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
Syntax:
~~~~~
-vtrihedron name [X0] [Y0] [Z0] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw]
+vtrihedron name [-dispMode {wf|sh|wireframe|shading}]
+ [-origin x y z ]
+ [-zaxis u v w -xaxis u v w ]
+ [-drawaxes {X|Y|Z|XY|YZ|XZ|XYZ}]
+ [-hidelabels {on|off}]"
+ [-label {XAxis|YAxis|ZAxis} value]"
+ [-attribute {XAxisLength|YAxisLength|ZAxisLength
+ |TubeRadiusPercent|ConeRadiusPercent"
+ |ConeLengthPercent|OriginRadiusPercent"
+ |ShadingNumberOfFacettes} value]"
+ [-color {Origin|XAxis|YAxis|ZAxis|XOYAxis|YOZAxis"
+ |XOZAxis|Whole} {r g b | colorName}]"
+ [-textcolor {r g b | colorName}]"
+ [-arrowscolor {r g b | colorName}]"
+ [-priority {Origin|XAxis|YAxis|ZAxis|XArrow"
+ |YArrow|ZArrow|XOYAxis|YOZAxis"
+ |XOZAxis|Whole} value]
+
~~~~~
-Creates a new *AIS_Trihedron* object. If no argument is set, the default trihedron (0XYZ) is created.
-
+Creates a new *AIS_Trihedron* object or changes existing trihedron. If no argument is set, the default trihedron (0XYZ) is created.
+
**Example:**
~~~~~
vinit
-vtrihedron tr
+vtrihedron tr1
+
+vtrihedron t2 -dispmode shading -origin -200 -200 -300
+vtrihedron t2 -color XAxis Quantity_NOC_RED
+vtrihedron t2 -color YAxis Quantity_NOC_GREEN
+vtrihedron t2 -color ZAxis|Origin Quantity_NOC_BLUE1
~~~~~
@subsubsection occt_draw_4_4_2 vplanetri
}
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();
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);
}
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);
}
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;
}
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
{
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.);
}
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;
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;
//=======================================================================
Standard_Real AIS_InteractiveContext::TrihedronSize() const
{
- return myDefaultDrawer->DatumAspect()->FirstAxisLength();
+ return myDefaultDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
}
//=======================================================================
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;
}
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);
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);
}
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) {
#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>
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();
}
Standard_Real AIS_PlaneTrihedron::GetLength() const {
- return myDrawer->DatumAspect()->FirstAxisLength();
+ return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
}
//=======================================================================
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();
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);
}
{
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);
}
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);
//! 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
{
#include <AIS_Trihedron.hxx>
-#include <AIS_Axis.hxx>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Plane.hxx>
-#include <AIS_Point.hxx>
-#include <Aspect_TypeOfLine.hxx>
-#include <DsgPrs_DatumPrs.hxx>
+#include <AIS_TrihedronOwner.hxx>
#include <Geom_Axis2Placement.hxx>
-#include <Geom_CartesianPoint.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_Point.hxx>
#include <Geom_Transformation.hxx>
-#include <gp_Ax1.hxx>
-#include <gp_Ax2.hxx>
-#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
-#include <gp_Trsf.hxx>
-#include <gp_Vec.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Graphic3d_ArrayOfPoints.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Graphic3d_Structure.hxx>
+#include <Graphic3d_ArrayOfPoints.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
+
+#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
-#include <Quantity_Color.hxx>
-#include <Select3D_SensitiveBox.hxx>
+#include <Prs3d_ToolSphere.hxx>
+
#include <Select3D_SensitivePoint.hxx>
+#include <Select3D_SensitivePrimitiveArray.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveTriangle.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard_Type.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <UnitsAPI.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(AIS_Trihedron,AIS_InteractiveObject)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
//=======================================================================
//function : AIS_Trihedron
-//purpose :
+//purpose :
//=======================================================================
-AIS_Trihedron::AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent):
-myComponent (aComponent),
-myHasOwnSize (Standard_False),
-myHasOwnTextColor (Standard_False),
-myHasOwnArrowColor (Standard_False)
+AIS_Trihedron::AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent)
+: myHasOwnSize (Standard_False),
+ myHasOwnTextColor (Standard_False),
+ myHasOwnArrowColor (Standard_False),
+ myTrihDispMode (Prs3d_DM_WireFrame),
+ myComponent (theComponent)
{
- LoadSubObjects();
+ // selection priorities
+ mySelectionPriority.Bind (Prs3d_DP_None, 5); // complete triedron: priority 5 (same as faces)
+ mySelectionPriority.Bind (Prs3d_DP_Origin, 8); // origin: priority 8
+ for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter)
+ {
+ mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 7); // axes: priority: 7
+ }
+ for (int aPartIter = Prs3d_DP_XOYAxis; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
+ {
+ mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 5); // planes: priority: 5
+ }
+
+ // trihedron labels
+ myLabel.Bind (Prs3d_DP_XAxis, "X");
+ myLabel.Bind (Prs3d_DP_YAxis, "Y");
+ myLabel.Bind (Prs3d_DP_ZAxis, "Z");
}
//=======================================================================
//function : SetComponent
-//purpose :
+//purpose :
//=======================================================================
-
-void AIS_Trihedron::SetComponent(const Handle(Geom_Axis2Placement)& aComponent)
+void AIS_Trihedron::SetComponent (const Handle(Geom_Axis2Placement)& theComponent)
{
- myComponent = aComponent;
-
- // Remove from current context and nullify objects to update
- Handle(AIS_InteractiveContext) anAISContext = GetContext();
- Standard_Boolean hasContext = (anAISContext.IsNull() == Standard_False);
- Standard_Integer anIdx;
- for (anIdx = 0; anIdx < 7; anIdx++)
- {
- // Deselect object
- if (hasContext)
- {
- if (anAISContext->IsSelected (myShapes[anIdx]))
- anAISContext->AddOrRemoveSelected (myShapes[anIdx], Standard_False);
-
- anAISContext->Remove (myShapes[anIdx], Standard_False);
- }
- myShapes[anIdx].Nullify();
- }
-
- LoadSubObjects();
+ myComponent = theComponent;
+ LoadRecomputable (AIS_WireFrame);
}
//=======================================================================
-//function : setLocalTransformation
+//function : setOwnDatumAspect
//purpose :
//=======================================================================
-
-void AIS_Trihedron::setLocalTransformation (const Handle(Geom_Transformation)& theTrsf)
+void AIS_Trihedron::setOwnDatumAspect()
{
- // Update location to the subshapes
- Standard_Integer anIdx;
- for (anIdx = 0; anIdx < 7; anIdx++)
- myShapes[anIdx]->SetLocalTransformation (theTrsf);
+ if (myDrawer->HasOwnDatumAspect())
+ return;
+
+ Handle(Prs3d_DatumAspect) aNewAspect = new Prs3d_DatumAspect();
+ myDrawer->SetDatumAspect(aNewAspect);
+
+ if (myDrawer->Link().IsNull())
+ return;
+
+ *myDrawer->DatumAspect()->TextAspect()->Aspect() =
+ *myDrawer->Link()->DatumAspect()->TextAspect()->Aspect();
+ *myDrawer->DatumAspect()->PointAspect()->Aspect() =
+ *myDrawer->Link()->DatumAspect()->PointAspect()->Aspect();
+ *myDrawer->DatumAspect()->ArrowAspect()->Aspect() =
+ *myDrawer->Link()->DatumAspect()->ArrowAspect()->Aspect();
- AIS_InteractiveObject::setLocalTransformation (theTrsf);
+ for (int aPartIter = Prs3d_DP_Origin; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
+ if (!aNewAspect->LineAspect(aPart).IsNull())
+ *myDrawer->DatumAspect()->LineAspect(aPart)->Aspect() =
+ *myDrawer->Link()->DatumAspect()->LineAspect(aPart)->Aspect();
+ if (!aNewAspect->ShadingAspect(aPart).IsNull())
+ *myDrawer->DatumAspect()->ShadingAspect(aPart)->Aspect() =
+ *myDrawer->Link()->DatumAspect()->ShadingAspect(aPart)->Aspect();
+ }
}
//=======================================================================
//function : SetSize
-//purpose :
+//purpose :
//=======================================================================
void AIS_Trihedron::SetSize(const Standard_Real aValue)
{
myHasOwnSize = Standard_True;
- if(!myDrawer->HasOwnDatumAspect()){
- Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
- myDrawer->SetDatumAspect(DA);
- }
-
- myDrawer->DatumAspect()->SetAxisLength(aValue,aValue,aValue);
-
- for(Standard_Integer i=4;i<=6;i++)
- Handle(AIS_Plane)::DownCast (myShapes[i])->SetSize(aValue);
+
+ setOwnDatumAspect();
+ myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
Update();
UpdateSelection();
}
-
-
//=======================================================================
//function : UnsetSize
-//purpose : if the object has 1 color, the default size of the
-// drawer is reproduced, otherwise DatumAspect becomes null
+//purpose :
//=======================================================================
-
void AIS_Trihedron::UnsetSize()
{
- if(!myHasOwnSize) return;
-
+ if (!myHasOwnSize)
+ {
+ return;
+ }
+
myHasOwnSize = Standard_False;
- if(hasOwnColor){
- const Handle(Prs3d_DatumAspect) DA =
- myDrawer->HasLink() ? myDrawer->Link()->DatumAspect() : new Prs3d_DatumAspect();
- myDrawer->DatumAspect()->SetAxisLength(DA->FirstAxisLength(),
- DA->SecondAxisLength(),
- DA->ThirdAxisLength());
+ if (hasOwnColor)
+ {
+ const Handle(Prs3d_DatumAspect) DA = myDrawer->HasLink()
+ ? myDrawer->Link()->DatumAspect()
+ : new Prs3d_DatumAspect();
+ myDrawer->DatumAspect()->SetAxisLength (DA->AxisLength (Prs3d_DP_XAxis),
+ DA->AxisLength (Prs3d_DP_YAxis),
+ DA->AxisLength (Prs3d_DP_ZAxis));
}
else
{
- myDrawer->SetDatumAspect (Handle(Prs3d_DatumAspect)());
+ Update();
}
- Update();
UpdateSelection();
-
}
//=======================================================================
//function : Size
-//purpose :
+//purpose :
//=======================================================================
-
Standard_Real AIS_Trihedron::Size() const
{
- return myDrawer->DatumAspect()->FirstAxisLength();
+ return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
}
//=======================================================================
-//function : XAxis
-//purpose :
+//function : Compute
+//purpose :
//=======================================================================
-Handle(AIS_Axis) AIS_Trihedron::XAxis() const
+void AIS_Trihedron::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
+ const Handle(Prs3d_Presentation)& thePrs,
+ const Standard_Integer theMode)
{
- Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[1]);
- if (anAxis.IsNull())
+ if (theMode != 0)
{
- anAxis = new AIS_Axis (myComponent,AIS_TOAX_XAxis);
+ return;
}
- return anAxis;
+
+ thePrs->SetInfiniteState (Standard_True);
+
+ gp_Ax2 anAxis (myComponent->Ax2());
+ updatePrimitives (myDrawer->DatumAspect(), myTrihDispMode, anAxis.Location(),
+ anAxis.XDirection(), anAxis.YDirection(), anAxis.Direction());
+ computePresentation (thePrsMgr, thePrs);
}
//=======================================================================
-//function : YAxis
-//purpose :
+//function : Compute
+//purpose :
//=======================================================================
-Handle(AIS_Axis) AIS_Trihedron::YAxis() const
+void AIS_Trihedron::Compute (const Handle(Prs3d_Projector)& theProjector,
+ const Handle(Geom_Transformation)& theTrsf,
+ const Handle(Prs3d_Presentation)& thePrs)
{
- Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[2]);
- if (anAxis.IsNull())
- {
- anAxis = new AIS_Axis (myComponent,AIS_TOAX_YAxis);
- }
-
- return anAxis;
+ PrsMgr_PresentableObject::Compute (theProjector, theTrsf, thePrs);
}
//=======================================================================
-//function : Axis
-//purpose :
+//function : ComputeSelection
+//purpose :
//=======================================================================
-Handle(AIS_Axis) AIS_Trihedron::Axis() const
+void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Integer theMode)
{
- Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[3]);
- if (anAxis.IsNull())
+ Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
+ switch (theMode)
{
- anAxis = new AIS_Axis (myComponent,AIS_TOAX_ZAxis);
+ case AIS_TrihedronSelectionMode_EntireObject:
+ {
+ Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (
+ this, mySelectionPriority.Find (Prs3d_DP_None));
+ const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
+ for (int aPartIter = isShadingMode ? Prs3d_DP_Origin : Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis;
+ ++aPartIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
+ if (!anAspect->DrawDatumPart (aPart))
+ {
+ continue;
+ }
+ theSelection->Add (createSensitiveEntity (aPart, anOwner));
+ }
+ break;
+ }
+ case AIS_TrihedronSelectionMode_Origin:
+ {
+ const Prs3d_DatumParts aPart = Prs3d_DP_Origin;
+ if (anAspect->DrawDatumPart (aPart))
+ {
+ Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart,
+ mySelectionPriority.Find (aPart));
+ Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = arrayOfPrimitives(aPart);
+ theSelection->Add (createSensitiveEntity (aPart, anOwner));
+ }
+ break;
+ }
+ case AIS_TrihedronSelectionMode_Axes:
+ {
+ for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
+ if (!anAspect->DrawDatumPart (aPart))
+ {
+ continue;
+ }
+ Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart,
+ mySelectionPriority.Find (aPart));
+ theSelection->Add (createSensitiveEntity (aPart, anOwner));
+ }
+ break;
+ }
+ case AIS_TrihedronSelectionMode_MainPlanes:
+ {
+ // create owner for each trihedron plane
+ {
+ for (int aPartIter = Prs3d_DP_XOYAxis; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
+ if (!anAspect->DrawDatumPart (aPart))
+ {
+ continue;
+ }
+ Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart,
+ mySelectionPriority.Find (aPart));
+ theSelection->Add (createSensitiveEntity (aPart, anOwner));
+ }
+ }
+ break;
+ }
}
- return anAxis;
}
//=======================================================================
-//function : Position
-//purpose :
+//function : HilightOwnerWithColor
+//purpose :
//=======================================================================
-Handle(AIS_Point) AIS_Trihedron::Position() const
+void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Handle(Prs3d_Drawer)& theStyle,
+ const Handle(SelectMgr_EntityOwner)& theOwner)
{
- Handle(AIS_Point) aPt = Handle(AIS_Point)::DownCast(myShapes[0]);
- if (aPt.IsNull()) {
- gp_Pnt aPnt = myComponent->Ax2().Location();
- Handle(Geom_Point) aPoint = new Geom_CartesianPoint(aPnt);
- aPt = new AIS_Point (aPoint);
+ Handle(AIS_TrihedronOwner) anOwner = Handle(AIS_TrihedronOwner)::DownCast (theOwner);
+ if (anOwner.IsNull())
+ {
+ /// default 0 selection mode
+ Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0;
+ thePM->Color (this, theStyle, aHiMode, NULL, Graphic3d_ZLayerId_Top);
+ return;
}
- return aPt;
-}
-//=======================================================================
-//function : XYPlane
-//purpose :
-//=======================================================================
-Handle(AIS_Plane) AIS_Trihedron::XYPlane() const
-{
- Handle(AIS_Plane) aPl = Handle(AIS_Plane)::DownCast(myShapes[4]);
- if (aPl.IsNull()) aPl = new AIS_Plane (myComponent,AIS_TOPL_XYPlane);
- return aPl;
-}
+ Handle(Prs3d_Presentation) aPresentation = GetHilightPresentation (thePM);
+ if (aPresentation.IsNull())
+ {
+ return;
+ }
-//=======================================================================
-//function : XZPlane
-//purpose :
-//=======================================================================
-Handle(AIS_Plane) AIS_Trihedron::XZPlane() const
-{
- Handle(AIS_Plane) aPl = Handle(AIS_Plane)::DownCast(myShapes[5]);
- if (aPl.IsNull()) aPl = new AIS_Plane (myComponent,AIS_TOPL_XZPlane);
- return aPl;
-}
+ aPresentation->Clear();
+ const Prs3d_DatumParts aPart = anOwner->DatumPart();
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPresentation);
+ Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
+ if (aPart >= Prs3d_DP_XOYAxis && aPart <= Prs3d_DP_XOZAxis)
+ {
+ // planes selection is equal in both shading and wireframe mode
+ aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
+ }
+ else
+ {
+ if (myTrihDispMode == Prs3d_DM_Shaded)
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect(aPart)->Aspect());
+ }
+ else
+ {
+ if (aPart == Prs3d_DP_Origin)
+ {
+ aGroup->SetGroupPrimitivesAspect (getHighlightPointAspect()->Aspect());
+ }
+ else
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect(aPart)->Aspect());
+ }
+ }
+ }
+ aGroup->AddPrimitiveArray (arrayOfPrimitives(aPart));
-//=======================================================================
-//function : YZPlane
-//purpose :
-//=======================================================================
-Handle(AIS_Plane) AIS_Trihedron::YZPlane() const
-{
- Handle(AIS_Plane) aPl = Handle(AIS_Plane)::DownCast(myShapes[6]);
- if (aPl.IsNull()) aPl = new AIS_Plane (myComponent,AIS_TOPL_YZPlane);
- return aPl;
+ aPresentation->Highlight (theStyle);
+ thePM->AddToImmediateList (aPresentation);
}
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-void AIS_Trihedron::Compute(
- const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
- const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode)
+//========================================================================
+//function : HilightSelected
+//purpose :
+//========================================================================
+void AIS_Trihedron::HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const SelectMgr_SequenceOfOwner& theOwners)
{
- aPresentation->SetInfiniteState (Standard_True);
- switch(aMode){
- case 0:
- DsgPrs_DatumPrs::Add(aPresentation,myComponent->Ax2(),myDrawer);
- break;
- case 1:
- break;
- case 2:
- break;
+ if (theOwners.IsEmpty() || !HasInteractiveContext())
+ {
+ return;
+ }
+
+ Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
+ const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
+
+ const Handle(Prs3d_Drawer)& aContextSelStyle = GetContext()->SelectionStyle();
+ const Quantity_Color& aSelectionColor = aContextSelStyle->Color();
+ for (SelectMgr_SequenceOfOwner::Iterator anIterator (theOwners); anIterator.More(); anIterator.Next())
+ {
+ const Handle(SelectMgr_EntityOwner)& anOwner = anIterator.Value();
+ Handle(AIS_TrihedronOwner) aTrihedronOwner = Handle(AIS_TrihedronOwner)::DownCast(anOwner);
+ if (aTrihedronOwner.IsNull())
+ {
+ thePM->Color (this, aContextSelStyle, 0);
+ continue;
+ }
+
+ const Prs3d_DatumParts aPart = aTrihedronOwner->DatumPart();
+ Handle(Graphic3d_Group) aGroup;
+ if (mySelectedParts.Contains (aPart)
+ || !myPartToGroup.Find (aPart, aGroup))
+ {
+ continue;
+ }
+
+ if (aPart >= Prs3d_DP_XOYAxis
+ && aPart <= Prs3d_DP_XOZAxis)
+ {
+ getHighlightLineAspect()->SetColor (aSelectionColor);
+ aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
+ }
+ else
+ {
+ if (isShadingMode)
+ {
+ getHighlightAspect()->SetColor (aSelectionColor);
+ aGroup->SetGroupPrimitivesAspect (getHighlightAspect()->Aspect());
+ }
+ else
+ {
+ if (aPart == Prs3d_DP_Origin)
+ {
+ getHighlightPointAspect()->SetColor (aSelectionColor);
+ aGroup->SetGroupPrimitivesAspect (getHighlightPointAspect()->Aspect());
+ }
+ else
+ {
+ getHighlightLineAspect()->SetColor (aSelectionColor);
+ aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
+ }
+ }
+ }
+ mySelectedParts.Append (aPart);
}
}
//=======================================================================
-//function : Compute
-//purpose :
+//function : ClearSelected
+//purpose :
//=======================================================================
-
-void AIS_Trihedron::Compute(const Handle(Prs3d_Projector)& aProjector,
- const Handle(Geom_Transformation)& aTransformation,
- const Handle(Prs3d_Presentation)& aPresentation)
+void AIS_Trihedron::ClearSelected()
{
-// throw Standard_NotImplemented("AIS_Trihedron::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
- PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
+ Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
+ const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
+ for (NCollection_List<Prs3d_DatumParts>::Iterator anIterator (mySelectedParts); anIterator.More();
+ anIterator.Next())
+ {
+ const Prs3d_DatumParts aPart = anIterator.Value();
+ Handle(Graphic3d_Group) aGroup = myPartToGroup.Find (aPart);
+ if (aPart >= Prs3d_DP_XOYAxis
+ && aPart <= Prs3d_DP_XOZAxis)
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect (aPart)->Aspect());
+ }
+ if (isShadingMode)
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
+ }
+ else
+ {
+ if (aPart == Prs3d_DP_Origin)
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect());
+ }
+ else
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect (aPart)->Aspect());
+ }
+ }
+ }
+ mySelectedParts.Clear();
}
//=======================================================================
-//function : ComputeSelection
-//purpose :
+//function : computePresentation
+//purpose :
//=======================================================================
-
-void AIS_Trihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode)
+void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager3d)& /*thePrsMgr*/,
+ const Handle(Prs3d_Presentation)& thePrs)
{
- // retrieve the tops of the trihedron.
- Standard_Integer Prior, anIdx;
- Handle(SelectMgr_EntityOwner) eown;
- TColgp_Array1OfPnt PP(1,4),PO(1,4);
- ExtremityPoints(PP);
+ myPartToGroup.Clear();
+ Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
+ const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
+ // display origin
+ {
+ // Origin is visualized only in shading mode
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
+ const Prs3d_DatumParts aPart = Prs3d_DP_Origin;
+ if (anAspect->DrawDatumPart(aPart))
+ {
+ myPartToGroup.Bind (aPart, aGroup);
+ if (isShadingMode)
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
+ }
+ else
+ {
+ aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect());
+ }
+ aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
+ }
+ }
- // remove shapes from active selections
- Handle(AIS_InteractiveContext) anAISContext = GetContext();
- if (!anAISContext.IsNull())
- for (anIdx = 0; anIdx < 7; anIdx++)
+ // display axes
+ {
+ for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
{
- // Deselect object
- if (anAISContext->IsSelected (myShapes[anIdx]))
- anAISContext->AddOrRemoveSelected (myShapes[anIdx], Standard_False);
+ Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter;
+ if (!anAspect->DrawDatumPart (aPart))
+ {
+ continue;
+ }
- anAISContext->Remove (myShapes[anIdx], Standard_False);
- }
-
- switch (aMode) {
- case 0:
- { // complete triedron only 1 owner : this... priority 5 (same as faces)
- Prior = 5;
- eown = new SelectMgr_EntityOwner(this,Prior);
- for (Standard_Integer i=1; i<=3;i++)
- aSelection->Add(new Select3D_SensitiveSegment(eown,PP(1),PP(i+1)));
- break;
- }
- case 1:
- { //origin :
- Prior = 8;
- const Handle(SelectMgr_SelectableObject)& anObj = myShapes[0]; // to avoid ambiguity
- eown= new SelectMgr_EntityOwner(anObj,Prior);
-
- aSelection->Add(new Select3D_SensitivePoint (eown,myComponent->Location()));
- // If the trihedron's shapes display and selection modes are the same
- // the shapes are still displayed after selection, so we need to
- // use different presentation and hide it by nullifying
- if (!anAISContext.IsNull())
+ Handle(Graphic3d_Group) anAxisGroup = Prs3d_Root::NewGroup (thePrs);
+ myPartToGroup.Bind (aPart, anAxisGroup);
+ if (isShadingMode)
{
- anAISContext->Display (myShapes[0], 1, 0, Standard_False);
- anAISContext->ClearPrs (myShapes[0], 1, Standard_False);
+ anAxisGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
}
-
- break;
+ else
+ {
+ anAxisGroup->SetGroupPrimitivesAspect (anAspect->LineAspect (aPart)->Aspect());
+ }
+ anAxisGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
+
+ // draw arrow
+ Handle(Graphic3d_Group) anArrowGroup = Prs3d_Root::NewGroup (thePrs);
+ anArrowGroup->SetPrimitivesAspect (anAspect->ArrowAspect()->Aspect());
+
+ Prs3d_DatumParts anArrowPart = anAspect->ArrowPartForAxis (aPart);
+ if (!anAspect->DrawDatumPart (anArrowPart))
+ {
+ continue;
+ }
+ anArrowGroup->AddPrimitiveArray (arrayOfPrimitives (anArrowPart));
}
- case 2:
- { //axes ... priority 7
- Prior = 7;
- for (Standard_Integer i=1; i<=3;i++){
- const Handle(SelectMgr_SelectableObject)& anObj = myShapes[i]; // to avoid ambiguity
- eown= new SelectMgr_EntityOwner(anObj,Prior);
- aSelection->Add(new Select3D_SensitiveSegment(eown,PP(1),PP(i+1)));
+ }
+ // display labels
+ if (anAspect->ToDrawLabels())
+ {
+ Handle(Geom_Axis2Placement) aComponent = myComponent;
+ const gp_Pnt anOrigin = aComponent->Location();
+ for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter;
+ if (!anAspect->DrawDatumPart (aPart))
+ {
+ continue;
}
- // If the trihedron's shapes display and selection modes are the same
- // the shapes are still displayed after selection, so we need to
- // use different presentation and hide it by nullifying
- AIS_TypeOfAxis anAxisType;
- if (!anAISContext.IsNull())
- for (anIdx = 1; anIdx <= 3; anIdx++)
- {
- // update AIS_Axis for selection
- Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[anIdx]);
- Handle(Prs3d_Drawer) aDrawer = anAxis->Attributes();
- Handle(Prs3d_DatumAspect) aDatum = myDrawer->DatumAspect();
- aDrawer->SetDatumAspect (aDatum);
- anAxisType = anAxis->TypeOfAxis();
- anAxis->SetAxis2Placement (myComponent, anAxisType);
-
- // display
- anAISContext->Display (myShapes[anIdx], 1, 0, Standard_False);
- anAISContext->ClearPrs (myShapes[anIdx], 1, Standard_False);
- }
-
- break;
+ const Standard_Real anAxisLength = anAspect->AxisLength (aPart);
+ const TCollection_ExtendedString& aLabel = myLabel.Find (aPart);
+ gp_Dir aDir;
+ switch (aPart)
+ {
+ case Prs3d_DP_XAxis: aDir = aComponent->XDirection(); break;
+ case Prs3d_DP_YAxis: aDir = aComponent->YDirection(); break;
+ case Prs3d_DP_ZAxis: aDir = aComponent->Direction(); break;
+ default: break;
+ }
+ Handle(Graphic3d_Group) aLabelGroup = Prs3d_Root::NewGroup (thePrs);
+ const gp_Pnt aPoint = anOrigin.XYZ() + aDir.XYZ() * anAxisLength;
+ Prs3d_Text::Draw (aLabelGroup, anAspect->TextAspect(), aLabel, aPoint);
}
-
- case 3:
- { // main planes priority 6
-// PO(1) = PP(1);
-// PO(4) = PP(1);
- Prior =5;
-
-
- const Handle(SelectMgr_SelectableObject)& anObj4 = myShapes[4]; // to avoid ambiguity
- eown= new SelectMgr_EntityOwner(anObj4,Prior);
-// PO(2) = PP(2);PO(3) = PP(3);
- aSelection->Add(new Select3D_SensitiveTriangle(eown,PP(1),PP(2),PP(3)));
-
- const Handle(SelectMgr_SelectableObject)& anObj5 = myShapes[5]; // to avoid ambiguity
- eown= new SelectMgr_EntityOwner(anObj5,Prior);
-// PO(2) = PP(3);PO(3) = PP(4);
- aSelection->Add(new Select3D_SensitiveTriangle(eown,PP(1),PP(2),PP(4)));
-
- const Handle(SelectMgr_SelectableObject)& anObj6 = myShapes[6]; // to avoid ambiguity
- eown= new SelectMgr_EntityOwner(anObj6,Prior);
-// PO(2) = PP(4);PO(3) = PP(2);
- aSelection->Add(new Select3D_SensitiveTriangle(eown,PP(1),PP(3),PP(4)));
-
- // If the trihedron's shapes display and selection modes are the same
- // the shapes are still displayed after selection, so we need to
- // use different presentation and hide it by nullifying
- if (!anAISContext.IsNull())
- for (anIdx = 4; anIdx < 7; anIdx++)
- {
- anAISContext->Display (myShapes[anIdx], 1, 0, Standard_False);
- anAISContext->ClearPrs (myShapes[anIdx], 1, Standard_False);
- }
+ }
+
+ // planes invisible group for planes selection
+ for (Standard_Integer anAxisIter = Prs3d_DP_XOYAxis; anAxisIter <= Prs3d_DP_XOZAxis; ++anAxisIter)
+ {
+ Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
+ if (!anAspect->DrawDatumPart(aPart))
+ {
+ continue;
}
+
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
+ myPartToGroup.Bind (aPart, aGroup);
+
+ const Handle(Graphic3d_AspectLine3d)& aLineAspect = anAspect->LineAspect (aPart)->Aspect();
+ aLineAspect->SetType (Aspect_TOL_EMPTY);
+
+ aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
+ aGroup->SetGroupPrimitivesAspect (aLineAspect);
}
-
}
//=======================================================================
-//function : SetColor
-//purpose :
+//function : LoadRecomputable
+//purpose :
//=======================================================================
-
-void AIS_Trihedron::SetColor(const Quantity_NameOfColor aCol)
+void AIS_Trihedron::LoadRecomputable (const Standard_Integer theMode)
{
- SetColor(Quantity_Color(aCol));
+ myRecomputeEveryPrs = Standard_False;
+ if (!myToRecomputeModes.Contains (theMode))
+ {
+ myToRecomputeModes.Append (theMode);
+ }
}
-void AIS_Trihedron::SetColor(const Quantity_Color &aCol)
+//=======================================================================
+//function : SetColor
+//purpose :
+//=======================================================================
+void AIS_Trihedron::SetDatumPartColor (const Prs3d_DatumParts thePart,
+ const Quantity_Color& theColor)
{
- hasOwnColor=Standard_True;
- myDrawer->SetColor (aCol);
-
- if(!myDrawer->HasOwnDatumAspect()){
- Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
-
- DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(),
- myDrawer->DatumAspect()->SecondAxisLength(),
- myDrawer->DatumAspect()->ThirdAxisLength());
- myDrawer->SetDatumAspect(DA);
- }
- myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(aCol);
- myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(aCol);
- myDrawer->DatumAspect()->ThirdAxisAspect()->SetColor(aCol);
+ setOwnDatumAspect();
+ myDrawer->DatumAspect()->ShadingAspect (thePart)->SetColor (theColor);
+ if (thePart != Prs3d_DP_Origin)
+ {
+ myDrawer->DatumAspect()->LineAspect (thePart)->SetColor (theColor);
+ }
}
//=======================================================================
//function : SetTextColor
-//purpose :
+//purpose :
//=======================================================================
-
-void AIS_Trihedron::SetTextColor(const Quantity_NameOfColor aCol)
+void AIS_Trihedron::SetTextColor (const Quantity_Color& theColor)
{
- myHasOwnTextColor = Standard_True;
- myOwnTextColor = aCol;
-
- if(!myDrawer->HasOwnDatumAspect()){
- Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
-
- DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(),
- myDrawer->DatumAspect()->SecondAxisLength(),
- myDrawer->DatumAspect()->ThirdAxisLength());
- myDrawer->SetDatumAspect(DA);
- }
- Handle(Prs3d_TextAspect) aspect = myDrawer->TextAspect();
- aspect->SetColor(aCol);
- myDrawer->SetTextAspect(aspect);
+ setOwnDatumAspect();
+ myDrawer->DatumAspect()->TextAspect()->SetColor (theColor);
}
-void AIS_Trihedron::SetArrowColor(const Quantity_NameOfColor aCol)
+//=======================================================================
+//function : Color
+//purpose :
+//=======================================================================
+Quantity_Color AIS_Trihedron::DatumPartColor (Prs3d_DatumParts thePart)
{
- myHasOwnArrowColor = Standard_True;
- myOwnArrowColor = aCol;
-
- if(!myDrawer->HasOwnDatumAspect()){
- Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
-
- DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(),
- myDrawer->DatumAspect()->SecondAxisLength(),
- myDrawer->DatumAspect()->ThirdAxisLength());
- myDrawer->SetDatumAspect(DA);
+ if (myTrihDispMode == Prs3d_DM_Shaded)
+ {
+ return myDrawer->DatumAspect()->ShadingAspect (thePart)->Color();
+ }
+ else
+ {
+ return myDrawer->DatumAspect()->LineAspect (thePart)->Aspect()->Color();
}
- Handle(Prs3d_ArrowAspect) aspect = myDrawer->ArrowAspect();
- aspect->SetColor(aCol);
- myDrawer->SetArrowAspect(aspect);
}
//=======================================================================
-Standard_Boolean AIS_Trihedron::HasTextColor() const {
-
- return myHasOwnTextColor;
-}
-
+//function : SetOriginColor
+//purpose :
//=======================================================================
-Quantity_NameOfColor AIS_Trihedron::TextColor() const {
-
- return myOwnTextColor;
+void AIS_Trihedron::SetOriginColor (const Quantity_Color& theColor)
+{
+ if (myTrihDispMode == Prs3d_DM_Shaded)
+ {
+ SetDatumPartColor (Prs3d_DP_Origin, theColor);
+ }
}
//=======================================================================
-Standard_Boolean AIS_Trihedron::HasArrowColor() const {
-
- return myHasOwnArrowColor;
+//function : SetXAxisColor
+//purpose :
+//=======================================================================
+void AIS_Trihedron::SetXAxisColor (const Quantity_Color& theColor)
+{
+ SetDatumPartColor (Prs3d_DP_XAxis, theColor);
}
//=======================================================================
-Quantity_NameOfColor AIS_Trihedron::ArrowColor() const {
-
- return myOwnArrowColor;
+//function : SetYAxisColor
+//purpose :
+//=======================================================================
+void AIS_Trihedron::SetYAxisColor (const Quantity_Color& theColor)
+{
+ SetDatumPartColor (Prs3d_DP_YAxis, theColor);
}
-
//=======================================================================
-//function : Compute
-//purpose : to avoid warning
+//function : SetAxisColor
+//purpose :
//=======================================================================
-void AIS_Trihedron::Compute(const Handle(Prs3d_Projector)&,
- const Handle(Prs3d_Presentation)&)
+void AIS_Trihedron::SetAxisColor (const Quantity_Color& theColor)
{
+ SetDatumPartColor (Prs3d_DP_ZAxis, theColor);
}
+
//=======================================================================
-//function : Type
-//purpose :
+//function : SetColor
+//purpose :
//=======================================================================
+void AIS_Trihedron::SetColor (const Quantity_Color& theColor)
+{
+ hasOwnColor = Standard_True;
+ myDrawer->SetColor (theColor);
-AIS_KindOfInteractive AIS_Trihedron::Type() const
-{return AIS_KOI_Datum;}
-
+ SetDatumPartColor (Prs3d_DP_Origin, theColor);
+ SetDatumPartColor (Prs3d_DP_XAxis, theColor);
+ SetDatumPartColor (Prs3d_DP_YAxis, theColor);
+ SetDatumPartColor (Prs3d_DP_ZAxis, theColor);
+}
//=======================================================================
-//function : Signature
-//purpose :
+//function : SetArrowColor
+//purpose :
//=======================================================================
+void AIS_Trihedron::SetArrowColor (const Quantity_Color& theColor)
+{
+ setOwnDatumAspect();
- Standard_Integer AIS_Trihedron::Signature() const
-{return 3;}
+ myHasOwnArrowColor = Standard_True;
+ myDrawer->DatumAspect()->ArrowAspect()->SetColor (theColor);
+}
//=======================================================================
-//function : ExtremityPoints
-//purpose : to avoid warning
+//function : TextColor
+//purpose :
//=======================================================================
-void AIS_Trihedron::ExtremityPoints(TColgp_Array1OfPnt& PP) const
+Quantity_Color AIS_Trihedron::TextColor() const
{
- gp_Ax2 theax(myComponent->Ax2());
- PP(1) = theax.Location();
-
- Standard_Real len = myDrawer->DatumAspect()->FirstAxisLength();
- gp_Vec vec = theax.XDirection();
- vec *= len;
- PP(2) = PP(1).Translated(vec);
-
- len = myDrawer->DatumAspect()->SecondAxisLength();
- vec = theax.YDirection();
- vec *= len;
- PP(3) = PP(1).Translated(vec);
-
- len = myDrawer->DatumAspect()->ThirdAxisLength();
- vec = theax.Direction();
- vec *= len;
- PP(4) = PP(1).Translated(vec);
+ return myDrawer->DatumAspect()->TextAspect()->Aspect()->Color();
}
//=======================================================================
-//function : AcceptDisplayMode
-//purpose :
+//function : ArrowColor
+//purpose :
//=======================================================================
-
- Standard_Boolean AIS_Trihedron::
-AcceptDisplayMode(const Standard_Integer aMode) const
-{return aMode == 0;}
-
-
+Quantity_Color AIS_Trihedron::ArrowColor() const
+{
+ return myDrawer->DatumAspect()->ArrowAspect()->Aspect()->Color();
+}
//=======================================================================
//function : UnsetColor
//purpose :
//=======================================================================
-
void AIS_Trihedron::UnsetColor()
{
- hasOwnColor=Standard_False;
- myDrawer->SetColor (Quantity_NOC_LIGHTSTEELBLUE4);
- myDrawer->DatumAspect()->FirstAxisAspect() ->SetColor (myDrawer->Color());
- myDrawer->DatumAspect()->SecondAxisAspect()->SetColor (myDrawer->Color());
- myDrawer->DatumAspect()->ThirdAxisAspect() ->SetColor (myDrawer->Color());
- if( HasTextColor() ) {
- SetTextColor(myDrawer->Color().Name());
+ hasOwnColor = Standard_False;
+ Quantity_Color aDefaultColor (Quantity_NOC_LIGHTSTEELBLUE4);
+ SetColor (aDefaultColor);
+ if (HasTextColor())
+ {
+ SetTextColor (aDefaultColor);
myHasOwnTextColor = Standard_False;
}
- if( HasArrowColor() ) {
- SetArrowColor(myDrawer->Color().Name());
+ if (HasArrowColor())
+ {
+ SetArrowColor (aDefaultColor);
myHasOwnArrowColor = Standard_False;
}
-
}
//=======================================================================
-//function : UnsetWitdth
-//purpose :
+//function : createSensitiveEntity
+//purpose :
//=======================================================================
-
-void AIS_Trihedron::UnsetWidth()
+Handle(SelectBasics_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs3d_DatumParts thePart,
+ const Handle(SelectBasics_EntityOwner)& theOwner) const
{
- myOwnWidth =0.0;
- myDrawer->DatumAspect()->FirstAxisAspect()->SetWidth(1.);
- myDrawer->DatumAspect()->SecondAxisAspect()->SetWidth(1.);
- myDrawer->DatumAspect()->ThirdAxisAspect()->SetWidth(1.);
+ Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
+ Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = arrayOfPrimitives (thePart);
+ if (aPrimitives.IsNull())
+ {
+ return Handle(SelectBasics_SensitiveEntity)();
+ }
+ if (thePart >= Prs3d_DP_XOYAxis
+ && thePart <= Prs3d_DP_XOZAxis)
+ { // plane
+ const gp_Pnt anXYZ1 = aPrimitives->Vertice (1);
+ const gp_Pnt anXYZ2 = aPrimitives->Vertice (2);
+ const gp_Pnt anXYZ3 = aPrimitives->Vertice (3);
+ return new Select3D_SensitiveTriangle (theOwner, anXYZ1, anXYZ2, anXYZ3);
+ }
+
+ if (myTrihDispMode == Prs3d_DM_Shaded)
+ {
+ Handle(Select3D_SensitivePrimitiveArray) aSelArray = new Select3D_SensitivePrimitiveArray (theOwner);
+ aSelArray->InitTriangulation (aPrimitives->Attributes(), aPrimitives->Indices(), TopLoc_Location());
+ return aSelArray;
+ }
+
+ if (Handle(Graphic3d_ArrayOfPoints) aPoints = Handle(Graphic3d_ArrayOfPoints)::DownCast(aPrimitives))
+ {
+ const gp_Pnt anXYZ1 = aPoints->Vertice (1);
+ return new Select3D_SensitivePoint (theOwner, anXYZ1);
+ }
+ else if (Handle(Graphic3d_ArrayOfSegments) aSegments = Handle(Graphic3d_ArrayOfSegments)::DownCast(aPrimitives))
+ {
+ const gp_Pnt anXYZ1 = aSegments->Vertice (1);
+ const gp_Pnt anXYZ2 = aSegments->Vertice (2);
+ return new Select3D_SensitiveSegment (theOwner, anXYZ1, anXYZ2);
+ }
+ return Handle(SelectBasics_SensitiveEntity)();
}
-void AIS_Trihedron::LoadSubObjects()
+
+// =======================================================================
+// function : arrayOfPrimitives
+// purpose :
+// =======================================================================
+Handle(Graphic3d_ArrayOfPrimitives) AIS_Trihedron::arrayOfPrimitives(
+ Prs3d_DatumParts theDatumPart) const
{
- myShapes[0] = Position();
- myShapes[1] = XAxis();
- myShapes[2] = YAxis();
- myShapes[3] = Axis();
- myShapes[4] = XYPlane();
- myShapes[5] = XZPlane();
- myShapes[6] = YZPlane();
+ Handle(Graphic3d_ArrayOfPrimitives) anArray;
+ myPrimitives.Find(theDatumPart, anArray);
+ return anArray;
}
-//=======================================================================
-//function : SetContext
-//purpose :
-//=======================================================================
-
-void AIS_Trihedron::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
+// =======================================================================
+// function : updatePrimitives
+// purpose :
+// =======================================================================
+void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
+ Prs3d_DatumMode theMode,
+ const gp_Pnt& theOrigin,
+ const gp_Dir& theXDirection,
+ const gp_Dir& theYDirection,
+ const gp_Dir& theZDirection)
{
-// Standard_Boolean same_DA = myDrawer->Link() == Ctx->DefaultDrawer();
-
- if( Ctx.IsNull())
- {
- Standard_Integer anIdx;
- for (anIdx = 0; anIdx < 7; anIdx++)
+ 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 anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
+ {
+ Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
+ anAxisPoints.Bind(aPart, gp_Pnt(anXYZOrigin + anAxisDirs.Find(aPart).XYZ() *
+ theAspect->AxisLength(aPart)));
+ }
+
+ if (theMode == Prs3d_DM_WireFrame)
+ {
+ // origin
+ if (theAspect->DrawDatumPart(Prs3d_DP_Origin))
+ {
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPoints(1);
+ aPrims->AddVertex(theOrigin);
+ myPrimitives.Bind(Prs3d_DP_Origin, aPrims);
+ }
+ // axes
+ for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter;
+ if (theAspect->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 = theAspect->ArrowPartForAxis(aPart);
+ if (theAspect->DrawDatumPart(anArrowPart))
+ {
+ myPrimitives.Bind(anArrowPart,
+ Prs3d_Arrow::DrawSegments(anAxisPoints.Find(aPart), anAxisDirs.Find(aPart),
+ theAspect->ArrowAspect()->Angle(),
+ theAspect->AxisLength(aPart) * theAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent),
+ (Standard_Integer) theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes)));
+ }
+ }
+ }
+ else
+ {
+ // shading mode
+ // origin
+ if (theAspect->DrawDatumPart(Prs3d_DP_Origin))
+ {
+ const Standard_Real aSphereRadius = theAspect->AxisLength(Prs3d_DP_XAxis) *
+ theAspect->Attribute(Prs3d_DP_ShadingOriginRadiusPercent);
+ const Standard_Integer aNbOfFacettes =
+ (Standard_Integer)theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes);
+ gp_Trsf aSphereTransform;
+ aSphereTransform.SetTranslationPart(gp_Vec(gp::Origin(), theOrigin));
+ myPrimitives.Bind(Prs3d_DP_Origin, Prs3d_ToolSphere::Create(aSphereRadius, aNbOfFacettes,
+ aNbOfFacettes, aSphereTransform));
+ }
+ // axes
+ {
+ const Standard_Integer aNbOfFacettes =
+ (Standard_Integer)theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes);
+ const Standard_Real aTubeRadiusPercent = theAspect->Attribute(Prs3d_DP_ShadingTubeRadiusPercent);
+ const Standard_Real aConeLengthPercent = theAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
+ const Standard_Real aConeRadiusPercent = theAspect->Attribute(Prs3d_DP_ShadingConeRadiusPercent);
+ for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
{
- myShapes[anIdx]->SetContext(Ctx);
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
+ const Prs3d_DatumParts anArrowPart = theAspect->ArrowPartForAxis(aPart);
+ const bool aDrawArrow = theAspect->DrawDatumPart(anArrowPart);
+ const Standard_Real anAxisLength = theAspect->AxisLength(aPart);
+ const gp_Ax1 anAxis(theOrigin, anAxisDirs.Find(aPart));
+
+ if (theAspect->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));
+ }
}
- AIS_InteractiveObject::SetContext (Ctx);
- return;
- }
- // Remove subobjects from current context
- Handle(AIS_InteractiveContext) anAISContext = GetContext();
-
- Standard_Boolean hasContext = (anAISContext.IsNull() == Standard_False);
- Standard_Integer anIdx;
- for (anIdx = 0; anIdx < 7; anIdx++)
+ }
+ }
+ // planes
+ for (Standard_Integer aPlaneIter = Prs3d_DP_XOYAxis; aPlaneIter <= Prs3d_DP_XOZAxis; ++aPlaneIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPlaneIter;
+ if (!theAspect->DrawDatumPart(aPart))
{
- // Deselect object
- if (hasContext)
- {
- if (anAISContext->IsSelected (myShapes[anIdx]))
- anAISContext->AddOrRemoveSelected (myShapes[anIdx], Standard_False);
-
- anAISContext->Remove (myShapes[anIdx], Standard_False);
- }
- myShapes[anIdx].Nullify();
+ continue;
+ }
+
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(4);
+ aPrims->AddVertex(theOrigin);
+
+ Prs3d_DatumParts aPart1 = Prs3d_DP_XAxis, aPart2 = Prs3d_DP_XAxis;
+ 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;
}
-
- AIS_InteractiveObject::SetContext (Ctx);
- LoadSubObjects();
- for(Standard_Integer i= 0;i<=6;i++)
- myShapes[i]->SetContext (Ctx);
+ aPrims->AddVertex(anAxisPoints.Find(aPart1));
+ aPrims->AddVertex(anAxisPoints.Find(aPart2));
+
+ aPrims->AddVertex(theOrigin);
+ myPrimitives.Bind(aPart, aPrims);
+ }
+}
+
+// =======================================================================
+// function : getHighlightAspect
+// purpose :
+// =======================================================================
+Handle(Prs3d_ShadingAspect) AIS_Trihedron::getHighlightAspect()
+{
+ if (!myHighlightAspect.IsNull())
+ return myHighlightAspect;
+
+ Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
+ if (!myHilightDrawer.IsNull())
+ aHighlightColor = myHilightDrawer->Color();
+
+ myHighlightAspect = new Prs3d_ShadingAspect();
+ myHighlightAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
+ myHighlightAspect->SetColor (aHighlightColor);
+
+ Graphic3d_MaterialAspect aHighlightMaterial;
+ aHighlightMaterial.SetColor (aHighlightColor);
+ myHighlightAspect->SetMaterial (aHighlightMaterial);
+
+ return myHighlightAspect;
+}
+
+// =======================================================================
+// function : getHighlightLineAspect
+// purpose :
+// =======================================================================
+Handle(Prs3d_LineAspect) AIS_Trihedron::getHighlightLineAspect()
+{
+ if (!myHighlightLineAspect.IsNull())
+ return myHighlightLineAspect;
+
+ Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
+ if (!myHilightDrawer.IsNull())
+ aHighlightColor = myHilightDrawer->Color();
+
+ Handle(Prs3d_DatumAspect) aDatumAspect = Attributes()->DatumAspect();
+ Handle(Prs3d_LineAspect) aLineAspect = aDatumAspect->LineAspect(Prs3d_DP_XAxis);
+ myHighlightLineAspect = new Prs3d_LineAspect (aHighlightColor, aLineAspect->Aspect()->Type(),
+ aLineAspect->Aspect()->Width());
+
+ return myHighlightLineAspect;
+}
+
+// =======================================================================
+// function : getHighlightPointAspect
+// purpose :
+// =======================================================================
+Handle(Prs3d_PointAspect) AIS_Trihedron::getHighlightPointAspect()
+{
+ if (!myHighlightPointAspect.IsNull())
+ return myHighlightPointAspect;
+
+ Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
+ if (!myHilightDrawer.IsNull())
+ aHighlightColor = myHilightDrawer->Color();
+ myHighlightPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, aHighlightColor, 1.0);
+
+ return myHighlightPointAspect;
}
#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 <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 <AIS_KindOfInteractive.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;
-#include <AIS_Trihedron.lxx>
+ 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;
+};
+DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
#endif // _AIS_Trihedron_HeaderFile
+++ /dev/null
-// Created on: 1997-03-06
-// Created by: Robert COUBLANC
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 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.
-
-inline const Handle(Geom_Axis2Placement)& AIS_Trihedron::Component() const
-{return myComponent;}
-
-inline Standard_Boolean AIS_Trihedron::HasOwnSize() const
-{return myHasOwnSize;}
--- /dev/null
+// 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());
+}
--- /dev/null
+// 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
--- /dev/null
+// Copyright (c) 2017 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_TrihedronSelectionMode_HeaderFile
+#define _AIS_TrihedronSelectionMode_HeaderFile
+
+//! 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
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
+++ /dev/null
-// Copyright (c) 2013-2014 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 <DsgPrs_DatumPrs.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Ax2.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-#include <Prs3d_Arrow.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_DatumAspect.hxx>
-#include <Prs3d_TextAspect.hxx>
-#include <Prs3d_ArrowAspect.hxx>
-
-void DsgPrs_DatumPrs::Add (const Handle(Prs3d_Presentation)& thePresentation,
- const gp_Ax2& theDatum,
- const Handle(Prs3d_Drawer)& theDrawer)
-{
- Handle(Prs3d_DatumAspect) aDatumAspect = theDrawer->DatumAspect();
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
-
- gp_Ax2 anAxis(theDatum);
- gp_Pnt anOrigin = anAxis.Location();
- gp_Dir aXDir = anAxis.XDirection();
- gp_Dir aYDir = anAxis.YDirection();
- gp_Dir aZDir = anAxis.Direction();
-
- Quantity_Length anAxisLength;
- Quantity_Length anArrowAngle = theDrawer->ArrowAspect()->Angle();
-
- const Standard_Boolean toDrawLabels = theDrawer->DatumAspect()->ToDrawLabels();
-
- Handle(Graphic3d_ArrayOfSegments) aPrims;
- if (aDatumAspect->DrawFirstAndSecondAxis())
- {
- anAxisLength = aDatumAspect->FirstAxisLength();
- const gp_Pnt aPoint1(anOrigin.XYZ() + aXDir.XYZ()*anAxisLength);
-
- aGroup->SetPrimitivesAspect(aDatumAspect->FirstAxisAspect()->Aspect());
- aPrims = new Graphic3d_ArrayOfSegments(2);
- aPrims->AddVertex(anOrigin);
- aPrims->AddVertex(aPoint1);
- aGroup->AddPrimitiveArray(aPrims);
-
- aGroup->SetPrimitivesAspect(theDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (thePresentation), aPoint1, aXDir, anArrowAngle, anAxisLength/10.);
- aGroup->SetPrimitivesAspect(theDrawer->TextAspect()->Aspect());
- Graphic3d_Vertex aVertex1(aPoint1.X(),aPoint1.Y(),aPoint1.Z());
- if (toDrawLabels)
- {
- aGroup->Text (Standard_CString ("X"), aVertex1, 16.0);
- }
-
- anAxisLength = aDatumAspect->SecondAxisLength();
- const gp_Pnt aPoint2(anOrigin.XYZ() + aYDir.XYZ()*anAxisLength);
-
- aGroup->SetPrimitivesAspect(aDatumAspect->SecondAxisAspect()->Aspect());
- aPrims = new Graphic3d_ArrayOfSegments(2);
- aPrims->AddVertex(anOrigin);
- aPrims->AddVertex(aPoint2);
- aGroup->AddPrimitiveArray(aPrims);
-
- aGroup->SetPrimitivesAspect(theDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (thePresentation), aPoint2, aYDir, anArrowAngle, anAxisLength/10.);
- aGroup->SetPrimitivesAspect(theDrawer->TextAspect()->Aspect());
- Graphic3d_Vertex aVertex2(aPoint2.X(),aPoint2.Y(),aPoint2.Z());
- if (toDrawLabels)
- {
- aGroup->Text (Standard_CString ("Y"), aVertex2, 16.0);
- }
- }
- if (aDatumAspect->DrawThirdAxis())
- {
- anAxisLength = aDatumAspect->ThirdAxisLength();
- const gp_Pnt aPoint3(anOrigin.XYZ() + aZDir.XYZ()*anAxisLength);
-
- aGroup->SetPrimitivesAspect(aDatumAspect->ThirdAxisAspect()->Aspect());
- aPrims = new Graphic3d_ArrayOfSegments(2);
- aPrims->AddVertex(anOrigin);
- aPrims->AddVertex(aPoint3);
- aGroup->AddPrimitiveArray(aPrims);
-
- aGroup->SetPrimitivesAspect(theDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (thePresentation), aPoint3, aZDir, anArrowAngle, anAxisLength/10.);
- aGroup->SetPrimitivesAspect(theDrawer->TextAspect()->Aspect());
- Graphic3d_Vertex aVertex3(aPoint3.X(),aPoint3.Y(),aPoint3.Z());
- if (toDrawLabels)
- {
- aGroup->Text (Standard_CString ("Z"), aVertex3, 16.0);
- }
- }
-}
+++ /dev/null
-// Copyright (c) 2013-2014 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 _DsgPrs_DatumPrs_H__
-#define _DsgPrs_DatumPrs_H__
-
-#include <gp_Ax2.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_Presentation.hxx>
-#include <Prs3d_Root.hxx>
-
-class DsgPrs_DatumPrs : public Prs3d_Root
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
- Standard_EXPORT static void Add
- (const Handle(Prs3d_Presentation)& thePresentation,
- const gp_Ax2& theDatum,
- const Handle(Prs3d_Drawer)& theDrawer);
-
-};
-#endif
DsgPrs_Chamf2dPresentation.hxx
DsgPrs_ConcentricPresentation.cxx
DsgPrs_ConcentricPresentation.hxx
-DsgPrs_DatumPrs.cxx
-DsgPrs_DatumPrs.hxx
DsgPrs_DiameterPresentation.cxx
DsgPrs_DiameterPresentation.hxx
DsgPrs_EllipseRadiusPresentation.cxx
Prs3d_BasicAspect.hxx
Prs3d_DatumAspect.cxx
Prs3d_DatumAspect.hxx
+Prs3d_DatumAttribute.hxx
+Prs3d_DatumAxes.hxx
+Prs3d_DatumMode.hxx
+Prs3d_DatumParts.hxx
Prs3d_DimensionArrowOrientation.hxx
Prs3d_DimensionAspect.cxx
Prs3d_DimensionAspect.hxx
//purpose :
//=======================================================================
void Prs3d_Arrow::Draw(const Handle(Graphic3d_Group)& theGroup,
- const gp_Pnt& aLocation,
- const gp_Dir& aDirection,
- const Quantity_PlaneAngle anAngle,
- const Quantity_Length aLength)
+ const gp_Pnt& theLocation,
+ const gp_Dir& theDirection,
+ const Quantity_PlaneAngle theAngle,
+ const Quantity_Length theLength)
{
- Quantity_Length dx,dy,dz; aDirection.Coord(dx,dy,dz);
-//
-// Point of the arrow:
- Quantity_Length xo,yo,zo; aLocation.Coord(xo,yo,zo);
-
-// Center of the base circle of the arrow:
- Quantity_Length xc = xo - dx * aLength;
- Quantity_Length yc = yo - dy * aLength;
- Quantity_Length zc = zo - dz * aLength;
+ Handle(Graphic3d_ArrayOfSegments) aPrimitives = Prs3d_Arrow::DrawSegments(theLocation,
+ theDirection, theAngle, theLength, 15);
+ theGroup->AddPrimitiveArray (aPrimitives);
+}
-// Construction of i,j mark for the circle:
- Quantity_Length xn=0., yn=0., zn=0.;
+//=======================================================================
+//function : DrawSegments
+//purpose :
+//=======================================================================
+Handle(Graphic3d_ArrayOfSegments) Prs3d_Arrow::DrawSegments (const gp_Pnt& theLocation,
+ const gp_Dir& theDir,
+ const Quantity_PlaneAngle theAngle,
+ const Quantity_Length theLength,
+ const Standard_Integer theNbSegments)
+{
+ Handle(Graphic3d_ArrayOfSegments) aSegments = new Graphic3d_ArrayOfSegments (theNbSegments + 1, 2 * (2 * theNbSegments));
- if ( Abs(dx) <= Abs(dy) && Abs(dx) <= Abs(dz)) xn=1.;
- else if ( Abs(dy) <= Abs(dz) && Abs(dy) <= Abs(dx)) yn=1.;
- else zn=1.;
- Quantity_Length xi = dy * zn - dz * yn;
- Quantity_Length yi = dz * xn - dx * zn;
- Quantity_Length zi = dx * yn - dy * xn;
+ // center of the base circle of the arrow
+ const gp_XYZ aC = theLocation.XYZ() + theDir.XYZ() * (-theLength);
- Quantity_Length Norme = sqrt ( xi*xi + yi*yi + zi*zi );
- xi = xi / Norme; yi = yi / Norme; zi = zi/Norme;
+ // construction of i,j mark for the circle
+ gp_Dir aN;
+ if (Abs(theDir.X()) <= Abs(theDir.Y())
+ && Abs(theDir.X()) <= Abs(theDir.Z()))
+ {
+ aN = gp::DX();
+ }
+ else if (Abs(theDir.Y()) <= Abs(theDir.Z())
+ && Abs(theDir.Y()) <= Abs(theDir.X()))
+ {
+ aN = gp::DY();
+ }
+ else
+ {
+ aN = gp::DZ();
+ }
- const Quantity_Length xj = dy * zi - dz * yi;
- const Quantity_Length yj = dz * xi - dx * zi;
- const Quantity_Length zj = dx * yi - dy * xi;
+ const gp_Dir anXYZi = theDir.Crossed (aN.XYZ());
+ const gp_XYZ anXYZj = theDir.XYZ().Crossed (anXYZi.XYZ());
+ aSegments->AddVertex (theLocation);
- const Standard_Integer NbPoints = 15;
+ const Standard_Real Tg = Tan (theAngle);
+ for (Standard_Integer aVertIter = 1; aVertIter <= theNbSegments; ++aVertIter)
+ {
+ const Standard_Real aCos = Cos (2.0 * M_PI / theNbSegments * (aVertIter - 1));
+ const Standard_Real aSin = Sin (2.0 * M_PI / theNbSegments * (aVertIter - 1));
- Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments(2*NbPoints);
- Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines(NbPoints+1);
+ const gp_Pnt pp(aC.X() + (aCos * anXYZi.X() + aSin * anXYZj.X()) * theLength * Tg,
+ aC.Y() + (aCos * anXYZi.Y() + aSin * anXYZj.Y()) * theLength * Tg,
+ aC.Z() + (aCos * anXYZi.Z() + aSin * anXYZj.Z()) * theLength * Tg);
- gp_Pnt p1;
- const Standard_Real Tg=tan(anAngle);
+ aSegments->AddVertex (pp);
+ }
- for (Standard_Integer i = 1; i <= NbPoints ; i++)
+ Standard_Integer aNbVertices = theNbSegments + 1;
+ Standard_Integer aFirstContourVertex = 2;
+ Standard_Integer anEdgeCount = 0;
+ for (Standard_Integer aVertIter = aFirstContourVertex; aVertIter <= aNbVertices; ++aVertIter)
{
- const Standard_Real cosinus = cos ( 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,
- yc + (cosinus * yi + sinus * yj) * aLength * Tg,
- zc + (cosinus * zi + sinus * zj) * aLength * Tg);
-
- aPrims1->AddVertex(aLocation);
- aPrims1->AddVertex(pp);
- if(i==1) p1 = pp;
- aPrims2->AddVertex(pp);
+ aSegments->AddEdge (1);
+ aSegments->AddEdge (aVertIter);
+ ++anEdgeCount;
}
- aPrims2->AddVertex(p1);
+ aSegments->AddEdge (aNbVertices);
+ aSegments->AddEdge (aFirstContourVertex);
+ ++anEdgeCount;
- theGroup->AddPrimitiveArray (aPrims1);
- theGroup->AddPrimitiveArray (aPrims2);
+ for (Standard_Integer aVertIter = aFirstContourVertex; aVertIter <= aNbVertices - 1; ++aVertIter)
+ {
+ aSegments->AddEdge (aVertIter);
+ aSegments->AddEdge (aVertIter + 1);
+ ++anEdgeCount;
+ }
+ return aSegments;
}
// ============================================================================
#include <Prs3d_Root.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Quantity_PlaneAngle.hxx>
#include <Quantity_Length.hxx>
const Standard_Real theConeLength,
const Standard_Integer theNbFacettes);
+ //! Defines the representation of the arrow as a container of segments.
+ //! @param theLocation location of the arrow tip
+ //! @param theDir direction of the arrow
+ //! @param theAngle angle of opening of the arrow head
+ //! @param theLength length of the arrow (from the tip)
+ //! @param theNbSegments count of points on polyline where location is connected
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) DrawSegments (const gp_Pnt& theLocation,
+ const gp_Dir& theDir,
+ const Quantity_PlaneAngle theAngle,
+ const Quantity_Length theLength,
+ const Standard_Integer theNbSegments);
+
//! Defines the representation of the arrow.
//! Note that this method does NOT assign any presentation aspects to the primitives group!
//! @param theGroup presentation group to add primitives
// purpose :
// =======================================================================
Prs3d_DatumAspect::Prs3d_DatumAspect()
-: myDrawFirstAndSecondAxis (Standard_True),
- myDrawThirdAxis (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);
- mySecondAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
- myThirdAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
+: myAxes (Prs3d_DA_XYZAxis),
+ myToDrawLabels (Standard_True)
+{
+ Standard_Real aDefaultLength = 100.0; // default axis lenght, the same as in context
+ Quantity_Color aDefaultColor(Quantity_NOC_LIGHTSTEELBLUE4); // default axis color
+
+ myAttributes.Bind (Prs3d_DA_XAxisLength, aDefaultLength);
+ myAttributes.Bind (Prs3d_DA_YAxisLength, aDefaultLength);
+ myAttributes.Bind (Prs3d_DA_ZAxisLength, aDefaultLength);
+ 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.0);
+
+ Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
+ Standard_Real aWidth = 1.0;
+ for (int aPartIter = Prs3d_DP_Origin; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
+ {
+ const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
+ 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();
+ myPointAspect = new Prs3d_PointAspect (Aspect_TOM_EMPTY, aDefaultColor, 1.0);
+ myArrowAspect = new Prs3d_ArrowAspect();
+}
+
+// =======================================================================
+// function : LineAspect
+// purpose :
+// =======================================================================
+Handle(Prs3d_LineAspect) Prs3d_DatumAspect::LineAspect (Prs3d_DatumParts thePart) const
+{
+ Handle(Prs3d_LineAspect) aLineAspect;
+ myLineAspects.Find (thePart, aLineAspect);
+ return aLineAspect;
+}
+
+// =======================================================================
+// function : ShadingAspect
+// purpose :
+// =======================================================================
+Handle(Prs3d_ShadingAspect) Prs3d_DatumAspect::ShadingAspect (Prs3d_DatumParts thePart) const
+{
+ Handle(Prs3d_ShadingAspect) aShadingAspect;
+ myShadedAspects.Find (thePart, aShadingAspect);
+ return aShadingAspect;
+}
+
+// =======================================================================
+// function : SetDrawFirstAndSecondAxis
+// purpose :
+// =======================================================================
+void Prs3d_DatumAspect::SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw)
+{
+ if (theToDraw)
+ {
+ myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_XAxis | Prs3d_DA_YAxis);
+ }
+ else
+ {
+ myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_XAxis & !Prs3d_DA_YAxis);
+ }
+}
+
+// =======================================================================
+// function : SetDrawThirdAxis
+// purpose :
+// =======================================================================
+void Prs3d_DatumAspect::SetDrawThirdAxis (Standard_Boolean theToDraw)
+{
+ if (theToDraw)
+ {
+ myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_ZAxis);
+ }
+ else
+ {
+ myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_ZAxis);
+ }
+}
+
+// =======================================================================
+// function : DrawDatumPart
+// purpose :
+// =======================================================================
+bool Prs3d_DatumAspect::DrawDatumPart (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;
+}
+
+// =======================================================================
+// function : AxisLength
+// purpose :
+// =======================================================================
+Standard_Real Prs3d_DatumAspect::AxisLength (Prs3d_DatumParts thePart) const
+{
+ switch (thePart)
+ {
+ case Prs3d_DP_XAxis: return myAttributes.Find (Prs3d_DA_XAxisLength);
+ case Prs3d_DP_YAxis: return myAttributes.Find (Prs3d_DA_YAxisLength);
+ case Prs3d_DP_ZAxis: return myAttributes.Find (Prs3d_DA_ZAxisLength);
+ default: break;
+ }
+ return 0.0;
+}
+
+// =======================================================================
+// function : ArrowPartForAxis
+// purpose :
+// =======================================================================
+Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (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;
}
#ifndef _Prs3d_DatumAspect_HeaderFile
#define _Prs3d_DatumAspect_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Boolean.hxx>
-#include <Quantity_Length.hxx>
-#include <Prs3d_BasicAspect.hxx>
+#include <NCollection_DataMap.hxx>
+#include <Prs3d_ArrowAspect.hxx>
+#include <Prs3d_DatumAttribute.hxx>
+#include <Prs3d_DatumAxes.hxx>
+#include <Prs3d_DatumMode.hxx>
+#include <Prs3d_DatumParts.hxx>
#include <Prs3d_LineAspect.hxx>
-#include <Standard_Real.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_TextAspect.hxx>
//! A framework to define the display of datums.
class Prs3d_DatumAspect : public Prs3d_BasicAspect
//! An empty framework to define the display of datums.
Standard_EXPORT Prs3d_DatumAspect();
-
+
+ //! Returns the right-handed coordinate system set in SetComponent.
+ Standard_EXPORT Handle(Prs3d_LineAspect) LineAspect (Prs3d_DatumParts thePart) const;
+
+ //! Returns the right-handed coordinate system set in SetComponent.
+ Standard_EXPORT Handle(Prs3d_ShadingAspect) ShadingAspect (Prs3d_DatumParts thePart) const;
+
+ //! Returns the right-handed coordinate system set in SetComponent.
+ const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; }
+
+ //! Returns the point aspect of origin wireframe presentation
+ const Handle(Prs3d_PointAspect)& PointAspect() const { return myPointAspect; }
+
+ //! Returns the arrow aspect of presentation
+ const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
+
//! Returns the attributes for display of the first axis.
- const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myFirstAxisAspect; }
-
+ 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.
- const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return mySecondAxisAspect; }
-
+ 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.
- const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myThirdAxisAspect; }
-
+ 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.
- void SetDrawFirstAndSecondAxis (const Standard_Boolean theToDraw) { myDrawFirstAndSecondAxis = theToDraw; }
-
+ Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
+ Standard_EXPORT void SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw);
+
//! Returns true if the first and second axes can be drawn.
- Standard_Boolean DrawFirstAndSecondAxis() const { return myDrawFirstAndSecondAxis; }
+ Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
+ Standard_Boolean DrawFirstAndSecondAxis() const
+ {
+ return (myAxes & Prs3d_DA_XAxis) != 0
+ && (myAxes & Prs3d_DA_YAxis) != 0;
+ }
//! Sets the DrawThirdAxis attributes to active.
- void SetDrawThirdAxis (const Standard_Boolean theToDraw) { myDrawThirdAxis = theToDraw; }
-
+ Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
+ Standard_EXPORT void SetDrawThirdAxis (Standard_Boolean theToDraw);
+
//! Returns true if the third axis can be drawn.
- Standard_Boolean DrawThirdAxis() const { return myDrawThirdAxis; }
+ Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
+ Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DA_ZAxis) != 0; }
+
+ //! Returns true if the given part is used in axes of aspect
+ Standard_EXPORT Standard_Boolean DrawDatumPart (Prs3d_DatumParts thePart) const;
+
+ //! Sets the axes used in the datum aspect
+ void SetDrawDatumAxes (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 (Prs3d_DatumAttribute theType, const Standard_Real& theValue)
+ {
+ myAttributes.Bind (theType, theValue);
+ }
+
+ //! Returns the attribute of the datum type
+ Standard_Real Attribute (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)
+ void SetAxisLength (Standard_Real theL1, Standard_Real theL2, Standard_Real theL3)
{
- myFirstAxisLength = theL1;
- mySecondAxisLength = theL2;
- myThirdAxisLength = 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.
- Quantity_Length FirstAxisLength() const { return myFirstAxisLength; }
+ Standard_EXPORT Standard_Real AxisLength (Prs3d_DatumParts thePart) const;
+
+ //! Returns the length of the displayed first axis.
+ Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
+ Standard_Real FirstAxisLength() const { return myAttributes.Find (Prs3d_DA_XAxisLength); }
//! Returns the length of the displayed second axis.
- Quantity_Length SecondAxisLength() const { return mySecondAxisLength; }
-
+ Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
+ Standard_Real SecondAxisLength() const { return myAttributes.Find (Prs3d_DA_YAxisLength); }
+
//! Returns the length of the displayed third axis.
- Quantity_Length ThirdAxisLength() const { return myThirdAxisLength; }
+ Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
+ Standard_Real ThirdAxisLength() const { return myAttributes.Find (Prs3d_DA_ZAxisLength); }
//! Sets option to draw or not to draw text labels for axes
- void SetToDrawLabels (const Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
+ void SetToDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
//! @return true if axes labels are drawn
Standard_Boolean ToDrawLabels() const { return myToDrawLabels; }
-private:
+ //! Returns type of arrow for a type of axis
+ Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const;
- Handle(Prs3d_LineAspect) myFirstAxisAspect;
- Handle(Prs3d_LineAspect) mySecondAxisAspect;
- Handle(Prs3d_LineAspect) myThirdAxisAspect;
- Standard_Boolean myDrawFirstAndSecondAxis;
- Standard_Boolean myDrawThirdAxis;
+private:
+ Prs3d_DatumAxes myAxes;
Standard_Boolean myToDrawLabels;
- Quantity_Length myFirstAxisLength;
- Quantity_Length mySecondAxisLength;
- Quantity_Length myThirdAxisLength;
+ NCollection_DataMap<Prs3d_DatumAttribute, Standard_Real> myAttributes;
+
+ NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_ShadingAspect)> myShadedAspects;
+ NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_LineAspect)> myLineAspects;
+ Handle(Prs3d_TextAspect) myTextAspect;
+ Handle(Prs3d_PointAspect) myPointAspect;
+ Handle(Prs3d_ArrowAspect) myArrowAspect;
};
DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
}
if (!myDatumAspect.IsNull())
{
- setAspectProgram (theProgram, myDatumAspect->FirstAxisAspect());
- setAspectProgram (theProgram, myDatumAspect->SecondAxisAspect());
- setAspectProgram (theProgram, myDatumAspect->ThirdAxisAspect());
+ setAspectProgram (theProgram, myDatumAspect->LineAspect(Prs3d_DP_XAxis));
+ setAspectProgram (theProgram, myDatumAspect->LineAspect(Prs3d_DP_YAxis));
+ setAspectProgram (theProgram, myDatumAspect->LineAspect(Prs3d_DP_ZAxis));
}
setAspectProgram (theProgram, myArrowAspect);
return;
#include <OSD_Timer.hxx>
#include <stdio.h>
-#if defined(_WIN32) || defined(__WIN32__)
-# include <windows.h>
-# include <io.h>
-#else
-# include <unistd.h>
-#endif
-
#include <Draw_PluginMacro.hxx>
-//=======================================================================
-
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
-#include <AIS_Trihedron.hxx>
-#include <AIS_Axis.hxx>
-#include <Geom_Line.hxx>
-#include <AIS_Line.hxx>
-
-Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-Standard_EXPORT Handle(AIS_InteractiveContext)& TheAISContext();
-
-//==============================================================================
-// function : VTrihedronOrigins
-// author : ota
-// purpose : draws triheron axis origin lines.
-// Draw arg : vtri_orig trihedron_name
-//==============================================================================
-static int VTrihedronOrigins(Draw_Interpretor& di,
- Standard_Integer argc,
- const char ** argv)
-{
- if(argc != 2){
- di <<"Usage : vtri_orig tri_name\n";
- return 1;
- }
-
- if(TheAISContext().IsNull()){
- di<<"Make 'vinit' before this method call\n";
- return 1;
- }
-
- //get trihedron from AIS map.
- TCollection_AsciiString aName(argv[1]);
- if(!GetMapOfAIS().IsBound2(aName)){
- di<<"No object named '"<<argv[1]<<"'\n";
- return 1;
- }
-
- Handle(AIS_Trihedron) aTrih =
- Handle(AIS_Trihedron)::DownCast(GetMapOfAIS().Find2(aName));
- if(aTrih.IsNull()){
- di<<"Trihedron is not found, try another name\n";
- return 1;
- }
-
- //get axis
- Handle(AIS_Axis) XAxis = aTrih->XAxis();
- Handle(AIS_Axis) YAxis = aTrih->YAxis();
- Handle(AIS_Axis) ZAxis = aTrih->Axis();
-
- //get geometrical lines
- Handle(Geom_Line) XGLine = XAxis->Component();
- Handle(Geom_Line) YGLine = YAxis->Component();
- Handle(Geom_Line) ZGLine = ZAxis->Component();
-
- //make AIS_Lines
- Handle(AIS_Line) XLine = new AIS_Line(XGLine);
- Handle(AIS_Line) YLine = new AIS_Line(YGLine);
- Handle(AIS_Line) ZLine = new AIS_Line(ZGLine);
-
- //put them into AIS map:
- GetMapOfAIS().Bind(XLine,aName+"_X");
- GetMapOfAIS().Bind(YLine,aName+"_Y");
- GetMapOfAIS().Bind(ZLine,aName+"_Z");
- //print names of created objects:
- di<<argv[1]<<"_X "<<argv[1]<<"_Y "<<argv[1]<<"_Z\n";
-
- //try to draw them:
- TheAISContext()->Display (XLine, Standard_False);
- TheAISContext()->Display (YLine, Standard_False);
- TheAISContext()->Display (ZLine, Standard_True);
-
- return 0;
-}
-
//=======================================================================
//function : QATestExtremaSS
//purpose :
{
const char* group = "QA_Commands";
- theCommands.Add ("vtri_orig",
- "vtri_orig : vtri_orig trihedron_name - draws axis origin lines",
- __FILE__,
- VTrihedronOrigins,
- group);
-
theCommands.Add ("QATestExtremaSS",
"QATestExtremaSS Shape Step [Flag { MIN = 0 | MAX = 1 | MINMAX = 2 }]",
__FILE__,
return 0;
}
+//=======================================================================
+//function : VNbDisplayed
+//purpose : Returns number of displayed objects
+//=======================================================================
+static Standard_Integer VNbDisplayed (Draw_Interpretor& theDi,
+ Standard_Integer theArgsNb,
+ const char** theArgVec)
+{
+ if(theArgsNb != 1)
+ {
+ theDi << "Usage : " << theArgVec[0] << "\n";
+ return 1;
+ }
+
+ Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
+ if (aContextAIS.IsNull())
+ {
+ std::cout << theArgVec[0] << "AIS context is not available.\n";
+ return 1;
+ }
+
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ if(aContext.IsNull())
+ {
+ theDi << "use 'vinit' command before " << theArgVec[0] << "\n";
+ return 1;
+ }
+
+ AIS_ListOfInteractive aListOfIO;
+ aContextAIS->DisplayedObjects(aListOfIO, false);
+
+ theDi << aListOfIO.Extent() << "\n";
+ return 0;
+}
+
//===============================================================================================
//function : VUpdate
//purpose :
"\n\t\t: -redisplay Recomputes presentation of objects.",
__FILE__, VDisplay2, group);
+ theCommands.Add ("vnbdisplayed",
+ "vnbdisplayed"
+ "\n\t\t: Returns number of displayed objects",
+ __FILE__, VNbDisplayed, group);
+
theCommands.Add ("vupdate",
"vupdate name1 [name2] ... [name n]"
"\n\t\t: Updates named objects in interactive context",
#include <ViewerTest.hxx>
+#include <AIS_PlaneTrihedron.hxx>
+
#include <Quantity_NameOfColor.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw.hxx>
#include <Font_BRepFont.hxx>
#include <Font_BRepTextBuilder.hxx>
#include <Font_FontMgr.hxx>
+
+#include <NCollection_List.hxx>
+
#include <OSD_Chronometer.hxx>
#include <TCollection_AsciiString.hxx>
#include <V3d_Viewer.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <Geom_Circle.hxx>
#include <GC_MakeCircle.hxx>
-#include <Prs3d_Presentation.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
+#include <Prs3d_DatumAttribute.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_VertexDrawMode.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_Presentation.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Image_AlienPixMap.hxx>
extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
extern Handle(AIS_InteractiveContext)& TheAISContext();
+namespace
+{
+ static bool convertToColor (const Handle(TColStd_HSequenceOfAsciiString)& theColorValues,
+ Quantity_Color& theColor)
+ {
+ const char* anArgs[3] =
+ {
+ theColorValues->Size() >= 1 ? theColorValues->Value (1).ToCString() : "",
+ theColorValues->Size() >= 2 ? theColorValues->Value (2).ToCString() : "",
+ theColorValues->Size() >= 3 ? theColorValues->Value (3).ToCString() : ""
+ };
+ return ViewerTest::ParseColor (theColorValues->Size(), anArgs, theColor) != 0;
+ }
+
+ static bool convertToDatumPart (const TCollection_AsciiString& theValue,
+ Prs3d_DatumParts& theDatumPart)
+ {
+ TCollection_AsciiString aValue = theValue;
+ aValue.LowerCase();
+ if (aValue == "origin") theDatumPart = Prs3d_DP_Origin;
+ else if (aValue == "xaxis") theDatumPart = Prs3d_DP_XAxis;
+ else if (aValue == "yaxis") theDatumPart = Prs3d_DP_YAxis;
+ else if (aValue == "zaxis") theDatumPart = Prs3d_DP_ZAxis;
+ else if (aValue == "xarrow") theDatumPart = Prs3d_DP_XArrow;
+ else if (aValue == "yarrow") theDatumPart = Prs3d_DP_YArrow;
+ else if (aValue == "zarrow") theDatumPart = Prs3d_DP_ZArrow;
+ else if (aValue == "xoyaxis") theDatumPart = Prs3d_DP_XOYAxis;
+ else if (aValue == "yozaxis") theDatumPart = Prs3d_DP_YOZAxis;
+ else if (aValue == "xozaxis") theDatumPart = Prs3d_DP_XOZAxis;
+ else if (aValue == "whole") theDatumPart = Prs3d_DP_None;
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+
+ static void convertToDatumParts (const TCollection_AsciiString& theValue,
+ NCollection_List<Prs3d_DatumParts>& theParts)
+ {
+ TCollection_AsciiString aValue = theValue;
+ const Standard_Integer aSplitPos = theValue.Search ("|");
+ Prs3d_DatumParts aPart = Prs3d_DP_None;
+ if (aSplitPos > 0)
+ {
+ convertToDatumParts (theValue.SubString (aSplitPos + 1, theValue.Length()), theParts);
+ if (aSplitPos == 1) // first symbol
+ {
+ return;
+ }
+ aValue = theValue.SubString (1, aSplitPos - 1);
+ }
+ if (convertToDatumPart (aValue, aPart))
+ {
+ theParts.Append (aPart);
+ }
+ }
+
+ static bool convertToDatumAttribute (const TCollection_AsciiString& theValue,
+ Prs3d_DatumAttribute& theAttribute)
+ {
+ TCollection_AsciiString aValue = theValue;
+ aValue.LowerCase();
+ if (aValue == "xaxislength") theAttribute = Prs3d_DA_XAxisLength;
+ else if (aValue == "yaxislength") theAttribute = Prs3d_DA_YAxisLength;
+ else if (aValue == "zaxislength") theAttribute = Prs3d_DA_ZAxisLength;
+ else if (aValue == "tuberadiuspercent") theAttribute = Prs3d_DP_ShadingTubeRadiusPercent;
+ else if (aValue == "coneradiuspercent") theAttribute = Prs3d_DP_ShadingConeRadiusPercent;
+ else if (aValue == "conelengthpercent") theAttribute = Prs3d_DP_ShadingConeLengthPercent;
+ else if (aValue == "originradiuspercent") theAttribute = Prs3d_DP_ShadingOriginRadiusPercent;
+ else if (aValue == "shadingnumberoffacettes") theAttribute = Prs3d_DP_ShadingNumberOfFacettes;
+ else
+ return false;
+ return true;
+ }
+
+ static void convertToDatumAttributes (const TCollection_AsciiString& theValue,
+ NCollection_List<Prs3d_DatumAttribute>& theAttributes)
+ {
+ TCollection_AsciiString aValue = theValue;
+ const Standard_Integer aSplitPos = theValue.Search ("|");
+ Prs3d_DatumAttribute anAttribute = Prs3d_DA_XAxisLength;
+ if (aSplitPos > 0)
+ {
+ convertToDatumAttributes (theValue.SubString (aSplitPos + 1, theValue.Length()), theAttributes);
+ if (aSplitPos == 1) // first symbol
+ {
+ return;
+ }
+ aValue = theValue.SubString (1, aSplitPos - 1);
+ }
+ if (convertToDatumAttribute (aValue, anAttribute))
+ {
+ theAttributes.Append (anAttribute);
+ }
+ }
+
+ static bool convertToDatumAxes (const TCollection_AsciiString& theValue,
+ Prs3d_DatumAxes& theDatumAxes)
+ {
+ TCollection_AsciiString aValue = theValue;
+ aValue.LowerCase();
+ if (aValue == "x") theDatumAxes = Prs3d_DA_XAxis;
+ else if (aValue == "y") theDatumAxes = Prs3d_DA_YAxis;
+ else if (aValue == "z") theDatumAxes = Prs3d_DA_ZAxis;
+ else if (aValue == "xy") theDatumAxes = Prs3d_DA_XYAxis;
+ else if (aValue == "zy") theDatumAxes = Prs3d_DA_YZAxis;
+ else if (aValue == "xz") theDatumAxes = Prs3d_DA_XZAxis;
+ else if (aValue == "xyz") theDatumAxes = Prs3d_DA_XYZAxis;
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+
+ static Standard_Boolean setTrihedronParams (Standard_Integer theArgsNb,
+ const char** theArgVec,
+ Handle(AIS_Trihedron) theTrihedron)
+ {
+ NCollection_DataMap<TCollection_AsciiString, Handle(TColStd_HSequenceOfAsciiString)> aMapOfArgs;
+ TCollection_AsciiString aParseKey;
+ for (Standard_Integer anArgIt = 1; anArgIt < theArgsNb; ++anArgIt)
+ {
+ TCollection_AsciiString anArg (theArgVec [anArgIt]);
+ if (anArg.Value (1) == '-'
+ && !anArg.IsRealValue())
+ {
+ aParseKey = anArg;
+ aParseKey.Remove (1);
+ aParseKey.LowerCase();
+ std::string aKey = aParseKey.ToCString();
+ aMapOfArgs.Bind (aParseKey, new TColStd_HSequenceOfAsciiString());
+ continue;
+ }
+
+ if (aParseKey.IsEmpty())
+ {
+ continue;
+ }
+
+ aMapOfArgs (aParseKey)->Append (anArg);
+ }
+
+ // Check parameters
+ if ((aMapOfArgs.IsBound ("xaxis") && !aMapOfArgs.IsBound ("zaxis"))
+ || (!aMapOfArgs.IsBound ("xaxis") && aMapOfArgs.IsBound ("zaxis")))
+ {
+ std::cout << "Syntax error: -xaxis and -zaxis parameters are to set together.\n";
+ return Standard_False;
+ }
+
+ Handle(TColStd_HSequenceOfAsciiString) aValues;
+ Handle(Geom_Axis2Placement) aComponent = theTrihedron->Component();
+ if (aMapOfArgs.Find ("origin", aValues))
+ {
+ aComponent->SetLocation (gp_Pnt (aValues->Value (1).RealValue(),
+ aValues->Value (2).RealValue(),
+ aValues->Value (3).RealValue()));
+ }
+ Handle(TColStd_HSequenceOfAsciiString) aXValues, aZValues;
+ if (aMapOfArgs.Find ("xaxis", aXValues) && aMapOfArgs.Find ("zaxis", aZValues))
+ {
+ gp_Dir aXDir (aXValues->Value (1).RealValue(),
+ aXValues->Value (2).RealValue(),
+ aXValues->Value (3).RealValue());
+
+ gp_Dir aZDir (aZValues->Value (1).RealValue(),
+ aZValues->Value (2).RealValue(),
+ aZValues->Value (3).RealValue());
+
+ if (!aZDir.IsNormal (aXDir, M_PI / 180.0))
+ {
+ std::cout << "Syntax error - parameters 'xaxis' and 'zaxis' are not applied as VectorX is not normal to VectorZ\n";
+ return Standard_False;
+ }
+
+ aComponent->SetXDirection(aXDir);
+ aComponent->SetDirection (aZDir);
+ }
+
+ if (aMapOfArgs.Find ("dispmode", aValues))
+ {
+ TCollection_AsciiString aValue (aValues->Value (1));
+ bool isWireframe = true;
+ if (aValue.IsEqual ("sh") || aValue.IsEqual ("shading"))
+ isWireframe = false;
+ theTrihedron->SetDatumDisplayMode (isWireframe ? Prs3d_DM_WireFrame
+ : Prs3d_DM_Shaded);
+ }
+
+ if (aMapOfArgs.Find ("hidelabels", aValues))
+ {
+ if (aValues->Size() == 0)
+ {
+ std::cout << "Syntax error: -hidelabels expects parameter 'on' or 'off' after.\n";
+ return Standard_False;
+ }
+
+ Standard_Boolean toHideLabels = Standard_True;
+ ViewerTest::ParseOnOff (aValues->Value (1).ToCString(), toHideLabels);
+ if (!theTrihedron->Attributes()->HasOwnDatumAspect())
+ theTrihedron->Attributes()->SetDatumAspect(new Prs3d_DatumAspect());
+ theTrihedron->Attributes()->DatumAspect()->SetToDrawLabels (!toHideLabels);
+ }
+
+ if (aMapOfArgs.Find ("color", aValues))
+ {
+ NCollection_List<Prs3d_DatumParts> aParts;
+ if (aValues->Size() < 2)
+ {
+ std::cout << "Syntax error: -color wrong parameters.\n";
+ return Standard_False;
+ }
+
+ convertToDatumParts (aValues->Value(1), aParts);
+ aValues->Remove (1); // datum part is processed
+ Quantity_Color aColor;
+ if (!convertToColor (aValues, aColor))
+ {
+ std::cout << "Syntax error: -color wrong parameters.\n";
+ return Standard_False;
+ }
+
+ for (NCollection_List<Prs3d_DatumParts>::Iterator anIterator (aParts); anIterator.More(); anIterator.Next())
+ {
+ Prs3d_DatumParts aDatumPart = anIterator.Value();
+ if (aDatumPart == Prs3d_DP_None)
+ {
+ theTrihedron->SetColor (aColor);
+ }
+ else
+ {
+ theTrihedron->SetDatumPartColor (aDatumPart, aColor);
+ }
+ }
+ }
+
+ if (aMapOfArgs.Find ("textcolor", aValues))
+ {
+ Quantity_Color aColor;
+ if (!convertToColor (aValues, aColor))
+ {
+ std::cout << "Syntax error: -textcolor wrong parameters.\n";
+ return Standard_False;
+ }
+ theTrihedron->SetTextColor (aColor);
+ }
+
+ if (aMapOfArgs.Find ("arrowcolor", aValues))
+ {
+ Quantity_Color aColor;
+ if (!convertToColor (aValues, aColor))
+ {
+ std::cout << "Syntax error: -arrowcolor wrong parameters.\n";
+ return Standard_False;
+ }
+ theTrihedron->SetArrowColor (aColor);
+ }
+
+ if (aMapOfArgs.Find ("attribute", aValues))
+ {
+ NCollection_List<Prs3d_DatumAttribute> anAttributes;
+ if (aValues->Size() != 2)
+ {
+ std::cout << "Syntax error: -attribute wrong parameters.\n";
+ return Standard_False;
+ }
+
+ convertToDatumAttributes (aValues->Value (1), anAttributes);
+ if (!theTrihedron->Attributes()->HasOwnDatumAspect())
+ theTrihedron->Attributes()->SetDatumAspect(new Prs3d_DatumAspect());
+ for (NCollection_List<Prs3d_DatumAttribute>::Iterator anIterator (anAttributes); anIterator.More(); anIterator.Next())
+ {
+ theTrihedron->Attributes()->DatumAspect()->SetAttribute (anIterator.Value(), aValues->Value (2).RealValue());
+ }
+ }
+
+ if (aMapOfArgs.Find ("priority", aValues))
+ {
+ Prs3d_DatumParts aDatumPart;
+ if (aValues->Size() < 2
+ || !convertToDatumPart (aValues->Value (1), aDatumPart))
+ {
+ std::cout << "Syntax error: -priority wrong parameters.\n";
+ return Standard_False;
+ }
+ theTrihedron->SetSelectionPriority (aDatumPart, aValues->Value (2).IntegerValue());
+ }
+
+ if (aMapOfArgs.Find ("labels", aValues))
+ {
+ Prs3d_DatumParts aDatumPart = Prs3d_DP_None;
+ if (aValues->Size() > 2
+ && convertToDatumPart(aValues->Value(1), aDatumPart)
+ && aDatumPart >= Prs3d_DP_XAxis
+ && aDatumPart <= Prs3d_DP_ZAxis) // labels are set to axes only
+ {
+ theTrihedron->SetLabel (aDatumPart, aValues->Value (2));
+ }
+ else
+ {
+ std::cout << "Syntax error: -labels wrong parameters.\n";
+ return Standard_False;
+ }
+ }
+
+ if (aMapOfArgs.Find ("drawaxes", aValues))
+ {
+ Prs3d_DatumAxes aDatumAxes = Prs3d_DA_XAxis;
+ if (aValues->Size() < 1
+ || !convertToDatumAxes (aValues->Value (1), aDatumAxes))
+ {
+ std::cout << "Syntax error: -drawaxes wrong parameters.\n";
+ return Standard_False;
+ }
+ if (!theTrihedron->Attributes()->HasOwnDatumAspect())
+ theTrihedron->Attributes()->SetDatumAspect(new Prs3d_DatumAspect());
+ theTrihedron->Attributes()->DatumAspect()->SetDrawDatumAxes (aDatumAxes);
+ }
+ return Standard_True;
+ }
+}
+
//==============================================================================
//function : Vtrihedron 2d
//purpose : Create a plane with a 2D trihedron from a faceselection
//Draw arg : vtri2d name
//==============================================================================
-#include <AIS_PlaneTrihedron.hxx>
static int VTrihedron2D (Draw_Interpretor& /*theDI*/,
Standard_Integer theArgsNum,
const char** theArgVec)
return 0;
}
-
-
-//==============================================================================
-//function : VTriherdron
-//purpose : Create a trihedron. If no arguments are set, the default
-// trihedron (Oxyz) is created.
-//Draw arg : vtrihedron name [Xo] [Yo] [Zo] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw]
-//==============================================================================
-
-static int VTrihedron (Draw_Interpretor& /*theDi*/,
- Standard_Integer theArgsNb,
- const char** theArgVec)
+//=======================================================================
+//function : VTrihedron
+//purpose :
+//=======================================================================
+static int VTrihedron (Draw_Interpretor& ,
+ Standard_Integer theArgsNb,
+ const char** theArgVec)
{
- if (theArgsNb < 2 || theArgsNb > 11)
+ if (theArgsNb < 2)
{
- std::cout << theArgVec[0] << " syntax error\n";
+ std::cout << "Syntax error: the wrong number of input parameters.\n";
return 1;
}
- // Parse parameters
- NCollection_DataMap<TCollection_AsciiString, Handle(TColStd_HSequenceOfAsciiString)> aMapOfArgs;
- TCollection_AsciiString aParseKey;
- for (Standard_Integer anArgIt = 1; anArgIt < theArgsNb; ++anArgIt)
- {
- TCollection_AsciiString anArg (theArgVec [anArgIt]);
-
- if (anArg.Value (1) == '-' && !anArg.IsRealValue())
- {
- aParseKey = anArg;
- aParseKey.Remove (1);
- aParseKey.LowerCase();
- aMapOfArgs.Bind (aParseKey, new TColStd_HSequenceOfAsciiString);
- continue;
- }
-
- if (aParseKey.IsEmpty())
- {
- continue;
- }
+ TCollection_AsciiString aName (theArgVec[1]);
+ gp_Pln aWorkingPlane;
+ Standard_Boolean toUpdate = Standard_True;
- aMapOfArgs(aParseKey)->Append (anArg);
- }
+ NCollection_DataMap<TCollection_AsciiString, Standard_Real> aRealParams;
+ NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStringParams;
- // Check parameters
- if ( (aMapOfArgs.IsBound ("xaxis") && !aMapOfArgs.IsBound ("zaxis"))
- || (!aMapOfArgs.IsBound ("xaxis") && aMapOfArgs.IsBound ("zaxis")) )
- {
- std::cout << theArgVec[0] << " error: -xaxis and -yaxis parameters are to set together.\n";
- return 1;
- }
-
- for (NCollection_DataMap<TCollection_AsciiString, Handle(TColStd_HSequenceOfAsciiString)>::Iterator aMapIt (aMapOfArgs);
- aMapIt.More(); aMapIt.Next())
+ Handle(AIS_Trihedron) aTrihedron;
+ if (GetMapOfAIS().IsBound2 (aName))
{
- const TCollection_AsciiString& aKey = aMapIt.Key();
- const Handle(TColStd_HSequenceOfAsciiString)& anArgs = aMapIt.Value();
-
- // Bool key, without arguments
- if (aKey.IsEqual ("hidelabels") && anArgs->IsEmpty())
- {
- continue;
- }
-
- if ( (aKey.IsEqual ("xaxis") || aKey.IsEqual ("zaxis") || aKey.IsEqual ("origin")) && anArgs->Length() == 3
- && anArgs->Value(1).IsRealValue() && anArgs->Value(2).IsRealValue() && anArgs->Value(3).IsRealValue() )
+ Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
+ aTrihedron = Handle(AIS_Trihedron)::DownCast (anObject);
+ if (aTrihedron.IsNull())
{
- continue;
+ std::cout << "Syntax error: no trihedron with this name.\n";
+ return 1;
}
}
-
- // Process parameters
- gp_Pnt anOrigin (0.0, 0.0, 0.0);
- gp_Dir aDirZ = gp::DZ();
- gp_Dir aDirX = gp::DX();
-
- Handle(TColStd_HSequenceOfAsciiString) aValues;
-
- if (aMapOfArgs.Find ("origin", aValues))
+ else
{
- anOrigin.SetX (aValues->Value(1).RealValue());
- anOrigin.SetY (aValues->Value(2).RealValue());
- anOrigin.SetZ (aValues->Value(3).RealValue());
+ Handle(Geom_Axis2Placement) aPlacement = new Geom_Axis2Placement (gp_Pnt (0.0, 0.0, 0.0),
+ gp::DZ(), gp::DX());
+ aTrihedron = new AIS_Trihedron (aPlacement);
}
- Handle(TColStd_HSequenceOfAsciiString) aValues2;
- if (aMapOfArgs.Find ("xaxis", aValues) && aMapOfArgs.Find ("zaxis", aValues2))
+ if (!setTrihedronParams (theArgsNb, theArgVec, aTrihedron))
{
- Standard_Real aX = aValues->Value(1).RealValue();
- Standard_Real aY = aValues->Value(2).RealValue();
- Standard_Real aZ = aValues->Value(3).RealValue();
- aDirX.SetCoord (aX, aY, aZ);
-
- aX = aValues->Value(1).RealValue();
- aY = aValues->Value(2).RealValue();
- aZ = aValues->Value(3).RealValue();
- aDirZ.SetCoord (aX, aY, aZ);
+ return 1;
}
- if (!aDirZ.IsNormal (aDirX, M_PI / 180.0))
+ // Redisplay a dimension after parameter changing.
+ if (ViewerTest::GetAISContext()->IsDisplayed (aTrihedron))
{
- std::cout << theArgVec[0] << " error - VectorX is not normal to VectorZ\n";
- return 1;
+ ViewerTest::GetAISContext()->Redisplay (aTrihedron, toUpdate);
}
-
- Handle(Geom_Axis2Placement) aPlacement = new Geom_Axis2Placement (anOrigin, aDirZ, aDirX);
- Handle(AIS_Trihedron) aShape = new AIS_Trihedron (aPlacement);
-
- if (aMapOfArgs.Find ("hidelabels", aValues))
+ else
{
- const Handle(Prs3d_Drawer)& aDrawer = aShape->Attributes();
-
- if(!aDrawer->HasOwnDatumAspect())
- {
- Handle(Prs3d_DatumAspect) aDefAspect = ViewerTest::GetAISContext()->DefaultDrawer()->DatumAspect();
-
- Handle(Prs3d_DatumAspect) aDatumAspect = new Prs3d_DatumAspect();
- aDatumAspect->FirstAxisAspect()->SetAspect (aDefAspect->FirstAxisAspect()->Aspect());
- aDatumAspect->SecondAxisAspect()->SetAspect (aDefAspect->SecondAxisAspect()->Aspect());
- aDatumAspect->ThirdAxisAspect()->SetAspect (aDefAspect->ThirdAxisAspect()->Aspect());
- aDatumAspect->SetAxisLength (aDefAspect->FirstAxisLength(),
- aDefAspect->SecondAxisLength(),
- aDefAspect->ThirdAxisLength());
-
- aDrawer->SetDatumAspect (aDatumAspect);
- }
-
- aDrawer->DatumAspect()->SetToDrawLabels (Standard_False);
+ VDisplayAISObject (theArgVec[1], aTrihedron);
}
- VDisplayAISObject (theArgVec[1], aShape);
return 0;
}
void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
{
const char *group ="AISObjects";
- theCommands.Add("vtrihedron",
- "vtrihedron : vtrihedron name [ -origin x y z ] [ -zaxis u v w -xaxis u v w ] [ -hidelabels ]"
- "\n\t\t: Creates a new *AIS_Trihedron* object. If no argument is set, the default trihedron (0XYZ) is created."
- "\n\t\t: -hidelabels allows to draw trihedron without axes labels. By default, they are displayed.",
- __FILE__,VTrihedron,group);
+
+ theCommands.Add ("vtrihedron",
+ "vtrihedron : vtrihedron name"
+ "\n\t\t: [-dispMode {wireframe|shading} ]"
+ "\n\t\t: [-origin x y z ]"
+ "\n\t\t: [-zaxis u v w -xaxis u v w ]"
+ "\n\t\t: [-drawaxes {X|Y|Z|XY|YZ|XZ|XYZ}]"
+ "\n\t\t: [-hidelabels {on|off}]"
+ "\n\t\t: [-label {XAxis|YAxis|ZAxis} value]"
+ "\n\t\t: [-attribute {XAxisLength|YAxisLength|ZAxisLength"
+ "\n\t\t: |TubeRadiusPercent|ConeRadiusPercent"
+ "\n\t\t: |ConeLengthPercent|OriginRadiusPercent"
+ "\n\t\t: |ShadingNumberOfFacettes} value]"
+ "\n\t\t: [-color {Origin|XAxis|YAxis|ZAxis|XOYAxis|YOZAxis"
+ "\n\t\t: |XOZAxis|Whole} {r g b | colorName}]"
+ "\n\t\t: [-textcolor {r g b | colorName}]"
+ "\n\t\t: [-arrowscolor {r g b | colorName}]"
+ "\n\t\t: [-priority {Origin|XAxis|YAxis|ZAxis|XArrow"
+ "\n\t\t: |YArrow|ZArrow|XOYAxis|YOZAxis"
+ "\n\t\t: |XOZAxis|Whole} value]"
+ "\n\t\t:"
+ "\n\t\t: Creates a new *AIS_Trihedron* object or changes parameters of "
+ "\n\t\t: existing trihedron. If no argument is set,"
+ "\n\t\t: the default trihedron (0XYZ) is created."
+ "\n\t\t: -dispMode mode of visualization: wf - wireframe,"
+ "\n\t\t: sh - shading."
+ "\n\t\t: Default value is wireframe."
+ "\n\t\t: -origin allows to set trihedron location."
+ "\n\t\t: -zaxis/-xaxis allows to set trihedron X and Z"
+ "\n\t\t: directions. The directions should"
+ "\n\t\t: be orthogonal. Y direction is calculated."
+ "\n\t\t: -drawaxes allows to set what axes are drawn in the"
+ "\n\t\t: trihedron, default state is XYZ"
+ "\n\t\t: -hidelabels allows to hide or show trihedron labels"
+ "\n\t\t: -labels allows to change default X/Y/Z titles of axes"
+ "\n\t\t: -attribute sets parameters of trihedron"
+ "\n\t\t: -color sets color properties of parts of trihedron"
+ "\n\t\t: -textcolor sets color properties of trihedron labels"
+ "\n\t\t: -arrowscolor sets color properties of trihedron arrows"
+ "\n\t\t: -priority allows to change default selection priority"
+ "\n\t\t: of trihedron components",
+ __FILE__,VTrihedron,group);
theCommands.Add("vtri2d",
"vtri2d Name"
set format PDF
-set size 10343
+set size 9070
+
set format PS
-set size 10646
+set size 9550
+
set format EPS
-set size 10590
+set size 9500
set format SVG
-set size 14042
+set size 12120
set format PGF
-set size 20398
+set size 17800
vexport ${aFile} PDF
if { [checkplatform -windows] } {
- set refsize 10131
+ set refsize 9087
} else {
- set refsize 10107
+ set refsize 9063
}
if { [file exists ${aFile}] } {
vexport ${aFile} PS
if { [checkplatform -windows] } {
- set refsize 10410
+ set refsize 9568
} else {
- set refsize 10386
+ set refsize 9544
}
if { [file exists ${aFile}] } {
vexport ${aFile} EPS
if { [checkplatform -windows] } {
- set refsize 10354
+ set refsize 9512
} else {
- set refsize 10330
+ set refsize 9488
}
if { [file exists ${aFile}] } {
vexport ${aFile} SVG
if { [checkplatform -windows] } {
- set refsize 14091
+ set refsize 12127
} else {
- set refsize 14207
+ set refsize 12113
}
if { [file exists ${aFile}] } {
vexport ${aFile} PGF
if { [checkplatform -windows] } {
- set refsize 20810
+ set refsize 17918
} else {
- set refsize 20438
+ set refsize 17794
}
if { [file exists ${aFile}] } {
vdrawtext text0 $s -pos 0 0 0 -color 1.0 1.0 1.0 -halign left -valign bottom -angle 0 -zoom 0 -height 50 -aspect regular -font SansFont
vdump $::imagedir/$s
vtexture b $::imagedir/$s
-
+file delete $::imagedir/$s
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
vclear
vaxo
-vtrihedron t -hidelabels
+vtrihedron t -hidelabels on
vzoom 4
vdump $anImage1
--- /dev/null
+puts "==========="
+puts "OCC27958: Visualization - add a shading mode for AIS_Trihedron"
+puts "==========="
+puts ""
+
+pload VISUALIZATION
+vclear
+vinit View1
+
+vtrihedron t0
+
+vtrihedron t1
+vselprops -selColor 1.0 0.0 0.0
+vselmode t1 1 1
+
+vselmode t1 2 1
+vselmode t1 3 1
+
+vtrihedron t1 -dispmode shading
+vtrihedron t1 -origin -200 -200 -300
+vtrihedron t1 -attribute XAxisLength|YAxisLength|ZAxisLength 80
+vtrihedron t1 -xaxis 40 60 120 -zaxis -120 0 40
+
+vtrihedron t1 -attribute TubeRadiusPercent 0.03
+vtrihedron t1 -attribute ConeRadiusPercent|OriginRadiusPercent 0.05
+vtrihedron t1 -color XAxis Quantity_NOC_RED
+vtrihedron t1 -color YAxis Quantity_NOC_GREEN
+vtrihedron t1 -color ZAxis|Origin Quantity_NOC_BLUE1
+
+vtrihedron t1 -textcolor 1.0 1.0 1.0
+vtrihedron t1 -arrowcolor 0.0 0.0 1.0
+
+vtrihedron t2 -origin 0 0 -300
+vtrihedron t2 -color Whole Quantity_NOC_PEACHPUFF
+vselmode t2 1 1
+vselmode t2 2 1
+vselmode t2 3 1
+
+vtrihedron t3 -dispmode shading -origin 200 200 -300 -color Whole 1.0 0.0 0.0
+vtrihedron t3 -drawaxes XY -hidelabels on
+
+vfit
+
+vdump $::imagedir/${::casename}.png
+++ /dev/null
-puts "TODO ?OCC12345 MacOS: Error : Colors are not equal"
-
-puts "================"
-puts "BUC61018"
-puts "OCC64"
-puts "================"
-puts ""
-
-set x_coord 205
-set y_coord 205
-
-vinit
-vtrihedron tri
-vtri_orig tri
-
-vmoveto 205 205
-
-checkcolor $x_coord $y_coord 0 1 1
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png