Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TranslatePanorama.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
22 #include "TranslatePanorama.h"
23 
24 
25 namespace HuginBase {
26 
28 void TranslatePanorama::translatePano(PanoramaData& panorama, const double x, const double y, const double z)
29 {
30 
31  for (unsigned int i = 0; i < panorama.getNrOfImages(); i++)
32  {
33  const SrcPanoImage & image = panorama.getImage(i);
34  double ix = image.getX();
35  double iy = image.getY();
36  double iz = image.getZ();
37 
38  // Don't update a variable linked to a variable we already updated.
39  SrcPanoImage copy = image;
40  #define conditional_set(variable, value) \
41  if (image.variable##isLinked())\
42  {\
43  unsigned int j = 0;\
44  while (j < i && !image.variable##isLinkedWith(panorama.getImage(j)))\
45  {\
46  j++;\
47  }\
48  if (j == i) copy.set##variable(value);\
49  } else {\
50  copy.set##variable(value);\
51  }
52  conditional_set(X, ix+x);
53  conditional_set(Y, iy+y);
54  conditional_set(Z, iz+z);
55 
56  panorama.setImage(i, copy);
57  panorama.imageChanged(i);
58  }
59 }
60 
61 
62 } //namespace
double X
#define conditional_set(variable, value)
virtual void setImage(std::size_t nr, const SrcPanoImage &img)=0
set a panorama image, counting starts with 0
static void translatePano(PanoramaData &panorama, const double x, const double y, const double z)
Model for a panorama.
Definition: PanoramaData.h:81
virtual const SrcPanoImage & getImage(std::size_t nr) const =0
get a panorama image, counting starts with 0
double Y
double Z
virtual void imageChanged(unsigned int imgNr)=0
mark image change for maintainance
virtual std::size_t getNrOfImages() const =0
number of images.
All variables of a source image.
Definition: SrcPanoImage.h:194