Open CASCADE Technology 7.8.2.dev
AIS_TexturedShape Class Reference

This class allows to map textures on shapes. Presentations modes AIS_WireFrame (0) and AIS_Shaded (1) behave in the same manner as in AIS_Shape, whilst new modes 2 (bounding box) and 3 (texture mapping) extends it functionality. More...

#include <AIS_TexturedShape.hxx>

Inheritance diagram for AIS_TexturedShape:

Public Member Functions

main methods
 AIS_TexturedShape (const TopoDS_Shape &theShape)
 Initializes the textured shape.
 
virtual void SetTextureFileName (const TCollection_AsciiString &theTextureFileName)
 Sets the texture source. <theTextureFileName> can specify path to texture image or one of the standard predefined textures. The accepted file types are those used in Image_AlienPixMap with extensions such as rgb, png, jpg and more. To specify the standard predefined texture, the <theTextureFileName> should contain integer - the Graphic3d_NameOfTexture2D enumeration index. Setting texture source using this method resets the source pixmap (if was set previously).
 
virtual void SetTexturePixMap (const Handle< Image_PixMap > &theTexturePixMap)
 Sets the texture source. <theTexturePixMap> specifies image data. Please note that the data should be in Bottom-Up order, the flag of Image_PixMap::IsTopDown() will be ignored by graphic driver. Setting texture source using this method resets the source by filename (if was set previously).
 
Standard_Boolean TextureMapState () const
 
void SetTextureMapOn ()
 Enables texture mapping.
 
void SetTextureMapOff ()
 Disables texture mapping.
 
Standard_CString TextureFile () const
 
const Handle< Image_PixMap > & TexturePixMap () const
 
methods to alter texture mapping properties
void UpdateAttributes ()
 Use this method to display the textured shape without recomputing the whole presentation. Use this method when ONLY the texture content has been changed. If other parameters (ie: scale factors, texture origin, texture repeat...) have changed, the whole presentation has to be recomputed:
 
virtual void SetColor (const Quantity_Color &theColor) override
 Sets the color.
 
virtual void UnsetColor () override
 Removes settings for the color.
 
virtual void SetMaterial (const Graphic3d_MaterialAspect &theAspect) override
 Sets the material aspect.
 
virtual void UnsetMaterial () override
 Removes settings for material aspect.
 
void EnableTextureModulate ()
 Enables texture modulation.
 
void DisableTextureModulate ()
 Disables texture modulation.
 
Standard_Boolean TextureRepeat () const
 
Standard_Real URepeat () const
 
Standard_Real VRepeat () const
 
void SetTextureRepeat (const Standard_Boolean theToRepeat, const Standard_Real theURepeat=1.0, const Standard_Real theVRepeat=1.0)
 Sets the number of occurrences of the texture on each face. The texture itself is parameterized in (0,1) by (0,1). Each face of the shape to be textured is parameterized in UV space (Umin,Umax) by (Vmin,Vmax). If RepeatYN is set to false, texture coordinates are clamped in the range (0,1)x(0,1) of the face.
 
Standard_Boolean TextureOrigin () const
 
Standard_Real TextureUOrigin () const
 
Standard_Real TextureVOrigin () const
 
void SetTextureOrigin (const Standard_Boolean theToSetTextureOrigin, const Standard_Real theUOrigin=0.0, const Standard_Real theVOrigin=0.0)
 Use this method to change the origin of the texture. The texel (0,0) will be mapped to the surface (UOrigin,VOrigin)
 
Standard_Boolean TextureScale () const
 
Standard_Real TextureScaleU () const
 
Standard_Real TextureScaleV () const
 
void SetTextureScale (const Standard_Boolean theToSetTextureScale, const Standard_Real theScaleU=1.0, const Standard_Real theScaleV=1.0)
 Use this method to scale the texture (percent of the face). You can specify a scale factor for both U and V. Example: if you set ScaleU and ScaleV to 0.5 and you enable texture repeat, the texture will appear twice on the face in each direction.
 
Standard_Boolean ShowTriangles () const
 
void ShowTriangles (const Standard_Boolean theToShowTriangles)
 Use this method to show the triangulation of the shape (for debugging etc.).
 
Standard_Boolean TextureModulate () const
 
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const override
 Return true if specified display mode is supported (extends AIS_Shape with Display Mode 3).
 
- Public Member Functions inherited from AIS_Shape
 AIS_Shape (const TopoDS_Shape &shap)
 Initializes construction of the shape shap from wires, edges and vertices.
 
virtual Standard_Integer Signature () const override
 Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum.
 
virtual AIS_KindOfInteractive Type () const override
 Returns Object as the type of Interactive Object.
 
virtual Standard_Boolean AcceptShapeDecomposition () const override
 Returns true if the Interactive Object accepts shape decomposition.
 
const TopoDS_ShapeShape () const
 Returns this shape object.
 
void SetShape (const TopoDS_Shape &theShape)
 Constructs an instance of the shape object theShape.
 
void Set (const TopoDS_Shape &theShape)
 Alias for SetShape().
 
Standard_Boolean SetOwnDeviationCoefficient ()
 Sets a local value for deviation coefficient for this specific shape.
 
Standard_Boolean SetOwnDeviationAngle ()
 Sets a local value for deviation angle for this specific shape.
 
void SetOwnDeviationCoefficient (const Standard_Real aCoefficient)
 Sets a local value for deviation coefficient for this specific shape.
 
void SetAngleAndDeviation (const Standard_Real anAngle)
 this compute a new angle and Deviation from the value anAngle and set the values stored in myDrawer with these that become local to the shape
 
Standard_Real UserAngle () const
 gives back the angle initial value put by the User.
 
void SetOwnDeviationAngle (const Standard_Real anAngle)
 sets myOwnDeviationAngle field in Prs3d_Drawer & recomputes presentation
 
