]> Creatis software - creaMaracasVisu.git/commitdiff
Creatiation of the factory of contours
authorromanello <romanello>
Mon, 15 Feb 2010 13:03:47 +0000 (13:03 +0000)
committerromanello <romanello>
Mon, 15 Feb 2010 13:03:47 +0000 (13:03 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.h [new file with mode: 0644]

diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp
new file mode 100644 (file)
index 0000000..2e713ca
--- /dev/null
@@ -0,0 +1,351 @@
+#include "creaContoursFactory.h"
+
+creaContoursFactory::creaContoursFactory()
+{
+
+}
+
+
+creaContoursFactory::~creaContoursFactory()
+{
+
+}
+
+manualContourBaseControler* creaContoursFactory::getContourControler(int typeContour)
+{
+       manualContourBaseControler *manContourControl;
+       //spline
+       if (typeContour==1)
+       {
+               manContourControl       = new manualContourControler();
+       }
+
+       //rectangle
+       if (typeContour==2)
+       {
+               manContourControl       = new manualRoiControler();
+       }
+
+       //circle
+       if (typeContour==3)
+       {
+               manContourControl       = new manualCircleControler();
+       }
+
+       //bullEye
+       if (typeContour==4)
+       {
+               manContourControl       = new manualRoiControler();
+       }
+
+       //line
+       if (typeContour==6)
+       {
+               manContourControl       = new manualLineControler();
+       }
+
+       //points
+       if (typeContour==7)
+       {
+               manContourControl       = new manualContourControler();
+       }
+
+       //rotationTool
+       if (typeContour==8)
+       {
+               manContourControl       = new manualRotationToolControler();
+       }
+       
+       //polygon
+       if (typeContour==10)
+       {
+               manContourControl       = new manualContourControler();
+       }
+       return manContourControl;
+
+       
+
+}
+
+manualContourBaseControler* creaContoursFactory::getContourControler(std::string typeContour)
+{
+       manualContourBaseControler *manContourControl;
+       if (typeContour.compare("spline")==0)
+       {
+                       manContourControl = getContourControler(1);
+       }
+
+       if (typeContour.compare("rectangle")==0)
+       {
+               manContourControl = getContourControler(2);
+       }
+
+       if (typeContour.compare("circle")==0)
+       {
+               manContourControl = getContourControler(3);
+       }
+
+       if (typeContour.compare("bullEye")==0)
+       {
+               manContourControl = getContourControler(4);
+       }
+
+       if (typeContour.compare("line")==0)
+       {
+               manContourControl = getContourControler(6);
+       }
+       
+       if (typeContour.compare("points")==0)
+       {
+               manContourControl = getContourControler(7);
+       }
+
+       if (typeContour.compare("rotationTool")==0)
+       {
+               manContourControl = getContourControler(8);
+       }
+       
+       if (typeContour.compare("polygon")==0)
+       {
+               manContourControl       =  getContourControler(10);
+       }
+
+       return manContourControl;
+}
+
+manualViewBaseContour* creaContoursFactory::getCountourView (int typeContour)
+{
+       
+       manualViewBaseContour *manViewerContour;
+       //spline
+       if (typeContour==1)
+       {
+               manViewerContour        = new manualViewContour();
+       }
+
+       //rectangle
+       if (typeContour==2)
+       {
+               manViewerContour        = new manualViewRoi();
+       }
+
+       //circle
+       if (typeContour==3)
+       {
+               manViewerContour        = new manualViewCircle();
+       }
+
+       //bullEye
+       if (typeContour==4)
+       {
+               manViewerContour        = new manualViewBullEye();
+       }
+
+       //line
+       if (typeContour==6)
+       {
+               manViewerContour        = new manualViewLine();
+       }
+       
+       //points
+       if (typeContour==7)
+       {
+               manViewerContour        = new manualViewPoints();
+       }
+
+       //rotationTool
+       if (typeContour==8)
+       {
+               manViewerContour        = new manualViewRotationTool();
+       }
+
+       //polygon
+       if (typeContour==10)
+       {
+               manViewerContour        = new manualViewContour();
+       }
+       return manViewerContour;
+}
+
+manualViewBaseContour* creaContoursFactory::getCountourView (std::string typeContour)
+{
+
+       manualViewBaseContour *manViewerContour;
+
+       if (typeContour.compare("spline")==0)
+       {
+               manViewerContour = getCountourView(1);
+       }
+
+       if (typeContour.compare("rectangle")==0)
+       {
+               manViewerContour = getCountourView(2);
+       }
+
+       if (typeContour.compare("circle")==0)
+       {
+               manViewerContour = getCountourView(3);
+       }
+
+       if (typeContour.compare("bullEye")==0)
+       {
+               manViewerContour = getCountourView(4);
+       }
+
+       if (typeContour.compare("line")==0)
+       {
+               manViewerContour = getCountourView(6);
+       }
+       
+       if (typeContour.compare("points")==0)
+       {
+               manViewerContour = getCountourView(7);
+       }
+
+       if (typeContour.compare("rotationTool")==0)
+       {
+               manViewerContour = getCountourView(8);
+       }
+
+       if (typeContour.compare("polygon")==0)
+       {
+               manViewerContour = getCountourView(10);
+       }
+       return manViewerContour;
+
+}
+
+manualBaseModel* creaContoursFactory::getContourModel(int typeContour)
+{
+       manualBaseModel *manModelContour=NULL;
+
+       // spline
+       if (typeContour==1)
+       {
+               manModelContour = new manualContourModel();
+       }
+
+       // rectangle
+       if (typeContour==2)
+       {
+               manModelContour = new manualContourModelRoi();
+       }
+
+       // circle
+       if (typeContour==3)
+       {
+               manModelContour = new manualContourModelCircle();
+       }
+
+       //bullEye
+       if(typeContour==4)
+       {
+               //Here we create a bullEye with 3 crowns and 5 sectors.
+               manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
+                       
+               int iCrown,sizeCrowns,iSector,sizeSectors;
+               double radioA,radioB,ang,angDelta,radioA2,radioB2 ;
+
+               sizeCrowns = 3;
+               radioA=33;
+               radioB=0;
+               angDelta= 72;
+               for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
+               {
+                       sizeSectors = 5;
+                       radioB  = radioA;
+                       if (iCrown==sizeCrowns-1)
+                       {
+                               radioA  = 0;
+                       } 
+                       else 
+                       {
+                               radioA  = radioA+33;
+                       }
+                       radioA2=radioA/100.0;
+                       radioB2=radioB/100.0;
+                       ang=0;
+                       for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
+                       {               
+                               ang     = ang+angDelta;
+                               manModelContourBullEye->AddSector(radioA2,radioB2,ang,angDelta);
+                       } // for iSector
+               }//for iCrown
+               manModelContour         = manModelContourBullEye;
+       }
+
+       // line
+       if (typeContour==6)
+       {
+               manModelContour = new manualContourModelLine();
+       }
+       
+       // points
+       if (typeContour==7)
+       {
+               manModelContour = new manualBaseModel();
+       }
+
+       //rotationTool
+       if(typeContour==8)
+       {
+               manModelContour = new manualContourModelRotationTool();
+       }
+
+       //polygon
+       if(typeContour==10)
+       {
+               manModelContour = new manualContourModelPolygon();
+       }
+
+       return manModelContour;
+}
+
+
+manualBaseModel* creaContoursFactory::getContourModel(std::string typeContour)
+{
+       manualBaseModel *manModelContour=NULL;
+
+       if (typeContour.compare("spline")==0)
+       {
+               manModelContour = getContourModel(1);
+       }
+
+       if (typeContour.compare("rectangle")==0)
+       {
+               manModelContour = getContourModel(2);
+       }
+
+       if (typeContour.compare("circle")==0)
+       {
+               manModelContour = getContourModel(3);
+       }
+
+       if (typeContour.compare("bullEye")==0)
+       {
+               manModelContour = getContourModel(4);
+       
+       }
+
+       if (typeContour.compare("line")==0)
+       {
+               manModelContour = getContourModel(6);
+       }
+       
+       if (typeContour.compare("points")==0)
+       {
+               manModelContour = getContourModel(7);
+       }
+
+       if (typeContour.compare("rotationTool")==0)
+       {
+               manModelContour = getContourModel(8);
+       }
+       
+       if (typeContour.compare("polygon")==0)
+       {
+               manModelContour = getContourModel(10);
+       }
+
+       return manModelContour;
+}
\ No newline at end of file
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.h
new file mode 100644 (file)
index 0000000..b5ab354
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef creaContoursFactory_h
+#define creaContoursFactory_h
+
+#include "manualContourControler.h"
+#include "manualBaseModel.h"
+#include "manualViewBaseContour.h"
+#include "manualCircleControler.h"
+#include "manualContourModelCircle.h"
+#include "manualViewCircle.h"
+#include "manualLineControler.h"
+#include "manualContourModelLine.h"
+#include "manualViewLine.h"
+#include "manualRoiControler.h"
+#include "manualViewRoi.h"
+#include "manualContourModelRoi.h"
+#include "manualViewBullEye.h"
+#include "manualContourModelBullEye.h"
+#include "manualViewPoints.h"
+#include "manualRotationToolControler.h"
+#include "manualContourModelRotationTool.h"
+#include "manualViewRotationTool.h"
+#include "manualContourModelPolygon.h"
+
+class creaMaracasVisu_EXPORT creaContoursFactory
+{
+
+//--------------------------- virtual ~manualBaseModel();------------------------
+// PUBLIC METHODS & ATTS
+//---------------------------------------------------
+
+       public:
+               creaContoursFactory();
+               virtual ~creaContoursFactory();
+
+               /* Creates the controler of the contour given the number of the contour*/
+               manualContourBaseControler* getContourControler(int typeContour);
+
+               /* Creates the controler of the contour given the name of the contour*/
+               manualContourBaseControler* getContourControler(std::string typeContour);
+
+               /* Creates the model of the contour given the number of the contour*/
+               manualBaseModel* getContourModel(int typeContour);
+
+               /* Creates the model of the contour given the name of the contour*/
+               manualBaseModel* getContourModel(std::string typeContour);
+
+               /* Creates the viewer of the contour given the number of the contour*/
+               manualViewBaseContour* getCountourView(int typeContour);
+
+               /* Creates the viezer of the contour given the name of the contour*/
+               manualViewBaseContour* getCountourView(std::string typeContour);                
+};
+
+#endif
\ No newline at end of file