]> Creatis software - creaMaracasVisu.git/commitdiff
no message
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Fri, 3 Feb 2012 07:03:46 +0000 (07:03 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Fri, 3 Feb 2012 07:03:46 +0000 (07:03 +0000)
13 files changed:
bbtk/src/bbcreaMaracasVisuTubeFilter.cxx
bbtk/src/bbcreaMaracasVisuTubeFilter.h
bbtk/src/bbcreaMaracasVisuTubeTreeFilter.cxx
bbtk/src/bbcreaMaracasVisuTubeTreeFilter.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx

index 16441924a4e790b274dd027b7d2054fa4e3ecb3c..995c58d0fa086867a172f81cd0b321377b7e620e 100644 (file)
@@ -55,6 +55,13 @@ namespace bbcreaMaracasVisu
                this->lstPointZ = lstPointZ;
        }
        
+       
+       void MaracasTubeFilter::SetlstColour( std::vector<double> lstColour  )
+       {
+               this->lstColour=lstColour;
+       }
+
+       
        void MaracasTubeFilter::SetlstRadius( std::vector<double> lstRadius  )
        {
                this->lstRadius = lstRadius;
@@ -77,6 +84,8 @@ namespace bbcreaMaracasVisu
        
        void MaracasTubeFilter::Run()
        {
+               
+               
                unsigned int i;
                unsigned int nTv = 8;       // No. of surface elements for each tube vertex             
                
@@ -87,23 +96,20 @@ namespace bbcreaMaracasVisu
                        points->InsertPoint(i, lstPointX[i],  lstPointY[i],  lstPointZ[i]);
                }
                
-               vtkSmartPointer<vtkCellArray> lines =
-               vtkSmartPointer<vtkCellArray>::New();
+               vtkSmartPointer<vtkCellArray> lines =   vtkSmartPointer<vtkCellArray>::New();
                lines->InsertNextCell( lstPointX.size() );
                for (i = 0; i < lstPointX.size(); i++)
                {
                        lines->InsertCellPoint(i);
                }
                
-               vtkSmartPointer<vtkPolyData> polyData =
-               vtkSmartPointer<vtkPolyData>::New();
+               vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
                polyData->SetPoints(points);
                polyData->SetLines(lines);
                
 
                // Varying tube radius using sine-function
-               vtkSmartPointer<vtkDoubleArray> tubeRadius =
-               vtkSmartPointer<vtkDoubleArray>::New();
+               vtkSmartPointer<vtkDoubleArray> tubeRadius = vtkSmartPointer<vtkDoubleArray>::New();
                tubeRadius->SetName("TubeRadius");
                tubeRadius->SetNumberOfTuples( lstRadius.size() );
                for (i=0 ;i<lstRadius.size() ; i++)
@@ -115,25 +121,33 @@ namespace bbcreaMaracasVisu
                
                // RBG array (could add Alpha channel too I guess...)
                // Varying from blue to red
-               vtkSmartPointer<vtkUnsignedCharArray> colors =
-               vtkSmartPointer<vtkUnsignedCharArray>::New();
+               vtkSmartPointer<vtkUnsignedCharArray> colors = vtkSmartPointer<vtkUnsignedCharArray>::New();
                colors->SetName("Colors");
                colors->SetNumberOfComponents(3);
                colors->SetNumberOfTuples( lstPointX.size() );
+               int numberOfColours = lstColour.size()/3;
+               int indexcolour;
                for (i = 0; i < lstPointX.size() ;i++)
-               {
-                       colors->InsertTuple3(i, 255 , 0.0 , 0.0 );
-               }
+               {                       
+                       if (numberOfColours==0){
+                               colors->InsertTuple3(i, 1 ,  1 ,  1 );
+                       } else {
+                               if (i<numberOfColours){
+                                       indexcolour=i*3;
+                               } else {
+                                       indexcolour=(numberOfColours-1)*3;
+                               }
+                               colors->InsertTuple3(i, 255*lstColour[indexcolour+0] ,  255*lstColour[indexcolour+1] ,  255*lstColour[indexcolour+2] );
+                       }
+               } // for
                polyData->GetPointData()->AddArray(colors);
                
-               vtkSmartPointer<vtkTubeFilter> tube
-               = vtkSmartPointer<vtkTubeFilter>::New();
+               vtkSmartPointer<vtkTubeFilter> tube = vtkSmartPointer<vtkTubeFilter>::New();
                tube->SetInput(polyData);
                tube->SetNumberOfSides(nTv);
                tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();
                
-               vtkSmartPointer<vtkPolyDataMapper> mapper =
-               vtkSmartPointer<vtkPolyDataMapper>::New();
+               vtkSmartPointer<vtkPolyDataMapper> mapper =     vtkSmartPointer<vtkPolyDataMapper>::New();
                mapper->SetInputConnection(tube->GetOutputPort());
                mapper->ScalarVisibilityOn();
                mapper->SetScalarModeToUsePointFieldData();
@@ -144,7 +158,6 @@ namespace bbcreaMaracasVisu
                actor->SetMapper(mapper);
                actor->GetProperty()->SetOpacity( opacity );
 
-               
                if ( transform!=NULL )
                {
                        actor->SetUserTransform( transform );
@@ -194,6 +207,7 @@ void TubeFilter::Process()
        tubefilter->SetlstRadius( bbGetInputlstRadio() );
        tubefilter->SetOpacity( bbGetInputOpacity() );
        tubefilter->SetTransform( bbGetInputTransform() );      
+       tubefilter->SetlstColour( bbGetInputColour() ); 
        tubefilter->Run();
     bbSetOutputOutAxis( tubefilter->GetActor() );      
        printf("EED TubeFilter::Process end \n");
@@ -208,7 +222,15 @@ void TubeFilter::bbUserSetDefaultValues()
 //    Here we initialize the input 'In' to 0
        bbSetInputOpacity(1);
        bbSetInputTransform(NULL);
-
+       
+       std::vector<double> colour;
+       // 0- gray
+       colour.push_back(1.0);
+       colour.push_back(0.0);
+       colour.push_back(0.0);
+       bbSetInputColour(colour);
+       
+       
 }
        
 //===== 
index c23d1fa279a6126018cf309f6d6a3f82025ab69b..993f10f8b74fc458749f77ec9e5aacf3800c5527 100644 (file)
@@ -26,6 +26,7 @@ namespace bbcreaMaracasVisu
                void SetvtkRenderer( vtkRenderer *render);
                void SetlstPoints( std::vector<double> lstPointX , std::vector<double> lstPointY , std::vector<double> lstPointZ );
                void SetlstRadius( std::vector<double> lstRadius  );
+               void SetlstColour( std::vector<double> lstColour  );
                void SetOpacity(double opacity);
                void SetTransform( vtkLinearTransform* transform  );
                vtkActor *GetActor();
@@ -40,6 +41,7 @@ namespace bbcreaMaracasVisu
                std::vector<double> lstPointY;
                std::vector<double> lstPointZ;
                std::vector<double> lstRadius;
+               std::vector<double> lstColour;
 
        };
 
