]> Creatis software - bbtkGEditor.git/commitdiff
Important change in the project to visualize the contour when the output was selected...
authorcorredor <>
Wed, 14 Apr 2010 14:32:17 +0000 (14:32 +0000)
committercorredor <>
Wed, 14 Apr 2010 14:32:17 +0000 (14:32 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorView.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorView.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx

index f2866f599afa50e52256b0458ae34be28f6ac38e..876dbb072c94123b165b2acf1ead577aab1a4d36 100644 (file)
@@ -92,7 +92,6 @@ namespace bbtk
        void GBlackBoxModel::move(double xx,double yy,double zz)
        {
                setInicPoint(xx,yy,zz);
-               //std::cout<<"GBlackBoxModel::move xx:"<<xx<<" yy:"<<yy<<" zz:"<<zz<<std::endl;
 
                //Refresh inputs position
                int i;
@@ -111,15 +110,15 @@ namespace bbtk
        
        //=========================================================================
 
-       GPortModel* GBlackBoxModel::getStartInputPort()
+       GPortModel* GBlackBoxModel::getStartOutputPort()
        {
                GPortModel* temp = NULL;
 
                for(int i=0; i<_inputs.size() && temp == NULL;i++)
                {
-                       if(_inputs[i]->getState() == CREATING_CONTOUR)
+                       if(_outputs[i]->getState() == CREATING_CONTOUR)
                        {
-                               temp = _inputs[i];
+                               temp = _outputs[i];
                        }
                }
 
index f1c36cf6030daf603e07b8d15209c24e1f9a711d..160ac37cd32a7ba3ce023333fdb8f6769bd30203 100644 (file)
@@ -75,7 +75,7 @@ namespace bbtk
                int getNumInputPorts();
                int getNumOutputPorts();
                virtual void move(double xx,double yy,double zz);
-               GPortModel* getStartInputPort();
+               GPortModel* getStartOutputPort();
 
 
        private:
index 4fb178ede60f48feab786e3ee40c936d67157cf9..06afba201c36ebecde19ce41ad930eec72cf3973 100644 (file)
@@ -59,10 +59,10 @@ namespace bbtk
        const int CREATING_CONTOUR=106;
 
        // Object dimensions
-       const double BOX_HEIGHT=0.15;
-       const double BOX_WIDTH=1.0;
-       const double PORT_HEIGHT=0.04;
-       const double PORT_WIDTH=0.04;
+       const double BOX_HEIGHT=15;
+       const double BOX_WIDTH=100;
+       const double PORT_HEIGHT=3;
+       const double PORT_WIDTH=3;
 
        // Commands
        const int REPAINT = 201;
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
index 0692d82aed4f4b1a8b6846d06c1723020a46ec65..e1dccfcfd45f8b357bc143f9e564cc084ddcc409 100644 (file)
@@ -47,6 +47,7 @@ Version:   $Revision$
 #include "GObjectsMVCFactory.h"
 #include "Observer.h"
 #include "GPortModel.h"
+#include "GConnectorView.h"
 
 //Includes bbtk
 #include <bbtkBlackBoxInputDescriptor.h>
@@ -57,7 +58,6 @@ Version:   $Revision$
 #include <InteractorStyleMaracas.h>
 #include <vtkInteractorStyleBaseView2D.h>
 #include <manualContourControler.h>
-#include <manualViewContour.h>
 #include <manualContourModel.h>
 
 //Includes vtk
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorView.cxx
new file mode 100644 (file)
index 0000000..ee86d3d
--- /dev/null
@@ -0,0 +1,62 @@
+/*=========================================================================                                                                               
+Program:   bbtk
+Module:    $RCSfile$
+Language:  C++
+Date:      $Date$
+Version:   $Revision$
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+/**
+*  \file 
+*  \brief Class bbtk::GConnectorView 
+*/
+
+
+#include "GConnectorView.h"
+
+namespace bbtk
+{
+
+
+       //=========================================================================
+       GConnectorView::GConnectorView()
+       {               
+       }
+
+       //=========================================================================
+       GConnectorView::~GConnectorView()
+       {
+       }
+       //=========================================================================
+
+       void GConnectorView::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type)
+       {
+               _wxvtkbaseview->TransCoordScreenToWorld(X,Y,Z,type);
+       }
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorView.h
new file mode 100644 (file)
index 0000000..3cd5c11
--- /dev/null
@@ -0,0 +1,87 @@
+/*=========================================================================                                                                               
+Program:   bbtk
+Module:    $RCSfile$
+Language:  C++
+Date:      $Date$
+Version:   $Revision$
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+
+
+/**
+*  \file 
+*  \brief Class bbtk::GConnectorView : abstract black-box interface. 
+*/
+
+/**
+* \class bbtk::GConnectorView
+* \brief 
+*/
+
+#ifndef __GConnectorView_h__
+#define __GConnectorView_h__
+
+//Includes same project
+
+//Includes creaMaracasVisu
+#include <manualViewContour.h>
+
+
+//Includes std
+#include <iostream>
+
+
+namespace bbtk
+{
+
+       class GConnectorView : public manualViewContour
+       {
+
+       public: 
+
+               //Constructors
+               GConnectorView();
+               ~GConnectorView();
+               
+               //Public methods                
+               virtual void TransfromCoordViewWorld(double &X, double &Y, double &Z, int type=2);
+
+       private:
+
+               //Attributes
+               
+
+               //Private Methods
+
+       protected:
+               //Protected methods
+               
+       };
+
+
+}
+// namespace bbtk
+#endif
+
index c9c196b2ad776da0d7103006618c9234291cd4f0..7e66a83ecfe11dbe44a366f80583dfc4c0b15d83 100644 (file)
@@ -67,7 +67,7 @@ namespace bbtk
                        int portType = ((GPortModel*)_model)->getPortType();
 
                        //Evaluate new state
-                       if(!_model->hasChanged() && state==HIGHLIGHTED && portType==GINPUTPORT )
+                       if(!_model->hasChanged() && state==HIGHLIGHTED && portType==GOUTPUTPORT )
                        {
                                _model->setState(CREATING_CONTOUR);
                                _model->setChanged();
index 64d1ceca7a1b29a3b7a89ba4279694afcc68396a..a354fd71da2901050ea97efc5796669c4fdee33a 100644 (file)
@@ -86,10 +86,12 @@ namespace bbtk
                _model->getInicPoint(xInic,yInic,zInic);
                _model->getFinalPoint(xFin, yFin,zFin);
 
-               _pts->SetPoint(0, xInic, yInic, 0 );
-               _pts->SetPoint(1, xInic, yFin, 0 );
-               _pts->SetPoint(2, xFin, yFin, 0 );
-               _pts->SetPoint(3, xFin, yInic, 0 );
+               // 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 );
 
                //-----------
 
@@ -118,10 +120,12 @@ namespace bbtk
                _model->getInicPoint(xInic,yInic,zInic);
                _model->getFinalPoint(xFin, yFin,zFin);
 
-               _pts->SetPoint(0, xInic, yInic, 0 );
-               _pts->SetPoint(1, xInic, yFin, 0 );
-               _pts->SetPoint(2, xFin, yFin, 0 );
-               _pts->SetPoint(3, xFin, yInic, 0 );
+               // 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 );
                                
                lines->InsertNextCell(5);
                lines->InsertCellPoint(0);
@@ -163,6 +167,7 @@ namespace bbtk
                //------------
 
                updatePositionTextActors( xInic,  yInic,  zInic);
+
                _nameActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
                _typeActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
 
@@ -182,11 +187,11 @@ namespace bbtk
 
        void vtkGBlackBoxView::updatePositionTextActors(double xInic, double yInic, double zInic)
        {
-               _nameActor->SetPosition(xInic+0.04,yInic-0.05,zInic);
-               _nameActor->SetScale(0.03,0.02,1);
+               _nameActor->SetPosition(xInic+4,yInic-5,zInic);
+               _nameActor->SetScale(3,2,1);
                                        
-               _typeActor->SetPosition(xInic+0.04,yInic-0.1,zInic);
-               _typeActor->SetScale(0.03,0.02,1);
+               _typeActor->SetPosition(xInic+4,yInic-10,zInic);
+               _typeActor->SetScale(3,2,1);
        }
 
 
index 4e92f740266fb4bcd745c0e1b69145f9342e7b64..98cfc8584b1204378b2aa597ad1ce28a583bf03e 100644 (file)
@@ -100,7 +100,8 @@ namespace bbtk
 
        bool vtkGObjectView::isPointInside(int X,int Y) //virtual
        {
-               double xx=X,yy=Y,zz=0;
+               // RaC In the actual version, always z=900
+               double xx=X,yy=Y,zz=900;
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                return _model->isPointInside(xx,yy,zz);
        }
@@ -109,7 +110,8 @@ namespace bbtk
 
        void vtkGObjectView::moveObject(int X,int Y) //virtual
        {               
-               double xx=X,yy=Y,zz=0;
+               // RaC In the actual version, always z=900
+               double xx=X,yy=Y,zz=900;
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
 
                
index d1ab127c683b6364be009dde5ad968b181802f07..d6bef81568860aae7bc07f4d537605b32eec53f7 100644 (file)
@@ -67,10 +67,12 @@ namespace bbtk
                _model->getInicPoint(xInic,yInic,zInic);
                _model->getFinalPoint(xFin, yFin,zFin);
 
-               _pts->SetPoint(0, xInic, yInic, 0 );
-               _pts->SetPoint(1, xInic, yFin, 0 );
-               _pts->SetPoint(2, xFin, yFin, 0 );
-               _pts->SetPoint(3, xFin, yInic, 0 );
+               // 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 );
 
                _baseView->GetRenderer()->Render();
                _baseView->GetRenWin()->Render();
@@ -94,10 +96,11 @@ namespace bbtk
                _model->getInicPoint(xInic,yInic,zInic);
                _model->getFinalPoint(xFin, yFin,zFin);
 
-               _pts->SetPoint(0, xInic, yInic, 0 );
-               _pts->SetPoint(1, xInic, yFin, 0 );
-               _pts->SetPoint(2, xFin, yFin, 0 );
-               _pts->SetPoint(3, xFin, yInic, 0 );
+               // 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 );
                                
                lines->InsertNextCell(5);
                lines->InsertCellPoint(0);