X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMGUI%2FGEOM_Displayer.h;h=712fe8316ab3aa04dc4b15d3cd6e2a61e3d93326;hb=1be0dcd9a7556a9a0c6a1a81bdcf3c5bfbd3c202;hp=ea2958a01072ad51788b747be0d5064336746a6c;hpb=f931ebe5b663153f8e276d607d870aa401a91048;p=modules%2Fgeom.git diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h old mode 100644 new mode 100755 index ea2958a01..712fe8316 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -1,39 +1,53 @@ -// GEOM GEOMGUI : GUI for Geometry component +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 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 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// 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, 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. // -// File : GEOM_Displayer.h -// Author : Vadim SANDLER -// Module : GEOM -// $Header$ +// 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 +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOM_Displayer.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#ifndef GEOM_DISPLAYER_H +#define GEOM_DISPLAYER_H + +#include "GEOM_GEOMGUI.hxx" +#include + +#include -#if !defined (__GEOM_DISPLAYER_H) -#define __GEOM_DISPLAYER_H +class GEOM_Actor; +class SALOME_ListIO; +class SALOME_View; +class SALOME_Prs; +class SALOME_OCCPrs; +class SALOME_VTKPrs; +class SALOME_OCCViewType; -#include "SALOME_Prs.h" -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_ListIO.hxx" #include #include +#include +#include +#include +#include +#include +#include #include @@ -47,71 +61,75 @@ typedef std::list ObjectList; -class TColStd_MapOfInteger; -class SalomeApp_SelectionMgr; +class LightApp_SelectionMgr; class SalomeApp_Study; +class SalomeApp_Application; class SUIT_SelectionFilter; -//class SALOME_Selection; +class gp_Ax3; -#ifdef WNT -#include -#else -#define SALOME_WNT_EXPORT -#endif - -class SALOME_WNT_EXPORT GEOM_Displayer : public SALOME_Displayer +class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer { - + public: /* Constructor */ - GEOM_Displayer( SalomeApp_Study* study ); + GEOM_Displayer( SalomeApp_Study* app ); /* Destructor */ virtual ~GEOM_Displayer(); - /* Display/Erase object methods */ + virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const; + /* Display/Erase object methods */ void Display ( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer = true, - SALOME_View* theViewFrame = 0 ); + SALOME_View* theViewFrame = 0 ); // This overloaded Display() method can be useful for operations // not using dialog boxes. - void Display ( GEOM::GEOM_Object_ptr theObj, - const bool updateViewer = true ); - - void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, + void Display ( GEOM::GEOM_BaseObject_ptr theObj, const bool updateViewer = true ); + void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, + const bool updateViewer = true, + const bool checkActiveViewer = true ); + + void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, + const bool theUpdateViewer, + SALOME_View* theViewFrame ); + void Erase ( const Handle(SALOME_InteractiveObject)& theIO, const bool forced = false, const bool updateViewer = true, - SALOME_View* theViewFrame = 0 ); + SALOME_View* theViewFrame = 0 ); - void Erase ( GEOM::GEOM_Object_ptr theObj, + void Erase ( GEOM::GEOM_BaseObject_ptr theObj, const bool forced = false, - const bool updateViewer = true ); + const bool updateViewer = true, + SALOME_View* theViewFrame = 0); + + void EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO, + const bool eraseOnlyChildren = false); /* Display/Erase list of objects methods */ - + void Display ( const SALOME_ListIO& theIOList, const bool updateViewer = true ); - + void Erase ( const SALOME_ListIO& theIOList, const bool forced = false, const bool updateViewer = true ); - + void Redisplay ( const SALOME_ListIO& theIOList, - const bool updateViewer = true ); + const bool updateViewer = true, + const bool checkActiveViewer = true ); - /* Erase all objects displayed in the given or active view */ - void EraseAll ( const bool forced = false, - const bool updateViewer = true, - SALOME_View* theViewFrame = 0 ); + void Redisplay ( const SALOME_ListIO& theIOList, + const bool theUpdateViewer, + SALOME_View* theViewFrame ); - /* Update current viewer */ - void UpdateViewer(); + /* Update visibility state */ + void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool ); - /* build presentation accordint to the current viewer type*/ + /* build presentation according to the current viewer type*/ SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr ); SALOME_Prs* BuildPrs ( const TopoDS_Shape& ); @@ -122,72 +140,173 @@ public: int GetColor () const; bool HasColor () const; + double SetTransparency ( const double ); + double UnsetTransparency(); + double GetTransparency () const; + bool HasTransparency () const; + + /* Set texture for shape displaying. */ + void SetTexture ( const std::string& ); + bool HasTexture () const; + std::string GetTexture () const; + /* Set width for shape displaying. If it is equal -1 then default width is used. */ void SetWidth ( const double ); void UnsetWidth(); double GetWidth () const; bool HasWidth () const; + /* Set width for iso-lines displaying. If it is equal -1 then default width is used. */ + void SetIsosWidth ( const int ); + int GetIsosWidth () const; + bool HasIsosWidth () const; + + /* Set nb iso-libes for displaying. Use -1 to set default values. */ + int SetNbIsos( const int ); + int UnsetNbIsos(); + int GetNbIsos() const; + bool HasNbIsos() const; + + /* Set color for iso-lines displaying. If it is equal -1 then default color is used. + Available values are from Quantity_NameOfColor enumeration */ + int SetIsosColor ( const int ); + int UnsetIsosColor(); + int GetIsosColor () const; + bool HasIsosColor () const; + + /* Set display mode shape displaying. If it is equal -1 then display mode is used. */ + int SetDisplayMode( const int ); + int GetDisplayMode() const; + int UnsetDisplayMode(); + bool HasDisplayMode() const; /* Sets name - for temporary objects only */ - void SetName( const char* theName ) { myName = theName; } - void UnsetName() { myName = ""; } + void SetName( const char* theName ); + void UnsetName(); /* Reimplemented from SALOME_Displayer */ virtual void Update( SALOME_OCCPrs* ); virtual void Update( SALOME_VTKPrs* ); - virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ); - virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ); + virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ); + virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ); + virtual void BeforeErase ( SALOME_View*, const SALOME_OCCPrs* ); + virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* ); - /* This methos is used for activisation/deactivisation of objects to be displayed*/ + /* This methods is used for activisation/deactivisation of objects to be displayed*/ void SetToActivate( const bool ); bool ToActivate() const; /* Activate/Deactivate selection*/ + void LocalSelection( const Handle(SALOME_InteractiveObject)&, const std::list ); void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int ); + void LocalSelection( const SALOME_ListIO& theIOList, const std::list ); void LocalSelection( const SALOME_ListIO& theIOList, const int ); void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false ); - void GlobalSelection( const TColStd_MapOfInteger&, const bool = false ); + void GlobalSelection( const TColStd_MapOfInteger&, const bool = false, const QList* = 0 ); + + SalomeApp_Study* getStudy() const; + + static SALOMEDS::Color getUniqueColor( const QList& ); + static SALOMEDS::Color getPredefinedUniqueColor(); + + /*Get color of the geom object*/ + static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject, bool& hasColor); + + /* Get minimum or maximum enclosed shape type */ + static int getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin ); + + /* Check if the object is a vertex or a compound of vertices */ + static bool isCompoundOfVertices( const TopoDS_Shape& theShape ); - static SALOME_View* GetActiveView(); - SalomeApp_Study* getStudy() const {return myStudy;} + + /* Builds presentation of not published object */ + virtual SALOME_Prs* buildSubshapePresentation(const TopoDS_Shape& aShape, + const QString&, + SALOME_View* = 0); + + /* Update visibility and parameters of the currently selected field step's color scale */ + void UpdateColorScale(); + bool SetUpdateColorScale(bool); protected: /* internal methods */ - /* Builds presentation accordint to the current viewer type */ - SALOME_Prs* buildPresentation( const Handle(SALOME_InteractiveObject)& theIO, - SALOME_View* theViewFrame = 0 ); - + /* Builds presentation according to the current viewer type */ + virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); + /* Sets interactive object */ - void setIO( const Handle(SALOME_InteractiveObject)& theIO ) { myIO = theIO; } - + void setIO( const Handle(SALOME_InteractiveObject)& theIO ); + /* Sets shape */ - void setShape( const TopoDS_Shape& theShape ) { myShape = theShape; } - + void setShape( const TopoDS_Shape& theShape ); + + /* Sets field step information */ + void setFieldStepInfo( const GEOM::field_data_type theFieldDataType, + const int theFieldDimension, + const QList& theFieldStepData, + const TCollection_AsciiString& theFieldStepName, + const double theFieldStepRangeMin, + const double theFieldStepRangeMax ); + /* Resets internal data */ void internalReset(); - void clearTemporary( SalomeApp_SelectionMgr* theSelMgr ); + void clearTemporary( LightApp_SelectionMgr* theSelMgr ); SUIT_SelectionFilter* getFilter( const int theMode ); - + SUIT_SelectionFilter* getComplexFilter( const QList* ); + + Quantity_Color qColorFromResources( const QString&, const QColor& ); + QColor colorFromResources( const QString&, const QColor& ); + void updateShapeProperties( const Handle(GEOM_AISShape)&, bool ); + void updateActorProperties( GEOM_Actor*, bool ); + void updateDimensions( const Handle(SALOME_InteractiveObject)&, SALOME_OCCPrs*, const gp_Ax3& ); + void updateShapeAnnotations( const Handle(SALOME_InteractiveObject)&, SALOME_OCCPrs*, const gp_Ax3& ); + + PropMap getObjectProperties( SalomeApp_Study*, const QString&, SALOME_View* = 0 ); + PropMap getDefaultPropertyMap(); + + /* Methods for reading the field step information */ + void readFieldStepInfo( GEOM::GEOM_FieldStep_var theGeomFieldStep ); + QList groupFieldData( const QList& theFieldStepData, + const int theFieldNbComponents, + const bool theIsString, + double& theFieldStepRangeMin, + double& theFieldStepRangeMax ); + protected: Handle(SALOME_InteractiveObject) myIO; TopoDS_Shape myShape; - string myName; + GEOM::field_data_type myFieldDataType; + int myFieldDimension; + QList myFieldStepData; + TCollection_AsciiString myFieldStepName; + double myFieldStepRangeMin; + double myFieldStepRangeMax; + std::string myName; + std::string myTexture; int myType; SALOME_View* myViewFrame; + bool myUpdateColorScale; // IPAL54049 // Attributes Quantity_Color myShadingColor; int myColor; double myWidth; + int myIsosWidth; + int myNbIsos; + int myIsosColor; bool myToActivate; int myDisplayMode; + bool myHasDisplayMode; + Aspect_TypeOfMarker myTypeOfMarker; + double myScaleOfMarker; + double myTransparency; + bool myIsRedisplayed; private: - SalomeApp_Study* myStudy; + SalomeApp_Application* myApp; + friend class GEOM_Swig; }; -#endif // __GEOM_DISPLAYER_H +#endif // GEOM_DISPLAYER_H