PanoCommand.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00024 #ifndef _Hgn1_PANOCOMMAND_H
00025 #define _Hgn1_PANOCOMMAND_H
00026 
00027 
00028 #include "Command.h"
00029 
00030 #include "panodata/Panorama.h"
00031 #include <panodata/StandardImageVariableGroups.h>
00032 
00033 namespace PanoCommand
00034 {
00039     class WXIMPEX CombinedPanoCommand : public PanoCommand
00040     {
00041     public:
00046         CombinedPanoCommand(HuginBase::Panorama & pano, std::vector<PanoCommand*> & commands)
00047             : PanoCommand(pano), commands(commands) { setName("multiple commands");};
00048         ~CombinedPanoCommand();
00049         virtual bool processPanorama(HuginBase::Panorama & pano);
00050     private:
00051         std::vector<PanoCommand*> commands;
00052     };
00053 
00055     class WXIMPEX NewPanoCmd : public PanoCommand
00056     {
00057     public:
00058         explicit NewPanoCmd(HuginBase::Panorama & pano) : PanoCommand(pano) { m_clearDirty = true; };
00059         virtual bool processPanorama(HuginBase::Panorama& pano);
00060         virtual std::string getName() const { return "new panorama"; };
00061     };
00062 
00064     class WXIMPEX AddImagesCmd : public PanoCommand
00065     {
00066     public:
00067         AddImagesCmd(HuginBase::Panorama & pano, const std::vector<HuginBase::SrcPanoImage> & images)
00068             : PanoCommand(pano), imgs(images) { };
00069         virtual bool processPanorama(HuginBase::Panorama& pano);
00070         virtual std::string getName() const { return "add images"; };
00071     private:
00072         std::vector<HuginBase::SrcPanoImage> imgs;
00073     };
00074 
00079     class WXIMPEX RemoveImageCmd : public PanoCommand
00080     {
00081     public:
00082         RemoveImageCmd(HuginBase::Panorama & p, unsigned int imgNr)
00083             : PanoCommand(p), imgNr(imgNr)
00084         { };
00085 
00086         virtual bool processPanorama(HuginBase::Panorama& pano);
00087         virtual std::string getName() const { return "remove image"; };
00088     private:
00089         unsigned int imgNr;
00090     };
00091 
00094     class WXIMPEX RemoveImagesCmd : public PanoCommand
00095     {
00096     public:
00097         RemoveImagesCmd(HuginBase::Panorama & p, HuginBase::UIntSet imgs) : PanoCommand(p), imgNrs(imgs) {};
00098         virtual bool processPanorama(HuginBase::Panorama& pano);
00099         virtual std::string getName() const { return "remove images"; };
00100     private:
00101         HuginBase::UIntSet imgNrs;
00102     };
00103 
00105     class WXIMPEX UpdateVariablesCmd : public PanoCommand
00106     {
00107     public:
00108         UpdateVariablesCmd(HuginBase::Panorama & p, const HuginBase::VariableMapVector & vars)
00109             : PanoCommand(p), vars(vars) {};
00110         virtual bool processPanorama(HuginBase::Panorama& pano);
00111         virtual std::string getName() const { return "update variables"; };
00112     private:
00113         HuginBase::VariableMapVector vars;
00114     };
00115 
00117     class WXIMPEX UpdateCPsCmd : public PanoCommand
00118     {
00119     public:
00120         UpdateCPsCmd(HuginBase::Panorama & p, const HuginBase::CPVector & cps, bool doUpdateCPError = true)
00121             : PanoCommand(p), cps(cps), updateCPError(doUpdateCPError)
00122         { };
00123         virtual bool processPanorama(HuginBase::Panorama& pano);
00124         virtual std::string getName() const { return "update control points"; };
00125     private:
00126         HuginBase::CPVector cps;
00127         bool updateCPError;
00128     };
00129 
00131     class WXIMPEX UpdateVariablesCPCmd : public PanoCommand
00132     {
00133     public:
00134         UpdateVariablesCPCmd(HuginBase::Panorama & p, const HuginBase::VariableMapVector & vars, const HuginBase::CPVector& cps)
00135             : PanoCommand(p), vars(vars), cps(cps)
00136         { };
00137         virtual bool processPanorama(HuginBase::Panorama& pano);
00138         virtual std::string getName() const { return "update variables and control points"; };
00139     private:
00140         HuginBase::VariableMapVector vars;
00141         HuginBase::CPVector cps;
00142     };
00143 
00145     class WXIMPEX UpdateVariablesCPSetCmd : public PanoCommand
00146     {
00147     public:
00148         UpdateVariablesCPSetCmd(HuginBase::Panorama & p, HuginBase::UIntSet imgs, const HuginBase::VariableMapVector & vars, const HuginBase::CPVector & cps)
00149             : PanoCommand(p), m_imgs(imgs), vars(vars), cps(cps)
00150         { };
00151         virtual bool processPanorama(HuginBase::Panorama& pano);
00152         virtual std::string getName() const { return "update variables and control points"; };
00153     private:
00154         HuginBase::UIntSet m_imgs;
00155         HuginBase::VariableMapVector vars;
00156         HuginBase::CPVector cps;
00157     };
00158 
00160     class WXIMPEX UpdateImageVariablesCmd : public PanoCommand
00161     {
00162     public:
00163         UpdateImageVariablesCmd(HuginBase::Panorama & p, unsigned int ImgNr, const HuginBase::VariableMap & vars)
00164             : PanoCommand(p), imgNr(ImgNr), vars(vars)
00165         { };
00166         virtual bool processPanorama(HuginBase::Panorama& pano);
00167         virtual std::string getName() const { return "update image variables"; };
00168     private:
00169         unsigned int imgNr;
00170         HuginBase::VariableMap vars;
00171     };
00172 
00174     class WXIMPEX UpdateImagesVariablesCmd : public PanoCommand
00175     {
00176     public:
00177         UpdateImagesVariablesCmd(HuginBase::Panorama & p, const HuginBase::UIntSet & change, const HuginBase::VariableMapVector & vars)
00178             : PanoCommand(p), change(change), vars(vars)
00179         { };
00180         virtual bool processPanorama(HuginBase::Panorama& pano);
00181         virtual std::string getName() const { return "update image variables"; }
00182     private:
00183         HuginBase::UIntSet change;
00184         HuginBase::VariableMapVector vars;
00185     };
00186 
00188     class WXIMPEX UpdateVariablesByParseExpression : public PanoCommand
00189     {
00190     public:
00191         UpdateVariablesByParseExpression(HuginBase::Panorama & p, const std::string& expression)
00192             : PanoCommand(p), m_expression(expression)
00193         { };
00194         virtual bool processPanorama(HuginBase::Panorama& pano);
00195         virtual std::string getName() const { return "update image variables by parsing expression"; }
00196     private:
00197         std::string m_expression;
00198     };
00199 
00201     class WXIMPEX UpdateOptimizeVectorCmd : public PanoCommand
00202     {
00203     public:
00204         UpdateOptimizeVectorCmd(HuginBase::Panorama &p, HuginBase::OptimizeVector optvec)
00205             : PanoCommand(p), m_optvec(optvec)
00206         { };
00207         virtual bool processPanorama(HuginBase::Panorama & pano);
00208         virtual std::string getName() const { return "update optimize vector"; }
00209     private:
00210         HuginBase::OptimizeVector m_optvec;
00211     };
00212 
00214     class WXIMPEX UpdateOptimizerSwitchCmd : public PanoCommand
00215     {
00216     public:
00217         UpdateOptimizerSwitchCmd(HuginBase::Panorama &p, int mode) : PanoCommand(p), m_mode(mode) { };
00218         virtual bool processPanorama(HuginBase::Panorama & pano);
00219         virtual std::string getName() const { return "update optimizer master switch"; }
00220     private:
00221         int m_mode;
00222     };
00223 
00225     class WXIMPEX UpdatePhotometricOptimizerSwitchCmd : public PanoCommand
00226     {
00227     public:
00228         UpdatePhotometricOptimizerSwitchCmd(HuginBase::Panorama &p, int mode) : PanoCommand(p), m_mode(mode) { };
00229         virtual bool processPanorama(HuginBase::Panorama & pano);
00230         virtual std::string getName() const { return "update photometric optimizer master switch"; }
00231     private:
00232         int m_mode;
00233     };
00234 
00236     class WXIMPEX SetVariableCmd : public PanoCommand
00237     {
00238     public:
00239         SetVariableCmd(HuginBase::Panorama & p, const HuginBase::UIntSet & images, const HuginBase::Variable & var)
00240             : PanoCommand(p), images(images), var(var)
00241         { };
00242         virtual bool processPanorama(HuginBase::Panorama& pano);
00243         virtual std::string getName() const { return "set image variable"; }
00244     private:
00245         HuginBase::UIntSet images;
00246         HuginBase::Variable var;
00247     };
00248 
00250     class WXIMPEX CenterPanoCmd : public PanoCommand
00251     {
00252     public:
00253         explicit CenterPanoCmd(HuginBase::Panorama & p) : PanoCommand(p) { };
00254         virtual bool processPanorama(HuginBase::Panorama& pano);
00255         virtual std::string getName() const { return "center panorama"; }
00256     };
00257 
00259     class WXIMPEX StraightenPanoCmd : public PanoCommand
00260     {
00261     public:
00262         explicit StraightenPanoCmd(HuginBase::Panorama & p) : PanoCommand(p) { };
00263         virtual bool processPanorama(HuginBase::Panorama& pano);
00264         virtual std::string getName() const { return "straighten panorama"; };
00265     };
00266 
00268     class WXIMPEX AddCtrlPointCmd : public PanoCommand
00269     {
00270     public:
00271         AddCtrlPointCmd(HuginBase::Panorama & p, const HuginBase::ControlPoint & cpoint)
00272             : PanoCommand(p), point(cpoint)
00273         {};
00274         virtual bool processPanorama(HuginBase::Panorama& pano);
00275         virtual std::string getName() const { return "add control point"; };
00276     private:
00277         HuginBase::ControlPoint point;
00278     };
00279 
00281     class WXIMPEX AddCtrlPointsCmd : public PanoCommand
00282     {
00283     public:
00284         AddCtrlPointsCmd(HuginBase::Panorama & p, const HuginBase::CPVector & cpoints)
00285             : PanoCommand(p), cps(cpoints)
00286         { }
00287         virtual bool processPanorama(HuginBase::Panorama& pano);
00288         virtual std::string getName() const { return "add control points"; };
00289     private:
00290         HuginBase::CPVector cps;
00291     };
00292 
00294     class WXIMPEX RemoveCtrlPointCmd : public PanoCommand
00295     {
00296     public:
00297         RemoveCtrlPointCmd(HuginBase::Panorama & p, unsigned int cpNr)
00298             : PanoCommand(p), pointNr(cpNr)
00299         { }
00300         virtual bool processPanorama(HuginBase::Panorama& pano);
00301         virtual std::string getName() const { return "remove control point"; };
00302     private:
00303         unsigned int pointNr;
00304     };
00305 
00307     class WXIMPEX RemoveCtrlPointsCmd : public PanoCommand
00308     {
00309     public:
00310         RemoveCtrlPointsCmd(HuginBase::Panorama & p, const HuginBase::UIntSet & points)
00311             : PanoCommand(p), m_points(points)
00312         { }
00313         virtual bool processPanorama(HuginBase::Panorama& pano);
00314         virtual std::string getName() const { return "remove control points"; };
00315     private:
00316         HuginBase::UIntSet m_points;
00317     };
00318 
00320     class WXIMPEX ChangeCtrlPointCmd : public PanoCommand
00321     {
00322     public:
00323         ChangeCtrlPointCmd(HuginBase::Panorama & p, unsigned int nr, HuginBase::ControlPoint point)
00324             : PanoCommand(p), pNr(nr), point(point)
00325         {};
00326         virtual bool processPanorama(HuginBase::Panorama& pano);
00327         virtual std::string getName() const { return "change control point"; };
00328     private:
00329         unsigned int pNr;
00330         HuginBase::ControlPoint point;
00331     };
00332 
00334     class WXIMPEX SetActiveImagesCmd : public PanoCommand
00335     {
00336     public:
00337         SetActiveImagesCmd(HuginBase::Panorama & p, HuginBase::UIntSet & active)
00338             : PanoCommand(p), m_active(active)
00339         { };
00340         virtual bool processPanorama(HuginBase::Panorama& pano);
00341         virtual std::string getName() const { return "change active images"; };
00342     private:
00343         HuginBase::UIntSet m_active;
00344     };
00345 
00347     class WXIMPEX SwapImagesCmd : public PanoCommand
00348     {
00349     public:
00350         SwapImagesCmd(HuginBase::Panorama & p, unsigned int i1, unsigned int i2)
00351             : PanoCommand(p), m_i1(i1), m_i2(i2)
00352         { };
00353         virtual bool processPanorama(HuginBase::Panorama& pano);
00354         virtual std::string getName() const { return "swap images"; };
00355     private:
00356         unsigned int m_i1;
00357         unsigned int m_i2;
00358     };
00359 
00361     class WXIMPEX MoveImageCmd : public PanoCommand
00362     {
00363     public:
00364         MoveImageCmd(HuginBase::Panorama & p, size_t i1, size_t i2)
00365             : PanoCommand(p), m_i1(i1), m_i2(i2)
00366         { };
00367         virtual bool processPanorama(HuginBase::Panorama& pano);
00368         virtual std::string getName() const { return "move images"; };
00369     private:
00370         unsigned int m_i1;
00371         unsigned int m_i2;
00372     };
00373 
00375     class WXIMPEX MergePanoCmd : public PanoCommand
00376     {
00377     public:
00378         MergePanoCmd(HuginBase::Panorama & p, HuginBase::Panorama & p2)
00379             : PanoCommand(p), newPano(p2)
00380         { };
00381         virtual bool processPanorama(HuginBase::Panorama& pano);
00382         virtual std::string getName() const { return "merge panorama"; };
00383     private:
00384         HuginBase::Panorama newPano;
00385     };
00386 
00389     class WXIMPEX UpdateSrcImageCmd : public PanoCommand
00390     {
00391     public:
00392         UpdateSrcImageCmd(HuginBase::Panorama & p, unsigned i, HuginBase::SrcPanoImage img)
00393             : PanoCommand(p), img(img), imgNr(i)
00394         { };
00395         virtual bool processPanorama(HuginBase::Panorama& pano);
00396         virtual std::string getName() const{ return "update source image"; };
00397     private:
00398         HuginBase::SrcPanoImage img;
00399         unsigned imgNr;
00400     };
00401 
00404     class WXIMPEX UpdateSrcImagesCmd : public PanoCommand
00405     {
00406     public:
00407         UpdateSrcImagesCmd(HuginBase::Panorama & p, HuginBase::UIntSet i, std::vector<HuginBase::SrcPanoImage> imgs)
00408             : PanoCommand(p), imgs(imgs), imgNrs(i)
00409         { };
00410         virtual bool processPanorama(HuginBase::Panorama& pano);
00411         virtual std::string getName() const { return "update source images"; };
00412     private:
00413         std::vector<HuginBase::SrcPanoImage> imgs;
00414         HuginBase::UIntSet imgNrs;
00415     };
00416 
00418     class WXIMPEX SetPanoOptionsCmd : public PanoCommand
00419     {
00420     public:
00421         SetPanoOptionsCmd(HuginBase::Panorama & p, const HuginBase::PanoramaOptions & opts)
00422             : PanoCommand(p), options(opts)
00423         { };
00424         virtual bool processPanorama(HuginBase::Panorama& pano);
00425         virtual std::string getName() const { return "set panorama options"; };
00426     private:
00427         HuginBase::PanoramaOptions options;
00428     };
00429 
00435     class WXIMPEX LoadPTProjectCmd : public PanoCommand
00436     {
00437     public:
00438         LoadPTProjectCmd(HuginBase::Panorama & p, const std::string  & filename, const std::string & prefix = "");
00439         virtual bool processPanorama(HuginBase::Panorama& pano);
00440         virtual std::string getName() const { return "load project"; };
00441     private:
00442         const std::string &filename;
00443         const std::string &prefix;
00444     };
00445 
00448     class WXIMPEX RotatePanoCmd : public PanoCommand
00449     {
00450     public:
00451         RotatePanoCmd(HuginBase::Panorama & p, double yaw, double pitch, double roll)
00452             : PanoCommand(p), y(yaw), p(pitch), r(roll)
00453         { };
00454         virtual bool processPanorama(HuginBase::Panorama& pano);
00455         virtual std::string getName() const { return "rotate panorama"; };
00456     private:
00457         double y, p, r;
00458     };
00459 
00462     class WXIMPEX TranslatePanoCmd : public PanoCommand
00463     {
00464     public:
00465         TranslatePanoCmd(HuginBase::Panorama & p, double TrX, double TrY, double TrZ)
00466             : PanoCommand(p), X(TrX), Y(TrY), Z(TrZ)
00467         { };
00468         virtual bool processPanorama(HuginBase::Panorama& pano);
00469         virtual std::string getName() const{ return "translate panorama"; };
00470     private:
00471         double X, Y, Z;
00472     };
00473 
00476     class WXIMPEX UpdateFocalLengthCmd : public PanoCommand
00477     {
00478     public:
00479         UpdateFocalLengthCmd(HuginBase::Panorama & p, HuginBase::UIntSet imgs, double newFocalLength)
00480             : PanoCommand(p), imgNrs(imgs), m_focalLength(newFocalLength)
00481         { };
00482         virtual bool processPanorama(HuginBase::Panorama& pano);
00483         virtual std::string getName() const { return "update focal length"; };
00484     private:
00485         HuginBase::UIntSet imgNrs;
00486         double m_focalLength;
00487     };
00488 
00491     class WXIMPEX UpdateCropFactorCmd : public PanoCommand
00492     {
00493     public:
00494         UpdateCropFactorCmd(HuginBase::Panorama & p, HuginBase::UIntSet imgs, double newCropFactor)
00495             : PanoCommand(p), imgNrs(imgs), m_cropFactor(newCropFactor)
00496         { };
00497         virtual bool processPanorama(HuginBase::Panorama& pano);
00498         virtual std::string getName() const { return "update crop factor"; };
00499     private:
00500         HuginBase::UIntSet imgNrs;
00501         double m_cropFactor;
00502     };
00503 
00506     class WXIMPEX ChangePartNumberCmd : public PanoCommand
00507     {
00508     public:
00509         ChangePartNumberCmd(HuginBase::Panorama & p, HuginBase::UIntSet image_numbers, std::size_t new_part_number,
00510             std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables)
00511             : PanoCommand(p), image_numbers(image_numbers), new_part_number(new_part_number),variables(variables)
00512         { };
00513         virtual bool processPanorama(HuginBase::Panorama& pano);
00514         virtual std::string getName() const { return "Change part number"; };
00515     private:
00516         HuginBase::UIntSet image_numbers;
00517         std::size_t new_part_number;
00518         std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables;
00519     };
00520 
00524     class WXIMPEX ChangePartImagesLinkingCmd : public PanoCommand
00525     {
00526     public:
00537         ChangePartImagesLinkingCmd(HuginBase::Panorama & p,
00538             HuginBase::UIntSet image_numbers, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> changeVariables,
00539             bool new_linked_state, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> groupVariables)
00540             : PanoCommand(p), image_numbers(image_numbers), changeVariables(changeVariables),
00541             new_linked_state(new_linked_state), groupVariables(groupVariables)
00542         { };
00543         virtual bool processPanorama(HuginBase::Panorama& pano);
00544         virtual std::string getName() const { return "Change image variable links"; };
00545     private:
00546         HuginBase::UIntSet image_numbers;
00547         std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> changeVariables;
00548         bool new_linked_state;
00549         std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> groupVariables;
00550     };
00551 
00554     class WXIMPEX LinkLensVarsCmd : public PanoCommand
00555     {
00556     public:
00557         LinkLensVarsCmd(HuginBase::Panorama & p, std::size_t lens_number, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables)
00558             : PanoCommand(p), lens_number(lens_number), variables(variables)
00559         { };
00560         virtual bool processPanorama(HuginBase::Panorama& pano);
00561         virtual std::string getName() const { return "Link lens variables"; };
00562     private:
00563         std::size_t lens_number;
00564         std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables;
00565     };
00566 
00568 #define image_variable( name, type, default_value )\
00569     class WXIMPEX ChangeImage##name##Cmd : public PanoCommand\
00570                 {\
00571     public:\
00572         ChangeImage##name##Cmd(HuginBase::Panorama & p,\
00573                                HuginBase::UIntSet image_numbers,\
00574                                type value)\
00575             :   PanoCommand(p),\
00576                 image_numbers(image_numbers),\
00577                 value(value)\
00578                         { };\
00579         virtual bool processPanorama(HuginBase::Panorama& pano);\
00580         virtual std::string getName() const { return "Change image's " #name; };\
00581     private:\
00582         HuginBase::UIntSet image_numbers;\
00583         type value;\
00584         };
00585 #include <panodata/image_variables.h>
00586 #undef image_variable
00587 
00591     class WXIMPEX NewPartCmd : public PanoCommand
00592     {
00593     public:
00601         NewPartCmd(HuginBase::Panorama & p, HuginBase::UIntSet image_numbers, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> vars)
00602             : PanoCommand(p), image_numbers(image_numbers), vars(vars)
00603         { }
00604         virtual bool processPanorama(HuginBase::Panorama& pano);
00605         virtual std::string getName() const { return "New Part"; };
00606     private:
00607         HuginBase::UIntSet image_numbers;
00608         std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> vars;
00609     };
00610 
00612     class WXIMPEX UpdateMaskForImgCmd : public PanoCommand
00613     {
00614     public:
00615         UpdateMaskForImgCmd(HuginBase::Panorama & p, unsigned int img, const HuginBase::MaskPolygonVector & mask)
00616             : PanoCommand(p), m_img(img), m_mask(mask)
00617         { };
00618         virtual bool processPanorama(HuginBase::Panorama& pano);
00619         virtual std::string getName() const { return "update mask"; };
00620     private:
00621         unsigned int m_img;
00622         HuginBase::MaskPolygonVector m_mask;
00623     };
00624 
00626     class WXIMPEX UpdateWhiteBalance : public PanoCommand
00627     {
00628     public:
00629         UpdateWhiteBalance(HuginBase::Panorama & p, double redFactor, double blueFactor)
00630             : PanoCommand(p), m_red(redFactor), m_blue(blueFactor)
00631         { };
00632         virtual bool processPanorama(HuginBase::Panorama& pano);
00633         virtual std::string getName() const { return "update global white balance"; };
00634     private:
00635         double m_red;
00636         double m_blue;
00637     };
00638 
00640     class WXIMPEX ResetToMeanExposure : public PanoCommand
00641     {
00642     public:
00643         explicit ResetToMeanExposure(HuginBase::Panorama & p) : PanoCommand(p) { };
00644         virtual bool processPanorama(HuginBase::Panorama& pano);
00645         virtual std::string getName() const { return "set exposure to mean exposure"; };
00646     };
00647 
00649     class WXIMPEX DistributeImagesCmd : public PanoCommand
00650     {
00651     public:
00652         explicit DistributeImagesCmd(HuginBase::Panorama & p) : PanoCommand(p) { };
00653         virtual bool processPanorama(HuginBase::Panorama& pano);
00654         virtual std::string getName() const { return "distribute images"; };
00655     };
00656 
00657 
00658 } // namespace PanoCommand
00659 
00660 #endif // _PANOCOMMAND_H

Generated on 20 Apr 2018 for Hugintrunk by  doxygen 1.4.7