index 8f2a3ce5b96a44cd26d1a401feb3b34d085db377..f431595c9a0219e8dfaa7f353ec610c69b953359 100644 (file)
 #include <vtkPointData.h>
 #include <vtkTubeFilter.h>
 #include <vtkSphereSource.h>
+#include "vtkObjectFactory.h"
 
 
+       
+       vtkStandardNewMacro(vtkLookupTableEED);
+       
+       // Construct with range=(0,1); and hsv ranges set up for rainbow color table 
+       // (from red to blue).
+       vtkLookupTableEED::vtkLookupTableEED(int sze, int ext)
+       {
+               this->TableRange[0] = 0.0;
+               this->TableRange[1] = 1.0;
+       }
+       
+       //----------------------------------------------------------------------------
+       vtkLookupTableEED::~vtkLookupTableEED()
+       {
+       }
+       
+       
+       
+       unsigned char *vtkLookupTableEED::MapValue(double v)
+       {
+               
+               //int idx = this->GetIndex(v);
+               //return (this->Table->GetPointer(0) + 4*idx);
+               
+               return 0;
+       }
+       
+       void vtkLookupTableEED::GetColor(double v, double rgb[3])
+       {
+               //      unsigned char *rgb8 = this->MapValue(v);
+               //      rgb[0] = rgb8[0]/255.0;
+               //      rgb[1] = rgb8[1]/255.0;
+               //      rgb[2] = rgb8[2]/255.0;
+               
+               rgb[0] = 1;
+               rgb[1] = 1;
+               rgb[2] = 0;
+       }
+       
+       
+       void vtkLookupTableEED::SetTableRange(double r[2])
+       {
+               this->SetTableRange(r[0],r[1]);
+       }
+       
+       //----------------------------------------------------------------------------
+       // Set the minimum/maximum scalar values for scalar mapping. Scalar values
+       // less than minimum range value are clamped to minimum range value.
+       // Scalar values greater than maximum range value are clamped to maximum
+       // range value.
+       void vtkLookupTableEED::SetTableRange(double rmin, double rmax)
+       {
+               if (rmax < rmin)
+               {
+                       vtkErrorMacro("Bad table range: ["<<rmin<<", "<<rmax<<"]");
+                       return;
+               }
+               
+               if (this->TableRange[0] == rmin && this->TableRange[1] == rmax)
+               {
+                       return;
+               }
+               
+               this->TableRange[0] = rmin;
+               this->TableRange[1] = rmax;
+               
+               this->Modified();
+       }
+       
+       
+       
+       //----------------------------------------------------------------------------
+       // Although this is a relatively expensive calculation,
+       // it is only done on the first render. Colors are cached
+       // for subsequent renders.
+       template<class T>
+       void vtkLookupTableMapDirVectorEED(vtkLookupTableEED *self, T *input, 
+                                                                          unsigned char *output, int length, 
+                                                                          int inIncr, int outFormat)
+       {
+               double tmp,sum;
+               //      double *mag;
+               int i, j;
+               double dirx,diry,dirz;
+               
+               
+               printf("EED length %d  %p\n", length,input);
+               //      mag = new double[length];
+               for (i = 0; i < length; ++i)
+               {
+                       dirx    = 0;
+                       diry    = 0;
+                       dirz    = 0;
+                       sum             = 0;
+                       for (j = 0; j < inIncr; ++j)
+                       {
+                               if (j==0) dirx= static_cast<double>(*input);  
+                               if (j==1) diry= static_cast<double>(*input);  
+                               if (j==2) dirz= static_cast<double>(*input);  
+                               tmp = static_cast<double>(*input);  
+                               sum += (tmp * tmp);
+                               ++input;
+                       }
+                       sum=sqrt(sum);
+                       *output++ = (unsigned char) abs( (255*dirx/sum) );
+                       *output++ = (unsigned char) abs( (255*diry/sum) );
+                       *output++ = (unsigned char) abs( (255*dirz/sum) );
+                       *output++ = 255;
+                       //              printf("%d %d %d   ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum));
+               }
+               
+               //      vtkLookupTableMapData(self, mag, output, length, 1, outFormat);
+               
+               //      delete [] mag;
+       }
+       
+       
+       
+       //----------------------------------------------------------------------------
+       void vtkLookupTableEED::MapScalarsThroughTable2(void *input, 
+                                                                                                       unsigned char *output,
+                                                                                                       int inputDataType, 
+                                                                                                       int numberOfValues,
+                                                                                                       int inputIncrement,
+                                                                                                       int outputFormat)
+       {
+               
+               printf("vtkLookupTableEED::MapScalarsThroughTable2 inputIncrement=%d   inputDataType=%d\n",inputIncrement,inputDataType);
+               
+               
+               //      if (this->UseMagnitude && inputIncrement > 1)
+               //  {
+               switch (inputDataType)
+               {
+                               vtkTemplateMacro(
+                                                                vtkLookupTableMapDirVectorEED(this,static_cast<VTK_TT*>(input),output,
+                                                                                                                          numberOfValues,inputIncrement,outputFormat);
+                                                                return
+                                                                );                             
+                       case VTK_BIT:
+                               vtkErrorMacro("Cannot comput magnitude of bit array.");
+                               break;
+                       default:
+                               vtkErrorMacro(<< "MapImageThroughTable: Unknown input ScalarType");
+               }
+               //  }
+               
+       }  
+       
+       
+       //----------------------------------------------------------------------------
+       void vtkLookupTableEED::PrintSelf(ostream& os, vtkIndent indent)
+       {
+               this->Superclass::PrintSelf(os,indent); 
+       }
+       
+       
+       
+       
+       //----------------------------------
+       //----------------------------------
+       //----------------------------------
+       //----------------------------------
+       //----------------------------------
+       
+       
+       
 namespace bbcreaMaracasVisu
 {
+       
+       
 
+       
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,TubeTreeFilter)
 BBTK_BLACK_BOX_IMPLEMENTATION(TubeTreeFilter,bbtk::AtomicBlackBox);
 
