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 GEOMBASE_HELPER_H
00028 #define GEOMBASE_HELPER_H
00029
00030 #include "GEOM_GEOMBase.hxx"
00031 #include "GEOM_GenericObjPtr.h"
00032
00033 #include <GEOM_Displayer.h>
00034 #include <SALOME_ListIO.hxx>
00035 #include <SALOMEconfig.h>
00036 #include CORBA_CLIENT_HEADER(GEOM_Gen)
00037
00038 #include <QString>
00039 #include <QMap>
00040
00041 #include <list>
00042
00043 typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
00044
00045 class SalomeApp_Study;
00046 class SUIT_Desktop;
00047 class SUIT_ViewWindow;
00048 class SALOME_Prs;
00049 class GEOM_Operation;
00050 class TColStd_MapOfInteger;
00051
00052
00053
00054
00055
00056
00057
00058
00059 class GEOMBASE_EXPORT GEOMBase_Helper
00060 {
00061 public:
00062 GEOMBase_Helper( SUIT_Desktop* );
00063 virtual ~GEOMBase_Helper();
00064
00065 protected:
00066 static GEOM::GEOM_Gen_ptr getGeomEngine();
00067
00068 void display ( const ObjectList&, const bool = true );
00069 void display ( GEOM::GEOM_Object_ptr, const bool = true );
00070 void erase ( const ObjectList&, const bool = true );
00071 void erase ( GEOM::GEOM_Object_ptr, const bool = true );
00072 void redisplay ( const ObjectList&, const bool = true, const bool = true );
00073 void redisplay ( GEOM::GEOM_Object_ptr, const bool = true, const bool = true );
00074
00075 virtual void displayPreview ( const bool display,
00076 const bool activate = false,
00077 const bool update = true,
00078 const bool toRemoveFromEngine = true,
00079 const double lineWidth = -1,
00080 const int displayMode = -1,
00081 const int color = -1 );
00082
00083
00084
00085 virtual void displayPreview ( GEOM::GEOM_Object_ptr obj,
00086 const bool append = false,
00087 const bool activate = false,
00088 const bool update = true,
00089 const double lineWidth = -1,
00090 const int displayMode = -1,
00091 const int color = -1 );
00092 void displayPreview ( const SALOME_Prs* prs,
00093 const bool append = false,
00094 const bool = true );
00095 void erasePreview ( const bool = true );
00096
00097 void localSelection( const ObjectList&, const int );
00098 void localSelection( GEOM::GEOM_Object_ptr, const int );
00099 void activate( const int );
00100 void globalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
00101 void globalSelection( const TColStd_MapOfInteger&, const bool = false );
00102 void globalSelection( const TColStd_MapOfInteger&, const QList<int>& ,const bool = false );
00103 void updateViewer ();
00104
00105 void prepareSelection( const ObjectList&, const int );
00106 void prepareSelection( GEOM::GEOM_Object_ptr, const int );
00107
00108 QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName );
00109
00110 bool openCommand ();
00111 bool abortCommand ();
00112 bool commitCommand ( const char* = 0 );
00113 bool hasCommand () const;
00114
00115 void updateObjBrowser() const;
00116 int getStudyId () const;
00117 SalomeApp_Study* getStudy () const;
00118 bool checkViewWindow ();
00119
00120 bool onAccept( const bool publish = true, const bool useTransaction = true );
00121
00122
00123
00124
00125 void showError();
00126
00127 void showError( const QString& msg );
00128
00129
00130 GEOM::GEOM_IOperations_ptr getOperation();
00131
00132
00133
00134
00135 inline void setPrefix( const QString& prefix ) { myPrefix = prefix; }
00136 QString getPrefix( GEOM::GEOM_Object_ptr = GEOM::GEOM_Object::_nil() ) const;
00137
00138 bool selectObjects( ObjectList& objects );
00139
00140
00142
00144
00145 virtual GEOM::GEOM_IOperations_ptr createOperation();
00146
00147
00148
00149
00150 virtual bool isValid( QString& msg );
00151
00152
00153 virtual bool execute( ObjectList& objects );
00154
00155
00156
00157
00158 virtual void restoreSubShapes( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject );
00159
00160
00161 virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr theObj );
00162
00163
00164
00165
00166 virtual QString getNewObjectName() const;
00167 virtual bool extractPrefix() const;
00168 virtual void addSubshapesToStudy();
00169
00170 GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, const QString& theName );
00171 GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, int theIndex );
00172
00173
00174 GEOM::GeomObjPtr getSelected( TopAbs_ShapeEnum type );
00175 GEOM::GeomObjPtr getSelected( const QList<TopAbs_ShapeEnum>& types );
00176 QList<GEOM::GeomObjPtr> getSelected( TopAbs_ShapeEnum type, int count, bool strict = true );
00177 QList<GEOM::GeomObjPtr> getSelected( const QList<TopAbs_ShapeEnum>& types, int count, bool strict = true );
00178
00179 void SetIsPreview(const bool thePreview) {isPreview = thePreview;}
00180 bool IsPreview() {return isPreview;}
00181
00182 GEOM_Displayer* getDisplayer();
00183 SUIT_Desktop* getDesktop() const;
00184
00185 virtual void setIsApplyAndClose( const bool theFlag );
00186 virtual bool isApplyAndClose() const;
00187
00188 virtual void setIsOptimizedBrowsing( const bool theFlag );
00189 virtual bool isOptimizedBrowsing() const;
00190
00191 private:
00192 QString getEntry( GEOM::GEOM_Object_ptr ) const;
00193 void clearShapeBuffer( GEOM::GEOM_Object_ptr );
00194
00195 private:
00196 typedef std::list<SALOME_Prs*> PrsList;
00197
00198 PrsList myPreview;
00199 GEOM_Displayer* myDisplayer;
00200 GEOM_Operation* myCommand;
00201 GEOM::GEOM_IOperations_var myOperation;
00202 SUIT_ViewWindow* myViewWindow;
00203 QString myPrefix;
00204 bool isPreview;
00205 SALOME_ListIO mySelected;
00206 SUIT_Desktop* myDesktop;
00207 bool myIsApplyAndClose;
00208 bool myIsOptimizedBrowsing;
00209
00210 };
00211
00212 #endif // GEOMBASE_HELPER_H