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