]> Creatis software - bbtkGEditor.git/commitdiff
Properties panel and black box text info
authorcorredor <>
Thu, 8 Apr 2010 13:32:37 +0000 (13:32 +0000)
committercorredor <>
Thu, 8 Apr 2010 13:32:37 +0000 (13:32 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxPropertiesPanel.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxPropertiesPanel.h [new file with mode: 0644]

index f6d8c4d174da9f0fedebfdf3c5806166893797f4..d2212d4a860497a721de25b445d3426a54c6e297 100644 (file)
@@ -147,6 +147,34 @@ namespace bbtk
 
        //=========================================================================
 
+       std::string GObjectModel::getBBTKType()
+       {
+               return _bbtkType; 
+       }
+
+       //=========================================================================
+
+       void GObjectModel::setBBTKType(std::string obtype)
+       {
+               _bbtkType = obtype;
+       }
+
+       //=========================================================================
+               
+       std::string GObjectModel::getBBTKName()
+       {
+               return _bbtkName;
+       }
+
+       //=========================================================================
+
+       void GObjectModel::setBBTKName(std::string obname)
+       {
+               _bbtkName = obname;
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index b610386018001a98279f611c60d20d0e0fb226a2..eefd07c1928cf980db1fb406d7ea465f0fc075b8 100644 (file)
@@ -82,7 +82,12 @@ namespace bbtk
 
                int getGObjectType();
                void setGObjectType(int obtype);
+
+               std::string getBBTKType();
+               void setBBTKType(std::string obtype);
                
+               std::string getBBTKName();
+               void setBBTKName(std::string obname);
                
        private:
 
@@ -104,6 +109,9 @@ namespace bbtk
                int  _state;
                int  _gObjectType;
 
+               std::string _bbtkType;
+               std::string _bbtkName;
+
                //Protected methods
                
        };
index 2beacdbf88add1d6b93be550707b191e1f9a1c7e..4fb178ede60f48feab786e3ee40c936d67157cf9 100644 (file)
@@ -59,7 +59,7 @@ namespace bbtk
        const int CREATING_CONTOUR=106;
 
        // Object dimensions
-       const double BOX_HEIGHT=0.1;
+       const double BOX_HEIGHT=0.15;
        const double BOX_WIDTH=1.0;
        const double PORT_HEIGHT=0.04;
        const double PORT_WIDTH=0.04;
index 3c79b612fdb903cd3395cce040e00b83d389ba1d..005c52fb096f9494682bfd3d9321946fe05d88dc 100644 (file)
@@ -97,7 +97,15 @@ 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);
                        
                        // ******* TO ERASE *******
                        /////////////////////
@@ -164,6 +172,15 @@ namespace bbtk
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                model->setInicPoint(xx,yy,zz);
                
+               int cantObjects = _objects.size();
+               cantObjects++;
+               std::stringstream stream;
+               stream << "Object " << cantObjects;
+               std::string arraystring = stream.str();
+
+               model->setBBTKName(arraystring);
+               model->setBBTKType(boxName);
+                               
                model->addObserver(view);
                model->addObserver(this);
 
