1 // -*- c-basic-offset: 4 -*-
2 /** @file PanoramaMemento.h
3  *
4  *  @author Pablo d'Angelo <pablo.dangelo@web.de>
5  *
6  *  $Id$
7  *
8  *  This is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU General Public
10  *  License as published by the Free Software Foundation; either
11  *  version 2 of the License, or (at your option) any later version.
12  *
13  *  This software is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public
19  *  License along with this software. If not, see
20  *  <http://www.gnu.org/licenses/>.
21  *
22  */
23 
24 
25 #include "ControlPoint.h"
26 
27 
28 namespace HuginBase {
29 
30 
operator ==(const ControlPoint & o) const31 bool ControlPoint::operator==(const ControlPoint & o) const
32 {
33     return (image1Nr == o.image1Nr &&
34             image2Nr == o.image2Nr &&
35             x1 == o.x1 && y1 == o.y1 &&
36             x2 == o.x2 && y2 == o.y2 &&
37             mode == o.mode &&
38             error == o.error);
39 }
40 
41 
mirror()42 void ControlPoint::mirror()
43 {
44     unsigned int ti;
45     double td;
46     ti =image1Nr; image1Nr = image2Nr, image2Nr = ti;
47     td = x1; x1 = x2 ; x2 = td;
48     td = y1; y1 = y2 ; y2 = td;
49 }
50 
getCPString() const51 const std::string ControlPoint::getCPString() const
52 {
53     std::ostringstream s;
54     s << mode;
55     if(image1Nr<=image2Nr)
56     {
57         s << " " << image1Nr << ": " << x1 << "," << y1 << "|" << image2Nr << ": " << x2 << "," <<y2;
58     }
59     else
60     {
61         s << " " << image2Nr << ": " << x2 << "," << y2 << "|" << image1Nr << ": " << x1 << "," <<y1;
62     }
63     return s.str();
64 };
65 
66 } // namespace
67