@@ -98,17 +269,21 @@ void TubeTreeFilter::DrawOneTube(int iGeneral,int numPoints, int iTube)
        sphereActorEnd->SetPosition(bbGetInputlstPointX()[i]*spc[0], bbGetInputlstPointY()[i]*spc[1], bbGetInputlstPointZ()[i]*spc[2] );
 
        vtkSmartPointer<vtkTubeFilter> tube = vtkSmartPointer<vtkTubeFilter>::New();
-//EED  vtkTubeFilter *tube = vtkTubeFilter::New();
        tube->SetInput(polyData);
        tube->SetNumberOfSides(nTv);
        tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();
+       
+       vtkLookupTableEED* vLutEED                               = vtkLookupTableEED::New();
 
        vtkSmartPointer<vtkPolyDataMapper> mapper =     vtkSmartPointer<vtkPolyDataMapper>::New();
-//EED  vtkPolyDataMapper *mapper =     vtkPolyDataMapper::New();
        mapper->SetInputConnection(tube->GetOutputPort());
        mapper->ScalarVisibilityOn();
-       mapper->SetScalarModeToUsePointFieldData();
-
+       
+// EED fev 02/ 20112   
+       mapper->SetScalarModeToUsePointFieldData();     
+       mapper->SetLookupTable( vLutEED );
+       mapper->SelectColorArray( "points_axe" );
+       
        //              vtkSmartPointer<vtkActor> actor =vtkSmartPointer<vtkActor>::New();
     vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
        actor->SetMapper(mapper);