@@ -341,15 +358,12 @@ namespace bbtk
                
                if(command==INIT_CREATION_CONTOUR)
                {
-                       std::cout<<"wxVtkSceneManager::update size:"<<_objects.size()<<std::endl;
                        for(int i = 0; i<_objects.size();i++)
                        {
-                               std::cout<<"wxVtkSceneManager::update type:"<<_objects[i]->getGObjectType()<<std::endl;
                                if(_objects[i]->getGObjectType() == GBLACKBOX)
                                {
                                        
                                        GPortModel* startInputPort=((GBlackBoxModel*)_objects[i])->getStartInputPort();
-                                       std::cout<<"wxVtkSceneManager::update "<<startInputPort<<std::endl;
                                        createGConnector(startInputPort);
 
                                }
index 55343688793515d83555e59cd9af5b0a028a567c..0692d82aed4f4b1a8b6846d06c1723020a46ec65 100644 (file)
@@ -66,6 +66,9 @@ Version:   $Revision$
 #include <vtkRenderer.h>
 #include <vtkInteractorStyleImage.h>
 
+#include <vtkVectorText.h>
+#include <vtkLinearExtrusionFilter.h>
+
 //Includes std
 #include <iostream>
 #include <map>
index 5c36d4b2ab66fc3462b71f45ade703a68d4c11e2..64d1ceca7a1b29a3b7a89ba4279694afcc68396a 100644 (file)
@@ -57,21 +57,29 @@ namespace bbtk
                {
                        _objectActor->GetProperty()->SetLineWidth(1);
                        _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+                       _nameActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
+                       _typeActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
                }
                else if(_model->getState()==HIGHLIGHTED)
                {
                        _objectActor->GetProperty()->SetLineWidth(2);
                        _objectActor->GetProperty()->SetColor(BOXCONTOUR_HIGHLIGHTED_R,BOXCONTOUR_HIGHLIGHTED_G,BOXCONTOUR_HIGHLIGHTED_B);
+                       _nameActor->GetProperty()->SetColor(BOXCONTOUR_HIGHLIGHTED_R,BOXCONTOUR_HIGHLIGHTED_G,BOXCONTOUR_HIGHLIGHTED_B);
+                       _typeActor->GetProperty()->SetColor(BOXCONTOUR_HIGHLIGHTED_R,BOXCONTOUR_HIGHLIGHTED_G,BOXCONTOUR_HIGHLIGHTED_B);
                }
                else if(_model->getState()==DRAG)
                {
                        _objectActor->GetProperty()->SetLineWidth(1.2);
                        _objectActor->GetProperty()->SetColor(BOXCONTOUR_DRAG_R,BOXCONTOUR_DRAG_G,BOXCONTOUR_DRAG_B);
+                       _nameActor->GetProperty()->SetColor(BOXCONTOUR_DRAG_R,BOXCONTOUR_DRAG_G,BOXCONTOUR_DRAG_B);
+                       _typeActor->GetProperty()->SetColor(BOXCONTOUR_DRAG_R,BOXCONTOUR_DRAG_G,BOXCONTOUR_DRAG_B);
                }
                else if(_model->getState()==SELECTED)
                {
                        _objectActor->GetProperty()->SetLineWidth(2);
                        _objectActor->GetProperty()->SetColor(BOXCONTOUR_SELECTED_R,BOXCONTOUR_SELECTED_G,BOXCONTOUR_SELECTED_B);
+                       _nameActor->GetProperty()->SetColor(BOXCONTOUR_SELECTED_R,BOXCONTOUR_SELECTED_G,BOXCONTOUR_SELECTED_B);
+                       _typeActor->GetProperty()->SetColor(BOXCONTOUR_SELECTED_R,BOXCONTOUR_SELECTED_G,BOXCONTOUR_SELECTED_B);
                }
 
                double xInic, yInic,zInic,xFin, yFin,zFin;
@@ -83,6 +91,12 @@ namespace bbtk
                _pts->SetPoint(2, xFin, yFin, 0 );
                _pts->SetPoint(3, xFin, yInic, 0 );
 
+               //-----------
+
+               updatePositionTextActors(xInic, yInic,zInic);
+
+               //-----------
+
                _baseView->GetRenWin()->Render();
        }
 
@@ -90,6 +104,8 @@ namespace bbtk
 
        void vtkGBlackBoxView::createVtkObjects() //virtual
        {
+
+               //------------
                _pts = vtkPoints::New();        
                vtkCellArray *lines = vtkCellArray::New();
                vtkPolyData *_pd = vtkPolyData::New();
@@ -122,10 +138,57 @@ namespace bbtk
 
                _objectActor->GetProperty()->SetColor(BOXCONTOUR_NH_R,BOXCONTOUR_NH_G,BOXCONTOUR_NH_B);
 
+               //------------
+
+               _vectorNameText = vtkVectorText::New();
+               std::string temp = _model->getBBTKName();
+               _vectorNameText->SetText(temp.c_str());
+
+               vtkPolyDataMapper* txtMapper = vtkPolyDataMapper::New();
+               txtMapper->SetInputConnection( _vectorNameText->GetOutputPort());
+               _nameActor = vtkActor::New();
+               _nameActor->SetMapper(txtMapper);
+
+               //------------
+
+               _vectorTypeText = vtkVectorText::New();
+               temp = _model->getBBTKType();
+               _vectorTypeText->SetText(temp.c_str());
+
+               txtMapper = vtkPolyDataMapper::New();
+               txtMapper->SetInputConnection( _vectorTypeText->GetOutputPort());
+               _typeActor = vtkActor::New();
+               _typeActor->SetMapper(txtMapper);
+
+               //------------
+
+               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);
+
+       }
+
+       //=========================================================================
+
+       void vtkGBlackBoxView::addVtkActors()//virtual
+       {
+               _baseView->GetRenderer()->AddActor(_nameActor);
+               _baseView->GetRenderer()->AddActor(_typeActor);
+
+               vtkGObjectView::addVtkActors();
        }
 
        //=========================================================================
 
+       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);
+                                       
+               _typeActor->SetPosition(xInic+0.04,yInic-0.1,zInic);
+               _typeActor->SetScale(0.03,0.02,1);
+       }
+
 
 }  // EO namespace bbtk
 
index 05a536a0b23b1ffae4ad7d7a17767d722a7af5f7..2d5ce85352a3aacde2a9fb14f2353bf4e2290150 100644 (file)
@@ -53,7 +53,7 @@ Version:   $Revision$
 
 #include "vtkPolyDataMapper.h"
 #include "vtkActor.h"
-
+#include "vtkVectorText.h"
 #include "vtkRenderer.h"
 #include "vtkCellArray.h"
 
@@ -80,14 +80,20 @@ namespace bbtk
 
                //Private Attributes
                vtkPoints *_pts;
