]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorperez <perez>
Wed, 4 Nov 2009 14:40:32 +0000 (14:40 +0000)
committerperez <perez>
Wed, 4 Nov 2009 14:40:32 +0000 (14:40 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracaSurfaceRenderingProp3D.cxx

index 8462b92256a5e0737d08a582fe98867b28d5917f..3d1187036e85bc21e7393130d4c5bf01416a00ee 100644 (file)
@@ -2,47 +2,76 @@
 
 #include <wx/colordlg.h>
 #include "wxMaracasSurfaceRendering.h"
+#include "wxMaracasRendererView.h"
 #include <OpenImage.xpm>
+#include <Add.xpm>
 #include "Color.xpm"
+
 /**
 **     Implementation of SurfaceRenderingProp3D
 **/
 
-wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent,int propid)
-:wxMaracasSurfaceRenderingPanel(parent, propid){
+wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent, int propid, bool _isComplexBox, int _panID)
+:wxMaracasSurfaceRenderingPanel(parent, propid, _isComplexBox, _panID){
        createControls();       
 }
 
 wxMaracasSurfaceRenderingProp3D::~wxMaracasSurfaceRenderingProp3D(){   
        //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false);
-       wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid);
+       if(this->isComplex())
+       {       
+               //if(this->getPanId() == 1)
+               //      ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSA(_propid, false);
+               //if(this->getPanId() == 2)
+               //      ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSB(_propid, false);
+               //if(this->getPanId() == 3)
+               //      ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSC(_propid, false);
+       }
+       //else
+               //wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid);
 }
 
 void wxMaracasSurfaceRenderingProp3D::createControls(){
 
-       wxFlexGridSizer* sizersurrendprop = new wxFlexGridSizer(1,1,1);
+       wxFlexGridSizer* sizersurfprop = new wxFlexGridSizer(1);
        
-       wxString choices[2];
-       choices[0] = wxString(_T("On"));
-       choices[1] = wxString(_T("Off"));
-       checkbox = new  wxCheckBox(this,-1,wxString(_T("Show Actor")));
-       Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange);  
-       checkbox->SetValue(true);       
-
-       sizersurrendprop->Add(checkbox,wxFIXED_MINSIZE);
+       if(!isComplexBox) 
+       {
+               wxString choices[2];
+               choices[0] = wxString(_T("On"));
+               choices[1] = wxString(_T("Off"));
+               checkbox = new  wxCheckBox(this,-1,wxString(_T("Show Actor")));
+               Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange);  
+               checkbox->SetValue(true);       
+
+               sizersurfprop->Add(checkbox,wxFIXED_MINSIZE);
+       }
 
        //this->addControl(checkbox);   
-       
+       wxFlexGridSizer* sizerbut = new wxFlexGridSizer(3);
+
        wxBitmap bitmap(Color_xpm);
        _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));    
        Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onColorChange);                   
-       sizersurrendprop->Add(_colorchoose,wxFIXED_MINSIZE);    
+       sizerbut->Add(_colorchoose,wxFIXED_MINSIZE);
 
+       wxBitmap bitmap1(Add_xpm);
+       _viewimage = new wxBitmapButton(this, -1, bitmap1, wxDefaultPosition, wxSize(30,30));   
+       Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onViewImage);                       
+       sizerbut->Add(_viewimage,wxFIXED_MINSIZE);
+
+       if(isComplexBox) 
+       {
+               wxBitmap bitmap2(OpenImage_xpm);
+               wxBitmapButton* _openParameters = new wxBitmapButton(this, -1, bitmap2, wxDefaultPosition, wxSize(30,30));      
+               Connect(_openParameters->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onOpenParameters);                     
+               sizerbut->Add(_openParameters,wxFIXED_MINSIZE); 
+       }
+       sizersurfprop->Add(sizerbut,wxFIXED_MINSIZE);
        //sizercolor->Add(checkbox,wxFIXED_MINSIZE);
        //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
        //this->addControl(sizercolor);
-       
-       
+
        wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity")));              
        opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS); 
        Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onOpacityRelease);     
@@ -50,16 +79,9 @@ void wxMaracasSurfaceRenderingProp3D::createControls(){
        sizeropacity->Add(label,wxFIXED_MINSIZE);
        sizeropacity->Add(opacity,wxFIXED_MINSIZE);
 
-       sizersurrendprop->Add(sizeropacity,wxFIXED_MINSIZE);
+       sizersurfprop->Add(sizeropacity,wxFIXED_MINSIZE);
 
-       /**wxBitmap bitmap1(OpenImage_xpm);
-       _viewimage = new wxBitmapButton(this, -1, bitmap1, wxDefaultPosition, wxSize(30,30));   
-       Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onViewImage);                       
-       sizersurrendprop->Add(_viewimage,wxFIXED_MINSIZE);      */
-       
-       //this->addControl(sizeropacity);
-       this->addControl(sizersurrendprop);
-       
+       this->addControl(sizersurfprop);
 }
 void wxMaracasSurfaceRenderingProp3D::onCheckBoxChange(wxCommandEvent& event){ 
        wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
@@ -74,7 +96,16 @@ void wxMaracasSurfaceRenderingProp3D::onColorChange(wxCommandEvent& event){
                double g = (double)(colour.Green())/255.0;
                double b = (double)(colour.Blue())/255.0;
                
-               wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b);
+               if(this->isComplex()){
+                       if(this->getPanId() == 1)
+                               ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->changeColorA(this->getPropId(), r, g, b);
+                       if(this->getPanId() == 2)
+                               ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->changeColorB(this->getPropId(), r, g, b);
+                       if(this->getPanId() == 3)
+                               ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->changeColorC(this->getPropId(), r, g, b);
+               }
+               else
+                       wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b);
        }
        delete colourdiag;
 }
@@ -83,9 +114,16 @@ void wxMaracasSurfaceRenderingProp3D::onColorChange(wxCommandEvent& event){
 }*/
 
 void wxMaracasSurfaceRenderingProp3D::onOpacityRelease(wxScrollEvent& event ){
-
-       wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
-
+       if(this->isComplex()){
+               if(this->getPanId() == 1)
+                       ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->changeOpacityA(this->getPropId(),opacity->GetValue());
+               if(this->getPanId() == 2)
+                       ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->changeOpacityB(this->getPropId(),opacity->GetValue());
+               if(this->getPanId() == 3)
+                       ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->changeOpacityC(this->getPropId(),opacity->GetValue());
+       }
+       else
+               wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
 }
 
 void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){      
@@ -96,3 +134,12 @@ void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){
        //}     
 }
 
+/** 
+** Loads the volume in a separate window
+** Carolina Perez: Method recently added 28/10/2009
+**/
+void wxMaracasSurfaceRenderingProp3D::onOpenParameters(wxCommandEvent& event){
+       dialog = new wxMaracasRenderImageManagementPanel(this);
+       dialog->SetSize(400,580);
+       dialog->Show(); 
+}
\ No newline at end of file