index d819ed715c76a9ab70c7a887a4b82c27b7dfec7b..f0a090e02fbc89fc7b6243fbfe767a33ec110f42 100644 (file)
 #include "vtkCellArray.h"
 #include "vtkProperty.h"
 #include "vtkLinearTransform.h"
+#include "vtkLookupTable.h"
+#include "vtkScalarsToColors.h"
+
+
+
+class /*VTK_COMMON_EXPORT*/ vtkLookupTableEED : public vtkScalarsToColors
+       {
+       public:
+               // Description:
+               // Construct with range=[0,1]; and hsv ranges set up for rainbow color table 
+               // (from red to blue).
+               static vtkLookupTableEED *New();
+               
+               vtkTypeMacro(vtkLookupTableEED,vtkScalarsToColors);
+               void PrintSelf(ostream& os, vtkIndent indent);
+               
+               double *GetRange() { return this->GetTableRange(); };
+               void SetRange(double min, double max) { this->SetTableRange(min, max); };
+               void SetRange(double rng[2]) { this->SetRange(rng[0], rng[1]); };
+               
+               void SetTableRange(double r[2]); 
+               virtual void SetTableRange(double min, double max);
+               vtkGetVectorMacro(TableRange,double,2);
+               
+               unsigned char *MapValue(double v);
+               
+               void GetColor(double x, double rgb[3]);
+               
+               void MapScalarsThroughTable2(void *input, unsigned char *output,
+                                                                        int inputDataType, int numberOfValues,
+                                                                        int inputIncrement, int outputIncrement);
+               
+               
+       protected:
+               
+               double TableRange[2];
+               vtkLookupTableEED(int sze=256, int ext=256);
+               ~vtkLookupTableEED();
+               
+               
+       private:
+               vtkLookupTableEED(const vtkLookupTableEED&);  // Not implemented.
+               void operator=(const vtkLookupTableEED&);  // Not implemented.
+};
+
+
+
 
 
 namespace bbcreaMaracasVisu
 {
+       
 
 class bbcreaMaracasVisu_EXPORT TubeTreeFilter
  :
index 8b8007143fd22d271c0368193fbb60861f1d17f0..97ffe0ad387a8cd243fa066eda3e520dae00d671 100644 (file)
@@ -67,6 +67,8 @@ void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *paren
 ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
 {
+       printf("EED ColorLayerImageViewPanel::ColorLayerImageViewPanel start \n");
+
        _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
        _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
 
index c6d8465096bfd21a7ec43484e7ed82244e2eef78..ea912f370f24b89fc98ff0180e781dcaffd58919 100644 (file)
@@ -25,7 +25,7 @@ ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor()
 //---------------------------------------------------------------------------------------------
 bool ColorLayerImageBasevtkInteractor::OnMouseMove()
 {
-
+       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove \n");
     if  (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
     {
         _layerImageBase->GetvtkImageReslice()->Modified();
@@ -94,10 +94,14 @@ void LayerImageBase::SetImage(vtkImageData* image)
 //----------------------------------------------------------------------------
 void LayerImageBase::SetwxVtkBaseView(wxVtkBaseView *baseview)
 {
+       printf("EED LayerImageBase::SetwxVtkBaseView start baseview:%p \n", baseview);
+
        _baseView = baseview;
 
     vtkInteractorStyleBaseView *isbv    = (vtkInteractorStyleBaseView*)(_baseView->GetInteractorStyleBaseView());
     isbv->AddInteractorStyleMaracas( new ColorLayerImageBasevtkInteractor(this) );
+       
+       printf("EED LayerImageBase::SetwxVtkBaseView end \n");
 }
 
 //----------------------------------------------------------------------------
@@ -145,7 +149,9 @@ int LayerImageBase::CleanZ(int z)
 //----------------------------------------------------------------------------
 void LayerImageBase::onThreshold()
 {
-
+       
+       printf("EED LayerImageBase::onThreshold start \n");
+       
        if ((_image!=NULL) && (_baseView!=NULL))
        {
                int z=CleanZ( GetZ() );
@@ -189,7 +195,12 @@ void LayerImageBase::onThreshold()
                _thresholdMapper->SetInput( img );
                _thresholdMapper->SetLookupTable( _thresholdTable );
                _thresholdActor->SetInput( _thresholdMapper->GetOutput() );
+
+               printf("EED LayerImageBase::onThreshold working \n");
+               
+               
                } // _image
+       printf("EED LayerImageBase::onThreshold end");
 }
 
 
index ccba053d156cdd2b3b8970d3f3b370ac4d56bba6..ab0af60cb3c1248b779044deaf6a9dc2c5a05b0f 100644 (file)
@@ -19,10 +19,9 @@ namespace creaButtonContainer
                ButtonGroupFactory::~ButtonGroupFactory( )
                {
                }
+               
                // ----------------------------------------------------------------------------------
-               ButtonGroupFactory::ButtonGroupContainer
-               ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,
-                   ButtonGroupModel* settings )
+               ButtonGroupFactory::ButtonGroupContainer ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,  ButtonGroupModel* settings )
                {
                        ButtonGroupContainer groupView;
                        try
@@ -31,11 +30,8 @@ namespace creaButtonContainer
                                for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
                                {
                                        wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
-                                       wxStaticText* wxGroupName = new wxStaticText( parent, -1,
-                                           groupNameAux, wxDefaultPosition, wxDefaultSize, 0,
-                                           _T("GroupText") );
-                                       ButtonGroup* group = new ButtonGroup( wxGroupName,
-                                           this->GetButtons( parent, ( *it ).second ) );
+                                       wxStaticText* wxGroupName = new wxStaticText( parent, -1, groupNameAux, wxDefaultPosition, wxDefaultSize, 0, _T("GroupText") );
+                                       ButtonGroup* group = new ButtonGroup( wxGroupName, this->GetButtons( parent, ( *it ).second ) );
                                        groupView.push_back( group );
                                }//rof
                        }//yrt
@@ -47,9 +43,9 @@ namespace creaButtonContainer
                        }//chtac
                        return ( groupView );
                }
+               
                // ----------------------------------------------------------------------------------
-               ButtonGroupFactory::ButtonContainer
-               ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
+               ButtonGroupFactory::ButtonContainer ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
                {
                        ButtonContainer buttonList;
                        try
@@ -68,7 +64,8 @@ namespace creaButtonContainer
                                    << "ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )"
                                    << "exception: " << e.what( ) << std::endl;
                        }//chtac
-                       return ( buttonList );   // JPR
+                       
+                       return ( buttonList );   // JPR
                }
        // ----------------------------------------------------------------------------------
        }//ecapseman
