Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simple fix for 40160 [CEA] No name in SHAPER
[modules/shaper.git]
/
src
/
XGUI
/
XGUI_Displayer.h
diff --git
a/src/XGUI/XGUI_Displayer.h
b/src/XGUI/XGUI_Displayer.h
index 5da345d703014df4c315506532308ff7bcf6ebe8..a720d6b586af1e3b31401c705236691e4cba3121 100644
(file)
--- a/
src/XGUI/XGUI_Displayer.h
+++ b/
src/XGUI/XGUI_Displayer.h
@@
-1,4
+1,4
@@
-// Copyright (C) 2014-20
17 CEA/DEN, EDF R&D
+// Copyright (C) 2014-20
24 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-12,10
+12,9
@@
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
//
// 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
//
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef XGUI_Displayer_H
//
#ifndef XGUI_Displayer_H
@@
-24,7
+23,6
@@
#include "XGUI.h"
#include <GeomAPI_AISObject.h>
#include "XGUI.h"
#include <GeomAPI_AISObject.h>
-#include <GeomAPI_ICustomPrs.h>
#include <GeomAPI_Pln.h>
#include <ModelAPI_Result.h>
#include <GeomAPI_Pln.h>
#include <ModelAPI_Result.h>
@@
-48,11
+46,14
@@
class ModelAPI_Feature;
class XGUI_SelectionActivate;
class XGUI_Workshop;
class XGUI_SelectionActivate;
class XGUI_Workshop;
+#define OPTIMIZE_PRS
+
#ifdef TINSPECTOR
class VInspectorAPI_CallBack;
#endif
#ifdef TINSPECTOR
class VInspectorAPI_CallBack;
#endif
+#ifdef OPTIMIZE_PRS
class XGUI_TwoSidePresentationMap
{
public:
class XGUI_TwoSidePresentationMap
{
public:
@@
-160,22
+161,23
@@
private:
QMap<ObjectPtr, Handle(AIS_InteractiveObject)> myResultToAISMap;
QMap<Handle(AIS_InteractiveObject), ObjectPtr> myAIStoResultMap;
};
QMap<ObjectPtr, Handle(AIS_InteractiveObject)> myResultToAISMap;
QMap<Handle(AIS_InteractiveObject), ObjectPtr> myAIStoResultMap;
};
+#endif
/**\class XGUI_Displayer
* \ingroup GUI
* \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
*/
/**\class XGUI_Displayer
* \ingroup GUI
* \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
*/
-class XGUI_EXPORT XGUI_Displayer: public QObject
+class XGUI_EXPORT XGUI_Displayer
: public QObject
{
Q_OBJECT
{
Q_OBJECT
-
public:
-
/// \enum DisplayMode display mode
-
enum DisplayMode {
-
NoMode = -1, ///< Mode is not defined
-
Wireframe, ///< Wireframe display mode
-
Shading ///< Shading display mode
-
};
+public:
+ /// \enum DisplayMode display mode
+ enum DisplayMode {
+ NoMode = -1, ///< Mode is not defined
+ Wireframe, ///< Wireframe display mode
+ Shading ///< Shading display mode
+ };
/// Constructor
/// \param theWorkshop a workshop instance
/// Constructor
/// \param theWorkshop a workshop instance
@@
-205,7
+207,7
@@
class XGUI_EXPORT XGUI_Displayer: public QObject
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
/// \return true if the object visibility state is changed
bool displayAIS(AISObjectPtr theAIS, const bool toActivateInSelectionModes,
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
/// \return true if the object visibility state is changed
bool displayAIS(AISObjectPtr theAIS, const bool toActivateInSelectionModes,
-
const Standard_Integer theDisplayMode = 0, bool theUpdateViewer = true);
+ const Standard_Integer theDisplayMode = 0, bool theUpdateViewer = true);
/// Redisplay the shape if it was displayed
/// \param theObject an object instance
/// Redisplay the shape if it was displayed
/// \param theObject an object instance
@@
-222,7
+224,7
@@
class XGUI_EXPORT XGUI_Displayer: public QObject
/// \param theValues a list of presentation to be selected
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
/// \param theValues a list of presentation to be selected
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
-
bool theUpdateViewer = true);
+ bool theUpdateViewer = true);
/// Unselect all objects
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
/// Unselect all objects
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
@@
-274,7
+276,10
@@
class XGUI_EXPORT XGUI_Displayer: public QObject
bool enableUpdateViewer(const bool isEnabled);
/// Returns true if the viewer update is not blocked
bool enableUpdateViewer(const bool isEnabled);
/// Returns true if the viewer update is not blocked
- bool isUpdateEnabled() const;
+ bool isUpdateEnabled() const
+ {
+ return myViewerBlockedRecursiveCount == 0;
+ }
/// Updates the viewer
void updateViewer() const;
/// Updates the viewer
void updateViewer() const;
@@
-298,7
+303,7
@@
class XGUI_EXPORT XGUI_Displayer: public QObject
/// \param theObjList - list of objects which has to be deactivated.
/// \param theUpdateViewer update viewer flag
void deactivateObjects(const QObjectPtrList& theObjList,
/// \param theObjList - list of objects which has to be deactivated.
/// \param theUpdateViewer update viewer flag
void deactivateObjects(const QObjectPtrList& theObjList,
-
const bool theUpdateViewer = true);
+ const bool theUpdateViewer = true);
/// Sets display mode for the given object if this object is displayed
void setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool theUpdateViewer = true);
/// Sets display mode for the given object if this object is displayed
void setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool theUpdateViewer = true);
@@
-316,13
+321,26
@@
class XGUI_EXPORT XGUI_Displayer: public QObject
int objectsCount() const { return myResult2AISObjectMap.size(); }
/// Returns list of displayed objects
int objectsCount() const { return myResult2AISObjectMap.size(); }
/// Returns list of displayed objects
- QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.objects(); }
+ QObjectPtrList displayedObjects() const {
+#ifdef OPTIMIZE_PRS
+ return myResult2AISObjectMap.objects();
+#else
+ return myResult2AISObjectMap.keys();
+#endif
+ }
/// Returns list of displayed objects
/// Returns list of displayed objects
+#ifdef OPTIMIZE_PRS
QList<Handle(AIS_InteractiveObject)> displayedPresentations() const
{
return myResult2AISObjectMap.presentations();
}
QList<Handle(AIS_InteractiveObject)> displayedPresentations() const
{
return myResult2AISObjectMap.presentations();
}
+#else
+ QList<AISObjectPtr> displayedPresentations() const
+ {
+ return myResult2AISObjectMap.values();
+ }
+#endif
/// Returns true if the given object can be shown in shaded mode
/// \param theObject object to check
/// Returns true if the given object can be shown in shaded mode
/// \param theObject object to check
@@
-359,6
+377,13
@@
class XGUI_EXPORT XGUI_Displayer: public QObject
/// Returns scale of active view
double getViewScale() const;
/// Returns scale of active view
double getViewScale() const;
+ /// Set color of selection
+ /// \param theColor R,G,B values of color
+ void setSelectionColor(const std::vector<int>& theColor);
+
+ /// Returns current selection color
+ std::vector<int> selectionColor() const;
+
signals:
/// Signal on object display
/// \param theObject a data object
signals:
/// Signal on object display
/// \param theObject a data object
@@
-424,27
+449,28
@@
private:
const NCollection_DataMap<TopoDS_Shape,
NCollection_Map<Handle(AIS_InteractiveObject)>>& theShapesToBeSelected);
const NCollection_DataMap<TopoDS_Shape,
NCollection_Map<Handle(AIS_InteractiveObject)>>& theShapesToBeSelected);
-pr
otected
:
+pr
ivate
:
XGUI_SelectionActivate* selectionActivate() const;
XGUI_SelectionActivate* selectionActivate() const;
-pr
otected
:
+pr
ivate
:
XGUI_Workshop* myWorkshop; ///< Reference to workshop
#ifdef TINSPECTOR
Handle(VInspectorAPI_CallBack) myVCallBack;
#endif
Handle(SelectMgr_AndFilter) myAndFilter; ///< A container for selection filters
XGUI_Workshop* myWorkshop; ///< Reference to workshop
#ifdef TINSPECTOR
Handle(VInspectorAPI_CallBack) myVCallBack;
#endif
Handle(SelectMgr_AndFilter) myAndFilter; ///< A container for selection filters
- /// A default custom presentation, which is used if the displayed feature is not
- /// a custom presentation
- GeomCustomPrsPtr myCustomPrs;
-
/// Definition of a type of map which defines correspondance between objects and presentations
/// Definition of a type of map which defines correspondance between objects and presentations
+#ifdef OPTIMIZE_PRS
XGUI_TwoSidePresentationMap myResult2AISObjectMap; ///< A map of displayed objects
XGUI_TwoSidePresentationMap myResult2AISObjectMap; ///< A map of displayed objects
+#else
+ typedef QMap<ObjectPtr, AISObjectPtr> ResultToAISMap;
+ ResultToAISMap myResult2AISObjectMap; ///< A map of displayed objects
+#endif
/// Number of blocking of the viewer update. The viewer is updated only if it is zero
int myViewerBlockedRecursiveCount;
/// Number of blocking of the viewer update. The viewer is updated only if it is zero
int myViewerBlockedRecursiveCount;
- bool myIsFirstAISContextUse; ///< Flag: first asking of AIS context: trihedron activation
+ mutable void* myContextId;
mutable bool myNeedUpdate; ///< A flag that update was requested but not done
};
mutable bool myNeedUpdate; ///< A flag that update was requested but not done
};