1 // Created on: 1995-01-25
2 // Created by: Jean-Louis Frenkel
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _PrsMgr_PresentableObject_HeaderFile
18 #define _PrsMgr_PresentableObject_HeaderFile
20 #include <Aspect_TypeOfFacingModel.hxx>
21 #include <gp_GTrsf.hxx>
22 #include <Graphic3d_ClipPlane.hxx>
23 #include <Graphic3d_SequenceOfHClipPlane.hxx>
24 #include <Graphic3d_TransformPers.hxx>
25 #include <Graphic3d_TransModeFlags.hxx>
26 #include <Graphic3d_ZLayerId.hxx>
27 #include <Prs3d_Drawer.hxx>
28 #include <PrsMgr_ListOfPresentableObjects.hxx>
29 #include <PrsMgr_Presentation.hxx>
30 #include <PrsMgr_Presentations.hxx>
31 #include <PrsMgr_TypeOfPresentation3d.hxx>
32 #include <TColStd_ListOfInteger.hxx>
34 class PrsMgr_PresentationManager;
35 typedef PrsMgr_PresentationManager PrsMgr_PresentationManager3d;
37 //! A framework to supply the Graphic3d structure of the object to be presented.
38 //! On the first display request, this structure is created by calling the appropriate algorithm and retaining this framework for further display.
39 //! This abstract framework is inherited in Application Interactive Services (AIS), notably by AIS_InteractiveObject.
40 //! Consequently, 3D presentation should be handled by the relevant daughter classes and their member functions in AIS.
41 //! This is particularly true in the creation of new interactive objects.
43 //! Key interface methods to be implemented by every Selectable Object:
44 //! - AcceptDisplayMode() accepting display modes implemented by this object;
45 //! - Compute() computing presentation for the given display mode index.
47 //! Warning! Methods managing standard attributes (SetColor(), SetWidth(), SetMaterial()) have different meaning for objects of different type (or no meaning at all).
48 //! Sub-classes might override these methods to modify Prs3d_Drawer or class properties providing a convenient short-cut depending on application needs.
49 //! For more sophisticated configuring, Prs3d_Drawer should be modified directly, while short-cuts might be left unimplemented.
50 class PrsMgr_PresentableObject : public Standard_Transient
52 DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentableObject, Standard_Transient)
53 friend class PrsMgr_Presentation;
54 friend class PrsMgr_PresentationManager;
57 //! Return presentations.
58 PrsMgr_Presentations& Presentations() { return myPresentations; }
60 //! Get ID of Z layer for main presentation.
61 Graphic3d_ZLayerId ZLayer() const { return myDrawer->ZLayer(); }
63 //! Set Z layer ID and update all presentations of the presentable object.
64 //! The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
65 Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId);
67 //! Returns true if object has mutable nature (content or location are be changed regularly).
68 //! Mutable object will be managed in different way than static onces (another optimizations).
69 Standard_Boolean IsMutable() const { return myIsMutable; }
71 //! Sets if the object has mutable nature (content or location will be changed regularly).
72 //! This method should be called before object displaying to take effect.
73 Standard_EXPORT virtual void SetMutable (const Standard_Boolean theIsMutable);
75 //! Returns true if the Interactive Object has display mode setting overriding global setting (within Interactive Context).
76 Standard_Boolean HasDisplayMode() const { return myDrawer->DisplayMode() != -1; }
78 //! Returns the display mode setting of the Interactive Object.
79 //! The range of supported display mode indexes should be specified within object definition and filtered by AccepDisplayMode().
80 //! @sa AcceptDisplayMode()
81 Standard_Integer DisplayMode() const { return myDrawer->DisplayMode(); }
83 //! Sets the display mode for the interactive object.
84 //! An object can have its own temporary display mode, which is different from that proposed by the interactive context.
85 //! @sa AcceptDisplayMode()
86 void SetDisplayMode (const Standard_Integer theMode)
88 if (AcceptDisplayMode (theMode))
90 myDrawer->SetDisplayMode (theMode);
94 //! Removes display mode settings from the interactive object.
95 void UnsetDisplayMode() { myDrawer->SetDisplayMode (-1); }
97 //! Returns true if the Interactive Object is in highlight mode.
98 Standard_Boolean HasHilightMode() const { return !myHilightDrawer.IsNull() && myHilightDrawer->DisplayMode() != -1; }
100 //! Returns highlight display mode.
101 //! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
102 Standard_Integer HilightMode() const { return !myHilightDrawer.IsNull() ? myHilightDrawer->DisplayMode() : -1; }
104 //! Sets highlight display mode.
105 //! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
106 Standard_EXPORT void SetHilightMode (const Standard_Integer theMode);
108 //! Unsets highlight display mode.
109 void UnsetHilightMode()
111 if (!myHilightDrawer.IsNull())
113 myHilightDrawer->SetDisplayMode (-1);
115 if (!myDynHilightDrawer.IsNull())
117 myDynHilightDrawer->SetDisplayMode (-1);
121 //! Returns true if the class of objects accepts specified display mode index.
122 //! The interactive context can have a default mode of representation for the set of Interactive Objects.
123 //! This mode may not be accepted by a given class of objects.
124 //! Consequently, this virtual method allowing us to get information about the class in question must be implemented.
125 //! At least one display mode index should be accepted by this method.
126 //! Although subclass can leave default implementation, it is highly desired defining exact list of supported modes instead,
127 //! which is usually an enumeration for one object or objects class sharing similar list of display modes.
128 virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const
131 return Standard_True;
134 //! Returns the default display mode.
135 virtual Standard_Integer DefaultDisplayMode() const { return 0; }
137 //! Returns TRUE if any active presentation has invalidation flag.
138 //! @param theToIncludeHidden when TRUE, also checks hidden presentations
139 Standard_EXPORT Standard_Boolean ToBeUpdated (Standard_Boolean theToIncludeHidden = Standard_False) const;
141 //! Flags presentation to be updated; UpdatePresentations() will recompute these presentations.
142 //! @param theMode presentation (display mode) to invalidate, or -1 to invalidate them all
143 Standard_EXPORT void SetToUpdate (Standard_Integer theMode);
145 //! flags all the Presentations to be Updated.
146 void SetToUpdate() { SetToUpdate (-1); }
148 //! Returns true if the interactive object is infinite; FALSE by default.
149 //! This flag affects various operations operating on bounding box of graphic presentations of this object.
150 //! For instance, infinite objects are not taken in account for View FitAll.
151 //! This does not necessarily means that object is actually infinite,
152 //! auxiliary objects might be also marked with this flag to achieve desired behavior.
153 Standard_Boolean IsInfinite() const { return myInfiniteState; }
155 //! Sets if object should be considered as infinite.
156 Standard_EXPORT void SetInfiniteState (const Standard_Boolean theFlag = Standard_True);
158 //! Returns information on whether the object accepts display in HLR mode or not.
159 PrsMgr_TypeOfPresentation3d TypeOfPresentation3d() const { return myTypeOfPresentation3d; }
161 //! Set type of presentation.
162 Standard_EXPORT void SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType);
164 public: //! @name presentation attributes
166 //! Returns the attributes settings.
167 const Handle(Prs3d_Drawer)& Attributes() const { return myDrawer; }
169 //! Initializes the drawing tool theDrawer.
170 virtual void SetAttributes(const Handle(Prs3d_Drawer)& theDrawer) { myDrawer = theDrawer; }
172 //! Returns the hilight attributes settings.
173 //! When not NULL, overrides both Prs3d_TypeOfHighlight_LocalSelected and Prs3d_TypeOfHighlight_Selected defined within AIS_InteractiveContext.
174 const Handle(Prs3d_Drawer)& HilightAttributes() const { return myHilightDrawer; }
176 //! Initializes the hilight drawing tool theDrawer.
177 virtual void SetHilightAttributes(const Handle(Prs3d_Drawer)& theDrawer) { myHilightDrawer = theDrawer; }
179 //! Returns the hilight attributes settings.
180 //! When not NULL, overrides both Prs3d_TypeOfHighlight_LocalDynamic and Prs3d_TypeOfHighlight_Dynamic defined within AIS_InteractiveContext.
181 const Handle(Prs3d_Drawer)& DynamicHilightAttributes() const { return myDynHilightDrawer; }
183 //! Initializes the dynamic hilight drawing tool.
184 virtual void SetDynamicHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer) { myDynHilightDrawer = theDrawer; }
186 //! Clears settings provided by the hilight drawing tool theDrawer.
187 virtual void UnsetHilightAttributes() { myHilightDrawer.Nullify(); }
189 //! Synchronize presentation aspects after their modification.
191 //! This method should be called after modifying primitive aspect properties (material, texture, shader)
192 //! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
193 Standard_EXPORT void SynchronizeAspects();
195 public: //! @name object transformation
197 //! Returns Transformation Persistence defining a special Local Coordinate system where this presentable object is located or NULL handle if not defined.
198 //! Position of the object having Transformation Persistence is mutable and depends on camera position.
199 //! The same applies to a bounding box of the object.
200 //! @sa Graphic3d_TransformPers class description
201 const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTransformPersistence; }
203 //! Sets up Transform Persistence defining a special Local Coordinate system where this object should be located.
204 //! Note that management of Transform Persistence object is more expensive than of the normal one,
205 //! because it requires its position being recomputed basing on camera position within each draw call / traverse.
206 //! @sa Graphic3d_TransformPers class description
207 Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
209 //! Return the local transformation.
210 //! Note that the local transformation of the object having Transformation Persistence
211 //! is applied within Local Coordinate system defined by this Persistence.
212 const Handle(Geom_Transformation)& LocalTransformationGeom() const { return myLocalTransformation; }
214 //! Sets local transformation to theTransformation.
215 //! Note that the local transformation of the object having Transformation Persistence
216 //! is applied within Local Coordinate system defined by this Persistence.
217 void SetLocalTransformation (const gp_Trsf& theTrsf) { setLocalTransformation (new Geom_Transformation (theTrsf)); }
219 //! Sets local transformation to theTransformation.
220 //! Note that the local transformation of the object having Transformation Persistence
221 //! is applied within Local Coordinate system defined by this Persistence.
222 void SetLocalTransformation (const Handle(Geom_Transformation)& theTrsf) { setLocalTransformation (theTrsf); }
224 //! Returns true if object has a transformation that is different from the identity.
225 Standard_Boolean HasTransformation() const { return !myTransformation.IsNull() && myTransformation->Form() != gp_Identity; }
227 //! Return the transformation taking into account transformation of parent object(s).
228 //! Note that the local transformation of the object having Transformation Persistence
229 //! is applied within Local Coordinate system defined by this Persistence.
230 const Handle(Geom_Transformation)& TransformationGeom() const { return myTransformation; }
232 //! Return the local transformation.
233 //! Note that the local transformation of the object having Transformation Persistence
234 //! is applied within Local Coordinate system defined by this Persistence.
235 const gp_Trsf& LocalTransformation() const { return !myLocalTransformation.IsNull()
236 ? myLocalTransformation->Trsf()
237 : getIdentityTrsf(); }
239 //! Return the transformation taking into account transformation of parent object(s).
240 //! Note that the local transformation of the object having Transformation Persistence
241 //! is applied within Local Coordinate system defined by this Persistence.
242 const gp_Trsf& Transformation() const { return !myTransformation.IsNull()
243 ? myTransformation->Trsf()
244 : getIdentityTrsf(); }
246 //! Return inversed transformation.
247 const gp_GTrsf& InversedTransformation() const { return myInvTransformation; }
249 //! Return combined parent transformation.
250 const Handle(Geom_Transformation)& CombinedParentTransformation() const { return myCombinedParentTransform; }
252 //! resets local transformation to identity.
253 Standard_EXPORT virtual void ResetTransformation();
255 //! Updates final transformation (parent + local) of presentable object and its presentations.
256 Standard_EXPORT virtual void UpdateTransformation();
258 public: //! @name clipping planes
261 //! @return set of previously added clip planes for all display mode presentations.
262 const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const { return myClipPlanes; }
264 //! Set clip planes for graphical clipping for all display mode presentations.
265 //! The composition of clip planes truncates the rendering space to convex volume.
266 //! Please be aware that number of supported clip plane is limited.
267 //! The planes which exceed the limit are ignored.
268 //! Besides of this, some planes can be already set in view where the object is shown:
269 //! the number of these planes should be subtracted from limit to predict the maximum
270 //! possible number of object clipping planes.
271 Standard_EXPORT virtual void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes);
273 //! Adds clip plane for graphical clipping for all display mode
274 //! presentations. The composition of clip planes truncates the rendering
275 //! space to convex volume. Please be aware that number of supported
276 //! clip plane is limited. The planes which exceed the limit are ignored.
277 //! Besides of this, some planes can be already set in view where the object
278 //! is shown: the number of these planes should be subtracted from limit
279 //! to predict the maximum possible number of object clipping planes.
280 //! @param thePlane [in] the clip plane to be appended to map of clip planes.
281 Standard_EXPORT virtual void AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
283 //! Removes previously added clip plane.
284 //! @param thePlane [in] the clip plane to be removed from map of clip planes.
285 Standard_EXPORT virtual void RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
287 public: //! @name parent/children properties
289 //! Returns parent of current object in scene hierarchy.
290 PrsMgr_PresentableObject* Parent() const { return myParent; }
292 //! Returns children of the current object.
293 const PrsMgr_ListOfPresentableObjects& Children() const { return myChildren; }
295 //! Makes theObject child of current object in scene hierarchy.
296 Standard_EXPORT virtual void AddChild (const Handle(PrsMgr_PresentableObject)& theObject);
298 //! Makes theObject child of current object in scene hierarchy with keeping the current global transformation
299 //! So the object keeps the same position/orientation in the global CS.
300 Standard_EXPORT void AddChildWithCurrentTransformation(const Handle(PrsMgr_PresentableObject)& theObject);
302 //! Removes theObject from children of current object in scene hierarchy.
303 Standard_EXPORT virtual void RemoveChild (const Handle(PrsMgr_PresentableObject)& theObject);
305 //! Removes theObject from children of current object in scene hierarchy with keeping the current global transformation.
306 //! So the object keeps the same position/orientation in the global CS.
307 Standard_EXPORT void RemoveChildWithRestoreTransformation(const Handle(PrsMgr_PresentableObject)& theObject);
309 //! Returns true if object should have own presentations.
310 Standard_Boolean HasOwnPresentations() const { return myHasOwnPresentations; }
312 //! Returns bounding box of object correspondingly to its current display mode.
313 //! This method requires presentation to be already computed, since it relies on bounding box of presentation structures,
314 //! which are supposed to be same/close amongst different display modes of this object.
315 Standard_EXPORT virtual void BoundingBox (Bnd_Box& theBndBox);
317 protected: //! @name interface methods
319 //! Protected empty constructor.
320 Standard_EXPORT PrsMgr_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
323 Standard_EXPORT virtual ~PrsMgr_PresentableObject();
325 //! Fills the given 3D view presentation for specified display mode using Compute() method.
326 //! In addition, configures other properties of presentation (transformation, clipping planes).
327 //! @param thePrsMgr presentation manager where presentation has been created
328 //! @param thePrs presentation to fill
329 //! @param theMode display mode to compute; can be any number accepted by AcceptDisplayMode() method
330 Standard_EXPORT virtual void Fill (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
331 const Handle(PrsMgr_Presentation)& thePrs,
332 const Standard_Integer theMode);
334 //! Calculates the 3D view presentation for specified display mode.
335 //! This is a key interface for implementing Presentable Object interface.
336 //! @param thePrsMgr presentation manager where presentation has been created
337 //! @param thePrs presentation to fill
338 //! @param theMode display mode to compute; can be any number accepted by AcceptDisplayMode() method
339 //! @sa AcceptDisplayMode()
340 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
341 const Handle(Prs3d_Presentation)& thePrs,
342 const Standard_Integer theMode) = 0;
344 //! Calculates hidden line removal presentation for specific camera position.
345 //! Each of the views in the viewer and every modification such as rotation, for example, entails recalculation.
346 //! Default implementation throws Standard_NotImplemented exception
347 //! Warning! The transformation must be applied to the object before computation.
348 //! @param theProjector [in] view orientation
349 //! @param theTrsf [in] additional transformation, or NULL if undefined
350 //! @param thePrs [in] presentation to fill
351 Standard_EXPORT virtual void computeHLR (const Handle(Graphic3d_Camera)& theProjector,
352 const Handle(Geom_Transformation)& theTrsf,
353 const Handle(Prs3d_Presentation)& thePrs);
355 //! Recomputes invalidated presentations of the object.
356 //! @param theToIncludeHidden if TRUE, then even hidden invalidated presentations will be updated
357 //! @return TRUE if some presentations were recomputed
358 Standard_EXPORT Standard_Boolean UpdatePresentations (Standard_Boolean theToIncludeHidden = Standard_False);
360 //! General virtual method for internal update of presentation state
361 //! when some modifications on list of clip planes occurs. Base
362 //! implementation propagate clip planes to every presentation.
363 Standard_EXPORT virtual void UpdateClipping();
365 //! Sets myCombinedParentTransform to theTransformation. Thus object receives transformation
366 //! from parent node and able to derive its own.
367 Standard_EXPORT virtual void SetCombinedParentTransform (const Handle(Geom_Transformation)& theTrsf);
369 //! Sets local transformation to theTransformation.
370 Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTransformation);
372 //! Return the identity transformation.
373 Standard_EXPORT static const gp_Trsf& getIdentityTrsf();
375 //! Recompute computed (HLR) presentations (when view is in computed mode).
376 Standard_EXPORT void recomputeComputed() const;
378 //! Replace aspects of existing (computed) presentation groups,
379 //! so that the new aspects can be applied without recomputing presentation.
380 //! It is NOT recommended approach, because user has to fill such map and then search for each occurrence in computed groups.
381 //! The recommended approach is computing presentation with necessary customized aspects,
382 //! and then modify them directly followed by SynchronizeAspects() call.
383 Standard_EXPORT void replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap);
385 public: //! @name simplified presentation properties API
387 //! Enables or disables on-triangulation build of isolines according to the flag given.
388 void SetIsoOnTriangulation (const Standard_Boolean theIsEnabled) { myDrawer->SetIsoOnTriangulation (theIsEnabled); }
390 //! Returns the current facing model which is in effect.
391 Aspect_TypeOfFacingModel CurrentFacingModel() const { return myCurrentFacingModel; }
393 //! change the current facing model apply on polygons for SetColor(), SetTransparency(), SetMaterial() methods default facing model is Aspect_TOFM_TWO_SIDE.
394 //! This mean that attributes is applying both on the front and back face.
395 void SetCurrentFacingModel (const Aspect_TypeOfFacingModel theModel = Aspect_TOFM_BOTH_SIDE) { myCurrentFacingModel = theModel; }
397 //! Returns true if the Interactive Object has color.
398 Standard_Boolean HasColor() const { return hasOwnColor; }
400 //! Returns the color setting of the Interactive Object.
401 virtual void Color (Quantity_Color& theColor) const { theColor = myDrawer->Color(); }
403 //! Only the interactive object knowns which Drawer attribute is affected by the color, if any
404 //! (ex: for a wire,it's the wireaspect field of the drawer, but for a vertex, only the point aspect field is affected by the color).
405 //! WARNING : Do not forget to set the corresponding fields here (hasOwnColor and myDrawer->SetColor())
406 virtual void SetColor (const Quantity_Color& theColor)
408 myDrawer->SetColor (theColor);
409 hasOwnColor = Standard_True;
412 //! Removes color settings. Only the Interactive Object
413 //! knows which Drawer attribute is affected by the color
414 //! setting. For a wire, for example, wire aspect is the
415 //! attribute affected. For a vertex, however, only point
416 //! aspect is affected by the color setting.
417 virtual void UnsetColor() { hasOwnColor = Standard_False; }
419 //! Returns true if the Interactive Object has width.
420 Standard_Boolean HasWidth() const { return myOwnWidth != 0.0f; }
422 //! Returns the width setting of the Interactive Object.
423 Standard_Real Width() const { return myOwnWidth; }
425 //! Allows you to provide the setting aValue for width.
426 //! Only the Interactive Object knows which Drawer attribute is affected by the width setting.
427 virtual void SetWidth (const Standard_Real theWidth) { myOwnWidth = (Standard_ShortReal )theWidth; }
429 //! Reset width to default value.
430 virtual void UnsetWidth() { myOwnWidth = 0.0f; }
432 //! Returns true if the Interactive Object has a setting for material.
433 Standard_Boolean HasMaterial() const { return hasOwnMaterial; }
435 //! Returns the current material setting as enumeration value.
436 Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const;
438 //! Sets the material aMat defining this display attribute
439 //! for the interactive object.
440 //! Material aspect determines shading aspect, color and
441 //! transparency of visible entities.
442 Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& aName);
444 //! Removes the setting for material.
445 Standard_EXPORT virtual void UnsetMaterial();
447 //! Returns true if there is a transparency setting.
448 Standard_Boolean IsTransparent() const { return myDrawer->Transparency() > 0.005f; }
450 //! Returns the transparency setting.
451 //! This will be between 0.0 and 1.0.
452 //! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
453 virtual Standard_Real Transparency() const { return (myDrawer->Transparency() <= 0.005f ? 0.0 : myDrawer->Transparency()); }
455 //! Attributes a setting aValue for transparency.
456 //! The transparency value should be between 0.0 and 1.0.
457 //! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
458 //! Warning At a value of 1.0, there may be nothing visible.
459 Standard_EXPORT virtual void SetTransparency (const Standard_Real aValue = 0.6);
461 //! Removes the transparency setting. The object is opaque by default.
462 Standard_EXPORT virtual void UnsetTransparency();
464 //! Returns Standard_True if <myDrawer> has non-null shading aspect
465 Standard_EXPORT virtual Standard_Boolean HasPolygonOffsets() const;
467 //! Retrieves current polygon offsets settings from <myDrawer>.
468 Standard_EXPORT virtual void PolygonOffsets (Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
470 //! Sets up polygon offsets for this object.
471 //! @sa Graphic3d_Aspects::SetPolygonOffsets()
472 Standard_EXPORT virtual void SetPolygonOffsets (const Standard_Integer aMode, const Standard_ShortReal aFactor = 1.0, const Standard_ShortReal aUnits = 0.0);
474 //! Clears settings provided by the drawing tool aDrawer.
475 Standard_EXPORT virtual void UnsetAttributes();
477 //! Dumps the content of me into the stream
478 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
480 public: //! @name deprecated methods
482 //! gives the list of modes which are flagged "to be updated".
483 Standard_DEPRECATED("This method is deprecated - UpdatePresentations() should be called instead")
484 Standard_EXPORT void ToBeUpdated (TColStd_ListOfInteger& ListOfMode) const;
486 Standard_DEPRECATED("This method is deprecated - overload taking Handle should be used instead")
487 void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes)
489 Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = new Graphic3d_SequenceOfHClipPlane (thePlanes);
490 SetClipPlanes (aPlanes);
493 //! Sets up Transform Persistence Mode for this object.
494 //! This function used to lock in object position, rotation and / or zooming relative to camera position.
495 //! Object will be drawn in the origin setted by thePoint parameter (except Graphic3d_TMF_TriedronPers flag
496 //! - see description later). theMode should be:
497 //! - Graphic3d_TMF_None - no persistence attributes (reset);
498 //! - Graphic3d_TMF_ZoomPers - object doesn't resize;
499 //! - Graphic3d_TMF_RotatePers - object doesn't rotate;
500 //! - Graphic3d_TMF_ZoomRotatePers - object doesn't resize and rotate;
501 //! - Graphic3d_TMF_RotatePers - object doesn't rotate;
502 //! - Graphic3d_TMF_TriedronPers - object behaves like trihedron.
503 //! If Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d persistence mode selected thePoint coordinates X and Y means:
504 //! - X = 0.0, Y = 0.0 - center of view window;
505 //! - X > 0.0, Y > 0.0 - right upper corner of view window;
506 //! - X > 0.0, Y < 0.0 - right lower corner of view window;
507 //! - X < 0.0, Y > 0.0 - left upper corner of view window;
508 //! - X < 0.0, Y < 0.0 - left lower corner of view window.
509 //! And Z coordinate defines the gap from border of view window (except center position).
510 Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
511 void SetTransformPersistence (const Graphic3d_TransModeFlags theMode, const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
513 SetTransformPersistence (Graphic3d_TransformPers::FromDeprecatedParams (theMode, thePoint));
516 //! Gets Transform Persistence Mode for this object
517 Standard_DEPRECATED("This method is deprecated - TransformPersistence() should be called instead")
518 Graphic3d_TransModeFlags GetTransformPersistenceMode() const
520 return myTransformPersistence.IsNull()
522 : myTransformPersistence->Mode();
525 //! Gets point of transform persistence for this object
526 Standard_DEPRECATED("This method is deprecated - TransformPersistence() should be called instead")
527 Standard_EXPORT gp_Pnt GetTransformPersistencePoint() const;
529 //! Get value of the flag "propagate visual state"
530 //! It means that the display/erase/color visual state is propagated automatically to all children;
531 //! by default, the flag is true
532 Standard_Boolean ToPropagateVisualState() const { return myToPropagateVisualState; }
534 //! Change the value of the flag "propagate visual state"
535 void SetPropagateVisualState(const Standard_Boolean theFlag) { myToPropagateVisualState = theFlag; }
539 //! Recomputes all presentations of the object.
540 Standard_DEPRECATED("This method is deprecated - SetToUpdate() + UpdatePresentations() should be called instead")
541 void Update (Standard_Boolean theToIncludeHidden = Standard_False)
544 UpdatePresentations (theToIncludeHidden);
547 //! Recomputes the presentation in the given mode.
548 //! @param theMode presentation (display mode) to recompute
549 //! @param theToClearOther when TRUE, other presentations (display modes) will be removed
550 Standard_DEPRECATED("This method is deprecated - SetToUpdate() + UpdatePresentations() should be called instead")
551 Standard_EXPORT void Update (Standard_Integer theMode, Standard_Boolean theToClearOther);
555 PrsMgr_PresentableObject* myParent; //!< pointer to the parent object
556 PrsMgr_Presentations myPresentations; //!< list of presentations
557 Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes; //!< sequence of object-specific clipping planes
558 Handle(Prs3d_Drawer) myDrawer; //!< main presentation attributes
559 Handle(Prs3d_Drawer) myHilightDrawer; //!< (optional) custom presentation attributes for highlighting selected object
560 Handle(Prs3d_Drawer) myDynHilightDrawer; //!< (optional) custom presentation attributes for highlighting detected object
561 Handle(Graphic3d_TransformPers) myTransformPersistence; //!< transformation persistence
562 Handle(Geom_Transformation) myLocalTransformation; //!< local transformation relative to parent object
563 Handle(Geom_Transformation) myTransformation; //!< absolute transformation of this object (combined parents + local transformations)
564 Handle(Geom_Transformation) myCombinedParentTransform; //!< transformation of parent object (combined for all parents)
565 PrsMgr_ListOfPresentableObjects myChildren; //!< list of children
566 gp_GTrsf myInvTransformation; //!< inversion of absolute transformation (combined parents + local transformations)
567 PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d; //!< presentation type
569 Aspect_TypeOfFacingModel myCurrentFacingModel; //!< current facing model
570 Standard_ShortReal myOwnWidth; //!< custom width value
571 Standard_Boolean hasOwnColor; //!< own color flag
572 Standard_Boolean hasOwnMaterial; //!< own material flag
574 Standard_Boolean myInfiniteState; //!< infinite flag
575 Standard_Boolean myIsMutable; //!< mutable flag
576 Standard_Boolean myHasOwnPresentations; //!< flag indicating if object should have own presentations
578 Standard_Boolean myToPropagateVisualState; //!< flag indicating if visual state (display/erase/color) should be propagated to all children
581 DEFINE_STANDARD_HANDLE(PrsMgr_PresentableObject, Standard_Transient)
583 #endif // _PrsMgr_PresentableObject_HeaderFile