1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0027958: Visualization, AIS_Trihedron - add shaded presentation option

A new Shaded presentation flag configured through Datum aspect (NOT as usual Display Mode).
Creation of auxiliary Axis/Point/Plane presentations in Trihedron presentation is removed.
'vtrihedron' DRAW command to change parameters of trihedron is extended to cover whole functionality of AIS_Trihedron.

The following classes are redesignede:
AIS_Trihedron,
Prs3d_DatumAspect.

The followin enumermations are created to manage properties of trihedron:
Prs3d_DatumAttribute,
Prs3d/Prs3d_DatumAxes,
Prs3d_DatumMode
This commit is contained in:
nds
2017-02-15 15:59:48 +03:00
committed by bugmaster
parent 68b0769935
commit bc001a4030
42 changed files with 2213 additions and 1182 deletions

View File

@@ -86,9 +86,9 @@ myIsXYZAxis(Standard_True)
}
DA->SetAxisLength(aLength,aLength,aLength);
Quantity_NameOfColor col = Quantity_NOC_TURQUOISE;
DA->FirstAxisAspect()->SetColor(col);
DA->SecondAxisAspect()->SetColor(col);
DA->ThirdAxisAspect()->SetColor(col);
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col);
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col);
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(col);
myDrawer->SetDatumAspect(DA);
ComputeFields();
@@ -225,9 +225,9 @@ void AIS_Axis::SetColor(const Quantity_Color &aCol)
myDrawer->LineAspect()->SetColor(aCol);
const Handle(Prs3d_DatumAspect)& DA = myDrawer->DatumAspect();
DA->FirstAxisAspect()->SetColor(aCol);
DA->SecondAxisAspect()->SetColor(aCol);
DA->ThirdAxisAspect()->SetColor(aCol);
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
}
@@ -244,9 +244,9 @@ void AIS_Axis::SetWidth(const Standard_Real aValue)
myDrawer->LineAspect()->SetWidth(aValue);
const Handle(Prs3d_DatumAspect)& DA = myDrawer->DatumAspect();
DA->FirstAxisAspect()->SetWidth(aValue);
DA->SecondAxisAspect()->SetWidth(aValue);
DA->ThirdAxisAspect()->SetWidth(aValue);
DA->LineAspect(Prs3d_DP_XAxis)->SetWidth(aValue);
DA->LineAspect(Prs3d_DP_YAxis)->SetWidth(aValue);
DA->LineAspect(Prs3d_DP_ZAxis)->SetWidth(aValue);
}
@@ -281,27 +281,27 @@ void AIS_Axis::ComputeFields()
case AIS_TOAX_XAxis:
{
oX.Coord(x,y,z);
myVal = DA->FirstAxisLength();
myVal = DA->AxisLength(Prs3d_DP_XAxis);
myDir = oX;
myLineAspect = DA->FirstAxisAspect();
myLineAspect = DA->LineAspect(Prs3d_DP_XAxis);
myText = Standard_CString ("X");
break;
}
case AIS_TOAX_YAxis:
{
oY.Coord(x,y,z);
myVal = DA->SecondAxisLength();
myVal = DA->AxisLength(Prs3d_DP_YAxis);
myDir = oY;
myLineAspect = DA->SecondAxisAspect();
myLineAspect = DA->LineAspect(Prs3d_DP_YAxis);
myText = Standard_CString ("Y");
break;
}
case AIS_TOAX_ZAxis:
{
oZ.Coord(x,y,z);
myVal = DA->ThirdAxisLength();
myVal = DA->AxisLength(Prs3d_DP_ZAxis);
myDir = oZ;
myLineAspect = DA->ThirdAxisAspect();
myLineAspect = DA->LineAspect(Prs3d_DP_ZAxis);
myText = Standard_CString ("Z");
break;
}
@@ -336,9 +336,9 @@ void AIS_Axis::UnsetColor()
hasOwnColor=Standard_False;
myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(Quantity_NOC_TURQUOISE);
myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(Quantity_NOC_TURQUOISE);
myDrawer->DatumAspect()->ThirdAxisAspect()->SetColor(Quantity_NOC_TURQUOISE);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_TURQUOISE);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Quantity_NOC_TURQUOISE);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Quantity_NOC_TURQUOISE);
}
//=======================================================================
//function : UnsetWidth
@@ -349,8 +349,8 @@ void AIS_Axis::UnsetWidth()
{
myOwnWidth = 0.0;
myDrawer->LineAspect()->SetWidth(1.);
myDrawer->DatumAspect()->FirstAxisAspect()->SetWidth(1.);
myDrawer->DatumAspect()->SecondAxisAspect()->SetWidth(1.);
myDrawer->DatumAspect()->ThirdAxisAspect()->SetWidth(1.);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(1.);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(1.);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(1.);
}

