]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authordonadio <donadio>
Wed, 25 Mar 2009 10:18:36 +0000 (10:18 +0000)
committerdonadio <donadio>
Wed, 25 Mar 2009 10:18:36 +0000 (10:18 +0000)
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfMainPanel.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx

index 7d43990be32d4a103f11e4e1f2853d810bd07850..4c67ae203886dbfcf780602e50833104284b8c1c 100644 (file)
@@ -375,7 +375,31 @@ void interfMainPanel::showPanel(wxWindow* panel){
        infoPanel->Refresh();
        this->Layout();
        this->Refresh();
+}
+
+/**
+**     Hide the panel in the 
+**/
+void interfMainPanel::hidePanel( ){
+       wxContourMainFrame::getInstance()->showAxis(false);
+       wxSizer* sizer = infoPanel->GetSizer();
+
+       if(currentWindow != NULL){
+               currentWindow->Hide();
+               sizer->Remove(currentWindow);
+       }
+       wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+       sizer->Add(emptyPanel);
+    currentWindow = emptyPanel;
+       currentWindow->Show(true);
 
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
+
+       infoPanel->Layout();
+       infoPanel->Refresh();
+       this->Layout();
+       this->Refresh();
 }
 
 /**
@@ -700,9 +724,30 @@ void interfMainPanel::onMirrorPressed(){
                flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
                flexsizer->Add(panelMirror, wxEXPAND);
                mirrorPanel->Layout();
+
+               refLineShown=true;
+
+               showPanel(mirrorPanel);
+               wxContourMainFrame::getInstance()->referenceLine();
        }       
-       showPanel(mirrorPanel);
-       //hideAxis();
 
-       wxContourMainFrame::getInstance()->referenceLine();
+       else
+       {
+               if(refLineShown)
+               {
+                       wxContourMainFrame::getInstance()->refLineHide();
+                       refLineShown=false;
+
+                       hidePanel();
+               }
+
+               else if (!refLineShown)
+               {
+                       wxContourMainFrame::getInstance()->refLineShow();
+                       refLineShown=true;
+
+                       showPanel(mirrorPanel);
+               }
+       }
+
 }
index cb17e22cc118d30c3c2c938ccb6290490ae3d346..bfbeb4fd4ad1dd1b03fba4ac34439f6e24575146 100644 (file)
@@ -71,6 +71,12 @@ public:
        **      Shows the panel in the 
        **/
        void showPanel(wxWindow* panel);
+
+       /**
+       **      Hides the panel in the 
+       **/
+       void hidePanel( );
+
        /**
        **      Gets the Information panel
        **/
@@ -216,7 +222,7 @@ private:
        wxPanel* informationPanel;
 
        bool axisshown;
-
+       bool refLineShown;
        
        //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
        //list of contours
index 335d165fd741c0027e86f921c6aa433255f41cf9..a3aba8df4f7abfb90b94decc93fc664c475cdd58 100644 (file)
@@ -55,6 +55,10 @@ char wxContourMainFrame::COPY = 'C';
                //_actualInstant                                = NULL;
                _numberOfVariablesStatistics = 6+1;
 
+               _refLineControl                         = NULL;
+               _refLineModel                           = NULL;
+               _refLineView                            = NULL;
+
                // set up default notebook style
 //             m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
 //             m_notebook_theme = 0;   
@@ -79,7 +83,11 @@ char wxContourMainFrame::COPY = 'C';
 //             _editionToolsPanel                      = NULL;
 //             _listViewPanel                          = NULL;
 //             _sceneManager                           = NULL;
-               //_actualInstant                                = NULL;
+//             _actualInstant                          = NULL;
+
+               _refLineControl                         = NULL;
+               _refLineModel                           = NULL;
+               _refLineView                            = NULL;
 
                // set up default notebook style
                m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