Standard_Boolean OwnDeviationCoefficient (Standard_Real &aCoefficient, Standard_Real &aPreviousCoefficient) const
 Returns true and the values of the deviation coefficient aCoefficient and the previous deviation coefficient aPreviousCoefficient. If these values are not already set, false is returned.
 
Standard_Boolean OwnDeviationAngle (Standard_Real &anAngle, Standard_Real &aPreviousAngle) const
 Returns true and the values of the deviation angle anAngle and the previous deviation angle aPreviousAngle. If these values are not already set, false is returned.
 
void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
 Sets the type of HLR algorithm used by the shape.
 
Prs3d_TypeOfHLR TypeOfHLR () const
 Gets the type of HLR algorithm.
 
virtual void SetWidth (const Standard_Real aValue) override
 Sets the value aValue for line width in the reconstructed compound shape. Changes line aspects for lines presentation.
 
virtual void UnsetWidth () override
 Removes the setting for line width in the reconstructed compound shape.
 
virtual void SetTransparency (const Standard_Real aValue=0.6) override
 Sets the value aValue for transparency in the reconstructed compound shape.
 
virtual void UnsetTransparency () override
 Removes the setting for transparency in the reconstructed compound shape.
 
virtual const Bnd_BoxBoundingBox ()
 Constructs a bounding box with which to reconstruct compound topological shapes for presentation.
 
virtual void Color (Quantity_Color &aColor) const override
 Returns the Color attributes of the shape accordingly to the current facing model;.
 
virtual Graphic3d_NameOfMaterial Material () const override
 Returns the NameOfMaterial attributes of the shape accordingly to the current facing model;.
 
virtual Standard_Real Transparency () const override
 Returns the transparency attributes of the shape accordingly to the current facing model;.
 
const gp_Pnt2dTextureRepeatUV () const
 Return texture repeat UV values; (1, 1) by default.
 
void SetTextureRepeatUV (const gp_Pnt2d &theRepeatUV)
 Sets the number of occurrences of the texture on each face. The texture itself is parameterized in (0,1) by (0,1). Each face of the shape to be textured is parameterized in UV space (Umin,Umax) by (Vmin,Vmax).
 
const gp_Pnt2dTextureOriginUV () const
 Return texture origin UV position; (0, 0) by default.
 
void SetTextureOriginUV (const gp_Pnt2d &theOriginUV)
 Use this method to change the origin of the texture. The texel (0,0) will be mapped to the surface (myUVOrigin.X(), myUVOrigin.Y()).
 
const gp_Pnt2dTextureScaleUV () const
 Return scale factor for UV coordinates; (1, 1) by default.
 
void SetTextureScaleUV (const gp_Pnt2d &theScaleUV)
 Use this method to scale the texture (percent of the face). You can specify a scale factor for both U and V. Example: if you set ScaleU and ScaleV to 0.5 and you enable texture repeat, the texture will appear twice on the face in each direction.
 
virtual void DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const override
 Dumps the content of me into the stream.
 
- Public Member Functions inherited from AIS_InteractiveObject
void Redisplay (const Standard_Boolean AllModes=Standard_False)
 Updates the active presentation; if <AllModes> = Standard_True all the presentations inside are recomputed. IMPORTANT: It is preferable to call Redisplay method of corresponding AIS_InteractiveContext instance for cases when it is accessible. This method just redirects call to myCTXPtr, so this class field must be up to date for proper result.
 
Standard_Boolean HasInteractiveContext () const
 Indicates whether the Interactive Object has a pointer to an interactive context.
 
AIS_InteractiveContextInteractiveContext () const
 Returns the context pointer to the interactive context.
 
virtual void SetContext (const Handle< AIS_InteractiveContext > &aCtx)
 Sets the interactive context aCtx and provides a link to the default drawing tool or "Drawer" if there is none.
 
Standard_Boolean HasOwner () const
 Returns true if the object has an owner attributed to it. The owner can be a shape for a set of sub-shapes or a sub-shape for sub-shapes which it is composed of, and takes the form of a transient.
 
const Handle< Standard_Transient > & GetOwner () const
 Returns the owner of the Interactive Object. The owner can be a shape for a set of sub-shapes or a sub-shape for sub-shapes which it is composed of, and takes the form of a transient. There are two types of owners:
 
void SetOwner (const Handle< Standard_Transient > &theApplicativeEntity)
 Allows you to attribute the owner theApplicativeEntity to an Interactive Object. This can be a shape for a set of sub-shapes or a sub-shape for sub-shapes which it is composed of. The owner takes the form of a transient.
 
void ClearOwner ()
 Each Interactive Object has methods which allow us to attribute an Owner to it in the form of a Transient. This method removes the owner from the graphic entity.
 
virtual Standard_Boolean ProcessDragging (const Handle< AIS_InteractiveContext > &theCtx, const Handle< V3d_View > &theView, const Handle< SelectMgr_EntityOwner > &theOwner, const Graphic3d_Vec2i &theDragFrom, const Graphic3d_Vec2i &theDragTo, const AIS_DragAction theAction)
 Drag object in the viewer.
 
Handle< AIS_InteractiveContextGetContext () const
 Returns the context pointer to the interactive context.
 
Standard_Boolean HasPresentation () const
 Returns TRUE when this object has a presentation in the current DisplayMode()
 
Handle< Prs3d_PresentationPresentation () const
 Returns the current presentation of this object according to the current DisplayMode()
 
void SetAspect (const Handle< Prs3d_BasicAspect > &anAspect)
 Sets the graphic basic aspect to the current presentation.
 
- Public Member Functions inherited from SelectMgr_SelectableObject
virtual ~SelectMgr_SelectableObject ()
 Clears all selections of the object.
 
