]> Creatis software - bbtkGEditor.git/commitdiff
#3066 bbGEditor Bug New Normal - Refresh vtk objects
authorEduardo DAVILA <davila@localhost.localdomain>
Fri, 3 Mar 2017 13:05:15 +0000 (14:05 +0100)
committerEduardo DAVILA <davila@localhost.localdomain>
Fri, 3 Mar 2017 13:05:15 +0000 (14:05 +0100)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx

index 41fb8674575605de664d9768df862c4de442f4e4..c902136502ee383e037fed4e4493fef7fe15028f 100644 (file)
@@ -79,7 +79,7 @@ namespace bbtk {
        // Object states
        
        // JGRR
-       const int POSSIBLE_CONNECTION = 107;
+       const int POSSIBLE_CONNECTION           =       107;
        const int SELECTED_POSSIBLE_CONNECTION = 108; 
        // EO JGRR
     
index 4549df8ce9160387a7bd42e3d34cc4b459de332f..97e98f4c55b0eb4818825e5abfaf5c570ebd7ff5 100644 (file)
@@ -114,33 +114,12 @@ namespace bbtk
        //=========================================================================
        void vtkGBlackBoxView::update(int idController,int command)
        {
-               updateColors();
-
+//EED 2017-03)02
+               update_X_Fin();
+               vtkGBoxView::update(idController,command);
                double xInic, yInic,zInic,xFin, yFin,zFin;
                _model->getInicPoint(xInic,yInic,zInic);
-
                updatePositionTextActor(xInic, yInic,zInic);
-        update_X_Fin();
-               _model->getFinalPoint(xFin, yFin,zFin);
-
-               // RaC In the actual version, zInic=zFin=GPOSITION_Z
-
-               _pts->SetPoint(0, xInic, yInic, zInic );
-               _pts->SetPoint(1, xInic, yFin, zInic );
-               _pts->SetPoint(2, xFin, yFin, zFin );
-               _pts->SetPoint(3, xFin, yInic, zFin );
-
-               updatePorts();
-
-
-// update position for one Actor that represents all OutputPorts
-
-
-//             _borderPolyMapper->Modified();
-               _fillPolyMapper->Modified();
-               //-----------
-
-               //-----------
                setRefreshWaiting();
        }
 
@@ -168,10 +147,13 @@ namespace bbtk
 //EED          _pts->SetPoint(1, xInic, yFin, zInic );
 //EED          _pts->SetPoint(2, xFin, yFin, zFin );
 //EED          _pts->SetPoint(3, xFin, yInic, zFin );
-               _pts->SetPoint(0, -1000, -1000, -1000 );
-               _pts->SetPoint(1, xInic, yFin, zInic );
-               _pts->SetPoint(2, 1000, 1000, 1000 );
-               _pts->SetPoint(3, xFin, yInic, zFin );
+
+//EED 2017-03-02
+//             _pts->SetPoint(0, -1000, -1000, -1000 );
+//             _pts->SetPoint(1, xInic, yFin, zInic );
+//             _pts->SetPoint(2, 1000, 1000, 1000 );
+//             _pts->SetPoint(3, xFin, yInic, zFin );
+
 
 //             lines->InsertNextCell(5);
 //             lines->InsertCellPoint(0);
@@ -230,7 +212,7 @@ namespace bbtk
                updatePositionTextActor( xInic,  yInic,  zInic);
        }
 
