]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx
The actual version updates the status bar with the highlighted object ... Also it...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / vtkGPortView.cxx
index adbe0caac36e9cfe2402ab37c80c1b18d7a8cbf3..a21ba849c2e44a5c14a7d58d977406ec16a066b4 100644 (file)
@@ -42,7 +42,7 @@ namespace bbtk
 
        //=========================================================================
        vtkGPortView::vtkGPortView()
-       {                       
+       {               
        }
 
        //=========================================================================
@@ -51,18 +51,10 @@ namespace bbtk
        }
 
        //=========================================================================
-       void vtkGPortView::update(int command)
+       void vtkGPortView::update(int idController,int command)
        {
-               _objectActor->GetProperty()->SetColor(0.8,0.2,0.5);
-               if(_model->getState()==HIGHLIGHTED)
-               {
-                       _objectActor->GetProperty()->SetColor(0.8,0.2,0.5);
-               }
-               else
-               {
-                       _objectActor->GetProperty()->SetColor(0.3,0.2,0.2);
-               }
-
+               updateColors();
+               
                double xInic, yInic,zInic,xFin, yFin,zFin;
 
                _model->getInicPoint(xInic,yInic,zInic);
@@ -70,14 +62,15 @@ namespace bbtk
 
                // RaC In the actual version, zInic=zFin=900
 
-               _pts->SetPoint(0, xInic, yInic, zInic );
-               _pts->SetPoint(1, xInic, yFin, zInic );
-               _pts->SetPoint(2, xFin, yFin, zFin );
-               _pts->SetPoint(3, xFin, yInic, zFin );
+               double mid = (xInic+xFin)/2;
 
-               //_baseView->GetRenderer()->Render();
-               //_baseView->GetRenWin()->Render();
+               _pts->SetPoint(0, xInic, yInic, zInic );
+               _pts->SetPoint(1, mid, yFin, zInic );
+               _pts->SetPoint(2, xFin, yInic, zFin );
 
+               _borderObjectActor->Modified();
+               
+               setRefreshWaiting();
        }
 
        //=========================================================================
@@ -87,10 +80,10 @@ namespace bbtk
                _pts = vtkPoints::New();        
                vtkCellArray *lines = vtkCellArray::New();
                vtkPolyData *_pd = vtkPolyData::New();
-               vtkPolyDataMapper* _bboxMapper=vtkPolyDataMapper::New();
-               _objectActor=vtkActor::New();
+               _borderPolyMapper=vtkPolyDataMapper::New();
+               _borderObjectActor=vtkActor::New();
                
-               _pts->SetNumberOfPoints(4);
+               _pts->SetNumberOfPoints(3);
 
                double xInic, yInic,zInic,xFin, yFin,zFin;
 
@@ -98,26 +91,45 @@ 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 );
+               _pts->SetPoint(1, mid, yFin, zInic );
+               _pts->SetPoint(2, xFin, yInic, zFin );
                                
-               lines->InsertNextCell(5);
+               lines->InsertNextCell(4);
                lines->InsertCellPoint(0);
                lines->InsertCellPoint(1);
                lines->InsertCellPoint(2);
-               lines->InsertCellPoint(3);
                lines->InsertCellPoint(0);
                        
                _pd->SetPoints( _pts );
                _pd->SetLines( lines );
 
-               _bboxMapper->SetInput(_pd);
-               _objectActor->SetMapper(_bboxMapper);
+               _borderPolyMapper->SetInput(_pd);
+               _borderObjectActor->SetMapper(_borderPolyMapper);
+               _borderObjectActor->Modified();
 
-               _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+               updateColors();
 
+
+       }
+
+       //=========================================================================
+
+       void vtkGPortView::updateColors()
+       {
+               _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,BOXBORDER_NH_G,BOXBORDER_NH_B);
+
+               if(_state==HIGHLIGHTED)
+               {
+                       _borderObjectActor->GetProperty()->SetColor(0.8,0.2,0.5);
+               }
+               else
+               {
+                       _borderObjectActor->GetProperty()->SetColor(0.3,0.2,0.2);
+               }
        }
 
        //=========================================================================