index 323e2a78813e4734f7f1e7bcae3e4b7c56bd6f94..901da6cd315cc4c896a6974075d2bf6073f7f3c5 100644 (file)
@@ -12,12 +12,12 @@ namespace creaButtonContainer
        namespace view
        {
                // ----------------------------------------------------------------------------------
-               Button::Button( wxWindow* parent, long id, ButtonPair* pair )
+               Button::Button( wxWindow* parent, long id, ButtonPair* pair )           
                {
-                       this->m_ButtonPair = pair;
-                       StringType wXbuttonName = this->m_ButtonPair->first->first;
-                       StringType wXiconPath = this->m_ButtonPair->first->second;
-                       StringType wXdescription = this->m_ButtonPair->second->first;
+                       this->m_ButtonPair                      = pair;
+                       StringType wXbuttonName         = this->m_ButtonPair->first->first;
+                       StringType wXiconPath           = this->m_ButtonPair->first->second;
+                       StringType wXdescription        = this->m_ButtonPair->second->first;
                        wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 );
                        wxString imageIcon( wXiconPath.c_str( ), wxConvUTF8 );
                        wxString description( wXdescription.c_str( ), wxConvUTF8 );
@@ -28,28 +28,33 @@ namespace creaButtonContainer
                            buttonName );
                        this->SetToolTip( description );
                }
