mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
Patch of issue #27958 (Visualization, AIS_Trihedron - add Shading display mode) adapted to OCCT 7.1.0
PATCH_TO_OCCT_710 define is used for cases of difference for specific code for 7.1.0 version.
This commit is contained in:
parent
d057720d07
commit
9d2f9eb5c3
File diff suppressed because it is too large
Load Diff
@ -17,18 +17,31 @@
|
|||||||
#ifndef _AIS_Trihedron_HeaderFile
|
#ifndef _AIS_Trihedron_HeaderFile
|
||||||
#define _AIS_Trihedron_HeaderFile
|
#define _AIS_Trihedron_HeaderFile
|
||||||
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
|
|
||||||
#include <Standard_Boolean.hxx>
|
|
||||||
#include <Quantity_NameOfColor.hxx>
|
|
||||||
#include <AIS_InteractiveObject.hxx>
|
#include <AIS_InteractiveObject.hxx>
|
||||||
#include <Standard_Real.hxx>
|
|
||||||
#include <Standard_Integer.hxx>
|
|
||||||
#include <PrsMgr_PresentationManager3d.hxx>
|
|
||||||
#include <SelectMgr_Selection.hxx>
|
|
||||||
#include <AIS_KindOfInteractive.hxx>
|
#include <AIS_KindOfInteractive.hxx>
|
||||||
|
|
||||||
|
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||||
|
|
||||||
|
#include <PrsMgr_PresentationManager3d.hxx>
|
||||||
|
|
||||||
|
#include <Prs3d_DatumAspect.hxx>
|
||||||
|
#include <Prs3d_DatumMode.hxx>
|
||||||
|
#include <Prs3d_DatumParts.hxx>
|
||||||
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
|
#include <Prs3d_LineAspect.hxx>
|
||||||
|
#include <Prs3d_PointAspect.hxx>
|
||||||
|
|
||||||
|
#include <Quantity_NameOfColor.hxx>
|
||||||
|
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
|
#include <Standard_Integer.hxx>
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#include <Standard_Type.hxx>
|
||||||
|
#include <SelectMgr_Selection.hxx>
|
||||||
|
|
||||||
#include <TColgp_Array1OfPnt.hxx>
|
#include <TColgp_Array1OfPnt.hxx>
|
||||||
|
|
||||||
class Geom_Axis2Placement;
|
class Geom_Axis2Placement;
|
||||||
class AIS_InteractiveObject;
|
class AIS_InteractiveObject;
|
||||||
class AIS_Axis;
|
class AIS_Axis;
|
||||||
@ -46,26 +59,24 @@ class AIS_Trihedron;
|
|||||||
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
|
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
|
||||||
|
|
||||||
//! Create a selectable trihedron
|
//! Create a selectable trihedron
|
||||||
//! there are 4 modes of selection :
|
//! The trihedron includes 1 origin, 3 axes and 3 labels.
|
||||||
//! mode = 0 to select trihedron ,priority = 1
|
//! Default text of labels are "X", "Y", "Z".
|
||||||
//! mode = 1 to select its origin ,priority = 5
|
//! Color of origin and any axis, color of arrows and labels may be changed.
|
||||||
//! mode = 2 to select its axis ,priority = 3
|
//! Visual presentation might be shown in two, shading and wireframe modes(wireframe by default)
|
||||||
//! mode = 3 to select its planes ,priority = 2
|
//! There are 4 modes of selection :
|
||||||
//! a trihedron has 1 origin, 3 axes and 3 planes.
|
//! mode = 0 to select trihedron, priority = 1
|
||||||
|
//! mode = 1 to select its origin, priority = 5
|
||||||
|
//! mode = 2 to select its axis, priority = 3
|
||||||
|
//! mode = 3 to select its planes, priority = 2
|
||||||
//! Warning
|
//! Warning
|
||||||
//! For the presentation of trihedra, the default unit of
|
//! For the presentation of trihedron, the default unit of
|
||||||
//! length is the millimeter, and the default value for the
|
//! length is the millimetre, and the default value for the
|
||||||
//! representation of axes is 10. To modify these
|
//! representation of the axes is 100. If you modify these
|
||||||
//! dimensions, you must temporarily recover the Drawer.
|
//! dimensions, you must temporarily recover the Drawer.
|
||||||
//! From inside it, you take the aspect in which the values
|
//! From inside it, you take the aspect in which the values
|
||||||
//! for length are stocked. For trihedra, this is FirstAxisLength from
|
//! for length are stocked. For trihedron, this is
|
||||||
//! Prs3d_DatumAspect(). Change the
|
//! Prs3d_Drawer_LineAspect. You change the
|
||||||
//! values inside this Aspect and recalculate the presentation.
|
//! values inside this Aspect and recalculate the presentation.
|
||||||
//! If you want to use extended selection modes, different than 0,
|
|
||||||
//! you should take care of removing of the shapes from the interactive
|
|
||||||
//! context that has been computed for selection; it might be necessary
|
|
||||||
//! when you change selection mode. You can use methods Axis, Point,
|
|
||||||
//! Plane to retrieve the shapes.
|
|
||||||
class AIS_Trihedron : public AIS_InteractiveObject
|
class AIS_Trihedron : public AIS_InteractiveObject
|
||||||
{
|
{
|
||||||
DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
|
DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
|
||||||
@ -75,18 +86,24 @@ public:
|
|||||||
//! Initializes a trihedron entity.
|
//! Initializes a trihedron entity.
|
||||||
Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent);
|
Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent);
|
||||||
|
|
||||||
|
//! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively.
|
||||||
|
Standard_EXPORT void SetDatumDisplayMode(const Prs3d_DatumMode& theMode) { myDisplayMode = theMode; }
|
||||||
|
|
||||||
|
//! Returns datum display mode.
|
||||||
|
Standard_EXPORT Prs3d_DatumMode DatumDisplayMode() const { return myDisplayMode; }
|
||||||
|
|
||||||
//! Returns the right-handed coordinate system set in SetComponent.
|
//! Returns the right-handed coordinate system set in SetComponent.
|
||||||
const Handle(Geom_Axis2Placement)& Component() const;
|
Standard_EXPORT const Handle(Geom_Axis2Placement)& Component() const { return myComponent; }
|
||||||
|
|
||||||
//! Constructs the right-handed coordinate system aComponent.
|
//! Constructs the right-handed coordinate system aComponent.
|
||||||
Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& aComponent);
|
Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& theComponent);
|
||||||
|
|
||||||
//! Returns true if the trihedron object has a size other
|
//! Returns true if the trihedron object has a size other
|
||||||
//! than the default size of 10 mm. along each axis.
|
//! than the default size of 100 mm. along each axis.
|
||||||
Standard_Boolean HasOwnSize() const;
|
Standard_Boolean HasOwnSize() const;
|
||||||
|
|
||||||
//! Sets the size aValue for the trihedron object.
|
//! Sets the size aValue for the trihedron object.
|
||||||
//! The default value is 10 mm.
|
//! The default value is 100 mm.
|
||||||
Standard_EXPORT void SetSize (const Standard_Real aValue);
|
Standard_EXPORT void SetSize (const Standard_Real aValue);
|
||||||
|
|
||||||
//! Removes any non-default settings for size of this
|
//! Removes any non-default settings for size of this
|
||||||
@ -95,43 +112,9 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT Standard_Real Size() const;
|
Standard_EXPORT Standard_Real Size() const;
|
||||||
|
|
||||||
//! Returns the "XAxis".
|
|
||||||
Standard_EXPORT Handle(AIS_Axis) XAxis() const;
|
|
||||||
|
|
||||||
//! Returns the "YAxis".
|
|
||||||
Standard_EXPORT Handle(AIS_Axis) YAxis() const;
|
|
||||||
|
|
||||||
//! Returns the main Axis.
|
|
||||||
Standard_EXPORT Handle(AIS_Axis) Axis() const;
|
|
||||||
|
|
||||||
//! Returns the origine.
|
|
||||||
Standard_EXPORT Handle(AIS_Point) Position() const;
|
|
||||||
|
|
||||||
//! Returns the "XYPlane".
|
|
||||||
Standard_EXPORT Handle(AIS_Plane) XYPlane() const;
|
|
||||||
|
|
||||||
//! Returns the "XZPlane".
|
|
||||||
Standard_EXPORT Handle(AIS_Plane) XZPlane() const;
|
|
||||||
|
|
||||||
//! Returns the "YZPlane".
|
|
||||||
Standard_EXPORT Handle(AIS_Plane) YZPlane() const;
|
|
||||||
|
|
||||||
//! connection to <aCtx> default drawer implies a recomputation
|
|
||||||
//! of SubObjects values.
|
|
||||||
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the display mode selected, aMode, is
|
//! Returns true if the display mode selected, aMode, is
|
||||||
//! valid for trihedron datums.
|
//! valid for trihedron datums.
|
||||||
Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
|
Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Computes the presentation according to a point of view
|
|
||||||
//! given by <aProjector>.
|
|
||||||
//! To be Used when the associated degenerated Presentations
|
|
||||||
//! have been transformed by <aTrsf> which is not a Pure
|
|
||||||
//! Translation. The HLR Prs can't be deducted automatically
|
|
||||||
//! WARNING :<aTrsf> must be applied
|
|
||||||
//! to the object to display before computation !!!
|
|
||||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
|
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
|
||||||
Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
|
||||||
@ -139,63 +122,154 @@ public:
|
|||||||
//! Indicates that the type of Interactive Object is datum.
|
//! Indicates that the type of Interactive Object is datum.
|
||||||
Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
|
Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
|
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||||
|
Standard_EXPORT void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE;
|
||||||
//! Sets the color aColor for this trihedron object.
|
|
||||||
Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
|
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||||
|
Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||||
Standard_EXPORT void SetTextColor (const Quantity_NameOfColor aColor);
|
|
||||||
|
|
||||||
|
//! Sets color of label of trihedron axes.
|
||||||
|
Standard_EXPORT void SetTextColor (const Quantity_NameOfColor theColor);
|
||||||
|
|
||||||
|
//! Sets color of label of trihedron axes.
|
||||||
|
Standard_EXPORT void SetTextColor (const Quantity_Color& theColor);
|
||||||
|
|
||||||
|
//! Returns true if trihedron has own text color
|
||||||
Standard_EXPORT Standard_Boolean HasTextColor() const;
|
Standard_EXPORT Standard_Boolean HasTextColor() const;
|
||||||
|
|
||||||
Standard_EXPORT Quantity_NameOfColor TextColor() const;
|
//! Returns trihedron text color
|
||||||
|
Standard_EXPORT Quantity_Color TextColor() const;
|
||||||
Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor aColor);
|
|
||||||
|
//! Sets color of arrow of trihedron axes. Used only in wireframe mode
|
||||||
|
Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor theColor);
|
||||||
|
|
||||||
|
//! Sets color of arrow of trihedron axes. Used only in wireframe mode
|
||||||
|
Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor);
|
||||||
|
|
||||||
|
//! Returns true if trihedron has own arrow color
|
||||||
Standard_EXPORT Standard_Boolean HasArrowColor() const;
|
Standard_EXPORT Standard_Boolean HasArrowColor() const;
|
||||||
|
|
||||||
Standard_EXPORT Quantity_NameOfColor ArrowColor() const;
|
//! Returns trihedron arrow color
|
||||||
|
Standard_EXPORT Quantity_Color ArrowColor() const;
|
||||||
//! Returns the four extremities of the trihedron from the
|
|
||||||
//! array of points, TheExtrem.
|
|
||||||
Standard_EXPORT void ExtremityPoints (TColgp_Array1OfPnt& TheExtrem) const;
|
|
||||||
|
|
||||||
//! Removes the settings for color.
|
//! Removes the settings for color.
|
||||||
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
|
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Removes the non-default settings for width set in SetWidth.
|
//! Sets color of datum part: origin or some of trihedron axes.
|
||||||
Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
|
//! If presentation is shading mode, this color is set for both sides of facing model
|
||||||
|
Standard_EXPORT void SetColor (const Prs3d_DatumParts& thePart,
|
||||||
|
const Quantity_Color& theColor);
|
||||||
|
|
||||||
|
//! Returns color of datum part: origin or some of trihedron axes.
|
||||||
|
Standard_EXPORT Quantity_Color Color (const Prs3d_DatumParts& thePart);
|
||||||
|
|
||||||
|
//! Sets color of origin.
|
||||||
|
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||||
|
Standard_EXPORT void SetOriginColor (const Quantity_Color& theColor);
|
||||||
|
|
||||||
|
//! Sets color of x-axis.
|
||||||
|
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||||
|
Standard_EXPORT void SetXAxisColor (const Quantity_Color& theColor);
|
||||||
|
|
||||||
|
//! Sets color of y-axis.
|
||||||
|
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||||
|
Standard_EXPORT void SetYAxisColor (const Quantity_Color& theColor);
|
||||||
|
|
||||||
|
//! Sets color of z-axis.
|
||||||
|
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||||
|
Standard_EXPORT void SetAxisColor (const Quantity_Color& theColor);
|
||||||
|
|
||||||
|
//! Sets priority of selection for owner of the given type
|
||||||
|
Standard_EXPORT void SetSelectionPriority(const Prs3d_DatumParts& thePart, const Standard_Integer thePriority)
|
||||||
|
{
|
||||||
|
mySelectionPriority.Bind(thePart, thePriority);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Sets priority of selection for owner of the given type
|
||||||
|
Standard_EXPORT Standard_Integer SelectionPriority(const Prs3d_DatumParts& thePart)
|
||||||
|
{
|
||||||
|
return mySelectionPriority.Find(thePart);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||||
|
Standard_EXPORT void SetLabel(const Prs3d_DatumParts& thePart, const TCollection_ExtendedString& thePriority)
|
||||||
|
{
|
||||||
|
myLabel.Bind(thePart, thePriority);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns text of axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||||
|
Standard_EXPORT const TCollection_ExtendedString& Label(const Prs3d_DatumParts& thePart)
|
||||||
|
{
|
||||||
|
return myLabel.Find(thePart);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
|
||||||
|
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Method which clear all selected owners belonging
|
||||||
|
//! to this selectable object ( for fast presentation draw ).
|
||||||
|
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Method which draws selected owners ( for fast presentation draw ).
|
||||||
|
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const SelectMgr_SequenceOfOwner& theOwners) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Method which hilight an owner belonging to
|
||||||
|
//! this selectable object ( for fast presentation draw ).
|
||||||
|
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
//! Compute trihedron presentation.
|
||||||
|
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||||
|
const Handle(Prs3d_Presentation)& thePrs,
|
||||||
|
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
private:
|
//! This compute is unavailable for trihedron presentation.
|
||||||
|
void Compute (const Handle(Prs3d_Projector)& , const Handle(Prs3d_Presentation)& ) Standard_OVERRIDE {}
|
||||||
|
|
||||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
//! This compute is unavailable for trihedron presentation.
|
||||||
|
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
const Handle(Geom_Transformation)& theTrsf,
|
||||||
|
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE;
|
||||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
|
|
||||||
|
//! Compute selection.
|
||||||
Standard_EXPORT void LoadSubObjects();
|
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||||
|
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Computes presentation for display mode equal 1.
|
||||||
|
Standard_EXPORT void ComputePresentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||||
|
const Handle(Prs3d_Presentation)& thePrs);
|
||||||
|
|
||||||
|
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
|
||||||
|
|
||||||
|
//! Created a sensitive entity for the datum part that will be used in selection owner creation
|
||||||
|
Handle(SelectBasics_SensitiveEntity) CreateSensitiveEntity(const Prs3d_DatumParts& thePart,
|
||||||
|
const Handle(SelectBasics_EntityOwner)& theOwner) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Handle(Geom_Axis2Placement) myComponent;
|
|
||||||
Handle(AIS_InteractiveObject) myShapes[7];
|
|
||||||
Standard_Boolean myHasOwnSize;
|
Standard_Boolean myHasOwnSize;
|
||||||
Standard_Boolean myHasOwnTextColor;
|
Standard_Boolean myHasOwnTextColor;
|
||||||
Quantity_NameOfColor myOwnTextColor;
|
|
||||||
Standard_Boolean myHasOwnArrowColor;
|
Standard_Boolean myHasOwnArrowColor;
|
||||||
Quantity_NameOfColor myOwnArrowColor;
|
|
||||||
|
Prs3d_DatumMode myDisplayMode;
|
||||||
|
Handle(Geom_Axis2Placement) myComponent;
|
||||||
|
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, Standard_Integer> mySelectionPriority;
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, TCollection_ExtendedString> myLabel;
|
||||||
|
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_Group)> myPartToGroup;
|
||||||
|
NCollection_List<Prs3d_DatumParts> mySelectedParts;
|
||||||
|
|
||||||
|
Handle(Prs3d_PointAspect) myPointAspect;
|
||||||
|
|
||||||
|
Handle(Prs3d_ShadingAspect) myHighlightAspect; // internal container to set group selected
|
||||||
|
Handle(Prs3d_LineAspect) myHighlightLineAspect; // internal container to set group selected
|
||||||
|
Handle(Prs3d_PointAspect) myHighlightPointAspect; // internal container to set group selected
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#include <AIS_Trihedron.lxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _AIS_Trihedron_HeaderFile
|
#endif // _AIS_Trihedron_HeaderFile
|
||||||
|
66
src/AIS/AIS_TrihedronOwner.cxx
Normal file
66
src/AIS/AIS_TrihedronOwner.cxx
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// Created by: Ilya SEVRIKOV
|
||||||
|
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <AIS_TrihedronOwner.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT (AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||||
|
|
||||||
|
AIS_TrihedronOwner::AIS_TrihedronOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||||
|
const Prs3d_DatumParts thePart,
|
||||||
|
const Standard_Integer thePriority)
|
||||||
|
: SelectMgr_EntityOwner (theSelObject, thePriority),
|
||||||
|
myDatumPart (thePart)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : HilightWithColor
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_TrihedronOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer /*theMode*/)
|
||||||
|
{
|
||||||
|
Selectable()->HilightOwnerWithColor (thePM, theStyle, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsHilighted
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean AIS_TrihedronOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode) const
|
||||||
|
{
|
||||||
|
if (!HasSelectable())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
return thePM->IsHighlighted (Selectable(), theMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Unhilight
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_TrihedronOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode)
|
||||||
|
{
|
||||||
|
if (!HasSelectable())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
thePM->Unhighlight (Selectable());
|
||||||
|
}
|
56
src/AIS/AIS_TrihedronOwner.hxx
Normal file
56
src/AIS/AIS_TrihedronOwner.hxx
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Created by: Ilya SEVRIKOV
|
||||||
|
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _AIS_TrihedronOwner_HeaderFile
|
||||||
|
#define _AIS_TrihedronOwner_HeaderFile
|
||||||
|
|
||||||
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
|
#include <SelectMgr_SelectableObject.hxx>
|
||||||
|
#include <Prs3d_DatumParts.hxx>
|
||||||
|
|
||||||
|
//! Entity owner for selection management of AIS_Trihedron object.
|
||||||
|
class AIS_TrihedronOwner : public SelectMgr_EntityOwner
|
||||||
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Creates an owner of AIS_Trihedron object.
|
||||||
|
Standard_EXPORT AIS_TrihedronOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||||
|
const Prs3d_DatumParts theDatumPart,
|
||||||
|
const Standard_Integer thePriority);
|
||||||
|
|
||||||
|
Standard_EXPORT const Prs3d_DatumParts& DatumPart() const { return myDatumPart; }
|
||||||
|
|
||||||
|
//! Highlights selectable object's presentation.
|
||||||
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
|
const Standard_Integer theMode = 0);
|
||||||
|
|
||||||
|
//! Returns true if the presentation manager thePM
|
||||||
|
//! highlights selections corresponding to the selection mode aMode.
|
||||||
|
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Removes highlighting from the owner of a detected
|
||||||
|
//! selectable object in the presentation manager thePM.
|
||||||
|
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Prs3d_DatumParts myDatumPart; //! Part of datum selected
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE (AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||||
|
|
||||||
|
#endif // _AIS_TrihedronOwner_HeaderFile
|
@ -179,6 +179,8 @@ AIS_Triangulation.hxx
|
|||||||
AIS_Trihedron.cxx
|
AIS_Trihedron.cxx
|
||||||
AIS_Trihedron.hxx
|
AIS_Trihedron.hxx
|
||||||
AIS_Trihedron.lxx
|
AIS_Trihedron.lxx
|
||||||
|
AIS_TrihedronOwner.cxx
|
||||||
|
AIS_TrihedronOwner.hxx
|
||||||
AIS_TypeFilter.cxx
|
AIS_TypeFilter.cxx
|
||||||
AIS_TypeFilter.hxx
|
AIS_TypeFilter.hxx
|
||||||
AIS_TypeOfAngle.hxx
|
AIS_TypeOfAngle.hxx
|
||||||
|
@ -8,6 +8,10 @@ Prs3d_BasicAspect.cxx
|
|||||||
Prs3d_BasicAspect.hxx
|
Prs3d_BasicAspect.hxx
|
||||||
Prs3d_DatumAspect.cxx
|
Prs3d_DatumAspect.cxx
|
||||||
Prs3d_DatumAspect.hxx
|
Prs3d_DatumAspect.hxx
|
||||||
|
Prs3d_DatumAttribute.hxx
|
||||||
|
Prs3d_DatumAxes.hxx
|
||||||
|
Prs3d_DatumMode.hxx
|
||||||
|
Prs3d_DatumParts.hxx
|
||||||
Prs3d_DimensionArrowOrientation.hxx
|
Prs3d_DimensionArrowOrientation.hxx
|
||||||
Prs3d_DimensionAspect.cxx
|
Prs3d_DimensionAspect.cxx
|
||||||
Prs3d_DimensionAspect.hxx
|
Prs3d_DimensionAspect.hxx
|
||||||
|
@ -31,20 +31,38 @@
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void Prs3d_Arrow::Draw(const Handle(Graphic3d_Group)& theGroup,
|
void Prs3d_Arrow::Draw(const Handle(Graphic3d_Group)& theGroup,
|
||||||
const gp_Pnt& aLocation,
|
const gp_Pnt& theLocation,
|
||||||
const gp_Dir& aDirection,
|
const gp_Dir& theDirection,
|
||||||
const Quantity_PlaneAngle anAngle,
|
const Quantity_PlaneAngle theAngle,
|
||||||
const Quantity_Length aLength)
|
const Quantity_Length theLength)
|
||||||
{
|
{
|
||||||
Quantity_Length dx,dy,dz; aDirection.Coord(dx,dy,dz);
|
Handle(Graphic3d_ArrayOfSegments) aPrimitives = Prs3d_Arrow::DrawSegments(theLocation,
|
||||||
|
theDirection, theAngle, theLength, 15);
|
||||||
|
theGroup->AddPrimitiveArray (aPrimitives);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DrawSegments
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Handle(Graphic3d_ArrayOfSegments) Prs3d_Arrow::DrawSegments (const gp_Pnt& theLocation,
|
||||||
|
const gp_Dir& theDirection,
|
||||||
|
const Quantity_PlaneAngle theAngle,
|
||||||
|
const Quantity_Length theLength,
|
||||||
|
const int theNumberOfSegments)
|
||||||
|
{
|
||||||
|
Handle(Graphic3d_ArrayOfSegments) aSegments = new Graphic3d_ArrayOfSegments(theNumberOfSegments+1,
|
||||||
|
2*(2*theNumberOfSegments));
|
||||||
|
|
||||||
|
Quantity_Length dx,dy,dz; theDirection.Coord(dx,dy,dz);
|
||||||
//
|
//
|
||||||
// Point of the arrow:
|
// Point of the arrow:
|
||||||
Quantity_Length xo,yo,zo; aLocation.Coord(xo,yo,zo);
|
Quantity_Length xo,yo,zo; theLocation.Coord(xo,yo,zo);
|
||||||
|
|
||||||
// Center of the base circle of the arrow:
|
// Center of the base circle of the arrow:
|
||||||
Quantity_Length xc = xo - dx * aLength;
|
Quantity_Length xc = xo - dx * theLength;
|
||||||
Quantity_Length yc = yo - dy * aLength;
|
Quantity_Length yc = yo - dy * theLength;
|
||||||
Quantity_Length zc = zo - dz * aLength;
|
Quantity_Length zc = zo - dz * theLength;
|
||||||
|
|
||||||
// Construction of i,j mark for the circle:
|
// Construction of i,j mark for the circle:
|
||||||
Quantity_Length xn=0., yn=0., zn=0.;
|
Quantity_Length xn=0., yn=0., zn=0.;
|
||||||
@ -63,32 +81,43 @@ void Prs3d_Arrow::Draw(const Handle(Graphic3d_Group)& theGroup,
|
|||||||
const Quantity_Length yj = dz * xi - dx * zi;
|
const Quantity_Length yj = dz * xi - dx * zi;
|
||||||
const Quantity_Length zj = dx * yi - dy * xi;
|
const Quantity_Length zj = dx * yi - dy * xi;
|
||||||
|
|
||||||
const Standard_Integer NbPoints = 15;
|
const Standard_Integer NbPoints = theNumberOfSegments;
|
||||||
|
|
||||||
Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments(2*NbPoints);
|
aSegments->AddVertex(theLocation);
|
||||||
Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines(NbPoints+1);
|
|
||||||
|
|
||||||
gp_Pnt p1;
|
gp_Pnt p1;
|
||||||
const Standard_Real Tg=tan(anAngle);
|
const Standard_Real Tg=tan(theAngle);
|
||||||
|
|
||||||
for (Standard_Integer i = 1; i <= NbPoints ; i++)
|
for (Standard_Integer i = 1; i <= NbPoints ; i++)
|
||||||
{
|
{
|
||||||
const Standard_Real cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
|
const Standard_Real cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
|
||||||
const Standard_Real sinus = sin ( 2 * M_PI / NbPoints * (i-1) );
|
const Standard_Real sinus = sin ( 2 * M_PI / NbPoints * (i-1) );
|
||||||
|
|
||||||
const gp_Pnt pp(xc + (cosinus * xi + sinus * xj) * aLength * Tg,
|
const gp_Pnt pp(xc + (cosinus * xi + sinus * xj) * theLength * Tg,
|
||||||
yc + (cosinus * yi + sinus * yj) * aLength * Tg,
|
yc + (cosinus * yi + sinus * yj) * theLength * Tg,
|
||||||
zc + (cosinus * zi + sinus * zj) * aLength * Tg);
|
zc + (cosinus * zi + sinus * zj) * theLength * Tg);
|
||||||
|
|
||||||
aPrims1->AddVertex(aLocation);
|
aSegments->AddVertex(pp);
|
||||||
aPrims1->AddVertex(pp);
|
|
||||||
if(i==1) p1 = pp;
|
|
||||||
aPrims2->AddVertex(pp);
|
|
||||||
}
|
}
|
||||||
aPrims2->AddVertex(p1);
|
|
||||||
|
|
||||||
theGroup->AddPrimitiveArray (aPrims1);
|
int aNbVertices = NbPoints + 1;
|
||||||
theGroup->AddPrimitiveArray (aPrims2);
|
int aFirstContourVertex = 2;
|
||||||
|
int anEdgeCount = 0;
|
||||||
|
for (Standard_Integer i = aFirstContourVertex; i <= aNbVertices ; i++) {
|
||||||
|
aSegments->AddEdge(1); // location vertex
|
||||||
|
aSegments->AddEdge(i);
|
||||||
|
anEdgeCount++;
|
||||||
|
}
|
||||||
|
aSegments->AddEdge(aNbVertices);
|
||||||
|
aSegments->AddEdge(aFirstContourVertex);
|
||||||
|
anEdgeCount++;
|
||||||
|
|
||||||
|
for (Standard_Integer i = aFirstContourVertex; i <= aNbVertices-1 ; i++) {
|
||||||
|
aSegments->AddEdge(i);
|
||||||
|
aSegments->AddEdge(i+1);
|
||||||
|
anEdgeCount++;
|
||||||
|
}
|
||||||
|
return aSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <Prs3d_Root.hxx>
|
#include <Prs3d_Root.hxx>
|
||||||
|
|
||||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||||
|
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||||
#include <Quantity_PlaneAngle.hxx>
|
#include <Quantity_PlaneAngle.hxx>
|
||||||
#include <Quantity_Length.hxx>
|
#include <Quantity_Length.hxx>
|
||||||
|
|
||||||
@ -46,6 +47,18 @@ public:
|
|||||||
const Standard_Real theConeLength,
|
const Standard_Real theConeLength,
|
||||||
const Standard_Integer theNbFacettes);
|
const Standard_Integer theNbFacettes);
|
||||||
|
|
||||||
|
//! Defines the representation of the arrow as a container of segments.
|
||||||
|
//! @param theLocation location of the arrow tip
|
||||||
|
//! @param theDirection direction of the arrow
|
||||||
|
//! @param theAngle angle of opening of the arrow head
|
||||||
|
//! @param theLength length of the arrow (from the tip)
|
||||||
|
//! @param theNumberOfSegments count of points on polyline where location is connected
|
||||||
|
Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) DrawSegments (const gp_Pnt& theLocation,
|
||||||
|
const gp_Dir& theDirection,
|
||||||
|
const Quantity_PlaneAngle theAngle,
|
||||||
|
const Quantity_Length theLength,
|
||||||
|
const int theNumberOfSegments);
|
||||||
|
|
||||||
//! Defines the representation of the arrow.
|
//! Defines the representation of the arrow.
|
||||||
//! Note that this method does NOT assign any presentation aspects to the primitives group!
|
//! Note that this method does NOT assign any presentation aspects to the primitives group!
|
||||||
//! @param theGroup presentation group to add primitives
|
//! @param theGroup presentation group to add primitives
|
||||||
|
@ -12,105 +12,248 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||||
|
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||||
|
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||||
|
|
||||||
#include <Prs3d_DatumAspect.hxx>
|
#include <Prs3d_DatumAspect.hxx>
|
||||||
#include <Prs3d_LineAspect.hxx>
|
#include <Prs3d_ToolSphere.hxx>
|
||||||
#include <Standard_Type.hxx>
|
#include <Prs3d_Arrow.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect,Prs3d_BasicAspect)
|
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||||
|
|
||||||
|
#define PATCH_TO_OCCT_710
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : Prs3d_DatumAspect
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
Prs3d_DatumAspect::Prs3d_DatumAspect()
|
Prs3d_DatumAspect::Prs3d_DatumAspect()
|
||||||
: myDrawFirstAndSecondAxis (Standard_True),
|
: myAxes (Prs3d_DA_XYZAxis),
|
||||||
myDrawThirdAxis (Standard_True),
|
myToDrawLabels (Standard_True)
|
||||||
myToDrawLabels (Standard_True),
|
|
||||||
myFirstAxisLength (10.0),
|
|
||||||
mySecondAxisLength (10.0),
|
|
||||||
myThirdAxisLength (10.0)
|
|
||||||
{
|
{
|
||||||
myFirstAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
myAttributes.Bind(Prs3d_DA_XAxisLength, 10.0);
|
||||||
mySecondAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
myAttributes.Bind(Prs3d_DA_YAxisLength, 10.0);
|
||||||
myThirdAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
myAttributes.Bind(Prs3d_DA_ZAxisLength, 10.0);
|
||||||
|
myAttributes.Bind(Prs3d_DP_ShadingTubeRadiusPercent, 0.02);
|
||||||
|
myAttributes.Bind(Prs3d_DP_ShadingConeRadiusPercent, 0.04);
|
||||||
|
myAttributes.Bind(Prs3d_DP_ShadingConeLengthPercent, 0.1);
|
||||||
|
myAttributes.Bind(Prs3d_DP_ShadingOriginRadiusPercent, 0.015);
|
||||||
|
myAttributes.Bind(Prs3d_DP_ShadingNumberOfFacettes, 12.);
|
||||||
|
|
||||||
|
myDefaultColors.Bind(Prs3d_DP_Origin, Quantity_Color(Quantity_NOC_BLUE1));
|
||||||
|
myDefaultColors.Bind(Prs3d_DP_XAxis, Quantity_Color(Quantity_NOC_RED));
|
||||||
|
myDefaultColors.Bind(Prs3d_DP_YAxis, Quantity_Color(Quantity_NOC_GREEN));
|
||||||
|
myDefaultColors.Bind(Prs3d_DP_ZAxis, Quantity_Color(Quantity_NOC_BLUE1));
|
||||||
|
|
||||||
|
Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
|
||||||
|
Standard_Real aWidth = 1.0;
|
||||||
|
for (int i = Prs3d_DP_Origin; i <= Prs3d_DP_XOZAxis; i++)
|
||||||
|
{
|
||||||
|
Prs3d_DatumParts aPart = (Prs3d_DatumParts)i;
|
||||||
|
Quantity_Color aDefaultColor;
|
||||||
|
if (!myDefaultColors.Find(aPart, aDefaultColor))
|
||||||
|
aDefaultColor = Quantity_NOC_PEACHPUFF;
|
||||||
|
if (aPart != Prs3d_DP_Origin) // origin point is used only in shading mode
|
||||||
|
myLineAspects.Bind(aPart, new Prs3d_LineAspect (aDefaultColor, aLineType, aWidth));
|
||||||
|
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
|
||||||
|
aShadingAspect->SetColor(aDefaultColor);
|
||||||
|
myShadedAspects.Bind(aPart, aShadingAspect);
|
||||||
|
}
|
||||||
|
myTextAspect = new Prs3d_TextAspect ();
|
||||||
|
#ifdef PATCH_TO_OCCT_710
|
||||||
|
myPointAspect = new Prs3d_PointAspect(Aspect_TOM_POINT/*Aspect_TOM_EMPTY*/,
|
||||||
|
#else
|
||||||
|
myPointAspect = new Prs3d_PointAspect(Aspect_TOM_EMPTY,
|
||||||
|
#endif
|
||||||
|
myDefaultColors.Find(Prs3d_DP_Origin), 1.0);
|
||||||
|
myArrowAspect = new Prs3d_ArrowAspect();
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Prs3d_LineAspect) Prs3d_DatumAspect::FirstAxisAspect() const {
|
Handle(Graphic3d_ArrayOfPrimitives) Prs3d_DatumAspect::ArrayOfPrimitives(
|
||||||
|
const Prs3d_DatumParts& theDatumPart) const
|
||||||
return myFirstAxisAspect;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Prs3d_LineAspect) Prs3d_DatumAspect::SecondAxisAspect() const {
|
|
||||||
|
|
||||||
return mySecondAxisAspect;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Prs3d_LineAspect) Prs3d_DatumAspect::ThirdAxisAspect() const {
|
|
||||||
|
|
||||||
return myThirdAxisAspect;
|
|
||||||
|
|
||||||
}
|
|
||||||
Standard_Boolean Prs3d_DatumAspect::DrawFirstAndSecondAxis () const {
|
|
||||||
|
|
||||||
return myDrawFirstAndSecondAxis;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Prs3d_DatumAspect::SetDrawFirstAndSecondAxis (const Standard_Boolean draw)
|
|
||||||
{
|
{
|
||||||
myDrawFirstAndSecondAxis = draw;
|
Handle(Graphic3d_ArrayOfPrimitives) anArray;
|
||||||
|
myPrimitives.Find(theDatumPart, anArray);
|
||||||
|
return anArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean Prs3d_DatumAspect::DrawThirdAxis () const {
|
void Prs3d_DatumAspect::UpdatePrimitives(const Prs3d_DatumMode& theMode, const gp_Pnt& theOrigin,
|
||||||
|
const gp_Dir& theXDirection,
|
||||||
return myDrawThirdAxis;
|
const gp_Dir& theYDirection, const gp_Dir& theZDirection)
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Prs3d_DatumAspect::SetDrawThirdAxis (const Standard_Boolean draw)
|
|
||||||
{
|
{
|
||||||
myDrawThirdAxis = draw;
|
myPrimitives.Clear();
|
||||||
|
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, gp_Dir> anAxisDirs;
|
||||||
|
anAxisDirs.Bind(Prs3d_DP_XAxis, theXDirection);
|
||||||
|
anAxisDirs.Bind(Prs3d_DP_YAxis, theYDirection);
|
||||||
|
anAxisDirs.Bind(Prs3d_DP_ZAxis, theZDirection);
|
||||||
|
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, gp_Pnt> anAxisPoints;
|
||||||
|
gp_XYZ anXYZOrigin = theOrigin.XYZ();
|
||||||
|
for (int i = Prs3d_DP_XAxis; i <= Prs3d_DP_ZAxis; i++)
|
||||||
|
{
|
||||||
|
Prs3d_DatumParts aPart = (Prs3d_DatumParts)i;
|
||||||
|
anAxisPoints.Bind(aPart, gp_Pnt(anXYZOrigin + anAxisDirs.Find(aPart).XYZ()*AxisLength(aPart)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theMode == Prs3d_DM_WireFrame)
|
||||||
|
{
|
||||||
|
// origin
|
||||||
|
Prs3d_DatumParts aPart = Prs3d_DP_Origin;
|
||||||
|
if (DrawDatumPart(aPart))
|
||||||
|
{
|
||||||
|
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPoints(1);
|
||||||
|
aPrims->AddVertex(theOrigin);
|
||||||
|
myPrimitives.Bind(aPart, aPrims);
|
||||||
|
}
|
||||||
|
// axes
|
||||||
|
for (int i = Prs3d_DP_XAxis; i <= Prs3d_DP_ZAxis; i++)
|
||||||
|
{
|
||||||
|
Prs3d_DatumParts aPart = (Prs3d_DatumParts)i;
|
||||||
|
if (DrawDatumPart(aPart))
|
||||||
|
{
|
||||||
|
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||||
|
aPrims->AddVertex(theOrigin);
|
||||||
|
aPrims->AddVertex(anAxisPoints.Find(aPart));
|
||||||
|
myPrimitives.Bind(aPart, aPrims);
|
||||||
|
}
|
||||||
|
|
||||||
|
Prs3d_DatumParts anArrowPart = ArrowPartForAxis(aPart);
|
||||||
|
if (DrawDatumPart(anArrowPart))
|
||||||
|
{
|
||||||
|
myPrimitives.Bind(anArrowPart,
|
||||||
|
Prs3d_Arrow::DrawSegments(anAxisPoints.Find(aPart), anAxisDirs.Find(aPart),
|
||||||
|
ArrowAspect()->Angle(),
|
||||||
|
AxisLength(aPart)*Attribute(Prs3d_DP_ShadingConeLengthPercent),
|
||||||
|
(Standard_Integer)Attribute(Prs3d_DP_ShadingNumberOfFacettes)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // shading mode
|
||||||
|
// origin
|
||||||
|
Prs3d_DatumParts aPart = Prs3d_DP_Origin;
|
||||||
|
if (DrawDatumPart(aPart))
|
||||||
|
{
|
||||||
|
Standard_Real aSphereRadius = AxisLength(Prs3d_DP_XAxis)*
|
||||||
|
Attribute(Prs3d_DP_ShadingOriginRadiusPercent);
|
||||||
|
Standard_Integer aNbOfFacettes = (Standard_Integer)Attribute(Prs3d_DP_ShadingNumberOfFacettes);
|
||||||
|
gp_Trsf aSphereTransform;
|
||||||
|
aSphereTransform.SetTranslationPart(gp_Vec(gp_Pnt(0.0, 0.0, 0.0), theOrigin));
|
||||||
|
myPrimitives.Bind(aPart, Prs3d_ToolSphere::Create(aSphereRadius, aNbOfFacettes,
|
||||||
|
aNbOfFacettes, aSphereTransform));
|
||||||
|
}
|
||||||
|
// axes
|
||||||
|
{
|
||||||
|
Standard_Integer aNbOfFacettes =
|
||||||
|
(Standard_Integer)Attribute(Prs3d_DP_ShadingNumberOfFacettes);
|
||||||
|
Standard_Real aTubeRadiusPercent = Attribute(Prs3d_DP_ShadingTubeRadiusPercent);
|
||||||
|
Standard_Real aConeLengthPercent = Attribute(Prs3d_DP_ShadingConeLengthPercent);
|
||||||
|
Standard_Real aConeRadiusPercent = Attribute(Prs3d_DP_ShadingConeRadiusPercent);
|
||||||
|
for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis;
|
||||||
|
++anAxisIter)
|
||||||
|
{
|
||||||
|
Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
|
||||||
|
Prs3d_DatumParts anArrowPart = ArrowPartForAxis(aPart);
|
||||||
|
bool aDrawArrow = DrawDatumPart(anArrowPart);
|
||||||
|
Standard_Real anAxisLength = AxisLength(aPart);
|
||||||
|
gp_Ax1 anAxis (theOrigin, anAxisDirs.Find(aPart));
|
||||||
|
|
||||||
|
if (DrawDatumPart(aPart))
|
||||||
|
// draw cylinder
|
||||||
|
myPrimitives.Bind(aPart, Prs3d_Arrow::DrawShaded (anAxis, anAxisLength*aTubeRadiusPercent,
|
||||||
|
aDrawArrow ? anAxisLength - anAxisLength*aConeLengthPercent: anAxisLength,
|
||||||
|
0.0, 0.0, aNbOfFacettes));
|
||||||
|
|
||||||
|
// draw arrow
|
||||||
|
if (aDrawArrow)
|
||||||
|
myPrimitives.Bind(anArrowPart, Prs3d_Arrow::DrawShaded (anAxis,
|
||||||
|
0.0, anAxisLength, anAxisLength*aConeRadiusPercent,
|
||||||
|
anAxisLength*aConeLengthPercent, aNbOfFacettes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// planes
|
||||||
|
for (Standard_Integer aPlaneIter = Prs3d_DP_XOYAxis; aPlaneIter <= Prs3d_DP_XOZAxis;
|
||||||
|
++aPlaneIter)
|
||||||
|
{
|
||||||
|
Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPlaneIter;
|
||||||
|
if (!DrawDatumPart(aPart))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(4);
|
||||||
|
aPrims->AddVertex(theOrigin);
|
||||||
|
|
||||||
|
Prs3d_DatumParts aPart1, aPart2;
|
||||||
|
switch (aPart) {
|
||||||
|
case Prs3d_DP_XOYAxis: { aPart1 = Prs3d_DP_XAxis; aPart2 = Prs3d_DP_YAxis; } break;
|
||||||
|
case Prs3d_DP_YOZAxis: { aPart1 = Prs3d_DP_YAxis; aPart2 = Prs3d_DP_ZAxis; } break;
|
||||||
|
case Prs3d_DP_XOZAxis: { aPart1 = Prs3d_DP_XAxis; aPart2 = Prs3d_DP_ZAxis; } break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
aPrims->AddVertex(anAxisPoints.Find(aPart1));
|
||||||
|
aPrims->AddVertex(anAxisPoints.Find(aPart2));
|
||||||
|
|
||||||
|
aPrims->AddVertex(theOrigin);
|
||||||
|
myPrimitives.Bind(aPart, aPrims);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prs3d_DatumAspect::SetAxisLength (const Quantity_Length L1,
|
void Prs3d_DatumAspect::SetDrawFirstAndSecondAxis (const Standard_Boolean theToDraw)
|
||||||
const Quantity_Length L2,
|
|
||||||
const Quantity_Length L3) {
|
|
||||||
|
|
||||||
myFirstAxisLength = L1;
|
|
||||||
mySecondAxisLength = L2;
|
|
||||||
myThirdAxisLength = L3;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Quantity_Length Prs3d_DatumAspect::FirstAxisLength () const {
|
|
||||||
|
|
||||||
return myFirstAxisLength;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Quantity_Length Prs3d_DatumAspect::SecondAxisLength () const {
|
|
||||||
|
|
||||||
return mySecondAxisLength;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Quantity_Length Prs3d_DatumAspect::ThirdAxisLength () const {
|
|
||||||
|
|
||||||
return myThirdAxisLength;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetToDrawLabels
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void Prs3d_DatumAspect::SetToDrawLabels (const Standard_Boolean theToDraw)
|
|
||||||
{
|
{
|
||||||
myToDrawLabels = theToDraw;
|
if (theToDraw)
|
||||||
|
myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_XAxis | Prs3d_DA_YAxis);
|
||||||
|
else
|
||||||
|
myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_XAxis & !Prs3d_DA_YAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
void Prs3d_DatumAspect::SetDrawThirdAxis (const Standard_Boolean theToDraw)
|
||||||
//function : ToDrawLabels
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean Prs3d_DatumAspect::ToDrawLabels() const
|
|
||||||
{
|
{
|
||||||
return myToDrawLabels;
|
if (theToDraw)
|
||||||
|
myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_ZAxis);
|
||||||
|
else
|
||||||
|
myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_ZAxis);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Prs3d_DatumAspect::DrawDatumPart(const Prs3d_DatumParts& thePart) const
|
||||||
|
{
|
||||||
|
switch (thePart)
|
||||||
|
{
|
||||||
|
case Prs3d_DP_Origin: return true;
|
||||||
|
case Prs3d_DP_XAxis:
|
||||||
|
case Prs3d_DP_XArrow: return (myAxes & Prs3d_DA_XAxis) != 0;
|
||||||
|
case Prs3d_DP_YAxis:
|
||||||
|
case Prs3d_DP_YArrow: return (myAxes & Prs3d_DA_YAxis) != 0;
|
||||||
|
case Prs3d_DP_ZAxis:
|
||||||
|
case Prs3d_DP_ZArrow: return (myAxes & Prs3d_DA_ZAxis) != 0;
|
||||||
|
case Prs3d_DP_XOYAxis: return DrawDatumPart(Prs3d_DP_XAxis) && DrawDatumPart(Prs3d_DP_YAxis);
|
||||||
|
case Prs3d_DP_YOZAxis: return DrawDatumPart(Prs3d_DP_YAxis) && DrawDatumPart(Prs3d_DP_ZAxis);
|
||||||
|
case Prs3d_DP_XOZAxis: return DrawDatumPart(Prs3d_DP_XAxis) && DrawDatumPart(Prs3d_DP_ZAxis);
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Quantity_Length Prs3d_DatumAspect::AxisLength(const Prs3d_DatumParts& thePart) const
|
||||||
|
{
|
||||||
|
switch (thePart)
|
||||||
|
{
|
||||||
|
case Prs3d_DP_XAxis: return (Quantity_Length)myAttributes.Find(Prs3d_DA_XAxisLength);
|
||||||
|
case Prs3d_DP_YAxis: return (Quantity_Length)myAttributes.Find(Prs3d_DA_YAxisLength);
|
||||||
|
case Prs3d_DP_ZAxis: return (Quantity_Length)myAttributes.Find(Prs3d_DA_ZAxisLength);
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return Quantity_Length(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis(const Prs3d_DatumParts& thePart) const
|
||||||
|
{
|
||||||
|
switch (thePart)
|
||||||
|
{
|
||||||
|
case Prs3d_DP_XAxis: return Prs3d_DP_XArrow;
|
||||||
|
case Prs3d_DP_YAxis: return Prs3d_DP_YArrow;
|
||||||
|
case Prs3d_DP_ZAxis: return Prs3d_DP_ZArrow;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return Prs3d_DP_None;
|
||||||
}
|
}
|
||||||
|
@ -17,87 +17,173 @@
|
|||||||
#ifndef _Prs3d_DatumAspect_HeaderFile
|
#ifndef _Prs3d_DatumAspect_HeaderFile
|
||||||
#define _Prs3d_DatumAspect_HeaderFile
|
#define _Prs3d_DatumAspect_HeaderFile
|
||||||
|
|
||||||
#include <Standard.hxx>
|
#include <NCollection_DataMap.hxx>
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
|
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||||
|
|
||||||
#include <Standard_Boolean.hxx>
|
|
||||||
#include <Quantity_Length.hxx>
|
|
||||||
#include <Prs3d_BasicAspect.hxx>
|
#include <Prs3d_BasicAspect.hxx>
|
||||||
|
#include <Prs3d_DatumAttribute.hxx>
|
||||||
|
#include <Prs3d_DatumParts.hxx>
|
||||||
|
#include <Prs3d_DatumMode.hxx>
|
||||||
|
#include <Prs3d_LineAspect.hxx>
|
||||||
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
|
#include <Prs3d_TextAspect.hxx>
|
||||||
|
#include <Prs3d_PointAspect.hxx>
|
||||||
|
#include <Prs3d_ArrowAspect.hxx>
|
||||||
|
#include <Prs3d_DatumAxes.hxx>
|
||||||
|
|
||||||
|
#include <Quantity_Length.hxx>
|
||||||
|
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
#include <Standard_Real.hxx>
|
#include <Standard_Real.hxx>
|
||||||
class Prs3d_LineAspect;
|
#include <Standard_Type.hxx>
|
||||||
|
|
||||||
|
|
||||||
class Prs3d_DatumAspect;
|
|
||||||
DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
|
||||||
|
|
||||||
//! A framework to define the display of datums.
|
//! A framework to define the display of datums.
|
||||||
class Prs3d_DatumAspect : public Prs3d_BasicAspect
|
class Prs3d_DatumAspect : public Prs3d_BasicAspect
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! An empty framework to define the display of datums.
|
//! An empty framework to define the display of datums.
|
||||||
Standard_EXPORT Prs3d_DatumAspect();
|
Standard_EXPORT Prs3d_DatumAspect();
|
||||||
|
|
||||||
|
//! Returns the right-handed coordinate system set in SetComponent.
|
||||||
|
Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect(const Prs3d_DatumParts& thePart) const
|
||||||
|
{
|
||||||
|
return myLineAspects.Find(thePart);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the right-handed coordinate system set in SetComponent.
|
||||||
|
Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect(const Prs3d_DatumParts& thePart) const
|
||||||
|
{
|
||||||
|
return myShadedAspects.Find(thePart);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the right-handed coordinate system set in SetComponent.
|
||||||
|
Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect() const
|
||||||
|
{
|
||||||
|
return myTextAspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the point aspect of origin wireframe presentation
|
||||||
|
Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect() const
|
||||||
|
{
|
||||||
|
return myPointAspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the arrow aspect of presentation
|
||||||
|
Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect() const
|
||||||
|
{
|
||||||
|
return myArrowAspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns primitives.
|
||||||
|
Handle(Graphic3d_ArrayOfPrimitives) ArrayOfPrimitives(const Prs3d_DatumParts& thePart) const;
|
||||||
|
|
||||||
|
//! Updates graphic groups for the current datum mode
|
||||||
|
//! Parameters of datum position and orientation
|
||||||
|
Standard_EXPORT void UpdatePrimitives(const Prs3d_DatumMode& theMode, const gp_Pnt& theOrigin,
|
||||||
|
const gp_Dir& theXDirection, const gp_Dir& theYDirection,
|
||||||
|
const gp_Dir& theZDirection);
|
||||||
|
|
||||||
//! Returns the attributes for display of the first axis.
|
//! Returns the attributes for display of the first axis.
|
||||||
Standard_EXPORT Handle(Prs3d_LineAspect) FirstAxisAspect() const;
|
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||||
|
const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects.Find(Prs3d_DP_XAxis); }
|
||||||
|
|
||||||
//! Returns the attributes for display of the second axis.
|
//! Returns the attributes for display of the second axis.
|
||||||
Standard_EXPORT Handle(Prs3d_LineAspect) SecondAxisAspect() const;
|
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||||
|
const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return myLineAspects.Find(Prs3d_DP_YAxis); }
|
||||||
|
|
||||||
//! Returns the attributes for display of the third axis.
|
//! Returns the attributes for display of the third axis.
|
||||||
Standard_EXPORT Handle(Prs3d_LineAspect) ThirdAxisAspect() const;
|
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||||
|
const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myLineAspects.Find(Prs3d_DP_ZAxis); }
|
||||||
|
|
||||||
//! Sets the DrawFirstAndSecondAxis attributes to active.
|
//! Sets the DrawFirstAndSecondAxis attributes to active.
|
||||||
Standard_EXPORT void SetDrawFirstAndSecondAxis (const Standard_Boolean draw);
|
Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
|
||||||
|
Standard_EXPORT void SetDrawFirstAndSecondAxis (const Standard_Boolean theToDraw);
|
||||||
|
|
||||||
//! Returns true if the first and second axes can be drawn.
|
//! Returns true if the first and second axes can be drawn.
|
||||||
Standard_EXPORT Standard_Boolean DrawFirstAndSecondAxis() const;
|
Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
|
||||||
|
Standard_Boolean DrawFirstAndSecondAxis() const { return (myAxes & Prs3d_DA_XAxis & Prs3d_DA_YAxis) != 0; }
|
||||||
|
|
||||||
//! Sets the DrawThirdAxis attributes to active.
|
//! Sets the DrawThirdAxis attributes to active.
|
||||||
Standard_EXPORT void SetDrawThirdAxis (const Standard_Boolean draw);
|
Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
|
||||||
|
Standard_EXPORT void SetDrawThirdAxis (const Standard_Boolean theToDraw);
|
||||||
|
|
||||||
//! Returns true if the third axis can be drawn.
|
//! Returns true if the third axis can be drawn.
|
||||||
Standard_EXPORT Standard_Boolean DrawThirdAxis() const;
|
Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
|
||||||
|
Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DA_ZAxis) != 0; }
|
||||||
//! Sets the lengths L1, L2 and L3 of the three axes.
|
|
||||||
Standard_EXPORT void SetAxisLength (const Standard_Real L1, const Standard_Real L2, const Standard_Real L3);
|
//! Returns true if the given part is used in axes of aspect
|
||||||
|
Standard_EXPORT Standard_Boolean DrawDatumPart(const Prs3d_DatumParts& thePart) const;
|
||||||
|
|
||||||
|
//! Sets the axes used in the datum aspect
|
||||||
|
void SetDrawDatumAxes(const Prs3d_DatumAxes& theType) { myAxes = theType; }
|
||||||
|
|
||||||
|
//! Returns axes used in the datum aspect
|
||||||
|
Prs3d_DatumAxes DatumAxes() const { return myAxes; }
|
||||||
|
|
||||||
|
//! Sets the attribute of the datum type
|
||||||
|
void SetAttribute(const Prs3d_DatumAttribute& theType, const Standard_Real& theValue)
|
||||||
|
{
|
||||||
|
myAttributes.Bind(theType, theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the attribute of the datum type
|
||||||
|
Standard_Real Attribute(const Prs3d_DatumAttribute& theType) const
|
||||||
|
{
|
||||||
|
return myAttributes.Find(theType);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Sets the lengths of the three axes.
|
||||||
|
void SetAxisLength (const Standard_Real theL1, const Standard_Real theL2, const Standard_Real theL3)
|
||||||
|
{
|
||||||
|
myAttributes.Bind(Prs3d_DA_XAxisLength, theL1);
|
||||||
|
myAttributes.Bind(Prs3d_DA_YAxisLength, theL2);
|
||||||
|
myAttributes.Bind(Prs3d_DA_ZAxisLength, theL3);
|
||||||
|
}
|
||||||
|
|
||||||
//! Returns the length of the displayed first axis.
|
//! Returns the length of the displayed first axis.
|
||||||
Standard_EXPORT Quantity_Length FirstAxisLength() const;
|
Quantity_Length AxisLength(const Prs3d_DatumParts& thePart) const;
|
||||||
|
|
||||||
|
//! Returns the length of the displayed first axis.
|
||||||
|
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||||
|
Quantity_Length FirstAxisLength() const { return (Quantity_Length)myAttributes.Find(Prs3d_DA_XAxisLength); }
|
||||||
|
|
||||||
//! Returns the length of the displayed second axis.
|
//! Returns the length of the displayed second axis.
|
||||||
Standard_EXPORT Quantity_Length SecondAxisLength() const;
|
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||||
|
Quantity_Length SecondAxisLength() const { return (Quantity_Length)myAttributes.Find(Prs3d_DA_YAxisLength); }
|
||||||
|
|
||||||
//! Returns the length of the displayed third axis.
|
//! Returns the length of the displayed third axis.
|
||||||
Standard_EXPORT Quantity_Length ThirdAxisLength() const;
|
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||||
|
Quantity_Length ThirdAxisLength() const { return (Quantity_Length)myAttributes.Find(Prs3d_DA_ZAxisLength); }
|
||||||
|
|
||||||
//! Sets option to draw or not to draw text labels for axes
|
//! Sets option to draw or not to draw text labels for axes
|
||||||
Standard_EXPORT void SetToDrawLabels (const Standard_Boolean theToDraw);
|
void SetToDrawLabels (const Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
|
||||||
|
|
||||||
//! @return true if axes labels are drawn
|
//! @return true if axes labels are drawn
|
||||||
Standard_EXPORT Standard_Boolean ToDrawLabels() const;
|
Standard_Boolean ToDrawLabels() const { return myToDrawLabels; }
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect,Prs3d_BasicAspect)
|
//! Returns type of arrow for a type of axis
|
||||||
|
Prs3d_DatumParts ArrowPartForAxis(const Prs3d_DatumParts& thePart) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Prs3d_DatumAxes myAxes;
|
||||||
Handle(Prs3d_LineAspect) myFirstAxisAspect;
|
|
||||||
Handle(Prs3d_LineAspect) mySecondAxisAspect;
|
|
||||||
Handle(Prs3d_LineAspect) myThirdAxisAspect;
|
|
||||||
Standard_Boolean myDrawFirstAndSecondAxis;
|
|
||||||
Standard_Boolean myDrawThirdAxis;
|
|
||||||
Standard_Boolean myToDrawLabels;
|
Standard_Boolean myToDrawLabels;
|
||||||
Quantity_Length myFirstAxisLength;
|
NCollection_DataMap<Prs3d_DatumAttribute, Standard_Real> myAttributes;
|
||||||
Quantity_Length mySecondAxisLength;
|
|
||||||
Quantity_Length myThirdAxisLength;
|
|
||||||
|
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_ArrayOfPrimitives)> myPrimitives;
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_ShadingAspect)> myShadedAspects;
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_LineAspect)> myLineAspects;
|
||||||
|
|
||||||
|
NCollection_DataMap<Prs3d_DatumParts, Quantity_Color> myDefaultColors;
|
||||||
|
|
||||||
|
Handle(Prs3d_TextAspect) myTextAspect;
|
||||||
|
Handle(Prs3d_PointAspect) myPointAspect;
|
||||||
|
Handle(Prs3d_ArrowAspect) myArrowAspect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _Prs3d_DatumAspect_HeaderFile
|
#endif // _Prs3d_DatumAspect_HeaderFile
|
||||||
|
30
src/Prs3d/Prs3d_DatumAttribute.hxx
Normal file
30
src/Prs3d/Prs3d_DatumAttribute.hxx
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Prs3d_DatumAttribute_HeaderFile
|
||||||
|
#define _Prs3d_DatumAttribute_HeaderFile
|
||||||
|
|
||||||
|
//! Enumeration defining a part of datum aspect, see Prs3d_Datum.
|
||||||
|
enum Prs3d_DatumAttribute
|
||||||
|
{
|
||||||
|
Prs3d_DA_XAxisLength = 0,
|
||||||
|
Prs3d_DA_YAxisLength,
|
||||||
|
Prs3d_DA_ZAxisLength,
|
||||||
|
Prs3d_DP_ShadingTubeRadiusPercent,
|
||||||
|
Prs3d_DP_ShadingConeRadiusPercent,
|
||||||
|
Prs3d_DP_ShadingConeLengthPercent,
|
||||||
|
Prs3d_DP_ShadingOriginRadiusPercent,
|
||||||
|
Prs3d_DP_ShadingNumberOfFacettes
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _Prs3d_DatumAttribute_HeaderFile
|
34
src/Prs3d/Prs3d_DatumAxes.hxx
Normal file
34
src/Prs3d/Prs3d_DatumAxes.hxx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Prs3d_DatumAxes_HeaderFile
|
||||||
|
#define _Prs3d_DatumAxes_HeaderFile
|
||||||
|
|
||||||
|
//! Enumeration defining an axes used in datum aspect, see Prs3d_Datum.
|
||||||
|
enum Prs3d_DatumAxes
|
||||||
|
{
|
||||||
|
Prs3d_DA_XAxis = 0x00000001, //!< X axis of the datum
|
||||||
|
Prs3d_DA_YAxis = 0x00000002, //!< Y axis of the datum
|
||||||
|
Prs3d_DA_ZAxis = 0x00000004, //!< Z axis of the datum
|
||||||
|
Prs3d_DA_XYAxis = Prs3d_DA_XAxis
|
||||||
|
| Prs3d_DA_YAxis, //!< XOY 2D axes
|
||||||
|
Prs3d_DA_YZAxis = Prs3d_DA_YAxis
|
||||||
|
| Prs3d_DA_ZAxis, //!< YOZ 2D axes
|
||||||
|
Prs3d_DA_XZAxis = Prs3d_DA_XAxis
|
||||||
|
| Prs3d_DA_ZAxis, //!< XOZ 2D axes
|
||||||
|
Prs3d_DA_XYZAxis = Prs3d_DA_XAxis
|
||||||
|
| Prs3d_DA_YAxis
|
||||||
|
| Prs3d_DA_ZAxis //!< XYZ 3D axes
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _Prs3d_DatumParts_HeaderFile
|
24
src/Prs3d/Prs3d_DatumMode.hxx
Normal file
24
src/Prs3d/Prs3d_DatumMode.hxx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Prs3d_DatumMode_HeaderFile
|
||||||
|
#define _Prs3d_DatumMode_HeaderFile
|
||||||
|
|
||||||
|
//! Enumeration defining a mode of datum graphic presentation, see Prs3d_Datum.
|
||||||
|
enum Prs3d_DatumMode
|
||||||
|
{
|
||||||
|
Prs3d_DM_WireFrame = 0,
|
||||||
|
Prs3d_DM_Shaded
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _Prs3d_DatumMode_HeaderFile
|
33
src/Prs3d/Prs3d_DatumParts.hxx
Normal file
33
src/Prs3d/Prs3d_DatumParts.hxx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#ifndef _Prs3d_DatumParts_HeaderFile
|
||||||
|
#define _Prs3d_DatumParts_HeaderFile
|
||||||
|
|
||||||
|
//! Enumeration defining a part of datum aspect, see Prs3d_Datum.
|
||||||
|
enum Prs3d_DatumParts
|
||||||
|
{
|
||||||
|
Prs3d_DP_Origin = 0,
|
||||||
|
Prs3d_DP_XAxis,
|
||||||
|
Prs3d_DP_YAxis,
|
||||||
|
Prs3d_DP_ZAxis,
|
||||||
|
Prs3d_DP_XArrow,
|
||||||
|
Prs3d_DP_YArrow,
|
||||||
|
Prs3d_DP_ZArrow,
|
||||||
|
Prs3d_DP_XOYAxis,
|
||||||
|
Prs3d_DP_YOZAxis,
|
||||||
|
Prs3d_DP_XOZAxis,
|
||||||
|
Prs3d_DP_None
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _Prs3d_DatumParts_HeaderFile
|
@ -85,7 +85,7 @@ static int VTrihedronOrigins(Draw_Interpretor& di,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get axis
|
//get axis
|
||||||
Handle(AIS_Axis) XAxis = aTrih->XAxis();
|
/*Handle(AIS_Axis) XAxis = aTrih->XAxis();
|
||||||
Handle(AIS_Axis) YAxis = aTrih->YAxis();
|
Handle(AIS_Axis) YAxis = aTrih->YAxis();
|
||||||
Handle(AIS_Axis) ZAxis = aTrih->Axis();
|
Handle(AIS_Axis) ZAxis = aTrih->Axis();
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ static int VTrihedronOrigins(Draw_Interpretor& di,
|
|||||||
TheAISContext()->Display(XLine);
|
TheAISContext()->Display(XLine);
|
||||||
TheAISContext()->Display(YLine);
|
TheAISContext()->Display(YLine);
|
||||||
TheAISContext()->Display(ZLine);
|
TheAISContext()->Display(ZLine);
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user