X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMBase%2FGEOMBase_Helper.h;h=a49a4dd6b9fd53eda0b41af4bf6aa2e3addc854e;hb=bbafce4b04731f9219f75dc124ec2429d994c202;hp=d8bc391d4e2a2861f4a9f43c618a74b712aeeb5c;hpb=392885c1a8d50369708bbe5e6b44033ed8b8ba51;p=modules%2Fgeom.git diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h old mode 100755 new mode 100644 index d8bc391d4..a49a4dd6b --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -1,42 +1,47 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMBase_Helper.h // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) -// + #ifndef GEOMBASE_HELPER_H #define GEOMBASE_HELPER_H #include "GEOM_GEOMBase.hxx" +#include "GEOM_GenericObjPtr.h" #include #include #include #include CORBA_CLIENT_HEADER(GEOM_Gen) +#include + #include #include #include +#include typedef std::list ObjectList; @@ -45,11 +50,10 @@ class SUIT_Desktop; class SUIT_ViewWindow; class SALOME_Prs; class GEOM_Operation; -class TColStd_MapOfInteger; //================================================================ // Class : GEOMBase_Helper -// Description : Helper class for dialog box development, can be used as +// Description : Helper class for dialog box development, can be used as // the second base class for dialog boxes. Contains convenient methods // performing common operations (display/erase, selection activation, // publication in a study, transaction management) @@ -57,10 +61,13 @@ class TColStd_MapOfInteger; class GEOMBASE_EXPORT GEOMBase_Helper { public: - GEOMBase_Helper( SUIT_Desktop* ); + GEOMBase_Helper( SUIT_Desktop*, SUIT_ViewWindow* aVW = 0); virtual ~GEOMBase_Helper(); + static SUIT_ViewWindow* getActiveView(); protected: + typedef std::list PrsList; + static GEOM::GEOM_Gen_ptr getGeomEngine(); void display ( const ObjectList&, const bool = true ); @@ -70,29 +77,38 @@ protected: void redisplay ( const ObjectList&, const bool = true, const bool = true ); void redisplay ( GEOM::GEOM_Object_ptr, const bool = true, const bool = true ); - virtual void displayPreview ( const bool activate = false, + virtual void displayPreview ( const bool display, + const bool activate = false, const bool update = true, const bool toRemoveFromEngine = true, - const double lineWidth = -1, + const double lineWidth = -1, const int displayMode = -1, - const int color = -1 ); + const int color = -1, + const bool append = false ); // This is the easiest way to show preview. It is based on execute() method. // It removes temporary GEOM::GEOM_Objects automatically. - virtual void displayPreview ( GEOM::GEOM_Object_ptr obj, - const bool append = false, - const bool activate = false, + virtual void displayPreview ( GEOM::GEOM_Object_ptr obj, + const bool append = false, + const bool activate = false, const bool update = true, - const double lineWidth = -1, + const double lineWidth = -1, const int displayMode = -1, const int color = -1 ); - void displayPreview ( const SALOME_Prs* prs, - const bool append = false, - const bool = true ); + void displayPreview ( const SALOME_Prs* prs, + const bool append = false, + const bool = true ); void erasePreview ( const bool = true ); + const PrsList& getPreview() const { return myPreview; } + + void localSelection( const ObjectList&, const std::list ); void localSelection( const ObjectList&, const int ); + void localSelection( GEOM::GEOM_Object_ptr, const std::list ); void localSelection( GEOM::GEOM_Object_ptr, const int ); + void localSelection( const std::string&, const std::string&, const std::list ); + void localSelection( const std::list ); + void localSelection( const int ); void activate( const int ); void globalSelection( const int = GEOM_ALLOBJECTS, const bool = false ); void globalSelection( const TColStd_MapOfInteger&, const bool = false ); @@ -102,7 +118,7 @@ protected: void prepareSelection( const ObjectList&, const int ); void prepareSelection( GEOM::GEOM_Object_ptr, const int ); - void addInStudy ( GEOM::GEOM_Object_ptr, const char* theName ); + QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName ); bool openCommand (); bool abortCommand (); @@ -110,17 +126,16 @@ protected: bool hasCommand () const; void updateObjBrowser() const; - int getStudyId () const; SalomeApp_Study* getStudy () const; bool checkViewWindow (); - bool onAccept( const bool publish = true, const bool useTransaction = true ); + bool onAccept( const bool publish = true, const bool useTransaction = true, bool erasePreviewFlag = true); // This method should be called from "OK" button handler. - // == true means that objects returned by execute() + // == true means that objects returned by execute() // should be published in a study. void showError(); - // Shows a message box with infromation about an error taken from getOperation()->GetErrorCode() + // Shows a message box with information about an error taken from getOperation()->GetErrorCode() void showError( const QString& msg ); // Shows a error message followed by @@ -131,16 +146,16 @@ protected: inline void setPrefix( const QString& prefix ) { myPrefix = prefix; } QString getPrefix( GEOM::GEOM_Object_ptr = GEOM::GEOM_Object::_nil() ) const; - + bool selectObjects( ObjectList& objects ); - // Selects list of objects + // Selects list of objects //////////////////////////////////////////////////////////////////////////// // Virtual methods, to be redefined in dialog classes //////////////////////////////////////////////////////////////////////////// virtual GEOM::GEOM_IOperations_ptr createOperation(); - // This method should be redefined in dialog boxes so as to return + // This method should be redefined in dialog boxes so as to return // proper GEOM_IOperation interface. // Returns nil reference by default @@ -148,11 +163,11 @@ protected: // Called by onAccept(). Redefine this method to check validity of user input in dialog boxes. virtual bool execute( ObjectList& objects ); - // This method is called by onAccept(). - // It should perform the required operation and put all new or modified objects into - // argument.Should return if some error occurs during its execution. + // This method is called by onAccept(). + // It should perform the required operation and put all new or modified objects into + // argument.Should return if some error occurs during its execution. - virtual void restoreSubShapes( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject ); + virtual void restoreSubShapes( SALOMEDS::SObject_ptr theSObject ); // This method is called by addInStudy(). virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr theObj ); @@ -160,26 +175,46 @@ protected: // for or a nil reference if should be published // as a top-level object. - virtual QString getNewObjectName() const; + virtual QString getNewObjectName (int CurrObj = -1) const; + virtual QString getObjectName(GEOM::GEOM_Object_ptr object) const; + virtual bool extractPrefix() const; virtual void addSubshapesToStudy(); + virtual QList getSourceObjects(); GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, const QString& theName ); - //This Metod to find SubObject in theFather Object by Name (theName) + GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, int theIndex ); + // These methods are used to find published sub-object (sub-shape) in the parent object (main shape) - void addSubshapesToFather( QMap& theMap ); + GEOM::GeomObjPtr getSelected( TopAbs_ShapeEnum type ); + GEOM::GeomObjPtr getSelected( const QList& types ); + QList getSelected( TopAbs_ShapeEnum type, int count, bool strict = true ); + QList getSelected( const QList& types, int count, bool strict = true ); + void hideSourceObjects( QList theObjectList ); void SetIsPreview(const bool thePreview) {isPreview = thePreview;} bool IsPreview() {return isPreview;} GEOM_Displayer* getDisplayer(); SUIT_Desktop* getDesktop() const; + virtual void setIsApplyAndClose( const bool theFlag ); + virtual bool isApplyAndClose() const; + + virtual void setIsOptimizedBrowsing( const bool theFlag ); + virtual bool isOptimizedBrowsing() const; + + virtual void setIsWaitCursorEnabled( const bool theFlag ) {myIsWaitCursorEnabled = theFlag;} + virtual bool isWaitCursorEnabled() const {return myIsWaitCursorEnabled ;} + virtual void setIsDisableBrowsing( const bool theFlag ) { myIsDisableBrowsing = theFlag; } + virtual bool isDisableBrowsing() const { return myIsDisableBrowsing; } + virtual void setIsDisplayResult( const bool theFlag ) {myIsDisplayResult = theFlag; } + virtual bool isDisplayResult() const { return myIsDisplayResult; } + private: - char* getEntry ( GEOM::GEOM_Object_ptr ) const; + QString getEntry( GEOM::GEOM_Object_ptr ) const; void clearShapeBuffer( GEOM::GEOM_Object_ptr ); private: - typedef std::list PrsList; PrsList myPreview; GEOM_Displayer* myDisplayer; @@ -190,7 +225,12 @@ private: bool isPreview; SALOME_ListIO mySelected; SUIT_Desktop* myDesktop; - + bool myIsApplyAndClose; + bool myIsOptimizedBrowsing; + bool myIsWaitCursorEnabled; + bool myIsDisableBrowsing; //This flag enable/disable selection + //in the Object Browser newly created objects. + bool myIsDisplayResult; //This flag display/hide newly created objects. }; #endif // GEOMBASE_HELPER_H