Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef GEOM_DISPLAYER_H
00028 #define GEOM_DISPLAYER_H
00029
00030 #include "GEOM_GEOMGUI.hxx"
00031
00032 #include <SALOME_InteractiveObject.hxx>
00033
00034 class SALOME_ListIO;
00035 class SALOME_View;
00036 class SALOME_Prs;
00037 class SALOME_OCCPrs;
00038 class SALOME_VTKPrs;
00039 class SALOME_OCCViewType;
00040
00041 #include <TopoDS_Shape.hxx>
00042 #include <Quantity_Color.hxx>
00043 #include <LightApp_Displayer.h>
00044 #include <LightApp_Study.h>
00045 #include <Aspect_TypeOfMarker.hxx>
00046
00047 #include <QList>
00048
00049 #include <list>
00050
00051 #include <SALOMEconfig.h>
00052 #include CORBA_CLIENT_HEADER(GEOM_Gen)
00053
00054 #define GEOM_ALLOBJECTS -1 // Selection of all objects is activated
00055 #define GEOM_PREVIEW -2 // Definition for preview selection
00056 #define GEOM_ALLSHAPES -3 // Selection of all shapes is activated
00057 #define GEOM_ALLGEOM -4 // Selection of all geom objects is activated
00058
00059 typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
00060
00061 class TColStd_MapOfInteger;
00062 class LightApp_SelectionMgr;
00063 class SalomeApp_Study;
00064 class SalomeApp_Application;
00065 class SUIT_SelectionFilter;
00066
00067
00068 class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer
00069 {
00070
00071 public:
00072
00073 GEOM_Displayer( SalomeApp_Study* app );
00074
00075 virtual ~GEOM_Displayer();
00076
00077 virtual bool canBeDisplayed( const QString& , const QString& ) const;
00078
00079
00080 void Display ( const Handle(SALOME_InteractiveObject)& theIO,
00081 const bool updateViewer = true,
00082 SALOME_View* theViewFrame = 0 );
00083
00084
00085
00086 void Display ( GEOM::GEOM_Object_ptr theObj,
00087 const bool updateViewer = true );
00088
00089 void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
00090 const bool updateViewer = true );
00091
00092 void Erase ( const Handle(SALOME_InteractiveObject)& theIO,
00093 const bool forced = false,
00094 const bool updateViewer = true,
00095 SALOME_View* theViewFrame = 0 );
00096
00097 void Erase ( GEOM::GEOM_Object_ptr theObj,
00098 const bool forced = false,
00099 const bool updateViewer = true );
00100
00101 void EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO,
00102 const bool eraseOnlyChildren = false);
00103
00104
00105
00106 void Display ( const SALOME_ListIO& theIOList,
00107 const bool updateViewer = true );
00108
00109 void Erase ( const SALOME_ListIO& theIOList,
00110 const bool forced = false,
00111 const bool updateViewer = true );
00112
00113 void Redisplay ( const SALOME_ListIO& theIOList,
00114 const bool updateViewer = true );
00115
00116
00117 SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
00118 SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
00119
00120
00121
00122 void SetColor ( const int );
00123 void UnsetColor();
00124 int GetColor () const;
00125 bool HasColor () const;
00126
00127
00128 void SetWidth ( const double );
00129 void UnsetWidth();
00130 double GetWidth () const;
00131 bool HasWidth () const;
00132
00133
00134 int SetDisplayMode( const int );
00135 int GetDisplayMode() const;
00136 int UnsetDisplayMode();
00137
00138
00139
00140 void SetName( const char* theName );
00141 void UnsetName();
00142
00143
00144 virtual void Update( SALOME_OCCPrs* );
00145 virtual void Update( SALOME_VTKPrs* );
00146 virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* );
00147 virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* );
00148
00149
00150 void SetToActivate( const bool );
00151 bool ToActivate() const;
00152
00153
00154 void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int );
00155 void LocalSelection( const SALOME_ListIO& theIOList, const int );
00156 void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
00157 void GlobalSelection( const TColStd_MapOfInteger&, const bool = false, const QList<int>* = 0 );
00158
00159 SalomeApp_Study* getStudy() const;
00160
00161 static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
00162
00163 static PropMap getDefaultPropertyMap(const QString& viewer_type);
00164
00165 static bool MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault);
00166
00167
00168 static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject, bool& hasColor);
00169
00170
00171 static int getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin );
00172
00173
00174 static bool isCompoundOfVertices( const TopoDS_Shape& theShape );
00175
00176
00177
00178 virtual SALOME_Prs* buildSubshapePresentation(const TopoDS_Shape& aShape,
00179 const QString&,
00180 SALOME_View* = 0);
00181
00182 protected:
00183
00184
00185 virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
00186
00187
00188 void setIO( const Handle(SALOME_InteractiveObject)& theIO );
00189
00190
00191 void setShape( const TopoDS_Shape& theShape );
00192
00193
00194 void internalReset();
00195
00196 void clearTemporary( LightApp_SelectionMgr* theSelMgr );
00197
00198 SUIT_SelectionFilter* getFilter( const int theMode );
00199 SUIT_SelectionFilter* getComplexFilter( const QList<int>* );
00200
00201 protected:
00202 Handle(SALOME_InteractiveObject) myIO;
00203 TopoDS_Shape myShape;
00204 std::string myName;
00205 int myType;
00206 SALOME_View* myViewFrame;
00207
00208
00209 Quantity_Color myShadingColor;
00210 int myColor;
00211 double myWidth;
00212 bool myToActivate;
00213 int myDisplayMode;
00214 Aspect_TypeOfMarker myTypeOfMarker;
00215 double myScaleOfMarker;
00216
00217 private:
00218 SalomeApp_Application* myApp;
00219 };
00220
00221 #endif // GEOM_DISPLAYER_H
00222