@@ -475,7 +483,8 @@ void wxContourMainFrame :: deleteContours( std::vector<std::string>  keyNamesVec
 }
 
 void wxContourMainFrame :: deleteContour( std::string theKeyName ){
-       /*manualContourModel                    * cModel;
+       /*
+       manualContourModel                      * cModel;
        manualViewBaseContour           * cViewer;
        manualContourBaseControler      * cControler;
 
@@ -694,17 +703,18 @@ void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName,
 {
        std::string cloneName = kernelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
        manualContourModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);
-       manualContourModel * refModel = kernelManager->getOutlineByKeyName(_refName);
 
-       manualPoint * refPoint1 = refModel->GetManualPoint(0);
-       manualPoint * refPoint2 = refModel->GetManualPoint(1);
+       manualPoint * refPoint1 = _refLineModel->GetManualPoint(0);
+       manualPoint * refPoint2 = _refLineModel->GetManualPoint(1);
 
        double pnt1X = refPoint1->GetX();
        double pnt1Y = refPoint1->GetY();
+       double pnt1Z = refPoint1->GetZ();
        double pnt2X = refPoint2->GetX();
        double pnt2Y = refPoint2->GetY();
+       double pnt2Z = refPoint2->GetZ();
+
        double angle = (atan2(pnt2Y - pnt1Y, pnt2X - pnt1X) * 180 / 3.1415926535897932384626433832795)+90;
-printf("ang=%f\n",angle);
        vtkTransform *t = vtkTransform::New();
 
        t->PostMultiply();
@@ -1127,117 +1137,94 @@ void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,i
 //Creates a reference line to be used as the axis of the mirroring
 void wxContourMainFrame::referenceLine()
 {
-/*
     wxBusyCursor wait;
        double spc[3];
-       
+
        vtkImageData *vtkimagedata = _theViewPanel->getImageData();
-       vtkimagedata->UpdateInformation();
-       vtkimagedata->SetUpdateExtent(vtkimagedata->GetWholeExtent());
-       vtkimagedata->Update();
-       vtkImageData _data = vtkimagedata;
-       _data->GetSpacing(spc);
-       //_vtkbasedata_1 = new vtkBaseData();
-       //_vtkbasedata_1->SetMarImageData(marimagedata);        
-       //_imageviewer2D_1->SetVtkBaseData( _vtkbasedata_1 );
-       //_imageviewer2D_1->Configure();
-
-
-       // Contorno 1
-       manualContourControler _manContourControl_1     = new manualContourControler();
-       manualContourModel _mContourModel_1     = new manualContourModel();
-       manualViewContour _mViewContour_1 = new manualViewContour();
-       _mViewContour_1->SetModel( _mContourModel_1 );
-//     _mViewContour_1->SetWxVtkBaseView( _imageviewer2D_1 );
-       _mViewContour_1->SetRange( 2 );
-       _mViewContour_1->SetZ( 1200 );
-
-
-//EED 3 oct 2006
-       _mViewContour_1->SetSpacing(spc);
-
-
-//EED 3 oct 2006
-       _mViewContour_1->SetColorNormalContour(0, 0, 1);
-       _mViewContour_1->SetColorEditContour(0, 0.5, 0.5);
-
-       _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 );
-//     _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_1 );
-       _manContourControl_1->CreateNewManualContour();
-       _manContourControl_1->SetActive(false);
-       _mViewContour_1->RefreshContour();
-
-       // Rectangulo
-//     _manRoiControl  = new manualRoiControler();
-//     _mContourModel  = new manualContourModel();
-//     _mViewRoi               = new manualViewRoi();
-       _mViewRoi->SetModel( _mContourModel );
-       _mViewRoi->SetWxVtkBaseView( _imageviewer2D_1 );
-       _mViewRoi->SetRange( 2 );
-       _mViewRoi->SetZ( 1200 );
-
-//EED 3 oct 2006
-       _mViewRoi->SetSpacing(spc);
-
-//     _manRoiControl->SetModelView( _mContourModel , _mViewRoi );
-//     _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manRoiControl );
-//     _manRoiControl->CreateNewManualContour();
-//     _manRoiControl->SetActive(true);
-//     _mViewRoi->RefreshContour();
-
-CreateNewPoint( 0,0);
-
-       Refresh();      
+       vtkimagedata->GetSpacing(spc);
 
-*/
+       wxVtkBaseView * viewer2D = _theViewPanel->getWxVtkBaseView();
 
+       _refLineControl = new manualLineControler();
+       _refLineModel   = new manualContourModelLine();
+       _refLineView = new manualViewLine();
+       _refLineView->SetModel( _refLineModel );
+       _refLineView->SetWxVtkBaseView( viewer2D );
+       _refLineView->SetRange( 2 );
+       _refLineView->SetZ( 1200 );
 
+       _refLineView->SetSpacing(spc);
 
+       _refLineView->SetColorNormalContour(0, 0, 1);
+       _refLineView->SetColorEditContour(0, 0.5, 0.5);
+       _refLineView->SetWidthLine(4);
 
+       _refLineControl->SetModelView( _refLineModel , _refLineView );
+       viewer2D->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _refLineControl );
+       _refLineModel->SetCloseContour(false);
+       _refLineControl->CreateNewManualContour();
+/*
+       double z = _refLineControl->GetZ();
 
-       //Crea una linea de referencia
-       manualContourModel * refLine = kernelManager->factoryManualContourModel(6);
+       _refLineModel->AddPoint(50,100,z);
+       _refLineModel->AddPoint(80,40,z);
 
-       std::vector<int> instantVector;
-       _instantPanel->getInstant( instantVector );
-       std::string nameLine = kernelManager->createOutline(refLine, instantVector);
-       bool addedModel = nameLine.compare("") != 0;
-       if( addedModel )
-       {
-               double spc[3];
-               _theViewPanel->getSpacing(spc);                                 
-               _theViewPanel->getSceneManager()->configureViewControlTo( nameLine, refLine,spc , 6);
-       }       
+       _refLineControl->AddPoint(50,100,z);
+       _refLineControl->AddPoint(80,40,z);
 
-       _refName = nameLine;
+       _refLineView->UpdateViewPoint(0);
+       _refLineView->UpdateViewPoint(1);
 
+       _refLineControl->SetCompleteCreation(true);
+       _refLineControl->SetEditable(true);
+*/
+       _refLineControl->SetActive(true);
+       _refLineView->RefreshContour();
+}
+
+//Hides the referenceLine
+void wxContourMainFrame::refLineHide()
+{
+       if (_refLineControl!=NULL)
+       {
+               _refLineView->RemoveCompleteContourActor();     
+       }
 }
 
