From 67a6b56195db640eb7f2a478440c6aa39ccb59ae Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 3 Mar 2017 14:05:15 +0100 Subject: [PATCH] #3066 bbGEditor Bug New Normal - Refresh vtk objects --- .../bbsKernelEditorGraphic/GlobalConstants.h | 2 +- .../vtkGBlackBoxView.cxx | 40 +++++-------------- .../bbsVtkGUIEditorGraphic/vtkGBoxView.cxx | 40 ++++++++++++------- .../bbsVtkGUIEditorGraphic/vtkGBoxView.h | 8 ++-- .../vtkGComplexBoxPortView.cxx | 14 ++++--- .../vtkGComplexBoxPortView.h | 2 +- .../bbsVtkGUIEditorGraphic/vtkGObjectView.cxx | 2 +- .../bbsVtkGUIEditorGraphic/vtkGPortView.cxx | 7 ++-- .../wxVtkSceneManager.cxx | 29 ++++++++++++-- 9 files changed, 82 insertions(+), 62 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index 41fb867..c902136 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx index 4549df8..97e98f4 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx @@ -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 { diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx index 9e5c0d6..02d194b 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx @@ -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( ) ; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h index 8a5cf7a..df91361 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx index 88ce615..c104877 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.cxx @@ -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 ) ; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h index 194d060..dcac186 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGComplexBoxPortView.h @@ -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(); }; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx index 90d1ba4..3427deb 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx @@ -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; diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx index b0ef338..bffe953 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx @@ -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 ************************* diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 95a2454..af87221 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -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 = ""; std::string line = ""; -- 2.47.1