void RecomputePrimitives ()
 Re-computes the sensitive primitives for all modes. IMPORTANT: Do not use this method to update selection primitives except implementing custom selection manager! This method does not take into account necessary BVH updates, but may invalidate the pointers it refers to. TO UPDATE SELECTION properly from outside classes, use method UpdateSelection.
 
void RecomputePrimitives (const Standard_Integer theMode)
 Re-computes the sensitive primitives which correspond to the <theMode>th selection mode. IMPORTANT: Do not use this method to update selection primitives except implementing custom selection manager! selection manager! This method does not take into account necessary BVH updates, but may invalidate the pointers it refers to. TO UPDATE SELECTION properly from outside classes, use method UpdateSelection.
 
void AddSelection (const Handle< SelectMgr_Selection > &aSelection, const Standard_Integer aMode)
 Adds the selection aSelection with the selection mode index aMode to this framework.
 
void ClearSelections (const Standard_Boolean update=Standard_False)
 Empties all the selections in the SelectableObject <update> parameter defines whether all object's selections should be flagged for further update or not. This improved method can be used to recompute an object's selection (without redisplaying the object completely) when some selection mode is activated not for the first time.
 
const Handle< SelectMgr_Selection > & Selection (const Standard_Integer theMode) const
 Returns the selection having specified selection mode or NULL.
 
Standard_Boolean HasSelection (const Standard_Integer theMode) const
 Returns true if a selection corresponding to the selection mode theMode was computed for this object.
 
const SelectMgr_SequenceOfSelectionSelections () const
 Return the sequence of selections.
 
void ResetTransformation () override
 resets local transformation to identity.
 
virtual void UpdateTransformation () override
 Recomputes the location of the selection aSelection.
 
virtual void UpdateTransformations (const Handle< SelectMgr_Selection > &aSelection)
 Updates locations in all sensitive entities from <aSelection> and in corresponding entity owners.
 
virtual void HilightSelected (const Handle< PrsMgr_PresentationManager > &thePrsMgr, const SelectMgr_SequenceOfOwner &theSeq)
 Method which draws selected owners ( for fast presentation draw )
 
virtual void ClearSelected ()
 Method which clear all selected owners belonging to this selectable object ( for fast presentation draw )
 
virtual void ClearDynamicHighlight (const Handle< PrsMgr_PresentationManager > &theMgr)
 Method that needs to be implemented when the object manages selection and dynamic highlighting on its own. Clears or invalidates dynamic highlight presentation. By default it clears immediate draw of given presentation manager.
 
virtual void HilightOwnerWithColor (const Handle< PrsMgr_PresentationManager > &thePM, const Handle< Prs3d_Drawer > &theStyle, const Handle< SelectMgr_EntityOwner > &theOwner)
 Method which hilight an owner belonging to this selectable object ( for fast presentation draw )
 
virtual Standard_Boolean IsAutoHilight () const
 If returns True, the old mechanism for highlighting selected objects is used (HilightSelected Method may be empty). If returns False, the HilightSelected method will be fully responsible for highlighting selected entity owners belonging to this selectable object.
 
virtual void SetAutoHilight (const Standard_Boolean theAutoHilight)
 Set AutoHilight property to true or false.
 
Handle< Prs3d_PresentationGetHilightPresentation (const Handle< PrsMgr_PresentationManager > &thePrsMgr)
 Creates or returns existing presentation for highlighting detected object.
 
Handle< Prs3d_PresentationGetSelectPresentation (const Handle< PrsMgr_PresentationManager > &thePrsMgr)
 Creates or returns existing presentation for highlighting selected object.
 
virtual void ErasePresentations (Standard_Boolean theToRemove)
 Removes presentations returned by GetHilightPresentation() and GetSelectPresentation().
 
virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId) override
 Set Z layer ID and update all presentations of the selectable object. The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
 
void UpdateSelection (const Standard_Integer theMode=-1)
 Sets update status FULL to selections of the object. Must be used as the only method of UpdateSelection from outer classes to prevent BVH structures from being outdated.
 
void SetAssemblyOwner (const Handle< SelectMgr_EntityOwner > &theOwner, const Standard_Integer theMode=-1)
 Sets common entity owner for assembly sensitive object entities.
 
Bnd_Box BndBoxOfSelected (const Handle< SelectMgr_IndexedMapOfOwner > &theOwners)
 Returns a bounding box of sensitive entities with the owners given if they are a part of activated selection.
 
Standard_Integer GlobalSelectionMode () const
 Returns the mode for selection of object as a whole; 0 by default.
 
virtual Handle< SelectMgr_EntityOwnerGlobalSelOwner () const
 Returns the owner of mode for selection of object as a whole.
 
virtual const Handle< SelectMgr_EntityOwner > & GetAssemblyOwner () const
 Returns common entity owner if the object is an assembly.
 
- Public Member Functions inherited from PrsMgr_PresentableObject
PrsMgr_PresentationsPresentations ()
 Return presentations.
 
Graphic3d_ZLayerId ZLayer () const
 Get ID of Z layer for main presentation.
 
Standard_Boolean IsMutable () const
 Returns true if object has mutable nature (content or location are be changed regularly). Mutable object will be managed in different way than static onces (another optimizations).
 
virtual void SetMutable (const Standard_Boolean theIsMutable)
 Sets if the object has mutable nature (content or location will be changed regularly). This method should be called before object displaying to take effect.
 
const Handle< Graphic3d_ViewAffinity > & ViewAffinity () const
 Return view affinity mask.
 
Standard_Boolean HasDisplayMode () const
 Returns true if the Interactive Object has display mode setting overriding global setting (within Interactive Context).
 
