#ifndef _AIS_ColoredShape_HeaderFile
#define _AIS_ColoredShape_HeaderFile
-#include <AIS_Drawer.hxx>
+#include <AIS_DataMapOfShapeDrawer.hxx>
#include <AIS_Shape.hxx>
-
-#include <NCollection_DataMap.hxx>
#include <NCollection_IndexedDataMap.hxx>
-#include <TopTools_ShapeMapHasher.hxx>
-#include <TopoDS_Compound.hxx>
#include <StdPrs_Volume.hxx>
-
-//! Customizable properties.
-class AIS_ColoredDrawer : public AIS_Drawer
-{
-public:
-
- AIS_ColoredDrawer (const Handle(AIS_Drawer)& theLink)
- : myIsHidden (Standard_False),
- myHasOwnColor (Standard_False),
- myHasOwnWidth (Standard_False)
- {
- Link (theLink);
- }
-
- Standard_Boolean IsHidden() const { return myIsHidden; }
- void SetHidden (const Standard_Boolean theToHide) { myIsHidden = theToHide; }
- Standard_Boolean HasOwnColor() const { return myHasOwnColor; }
- void UnsetOwnColor() { myHasOwnColor = Standard_False; }
- void SetOwnColor (const Quantity_Color& /*theColor*/) { myHasOwnColor = Standard_True; }
- Standard_Boolean HasOwnWidth() const { return myHasOwnWidth; }
- void UnsetOwnWidth() { myHasOwnWidth = Standard_False; }
- void SetOwnWidth (const Standard_Real /*theWidth*/) { myHasOwnWidth = Standard_True; }
-
-public: //! @name list of overridden properties
-
- Standard_Boolean myIsHidden;
- Standard_Boolean myHasOwnColor;
- Standard_Boolean myHasOwnWidth;
-
-public:
- DEFINE_STANDARD_RTTI(AIS_ColoredDrawer);
-
-};
-
-DEFINE_STANDARD_HANDLE(AIS_ColoredDrawer, AIS_Drawer)
+#include <TopoDS_Compound.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TColStd_MapTransientHasher.hxx>
//! Presentation of the shape with customizable sub-shapes properties.
class AIS_ColoredShape : public AIS_Shape
//! Customize properties of specified sub-shape.
//! The shape will be stored in the map but ignored, if it is not sub-shape of main Shape!
//! This method can be used to mark sub-shapes with customizable properties.
- Standard_EXPORT Handle(AIS_ColoredDrawer) CustomAspects (const TopoDS_Shape& theShape);
+ Standard_EXPORT virtual Handle(AIS_ColoredDrawer) CustomAspects (const TopoDS_Shape& theShape);
//! Reset the map of custom sub-shape aspects.
- Standard_EXPORT void ClearCustomAspects();
+ Standard_EXPORT virtual void ClearCustomAspects();
//! Reset custom properties of specified sub-shape.
//! @param theToUnregister unregister or not sub-shape from the map
Standard_EXPORT void SetCustomWidth (const TopoDS_Shape& theShape,
const Standard_Real theLineWidth);
+ //! Return the map of custom aspects.
+ const AIS_DataMapOfShapeDrawer& CustomAspectsMap() const { return myShapeColors; }
+
+ //! Return the map of custom aspects.
+ AIS_DataMapOfShapeDrawer& ChangeCustomAspectsMap() { return myShapeColors; }
+
public: //! @name global aspects
//! Setup color of entire shape.
protected:
- typedef NCollection_DataMap<TopoDS_Shape, Handle(AIS_ColoredDrawer), TopTools_ShapeMapHasher> DataMapOfShapeColor;
- typedef NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> DataMapOfShapeShape;
- typedef NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Compound, TopTools_ShapeMapHasher> DataMapOfShapeCompd;
+ typedef NCollection_IndexedDataMap<Handle(AIS_ColoredDrawer), TopoDS_Compound, TColStd_MapTransientHasher> DataMapOfDrawerCompd;
protected:
//! Recursive function to map shapes.
- //! @param theBaseKey the key to be used for undetailed shapes (default colors)
- //! @param theSubshapeToParse the subshape to be parsed
- //! @param theSubshapeKeyshapeMap shapes map Subshape (in the base shape) -> Keyshape (detailed shape)
- //! @param theParentType the parent subshape type
- //! @param theTypeKeyshapeDrawshapeArray the array of shape types to fill
- Standard_EXPORT static Standard_Boolean dispatchColors (const TopoDS_Shape& theBaseKey,
- const TopoDS_Shape& theSubshapeToParse,
- const DataMapOfShapeShape& theSubshapeKeyshapeMap,
- const TopAbs_ShapeEnum theParentType,
- DataMapOfShapeCompd* theTypeKeyshapeDrawshapeArray);
-
- Standard_EXPORT static void dispatchColors (const TopoDS_Shape& theBaseShape,
- const DataMapOfShapeColor& theKeyshapeColorMap,
- DataMapOfShapeCompd* theTypeKeyshapeDrawshapeArray);
-
+ //! @param theParentDrawer the drawer to be used for undetailed shapes (default colors)
+ //! @param theShapeToParse the subshape to be recursively parsed
+ //! @param theShapeDrawerMap shapes map Subshape (in the base shape) -> Drawer
+ //! @param theParentType the parent subshape type
+ //! @param theIsParentClosed flag indicating that specified shape is part of closed Solid
+ //! @param theDrawerOpenedShapePerType the array of shape types to fill
+ //! @param theDrawerClosedFaces the map for closed faces
+ Standard_EXPORT static Standard_Boolean dispatchColors (const Handle(AIS_ColoredDrawer)& theParentDrawer,
+ const TopoDS_Shape& theShapeToParse,
+ const AIS_DataMapOfShapeDrawer& theShapeDrawerMap,
+ const TopAbs_ShapeEnum theParentType,
+ const Standard_Boolean theIsParentClosed,
+ DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
+ DataMapOfDrawerCompd& theDrawerClosedFaces);
protected:
//! Add shape to presentation
- //! @param thePrs the presentation
- //! @param theDispatched the shapes map with unique attributes
- //! @param theMode display mode
- //! @param theVolume how to interpret theDispatched shapes - as Closed volumes, as Open volumes
- //! or to perform Autodetection
+ //! @param thePrs the presentation
+ //! @param theDrawerOpenedShapePerType the shapes map with unique attributes
+ //! @param theDrawerClosedFaces the map of attributes for closed faces
+ //! @param theMode display mode
Standard_EXPORT void addShapesWithCustomProps (const Handle(Prs3d_Presentation)& thePrs,
- DataMapOfShapeCompd* theDispatched,
- const Standard_Integer theMode,
- const StdPrs_Volume theVolume);
+ const DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
+ const DataMapOfDrawerCompd& theDrawerClosedFaces,
+ const Standard_Integer theMode);
//! Check all shapes from myShapeColorsfor visibility
Standard_EXPORT Standard_Boolean isShapeEntirelyVisible() const;
- //! Check a shape with unique attributes for visibility of all 2d subshape
- Standard_EXPORT Standard_Boolean isShapeEntirelyVisible (DataMapOfShapeCompd* theDispatched) const;
-
//! Resolve (parse) theKeyShape into subshapes, search in they for theBaseShape,
- //! bind all resolved subshapes with theOriginKeyShape and store all binds in theSubshapeKeyshapeMap
- //! @param theSubshapeKeyshapeMap shapes map: resolved and found theBaseShape subshape -> theOriginKeyShape
- //! @param theBaseShape a shape to be sought
- //! @param theBaseKey a shape to be resolved (parse) into smaller (in topological sense)
- //! subshapes for new bind cycle
- //! @param theOriginKeyShape the key to be used for undetailed shapes (default colors)
- Standard_EXPORT static void bindSubShapes (DataMapOfShapeShape& theSubshapeKeyshapeMap,
- const TopoDS_Shape& theBaseShape,
- const TopoDS_Shape& theKeyShape,
- const TopoDS_Shape& theOriginKeyShape);
+ //! bind all resolved subshapes with theOriginKeyShape and store all binds in theShapeDrawerMap
+ //! @param theShapeDrawerMap shapes map: resolved and found theBaseShape subshape -> theOriginKeyShape
+ //! @param theKeyShape a shape to be resolved (parse) into smaller (in topological sense)
+ //! subshapes for new bind cycle
+ //! @param theDrawer assigned drawer
+ Standard_EXPORT void bindSubShapes (AIS_DataMapOfShapeDrawer& theShapeDrawerMap,
+ const TopoDS_Shape& theKeyShape,
+ const Handle(AIS_ColoredDrawer)& theDrawer);
protected:
- DataMapOfShapeColor myShapeColors;
+ AIS_DataMapOfShapeDrawer myShapeColors;
public:
- DEFINE_STANDARD_RTTI(AIS_ColoredShape);
+ DEFINE_STANDARD_RTTIEXT(AIS_ColoredShape,AIS_Shape)
};