+               vtkActor* _nameActor;
+               vtkActor* _typeActor;
+               vtkVectorText* _vectorNameText;
+               vtkVectorText* _vectorTypeText;
 
                //Private Methods
+               void updatePositionTextActors(double xInic, double yInic, double zInic);
 
        protected:
 
                //Protected Attributes
                
                //Protected Methods
+               virtual void addVtkActors();
                virtual void createVtkObjects();
                virtual void update(int command);
        };
index 0f87071f6fdadb24053f960ae8a0102ab488d2b9..6049911d6ddceab8ccc1aed7075a6a4559b16a0d 100644 (file)
@@ -67,6 +67,7 @@ namespace bbtk
                initTabPanelsManager();
                initPackageBrowser();
                initHelpHTMLBrowser();
+               initPropertiesPanel();
 
                CreateStatusBar();
                _frameAUIMgr->Update();
@@ -148,6 +149,14 @@ namespace bbtk
 
        //================================================================
 
+       void wxGUIEditorGraphicBBS::initPropertiesPanel()
+       {
+               _propertiesPanel = new wxPropertiesPanel(this);
+               _frameAUIMgr->AddPane(_propertiesPanel,wxAuiPaneInfo().Right().MinSize(200,200).CloseButton(false).Floatable(false));
+       }
+
+       //================================================================
+
        void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc( const std::string& pack )
        {
                std::string mess("Regenerating doc for package '");
index 4a62c668e328e8034f8d91224f07bac180ec82e3..483d2b4fc502bcad9f7c5333d482139aead76fbb 100644 (file)
@@ -45,6 +45,7 @@
 
 //Includes same project
 #include "wxTabPanelsManager.h"
+#include "wxPropertiesPanel.h"
 #include "wxart_new.xpm"
 
 //Includes creaMaracasVisu
@@ -66,6 +67,7 @@
 #include <wx/bitmap.h>
 #include <wx/menu.h>
 #include <wx/dnd.h>
+#include <wx/grid.h>
 
 //Includes std
 
@@ -83,6 +85,7 @@ namespace bbtk
                void initTabPanelsManager();
                void initPackageBrowser();
                void initHelpHTMLBrowser();
+               void initPropertiesPanel();
 
                void RegenerateAll();
                void DoRegeneratePackageDoc(const std::string& pack);   
@@ -98,6 +101,7 @@ namespace bbtk
                wxAuiNotebook                                           *_notebook;
                WxGUIPackageBrowser2                            *_pkgBrowser;
                WxGUIHtmlBrowser                                        *_helpHtmlBrowser;
+               wxPropertiesPanel                                       *_propertiesPanel;
 
                std::string _dataDir;
 
diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxPropertiesPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxPropertiesPanel.cxx
new file mode 100644 (file)
index 0000000..0118e3b
--- /dev/null
@@ -0,0 +1,71 @@
+/*=========================================================================                                                                               
+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::wxPropertiesPanel . 
+*/
+
+
+#include "wxPropertiesPanel.h"
+
+
+namespace bbtk
+{
+       //=========================================================================
+       wxPropertiesPanel::wxPropertiesPanel()
+       {
+               _grid=NULL;
+       }
+
+       //=========================================================================
+       wxPropertiesPanel::wxPropertiesPanel(wxWindow *parent):wxPanel(parent)
+       {
+               _grid = new wxGrid(this,wxID_ANY);
+               _grid->CreateGrid(15,2);
+               _grid->SetColLabelSize(0);
+               _grid->SetRowLabelSize(0);
+
+               wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+               sizer->Add(_grid,0,wxEXPAND|wxALL,0);
+               SetSizer(sizer);
+       }
+
+       //=========================================================================
+       wxPropertiesPanel::~wxPropertiesPanel()
+       {
+
+       }
+       //=========================================================================
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxPropertiesPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxPropertiesPanel.h
new file mode 100644 (file)
index 0000000..147fe13
--- /dev/null
@@ -0,0 +1,83 @@
+/*=========================================================================                                                                               
+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::wxPropertiesPanel : abstract black-box interface. 
+*/
+
+/**
+* \class bbtk::wxPropertiesPanel
+* \brief 
+*/
+
+#ifndef __wxPropertiesPanel_h__
+#define __wxPropertiesPanel_h__
+
+//Includes same project
+
+//Includes wxWidgets
+#include <wx/panel.h>
+#include <wx/aui/aui.h>
+#include <wx/dnd.h>
+#include <wx/grid.h>
+
+//Includes creaMaracasVisu
+
+//Includes std
+#include <iostream>
+
+
+
+
+namespace bbtk
+{
+
+       class wxPropertiesPanel :  public wxPanel
+       {
+       public: 
+               wxPropertiesPanel();
+               wxPropertiesPanel(wxWindow *parent);
+               ~wxPropertiesPanel();
+               
+       private:
+               wxGrid          *_grid;
+       
+       protected:
+
+       };
+
+
+}
+// namespace bbtk
+#endif
+