Standard_Integer DisplayMode () const
 Returns the display mode setting of the Interactive Object. The range of supported display mode indexes should be specified within object definition and filtered by AccepDisplayMode().
 
void SetDisplayMode (const Standard_Integer theMode)
 Sets the display mode for the interactive object. An object can have its own temporary display mode, which is different from that proposed by the interactive context.
 
void UnsetDisplayMode ()
 Removes display mode settings from the interactive object.
 
Standard_Boolean HasHilightMode () const
 Returns true if the Interactive Object is in highlight mode.
 
Standard_Integer HilightMode () const
 Returns highlight display mode. This is obsolete method for backward compatibility - use HilightAttributes() and DynamicHilightAttributes() instead.
 
void SetHilightMode (const Standard_Integer theMode)
 Sets highlight display mode. This is obsolete method for backward compatibility - use HilightAttributes() and DynamicHilightAttributes() instead.
 
void UnsetHilightMode ()
 Unsets highlight display mode.
 
virtual Standard_Integer DefaultDisplayMode () const
 Returns the default display mode.
 
Standard_Boolean ToBeUpdated (Standard_Boolean theToIncludeHidden=Standard_False) const
 Returns TRUE if any active presentation has invalidation flag.
 
void SetToUpdate (Standard_Integer theMode)
 Flags presentation to be updated; UpdatePresentations() will recompute these presentations.
 
void SetToUpdate ()
 flags all the Presentations to be Updated.
 
Standard_Boolean IsInfinite () const
 Returns true if the interactive object is infinite; FALSE by default. This flag affects various operations operating on bounding box of graphic presentations of this object. For instance, infinite objects are not taken in account for View FitAll. This does not necessarily means that object is actually infinite, auxiliary objects might be also marked with this flag to achieve desired behavior.
 
void SetInfiniteState (const Standard_Boolean theFlag=Standard_True)
 Sets if object should be considered as infinite.
 
PrsMgr_TypeOfPresentation3d TypeOfPresentation3d () const
 Returns information on whether the object accepts display in HLR mode or not.
 
void SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType)
 Set type of presentation.
 
PrsMgr_DisplayStatus DisplayStatus () const
 Return presentation display status; PrsMgr_DisplayStatus_None by default.
 
const Handle< Prs3d_Drawer > & Attributes () const
 Returns the attributes settings.
 
virtual void SetAttributes (const Handle< Prs3d_Drawer > &theDrawer)
 Initializes the drawing tool theDrawer.
 
const Handle< Prs3d_Drawer > & HilightAttributes () const
 Returns the hilight attributes settings. When not NULL, overrides both Prs3d_TypeOfHighlight_LocalSelected and Prs3d_TypeOfHighlight_Selected defined within AIS_InteractiveContext::HighlightStyle().
 
virtual void SetHilightAttributes (const Handle< Prs3d_Drawer > &theDrawer)
 Initializes the hilight drawing tool theDrawer.
 
const Handle< Prs3d_Drawer > & DynamicHilightAttributes () const
 Returns the hilight attributes settings. When not NULL, overrides both Prs3d_TypeOfHighlight_LocalDynamic and Prs3d_TypeOfHighlight_Dynamic defined within AIS_InteractiveContext::HighlightStyle().
 
virtual void SetDynamicHilightAttributes (const Handle< Prs3d_Drawer > &theDrawer)
 Initializes the dynamic hilight drawing tool.
 
virtual void UnsetHilightAttributes ()
 Clears settings provided by the hilight drawing tool theDrawer.
 
void SynchronizeAspects ()
 Synchronize presentation aspects after their modification.
 
const Handle< Graphic3d_TransformPers > & TransformPersistence () const
 Returns Transformation Persistence defining a special Local Coordinate system where this presentable object is located or NULL handle if not defined. Position of the object having Transformation Persistence is mutable and depends on camera position. The same applies to a bounding box of the object.
 
virtual void SetTransformPersistence (const Handle< Graphic3d_TransformPers > &theTrsfPers)
 Sets up Transform Persistence defining a special Local Coordinate system where this object should be located. Note that management of Transform Persistence object is more expensive than of the normal one, because it requires its position being recomputed basing on camera position within each draw call / traverse.
 
const Handle< TopLoc_Datum3D > & LocalTransformationGeom () const
 Return the local transformation. Note that the local transformation of the object having Transformation Persistence is applied within Local Coordinate system defined by this Persistence.
 
void SetLocalTransformation (const gp_Trsf &theTrsf)
 Sets local transformation to theTransformation. Note that the local transformation of the object having Transformation Persistence is applied within Local Coordinate system defined by this Persistence.
 
void SetLocalTransformation (const Handle< TopLoc_Datum3D > &theTrsf)
 Sets local transformation to theTransformation. Note that the local transformation of the object having Transformation Persistence is applied within Local Coordinate system defined by this Persistence.
 
Standard_Boolean HasTransformation () const
 Returns true if object has a transformation that is different from the identity.
 
const Handle< TopLoc_Datum3D > & TransformationGeom () const
 Return the transformation taking into account transformation of parent object(s). Note that the local transformation of the object having Transformation Persistence is applied within Local Coordinate system defined by this Persistence.
 
const gp_TrsfLocalTransformation () const
 Return the local transformation. Note that the local transformation of the object having Transformation Persistence is applied within Local Coordinate system defined by this Persistence.
 
const gp_TrsfTransformation () const
 Return the transformation taking into account transformation of parent object(s). Note that the local transformation of the object having Transformation Persistence is applied within Local Coordinate system defined by this Persistence.
 
const gp_GTrsfInversedTransformation () const
 Return inversed transformation.
 
const Handle< TopLoc_Datum3D > & CombinedParentTransformation () const
 Return combined parent transformation.
 
const Handle< Graphic3d_SequenceOfHClipPlane > & ClipPlanes () const
 Get clip planes.
 