-       //=========================================================================
+       //===============BoundaryEdgesOn==========================================================
 
        void vtkGBlackBoxView::addVtkActors()//virtual
        {
index 9e5c0d64d53f79ce05436b29444ae40c9d95cdc6..02d194b772a3c283f2063a22a3513cda4c4d74ec 100644 (file)
@@ -78,31 +78,23 @@ namespace bbtk
        //=========================================================================
        void vtkGBoxView::update(int idController,int command)
        {
-               updateColors();
-               
+               updateColors();         
                double xInic, yInic,zInic,xFin, yFin,zFin;
                _model->getInicPoint(xInic,yInic,zInic);
                _model->getFinalPoint(xFin, yFin,zFin);
-
                // RaC In the actual version, zInic=zFin=GPOSITION_Z
-
                _pts->SetPoint(0, xInic, yInic, zInic );
                _pts->SetPoint(1, xInic, yFin, zInic );
                _pts->SetPoint(2, xFin, yFin, zFin );
                _pts->SetPoint(3, xFin, yInic, zFin );
-
+               _pts->Modified();
                updatePorts();
-
 //             _borderPolyMapper->Modified();
                _fillPolyMapper->Modified();
-               //-----------
-
-               //-----------
                setRefreshWaiting();
        }
 
 
-
        //=========================================================================
 //EED2017
        void vtkGBoxView::createVtkInputOutputPorts()
@@ -112,6 +104,14 @@ namespace bbtk
                int numberOfTriangles                   = boxModel->getNumInputPorts();
                _TrianglesInputsPts                             = vtkPoints::New();
                _TrianglesInputsPts->SetNumberOfPoints( 3*numberOfTriangles );
+
+//EED 2017-03-02
+//             if (numberOfTriangles>0)
+//             {
+//                     _TrianglesInputsPts->SetPoint(0, -1000, -1000, -1000 );
+//                     _TrianglesInputsPts->SetPoint(1, 1000, 1000, 1000 );
+//             }
+
                vtkCellArray *stripTrianglesInputs = vtkCellArray::New();
                vtkPolyData *pdTrianglesInputs  = vtkPolyData::New();
                _TrianglesInputsPolyMapper              = vtkPolyDataMapper::New();
@@ -135,6 +135,14 @@ namespace bbtk
                numberOfTriangles                                               = boxModel->getNumOutputPorts();
                _TrianglesOutputsPts                                    = vtkPoints::New();
                _TrianglesOutputsPts->SetNumberOfPoints( 3*numberOfTriangles );
+
+//EED 2017-03-02
+//             if (numberOfTriangles>0)
+//             {
+//                     _TrianglesOutputsPts->SetPoint(0, -1000, -1000, -1000 );
+//                     _TrianglesOutputsPts->SetPoint(1, 1000, 1000, 1000 );
+//             }
+
                vtkCellArray *stripTrianglesOutputs     = vtkCellArray::New();
                vtkPolyData *pdTrianglesOutputs                 = vtkPolyData::New();
                _TrianglesOutputsPolyMapper                             = vtkPolyDataMapper::New();
@@ -179,10 +187,12 @@ namespace bbtk
 //EED          _pts->SetPoint(1, xInic, yFin, zInic );
 //EED          _pts->SetPoint(2, xFin, yFin, zFin );
 //EED          _pts->SetPoint(3, xFin, yInic, zFin );
-               _pts->SetPoint(0, -1000, -1000, -1000 );
-               _pts->SetPoint(1, xInic, yFin, zInic );
-               _pts->SetPoint(2, 1000, 1000, 1000 );
-               _pts->SetPoint(3, xFin, yInic, zFin );
+
+//EED 2017-03-02
+//             _pts->SetPoint(0, -1000, -1000, -1000 );
+//             _pts->SetPoint(1, xInic, yFin, zInic );
+//             _pts->SetPoint(2, 1000, 1000, 1000 );
+//             _pts->SetPoint(3, xFin, yInic, zFin );
                                
 //             lines->InsertNextCell(5);
 //             lines->InsertCellPoint(0);
@@ -298,6 +308,7 @@ namespace bbtk
                        _TrianglesInputsPts->SetPoint(i*3+1, ( xInic + xFin ) / 2       , yFin  , zInic );
                        _TrianglesInputsPts->SetPoint(i*3+2, xFin                                       , yInic , zFin );
                }
+               _TrianglesInputsPts->Modified();
         _TrianglesInputsPolyMapper->Modified( ) ;
 
 // update position for one Actor that represents all OutputPorts
@@ -312,6 +323,7 @@ namespace bbtk
                        _TrianglesOutputsPts->SetPoint(i*3+1, ( xInic + xFin ) / 2      , yFin  , zInic );
                        _TrianglesOutputsPts->SetPoint(i*3+2, xFin                                      , yInic , zFin );
                }
+               _TrianglesOutputsPts->Modified();
         _TrianglesOutputsPolyMapper->Modified( ) ;
 
 
index 8a5cf7abcf3145e28119a057a6f50522e8fc0f30..df91361af8f9ddf1cc742e8653221b5f687af986 100644 (file)
@@ -114,13 +114,13 @@ namespace bbtk
                //Private Attributes
 
                // Input Triangles
-               vtkPoints               *_TrianglesInputsPts;
+               vtkPoints                       *_TrianglesInputsPts;
                vtkPolyDataMapper       *_TrianglesInputsPolyMapper;
-               vtkActor                *_TrianglesInputsActor;
+               vtkActor                        *_TrianglesInputsActor;
                // Output Triangles
-               vtkPoints               *_TrianglesOutputsPts;
+               vtkPoints                       *_TrianglesOutputsPts;
                vtkPolyDataMapper       *_TrianglesOutputsPolyMapper;
-               vtkActor                *_TrianglesOutputsActor;
+               vtkActor                        *_TrianglesOutputsActor;
 
                //Private Methods
 
index 88ce615e2ce216d4f03b063aff179ea6651c6498..c104877ee2323d20b052c260c9cd457d480bb541 100644 (file)
@@ -77,8 +77,9 @@ namespace bbtk {
        {
     }
 
-    //=========================================================================
 
+/*EED Borrame
+    //=========================================================================
     void vtkGComplexBoxPortView::update( int idController , int command ) 
        {
         updateColors( ) ;
@@ -97,6 +98,7 @@ namespace bbtk {
 
         setRefreshWaiting( ) ;
     }
+*/
 
     //=========================================================================
 
@@ -122,10 +124,12 @@ namespace bbtk {
         //EED          _pts->SetPoint(1, xInic, yFin, zInic );
         //EED          _pts->SetPoint(2, xFin, yFin, zFin );
         //EED          _pts->SetPoint(3, xFin, yInic, zFin );
-        _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
-        _pts->SetPoint( 1 , xInic , yFin , zInic ) ;
-        _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
-        _pts->SetPoint( 3 , xFin , yInic , zFin ) ;
+
+//EED 2017-03-02
+//        _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
+//        _pts->SetPoint( 1 , xInic , yFin , zInic ) ;
+//        _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
+//        _pts->SetPoint( 3 , xFin , yInic , zFin ) ;
 
 
 //        lines->InsertNextCell( 5 ) ;
index 194d0600965f18808b29fed4127b20e82fc18c80..dcac1869134fc8ec938683dbe4a131db17bcf383 100644 (file)
@@ -121,7 +121,7 @@ namespace bbtk
                virtual void removeVtkActors();
                virtual void createVtkObjects();
 
-               virtual void update(int idController,int command);
+//EED Borrame          virtual void update(int idController,int command);
                virtual void updateColors();
        };
 
index 90d1ba4ecbad1dd50aca892e268d22e43bd4b00f..3427debfebb29fb9c8909ab20928d2b00c7f0565 100644 (file)
@@ -154,10 +154,10 @@ namespace bbtk
 
        void vtkGObjectView::moveObject(int X,int Y) //virtual
        {               
+
                // RaC In the actual version, always z=GPOSITION_Z
                double xx=X,yy=Y,zz=GPOSITION_Z;
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
-
                if(_isStartDragging)
                {
                        _isStartDragging=false;
index b0ef338bd65eda4de2ab9c4294462e530adc1cc0..bffe9538080f184af78bb970ec9a7a1d23609cae 100644 (file)
@@ -115,9 +115,10 @@ namespace bbtk {
         _pts = vtkPoints::New( ) ;
         _pts->SetNumberOfPoints( 3 ) ;
 
-        _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
-        _pts->SetPoint( 1 , mid , yFin , zInic ) ;
-        _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
+//EED 2017-03-02
+//        _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
+//        _pts->SetPoint( 1 , mid , yFin , zInic ) ;
+//        _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
 
 
         ///************************* FILL *************************
index 95a2454c22ff447cf2ec8b5e21ee29bede39abf0..af87221b5d01c3da0f519edf9f6df0b8631b6bff 100644 (file)
@@ -1780,23 +1780,45 @@ void wxVtkSceneManager::refresh() {
 }
 //=========================================================================
 
-void wxVtkSceneManager::refreshScene() {
+void wxVtkSceneManager::refreshScene() 
+{
        _baseView->RefreshView();
 }
 
 //=========================================================================
 
-void wxVtkSceneManager::centerView() {
+void wxVtkSceneManager::centerView() 
+{
+       double bb[6];
+       _baseView->GetRenderer()->ComputeVisiblePropBounds(bb);
+
        double temp[3];
        _baseView->GetRenderer()->GetActiveCamera()->GetFocalPoint(temp);
        _baseView->GetRenderer()->GetActiveCamera()->SetFocalPoint(0, 0, temp[2]);
        _baseView->GetRenderer()->GetActiveCamera()->GetPosition(temp);
        _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0, 0, temp[2]);
+
+       _baseView->GetRenderer()->ResetCamera();
+       _baseView->GetRenderer()->ResetCameraClippingRange();
+
+/*
+       double tt=_baseView->GetRenderer()->GetNearClippingPlaneTolerance();
+       printf("EED wxVtkSceneManager::centerView() tolerance=%f\n",tt);
+       double cr1,cr2;
+       _baseView->GetRenderer()->GetActiveCamera()->GetClippingRange(cr1,cr2);
+       printf("EED wxVtkSceneManager::centerView() cr1=%f  cr2=%f\n",cr1,cr2);
+       _baseView->GetRenderer()->GetActiveCamera()->SetClippingRange(0.01,100000);
+       _baseView->GetRenderer()->GetActiveCamera()->GetClippingRange(cr1,cr2);
+       printf("EED wxVtkSceneManager::centerView() cr1=%f  cr2=%f\n",cr1,cr2);
+*/
+
+       _baseView->GetRenderer()->Render();
 }
 
 //=========================================================================
 
-void wxVtkSceneManager::saveDiagram(std::string &content) {
+void wxVtkSceneManager::saveDiagram(std::string &content) 
+{
        char buffer[50];
 
        content += "CATEGORY:";
@@ -1928,7 +1950,6 @@ void wxVtkSceneManager::getCleanLine(stringstream &inputStream, std::string &lin
 //=========================================================================
 void wxVtkSceneManager::loadDiagram(stringstream &inputStream) 
 {
-
        int size;
        std::string version = "<void>";
        std::string line = "";