]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
#3322 creaContours Feature New Normal - Show reference contour Befor After actual...
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourViewPanel.cxx
index 0115b33cbb411d4947cd29b5b429a575547c1a63..de7b90660a8eb27c230f8b4a4736f2bcbef7fbeb 100644 (file)
@@ -58,6 +58,8 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        {
                theShowingImage->GetSpacing(last_spacing);
                showingVID                              = theShowingImage;
+               _before                                 = false;
+               _after                                  = false;
                int gapH                                = 20;
                int gapV                                = 10;
                _verticalConceptName    = "";
@@ -224,6 +226,13 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
        }
 
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourViewPanel::SetXY(int x, int y)
+       {
+               GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetX(x);
+               GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetY(y);
+       }
+
        //------------------------------------------------------------------------------------------------------------
        void wxContourViewPanel::Refresh()
        {
@@ -703,11 +712,58 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
 
        void wxContourViewPanel::addNameWrapperToScene()
        {
-               int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
-               for(int i = 0; i < size;i++){
+               int i,size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
+               for(i = 0; i < size;i++)
+               {
                        std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
                        _sceneManager->addToScene(name, true, true, true, false, false );
-               }
+               } // for i
+
+               std::vector<int> tempVector;
+               wxContourMainFrame::getInstance()->getInstantVector( tempVector );
+
+               if (_before==true)
+               {
+                       std::vector<std::string> lstNameBefor;
+                       // Contours Befor
+                       for (i=tempVector[1]-1; i>=0; i--)
+                       {
+                               lstNameBefor = wxContourMainFrame::getInstance()->getOutlinesName( i );
+                               size = lstNameBefor.size();
+                               if (size!=0)
+                               {
+                                       i=-1;
+                               } //if size 
+                       } // for                
+                       for(i = 0; i < size;i++)
+                       {
+                               //                                                    ctrol  active showCtr
+                               _sceneManager->addToScene(lstNameBefor[i], true, true, false, false, false );
+                       } // for i
+               } // if _before Contour
+       
+               if (_after==true)
+               {
+                       std::vector<std::string> lstNameAfter;
+                       // Contours After
+                       int ext[6];
+                       getImageData()->GetExtent(ext);
+                       int dimZ=ext[5]-ext[4]+1;
+                       for (i=tempVector[1]+1; i<dimZ; i++)
+                       {
+                               lstNameAfter = wxContourMainFrame::getInstance()->getOutlinesName( i );
+                               size = lstNameAfter.size();
+                               if (size!=0)
+                               {
+                                       i=dimZ;
+                               } //if size 
+                       } // for
+                       for(i = 0; i < size;i++)
+                       {
+                               //                                                    ctrol  active showCtr
+                               _sceneManager->addToScene(lstNameAfter[i], true, true, false, false, false );
+                       } // for i
+               } // if _after Contour
        }
 
        std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
@@ -771,6 +827,12 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                wxvtk2dbaseview->SetInterpolate( interpolate );
        }
 
+       void wxContourViewPanel::onBeforeAfterContour(bool before, bool after)
+       {
+               _before = before;
+               _after  = after;
+       }
+
        void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
        {
                _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);