virtual void SetClipPlanes (const Handle< Graphic3d_SequenceOfHClipPlane > &thePlanes)
 Set clip planes for graphical clipping for all display mode presentations. The composition of clip planes truncates the rendering space to convex volume. Please be aware that number of supported clip plane is limited. The planes which exceed the limit are ignored. Besides of this, some planes can be already set in view where the object is shown: the number of these planes should be subtracted from limit to predict the maximum possible number of object clipping planes.
 
virtual void AddClipPlane (const Handle< Graphic3d_ClipPlane > &thePlane)
 Adds clip plane for graphical clipping for all display mode presentations. The composition of clip planes truncates the rendering space to convex volume. Please be aware that number of supported clip plane is limited. The planes which exceed the limit are ignored. Besides of this, some planes can be already set in view where the object is shown: the number of these planes should be subtracted from limit to predict the maximum possible number of object clipping planes.
 
virtual void RemoveClipPlane (const Handle< Graphic3d_ClipPlane > &thePlane)
 Removes previously added clip plane.
 
PrsMgr_PresentableObjectParent () const
 Returns parent of current object in scene hierarchy.
 
const PrsMgr_ListOfPresentableObjectsChildren () const
 Returns children of the current object.
 
virtual void AddChild (const Handle< PrsMgr_PresentableObject > &theObject)
 Makes theObject child of current object in scene hierarchy.
 
void AddChildWithCurrentTransformation (const Handle< PrsMgr_PresentableObject > &theObject)
 Makes theObject child of current object in scene hierarchy with keeping the current global transformation So the object keeps the same position/orientation in the global CS.
 
virtual void RemoveChild (const Handle< PrsMgr_PresentableObject > &theObject)
 Removes theObject from children of current object in scene hierarchy.
 
void RemoveChildWithRestoreTransformation (const Handle< PrsMgr_PresentableObject > &theObject)
 Removes theObject from children of current object in scene hierarchy with keeping the current global transformation. So the object keeps the same position/orientation in the global CS.
 
Standard_Boolean HasOwnPresentations () const
 Returns true if object should have own presentations.
 
virtual void BoundingBox (Bnd_Box &theBndBox)
 Returns bounding box of object correspondingly to its current display mode. This method requires presentation to be already computed, since it relies on bounding box of presentation structures, which are supposed to be same/close amongst different display modes of this object.
 
void SetIsoOnTriangulation (const Standard_Boolean theIsEnabled)
 Enables or disables on-triangulation build of isolines according to the flag given.
 
Aspect_TypeOfFacingModel CurrentFacingModel () const
 Returns the current facing model which is in effect.
 
void SetCurrentFacingModel (const Aspect_TypeOfFacingModel theModel=Aspect_TOFM_BOTH_SIDE)
 change the current facing model apply on polygons for SetColor(), SetTransparency(), SetMaterial() methods default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is applying both on the front and back face.
 
Standard_Boolean HasColor () const
 Returns true if the Interactive Object has color.
 
Standard_Boolean HasWidth () const
 Returns true if the Interactive Object has width.
 
Standard_Real Width () const
 Returns the width setting of the Interactive Object.
 
Standard_Boolean HasMaterial () const
 Returns true if the Interactive Object has a setting for material.
 
Standard_Boolean IsTransparent () const
 Returns true if there is a transparency setting.
 
virtual Standard_Boolean HasPolygonOffsets () const
 Returns Standard_True if <myDrawer> has non-null shading aspect.
 
virtual void PolygonOffsets (Standard_Integer &aMode, Standard_ShortReal &aFactor, Standard_ShortReal &aUnits) const
 Retrieves current polygon offsets settings from <myDrawer>.
 
virtual void SetPolygonOffsets (const Standard_Integer aMode, const Standard_ShortReal aFactor=1.0, const Standard_ShortReal aUnits=0.0)
 Sets up polygon offsets for this object.
 
virtual void UnsetAttributes ()
 Clears settings provided by the drawing tool aDrawer.
 
void ToBeUpdated (TColStd_ListOfInteger &ListOfMode) const
 gives the list of modes which are flagged "to be updated".
 
Standard_Boolean ToPropagateVisualState () const
 Get value of the flag "propagate visual state" It means that the display/erase/color visual state is propagated automatically to all children; by default, the flag is true.
 
void SetPropagateVisualState (const Standard_Boolean theFlag)
 Change the value of the flag "propagate visual state".
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
Standard_Integer GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object.
 
Standard_Integer DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Member Functions

overridden methods
virtual void Compute (const Handle< PrsMgr_PresentationManager > &thePrsMgr, const Handle< Prs3d_Presentation > &thePrs, const Standard_Integer theMode) override
 Compute presentation with texture mapping support.
 
void updateAttributes (const Handle< Prs3d_Presentation > &thePrs)
 Compute presentation with texture mapping support.
 
- Protected Member Functions inherited from AIS_Shape
virtual void computeHLR (const Handle< Graphic3d_Camera > &theProjector, const Handle< TopLoc_Datum3D > &theTrsf, const Handle< Prs3d_Presentation > &thePrs) override
 Compute projected presentation.
 
virtual void ComputeSelection (const Handle< SelectMgr_Selection > &theSelection, const Standard_Integer theMode) override
 Compute selection.
 
bool setColor (const Handle< Prs3d_Drawer > &theDrawer, const Quantity_Color &theColor) const
 Create own aspects (if they do not exist) and set color to them.
 
bool setWidth (const Handle< Prs3d_Drawer > &theDrawer, const Standard_Real theWidth) const
 Create own aspects (if they do not exist) and set width to them.
 
void setTransparency (const Handle< Prs3d_Drawer > &theDrawer, const Standard_Real theValue) const
 shape to display
 