+//Shows the referenceLine
+void wxContourMainFrame::refLineShow()
+{
+       if (_refLineControl!=NULL)
+       {
+               wxVtkBaseView * viewer2D = _theViewPanel->getWxVtkBaseView();
+
+               _refLineView->SetModel( _refLineModel );
+               _refLineView->SetWxVtkBaseView( viewer2D );
+               _refLineView->SetRange( 2 );
+               _refLineView->SetZ( 1200 );
+
+               _refLineControl->SetModelView( _refLineModel , _refLineView );
+               viewer2D->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _refLineControl );
+               _refLineControl->CreateNewManualContour();
+               //_refLineControl->SetActive(true);
+               //_refLineControl->SetEditable(true);
+               _refLineView->RefreshContour();
+       }
+}
 
 void wxContourMainFrame::onMirror()
 {
        //AD:02-09
        std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
        std::vector<std::string> filterCurrentSelection;
-       
-       std::vector<std::string>::iterator iter;
-       for (iter=currentSelection.begin(); iter!=currentSelection.end(); ++iter)
-       {
-               //Diferente de la linea de referencia
-               if ((_refName.compare(*iter))!=0)
-               {
-                       filterCurrentSelection.push_back(*iter);        
-               }
-       }
 
        std::vector<int> tempVector;
        _instantPanel->getInstant( tempVector );
     _performingOperation->reset();
        _performingOperation->setStartCommand( COPY );
        _performingOperation->setStartOperationInstantVector( tempVector );
-       _performingOperation->setKeyNamesOperationElems( filterCurrentSelection );
+       _performingOperation->setKeyNamesOperationElems( currentSelection );
 
-       //AD:02-09
        char theStartCommand = _performingOperation->getStartCommand();
        if (  theStartCommand == COPY )
        {
@@ -1255,8 +1242,8 @@ void wxContourMainFrame::onMirror()
                }               
        }
 
-       deleteContour( _refName );
-       _refName = "";
+       //deleteContour( _refName );
+       //_refName = "";
 }
 
 void wxContourMainFrame::showAxis(bool show){
index c9c34561a751fc51631c1f5ca3c1789c9627877a..9ceabd9edfc924a901982c63b310c928bfc4e168 100644 (file)
@@ -227,6 +227,8 @@ class wxContourMainFrame : public wxPanel {
 
        //AD
        void referenceLine();
+       void refLineHide();
+       void refLineShow();
 
        //AD
        void onMirror();
@@ -286,8 +288,11 @@ private:
 
        wxInstantChooserPanel * _instantPanel;
 
-       //AD    
-       std::string _refName;
+       //AD: 03-09: This attributes represents the reference line that is going to be used for the mirroring
+       manualLineControler             * _refLineControl;
+       manualContourModelLine  * _refLineModel;
+       manualViewLine                  * _refLineView;
+
 
 
        wxAuiManager m_mgr;
index 635dcd3da6f7670efdb1a29f1e9a6ef8d5cce69f..589ed818c27d62172a0be7784de50ae982482e21 100644 (file)
@@ -414,7 +414,8 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
 
                std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
                iter = _sceneContours_ViewControl->find( theKeyName );
-               if (iter != _sceneContours_ViewControl->end()){
+               if (iter != _sceneContours_ViewControl->end())
+               {
                        ContourWrap_ViewControl * contourWRP =   iter->second;
                        removeFromScene( contourWRP );  
 //EED Borrame