X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMGUI%2FGEOM_Displayer.h;h=cf5a9df5536ac20be2197a3758db9829b29bcb61;hb=02b418c3b20546854152b3ff5b85b61ae87c9a63;hp=8cd96e5d1d1f1c4a226772f5003d4dae9f9d529e;hpb=465e84c52edb243fa36d581abc659b1c97156c64;p=modules%2Fgeom.git diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 8cd96e5d1..cf5a9df55 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// 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 @@ -28,6 +28,7 @@ #define GEOM_DISPLAYER_H #include "GEOM_GEOMGUI.hxx" +#include #include @@ -44,7 +45,12 @@ class SALOME_OCCViewType; #include #include #include - +#if OCC_VERSION_MAJOR >= 7 + #include +#endif +#include +#include +#include #include #include @@ -59,13 +65,11 @@ class SALOME_OCCViewType; typedef std::list ObjectList; -class TColStd_MapOfInteger; class LightApp_SelectionMgr; class SalomeApp_Study; class SalomeApp_Application; class SUIT_SelectionFilter; -class Handle_GEOM_AISShape; -//class SALOME_Selection; +class gp_Ax3; class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer { @@ -85,23 +89,29 @@ public: // This overloaded Display() method can be useful for operations // not using dialog boxes. - void Display ( GEOM::GEOM_Object_ptr theObj, + void Display ( GEOM::GEOM_BaseObject_ptr theObj, const bool updateViewer = true ); void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, - const bool updateViewer = true ); + 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 ); - 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); + const bool eraseOnlyChildren = false); /* Display/Erase list of objects methods */ @@ -113,7 +123,15 @@ public: const bool updateViewer = true ); void Redisplay ( const SALOME_ListIO& theIOList, - const bool updateViewer = true ); + const bool updateViewer = true, + const bool checkActiveViewer = true ); + + void Redisplay ( const SALOME_ListIO& theIOList, + const bool theUpdateViewer, + SALOME_View* theViewFrame ); + + /* Update visibility state */ + void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool ); /* build presentation accordint to the current viewer type*/ SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr ); @@ -125,6 +143,11 @@ public: void UnsetColor(); 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& ); @@ -141,7 +164,20 @@ public: 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; @@ -157,13 +193,17 @@ public: virtual void Update( SALOME_VTKPrs* ); 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*/ 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, const QList* = 0 ); @@ -188,6 +228,9 @@ public: const QString&, SALOME_View* = 0); + /* Update visibility and parameters of the currently selected field step's color scale */ + void UpdateColorScale( const bool theIsRedisplayFieldSteps = false, const bool updateViewer = true ); + protected: /* internal methods */ /* Builds presentation according to the current viewer type */ @@ -199,6 +242,14 @@ protected: /* Sets shape */ 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(); @@ -211,28 +262,61 @@ protected: 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& ); 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 ); + + // Note: the method is copied from Aspect_ColorScale class + static Standard_Integer HueFromValue( const Standard_Integer aValue, + const Standard_Integer aMin, + const Standard_Integer aMax ); + + // Note: the method is copied from Aspect_ColorScale class + static Standard_Boolean FindColor( const Standard_Real aValue, + const Standard_Real aMin, + const Standard_Real aMax, + const Standard_Integer ColorsCount, + Quantity_Color& aColor ); + protected: Handle(SALOME_InteractiveObject) myIO; TopoDS_Shape myShape; + 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; +#if OCC_VERSION_MAJOR >= 7 + Handle(AIS_ColorScale) myColorScale; +#endif // 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; private: SalomeApp_Application* myApp;