+               
                // ----------------------------------------------------------------------------------
                Button::~Button( )
                {
                }
+               
                // ----------------------------------------------------------------------------------
                StringType
                Button::GetButtonName( )
                {
                        return ( this->m_ButtonPair->first->first );
                }
+               
                // ----------------------------------------------------------------------------------
                StringType
                Button::GetIconPath( )
                {
                        return ( this->m_ButtonPair->first->second );
                }
+               
                // ----------------------------------------------------------------------------------
                StringType
                Button::GetDescription( )
                {
                        return ( this->m_ButtonPair->second->first );
                }
+               
                // ----------------------------------------------------------------------------------
                void
                Button::Execute( )
index 93feebc7ec06c4079b986b78c0975ce28cc3cf62..15d2c0ee76fc4bce9b87254302cf59ed3a255e65 100644 (file)
@@ -17,51 +17,44 @@ namespace creaButtonContainer
                END_EVENT_TABLE()
 
                // ----------------------------------------------------------------------------------
-               ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent,
-                   ButtonGroupSettings* settings ) :
-                           wxScrolledWindow(
-                               parent,
-                               -1,
-                               wxDefaultPosition,
-                               wxDefaultSize,
-                               wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL
-                                   | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") )
+               ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings ) 
+               : wxScrolledWindow(parent,-1, wxDefaultPosition,wxDefaultSize, wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") )
                {
                        ButtonGroupFactory factory;
-                       this->SetGroupContainer(
-                           factory.CreateButtonGroupContainer( this, settings ) );
+                       this->SetGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
                        this->PanelInit( );
                        this->m_ButtonCController = new BCController( this );
                        this->m_ButtonCController->AddEvents( );
                        this->SetEventHandler( this->m_ButtonCController );
                }
+               
                // ----------------------------------------------------------------------------------
                ButtonContainerPanel::~ButtonContainerPanel( )
                {
                }
+               
                // ----------------------------------------------------------------------------------
-               void
-               ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer )
+               void ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer )
                {
                        this->m_ButtonGroupList = groupContainer;
                }
+               
                // ----------------------------------------------------------------------------------
-               void
-               ButtonContainerPanel::PanelInit( )
+               void ButtonContainerPanel::PanelInit( )
                {
                        try
                        {
+                               
+// EED 20/01/2012  flag 01
                                this->m_Sizer = new Sizer( 0, 1, 0, 0 );
-                               for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it
-                                   != this->m_ButtonGroupList.end( ); ++it )
+                               for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it != this->m_ButtonGroupList.end( ); ++it )
                                {
                                        GroupManager* manager = new GroupManager( this, *it );
                                        this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager;
                                        this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
-                                       std::cout << "creaButtonContainer: New ButtonGroup Sizer Added"
-                                           << std::endl;
                                }
                                this->SetSizer( this->m_Sizer );
+                               this->Layout( );
                                this->FitSizer( );
                        }//yrt
                        catch ( const std::exception& e )
@@ -70,9 +63,9 @@ namespace creaButtonContainer
                                    << e.what( ) << std::endl;
                        }//hctac
                }
+               
                // ----------------------------------------------------------------------------------
