File indexing completed on 2025-01-18 10:03:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _Graphic3d_CStructure_HeaderFile
0016 #define _Graphic3d_CStructure_HeaderFile
0017
0018 #include <Graphic3d_DisplayPriority.hxx>
0019 #include <Graphic3d_PresentationAttributes.hxx>
0020 #include <Graphic3d_SequenceOfGroup.hxx>
0021 #include <Graphic3d_SequenceOfHClipPlane.hxx>
0022 #include <Graphic3d_ViewAffinity.hxx>
0023 #include <Graphic3d_TransformPers.hxx>
0024 #include <Graphic3d_ZLayerId.hxx>
0025 #include <TopLoc_Datum3D.hxx>
0026 #include <NCollection_IndexedMap.hxx>
0027
0028 class Graphic3d_GraphicDriver;
0029 class Graphic3d_StructureManager;
0030
0031
0032 class Graphic3d_CStructure : public Standard_Transient
0033 {
0034 DEFINE_STANDARD_RTTIEXT(Graphic3d_CStructure, Standard_Transient)
0035 protected:
0036
0037
0038 template<class Struct_t>
0039 class SubclassStructIterator
0040 {
0041 public:
0042 SubclassStructIterator (const NCollection_IndexedMap<const Graphic3d_CStructure*>& theStructs) : myIter (theStructs) {}
0043 Standard_Boolean More() const { return myIter.More(); }
0044 void Next() { myIter.Next(); }
0045 const Struct_t* Value() const { return (const Struct_t* )(myIter.Value()); }
0046 Struct_t* ChangeValue() { return (Struct_t* )(myIter.Value()); }
0047 private:
0048 NCollection_IndexedMap<const Graphic3d_CStructure*>::Iterator myIter;
0049 };
0050
0051
0052 template<class Group_t>
0053 class SubclassGroupIterator
0054 {
0055 public:
0056 SubclassGroupIterator (const Graphic3d_SequenceOfGroup& theGroups) : myIter (theGroups) {}
0057 Standard_Boolean More() const { return myIter.More(); }
0058 void Next() { myIter.Next(); }
0059 const Group_t* Value() const { return (const Group_t* )(myIter.Value().get()); }
0060 Group_t* ChangeValue() { return (Group_t* )(myIter.ChangeValue().get()); }
0061 private:
0062 Graphic3d_SequenceOfGroup::Iterator myIter;
0063 };
0064
0065 public:
0066
0067
0068 const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const
0069 {
0070 return myGraphicDriver;
0071 }
0072
0073
0074 const Graphic3d_SequenceOfGroup& Groups() const
0075 {
0076 return myGroups;
0077 }
0078
0079
0080 const Handle(TopLoc_Datum3D)& Transformation() const { return myTrsf; }
0081
0082
0083 virtual void SetTransformation (const Handle(TopLoc_Datum3D)& theTrsf) { myTrsf = theTrsf; }
0084
0085
0086 const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTrsfPers; }
0087
0088
0089 virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers) { myTrsfPers = theTrsfPers; }
0090
0091
0092 bool HasGroupTransformPersistence() const { return myHasGroupTrsf; }
0093
0094
0095 void SetGroupTransformPersistence (bool theValue) { myHasGroupTrsf = theValue; }
0096
0097
0098 const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const
0099 {
0100 return myClipPlanes;
0101 }
0102
0103
0104 void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { myClipPlanes = thePlanes; }
0105
0106
0107 const Graphic3d_BndBox3d& BoundingBox() const
0108 {
0109 return myBndBox;
0110 }
0111
0112
0113
0114 Graphic3d_BndBox3d& ChangeBoundingBox()
0115 {
0116 return myBndBox;
0117 }
0118
0119
0120 bool IsVisible() const { return visible != 0; }
0121
0122
0123 bool IsVisible (const Standard_Integer theViewId) const
0124 {
0125 return visible != 0
0126 && (ViewAffinity.IsNull()
0127 || ViewAffinity->IsVisible (theViewId));
0128 }
0129
0130
0131 virtual void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) { myZLayer = theLayerIndex; }
0132
0133
0134 Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
0135
0136
0137
0138 const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myHighlightStyle; }
0139
0140
0141 Standard_Integer Identification() const { return myId; }
0142
0143
0144 Graphic3d_DisplayPriority Priority() const { return myPriority; }
0145
0146
0147 void SetPriority (Graphic3d_DisplayPriority thePriority) { myPriority = thePriority; }
0148
0149
0150 Graphic3d_DisplayPriority PreviousPriority() const { return myPreviousPriority; }
0151
0152
0153 void SetPreviousPriority (Graphic3d_DisplayPriority thePriority) { myPreviousPriority = thePriority; }
0154
0155 public:
0156
0157
0158 Standard_Boolean IsCulled() const { return myIsCulled; }
0159
0160
0161 void SetCulled (Standard_Boolean theIsCulled) const { myIsCulled = theIsCulled; }
0162
0163
0164
0165 void MarkAsNotCulled() const { myIsCulled = Standard_False; }
0166
0167
0168 Standard_Boolean BndBoxClipCheck() const { return myBndBoxClipCheck; }
0169
0170
0171 void SetBndBoxClipCheck(Standard_Boolean theBndBoxClipCheck) { myBndBoxClipCheck = theBndBoxClipCheck; }
0172
0173
0174 Standard_Boolean IsAlwaysRendered() const
0175 {
0176 return IsInfinite
0177 || IsForHighlight
0178 || IsMutable
0179 || Is2dText
0180 || (!myTrsfPers.IsNull() && myTrsfPers->IsTrihedronOr2d());
0181 }
0182
0183 public:
0184
0185
0186 virtual void OnVisibilityChanged() = 0;
0187
0188
0189 virtual void Clear() = 0;
0190
0191
0192 virtual void Connect (Graphic3d_CStructure& theStructure) = 0;
0193
0194
0195 virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
0196
0197
0198 virtual void GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle) = 0;
0199
0200
0201 virtual void GraphicUnhighlight() = 0;
0202
0203
0204 virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
0205
0206
0207 virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
0208
0209
0210 virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
0211
0212
0213 virtual void updateLayerTransformation() {}
0214
0215
0216 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0217
0218 public:
0219
0220 Handle(Graphic3d_ViewAffinity) ViewAffinity;
0221
0222 protected:
0223
0224
0225 Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
0226
0227 protected:
0228
0229 Handle(Graphic3d_GraphicDriver) myGraphicDriver;
0230 Graphic3d_SequenceOfGroup myGroups;
0231 Graphic3d_BndBox3d myBndBox;
0232 Handle(TopLoc_Datum3D) myTrsf;
0233 Handle(Graphic3d_TransformPers) myTrsfPers;
0234 Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
0235 Handle(Graphic3d_PresentationAttributes) myHighlightStyle;
0236
0237 Standard_Integer myId;
0238 Graphic3d_ZLayerId myZLayer;
0239 Graphic3d_DisplayPriority myPriority;
0240 Graphic3d_DisplayPriority myPreviousPriority;
0241
0242 mutable Standard_Boolean myIsCulled;
0243 Standard_Boolean myBndBoxClipCheck;
0244
0245 Standard_Boolean myHasGroupTrsf;
0246
0247 public:
0248
0249 unsigned IsInfinite : 1;
0250 unsigned stick : 1;
0251 unsigned highlight : 1;
0252 unsigned visible : 1;
0253 unsigned HLRValidation : 1;
0254 unsigned IsForHighlight : 1;
0255 unsigned IsMutable : 1;
0256 unsigned Is2dText : 1;
0257
0258 };
0259
0260 DEFINE_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient)
0261
0262 #endif