00001 /*========================================================================= 00002 Program: bbtk 00003 Module: $RCSfile: vtkGObjectView.h,v $ 00004 Language: C++ 00005 Date: $Date: 2010/09/22 23:14:05 $ 00006 Version: $Revision: 1.14 $ 00007 =========================================================================*/ 00008 00009 /* --------------------------------------------------------------------- 00010 00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) 00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux 00013 * 00014 * This software is governed by the CeCILL-B license under French law and 00015 * abiding by the rules of distribution of free software. You can use, 00016 * modify and/ or redistribute the software under the terms of the CeCILL-B 00017 * license as circulated by CEA, CNRS and INRIA at the following URL 00018 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 00019 * or in the file LICENSE.txt. 00020 * 00021 * As a counterpart to the access to the source code and rights to copy, 00022 * modify and redistribute granted by the license, users are provided only 00023 * with a limited warranty and the software's author, the holder of the 00024 * economic rights, and the successive licensors have only limited 00025 * liability. 00026 * 00027 * The fact that you are presently reading this means that you have had 00028 * knowledge of the CeCILL-B license and that you accept its terms. 00029 * ------------------------------------------------------------------------ */ 00030 00031 00032 00038 /**** 00039 * Design and Developpement of BBTK GEditor 00040 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co> 00041 * RaC - 2010 00042 ****/ 00043 00044 #ifndef __vtkGObjectView_h__ 00045 #define __vtkGObjectView_h__ 00046 00047 //Includes same project 00048 #include "GlobalConstants.h" 00049 #include "GObjectModel.h" 00050 #include "Observer.h" 00051 00052 //Includes creaMaracasVisu 00053 #include <wxVtkBaseView.h> 00054 #include <vtkInteractorStyleBaseView.h> 00055 00056 //Includes vtk 00057 #include <vtkRenderer.h> 00058 #include "vtkConeSource.h" 00059 #include "vtkPolyDataMapper.h" 00060 #include "vtkActor.h" 00061 00062 00063 //Includes std 00064 #include <iostream> 00065 00066 00067 namespace bbtk 00068 { 00069 00070 class vtkGObjectView : public Observer 00071 { 00072 00073 public: 00074 00075 //Constructors 00076 vtkGObjectView(); 00077 ~vtkGObjectView(); 00078 00079 //Public methods 00080 00081 void setModel(GObjectModel *model); 00082 void setBaseView(wxVtkBaseView* baseView); 00083 void initVtkObjects(); 00084 00085 void setStartDragging(bool param); 00086 00087 void setState(int state); 00088 int getState(); 00089 00090 // Method to force a vtk refresh to the list of controllers of the wxVtkBaseView 00091 void setRefreshWaiting(); 00092 00093 virtual bool isPointInside(int X,int Y); 00094 virtual void moveObject(int X, int Y); 00095 00096 virtual void removeFromScene(); 00097 00098 virtual void update(int idController,int command); 00099 00100 private: 00101 00102 //Private Attributes 00103 bool _isStartDragging; 00104 00105 //Makes a difference between the first point clicked and the new position, in order to move the selected objects 00106 double dragDifX; 00107 double dragDifY; 00108 00109 00110 //Private Methods 00111 00112 protected: 00113 00114 //Protected Attributes 00115 00116 wxVtkBaseView * _baseView; 00117 GObjectModel * _model; 00118 vtkActor * _borderObjectActor; 00119 vtkActor * _fillObjectActor; 00120 vtkPolyDataMapper * _fillPolyMapper; 00121 vtkPolyDataMapper * _borderPolyMapper; 00122 00123 vtkPoints *_pts; 00124 00125 // State of the object (See GlobalConstants.h) 00126 int _state; 00127 00128 //Protected Methods 00129 virtual void createVtkObjects(); 00130 virtual void addVtkActors(); 00131 virtual void removeVtkActors(); 00132 virtual void updateColors(); 00133 }; 00134 00135 00136 } 00137 // namespace bbtk 00138 #endif 00139