-               void
-               ButtonContainerPanel::FitSizer( )
+               void ButtonContainerPanel::FitSizer( )
                {
                        this->m_Sizer->Fit( this );
                        this->m_Sizer->FitInside( this );
index 6dfeaa87ed1453bd80460d098d06862405cac444..dd14a931abfc6d82c9c24b64834cf3c64753ec41 100644 (file)
@@ -12,28 +12,31 @@ namespace creaButtonContainer
        namespace view
        {
                // ----------------------------------------------------------------------------------
-               ButtonGroup::ButtonGroup( wxStaticText* groupName,
-                   ButtonContainer cartoButtons )
+               ButtonGroup::ButtonGroup( wxStaticText* groupName, ButtonContainer cartoButtons )
                {
                        this->m_GroupName = groupName;
                        this->m_Buttons = cartoButtons;
                }
+               
                // ----------------------------------------------------------------------------------
                ButtonGroup::~ButtonGroup( )
                {
                }
+               
                // ----------------------------------------------------------------------------------
                ButtonGroup::ButtonContainer
                ButtonGroup::GetButtonContainer( )
                {
                        return ( this->m_Buttons );
                }
+               
                // ----------------------------------------------------------------------------------
                wxStaticText*
                ButtonGroup::GetGroupName( )
                {
                        return ( this->m_GroupName );
                }
+               
                // ----------------------------------------------------------------------------------
                ButtonGroup::IdButtonContainer
                ButtonGroup::GetButtonIdContainer( )
@@ -54,6 +57,7 @@ namespace creaButtonContainer
                        }//hctac
                        return ( idContainer );
                }
+               
                // ----------------------------------------------------------------------------------
                Button*
                ButtonGroup::GetButton( long id )
index 8d00a5da0dc2feab29fa8cfe124291f8e934aecf..e788f82a0b5dffd3dbe608d1daaa0e6a96567248 100644 (file)
@@ -16,6 +16,8 @@ namespace creaButtonContainer
                        wxFlexGridSizer( 0, 1, 0, 0 )
                {
                }
+               
+//EED 20/01/2012  Flag03               
                // ----------------------------------------------------------------------------------
                ButtonManager::ButtonManager( ButtonGroup* buttonGroup ) :
                        wxFlexGridSizer( 0, 1, 0, 0 )
@@ -30,30 +32,31 @@ namespace creaButtonContainer
                                std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
                        }//hctac
                }
+               
                // ----------------------------------------------------------------------------------
                ButtonManager::~ButtonManager( )
                {
                }
+               
                // ----------------------------------------------------------------------------------
