]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
Important change in the project to visualize the contour when the output was selected...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / wxVtkSceneManager.cxx
index 005c52fb096f9494682bfd3d9321946fe05d88dc..7370b197621b13d3564a857ce4f0e97320845d33 100644 (file)
@@ -54,10 +54,8 @@ namespace bbtk
 
                        ///// ******* TO ERASE *******
                        //JUST TO TEST
-                       //
-                       
-                       
-                       
+                       //              
+                       /*
                        vtkConeSource *cone = vtkConeSource::New();
        
                   cone->SetResolution(10);
@@ -72,10 +70,10 @@ namespace bbtk
                   vtkPoints *_pts = vtkPoints::New();
                        _pts->SetNumberOfPoints(4);
 
-                       _pts->SetPoint(0, -1    , -1    , 0 );
-                       _pts->SetPoint(1,  1    , -1    , 0 );
-                       _pts->SetPoint(2,  1    ,  1    , 0 );
-                       _pts->SetPoint(3, -1    ,  1    , 0 );
+                       _pts->SetPoint(0, -100  , -100  , 900 );
+                       _pts->SetPoint(1,  100  , -100  , 900 );
+                       _pts->SetPoint(2,  100  ,  100  , 900 );
+                       _pts->SetPoint(3, -100  ,  100  , 900 );
        
                        vtkCellArray *lines = vtkCellArray::New();
                        lines->InsertNextCell(5);
@@ -97,22 +95,45 @@ namespace bbtk
 
                        getRenderer()->AddActor(_pointVtkActor);
 
-                       // Create a vector text
-                       vtkVectorText* vecText = vtkVectorText::New();
-                       vecText->SetText("vtkVectorText");
-
-                       vtkPolyDataMapper* txtMapper = vtkPolyDataMapper::New();
-                       txtMapper->SetInputConnection( vecText->GetOutputPort());
-                       vtkActor* txtActor = vtkActor::New();
-                       txtActor->SetMapper(txtMapper);
-                       //getRenderer()->AddActor(txtActor);
                        
+                       
+                                       
+                  vtkPoints *_pts2 = vtkPoints::New();
+                       _pts2->SetNumberOfPoints(4);
+
+                       _pts2->SetPoint(0, -105 , -100  , -50 );
+                       _pts2->SetPoint(1,  100 , -100  , -50 );
+                       _pts2->SetPoint(2,  100 ,  100  , -50 );
+                       _pts2->SetPoint(3, -105 ,  100  , -50 );
+       
+                       vtkCellArray *lines2 = vtkCellArray::New();
+                       lines2->InsertNextCell(5);
+                       lines2->InsertCellPoint(0);
+                       lines2->InsertCellPoint(1);
+                       lines2->InsertCellPoint(2);
+                       lines2->InsertCellPoint(3);
+                       lines2->InsertCellPoint(0);
+
+                       vtkPolyData *_pd2 = vtkPolyData::New();
+                       _pd2->SetPoints( _pts2 );
+                       _pd2->SetLines( lines2 );
+
+                       vtkActor *_pointVtkActor2       =       vtkActor::New();
+                       vtkPolyDataMapper* _bboxMapper2         =       vtkPolyDataMapper::New();
+
+                       _bboxMapper2->SetInput(_pd2);
+                       _pointVtkActor2->SetMapper(_bboxMapper2);
+
+                       getRenderer()->AddActor(_pointVtkActor2);
+
+                       */
                        // ******* TO ERASE *******
                        /////////////////////
                        
                }
        }
 
+
        //=========================================================================
        void wxVtkSceneManager::disconnectDrop()
        {
@@ -136,10 +157,17 @@ namespace bbtk
                iren->SetInteractorStyle(interactorstylebaseview);
                interactorstylebaseview->SetwxVtkBaseView(_baseView);
                
+               double posCamera[3];
+               _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
+               _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0,0,1000);
+               _baseView->GetRenderer()->GetActiveCamera()->GetPosition(posCamera);
+               _baseView->GetRenderer()->ResetCamera();
+               _baseView->GetRenderer()->ResetCameraClippingRange();
+               
+
                _baseView->GetRenderer()->SetBackground(0.9,0.9,0.9);
                _baseView->GetRenderer()->GradientBackgroundOff();
                _baseView->Refresh();
-
        }
 
        //=========================================================================
@@ -167,7 +195,7 @@ namespace bbtk
                double yy =  windowHeight-y;
                
                //z value is not important yet, because it is only used a parallel projection
-               double zz = 0;
+               double zz = 900;
 
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                model->setInicPoint(xx,yy,zz);
@@ -175,7 +203,7 @@ namespace bbtk
                int cantObjects = _objects.size();
                cantObjects++;
                std::stringstream stream;
-               stream << "Object " << cantObjects;
+               stream << "Box " << cantObjects;
                std::string arraystring = stream.str();
 
                model->setBBTKName(arraystring);
@@ -295,7 +323,7 @@ namespace bbtk
        void wxVtkSceneManager::createGConnector(GPortModel* startPort)
        {
                manualContourControler* manContourControl       = new manualContourControler();
-               manualViewContour* manViewerContour     = new manualViewContour();
+               GConnectorView* manViewerContour        = new GConnectorView();
                manualContourModel* manContourModel     = new manualContourModel();
 
                
@@ -312,6 +340,7 @@ namespace bbtk
                manContourControl->SetModelView( manContourModel , manViewerContour );
                manContourControl->Configure();
                int i,sizeLstPoints = manContourModel->GetSizeLstPoints();
+               //std::cout<<"RaC wxVtkSceneManager::createGConnector "<<this<<" size:"<<sizeLstPoints<<std::endl;
                for ( i=0; i<sizeLstPoints; i++ )
                {
                        manViewerContour->AddPoint();
@@ -363,8 +392,8 @@ namespace bbtk
                                if(_objects[i]->getGObjectType() == GBLACKBOX)
                                {
                                        
-                                       GPortModel* startInputPort=((GBlackBoxModel*)_objects[i])->getStartInputPort();
-                                       createGConnector(startInputPort);
+                                       GPortModel* startOutputPort=((GBlackBoxModel*)_objects[i])->getStartOutputPort();
+                                       createGConnector(startOutputPort);
 
                                }
                                else