void setMaterial (const Handle< Prs3d_Drawer > &theDrawer, const Graphic3d_MaterialAspect &theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const
 shape to display
 
void replaceWithNewOwnAspects ()
 Replace aspects of already computed groups from drawer link by the new own value.
 
- Protected Member Functions inherited from AIS_InteractiveObject
 AIS_InteractiveObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d=PrsMgr_TOP_AllView)
 The TypeOfPresention3d means that the interactive object may have a presentation dependent on the view of Display.
 
void SetDisplayStatus (PrsMgr_DisplayStatus theStatus)
 Set presentation display status.
 
- Protected Member Functions inherited from SelectMgr_SelectableObject
 SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d=PrsMgr_TOP_AllView)
 Protected empty constructor.
 
void setGlobalSelMode (const Standard_Integer theMode)
 Override global selection mode.
 
virtual void UpdateClipping () override
 Update clipping planes state.
 
virtual void updateSelection (const Standard_Integer theMode)
 Sets update status FULL to selections of the object. Must be used as the only method of UpdateSelection from outer classes to prevent BVH structures from being outdated.
 
- Protected Member Functions inherited from PrsMgr_PresentableObject
void Update (Standard_Boolean theToIncludeHidden=Standard_False)
 Recomputes all presentations of the object.
 
void Update (Standard_Integer theMode, Standard_Boolean theToClearOther)
 Recomputes the presentation in the given mode.
 
 PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d=PrsMgr_TOP_AllView)
 Protected empty constructor.
 
virtual ~PrsMgr_PresentableObject ()
 Destructor.
 
virtual void Fill (const Handle< PrsMgr_PresentationManager > &thePrsMgr, const Handle< PrsMgr_Presentation > &thePrs, const Standard_Integer theMode)
 Fills the given 3D view presentation for specified display mode using Compute() method. In addition, configures other properties of presentation (transformation, clipping planes).
 
Standard_Boolean UpdatePresentations (Standard_Boolean theToIncludeHidden=Standard_False)
 Recomputes invalidated presentations of the object.
 
virtual void SetCombinedParentTransform (const Handle< TopLoc_Datum3D > &theTrsf)
 Sets myCombinedParentTransform to theTransformation. Thus object receives transformation from parent node and able to derive its own.
 
virtual void setLocalTransformation (const Handle< TopLoc_Datum3D > &theTransformation)
 Sets local transformation to theTransformation.
 
void recomputeComputed () const
 Recompute computed (HLR) presentations (when view is in computed mode).
 
void replaceAspects (const Graphic3d_MapOfAspectsToAspects &theMap)
 Replace aspects of existing (computed) presentation groups, so that the new aspects can be applied without recomputing presentation. It is NOT recommended approach, because user has to fill such map and then search for each occurrence in computed groups. The recommended approach is computing presentation with necessary customized aspects, and then modify them directly followed by SynchronizeAspects() call.
 

Protected Attributes

presentation fields
Handle< Graphic3d_Texture2DmyTexture
 
Handle< Graphic3d_AspectFillArea3dmyAspect
 
texture source fields
Handle< Image_PixMapmyTexturePixMap
 
TCollection_AsciiString myTextureFile
 
Graphic3d_NameOfTexture2D myPredefTexture
 
texture mapping properties
Standard_Boolean myToMapTexture
 
Standard_Boolean myModulate
 
Standard_Boolean myIsCustomOrigin
 
Standard_Boolean myToRepeat
 
Standard_Boolean myToScale
 
Standard_Boolean myToShowTriangles
 
- Protected Attributes inherited from AIS_Shape
TopoDS_Shape myshape
 shape to display
 
Bnd_Box myBB
 cached bounding box of the shape
 
gp_Pnt2d myUVOrigin
 UV origin vector for generating texture coordinates.
 
gp_Pnt2d myUVRepeat
 UV repeat vector for generating texture coordinates.
 
gp_Pnt2d myUVScale
 UV scale vector for generating texture coordinates.
 
Standard_Real myInitAng
 shape to display
 
Standard_Boolean myCompBB
 if TRUE, then bounding box should be recomputed
 
- Protected Attributes inherited from AIS_InteractiveObject
AIS_InteractiveContextmyCTXPtr
 pointer to Interactive Context, where object is currently displayed;
 
Handle< Standard_TransientmyOwner
 application-specific owner object
 
- Protected Attributes inherited from SelectMgr_SelectableObject
SelectMgr_SequenceOfSelection myselections
 list of selections
 
Handle< Prs3d_PresentationmySelectionPrs
 optional presentation for highlighting selected object
 
Handle< Prs3d_PresentationmyHilightPrs
 optional presentation for highlighting detected object
 
Standard_Integer myGlobalSelMode
 global selection mode
 
Standard_Boolean myAutoHilight
 auto-highlighting flag defining
 
- Protected Attributes inherited from PrsMgr_PresentableObject
PrsMgr_PresentableObjectmyParent
 pointer to the parent object
 
PrsMgr_Presentations myPresentations
 list of presentations
 
Handle< Graphic3d_ViewAffinitymyViewAffinity
 view affinity mask
 
Handle< Graphic3d_SequenceOfHClipPlanemyClipPlanes
 sequence of object-specific clipping planes
 
Handle< Prs3d_DrawermyDrawer
 main presentation attributes
 
Handle< Prs3d_DrawermyHilightDrawer
 (optional) custom presentation attributes for highlighting selected object
 
Handle< Prs3d_DrawermyDynHilightDrawer
 (optional) custom presentation attributes for highlighting detected object
 
Handle< Graphic3d_TransformPersmyTransformPersistence
 transformation persistence
 
Handle< TopLoc_Datum3DmyLocalTransformation
 local transformation relative to parent object
 
