33 : m_variables (variables),
62 std::size_t part)
const
79 bool found_first =
false;
82 #define image_variable( name, type, default_value )\
84 for (std::size_t imageNr = 0; imageNr < m_pano.getNrOfImages(); imageNr++)\
86 if (m_image_part_numbers[imageNr] == part)\
91 if (m_pano.getImage(imageNr).name##isLinked())\
102 #undef image_variable
120 #define image_variable( name, type, default_value )\
122 m_pano.unlinkImageVariable##name(i);\
125 #undef image_variable
133 unsigned int imageNr)
143 bool found_first_image =
false;
144 int first_image_number;
150 if (!found_first_image)
152 first_image_number = i;
153 found_first_image =
true;
159 #define image_variable( name, type, default_value )\
161 m_pano.linkImageVariable##name(first_image_number, i);\
164 #undef image_variable
172 unsigned int imageNr)
184 DEBUG_TRACE(
"Switching image " << imageNr <<
" to part " << partNr);
187 DEBUG_ERROR(
"Request to switch an image to a nonexistent part." );
191 unsigned int part_image_index;
192 for (part_image_index = 0;
m_image_part_numbers[part_image_index] != partNr; part_image_index++);
196 std::set<ImageVariableEnum> linked_variables;
201 #define image_variable( name, type, default_value ) \
203 if(m_pano.getImage(part_image_index).name##isLinked())\
205 linked_variables.insert(IVE_##name);\
209 #undef image_variable
215 bool singular = linked_variables.empty();
226 #define image_variable( name, type, default_value ) \
228 m_pano.unlinkImageVariable##name(imageNr);\
231 #undef image_variable
236 for(std::set<ImageVariableEnum>::iterator i = linked_variables.begin(); i != linked_variables.end(); ++i)
244 #define image_variable( name, type, default_value ) \
246 m_pano.linkImageVariable##name(part_image_index, imageNr);\
249 #undef image_variable
276 if (
m_pano.getNrOfImages() == 0)
286 std::vector<std::size_t> parts_first_image;
288 parts_first_image.push_back(0);
296 std::size_t part_number = parts_first_image.size();;
297 for (std::size_t j = 0; j < parts_first_image.size(); j++)
300 for (std::set<ImageVariableEnum>::const_iterator k =
m_variables.begin();
301 (k !=
m_variables.end()) && (part_number != j); ++k)
308 #define image_variable( name, type, default_value ) \
310 if (m_pano.getImage(i).name##isLinkedWith(m_pano.getImage(parts_first_image[j]))) \
314 #undef image_variable
321 if (part_number == parts_first_image.size())
323 parts_first_image.push_back(i);
std::set< ImageVariableEnum > m_variables
The set of variables which make up this group.
bool getVarLinkedInPart(ImageVariableEnum variable, std::size_t part) const
Get the linked status of a particular variable for a given part number.
void linkVariableImage(ImageVariableEnum variable, unsigned int imageNr)
link one of the variables across a part containing a given image
std::vector< UIntSet > UIntSetVector
const PanoramaData & m_pano
The panorama this group works on.
unsigned int getPartNumber(unsigned int imageNr) const
Get a part number from an image number.
#define DEBUG_ASSERT(cond)
Declare the ImageVariableGroup and ImageVariableGroupObserver classes.
void linkVariablePart(ImageVariableEnum variable, unsigned int partNr)
link one of the variables across a given part
virtual ~ConstImageVariableGroup()
destructor
std::set< unsigned int > UIntSet
UIntSetVector getPartsSet() const
return a vector which contains a HuginBase::UIntSet for each group with the corresponding images numb...
ConstImageVariableGroup(std::set< ImageVariableEnum > variables, const PanoramaData &pano)
constructor
void unlinkVariablePart(ImageVariableEnum variable, unsigned int partNr)
unlink one of the variables across a given part.
std::vector< unsigned int > m_image_part_numbers
The part numbers for each image.
void setPartNumbers()
Set the part numbers in m_image_part_numbers, and notify observers of changes.
void unlinkVariableImage(ImageVariableEnum variable, unsigned int imageNr)
unlink one the variables across the part containing a given image.
void updatePartNumbers()
Update the part numbers, call this when the panorama changes.
virtual void imageChanged(unsigned int imgNr)=0
mark image change for maintainance
virtual std::size_t getNrOfImages() const =0
number of images.
std::size_t getNumberOfParts() const
get the number of parts.
void switchParts(unsigned int ImageNr, unsigned int partNr)
switch a given image to a different part number.
This file specifies what image variables SrcPanoImg should have.