View File

@@ -69,11 +69,11 @@ static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
return Dr->SeenLineAspect();
break;
case AIS_TOA_FirstAxis:
return Dr->DatumAspect()->FirstAxisAspect();
return Dr->DatumAspect()->LineAspect(Prs3d_DP_XAxis);
case AIS_TOA_SecondAxis:
return Dr->DatumAspect()->SecondAxisAspect();
return Dr->DatumAspect()->LineAspect(Prs3d_DP_YAxis);
case AIS_TOA_ThirdAxis:
return Dr->DatumAspect()->SecondAxisAspect();
return Dr->DatumAspect()->LineAspect(Prs3d_DP_ZAxis);
}
Handle(Prs3d_LineAspect) bid;
return bid;

View File

@@ -2736,9 +2736,9 @@ void AIS_InteractiveContext::InitAttributes()
const Standard_Real aLength = 100.0;
aTrihAspect->SetAxisLength (aLength, aLength, aLength);
const Quantity_NameOfColor aColor = Quantity_NOC_LIGHTSTEELBLUE4;
aTrihAspect->FirstAxisAspect() ->SetColor (aColor);
aTrihAspect->SecondAxisAspect()->SetColor (aColor);
aTrihAspect->ThirdAxisAspect() ->SetColor (aColor);
aTrihAspect->LineAspect(Prs3d_DP_XAxis)->SetColor (aColor);
aTrihAspect->LineAspect(Prs3d_DP_YAxis)->SetColor (aColor);
aTrihAspect->LineAspect(Prs3d_DP_ZAxis)->SetColor (aColor);
Handle(Prs3d_PlaneAspect) aPlaneAspect = myDefaultDrawer->PlaneAspect();
const Standard_Real aPlaneLength = 200.0;
@@ -2752,7 +2752,7 @@ void AIS_InteractiveContext::InitAttributes()
//=======================================================================
Standard_Real AIS_InteractiveContext::TrihedronSize() const
{
return myDefaultDrawer->DatumAspect()->FirstAxisLength();
return myDefaultDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
}
//=======================================================================

View File

@@ -412,9 +412,9 @@ void AIS_Plane::UnsetSize()
new Prs3d_DatumAspect();
myDrawer->PlaneAspect()->SetPlaneLength(PA->PlaneXLength(),PA->PlaneYLength());
myDrawer->DatumAspect()->SetAxisLength(DA->FirstAxisLength(),
DA->SecondAxisLength(),
DA->ThirdAxisLength());
myDrawer->DatumAspect()->SetAxisLength(DA->AxisLength(Prs3d_DP_XAxis),
DA->AxisLength(Prs3d_DP_YAxis),
DA->AxisLength(Prs3d_DP_ZAxis));
}
myHasOwnSize = Standard_False;
@@ -467,9 +467,9 @@ void AIS_Plane::SetColor(const Quantity_Color &aCol)
}
PA->EdgesAspect()->SetColor(aCol);
DA->FirstAxisAspect()->SetColor(aCol);
DA->SecondAxisAspect()->SetColor(aCol);
DA->ThirdAxisAspect()->SetColor(aCol);
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
if(!yenavaitPA)
myDrawer->SetPlaneAspect(PA);
@@ -500,9 +500,9 @@ void AIS_Plane::UnsetColor()
Quantity_NameOfColor Col = PA->EdgesAspect()->Aspect()->Color().Name();
myDrawer->PlaneAspect()->EdgesAspect()->SetColor(Col);
myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(Col);
myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(Col);
myDrawer->DatumAspect()->ThirdAxisAspect()->SetColor(Col);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Col);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Col);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Col);
}
@@ -566,9 +566,9 @@ void AIS_Plane::ComputeFields()
oX.Coord(x1,y1,z1);
oY.Coord(x2,y2,z2);
oZ.Coord(x3,y3,z3);
Standard_Real DS1 = DA->FirstAxisLength();
Standard_Real DS2 = DA->SecondAxisLength();
Standard_Real DS3 = DA->ThirdAxisLength();
Standard_Real DS1 = DA->AxisLength(Prs3d_DP_XAxis);
Standard_Real DS2 = DA->AxisLength(Prs3d_DP_YAxis);
Standard_Real DS3 = DA->AxisLength(Prs3d_DP_ZAxis);
// gp_Pnt aPt2,aPt3;
switch (myTypeOfPlane) {

View File

@@ -23,7 +23,6 @@
#include <AIS_PlaneTrihedron.hxx>
#include <AIS_Point.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <DsgPrs_DatumPrs.hxx>
#include <DsgPrs_XYZAxisPresentation.hxx>
#include <Geom_Axis1Placement.hxx>
#include <Geom_Axis2Placement.hxx>
@@ -70,10 +69,9 @@ AIS_PlaneTrihedron::AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane)
Standard_Real aLength = UnitsAPI::AnyToLS (100. ,"mm");
DA->SetAxisLength(aLength,aLength,aLength);
Quantity_NameOfColor col = Quantity_NOC_ROYALBLUE1;
DA->FirstAxisAspect()->SetColor(col);
DA->SecondAxisAspect()->SetColor(col);
DA->SetDrawFirstAndSecondAxis(Standard_True);
DA->SetDrawThirdAxis(Standard_False);
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col);
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col);
DA->SetDrawDatumAxes(Prs3d_DA_XYAxis);
myDrawer->SetDatumAspect(DA); // odl - specific is created because it is modified
myShapes[0] = Position();
myShapes[1] = XAxis();
@@ -146,7 +144,7 @@ void AIS_PlaneTrihedron::SetLength(const Standard_Real theLength) {
}
Standard_Real AIS_PlaneTrihedron::GetLength() const {
return myDrawer->DatumAspect()->FirstAxisLength();
return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
}
//=======================================================================
@@ -160,7 +158,7 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
aPresentation->SetDisplayPriority(5);
// drawing axis in X direction
gp_Pnt first, last;
Standard_Real value = myDrawer->DatumAspect()->FirstAxisLength();
Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
gp_Dir xDir = myPlane->Position().Ax2().XDirection();
gp_Pnt orig = myPlane->Position().Ax2().Location();
@@ -170,15 +168,15 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
first.SetCoord( xo, yo, zo );
last.SetCoord( xo + x * value, yo + y * value, zo + z * value );
DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->FirstAxisAspect(), myDrawer->ArrowAspect(), myDrawer->TextAspect(), xDir, value, myXLabel.ToCString(), first, last );
DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), xDir, value, myXLabel.ToCString(), first, last );
// drawing axis in Y direction
value = myDrawer->DatumAspect()->SecondAxisLength();
value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis);
gp_Dir yDir = myPlane->Position().Ax2().YDirection();
yDir.Coord( x, y, z );
last.SetCoord( xo + x * value, yo + y * value, zo + z * value );
DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->FirstAxisAspect(), myDrawer->ArrowAspect(), myDrawer->TextAspect(), yDir, value, myYLabel.ToCString(), first, last );
DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), yDir, value, myYLabel.ToCString(), first, last );
aPresentation->SetInfiniteState (Standard_True);
}
@@ -253,8 +251,8 @@ void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol)
{
hasOwnColor=Standard_True;
myDrawer->SetColor (aCol);
myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(aCol);
myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(aCol);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
}
@@ -275,12 +273,12 @@ void ExtremityPoints(TColgp_Array1OfPnt& PP,const Handle(Geom_Plane)& myPlane,c
gp_Ax2 theax(myPlane->Position().Ax2());
PP(1) = theax.Location();
Standard_Real len = myDrawer->DatumAspect()->FirstAxisLength();
Standard_Real len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
gp_Vec vec = theax.XDirection();
vec *= len;
PP(2) = PP(1).Translated(vec);
len = myDrawer->DatumAspect()->SecondAxisLength();
len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis);
vec = theax.YDirection();
vec *= len;
PP(3) = PP(1).Translated(vec);

View File

@@ -58,7 +58,7 @@ DEFINE_STANDARD_HANDLE(AIS_PlaneTrihedron, AIS_InteractiveObject)
//! these dimensions, you must temporarily recover the
//! Drawer object. From inside it, take the Aspects in
//! which the values for length are stocked, for example,
//! PlaneAspect for planes and FirstAxisAspect for
//! PlaneAspect for planes and LineAspect for
//! trihedra. Change these values and recalculate the presentation.
class AIS_PlaneTrihedron : public AIS_InteractiveObject
{

File diff suppressed because it is too large Load Diff

View File

@@ -17,185 +17,268 @@
#ifndef _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 <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <SelectMgr_Selection.hxx>
#include <AIS_KindOfInteractive.hxx>
#include <AIS_TrihedronSelectionMode.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 <SelectMgr_Selection.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Quantity_Color.hxx>
class Geom_Axis2Placement;
class AIS_InteractiveObject;
class AIS_Axis;
class AIS_Point;
class AIS_Plane;
class AIS_InteractiveContext;
class Prs3d_Presentation;
class Prs3d_Projector;
class Geom_Transformation;
class gp_Trsf;
class Quantity_Color;
class AIS_Trihedron;
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
//! Create a selectable trihedron
//! there are 4 modes of selection :
//! 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
//! a trihedron has 1 origin, 3 axes and 3 planes.
//! Warning
//! For the presentation of trihedra, the default unit of
//! length is the millimeter, and the default value for the
//! representation of axes is 10. To modify these
//! dimensions, you must temporarily recover the Drawer.
//! From inside it, you take the aspect in which the values
//! for length are stocked. For trihedra, this is FirstAxisLength from
//! Prs3d_DatumAspect(). Change the
//! 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.
//! The trihedron includes 1 origin, 3 axes and 3 labels.
//! Default text of labels are "X", "Y", "Z".
//! Color of origin and any axis, color of arrows and labels may be changed.
//! Visual presentation might be shown in two, shaded and wireframe modes, wireframe by default).
//! There are 4 modes of selection:
//! - AIS_TrihedronSelectionMode_EntireObject to select trihedron, priority = 1
//! - AIS_TrihedronSelectionMode_Origin to select its origin, priority = 5
//! - AIS_TrihedronSelectionMode_Axes to select its axis, priority = 3
//! - AIS_TrihedronSelectionMode_MainPlanes to select its planes, priority = 2
//!
//! Warning!
//! For the presentation of trihedron, the default unit of length is the millimetre,
//! and the default value for the representation of the axes is 100.
//! If you modify these dimensions, you must temporarily recover the Drawer.
//! From inside it, you take the aspect in which the values for length are stocked.
//! For trihedron, this is Prs3d_Drawer_LineAspect.
//! You change the values inside this Aspect and recalculate the presentation.
class AIS_Trihedron : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
public:
//! Initializes a trihedron entity.
Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent);
Standard_EXPORT AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent);
//! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively.
void SetDatumDisplayMode (Prs3d_DatumMode theMode) { myTrihDispMode = theMode; }
//! Returns datum display mode.
Prs3d_DatumMode DatumDisplayMode() const { return myTrihDispMode; }
//! Returns the right-handed coordinate system set in SetComponent.
const Handle(Geom_Axis2Placement)& Component() const;
const Handle(Geom_Axis2Placement)& Component() const { return myComponent; }
//! 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
//! than the default size of 10 mm. along each axis.
Standard_Boolean HasOwnSize() const;
//! than the default size of 100 mm. along each axis.
Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
//! Sets the size aValue for the trihedron object.
//! The default value is 10 mm.
Standard_EXPORT void SetSize (const Standard_Real aValue);
//! Removes any non-default settings for size of this
//! trihedron object.
//! The default value is 100 mm.
Standard_EXPORT void SetSize (const Standard_Real theValue);
//! Removes any non-default settings for size of this trihedron object.
//! If the object has 1 color, the default size of the
//! drawer is reproduced, otherwise DatumAspect becomes null.
Standard_EXPORT void UnsetSize();
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
//! valid for trihedron datums.
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 true if the display mode selected, aMode, is valid for trihedron datums.
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0;
}
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; }
//! Indicates that the type of Interactive Object is datum.
Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
//! Sets the color aColor for this trihedron object.
Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
Standard_EXPORT void SetTextColor (const Quantity_NameOfColor aColor);
Standard_EXPORT Standard_Boolean HasTextColor() const;
Standard_EXPORT Quantity_NameOfColor TextColor() const;
Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor aColor);
Standard_EXPORT Standard_Boolean HasArrowColor() const;
Standard_EXPORT Quantity_NameOfColor ArrowColor() const;
//! Returns the four extremities of the trihedron from the
//! array of points, TheExtrem.
Standard_EXPORT void ExtremityPoints (TColgp_Array1OfPnt& TheExtrem) const;
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
//! Sets the color theColor for this trihedron object, it changes color of axes.
void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE
{
return SetColor (Quantity_Color (theColor));
}
//! Sets the color theColor for this trihedron object, it changes color of axes.
Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
//! Sets color of label of trihedron axes.
Standard_EXPORT void SetTextColor (const Quantity_Color& theColor);
//! Returns true if trihedron has own text color
Standard_Boolean HasTextColor() const { return myHasOwnTextColor; }
//! Returns trihedron text color
Standard_EXPORT Quantity_Color TextColor() const;
//! 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_Boolean HasArrowColor() const { return myHasOwnArrowColor; }
//! Returns trihedron arrow color
Standard_EXPORT Quantity_Color ArrowColor() const;
//! Removes the settings for color.
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
//! Removes the non-default settings for width set in SetWidth.
Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Sets color of datum part: origin or some of trihedron axes.
//! If presentation is shading mode, this color is set for both sides of facing model
Standard_EXPORT void SetDatumPartColor (const Prs3d_DatumParts thePart,
const Quantity_Color& theColor);
//! Returns color of datum part: origin or some of trihedron axes.
Standard_EXPORT Quantity_Color DatumPartColor (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
void SetSelectionPriority (Prs3d_DatumParts thePart,
Standard_Integer thePriority)
{
mySelectionPriority.Bind (thePart, thePriority);
}
//! Sets priority of selection for owner of the given type
Standard_Integer SelectionPriority (Prs3d_DatumParts thePart)
{
return mySelectionPriority.Find (thePart);
}
//! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis
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
const TCollection_ExtendedString& Label (Prs3d_DatumParts thePart)
{
return myLabel.Find (thePart);
}
public:
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return false; }
//! 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(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
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:
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
Standard_EXPORT void LoadSubObjects();
//! This compute is unavailable for trihedron presentation.
void Compute (const Handle(Prs3d_Projector)& , const Handle(Prs3d_Presentation)& ) Standard_OVERRIDE {}
//! This compute is unavailable for trihedron presentation.
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
const Handle(Geom_Transformation)& theTrsf,
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE;
//! Compute selection.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
protected:
Handle(Geom_Axis2Placement) myComponent;
Handle(AIS_InteractiveObject) myShapes[7];
Standard_EXPORT void LoadRecomputable (const Standard_Integer theMode);
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) createSensitiveEntity (const Prs3d_DatumParts thePart,
const Handle(SelectBasics_EntityOwner)& theOwner) const;
//! Computes presentation for display mode equal 1.
Standard_EXPORT void computePresentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs);
//! Returns own datum aspect of trihedron, create this aspect if it was not created yet.
Standard_EXPORT void setOwnDatumAspect();
//! Returns primitives.
Standard_EXPORT Handle(Graphic3d_ArrayOfPrimitives) arrayOfPrimitives(
Prs3d_DatumParts thePart) const;
//! Updates graphic groups for the current datum mode
//! Parameters of datum position and orientation
Standard_EXPORT void updatePrimitives (const Handle(Prs3d_DatumAspect)& theAspect,
Prs3d_DatumMode theMode,
const gp_Pnt& theOrigin,
const gp_Dir& theXDir,
const gp_Dir& theYDir,
const gp_Dir& theZDir);
//! Returns highlight line aspect , create if it is the first call
Handle(Prs3d_ShadingAspect) getHighlightAspect();
//! Returns highlight line aspect , create if it is the first call
Handle(Prs3d_LineAspect) getHighlightLineAspect();
//! Returns highlight line aspect , create if it is the first call
Handle(Prs3d_PointAspect) getHighlightPointAspect();
protected:
Standard_Boolean myHasOwnSize;
Standard_Boolean myHasOwnTextColor;
Quantity_NameOfColor myOwnTextColor;
Standard_Boolean myHasOwnArrowColor;
Quantity_NameOfColor myOwnArrowColor;
Standard_Boolean myHasOwnDatumAspect;
Prs3d_DatumMode myTrihDispMode;
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_ShadingAspect) myHighlightAspect;
Handle(Prs3d_LineAspect) myHighlightLineAspect;
Handle(Prs3d_PointAspect) myHighlightPointAspect;
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_ArrayOfPrimitives)> myPrimitives;
};
#include <AIS_Trihedron.lxx>
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
#endif // _AIS_Trihedron_HeaderFile

View File

@@ -0,0 +1,71 @@
// 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)
// =======================================================================
// function : AIS_TrihedronOwner
// purpose :
// =======================================================================
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(Prs3d_Drawer)& 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)
{
(void )theMode;
if (!HasSelectable())
{
return;
}
thePM->Unhighlight (Selectable());
}

View File

@@ -0,0 +1,57 @@
// 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);
//! Returns the datum part identifier.
Prs3d_DatumParts DatumPart() const { return myDatumPart; }
//! Highlights selectable object's presentation.
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) Standard_OVERRIDE;
//! 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

View File

@@ -1,7 +1,4 @@
// Created on: 1997-03-06
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -14,8 +11,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline const Handle(Geom_Axis2Placement)& AIS_Trihedron::Component() const
{return myComponent;}
#ifndef _AIS_TrihedronSelectionMode_HeaderFile
#define _AIS_TrihedronSelectionMode_HeaderFile
inline Standard_Boolean AIS_Trihedron::HasOwnSize() const
{return myHasOwnSize;}
//! Enumeration defining selection modes supported by AIS_Trihedron.
enum AIS_TrihedronSelectionMode
{
AIS_TrihedronSelectionMode_EntireObject = 0, //!< select trihedron as whole
AIS_TrihedronSelectionMode_Origin = 1, //!< origin
AIS_TrihedronSelectionMode_Axes = 2, //!< axes
AIS_TrihedronSelectionMode_MainPlanes = 3 //!< main planes
};
#endif // _AIS_TrihedronSelectionMode_HeaderFile

View File

@@ -176,7 +176,9 @@ AIS_Triangulation.cxx
AIS_Triangulation.hxx
AIS_Trihedron.cxx
AIS_Trihedron.hxx
AIS_Trihedron.lxx
AIS_TrihedronOwner.cxx
AIS_TrihedronOwner.hxx
AIS_TrihedronSelectionMode.hxx
AIS_TypeFilter.cxx
AIS_TypeFilter.hxx
AIS_TypeOfAngle.hxx