Handle< TopLoc_Datum3DmyTransformation
 absolute transformation of this object (combined parents + local transformations)
 
Handle< TopLoc_Datum3DmyCombinedParentTransform
 transformation of parent object (combined for all parents)
 
PrsMgr_ListOfPresentableObjects myChildren
 list of children
 
gp_GTrsf myInvTransformation
 inversion of absolute transformation (combined parents + local transformations)
 
PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d
 presentation type
 
PrsMgr_DisplayStatus myDisplayStatus
 presentation display status
 
Aspect_TypeOfFacingModel myCurrentFacingModel
 current facing model
 
Standard_ShortReal myOwnWidth
 custom width value
 
Standard_Boolean hasOwnColor
 own color flag
 
Standard_Boolean hasOwnMaterial
 own material flag
 
Standard_Boolean myInfiniteState
 infinite flag
 
Standard_Boolean myIsMutable
 mutable flag
 
Standard_Boolean myHasOwnPresentations
 flag indicating if object should have own presentations
 
Standard_Boolean myToPropagateVisualState
 flag indicating if visual state (display/erase/color) should be propagated to all children
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from AIS_Shape
static TopAbs_ShapeEnum SelectionType (const Standard_Integer theSelMode)
 Return shape type for specified selection mode.
 
static Standard_Integer SelectionMode (const TopAbs_ShapeEnum theShapeType)
 Return selection mode for specified shape type.
 
static void computeHlrPresentation (const Handle< Graphic3d_Camera > &theProjector, const Handle< Prs3d_Presentation > &thePrs, const TopoDS_Shape &theShape, const Handle< Prs3d_Drawer > &theDrawer)
 Compute HLR presentation for specified shape.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const char * get_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 
- Static Protected Member Functions inherited from PrsMgr_PresentableObject
static const gp_TrsfgetIdentityTrsf ()
 Return the identity transformation.
 

Detailed Description

This class allows to map textures on shapes. Presentations modes AIS_WireFrame (0) and AIS_Shaded (1) behave in the same manner as in AIS_Shape, whilst new modes 2 (bounding box) and 3 (texture mapping) extends it functionality.

The texture itself is parametrized in (0,1)x(0,1). Each face of a shape located in UV space is provided with these parameters:

  • Umin - starting position in U
  • Umax - ending position in U
  • Vmin - starting position in V
  • Vmax - ending position in V Each face is triangulated and a texel is assigned to each node. Facets are then filled using a linear interpolation of texture between each 'three texels'. User can act on:
  • the number of occurrences of the texture on the face
  • the position of the origin of the texture
  • the scale factor of the texture

Constructor & Destructor Documentation

◆ AIS_TexturedShape()

AIS_TexturedShape::AIS_TexturedShape ( const TopoDS_Shape & theShape)

Initializes the textured shape.

Member Function Documentation

◆ AcceptDisplayMode()

virtual Standard_Boolean AIS_TexturedShape::AcceptDisplayMode ( const Standard_Integer theMode) const
inlineoverridevirtual

Return true if specified display mode is supported (extends AIS_Shape with Display Mode 3).

Reimplemented from AIS_Shape.

◆ Compute()

virtual void AIS_TexturedShape::Compute ( const Handle< PrsMgr_PresentationManager > & thePrsMgr,
const Handle< Prs3d_Presentation > & thePrs,
const Standard_Integer theMode )
overrideprotectedvirtual

Compute presentation with texture mapping support.

Reimplemented from AIS_Shape.

◆ DisableTextureModulate()

void AIS_TexturedShape::DisableTextureModulate ( )

Disables texture modulation.

◆ EnableTextureModulate()

void AIS_TexturedShape::EnableTextureModulate ( )

Enables texture modulation.

◆ SetColor()

virtual void AIS_TexturedShape::SetColor ( const Quantity_Color & theColor)
overridevirtual

Sets the color.

Reimplemented from AIS_Shape.

◆ SetMaterial()

virtual void AIS_TexturedShape::SetMaterial ( const Graphic3d_MaterialAspect & theAspect)
overridevirtual

Sets the material aspect.

Reimplemented from AIS_Shape.

◆ SetTextureFileName()

virtual void AIS_TexturedShape::SetTextureFileName ( const TCollection_AsciiString & theTextureFileName)
virtual

Sets the texture source. <theTextureFileName> can specify path to texture image or one of the standard predefined textures. The accepted file types are those used in Image_AlienPixMap with extensions such as rgb, png, jpg and more. To specify the standard predefined texture, the <theTextureFileName> should contain integer - the Graphic3d_NameOfTexture2D enumeration index. Setting texture source using this method resets the source pixmap (if was set previously).

◆ SetTextureMapOff()

void AIS_TexturedShape::SetTextureMapOff ( )

Disables texture mapping.

◆ SetTextureMapOn()

void AIS_TexturedShape::SetTextureMapOn ( )

Enables texture mapping.

◆ SetTextureOrigin()

void AIS_TexturedShape::SetTextureOrigin ( const Standard_Boolean theToSetTextureOrigin,
const Standard_Real theUOrigin = 0.0,
const Standard_Real theVOrigin = 0.0 )

Use this method to change the origin of the texture. The texel (0,0) will be mapped to the surface (UOrigin,VOrigin)

◆ SetTexturePixMap()

virtual void AIS_TexturedShape::SetTexturePixMap ( const Handle< Image_PixMap > & theTexturePixMap)
virtual

Sets the texture source. <theTexturePixMap> specifies image data. Please note that the data should be in Bottom-Up order, the flag of Image_PixMap::IsTopDown() will be ignored by graphic driver. Setting texture source using this method resets the source by filename (if was set previously).

◆ SetTextureRepeat()

