| 1 | // Created on: 1991-06-12 |
| 2 | // Created by: NW,JPB,CAL |
| 3 | // Copyright (c) 1991-1999 Matra Datavision |
| 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
| 5 | // |
| 6 | // This file is part of Open CASCADE Technology software library. |
| 7 | // |
| 8 | // This library is free software; you can redistribute it and/or modify it under |
| 9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
| 10 | // by the Free Software Foundation, with special exception defined in the file |
| 11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 12 | // distribution for complete text of the license and disclaimer of any warranty. |
| 13 | // |
| 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 15 | // commercial license or contractual agreement. |
| 16 | |
| 17 | #ifndef _Graphic3d_Structure_HeaderFile |
| 18 | #define _Graphic3d_Structure_HeaderFile |
| 19 | |
| 20 | #include <Standard.hxx> |
| 21 | #include <Standard_Type.hxx> |
| 22 | |
| 23 | #include <Graphic3d_CStructure.hxx> |
| 24 | #include <Graphic3d_IndexedMapOfAddress.hxx> |
| 25 | #include <Quantity_Color.hxx> |
| 26 | #include <Aspect_TypeOfHighlightMethod.hxx> |
| 27 | #include <Standard_Address.hxx> |
| 28 | #include <Graphic3d_TypeOfStructure.hxx> |
| 29 | #include <MMgt_TShared.hxx> |
| 30 | #include <Standard_Boolean.hxx> |
| 31 | #include <Standard_Integer.hxx> |
| 32 | #include <Graphic3d_ZLayerId.hxx> |
| 33 | #include <Graphic3d_SequenceOfHClipPlane.hxx> |
| 34 | #include <Standard_Real.hxx> |
| 35 | #include <TColStd_Array2OfReal.hxx> |
| 36 | #include <Graphic3d_SequenceOfGroup.hxx> |
| 37 | #include <Graphic3d_TypeOfConnection.hxx> |
| 38 | #include <Graphic3d_MapOfStructure.hxx> |
| 39 | #include <Graphic3d_TypeOfComposition.hxx> |
| 40 | #include <Graphic3d_TransformPers.hxx> |
| 41 | #include <Graphic3d_TransModeFlags.hxx> |
| 42 | #include <Graphic3d_BndBox4f.hxx> |
| 43 | #include <Graphic3d_BndBox4d.hxx> |
| 44 | #include <Graphic3d_Vertex.hxx> |
| 45 | class Graphic3d_PriorityDefinitionError; |
| 46 | class Graphic3d_StructureDefinitionError; |
| 47 | class Graphic3d_TransformError; |
| 48 | class Graphic3d_Group; |
| 49 | class Graphic3d_StructureManager; |
| 50 | class Quantity_Color; |
| 51 | class Graphic3d_DataStructureManager; |
| 52 | class Bnd_Box; |
| 53 | class gp_Pnt; |
| 54 | class Graphic3d_Vector; |
| 55 | |
| 56 | |
| 57 | class Graphic3d_Structure; |
| 58 | DEFINE_STANDARD_HANDLE(Graphic3d_Structure, MMgt_TShared) |
| 59 | |
| 60 | //! This class allows the definition a graphic object. |
| 61 | //! This graphic structure can be displayed, |
| 62 | //! erased, or highlighted. |
| 63 | //! This graphic structure can be connected with |
| 64 | //! another graphic structure. |
| 65 | //! Keywords: Structure, StructureManager, Display, Erase, Highlight, |
| 66 | //! UnHighlight, Visible, Priority, Selectable, Visible, |
| 67 | //! Visual, Connection, Ancestors, Descendants, Transformation |
| 68 | class Graphic3d_Structure : public MMgt_TShared |
| 69 | { |
| 70 | |
| 71 | public: |
| 72 | |
| 73 | |
| 74 | //! Creates a graphic object in the manager theManager. |
| 75 | //! It will appear in all the views of the visualiser. |
| 76 | //! The structure is not displayed when it is created. |
| 77 | Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager); |
| 78 | |
| 79 | //! Creates a shadow link to existing graphic object. |
| 80 | Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager, const Handle(Graphic3d_Structure)& thePrs); |
| 81 | |
| 82 | //! if WithDestruction == Standard_True then |
| 83 | //! suppress all the groups of primitives in the structure. |
| 84 | //! and it is mandatory to create a new group in <me>. |
| 85 | //! if WithDestruction == Standard_False then |
| 86 | //! clears all the groups of primitives in the structure. |
| 87 | //! and all the groups are conserved and empty. |
| 88 | //! They will be erased at the next screen update. |
| 89 | //! The structure itself is conserved. |
| 90 | //! The transformation and the attributes of <me> are conserved. |
| 91 | //! The childs of <me> are conserved. |
| 92 | Standard_EXPORT virtual void Clear (const Standard_Boolean WithDestruction = Standard_True); |
| 93 | |
| 94 | //! Suppresses the structure <me>. |
| 95 | //! It will be erased at the next screen update. |
| 96 | Standard_EXPORT ~Graphic3d_Structure(); |
| 97 | |
| 98 | //! Displays the structure <me> in all the views of the visualiser. |
| 99 | Standard_EXPORT virtual void Display(); |
| 100 | |
| 101 | //! Returns the current display priority for the |
| 102 | //! structure <me>. |
| 103 | Standard_EXPORT Standard_Integer DisplayPriority() const; |
| 104 | |
| 105 | //! Erases the structure <me> in all the views |
| 106 | //! of the visualiser. |
| 107 | Standard_EXPORT virtual void Erase(); |
| 108 | |
| 109 | //! Highlights the structure <me> in all the views of the visualiser, using the following methods: |
| 110 | //! TOHM_COLOR = drawn in the highlight color |
| 111 | //! TOHM_BOUNDBOX = enclosed by the boundary box |
| 112 | Standard_EXPORT void Highlight (const Aspect_TypeOfHighlightMethod theMethod, const Quantity_Color& theColor, const Standard_Boolean theToUpdateMgr = Standard_True); |
| 113 | |
| 114 | //! Suppress the structure <me>. |
| 115 | //! It will be erased at the next screen update. |
| 116 | //! Warning: No more graphic operations in <me> after this call. |
| 117 | //! Category: Methods to modify the class definition |
| 118 | Standard_EXPORT void Remove(); |
| 119 | |
| 120 | //! Computes axis-aligned bounding box of a structure. |
| 121 | Standard_EXPORT virtual void CalculateBoundBox(); |
| 122 | |
| 123 | //! If <theToSet> is Standard_True then <me> is infinite and |
| 124 | //! the MinMaxValues method method return : |
| 125 | //! theXMin = theYMin = theZMin = RealFirst(). |
| 126 | //! theXMax = theYMax = theZMax = RealLast(). |
| 127 | //! By default, <me> is not infinite but empty. |
| 128 | Standard_EXPORT void SetInfiniteState (const Standard_Boolean theToSet); |
| 129 | |
| 130 | //! Modifies the order of displaying the structure. |
| 131 | //! Values are between 0 and 10. |
| 132 | //! Structures are drawn according to their display priorities |
| 133 | //! in ascending order. |
| 134 | //! A structure of priority 10 is displayed the last and appears over the others. |
| 135 | //! The default value is 5. |
| 136 | //! Category: Methods to modify the class definition |
| 137 | //! Warning: If <me> is displayed then the SetDisplayPriority |
| 138 | //! method erase <me> and display <me> with the |
| 139 | //! new priority. |
| 140 | //! Raises PriorityDefinitionError if <Priority> is |
| 141 | //! greater than 10 or a negative value. |
| 142 | Standard_EXPORT void SetDisplayPriority (const Standard_Integer Priority); |
| 143 | |
| 144 | //! Reset the current priority of the structure to the |
| 145 | //! previous priority. |
| 146 | //! Category: Methods to modify the class definition |
| 147 | //! Warning: If <me> is displayed then the SetDisplayPriority |
| 148 | //! method erase <me> and display <me> with the |
| 149 | //! previous priority. |
| 150 | Standard_EXPORT void ResetDisplayPriority(); |
| 151 | |
| 152 | //! Set Z layer ID for the structure. The Z layer mechanism |
| 153 | //! allows to display structures presented in higher layers in overlay |
| 154 | //! of structures in lower layers by switching off z buffer depth |
| 155 | //! test between layers |
| 156 | Standard_EXPORT void SetZLayer (const Graphic3d_ZLayerId theLayerId); |
| 157 | |
| 158 | //! Get Z layer ID of displayed structure. The method |
| 159 | //! returns -1 if the structure has no ID (deleted from graphic driver). |
| 160 | Standard_EXPORT Graphic3d_ZLayerId GetZLayer() const; |
| 161 | |
| 162 | //! Changes a sequence of clip planes slicing the structure on rendering. |
| 163 | //! @param thePlanes [in] the set of clip planes. |
| 164 | Standard_EXPORT void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes); |
| 165 | |
| 166 | //! Get clip planes slicing the structure on rendering. |
| 167 | //! @return set of clip planes. |
| 168 | Standard_EXPORT const Graphic3d_SequenceOfHClipPlane& GetClipPlanes() const; |
| 169 | |
| 170 | //! Modifies the visibility indicator to Standard_True or |
| 171 | //! Standard_False for the structure <me>. |
| 172 | //! The default value at the definition of <me> is |
| 173 | //! Standard_True. |
| 174 | Standard_EXPORT void SetVisible (const Standard_Boolean AValue); |
| 175 | |
| 176 | //! Modifies the visualisation mode for the structure <me>. |
| 177 | Standard_EXPORT virtual void SetVisual (const Graphic3d_TypeOfStructure AVisual); |
| 178 | |
| 179 | //! Modifies the minimum and maximum zoom coefficients |
| 180 | //! for the structure <me>. |
| 181 | //! The default value at the definition of <me> is unlimited. |
| 182 | //! Category: Methods to modify the class definition |
| 183 | //! Warning: Raises StructureDefinitionError if <LimitInf> is |
| 184 | //! greater than <LimitSup> or if <LimitInf> or |
| 185 | //! <LimitSup> is a negative value. |
| 186 | Standard_EXPORT void SetZoomLimit (const Standard_Real LimitInf, const Standard_Real LimitSup); |
| 187 | |
| 188 | //! marks the structure <me> representing wired structure needed for |
| 189 | //! highlight only so it won't be added to BVH tree. |
| 190 | //! Category: Methods to modify the class definition |
| 191 | Standard_EXPORT void SetIsForHighlight (const Standard_Boolean isForHighlight); |
| 192 | |
| 193 | //! Suppresses the highlight for the structure <me> |
| 194 | //! in all the views of the visualiser. |
| 195 | Standard_EXPORT void UnHighlight(); |
| 196 | |
| 197 | Standard_EXPORT virtual void Compute(); |
| 198 | |
| 199 | //! Returns the new Structure defined for the new visualization |
| 200 | Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector); |
| 201 | |
| 202 | //! Returns the new Structure defined for the new visualization |
| 203 | Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix); |
| 204 | |
| 205 | //! Returns the new Structure defined for the new visualization |
| 206 | Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure); |
| 207 | |
| 208 | //! Returns the new Structure defined for the new visualization |
| 209 | Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix, Handle(Graphic3d_Structure)& aStructure); |
| 210 | |
| 211 | //! Forces a new construction of the structure <me> |
| 212 | //! if <me> is displayed and TOS_COMPUTED. |
| 213 | Standard_EXPORT void ReCompute(); |
| 214 | |
| 215 | //! Forces a new construction of the structure <me> |
| 216 | //! if <me> is displayed in <aProjetor> and TOS_COMPUTED. |
| 217 | Standard_EXPORT void ReCompute (const Handle(Graphic3d_DataStructureManager)& aProjector); |
| 218 | |
| 219 | //! Returns Standard_True if the structure <me> contains |
| 220 | //! Polygons, Triangles or Quadrangles. |
| 221 | Standard_EXPORT Standard_Boolean ContainsFacet() const; |
| 222 | |
| 223 | //! Returns the groups sequence included in the structure <me> (internal storage). |
| 224 | Standard_EXPORT const Graphic3d_SequenceOfGroup& Groups() const; |
| 225 | |
| 226 | //! Returns the current number of groups in the |
| 227 | //! structure <me>. |
| 228 | Standard_EXPORT Standard_Integer NumberOfGroups() const; |
| 229 | |
| 230 | //! Append new group to this structure. |
| 231 | Standard_EXPORT Handle(Graphic3d_Group) NewGroup(); |
| 232 | |
| 233 | //! Returns the highlight color for the Highlight method |
| 234 | //! with the highlight method TOHM_COLOR or TOHM_BOUNDBOX. |
| 235 | Standard_EXPORT const Quantity_Color& HighlightColor() const; |
| 236 | |
| 237 | //! Returns Standard_True if the structure <me> is deleted. |
| 238 | //! <me> is deleted after the call Remove (me). |
| 239 | Standard_EXPORT Standard_Boolean IsDeleted() const; |
| 240 | |
| 241 | //! Returns the display indicator for the structure <me>. |
| 242 | Standard_EXPORT virtual Standard_Boolean IsDisplayed() const; |
| 243 | |
| 244 | //! Returns Standard_True if the structure <me> is empty. |
| 245 | //! Warning: A structure is empty if : |
| 246 | //! it do not have group or all the groups are empties |
| 247 | //! and it do not have descendant or all the descendants |
| 248 | //! are empties. |
| 249 | Standard_EXPORT Standard_Boolean IsEmpty() const; |
| 250 | |
| 251 | //! Returns Standard_True if the structure <me> is infinite. |
| 252 | Standard_EXPORT Standard_Boolean IsInfinite() const; |
| 253 | |
| 254 | //! Returns the highlight indicator for the structure <me>. |
| 255 | Standard_EXPORT virtual Standard_Boolean IsHighlighted() const; |
| 256 | |
| 257 | //! Returns Standard_True if the structure <me> is transformed. |
| 258 | //! <=> The transformation != Identity. |
| 259 | Standard_EXPORT Standard_Boolean IsTransformed() const; |
| 260 | |
| 261 | //! Returns the visibility indicator for the structure <me>. |
| 262 | Standard_EXPORT Standard_Boolean IsVisible() const; |
| 263 | |
| 264 | //! Returns the coordinates of the boundary box of the structure <me>. |
| 265 | //! If <theToIgnoreInfiniteFlag> is TRUE, the method returns actual graphical |
| 266 | //! boundaries of the Graphic3d_Group components. Otherwise, the |
| 267 | //! method returns boundaries taking into account infinite state |
| 268 | //! of the structure. This approach generally used for application |
| 269 | //! specific fit operation (e.g. fitting the model into screen, |
| 270 | //! not taking into accout infinite helper elements). |
| 271 | //! Warning: If the structure <me> is empty then the empty box is returned, |
| 272 | //! If the structure <me> is infinite then the whole box is returned. |
| 273 | Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
| 274 | |
| 275 | //! Returns the visualisation mode for the structure <me>. |
| 276 | Standard_EXPORT Graphic3d_TypeOfStructure Visual() const; |
| 277 | |
| 278 | //! Returns Standard_True if the connection is possible between |
| 279 | //! <AStructure1> and <AStructure2> without a creation |
| 280 | //! of a cycle. |
| 281 | //! |
| 282 | //! It's not possible to call the method |
| 283 | //! AStructure1->Connect (AStructure2, TypeOfConnection) |
| 284 | //! if |
| 285 | //! - the set of all ancestors of <AStructure1> contains |
| 286 | //! <AStructure1> and if the |
| 287 | //! TypeOfConnection == TOC_DESCENDANT |
| 288 | //! - the set of all descendants of <AStructure1> contains |
| 289 | //! <AStructure2> and if the |
| 290 | //! TypeOfConnection == TOC_ANCESTOR |
| 291 | Standard_EXPORT static Standard_Boolean AcceptConnection (const Handle(Graphic3d_Structure)& AStructure1, const Handle(Graphic3d_Structure)& AStructure2, const Graphic3d_TypeOfConnection AType); |
| 292 | |
| 293 | //! Returns the group of structures to which <me> is connected. |
| 294 | Standard_EXPORT void Ancestors (Graphic3d_MapOfStructure& SG) const; |
| 295 | |
| 296 | //! If Atype is TOC_DESCENDANT then add <AStructure> |
| 297 | //! as a child structure of <me>. |
| 298 | //! If Atype is TOC_ANCESTOR then add <AStructure> |
| 299 | //! as a parent structure of <me>. |
| 300 | //! The connection propagates Display, Highlight, Erase, |
| 301 | //! Remove, and stacks the transformations. |
| 302 | //! No connection if the graph of the structures |
| 303 | //! contains a cycle and <WithCheck> is Standard_True; |
| 304 | Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, const Standard_Boolean WithCheck = Standard_False); |
| 305 | |
| 306 | //! Returns the group of structures connected to <me>. |
| 307 | Standard_EXPORT void Descendants (Graphic3d_MapOfStructure& SG) const; |
| 308 | |
| 309 | //! Suppress the connection between <AStructure> and <me>. |
| 310 | Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& AStructure); |
| 311 | |
| 312 | //! If Atype is TOC_DESCENDANT then suppress all |
| 313 | //! the connections with the child structures of <me>. |
| 314 | //! If Atype is TOC_ANCESTOR then suppress all |
| 315 | //! the connections with the parent structures of <me>. |
| 316 | Standard_EXPORT void DisconnectAll (const Graphic3d_TypeOfConnection AType); |
| 317 | |
| 318 | //! Returns <ASet> the group of structures : |
| 319 | //! - directly or indirectly connected to <AStructure> if the |
| 320 | //! TypeOfConnection == TOC_DESCENDANT |
| 321 | //! - to which <AStructure> is directly or indirectly connected |
| 322 | //! if the TypeOfConnection == TOC_ANCESTOR |
| 323 | Standard_EXPORT static void Network (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, Graphic3d_MapOfStructure& ASet); |
| 324 | |
| 325 | Standard_EXPORT void SetOwner (const Standard_Address Owner); |
| 326 | |
| 327 | Standard_EXPORT Standard_Address Owner() const; |
| 328 | |
| 329 | Standard_EXPORT void SetHLRValidation (const Standard_Boolean AFlag); |
| 330 | |
| 331 | Standard_EXPORT Standard_Boolean HLRValidation() const; |
| 332 | |
| 333 | //! Modifies the current local modelling transformation |
| 334 | //! in the structure <me>. |
| 335 | //! |
| 336 | //! It is defined as a 4*4 real matrix. |
| 337 | //! |
| 338 | //! ------------------- |
| 339 | //! | a11 a12 a13 t1 | |
| 340 | //! | a21 a22 a23 t2 | |
| 341 | //! | a31 a32 a33 t3 | |
| 342 | //! | 0 0 0 1 | |
| 343 | //! ------------------- |
| 344 | //! |
| 345 | //! TypeOfComposition : TOC_REPLACE |
| 346 | //! TOC_POSTCONCATENATE |
| 347 | //! |
| 348 | //! Then the modified Local Modelling Transformation is composed |
| 349 | //! with the current Global Modelling Transformation to create a |
| 350 | //! new Composite Modelling Transformation. |
| 351 | //! |
| 352 | //! The compose type specifies the role of the current local |
| 353 | //! modelling transformation (L) in composing the new value for |
| 354 | //! the current local modelling transformation (L'), which is |
| 355 | //! then combined with the current global modelling transforma- |
| 356 | //! tion (G) to calculate the new composite modelling transfor- |
| 357 | //! mation (C). |
| 358 | //! |
| 359 | //! TOC_REPLACE |
| 360 | //! The transformation matrix (T) replaces the value of |
| 361 | //! current local modelling transformation (L). |
| 362 | //! |
| 363 | //! L' <- T |
| 364 | //! C <- G x L' |
| 365 | //! |
| 366 | //! TOC_POSTCONCATENATE |
| 367 | //! The current local modelling transformation (L) is multiplied |
| 368 | //! by the transformation matrix (T): |
| 369 | //! |
| 370 | //! L' <- T x L |
| 371 | //! C <- G x L' |
| 372 | //! |
| 373 | //! Category: Methods to manage the structure transformation |
| 374 | //! Warning: Raises TransformError if the matrix is not a 4x4 matrix. |
| 375 | Standard_EXPORT void SetTransform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType); |
| 376 | |
| 377 | //! Returns the transformation associated with |
| 378 | //! the structure <me>. |
| 379 | Standard_EXPORT void Transform (TColStd_Array2OfReal& AMatrix) const; |
| 380 | |
| 381 | //! Modifies the current modelling transform persistence (pan, zoom or rotate) |
| 382 | Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag, const gp_Pnt& APoint); |
| 383 | |
| 384 | Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag); |
| 385 | |
| 386 | //! Get the current modelling transform persistence (pan, zoom or rotate) |
| 387 | Standard_EXPORT Graphic3d_TransModeFlags TransformPersistenceMode() const; |
| 388 | |
| 389 | //! Get the current point of relative modelling transform persistence |
| 390 | Standard_EXPORT gp_Pnt TransformPersistencePoint() const; |
| 391 | |
| 392 | //! @return transform persistence of the presentable object. |
| 393 | const Graphic3d_TransformPers& TransformPersistence() const; |
| 394 | |
| 395 | //! Sets if the structure location has mutable nature (content or location will be changed regularly). |
| 396 | Standard_EXPORT void SetMutable (const Standard_Boolean theIsMutable); |
| 397 | |
| 398 | //! Returns true if structure has mutable nature (content or location are be changed regularly). |
| 399 | //! Mutable structure will be managed in different way than static onces. |
| 400 | Standard_EXPORT Standard_Boolean IsMutable() const; |
| 401 | |
| 402 | Standard_EXPORT Graphic3d_TypeOfStructure ComputeVisual() const; |
| 403 | |
| 404 | //! Clears the structure <me>. |
| 405 | Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction); |
| 406 | |
| 407 | Standard_EXPORT void GraphicConnect (const Handle(Graphic3d_Structure)& ADaughter); |
| 408 | |
| 409 | Standard_EXPORT void GraphicDisconnect (const Handle(Graphic3d_Structure)& ADaughter); |
| 410 | |
| 411 | //! Highlights the structure <me>. |
| 412 | Standard_EXPORT void GraphicHighlight (const Aspect_TypeOfHighlightMethod Method); |
| 413 | |
| 414 | Standard_EXPORT void GraphicTransform (const TColStd_Array2OfReal& AMatrix); |
| 415 | |
| 416 | //! Suppress the highlight for the structure <me>. |
| 417 | Standard_EXPORT void GraphicUnHighlight(); |
| 418 | |
| 419 | //! Returns the identification number of the structure <me>. |
| 420 | Standard_EXPORT Standard_Integer Identification() const; |
| 421 | |
| 422 | //! Prints informations about the network associated |
| 423 | //! with the structure <AStructure>. |
| 424 | Standard_EXPORT static void PrintNetwork (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType); |
| 425 | |
| 426 | //! Suppress the adress <APtr> in the list |
| 427 | //! of descendants or in the list of ancestors. |
| 428 | Standard_EXPORT void Remove (const Standard_Address APtr, const Graphic3d_TypeOfConnection AType); |
| 429 | |
| 430 | Standard_EXPORT void SetComputeVisual (const Graphic3d_TypeOfStructure AVisual); |
| 431 | |
| 432 | //! Transforms <X>, <Y>, <Z> with the transformation <ATrsf>. |
| 433 | Standard_EXPORT static void Transforms (const TColStd_Array2OfReal& ATrsf, const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Real& NewX, Standard_Real& NewY, Standard_Real& NewZ); |
| 434 | |
| 435 | //! Transforms <Coord> with the transformation <ATrsf>. |
| 436 | Standard_EXPORT static Graphic3d_Vector Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vector& Coord); |
| 437 | |
| 438 | //! Transforms <Coord> with the transformation <ATrsf>. |
| 439 | Standard_EXPORT static Graphic3d_Vertex Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vertex& Coord); |
| 440 | |
| 441 | //! Returns the low-level structure |
| 442 | const Handle(Graphic3d_CStructure)& CStructure() const; |
| 443 | |
| 444 | friend class Graphic3d_Group; |
| 445 | |
| 446 | |
| 447 | DEFINE_STANDARD_RTTIEXT(Graphic3d_Structure,MMgt_TShared) |
| 448 | |
| 449 | protected: |
| 450 | |
| 451 | //! Transforms boundaries with <theTrsf> transformation. |
| 452 | Standard_EXPORT static void TransformBoundaries (const TColStd_Array2OfReal& theTrsf, Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin, Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax); |
| 453 | |
| 454 | //! Appends new descendant structure. |
| 455 | Standard_EXPORT Standard_Boolean AppendDescendant (const Standard_Address theDescendant); |
| 456 | |
| 457 | //! Removes the given descendant structure. |
| 458 | Standard_EXPORT Standard_Boolean RemoveDescendant (const Standard_Address theDescendant); |
| 459 | |
| 460 | //! Appends new ancestor structure. |
| 461 | Standard_EXPORT Standard_Boolean AppendAncestor (const Standard_Address theAncestor); |
| 462 | |
| 463 | //! Removes the given ancestor structure. |
| 464 | Standard_EXPORT Standard_Boolean RemoveAncestor (const Standard_Address theAncestor); |
| 465 | |
| 466 | private: |
| 467 | |
| 468 | //! Suppress in the structure <me>, the group theGroup. |
| 469 | //! It will be erased at the next screen update. |
| 470 | Standard_EXPORT void Remove (const Handle(Graphic3d_Group)& theGroup); |
| 471 | |
| 472 | //! Manages the number of groups in the structure <me> |
| 473 | //! which contains facet. |
| 474 | //! Polygons, Triangles or Quadrangles. |
| 475 | //! <ADelta> = +1 or -1 |
| 476 | Standard_EXPORT void GroupsWithFacet (const Standard_Integer ADelta); |
| 477 | |
| 478 | //! Returns the extreme coordinates found in the structure <me> without transformation applied. |
| 479 | Standard_EXPORT Graphic3d_BndBox4f minMaxCoord() const; |
| 480 | |
| 481 | //! Gets untransformed bounding box from structure. |
| 482 | Standard_EXPORT void getBox (Graphic3d_BndBox4d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
| 483 | |
| 484 | //! Adds transformed (with myCStructure->Transformation) bounding box of structure to theBox. |
| 485 | Standard_EXPORT void addTransformed (Graphic3d_BndBox4d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
| 486 | |
| 487 | //! Returns the manager to which <me> is associated. |
| 488 | Standard_EXPORT Handle(Graphic3d_StructureManager) StructureManager() const; |
| 489 | |
| 490 | //! Calls the Update method of the StructureManager which contains the Structure <me>. |
| 491 | //! If theUpdateLayer is true then invalidates bounding box of ZLayer. |
| 492 | Standard_EXPORT void Update (const bool theUpdateLayer = false) const; |
| 493 | |
| 494 | protected: |
| 495 | |
| 496 | Graphic3d_StructureManager* myStructureManager; |
| 497 | Graphic3d_StructureManager* myFirstStructureManager; |
| 498 | Graphic3d_TypeOfStructure myComputeVisual; |
| 499 | |
| 500 | Handle(Graphic3d_CStructure) myCStructure; |
| 501 | Graphic3d_IndexedMapOfAddress myAncestors; |
| 502 | Graphic3d_IndexedMapOfAddress myDescendants; |
| 503 | Quantity_Color myHighlightColor; |
| 504 | Aspect_TypeOfHighlightMethod myHighlightMethod; |
| 505 | Standard_Address myOwner; |
| 506 | Graphic3d_TypeOfStructure myVisual; |
| 507 | |
| 508 | |
| 509 | }; |
| 510 | |
| 511 | |
| 512 | #include <Graphic3d_Structure.lxx> |
| 513 | |
| 514 | |
| 515 | |
| 516 | |
| 517 | |
| 518 | #endif // _Graphic3d_Structure_HeaderFile |