-               void
-               ButtonManager::SetGroupName( wxStaticText* groupName )
+               void ButtonManager::SetGroupName( wxStaticText* groupName )
                {
                        this->m_GroupName = groupName;
                        this->Add( this->m_GroupName, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
                }
+               
                // ----------------------------------------------------------------------------------
-               void
-               ButtonManager::SetButtonManager( ButtonContainer buttonContainer )
+               void ButtonManager::SetButtonManager( ButtonContainer buttonContainer )
                {
                        try
                        {
                                if ( this->m_GroupName != NULL )
                                {
                                        this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 );
-                                       for( ButtonContainer::iterator it = buttonContainer.begin( ); it
-                                           != buttonContainer.end( ); ++it )
-                                               this->m_GridSizer->Add( ( *it ).second, -1,
-                                                   wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
+                                       for( ButtonContainer::iterator it = buttonContainer.begin( ); it!= buttonContainer.end( ); ++it )
+                                       {
+                                               this->m_GridSizer->Add( ( *it ).second, -1,  wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
+                                       }
                                        this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
                                }//fi
                        }//yrt
index 86a461a1ed359e881d7c6be73487a252e0f3795c..116d48df7fe1da2dc40554dee272770abcc08ae9 100644 (file)
@@ -15,55 +15,61 @@ namespace creaButtonContainer
                GroupManager::GroupManager( wxWindow* parent, ButtonGroup* buttonGroup ) :
                        wxFlexGridSizer( 1, 0, 0, 0 )
                {
+//EED 20/01/2012  flag 02                      
                        this->m_IDExpButton = wxNewId( );
-                       this->m_ExpansionButton = new ExpansionButton( parent,
-                           this->m_IDExpButton, _("-"), wxDefaultPosition, wxSize( 20, 20 ), 0,
-                           wxDefaultValidator, _T("EXPBUTTON") );
+                       this->m_ExpansionButton = new ExpansionButton( parent, this->m_IDExpButton, _("-"), wxDefaultPosition, wxSize( 20, 20 ), 0, wxDefaultValidator, _T("EXPBUTTON") );
                        this->Add( m_ExpansionButton, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
                        this->m_ButtonManager = new ButtonManager( buttonGroup );
-                       this->Add( this->m_ButtonManager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP,
-                           5 );
+                       this->Add( this->m_ButtonManager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
                }
+               
                // ----------------------------------------------------------------------------------
                GroupManager::~GroupManager( )
                {
                }
+               
                // ----------------------------------------------------------------------------------
                long
                GroupManager::GetButtonID( )
                {
                        return ( this->m_IDExpButton );
                }
+               
                // ----------------------------------------------------------------------------------
                GroupManager::ExpansionButton*
                GroupManager::GetButton( )
                {
                        return ( this->m_ExpansionButton );
                }
+               
                // ----------------------------------------------------------------------------------
                ButtonManager*
                GroupManager::GetButtonManager( )
                {
                        return ( this->m_ButtonManager );
                }
+               
                // ----------------------------------------------------------------------------------
                void
                GroupManager::SetButtonID( long id )
                {
                        this->m_IDExpButton = id;
                }
+               
                // ----------------------------------------------------------------------------------
                void
                GroupManager::SetButton( ExpansionButton* button )
                {
                        this->m_ExpansionButton = button;
                }
+               
                // ----------------------------------------------------------------------------------
                void
                GroupManager::SetButtonManager( ButtonManager* container )
                {
                        this->m_ButtonManager = container;
                }
+               
                // ----------------------------------------------------------------------------------
                void
                GroupManager::HideSubPanel( bool hide )
index 7477a38afb1abb3f9d5969b9792188218238a2fc..9e77d001a742315363c8e8edff3ba9ba11e8ade1 100644 (file)
@@ -14,38 +14,28 @@ namespace creaPanelButtonContainer
        //*)
        END_EVENT_TABLE()
        // ----------------------------------------------------------------------------------
-       typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer >
-           TConcreteFunctor;
+       typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer >   TConcreteFunctor;
        // ----------------------------------------------------------------------------------
-       PanelButtonContainer::PanelButtonContainer( wxWindow* parent,
-           ButtonContainerSettings* bcSettings ) :
-                   wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize,
-                       wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") )
+       PanelButtonContainer::PanelButtonContainer( wxWindow* parent,  ButtonContainerSettings* bcSettings ) 
+               : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") )
        {
                this->m_ButtonContainerSettings = bcSettings;
                this->m_ButtonPanel = new wxPanel( this );
 
                //Class that manages the event!!!
-               TConcreteFunctor* functor = new TConcreteFunctor( this,
-                   &PanelButtonContainer::GenericButtonEvent );
+       //EED 20/01/2012
+               TConcreteFunctor* functor = new TConcreteFunctor( this, &PanelButtonContainer::GenericButtonEvent );
+//             TConcreteFunctor* functor = new TConcreteFunctor( this->m_ButtonPanel, &PanelButtonContainer::GenericButtonEvent );
                //end of the event definition
 
-               this->m_ButtonContainerPanel = new ButtonContainerPanel( this,
-                   this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
+               this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
 
                //Using AuiManager to Manage the Panels
                this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
 
-               this->m_AuiManager->AddPane(
-                   this->m_ButtonPanel,
-                   wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(
-                       true ).CloseButton( false ).Bottom( ).Resizable( true ) );
+               this->m_AuiManager->AddPane(this->m_ButtonPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
                //CartoButtonPanel Management
-               this->m_AuiManager->AddPane(
-                   this->m_ButtonContainerPanel,
-                   wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(
-                       _("creaButtonContainer") ). CaptionVisible( false ).CloseButton(
-                       false ).Center( ).Resizable( true ) );
+               this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(_("creaButtonContainer") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) );
                this->m_AuiManager->Update( );
        }
        // ----------------------------------------------------------------------------------
@@ -61,16 +51,14 @@ namespace creaPanelButtonContainer
                        //Hiding the last CartoSettingsPanel
                        this->m_ButtonPanel->Show( false );
                        //Finding the CartoSettingsPanel of the ButtonClicket
-                       this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(
-                           buttonName );
+                       this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(buttonName );
                        //changing the parent of the panel!
                        if ( this->m_ButtonPanel->GetParent( ) != this )
                        {
                                this->m_ButtonPanel->Reparent( this );
                        }//fi
                        //CartoSettingsPanel Management
-                       this->m_AuiManager->GetPane( _T("ButtonPanel") ).window
-                           = this->m_ButtonPanel;
+                       this->m_AuiManager->GetPane( _T("ButtonPanel") ).window = this->m_ButtonPanel;
                        //Updating the manager
                        this->m_AuiManager->Update( );
                }//yrt