File indexing completed on 2026-09-19 09:27:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _AIS_ColoredShape_HeaderFile
0017 #define _AIS_ColoredShape_HeaderFile
0018
0019 #include <AIS_ColoredDrawer.hxx>
0020 #include <NCollection_DataMap.hxx>
0021 #include <TopTools_ShapeMapHasher.hxx>
0022 #include <AIS_Shape.hxx>
0023 #include <NCollection_IndexedDataMap.hxx>
0024 #include <TopoDS_Compound.hxx>
0025 #include <TopoDS_Shape.hxx>
0026 #include <NCollection_Map.hxx>
0027
0028 class StdSelect_BRepOwner;
0029
0030
0031 class AIS_ColoredShape : public AIS_Shape
0032 {
0033 public:
0034
0035 Standard_EXPORT AIS_ColoredShape(const TopoDS_Shape& theShape);
0036
0037
0038 Standard_EXPORT AIS_ColoredShape(const occ::handle<AIS_Shape>& theShape);
0039
0040 public:
0041
0042
0043
0044 Standard_EXPORT virtual occ::handle<AIS_ColoredDrawer> CustomAspects(
0045 const TopoDS_Shape& theShape);
0046
0047
0048 Standard_EXPORT virtual void ClearCustomAspects();
0049
0050
0051
0052 Standard_EXPORT void UnsetCustomAspects(const TopoDS_Shape& theShape,
0053 const bool theToUnregister = false);
0054
0055
0056 Standard_EXPORT void SetCustomColor(const TopoDS_Shape& theShape, const Quantity_Color& theColor);
0057
0058
0059 Standard_EXPORT void SetCustomTransparency(const TopoDS_Shape& theShape, double theTransparency);
0060
0061
0062 Standard_EXPORT void SetCustomWidth(const TopoDS_Shape& theShape, const double theLineWidth);
0063
0064
0065 const NCollection_DataMap<TopoDS_Shape, occ::handle<AIS_ColoredDrawer>, TopTools_ShapeMapHasher>&
0066 CustomAspectsMap() const
0067 {
0068 return myShapeColors;
0069 }
0070
0071
0072 NCollection_DataMap<TopoDS_Shape, occ::handle<AIS_ColoredDrawer>, TopTools_ShapeMapHasher>&
0073 ChangeCustomAspectsMap()
0074 {
0075 return myShapeColors;
0076 }
0077
0078 public:
0079
0080 Standard_EXPORT void SetColor(const Quantity_Color& theColor) override;
0081
0082
0083 Standard_EXPORT void SetWidth(const double theLineWidth) override;
0084
0085
0086 Standard_EXPORT void SetTransparency(const double theValue) override;
0087
0088
0089 Standard_EXPORT void SetMaterial(const Graphic3d_MaterialAspect& theAspect) override;
0090
0091 public:
0092
0093 Standard_EXPORT void UnsetTransparency() override;
0094
0095
0096 Standard_EXPORT void UnsetWidth() override;
0097
0098 protected:
0099
0100 Standard_EXPORT void Compute(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0101 const occ::handle<Prs3d_Presentation>& thePrs,
0102 const int theMode) override;
0103
0104
0105 Standard_EXPORT void ComputeSelection(const occ::handle<SelectMgr_Selection>& theSelection,
0106 const int theMode) override;
0107
0108 protected:
0109 typedef NCollection_IndexedDataMap<occ::handle<AIS_ColoredDrawer>, TopoDS_Compound>
0110 DataMapOfDrawerCompd;
0111
0112 protected:
0113
0114
0115
0116
0117
0118
0119
0120
0121 Standard_EXPORT static bool dispatchColors(
0122 const occ::handle<AIS_ColoredDrawer>& theParentDrawer,
0123 const TopoDS_Shape& theShapeToParse,
0124 const NCollection_DataMap<TopoDS_Shape,
0125 occ::handle<AIS_ColoredDrawer>,
0126 TopTools_ShapeMapHasher>& theShapeDrawerMap,
0127 const TopAbs_ShapeEnum theParentType,
0128 const bool theIsParentClosed,
0129 DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
0130 DataMapOfDrawerCompd& theDrawerClosedFaces);
0131
0132 protected:
0133
0134
0135
0136 Standard_EXPORT void fillSubshapeDrawerMap(
0137 NCollection_DataMap<TopoDS_Shape, occ::handle<AIS_ColoredDrawer>, TopTools_ShapeMapHasher>&
0138 theSubshapeDrawerMap) const;
0139
0140
0141
0142
0143
0144
0145 Standard_EXPORT void addShapesWithCustomProps(
0146 const occ::handle<Prs3d_Presentation>& thePrs,
0147 const DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
0148 const DataMapOfDrawerCompd& theDrawerClosedFaces,
0149 const int theMode);
0150
0151
0152 Standard_EXPORT bool isShapeEntirelyVisible() const;
0153
0154
0155
0156
0157
0158
0159
0160
0161 Standard_EXPORT void bindSubShapes(
0162 NCollection_DataMap<TopoDS_Shape, occ::handle<AIS_ColoredDrawer>, TopTools_ShapeMapHasher>&
0163 theShapeDrawerMap,
0164 const TopoDS_Shape& theKeyShape,
0165 const occ::handle<AIS_ColoredDrawer>& theDrawer) const;
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176 Standard_EXPORT void computeSubshapeSelection(
0177 const occ::handle<AIS_ColoredDrawer>& theParentDrawer,
0178 const NCollection_DataMap<TopoDS_Shape,
0179 occ::handle<AIS_ColoredDrawer>,
0180 TopTools_ShapeMapHasher>& theShapeDrawerMap,
0181 const TopoDS_Shape& theShape,
0182 const occ::handle<StdSelect_BRepOwner>& theOwner,
0183 const occ::handle<SelectMgr_Selection>& theSelection,
0184 const TopAbs_ShapeEnum theTypOfSel,
0185 const int thePriority,
0186 const double theDeflection,
0187 const double theDeflAngle);
0188
0189 protected:
0190 NCollection_DataMap<TopoDS_Shape, occ::handle<AIS_ColoredDrawer>, TopTools_ShapeMapHasher>
0191 myShapeColors;
0192
0193 public:
0194 DEFINE_STANDARD_RTTIEXT(AIS_ColoredShape, AIS_Shape)
0195 };
0196
0197 #endif