void AIS_TexturedShape::SetTextureRepeat ( const Standard_Boolean theToRepeat,
const Standard_Real theURepeat = 1.0,
const Standard_Real theVRepeat = 1.0 )

Sets the number of occurrences of the texture on each face. The texture itself is parameterized in (0,1) by (0,1). Each face of the shape to be textured is parameterized in UV space (Umin,Umax) by (Vmin,Vmax). If RepeatYN is set to false, texture coordinates are clamped in the range (0,1)x(0,1) of the face.

◆ SetTextureScale()

void AIS_TexturedShape::SetTextureScale ( const Standard_Boolean theToSetTextureScale,
const Standard_Real theScaleU = 1.0,
const Standard_Real theScaleV = 1.0 )

Use this method to scale the texture (percent of the face). You can specify a scale factor for both U and V. Example: if you set ScaleU and ScaleV to 0.5 and you enable texture repeat, the texture will appear twice on the face in each direction.

◆ ShowTriangles() [1/2]

Standard_Boolean AIS_TexturedShape::ShowTriangles ( ) const
inline
Returns
true if displaying of triangles is requested

◆ ShowTriangles() [2/2]

void AIS_TexturedShape::ShowTriangles ( const Standard_Boolean theToShowTriangles)

Use this method to show the triangulation of the shape (for debugging etc.).

◆ TextureFile()

Standard_CString AIS_TexturedShape::TextureFile ( ) const
inline
Returns
path to the texture file

◆ TextureMapState()

Standard_Boolean AIS_TexturedShape::TextureMapState ( ) const
inline
Returns
flag to control texture mapping (for presentation mode 3)

◆ TextureModulate()

Standard_Boolean AIS_TexturedShape::TextureModulate ( ) const
inline
Returns
true if texture color modulation is turned on

◆ TextureOrigin()

Standard_Boolean AIS_TexturedShape::TextureOrigin ( ) const
inline
Returns
true if texture UV origin has been modified

◆ TexturePixMap()

const Handle< Image_PixMap > & AIS_TexturedShape::TexturePixMap ( ) const
inline
Returns
the source pixmap for texture map

◆ TextureRepeat()

Standard_Boolean AIS_TexturedShape::TextureRepeat ( ) const
inline
Returns
texture repeat flag

◆ TextureScale()

Standard_Boolean AIS_TexturedShape::TextureScale ( ) const
inline
Returns
true if scale factor should be applied to texture mapping

◆ TextureScaleU()

Standard_Real AIS_TexturedShape::TextureScaleU ( ) const
inline
Returns
scale factor for U coordinate (1.0 by default)

◆ TextureScaleV()

Standard_Real AIS_TexturedShape::TextureScaleV ( ) const
inline
Returns
scale factor for V coordinate (1.0 by default)

◆ TextureUOrigin()

Standard_Real AIS_TexturedShape::TextureUOrigin ( ) const
inline
Returns
texture origin U position (0.0 by default)

◆ TextureVOrigin()

Standard_Real AIS_TexturedShape::TextureVOrigin ( ) const
inline
Returns
texture origin V position (0.0 by default)

◆ UnsetColor()

virtual void AIS_TexturedShape::UnsetColor ( )
overridevirtual

Removes settings for the color.

Reimplemented from AIS_Shape.

◆ UnsetMaterial()

virtual void AIS_TexturedShape::UnsetMaterial ( )
overridevirtual

Removes settings for material aspect.

Reimplemented from AIS_Shape.

◆ UpdateAttributes()

void AIS_TexturedShape::UpdateAttributes ( )

Use this method to display the textured shape without recomputing the whole presentation. Use this method when ONLY the texture content has been changed. If other parameters (ie: scale factors, texture origin, texture repeat...) have changed, the whole presentation has to be recomputed:

if (myShape->DisplayMode() == 3)
{
myAISContext->RecomputePrsOnly (myShape);
}
else
{
myAISContext->SetDisplayMode (myShape, 3, Standard_False);
myAISContext->Display (myShape, Standard_True);
}
#define Standard_False
Definition Standard_TypeDef.hxx:56
#define Standard_True
Definition Standard_TypeDef.hxx:57

◆ updateAttributes()

void AIS_TexturedShape::updateAttributes ( const Handle< Prs3d_Presentation > & thePrs)
protected

Compute presentation with texture mapping support.

◆ URepeat()

Standard_Real AIS_TexturedShape::URepeat ( ) const
inline
Returns
texture repeat U value

◆ VRepeat()

Standard_Real AIS_TexturedShape::VRepeat ( ) const
inline
Returns
texture repeat V value

Field Documentation

◆ myAspect

Handle< Graphic3d_AspectFillArea3d > AIS_TexturedShape::myAspect
protected

◆ myIsCustomOrigin

Standard_Boolean AIS_TexturedShape::myIsCustomOrigin
protected

◆ myModulate

Standard_Boolean AIS_TexturedShape::myModulate
protected

◆ myPredefTexture

Graphic3d_NameOfTexture2D AIS_TexturedShape::myPredefTexture
protected

◆ myTexture

Handle< Graphic3d_Texture2D > AIS_TexturedShape::myTexture
protected

◆ myTextureFile

TCollection_AsciiString AIS_TexturedShape::myTextureFile
protected

◆ myTexturePixMap

Handle< Image_PixMap > AIS_TexturedShape::myTexturePixMap
protected

◆ myToMapTexture

Standard_Boolean AIS_TexturedShape::myToMapTexture
protected

◆ myToRepeat

Standard_Boolean AIS_TexturedShape::myToRepeat
protected

◆ myToScale

Standard_Boolean AIS_TexturedShape::myToScale
protected

◆ myToShowTriangles

Standard_Boolean AIS_TexturedShape::myToShowTriangles
protected

The documentation for this class was generated from the following file: