]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx
Changes in information presented in status bar, inside the box, and the editing dialo...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / vtkGPortView.cxx
index 42dcd2129435116f877e273e0821bc528510728a..a56cd3b7eae38be363a6681d9e6cc5de77409301 100644 (file)
@@ -51,7 +51,7 @@ namespace bbtk
        }
 
        //=========================================================================
-       void vtkGPortView::update(int idObservable,int command)
+       void vtkGPortView::update(int idController,int command)
        {
                updateColors();
                
@@ -62,10 +62,13 @@ namespace bbtk
 
                // RaC In the actual version, zInic=zFin=900
 
+               double mid = (xInic+xFin)/2;
+
                _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->SetPoint(1, mid, yFin, zInic );
+               _pts->SetPoint(2, xFin, yInic, zFin );
+
+               _fillPolyMapper->Modified();
                
                setRefreshWaiting();
        }
@@ -75,12 +78,7 @@ namespace bbtk
        void vtkGPortView::createVtkObjects() //virtual
        {
                _pts = vtkPoints::New();        
-               vtkCellArray *lines = vtkCellArray::New();
-               vtkPolyData *_pd = vtkPolyData::New();
-               vtkPolyDataMapper* _bboxMapper=vtkPolyDataMapper::New();
-               _objectActor=vtkActor::New();
-               
-               _pts->SetNumberOfPoints(4);
+               _pts->SetNumberOfPoints(3);
 
                double xInic, yInic,zInic,xFin, yFin,zFin;
 
@@ -88,23 +86,35 @@ namespace bbtk
                _model->getFinalPoint(xFin, yFin,zFin);
 
                // RaC In the actual version, zInic=zFin=900
+
+               double mid = (xInic+xFin)/2;
+
                _pts->SetPoint(0, xInic, yInic, zInic );
-               _pts->SetPoint(1, xInic, yFin, zInic );
-               _pts->SetPoint(2, xFin, yFin, zFin );
-               _pts->SetPoint(3, xFin, yInic, zFin );
-                               
-               lines->InsertNextCell(5);
-               lines->InsertCellPoint(0);
-               lines->InsertCellPoint(1);
-               lines->InsertCellPoint(2);
-               lines->InsertCellPoint(3);
-               lines->InsertCellPoint(0);
+               _pts->SetPoint(1, mid, yFin, zInic );
+               _pts->SetPoint(2, xFin, yInic, zFin );                          
                        
-               _pd->SetPoints( _pts );
-               _pd->SetLines( lines );
+               ///************************* FILL *************************
+
+               vtkCellArray *strip = vtkCellArray::New();
+               vtkPolyData *pdFill = vtkPolyData::New();
+               _fillPolyMapper=vtkPolyDataMapper::New();
+               _fillObjectActor=vtkActor::New();
+
+               // RaC In the actual version, zInic=zFin=900
+
+               strip->InsertNextCell(3);
+               strip->InsertCellPoint(0);
+               strip->InsertCellPoint(1);
+               strip->InsertCellPoint(2);
+                       
+               pdFill->SetPoints( _pts );
+               pdFill->SetStrips( strip );
+
+               _fillPolyMapper->SetInput(pdFill);
+               _fillObjectActor->SetMapper(_fillPolyMapper);
+               _fillPolyMapper->Modified();
 
-               _bboxMapper->SetInput(_pd);
-               _objectActor->SetMapper(_bboxMapper);
+               ///************************* FILL *************************
 
                updateColors();
 
@@ -115,15 +125,27 @@ namespace bbtk
 
        void vtkGPortView::updateColors()
        {
-               _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+               _fillObjectActor->GetProperty()->SetColor(0.5,0.45,0.45);
 
                if(_state==HIGHLIGHTED)
                {
-                       _objectActor->GetProperty()->SetColor(0.8,0.2,0.5);
+                       _fillObjectActor->GetProperty()->SetColor(0.8,0.8,0.8);
                }
                else
                {
-                       _objectActor->GetProperty()->SetColor(0.3,0.2,0.2);
+                       GPortModel* portm = (GPortModel*)_model;
+                       if(portm->isConnected())
+                       {
+                               _fillObjectActor->GetProperty()->SetColor(0.15,0.15,0.15);
+                       }
+                       else if(portm->isValueSet())
+                       {
+                               _fillObjectActor->GetProperty()->SetColor(0.55,0.25,0.25);
+                       }
+                       else 
+                       {
+                               _fillObjectActor->GetProperty()->SetColor(0.5,0.45,0.45);
+                       }
                }
        }