#include <AIS_Trihedron.hxx>
#include <AIS_Axis.hxx>
#include <gp_Trsf.hxx>
+#include <gp_Quaternion.hxx>
#include <TopLoc_Location.hxx>
#include <HLRAlgo_Projector.hxx>
#include <TColStd_HArray1OfAsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
-#if defined(_MSC_VER)
-# define _CRT_SECURE_NO_DEPRECATE
-# pragma warning (disable:4996)
-#endif
-
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theName,
const Handle(AIS_InteractiveObject)& theAISObj,
extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
extern Handle(AIS_InteractiveContext)& TheAISContext();
-
//==============================================================================
//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)
+{
+ if (theArgsNum != 2)
+ {
+ std::cerr << theArgVec[0]<< " error.\n";
+ return 1;
+ }
+ TopTools_ListOfShape aShapes;
+ ViewerTest::GetSelectedShapes (aShapes);
+ if (aShapes.Extent() != 1)
+ {
+ std::cerr << "Error: wrong number of selected shapes.\n";
+ return 1;
+ }
-static int VTrihedron2D (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+ const TopoDS_Shape& aShape = aShapes.First();
-{
- // Verification des arguments
- if ( argc!=2) {di<<argv[0]<<" error\n"; return 1;}
+ TopoDS_Face aFace = TopoDS::Face (aShape);
+ TopExp_Explorer aFaceExp (aFace, TopAbs_EDGE);
+ TopoDS_Edge anEdge0 = TopoDS::Edge (aFaceExp.Current());
- // Declarations
- Standard_Integer myCurrentIndex;
- // Fermeture des contextes
- TheAISContext()->CloseAllContexts();
- // Ouverture d'un contexte local et recuperation de son index.
- TheAISContext()->OpenLocalContext();
- myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
- // On active les modes de selections faces.
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
- di<<" Select a face .\n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // fin de la boucle
-
- TopoDS_Shape ShapeB;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeB = TheAISContext()->SelectedShape();
- }
-
- TopoDS_Face FaceB=TopoDS::Face(ShapeB);
-
- // Construction du Plane
- // recuperation des edges des faces.
- TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
-
- TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
- // declarations
gp_Pnt A,B,C;
-
- // si il y a plusieurs edges
- if (FaceExpB.More() ) {
- FaceExpB.Next();
- TopoDS_Edge EdgeC=TopoDS::Edge(FaceExpB.Current() );
- BRepAdaptor_Curve theCurveB(EdgeB);
- BRepAdaptor_Curve theCurveC(EdgeC);
- A=theCurveC.Value(0.1);
- B=theCurveC.Value(0.9);
- C=theCurveB.Value(0.5);
+ if (aFaceExp.More())
+ {
+ aFaceExp.Next();
+ TopoDS_Edge anEdge1 = TopoDS::Edge (aFaceExp.Current() );
+ BRepAdaptor_Curve aCurve0 (anEdge0);
+ BRepAdaptor_Curve aCurve1 (anEdge1);
+ A = aCurve1.Value (0.1);
+ B = aCurve1.Value (0.9);
+ C = aCurve0.Value (0.5);
}
- else {
- // FaceB a 1 unique edge courbe
- BRepAdaptor_Curve theCurveB(EdgeB);
- A=theCurveB.Value(0.1);
- B=theCurveB.Value(0.9);
- C=theCurveB.Value(0.5);
+ else
+ {
+ BRepAdaptor_Curve aCurve0 (anEdge0);
+ A = aCurve0.Value (0.1);
+ B = aCurve0.Value (0.9);
+ C = aCurve0.Value (0.5);
}
- // Construction du Geom_Plane
- GC_MakePlane MkPlane(A,B,C);
- Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
- // Construction de l'AIS_PlaneTrihedron
- Handle(AIS_PlaneTrihedron) theAISPlaneTri= new AIS_PlaneTrihedron(theGeomPlane );
+ GC_MakePlane aMkPlane (A,B,C);
- // Fermeture du contexte local.
- TheAISContext()->CloseLocalContext(myCurrentIndex);
+ Handle(AIS_PlaneTrihedron) anAISPlaneTri = new AIS_PlaneTrihedron (aMkPlane.Value());
+ TCollection_AsciiString aName (theArgVec[1]);
- // on le display & bind
- TheAISContext()->Display(theAISPlaneTri );
- GetMapOfAIS().Bind ( theAISPlaneTri ,argv[1]);
+ VDisplayAISObject (aName, anAISPlaneTri);
return 0;
}
else if (argc==2) {ThereIsName=Standard_False;value=Draw::Atof(argv[1]);}
else {ThereIsName=Standard_True;value=Draw::Atof(argv[2]);}
- // On ferme le contexte local pour travailler dans le contexte global
- if(TheAISContext()->HasOpenedContext())
- TheAISContext()->CloseLocalContext();
-
// On set le booleen ThereIsCurrent
if (TheAISContext() -> NbSelected() > 0) {ThereIsCurrent=Standard_True;}
else {ThereIsCurrent=Standard_False;}
// Verification des arguments
if ( argc!=2) {di<<argv[0]<<" error\n"; return 1;}
- // Declarations
- Standard_Integer myCurrentIndex;
- // Fermeture des contextes locaux
- TheAISContext()->CloseAllContexts();
-
- // On recupere tous les trihedrons de la GetMapOfAIS()
- // et on active le mode de selection par face.
- // =================================================
-
- // Ouverture d'un contexte local et recuperation de son index.
- TheAISContext()->OpenLocalContext(Standard_False);
- myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
-
- ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
- it (GetMapOfAIS());
- while(it.More()){
- Handle(AIS_InteractiveObject) ShapeA =
- Handle(AIS_InteractiveObject)::DownCast(it.Key1());
- // On verifie que c'est bien un trihedron
- if (!ShapeA.IsNull() &&
- ShapeA->Type()==AIS_KOI_Datum && ShapeA->Signature()==3 ) {
- // on le downcast
- Handle(AIS_Trihedron) TrihedronA =(Handle(AIS_Trihedron)::DownCast (ShapeA));
- // on le charge dans le contexte et on active le mode Plane.
- TheAISContext()->Load(TrihedronA,0,Standard_False);
- TheAISContext()->Activate(TrihedronA,3);
- }
- it.Next();
+ if (TheAISContext()->NbSelected() != 1)
+ {
+ std::cerr << "Error: Wrong number of selected shapes.\n";
+ return 1;
}
- di<<" Select a plane.\n";
- // Boucle d'attente waitpick.
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // fin de la boucle
-
- Handle(AIS_InteractiveObject) theIOB;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- theIOB = TheAISContext()->SelectedInteractive();
+ TheAISContext()->InitSelected();
+ Handle(AIS_InteractiveObject) aTest = TheAISContext()->SelectedInteractive();
+ Handle(AIS_Plane) aPlane = Handle(AIS_Plane)::DownCast (aTest);
+ if (aPlane.IsNull())
+ {
+ std::cerr << "Error: Selected shape is not a plane.\n";
+ return 1;
}
- // on le downcast
- Handle(AIS_Plane) PlaneB =(Handle(AIS_Plane)::DownCast (theIOB));
-
- // Fermeture du contexte local.
- TheAISContext()->CloseLocalContext(myCurrentIndex);
- // on le display & bind
- TheAISContext()->Display(PlaneB );
- GetMapOfAIS().Bind ( PlaneB ,argv[1]);
+ VDisplayAISObject (argv[1], aPlane);
return 0;
}
// Declarations
Standard_Boolean HasArg;
TCollection_AsciiString name;
- Standard_Integer MyCurrentIndex;
// Verification
if (argc<2 || argc>8 ) {di<<" Syntaxe error\n";return 1;}
else HasArg=Standard_False;
name=argv[1];
- // Fermeture des contextes
- TheAISContext()->CloseAllContexts();
+
+ TopTools_ListOfShape aShapes;
+ ViewerTest::GetSelectedShapes (aShapes);
// Cas ou il y a des arguments
// Purpose: Teste le constructeur AIS_Axis::AIS_Axis(x: Line from Geom)
Handle(Geom_Line) myLine=new Geom_Line (p1 ,myVect );
Handle(AIS_Axis) TheAxis=new AIS_Axis (myLine );
GetMapOfAIS().Bind (TheAxis,name);
- TheAISContext()->Display(TheAxis);
+ TheAISContext()->Display(TheAxis, Standard_True);
}
// Pas d'arguments
// fonction vaxis
// Purpose: Teste le constructeur AIS_Axis::AIS_Axis (x:Axis1Placement from Geom)
if ( !strcasecmp(argv[0], "vaxis")) {
- TheAISContext()->OpenLocalContext();
- MyCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
-
- // Active le mode edge et le mode vertex
- TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(1) );
- TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(2) );
- di<<" Select an edge or a vertex.\n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // fin de la boucle
-
- // recuperation de la shape.
- TopoDS_Shape ShapeA;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeA = TheAISContext()->SelectedShape();
- }
- // recuperation de l'AIS_InteractiveObject
- //Handle(AIS_InteractiveObject) myAISio=TheAISContext()->Current();
- // down cast en AIS_Point si sig et type
- // AIS_Point -> Geom_Pnt ....
-
- if (ShapeA.ShapeType()==TopAbs_VERTEX) {
- // on desactive le mode edge
- TheAISContext()->DeactivateStandardMode(AIS_Shape::SelectionType(2) );
- di<<" Select a different vertex.\n";
-
- TopoDS_Shape ShapeB;
- do {
- // Boucle d'attente waitpick.
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // fin de la boucle
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeB = TheAISContext()->SelectedShape();
- }
-
+ if (aShapes.Extent() != 2 && aShapes.Extent() != 1)
+ {
+ std::cerr << "Error: Wrong number of selected shapes.\n";
+ return 1;
+ }
- } while(ShapeB.IsSame(ShapeA) );
+ const TopoDS_Shape& aShapeA = aShapes.First();
+ if (aShapeA.ShapeType() == TopAbs_VERTEX)
+ {
+ if (aShapes.Extent() != 2)
+ {
+ std::cerr << "Error: Wron number of selected shapes.\n";
+ return 1;
+ }
- // Fermeture du context local
- TheAISContext()->CloseLocalContext(MyCurrentIndex);
+ const TopoDS_Shape& aShapeB = aShapes.Last();
+ if (aShapeB.ShapeType() != TopAbs_VERTEX)
+ {
+ std::cerr << "Syntax error: You should select two vertices or one edge.\n";
+ return 1;
+ }
// Construction de l'axe
- gp_Pnt A=BRep_Tool::Pnt(TopoDS::Vertex(ShapeA) );
- gp_Pnt B=BRep_Tool::Pnt(TopoDS::Vertex(ShapeB) );
- gp_Vec V (A,B);
- gp_Dir D (V);
+ gp_Pnt A = BRep_Tool::Pnt (TopoDS::Vertex (aShapeA));
+ gp_Pnt B = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
+ gp_Vec V (A,B);
+ gp_Dir D (V);
Handle(Geom_Axis1Placement) OrigineAndVect=new Geom_Axis1Placement (A,D);
Handle(AIS_Axis) TheAxis=new AIS_Axis (OrigineAndVect);
GetMapOfAIS().Bind (TheAxis,name);
- TheAISContext()->Display(TheAxis);
- }
- else {
- // Un unique edge (ShapeA) a ete picke
- // Fermeture du context local
- TheAISContext()->CloseLocalContext(MyCurrentIndex);
- // Constuction de l'axe
- TopoDS_Edge ed =TopoDS::Edge(ShapeA);
+ TheAISContext()->Display (TheAxis, Standard_True);
+ }
+ else
+ {
+ TopoDS_Edge ed =TopoDS::Edge (aShapeA);
TopoDS_Vertex Va,Vb;
TopExp::Vertices(ed,Va,Vb );
gp_Pnt A=BRep_Tool::Pnt(Va);
Handle(Geom_Axis1Placement) OrigineAndVect=new Geom_Axis1Placement (A,D);
Handle(AIS_Axis) TheAxis=new AIS_Axis (OrigineAndVect);
GetMapOfAIS().Bind (TheAxis,name);
- TheAISContext()->Display(TheAxis);
+ TheAISContext()->Display (TheAxis, Standard_True);
}
}
// Fonction axispara
// Purpose: Teste le constructeur AIS_Axis::AIS_Axis(x: Axis2Placement from Geom, y: TypeOfAxis from AIS)
- else if ( !strcasecmp(argv[0], "vaxispara")) {
-
- TheAISContext()->OpenLocalContext();
- MyCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
-
- // Active le mode edge
- TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(2) );
- di<<" Select an edge.\n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // fin de la boucle
-
- TopoDS_Shape ShapeA;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeA = TheAISContext()->SelectedShape();
- }
- // Active le mode vertex et deactive edges
- TheAISContext()->DeactivateStandardMode(AIS_Shape::SelectionType(2) );
- TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(1) );
- di<<" Select a vertex.\n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // fin de la boucle
-
- // On peut choisir un pnt sur l'edge
- TopoDS_Shape ShapeB;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeB = TheAISContext()->SelectedShape();
- }
- // Fermeture du context local
- TheAISContext()->CloseLocalContext(MyCurrentIndex);
+ else if ( !strcasecmp(argv[0], "vaxispara"))
+ {
+ if (aShapes.Extent() != 2)
+ {
+ std::cerr << "Error: Wrong number of selected shapes.\n";
+ return 1;
+ }
- // Construction de l'axe
- TopoDS_Edge ed=TopoDS::Edge(ShapeA) ;
- gp_Pnt B=BRep_Tool::Pnt(TopoDS::Vertex(ShapeB) );
+ const TopoDS_Shape& aShapeA = aShapes.First();
+ const TopoDS_Shape& aShapeB = aShapes.Last();
+ if (!(aShapeA.ShapeType() == TopAbs_EDGE
+ && aShapeB.ShapeType() == TopAbs_VERTEX))
+ {
+ std::cerr << "Syntax error: You should select face and then vertex.\n";
+ return 1;
+ }
+
+ TopoDS_Edge ed=TopoDS::Edge (aShapeA);
+ gp_Pnt B=BRep_Tool::Pnt(TopoDS::Vertex(aShapeB));
TopoDS_Vertex Va,Vc;
TopExp::Vertices(ed,Va,Vc );
gp_Pnt A=BRep_Tool::Pnt(Va);
Handle(Geom_Axis1Placement) OrigineAndVect=new Geom_Axis1Placement (B,D);
Handle(AIS_Axis) TheAxis=new AIS_Axis (OrigineAndVect);
GetMapOfAIS().Bind (TheAxis,name);
- TheAISContext()->Display(TheAxis);
+ TheAISContext()->Display (TheAxis, Standard_True);
}
// Fonction axisortho
- else {
- TheAISContext()->OpenLocalContext();
- MyCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
-
- // Active le mode edge
- TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(2) );
- di<<" Select an edge.\n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // fin de la boucle
-
- TopoDS_Shape ShapeA;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeA = TheAISContext()->SelectedShape();
- }
- // Active le mode vertex et deactive edges
- TheAISContext()->DeactivateStandardMode(AIS_Shape::SelectionType(2) );
- TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(1) );
- di<<" Slect a vertex.\n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // fin de la boucle
-
- // On peut choisir un pnt sur l'edge
- TopoDS_Shape ShapeB;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeB = TheAISContext()->SelectedShape();
- }
- // Fermeture du context local
- TheAISContext()->CloseLocalContext(MyCurrentIndex);
+ else
+ {
+ if (aShapes.Extent() != 2)
+ {
+ std::cerr << "Error: Wrong number of selected shapes.\n";
+ return 1;
+ }
+
+ const TopoDS_Shape& aShapeA = aShapes.First();
+ const TopoDS_Shape& aShapeB = aShapes.Last();
+ if (!(aShapeA.ShapeType() == TopAbs_EDGE
+ && aShapeB.ShapeType() == TopAbs_VERTEX))
+ {
+ std::cerr << "Syntax error: You should select face and then vertex.\n";
+ return 1;
+ }
// Construction de l'axe
- TopoDS_Edge ed=TopoDS::Edge(ShapeA) ;
- gp_Pnt B=BRep_Tool::Pnt(TopoDS::Vertex(ShapeB) );
+ TopoDS_Edge ed=TopoDS::Edge(aShapeA) ;
+ gp_Pnt B=BRep_Tool::Pnt(TopoDS::Vertex(aShapeB) );
TopoDS_Vertex Va,Vc;
TopExp::Vertices(ed,Va,Vc );
gp_Pnt A=BRep_Tool::Pnt(Va);
Handle(Geom_Axis1Placement) OrigineAndVect=new Geom_Axis1Placement (B,D);
Handle(AIS_Axis) TheAxis=new AIS_Axis (OrigineAndVect);
GetMapOfAIS().Bind (TheAxis,name);
- TheAISContext()->Display(TheAxis);
+ TheAISContext()->Display (TheAxis, Standard_True);
}
// Declarations
Standard_Boolean HasArg;
TCollection_AsciiString name;
- Standard_Integer myCurrentIndex;
// Verification
if (argc<2 || argc>5 ) {di<<" Syntaxe error\n";return 1;}
else HasArg=Standard_False;
name=argv[1];
- // Fermeture des contextes
- TheAISContext()->CloseAllContexts();
// Il y a des arguments: teste l'unique constructeur AIS_Pnt::AIS_Pnt(Point from Geom)
if (HasArg) {
Handle(Geom_CartesianPoint ) myGeomPoint= new Geom_CartesianPoint (thecoord[0],thecoord[1],thecoord[2]);
Handle(AIS_Point) myAISPoint=new AIS_Point(myGeomPoint );
GetMapOfAIS().Bind (myAISPoint,name);
- TheAISContext()->Display(myAISPoint);
+ TheAISContext()->Display (myAISPoint, Standard_True);
}
// Il n'a pas d'arguments
- else {
- TheAISContext()->OpenLocalContext();
- myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
-
- // Active le mode Vertex et Edges
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
- di<<" Select a vertex or an edge(build the middle)\n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // fin de la boucle
+ else
+ {
+ TopTools_ListOfShape aShapes;
+ ViewerTest::GetSelectedShapes (aShapes);
- TopoDS_Shape ShapeA;
- for (TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeA= TheAISContext()->SelectedShape();
+ if (aShapes.Extent() != 1)
+ {
+ std::cerr << "Error: Wrong number of selected shapes.\n";
+ std::cerr << "\tYou should select one edge or vertex.\n";
+ return 1;
}
- if (ShapeA.ShapeType()==TopAbs_VERTEX ) {
- // Un vertex a ete selectionne
- // Fermeture du context local
- TheAISContext()->CloseLocalContext(myCurrentIndex);
+ const TopoDS_Shape& aShapeA = aShapes.First();
- // Construction du point
- gp_Pnt A=BRep_Tool::Pnt(TopoDS::Vertex(ShapeA ) );
+ if (aShapeA.ShapeType()==TopAbs_VERTEX )
+ {
+ gp_Pnt A=BRep_Tool::Pnt(TopoDS::Vertex(aShapeA ) );
Handle(Geom_CartesianPoint) myGeomPoint= new Geom_CartesianPoint (A );
Handle(AIS_Point) myAISPoint = new AIS_Point (myGeomPoint );
GetMapOfAIS().Bind(myAISPoint,name);
- TheAISContext()->Display(myAISPoint);
+ TheAISContext()->Display (myAISPoint, Standard_True);
}
- else {
- // Un Edge a ete selectionne
- // Fermeture du context local
- TheAISContext()->CloseLocalContext(myCurrentIndex);
-
- // Construction du point milieu de l'edge
- TopoDS_Edge myEdge=TopoDS::Edge(ShapeA);
+ else
+ {
+ TopoDS_Edge myEdge=TopoDS::Edge(aShapeA);
TopoDS_Vertex myVertexA,myVertexB;
TopExp::Vertices (myEdge ,myVertexA ,myVertexB );
gp_Pnt A=BRep_Tool::Pnt(myVertexA );
Handle(Geom_CartesianPoint) myGeomPointM= new Geom_CartesianPoint ( (A.X()+B.X())/2 , (A.Y()+B.Y())/2 , (A.Z()+B.Z())/2 );
Handle(AIS_Point) myAISPointM = new AIS_Point (myGeomPointM );
GetMapOfAIS().Bind(myAISPointM,name);
- TheAISContext()->Display(myAISPointM);
+ TheAISContext()->Display (myAISPointM, Standard_True);
}
}
// Declarations
Standard_Boolean hasArg;
TCollection_AsciiString aName;
- Standard_Integer aCurrentIndex;
// Verification
if (argc<2 || argc>6 )
hasArg=Standard_False;
aName=argv[1];
- // Close all contexts
- TheAISContext()->CloseAllContexts();
// There are some arguments
if (hasArg)
anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
}
}
- TheAISContext()->Display(anAISPlane);
+ TheAISContext()->Display (anAISPlane, Standard_True);
}
// The first argument is an AIS_Axis
anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
}
}
- TheAISContext()->Display(anAISPlane);
+ TheAISContext()->Display (anAISPlane, Standard_True);
}
// The first argumnet is an AIS_Plane
anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
}
}
- TheAISContext()->Display(anAISPlane);
+ TheAISContext()->Display (anAISPlane, Standard_True);
}
// Error
else
// There are no arguments
else
{
+ TopTools_ListOfShape aShapes;
+ ViewerTest::GetSelectedShapes (aShapes);
+
// Function vplane
// Test the constructor AIS_Plane::AIS_Plane(Geom_Plane, Standard_Boolean )
if (!strcasecmp(argv[0], "vplane"))
{
- TheAISContext()->OpenLocalContext();
- aCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
-
- // Active modes Vertex, Edge and Face
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1));
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2));
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4));
- std::cout<<"Select a vertex, a face or an edge\n";
-
- // Wait for picking
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeA;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
+ if (aShapes.Extent() < 1 || aShapes.Extent() > 3)
{
- aShapeA = TheAISContext()->SelectedShape();
+ std::cerr << "Error: Wront number of selected shapes.\n";
+ std::cerr << "\tYou should one of variant: face, edge and vertex or three vertices.\n";
+ return 1;
}
- // aShapeA is a Vertex
- if (aShapeA.ShapeType()==TopAbs_VERTEX )
+ const TopoDS_Shape& aShapeA = aShapes.First();
+ if (aShapeA.ShapeType() == TopAbs_VERTEX)
{
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4));
- std::cout<<" Select an edge or a different vertex\n";
-
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeB;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
+ if (aShapes.Extent() == 2)
{
- aShapeB = TheAISContext()->SelectedShape();
- }
- // aShapeB is a Vertex
- if (aShapeB.ShapeType()==TopAbs_VERTEX)
- {
- // A and B are the same
- if (aShapeB.IsSame(aShapeA))
- {
- std::cout<<" vplane: error, same points selected\n";
- return 1;
- }
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(2));
- std::cout<<" Select a different vertex\n";
-
- // Wait for picking
- Standard_Integer argcccc = 5;
- const char *buffff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvvv = (const char **) buffff;
- while (ViewerMainLoop( argcccc, argvvvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeC;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
- {
- aShapeC = TheAISContext()->SelectedShape();
- }
- // aShapeC is the same as A or B
- if (aShapeC.IsSame(aShapeA)||aShapeC.IsSame(aShapeB))
+ const TopoDS_Shape& aShapeB = aShapes.Last();
+ if (aShapeB.ShapeType() != TopAbs_EDGE)
{
- std::cout<<" vplane: error, same points selected\n";
+ std::cerr << "Syntax error: Together with vertex should be edge.\n";
return 1;
}
- // Close the local context
- TheAISContext()->CloseLocalContext(aCurrentIndex);
-
- // Construction of plane
- gp_Pnt A = BRep_Tool::Pnt(TopoDS::Vertex(aShapeA));
- gp_Pnt B = BRep_Tool::Pnt(TopoDS::Vertex(aShapeB));
- gp_Pnt C = BRep_Tool::Pnt(TopoDS::Vertex(aShapeC));
- GC_MakePlane MkPlane(A, B, C);
- Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
- Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane);
- GetMapOfAIS().Bind (anAISPlane, aName);
- TheAISContext()->Display(anAISPlane);
- }
- // ShapeB is an edge
- else
- {
// Verify that the vertex is not on the edge ShapeB
TopoDS_Edge anEdgeB = TopoDS::Edge(aShapeB);
TopoDS_Vertex aVertA = TopoDS::Vertex(aShapeA);
}
else
{
- // Close the local context
- TheAISContext()->CloseLocalContext(aCurrentIndex);
- // Construction of plane
gp_Pnt A = BRep_Tool::Pnt(aVertA);
TopoDS_Vertex aVBa, aVBb;
TopExp::Vertices(anEdgeB ,aVBa ,aVBb);
Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane);
GetMapOfAIS().Bind (anAISPlane, aName);
- TheAISContext()->Display(anAISPlane);
+ TheAISContext()->Display (anAISPlane, Standard_True);
+ }
+ }
+ else if (aShapes.Extent() == 3)
+ {
+ TopTools_ListOfShape::Iterator anIter (aShapes);
+
+ anIter.Next();
+ const TopoDS_Shape& aShapeB = anIter.Value();
+
+ anIter.Next();
+ const TopoDS_Shape& aShapeC = anIter.Value();
+
+ if (!(aShapeB.ShapeType() == TopAbs_VERTEX
+ && aShapeC.ShapeType() == TopAbs_VERTEX))
+ {
+ std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ return 1;
}
+
+ gp_Pnt A = BRep_Tool::Pnt(TopoDS::Vertex(aShapeA));
+ gp_Pnt B = BRep_Tool::Pnt(TopoDS::Vertex(aShapeB));
+ gp_Pnt C = BRep_Tool::Pnt(TopoDS::Vertex(aShapeC));
+ GC_MakePlane MkPlane(A, B, C);
+ Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
+ Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane);
+ GetMapOfAIS().Bind (anAISPlane, aName);
+ TheAISContext()->Display (anAISPlane, Standard_True);
+ }
+ else
+ {
+ std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ return 1;
}
}
- // aShapeA is an edge
- else if (aShapeA.ShapeType()==TopAbs_EDGE)
+ else if (aShapeA.ShapeType() == TopAbs_EDGE)
{
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4));
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(2));
- std::cout<<" Select a vertex that don't belong to the edge\n";
-
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
+ if (aShapes.Extent() != 2)
+ {
+ std::cerr << "Error: wrong number of selected shapes.\n";
+ return 1;
+ }
- TopoDS_Shape aShapeB;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
+ const TopoDS_Shape& aShapeB = aShapes.Last();
+ if (aShapeB.ShapeType() != TopAbs_VERTEX)
{
- aShapeB = TheAISContext()->SelectedShape();
+ std::cerr << "Syntax error: Together with edge should be vertex.\n";
+ return 1;
}
- // aShapeB should be a Vertex
+
// Check that the vertex aShapeB is not on the edge
TopoDS_Edge anEdgeA = TopoDS::Edge(aShapeA);
TopoDS_Vertex aVertB = TopoDS::Vertex(aShapeB);
std::cout<<" vplane: error point is on the edge\n";
return 1;
}
- else
- {
- // Close the local context
- TheAISContext()->CloseLocalContext(aCurrentIndex);
- // Construction of plane
- gp_Pnt B = BRep_Tool::Pnt(aVertB);
- TopoDS_Vertex aVAa, aVAb;
- TopExp::Vertices(anEdgeA, aVAa, aVAb);
- gp_Pnt Aa = BRep_Tool::Pnt(aVAa);
- gp_Pnt Ab = BRep_Tool::Pnt(aVAb);
- GC_MakePlane MkPlane (B,Aa,Ab);
- Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
- Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane);
- GetMapOfAIS().Bind (anAISPlane ,aName);
- TheAISContext()->Display(anAISPlane);
- }
+
+ gp_Pnt B = BRep_Tool::Pnt(aVertB);
+ TopoDS_Vertex aVAa, aVAb;
+ TopExp::Vertices(anEdgeA, aVAa, aVAb);
+ gp_Pnt Aa = BRep_Tool::Pnt(aVAa);
+ gp_Pnt Ab = BRep_Tool::Pnt(aVAb);
+ GC_MakePlane MkPlane (B,Aa,Ab);
+ Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
+ Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane);
+ GetMapOfAIS().Bind (anAISPlane ,aName);
+ TheAISContext()->Display (anAISPlane, Standard_True);
}
- // aShapeA is a Face
- else
+ else if (aShapeA.ShapeType() == TopAbs_FACE)
{
- // Close the local context: nothing to select
- TheAISContext()->CloseLocalContext(aCurrentIndex);
- // Construction of plane
TopoDS_Face aFace = TopoDS::Face(aShapeA);
BRepAdaptor_Surface aSurface (aFace, Standard_False);
if (aSurface.GetType()==GeomAbs_Plane)
Handle(Geom_Plane) aGeomPlane = new Geom_Plane(aPlane);
Handle(AIS_Plane) anAISPlane = new AIS_Plane(aGeomPlane);
GetMapOfAIS().Bind (anAISPlane, aName);
- TheAISContext()->Display(anAISPlane);
+ TheAISContext()->Display (anAISPlane, Standard_True);
}
else
{
return 1;
}
}
+ else
+ {
+ std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ return 1;
+ }
}
// Function vPlanePara
// test the constructor AIS_Plane::AIS_Plane(Geom_Plane,gp_Pnt)
else if (!strcasecmp(argv[0], "vplanepara"))
{
- TheAISContext()->OpenLocalContext();
- aCurrentIndex = TheAISContext()->IndexOfCurrentLocal();
-
- // Activate modes Vertex and Face
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1));
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4));
- std::cout<<" Select a vertex or a face\n";
-
- // Wait for picking
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeA;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
+ if (aShapes.Extent() != 2)
{
- aShapeA = TheAISContext()->SelectedShape();
+ std::cerr << "Error: Wrong number of selected shapes.\n";
+ return 1;
}
- if (aShapeA.ShapeType()==TopAbs_VERTEX )
+ const TopoDS_Shape* aShapeA = &aShapes.First();
+ const TopoDS_Shape* aShapeB = &aShapes.Last();
+ if (aShapeA->ShapeType() != TopAbs_VERTEX)
{
- // aShapeA is a vertex
- // Deactivate the mode Vertex
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(1));
- std::cout<<" Select a face\n";
-
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeB;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
- {
- // A vertex ShapeA can be on Face ShapeB
- aShapeB = TheAISContext()->SelectedShape();
- }
+ std::swap (aShapeA, aShapeB);
+ }
- // Close the local context
- TheAISContext()->CloseLocalContext(aCurrentIndex);
+ if (!(aShapeA->ShapeType() == TopAbs_VERTEX
+ && aShapeB->ShapeType() == TopAbs_FACE))
+ {
+ std::cerr << "Syntax error: you should select face and vertex.\n";
+ return 1;
+ }
- // Construction of plane
- gp_Pnt A = BRep_Tool::Pnt(TopoDS::Vertex(aShapeA));
+ gp_Pnt A = BRep_Tool::Pnt(TopoDS::Vertex(*aShapeA));
- TopoDS_Face aFace = TopoDS::Face(aShapeB);
- BRepAdaptor_Surface aSurface (aFace, Standard_False);
- if (aSurface.GetType()==GeomAbs_Plane )
- {
- gp_Pln aPlane = aSurface.Plane();
- // Construct a plane parallel to aGeomPlane through A
- aPlane.SetLocation(A);
- Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPlane);
- Handle(AIS_Plane) aAISPlane = new AIS_Plane (aGeomPlane, A);
- GetMapOfAIS().Bind (aAISPlane ,aName);
- TheAISContext()->Display(aAISPlane);
- }
- else
- {
- std::cout<<" vplanepara: error\n";
- return 1;
- }
+ TopoDS_Face aFace = TopoDS::Face(*aShapeB);
+ BRepAdaptor_Surface aSurface (aFace, Standard_False);
+ if (aSurface.GetType() == GeomAbs_Plane)
+ {
+ gp_Pln aPlane = aSurface.Plane();
+ // Construct a plane parallel to aGeomPlane through A
+ aPlane.SetLocation(A);
+ Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPlane);
+ Handle(AIS_Plane) aAISPlane = new AIS_Plane (aGeomPlane, A);
+ GetMapOfAIS().Bind (aAISPlane ,aName);
+ TheAISContext()->Display (aAISPlane, Standard_True);
}
else
{
- // ShapeA is a Face
- // Deactive the mode Face
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4));
- std::cout<<" Select a vertex\n";
-
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeB;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
- {
- // A vertex ShapeB can be on Face ShapeA
- aShapeB = TheAISContext()->SelectedShape();
- }
- // Close the local context
- TheAISContext()->CloseLocalContext(aCurrentIndex);
-
- // Construction of plane
- gp_Pnt B = BRep_Tool::Pnt(TopoDS::Vertex(aShapeB));
-
- TopoDS_Face aFace=TopoDS::Face(aShapeA);
- BRepAdaptor_Surface aSurface (aFace, Standard_False);
- if (aSurface.GetType()==GeomAbs_Plane )
- {
- gp_Pln aPlane = aSurface.Plane();
- aPlane.SetLocation(B);
- Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPlane);
- // Construct a plane parallel to aGeomPlane through B
- Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane, B);
- GetMapOfAIS().Bind (anAISPlane, aName);
- TheAISContext()->Display(anAISPlane);
- }
- else
- {
- std::cout<<" vplanepara: error\n";return 1;
- }
+ std::cerr << "Error: Builded surface is not a plane.\n";
+ return 1;
}
}
// test the constructor AIS_Plane::AIS_Plane(Geom_Plane,gp_Pnt,gp_Pnt,gp_Pnt)
else
{
- TheAISContext()->OpenLocalContext();
- aCurrentIndex = TheAISContext()->IndexOfCurrentLocal();
-
- // Activate the modes Edge and Face
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2));
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4));
- std::cout<<" Select a face and an edge coplanar\n";
+ if (aShapes.Extent() != 2)
+ {
+ std::cerr << "Error: wrong number of selected shapes.\n";
+ return 1;
+ }
- // Wait for picking
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // end of the loop
+ const TopoDS_Shape* aShapeA = &aShapes.First();
+ const TopoDS_Shape* aShapeB = &aShapes.Last();
- TopoDS_Shape aShapeA;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
+ if (aShapeA->ShapeType() != TopAbs_EDGE)
{
- aShapeA = TheAISContext()->SelectedShape();
+ std::swap (aShapeA, aShapeB);
}
- if (aShapeA.ShapeType()==TopAbs_EDGE )
+ if (!(aShapeA->ShapeType() == TopAbs_EDGE
+ && aShapeB->ShapeType() == TopAbs_FACE))
{
- // ShapeA is an edge, deactivate the mode Edge...
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(2));
- std::cout<<" Select a face\n";
-
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeB;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
- {
- // Edge ShapeA can be on Face ShapeB
- aShapeB = TheAISContext()->SelectedShape();
- }
-
- // Close the local context
- TheAISContext()->CloseLocalContext(aCurrentIndex);
+ std::cerr << "Error: you should select edge and face.\n";
+ return 1;
+ }
- // Construction of plane
- TopoDS_Edge anEdgeA = TopoDS::Edge(aShapeA);
- TopoDS_Vertex aVAa, aVAb;
- TopExp::Vertices(anEdgeA, aVAa, aVAb);
- gp_Pnt Aa = BRep_Tool::Pnt(aVAa);
- gp_Pnt Ab = BRep_Tool::Pnt(aVAb);
- gp_Vec ab (Aa,Ab);
-
- gp_Dir Dab (ab);
- // Creation of rotation axis
- gp_Ax1 aRotAxis (Aa,Dab);
-
- TopoDS_Face aFace = TopoDS::Face(aShapeB);
- // The edge must be parallel to the face
- BRepExtrema_ExtPF aHeightA (aVAa, aFace);
- BRepExtrema_ExtPF aHeightB (aVAb, aFace);
- // Compare to heights
- if (fabs(sqrt(aHeightA.SquareDistance(1)) - sqrt(aHeightB.SquareDistance(1)))
- >Precision::Confusion())
- {
- // the edge is not parallel to the face
- std::cout<<" vplaneortho error: the edge is not parallel to the face\n";
- return 1;
- }
- // the edge is OK
- BRepAdaptor_Surface aSurface (aFace, Standard_False);
- if (aSurface.GetType()==GeomAbs_Plane)
- {
- gp_Pln aPlane = aSurface.Plane();
- // It rotates a half turn round the axis of rotation
- aPlane.Rotate(aRotAxis , M_PI/2);
+ // Construction of plane
+ TopoDS_Edge anEdgeA = TopoDS::Edge(*aShapeA);
+ TopoDS_Vertex aVAa, aVAb;
+ TopExp::Vertices(anEdgeA, aVAa, aVAb);
+ gp_Pnt Aa = BRep_Tool::Pnt(aVAa);
+ gp_Pnt Ab = BRep_Tool::Pnt(aVAb);
+ gp_Vec ab (Aa,Ab);
+
+ gp_Dir Dab (ab);
+ // Creation of rotation axis
+ gp_Ax1 aRotAxis (Aa,Dab);
+
+ TopoDS_Face aFace = TopoDS::Face(*aShapeB);
+ // The edge must be parallel to the face
+ BRepExtrema_ExtPF aHeightA (aVAa, aFace);
+ BRepExtrema_ExtPF aHeightB (aVAb, aFace);
+ // Compare to heights
+ if (fabs(sqrt(aHeightA.SquareDistance(1)) - sqrt(aHeightB.SquareDistance(1)))
+ >Precision::Confusion())
+ {
+ // the edge is not parallel to the face
+ std::cout<<" vplaneortho error: the edge is not parallel to the face\n";
+ return 1;
+ }
+ // the edge is OK
+ BRepAdaptor_Surface aSurface (aFace, Standard_False);
+ if (aSurface.GetType()==GeomAbs_Plane)
+ {
+ gp_Pln aPlane = aSurface.Plane();
+ // It rotates a half turn round the axis of rotation
+ aPlane.Rotate(aRotAxis , M_PI/2);
- Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPlane);
- // constructed aGeomPlane parallel to a plane containing the edge (center mid-edge)
- gp_Pnt aMiddle ((Aa.X()+Ab.X() )/2 ,(Aa.Y()+Ab.Y() )/2 ,(Aa.Z()+Ab.Z() )/2 );
- Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane, aMiddle);
- GetMapOfAIS().Bind (anAISPlane, aName);
- TheAISContext()->Display(anAISPlane);
- }
- else
- {
- std::cout<<" vplaneortho: error\n";
- return 1;
- }
+ Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPlane);
+ // constructed aGeomPlane parallel to a plane containing the edge (center mid-edge)
+ gp_Pnt aMiddle ((Aa.X()+Ab.X() )/2 ,(Aa.Y()+Ab.Y() )/2 ,(Aa.Z()+Ab.Z() )/2 );
+ Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane, aMiddle);
+ GetMapOfAIS().Bind (anAISPlane, aName);
+ TheAISContext()->Display (anAISPlane, Standard_True);
}
else
{
- // ShapeA is a Face, deactive the mode Face.
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4));
- std::cout<<" Select an edge\n";
-
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
-
- TopoDS_Shape aShapeB;
- for (TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected())
- {
- // Edge ShapeB can be on Face ShapeA
- aShapeB = TheAISContext()->SelectedShape();
- }
- // Close the local context
- TheAISContext()->CloseLocalContext(aCurrentIndex);
-
- // Construction of plane
- TopoDS_Edge anEdgeB = TopoDS::Edge(aShapeB);
- TopoDS_Vertex aVBa, aVBb;
- TopExp::Vertices(anEdgeB, aVBa, aVBb);
- gp_Pnt aBa = BRep_Tool::Pnt(aVBa);
- gp_Pnt aBb = BRep_Tool::Pnt(aVBb);
- gp_Vec ab (aBa,aBb);
- gp_Dir Dab (ab);
- // Creation of rotation axe
- gp_Ax1 aRotAxis (aBa,Dab);
-
- TopoDS_Face aFace = TopoDS::Face(aShapeA);
- // The edge must be parallel to the face
- BRepExtrema_ExtPF aHeightA (aVBa, aFace);
- BRepExtrema_ExtPF aHeightB (aVBb, aFace);
- // Comparing the two heights
- if (fabs(sqrt(aHeightA.SquareDistance(1)) - sqrt(aHeightB.SquareDistance(1)))
- >Precision::Confusion())
- {
- // the edge is not parallel to the face
- std::cout<<" vplaneortho error: the edge is not parallel to the face\n";
- return 1;
- }
- // The edge is OK
- BRepAdaptor_Surface aSurface (aFace, Standard_False);
- if (aSurface.GetType()==GeomAbs_Plane)
- {
- gp_Pln aPlane = aSurface.Plane();
- // It rotates a half turn round the axis of rotation
- aPlane.Rotate(aRotAxis , M_PI/2);
- Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPlane);
- // constructed aGeomPlane parallel to a plane containing the edge theGeomPlane (center mid-edge)
- gp_Pnt aMiddle ((aBa.X()+aBb.X() )/2 , (aBa.Y()+aBb.Y() )/2 , (aBa.Z()+aBb.Z() )/2 );
- Handle(AIS_Plane) anAISPlane = new AIS_Plane (aGeomPlane, aMiddle);
- GetMapOfAIS().Bind (anAISPlane ,aName);
- TheAISContext()->Display(anAISPlane);
- }
- else
- {
- std::cout<<" vplaneortho: error\n";
- return 1;
- }
+ std::cout<<" vplaneortho: error\n";
+ return 1;
}
}
}
static int VLineBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
- Standard_Integer myCurrentIndex;
// Verifications
if (argc!=4 && argc!=8 && argc!=2 ) {di<<"vline error: number of arguments not correct \n";return 1; }
- // Fermeture des contextes
- TheAISContext()->CloseAllContexts();
// On recupere les parametres
Handle(AIS_InteractiveObject) theShapeA;
// Les deux points sont OK...Construction de l'AIS_Line (en faite, le segment AB)
Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
GetMapOfAIS().Bind(theAISLine,argv[1] );
- TheAISContext()->Display(theAISLine );
+ TheAISContext()->Display (theAISLine, Standard_True);
}
Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
GetMapOfAIS().Bind(theAISLine,argv[1] );
- TheAISContext()->Display(theAISLine );
+ TheAISContext()->Display (theAISLine, Standard_True);
}
// Pas de parametres: Selection dans le viewer.
// ============================================
- else {
- TheAISContext()->OpenLocalContext();
- myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
-
- // Active le mode Vertex.
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
- di<<" Select a vertex \n";
-
- // Boucle d'attente waitpick.
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // fin de la boucle
-
- TopoDS_Shape ShapeA;
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeA = TheAISContext()->SelectedShape();
+ else
+ {
+ TopTools_ListOfShape aShapes;
+ ViewerTest::GetSelectedShapes (aShapes);
+ if (aShapes.Extent() != 2)
+ {
+ std::cerr << "Error: wrong number of selected shapes.\n";
+ return 1;
}
- // ShapeA est un Vertex
- if (ShapeA.ShapeType()==TopAbs_VERTEX ) {
-
- di<<" Select a different vertex.\n";
-
- TopoDS_Shape ShapeB;
- do {
+ const TopoDS_Shape& aShapeA = aShapes.First();
+ const TopoDS_Shape& aShapeB = aShapes.Last();
- // Boucle d'attente waitpick.
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // fin de la boucle
-
- for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- ShapeB = TheAISContext()->SelectedShape();
- }
-
-
- } while(ShapeB.IsSame(ShapeA) );
-
- // Fermeture du context local
- TheAISContext()->CloseLocalContext(myCurrentIndex);
-
- // Construction de la line
- gp_Pnt A=BRep_Tool::Pnt(TopoDS::Vertex(ShapeA) );
- gp_Pnt B=BRep_Tool::Pnt(TopoDS::Vertex(ShapeB) );
-
- Handle(Geom_CartesianPoint ) myCartPointA=new Geom_CartesianPoint(A);
- Handle(Geom_CartesianPoint ) myCartPointB=new Geom_CartesianPoint(B);
+ if (!(aShapeA.ShapeType() == TopAbs_VERTEX
+ && aShapeB.ShapeType() == TopAbs_VERTEX))
+ {
+ std::cerr << "Error: you should select two different vertex.\n";
+ return 1;
+ }
- Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
- GetMapOfAIS().Bind(theAISLine,argv[1] );
- TheAISContext()->Display(theAISLine );
+ // Construction de la line
+ gp_Pnt A = BRep_Tool::Pnt (TopoDS::Vertex (aShapeA));
+ gp_Pnt B = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
- }
- else {
- di<<"vline error.\n";
- }
+ Handle(Geom_CartesianPoint ) myCartPointA=new Geom_CartesianPoint(A);
+ Handle(Geom_CartesianPoint ) myCartPointB=new Geom_CartesianPoint(B);
+ Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
+ GetMapOfAIS().Bind(theAISLine,argv[1] );
+ TheAISContext()->Display (theAISLine, Standard_True);
}
return 0;
GetMapOfAIS().Bind(aCircle, theName);
// Display the circle
- TheAISContext()->Display(aCircle);
+ TheAISContext()->Display (aCircle, Standard_True);
}
static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const char** argv)
{
- Standard_Integer myCurrentIndex;
// Verification of the arguments
if (argc>6 || argc<2)
{
std::cout << "vcircle error: expect 4 arguments.\n";
return 1; // TCL_ERROR
}
- TheAISContext()->CloseAllContexts();
// There are all arguments
if (argc == 6)
{
// Get arguments
TCollection_AsciiString aName(argv[1]);
- Standard_Boolean isFilled = (Standard_Boolean)Draw::Atoi(argv[5]);
+ Standard_Boolean isFilled = Draw::Atoi(argv[5]) != 0;
Handle(AIS_InteractiveObject) theShapeA;
Handle(AIS_InteractiveObject) theShapeB;
// Get the name of the circle
TCollection_AsciiString aName(argv[1]);
- TheAISContext()->OpenLocalContext();
- myCurrentIndex = TheAISContext()->IndexOfCurrentLocal();
-
- // Activate selection mode for vertices and faces
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
- TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
- std::cout << " Select a vertex or a face\n";
-
- // Wait for picking
- Standard_Integer argcc = 5;
- const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvv = (const char **) buff;
- while (ViewerMainLoop( argcc, argvv) ) { }
- // end of the loop
-
- TopoDS_Shape ShapeA;
- for(TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected() )
+ TopTools_ListOfShape aShapes;
+ ViewerTest::GetSelectedShapes (aShapes);
+ if (aShapes.Extent() != 3 && aShapes.Extent() != 2)
{
- ShapeA = TheAISContext()->SelectedShape();
+ std::cerr << "Error: Wrong number of selected shapes.\n";
+ return 1;
}
- // ShapeA is a Vertex
- if (ShapeA.ShapeType() == TopAbs_VERTEX )
+ const TopoDS_Shape& aShapeA = aShapes.First();
+ if (aShapeA.ShapeType() == TopAbs_VERTEX )
{
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4) );
- std::cout << " Select a different vertex\n";
-
- TopoDS_Shape ShapeB;
- do
+ if (aShapes.Extent() != 3)
{
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
+ std::cerr << "Error: wrong number of selected shapes.\n";
+ return 1;
+ }
- for(TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected() )
- {
- ShapeB = TheAISContext()->SelectedShape();
- }
- } while(ShapeB.IsSame(ShapeA) );
+ TopTools_ListOfShape::Iterator anIter (aShapes);
- // Selection of ShapeC
- std::cout << " Select the last vertex\n";
- TopoDS_Shape ShapeC;
- do
- {
- // Wait for picking
- Standard_Integer argcccc = 5;
- const char *buffff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvvv = (const char **) buffff;
- while (ViewerMainLoop( argcccc, argvvvv) ) { }
- // end of the loop
+ anIter.Next();
+ const TopoDS_Shape& aShapeB = anIter.Value();
- for(TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected() )
- {
- ShapeC = TheAISContext()->SelectedShape();
- }
- } while(ShapeC.IsSame(ShapeA) || ShapeC.IsSame(ShapeB) );
+ anIter.Next();
+ const TopoDS_Shape& aShapeC = anIter.Value();
// Get isFilled
Standard_Boolean isFilled;
std::cout << "Enter filled status (0 or 1)\n";
cin >> isFilled;
- // Close the local context
- TheAISContext()->CloseLocalContext(myCurrentIndex);
-
// Construction of the circle
- gp_Pnt A = BRep_Tool::Pnt(TopoDS::Vertex(ShapeA));
- gp_Pnt B = BRep_Tool::Pnt(TopoDS::Vertex(ShapeB));
- gp_Pnt C = BRep_Tool::Pnt(TopoDS::Vertex(ShapeC));
+ gp_Pnt A = BRep_Tool::Pnt (TopoDS::Vertex (aShapeA));
+ gp_Pnt B = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
+ gp_Pnt C = BRep_Tool::Pnt (TopoDS::Vertex (aShapeC));
GC_MakeCircle Cir = GC_MakeCircle (A, B, C);
Handle (Geom_Circle) theGeomCircle;
DisplayCircle(theGeomCircle, aName, isFilled);
}
- // Shape is a face
- else
+ else if (aShapeA.ShapeType() == TopAbs_FACE)
{
- std::cout << " Select a vertex (in your face)\n";
- TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4) );
-
- TopoDS_Shape ShapeB;
- // Wait for picking
- Standard_Integer argccc = 5;
- const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
- const char **argvvv = (const char **) bufff;
- while (ViewerMainLoop( argccc, argvvv) ) { }
- // end of the loop
-
- for(TheAISContext()->InitSelected();
- TheAISContext()->MoreSelected();
- TheAISContext()->NextSelected() )
- {
- ShapeB = TheAISContext()->SelectedShape();
- }
+ const TopoDS_Shape& aShapeB = aShapes.Last();
// Recover the radius
Standard_Real theRad;
std::cout << "Enter filled status (0 or 1)\n";
cin >> isFilled;
- // Close the local context
- TheAISContext()->CloseLocalContext(myCurrentIndex);
- // Construction of the circle
-
// Recover the normal to the plane. tag
- TopoDS_Face myFace = TopoDS::Face(ShapeA);
+ TopoDS_Face myFace = TopoDS::Face(aShapeA);
BRepAdaptor_Surface mySurface (myFace, Standard_False);
gp_Pln myPlane = mySurface.Plane();
Handle(Geom_Plane) theGeomPlane = new Geom_Plane (myPlane);
gp_Dir theDir = thegpAxe.Direction();
// Recover the center
- gp_Pnt theCenter = BRep_Tool::Pnt(TopoDS::Vertex(ShapeB));
+ gp_Pnt theCenter = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
// Construct the circle
GC_MakeCircle Cir = GC_MakeCircle (theCenter, theDir ,theRad);
}
DisplayCircle(theGeomCircle, aName, isFilled);
-
}
-
+ else
+ {
+ std::cerr << "Error: You should select face and vertex or three vertices.\n";
+ return 1;
+ }
}
return 0;
Handle(AIS_TextLabel) aTextPrs;
ViewerTest_AutoUpdater anAutoUpdater (aContext, ViewerTest::CurrentView());
+ Standard_Boolean isNewPrs = Standard_False;
if (GetMapOfAIS().IsBound2 (aName))
{
- aTextPrs = Handle(AIS_TextLabel)::DownCast (GetMapOfAIS().Find2 (aName));
+ aTextPrs = Handle(AIS_TextLabel)::DownCast (GetMapOfAIS().Find2 (aName));
}
- else
+
+ if (aTextPrs.IsNull())
{
+ isNewPrs = Standard_True;
aTextPrs = new AIS_TextLabel();
aTextPrs->SetFont ("Courier");
}
aTextPrs->SetText (aText);
- Graphic3d_TransModeFlags aTrsfPersFlags = Graphic3d_TMF_None;
- gp_Pnt aTPPosition;
+ Handle(Graphic3d_TransformPers) aTrsfPers;
Aspect_TypeOfDisplayText aDisplayType = Aspect_TODT_NORMAL;
-
Standard_Boolean aHasPlane = Standard_False;
gp_Dir aNormal;
gp_Dir aDirection;
}
else if (aParam == "-2d")
{
- aTrsfPersFlags = Graphic3d_TMF_2d;
+ aTrsfPers = new Graphic3d_TransformPers (Graphic3d_TMF_2d);
}
else if (aParam == "-trsfperspos"
|| aParam == "-perspos")
++anArgIt;
}
}
- aTPPosition.SetCoord (aX.IntegerValue(), aY.IntegerValue(), aZ.IntegerValue());
+
+ aTrsfPers = Graphic3d_TransformPers::FromDeprecatedParams (Graphic3d_TMF_2d, gp_Pnt (aX.IntegerValue(), aY.IntegerValue(), aZ.IntegerValue()));
}
else
{
aTextPrs->SetDisplayType (aDisplayType);
- if (aTrsfPersFlags != Graphic3d_TMF_None)
+ if (!aTrsfPers.IsNull())
{
- aTextPrs->SetTransformPersistence (aTrsfPersFlags, aTPPosition);
+ aContext->SetTransformPersistence (aTextPrs, aTrsfPers);
aTextPrs->SetZLayer(Graphic3d_ZLayerId_TopOSD);
if (aTextPrs->Position().Z() != 0)
{
aTextPrs->SetPosition (gp_Pnt(aTextPrs->Position().X(), aTextPrs->Position().Y(), 0));
}
}
- else if (aTrsfPersFlags != aTextPrs->TransformPersistence().Flags)
+ else if (!aTextPrs->TransformPersistence().IsNull())
+ {
+ aContext->SetTransformPersistence (aTextPrs, Handle(Graphic3d_TransformPers)());
+ }
+
+ if (isNewPrs)
+ {
+ ViewerTest::Display (aName, aTextPrs, Standard_False);
+ }
+ else
{
- aTextPrs->SetTransformPersistence (aTrsfPersFlags);
+ aContext->Redisplay (aTextPrs, Standard_False, Standard_True);
}
- ViewerTest::Display (aName, aTextPrs, Standard_False);
return 0;
}
return 1;
}
- // close local context
- if (aContextAIS->HasOpenedContext ())
- aContextAIS->CloseLocalContext ();
-
Handle(HLRBRep_PolyAlgo) aPolyAlgo = new HLRBRep_PolyAlgo();
HLRBRep_PolyHLRToShape aHLRToShape;
// create an AIS shape and display it
Handle(AIS_Shape) anObject = new AIS_Shape (aHlrShape);
GetMapOfAIS().Bind (anObject, aHlrName);
- aContextAIS->Display (anObject);
+ aContextAIS->Display (anObject, Standard_False);
aContextAIS->UpdateCurrentViewer ();
return 0;
}
+namespace
+{
+ //! Auxiliary function for parsing translation vector - either 2D or 3D.
+ static Standard_Integer parseTranslationVec (Standard_Integer theArgNb,
+ const char** theArgVec,
+ gp_Vec& theVec)
+ {
+ if (theArgNb < 2)
+ {
+ return 0;
+ }
+
+ TCollection_AsciiString anX (theArgVec[0]);
+ TCollection_AsciiString anY (theArgVec[1]);
+ if (!anX.IsRealValue()
+ || !anY.IsRealValue())
+ {
+ return 0;
+ }
+
+ theVec.SetX (anX.RealValue());
+ theVec.SetY (anY.RealValue());
+ if (theArgNb >= 3)
+ {
+ TCollection_AsciiString anZ (theArgVec[2]);
+ if (anZ.IsRealValue())
+ {
+ theVec.SetZ (anZ.RealValue());
+ return 3;
+ }
+ }
+ return 2;
+ }
+}
+
//=======================================================================
//function : VSetLocation
//purpose : Change location of AIS interactive object
//=======================================================================
-static Standard_Integer VSetLocation (Draw_Interpretor& /*di*/,
+static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
return 1;
}
- TCollection_AsciiString aName;
- gp_Vec aLocVec;
- Standard_Boolean isSetLoc = Standard_False;
-
- Standard_Integer anArgIter = 1;
- for (; anArgIter < theArgNb; ++anArgIter)
+ Standard_Boolean toPrintInfo = Standard_True;
+ Handle(AIS_InteractiveObject) anObj;
+ TCollection_AsciiString aCmdName (theArgVec[0]);
+ aCmdName.LowerCase();
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
- Standard_CString anArg = theArgVec[anArgIter];
- if (anUpdateTool.parseRedrawMode (theArgVec[anArgIter]))
+ TCollection_AsciiString anArg = theArgVec[anArgIter];
+ anArg.LowerCase();
+ if (anUpdateTool.parseRedrawMode (anArg))
{
continue;
}
- else if (aName.IsEmpty())
+ else if (anObj.IsNull())
+ {
+ const TCollection_AsciiString aName (theArgVec[anArgIter]);
+ const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+ if (aMap.IsBound2 (aName))
+ {
+ anObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
+ }
+ if (anObj.IsNull())
+ {
+ std::cout << "Error: object '" << aName << "' is not displayed!\n";
+ return 1;
+ }
+ }
+ else if (anArg == "-reset")
{
- aName = anArg;
+ toPrintInfo = Standard_False;
+ aContext->SetLocation (anObj, gp_Trsf());
}
- else if (!isSetLoc)
+ else if (anArg == "-copyfrom"
+ || anArg == "-copy")
{
- isSetLoc = Standard_True;
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: syntax error at '" << anArg << "'\n";
+ std::cout << "Syntax error at '" << anArg << "'\n";
return 1;
}
- aLocVec.SetX (Draw::Atof (theArgVec[anArgIter++]));
- aLocVec.SetY (Draw::Atof (theArgVec[anArgIter]));
- if (anArgIter + 1 < theArgNb)
+
+ const TCollection_AsciiString aName2 (theArgVec[anArgIter + 1]);
+ const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+ Handle(AIS_InteractiveObject) anObj2;
+ if (aMap.IsBound2 (aName2))
+ {
+ anObj2 = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName2));
+ }
+ if (anObj2.IsNull())
{
- aLocVec.SetZ (Draw::Atof (theArgVec[++anArgIter]));
+ std::cout << "Error: object '" << aName2 << "' is not displayed!\n";
+ return 1;
}
+
+ ++anArgIter;
+ aContext->SetLocation (anObj, anObj2->LocalTransformation());
}
- else
+ else if (anArg == "-rotate")
{
- std::cout << "Error: unknown argument '" << anArg << "'\n";
- return 1;
- }
- }
-
- // find object
- const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- Handle(AIS_InteractiveObject) anIObj;
- if (aMap.IsBound2 (aName))
- {
- anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
- }
- if (anIObj.IsNull())
- {
- std::cout << "Error: object '" << aName << "' is not displayed!\n";
- return 1;
- }
-
- gp_Trsf aTrsf;
- aTrsf.SetTranslation (aLocVec);
- TopLoc_Location aLocation (aTrsf);
- aContext->SetLocation (anIObj, aLocation);
- return 0;
-}
-
-//=======================================================================
-//function : TransformPresentation
-//purpose : Change transformation of AIS interactive object
-//=======================================================================
-static Standard_Integer LocalTransformPresentation (Draw_Interpretor& /*theDi*/,
- Standard_Integer theArgNb,
- const char** theArgVec)
-{
- if (theArgNb <= 1)
- {
- std::cout << "Error: too few arguments.\n";
- return 1;
- }
-
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
- ViewerTest_AutoUpdater anUpdateTool(aContext, ViewerTest::CurrentView());
- if (aContext.IsNull())
- {
- std::cout << "Error: no active view!\n";
- return 1;
- }
-
- gp_Trsf aTrsf;
- Standard_Integer aLast = theArgNb;
- const char* aName = theArgVec[0];
-
- Standard_Boolean isReset = Standard_False;
- Standard_Boolean isMove = Standard_False;
+ toPrintInfo = Standard_False;
+ if (anArgIter + 7 >= theArgNb)
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ return 1;
+ }
- // Prefix 'vloc'
- aName += 4;
+ gp_Trsf aTrsf;
+ aTrsf.SetRotation (gp_Ax1 (gp_Pnt (Draw::Atof (theArgVec[anArgIter + 1]),
+ Draw::Atof (theArgVec[anArgIter + 2]),
+ Draw::Atof (theArgVec[anArgIter + 3])),
+ gp_Vec (Draw::Atof (theArgVec[anArgIter + 4]),
+ Draw::Atof (theArgVec[anArgIter + 5]),
+ Draw::Atof (theArgVec[anArgIter + 6]))),
+ Draw::Atof (theArgVec[anArgIter + 7]) * (M_PI / 180.0));
+ anArgIter += 7;
- if (!strcmp (aName, "reset"))
- {
- isReset = Standard_True;
- }
- else if (!strcmp (aName, "move"))
- {
- if (theArgNb < 3)
- {
- std::cout << "Error: too few arguments.\n";
- return 1;
+ aTrsf = anObj->LocalTransformation() * aTrsf;
+ aContext->SetLocation (anObj, aTrsf);
}
-
- const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
-
- Handle(AIS_InteractiveObject) anIObj;
- if (aMap.IsBound2 (theArgVec[theArgNb - 1]))
+ else if (anArg == "-translate")
{
- anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (theArgVec[theArgNb - 1]));
- }
+ toPrintInfo = Standard_False;
+ gp_Vec aLocVec;
+ Standard_Integer aNbParsed = parseTranslationVec (theArgNb - anArgIter - 1, theArgVec + anArgIter + 1, aLocVec);
+ anArgIter += aNbParsed;
+ if (aNbParsed == 0)
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ return 1;
+ }
- if (anIObj.IsNull())
- {
- std::cout << "Error: object '" << theArgVec[theArgNb - 1] << "' is not displayed!\n";
- return 1;
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslationPart (aLocVec);
+ aTrsf = anObj->LocalTransformation() * aTrsf;
+ aContext->SetLocation (anObj, aTrsf);
}
+ else if (anArg == "-scale"
+ || anArg == "-setscale")
+ {
+ toPrintInfo = Standard_False;
+ gp_XYZ aScaleLoc;
+ Standard_Real aScale = 1.0;
+ Standard_Boolean toPrintScale = Standard_True;
+ Standard_Boolean hasScaleLoc = Standard_False;
+ if (anArgIter + 4 < theArgNb)
+ {
+ TCollection_AsciiString aScaleArgs[4] =
+ {
+ TCollection_AsciiString (theArgVec[anArgIter + 1]),
+ TCollection_AsciiString (theArgVec[anArgIter + 2]),
+ TCollection_AsciiString (theArgVec[anArgIter + 3]),
+ TCollection_AsciiString (theArgVec[anArgIter + 4])
+ };
+ Standard_Integer aScaleArgIter = 0;
+ for (; aScaleArgIter < 4; ++aScaleArgIter)
+ {
+ if (!aScaleArgs[aScaleArgIter].IsRealValue())
+ {
+ break;
+ }
+ }
+ if (aScaleArgIter == 4)
+ {
+ aScaleLoc.SetCoord (aScaleArgs[0].RealValue(), aScaleArgs[1].RealValue(), aScaleArgs[2].RealValue());
+ aScale = aScaleArgs[3].RealValue();
+ anArgIter += 4;
+ toPrintScale = Standard_False;
+ hasScaleLoc = Standard_True;
+ }
+ else if (aScaleArgIter >= 1)
+ {
+ aScale = aScaleArgs[0].RealValue();
+ ++anArgIter;
+ toPrintScale = Standard_False;
+ }
+ }
+ else if (anArgIter + 1 < theArgNb)
+ {
+ TCollection_AsciiString aScaleArg (theArgVec[anArgIter + 1]);
+ if (aScaleArg.IsRealValue())
+ {
+ aScale = aScaleArg.RealValue();
+ ++anArgIter;
+ toPrintScale = Standard_False;
+ }
+ }
- isMove = Standard_True;
+ if (toPrintScale)
+ {
+ if (anArg == "-setscale")
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ return 1;
+ }
- aTrsf = anIObj->Transformation();
- aLast = theArgNb - 1;
- }
- else if (!strcmp (aName, "translate"))
- {
- if (theArgNb < 5)
- {
- std::cout << "Error: too few arguments.\n";
- return 1;
+ char aText[1024];
+ Sprintf (aText, "%g ", anObj->LocalTransformation().ScaleFactor());
+ theDI << aText;
+ continue;
+ }
+
+ if (anArg == "-setscale")
+ {
+ gp_Trsf aTrsf = anObj->LocalTransformation();
+ if (hasScaleLoc)
+ {
+ aTrsf.SetScale (aScaleLoc, aScale);
+ }
+ else
+ {
+ aTrsf.SetScaleFactor (aScale);
+ }
+ aContext->SetLocation (anObj, aTrsf);
+ }
+ else
+ {
+ gp_Trsf aTrsf;
+ if (hasScaleLoc)
+ {
+ aTrsf.SetScale (aScaleLoc, aScale);
+ aTrsf = anObj->LocalTransformation() * aTrsf;
+ }
+ else
+ {
+ aTrsf = anObj->LocalTransformation();
+ aTrsf.SetScaleFactor (aTrsf.ScaleFactor() * aScale);
+ }
+ aContext->SetLocation (anObj, aTrsf);
+ }
}
- aTrsf.SetTranslation (gp_Vec (Draw::Atof (theArgVec[theArgNb - 3]),
- Draw::Atof (theArgVec[theArgNb - 2]),
- Draw::Atof (theArgVec[theArgNb - 1])));
- aLast = theArgNb - 3;
- }
- else if (!strcmp (aName, "rotate"))
- {
- if (theArgNb < 9)
+ else if (anArg == "-mirror")
{
- std::cout << "Error: too few arguments.\n";
- return 1;
- }
-
- aTrsf.SetRotation (
- gp_Ax1 (gp_Pnt (Draw::Atof (theArgVec[theArgNb - 7]),
- Draw::Atof (theArgVec[theArgNb - 6]),
- Draw::Atof (theArgVec[theArgNb - 5])),
- gp_Vec (Draw::Atof (theArgVec[theArgNb - 4]),
- Draw::Atof (theArgVec[theArgNb - 3]),
- Draw::Atof (theArgVec[theArgNb - 2]))),
- Draw::Atof (theArgVec[theArgNb - 1]) * (M_PI / 180.0));
+ toPrintInfo = Standard_False;
+ if (anArgIter + 6 >= theArgNb)
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ return 1;
+ }
- aLast = theArgNb - 7;
- }
- else if (!strcmp (aName, "mirror"))
- {
- if (theArgNb < 8)
- {
- std::cout << "Error: too few arguments.\n";
- return 1;
+ gp_Trsf aTrsf;
+ aTrsf.SetMirror (gp_Ax2 (gp_Pnt (Draw::Atof(theArgVec[theArgNb - 6]),
+ Draw::Atof(theArgVec[theArgNb - 5]),
+ Draw::Atof(theArgVec[theArgNb - 4])),
+ gp_Vec (Draw::Atof(theArgVec[theArgNb - 3]),
+ Draw::Atof(theArgVec[theArgNb - 2]),
+ Draw::Atof(theArgVec[theArgNb - 1]))));
+ anArgIter += 6;
+ aTrsf = anObj->LocalTransformation() * aTrsf;
+ aContext->SetLocation (anObj, aTrsf);
}
-
- aTrsf.SetMirror (gp_Ax2 (gp_Pnt (Draw::Atof(theArgVec[theArgNb - 6]),
- Draw::Atof(theArgVec[theArgNb - 5]),
- Draw::Atof(theArgVec[theArgNb - 4])),
- gp_Vec (Draw::Atof(theArgVec[theArgNb - 3]),
- Draw::Atof(theArgVec[theArgNb - 2]),
- Draw::Atof(theArgVec[theArgNb - 1]))));
- aLast = theArgNb - 6;
- }
- else if (!strcmp (aName, "scale"))
- {
- if (theArgNb < 6)
+ else if (anArg == "-setrotation"
+ || anArg == "-rotation")
{
- std::cout << "Error: too few arguments.\n";
- return 1;
- }
+ toPrintInfo = Standard_False;
+ if (anArgIter + 4 < theArgNb)
+ {
+ TCollection_AsciiString aQuatArgs[4] =
+ {
+ TCollection_AsciiString (theArgVec[anArgIter + 1]),
+ TCollection_AsciiString (theArgVec[anArgIter + 2]),
+ TCollection_AsciiString (theArgVec[anArgIter + 3]),
+ TCollection_AsciiString (theArgVec[anArgIter + 4])
+ };
+ Standard_Integer aQuatArgIter = 0;
+ for (; aQuatArgIter < 4; ++aQuatArgIter)
+ {
+ if (!aQuatArgs[aQuatArgIter].IsRealValue())
+ {
+ break;
+ }
+ }
- aTrsf.SetScale (gp_Pnt (Draw::Atof(theArgVec[theArgNb - 4]),
- Draw::Atof(theArgVec[theArgNb - 3]),
- Draw::Atof(theArgVec[theArgNb - 2])),
- Draw::Atof(theArgVec[theArgNb - 1]));
- aLast = theArgNb - 4;
- }
+ if (aQuatArgIter == 4)
+ {
+ anArgIter += 4;
+ const gp_Quaternion aQuat (aQuatArgs[0].RealValue(),
+ aQuatArgs[1].RealValue(),
+ aQuatArgs[2].RealValue(),
+ aQuatArgs[3].RealValue());
+ gp_Trsf aTrsf = anObj->LocalTransformation();
+ aTrsf.SetRotation (aQuat);
+ aContext->SetLocation (anObj, aTrsf);
+ continue;
+ }
+ else if (anArg == "-setrotation")
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ return 1;
+ }
+ }
- for (Standard_Integer anIdx = 1; anIdx < aLast; anIdx++)
- {
- // find object
- const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- Handle(AIS_InteractiveObject) anIObj;
- if (aMap.IsBound2 (theArgVec[anIdx]))
- {
- anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (theArgVec[anIdx]));
- }
- if (anIObj.IsNull())
- {
- std::cout << "Error: object '" << theArgVec[anIdx] << "' is not displayed!\n";
- return 1;
+ char aText[1024];
+ const gp_Quaternion aQuat = anObj->LocalTransformation().GetRotation();
+ Sprintf (aText, "%g %g %g %g ", aQuat.X(), aQuat.Y(), aQuat.Z(), aQuat.W());
+ theDI << aText;
}
-
- if (isReset)
+ else if (anArg == "-setlocation"
+ || anArg == "-location")
{
- // aTrsf already identity
+ toPrintInfo = Standard_False;
+ gp_Vec aLocVec;
+ Standard_Integer aNbParsed = parseTranslationVec (theArgNb - anArgIter - 1, theArgVec + anArgIter + 1, aLocVec);
+ anArgIter += aNbParsed;
+ if (aNbParsed != 0)
+ {
+ gp_Trsf aTrsf = anObj->LocalTransformation();
+ aTrsf.SetTranslationPart (aLocVec);
+ aContext->SetLocation (anObj, aTrsf);
+ }
+ else if (anArg == "-setlocation")
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ return 1;
+ }
+
+ char aText[1024];
+ const gp_XYZ aLoc = anObj->LocalTransformation().TranslationPart();
+ Sprintf (aText, "%g %g %g ", aLoc.X(), aLoc.Y(), aLoc.Z());
+ theDI << aText;
}
- else if (isMove)
+ else if (aCmdName == "vsetlocation")
{
- aTrsf = anIObj->LocalTransformation() * anIObj->Transformation().Inverted() * aTrsf;
+ // compatibility with old syntax
+ gp_Vec aLocVec;
+ Standard_Integer aNbParsed = parseTranslationVec (theArgNb - anArgIter, theArgVec + anArgIter, aLocVec);
+ if (aNbParsed == 0)
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ return 1;
+ }
+ anArgIter = anArgIter + aNbParsed - 1;
+
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslationPart (aLocVec);
+ aContext->SetLocation (anObj, aTrsf);
+ toPrintInfo = Standard_False;
}
else
{
- aTrsf = anIObj->LocalTransformation() * aTrsf;
+ std::cout << "Error: unknown argument '" << anArg << "'\n";
+ return 1;
}
+ }
- TopLoc_Location aLocation (aTrsf);
- aContext->SetLocation (anIObj, aLocation);
+ if (anObj.IsNull())
+ {
+ std::cout << "Syntax error - wrong number of arguments\n";
+ return 1;
+ }
+ else if (!toPrintInfo)
+ {
+ return 0;
}
+ const gp_Trsf aTrsf = anObj->LocalTransformation();
+ const gp_XYZ aLoc = aTrsf.TranslationPart();
+ const gp_Quaternion aRot = aTrsf.GetRotation();
+ char aText[4096];
+ Sprintf (aText, "Location: %g %g %g\n"
+ "Rotation: %g %g %g %g\n"
+ "Scale: %g\n",
+ aLoc.X(), aLoc.Y(), aLoc.Z(),
+ aRot.X(), aRot.Y(), aRot.Z(), aRot.W(),
+ aTrsf.ScaleFactor());
+ theDI << aText;
return 0;
}
GetMapOfAIS().Bind (anOriginObject, aName);
// Display connected object
- TheAISContext()->Display (anOriginObject);
+ TheAISContext()->Display (anOriginObject, Standard_True);
return 0;
}
aTrsf.SetTranslation (gp_Vec (aX, aY, aZ));
anAssembly->Connect (anIObj, aTrsf);
- TheAISContext()->Display (anAssembly);
+ TheAISContext()->Display (anAssembly, Standard_False);
TheAISContext()->RecomputeSelectionOnly (anAssembly);
aContext->UpdateCurrentViewer();
}
const Standard_Integer aSelectionMode = Draw::Atoi (anArgNb == 3 ? theArgv[1] : theArgv[2]);
- const Standard_Boolean toTurnOn = Draw::Atoi (anArgNb == 3 ? theArgv[2] : theArgv[3]);
+ const Standard_Boolean toTurnOn = Draw::Atoi (anArgNb == 3 ? theArgv[2] : theArgv[3]) != 0;
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (aSelectionMode == 0 && anAISContext->HasOpenedContext())
{
anAISContext->CloseLocalContext();
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
if (aSelectionMode == 0)
{
if (aSelectionMode != 0 && toTurnOn) // Turn on specified mode
{
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (!anAISContext->HasOpenedContext() && isToOpenLocalCtx)
{
anAISContext->OpenLocalContext (Standard_False);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
{
const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
- if (InList (anAISContext, anIO, 0))
- {
- anAISContext->Deactivate (anIO, 0);
- }
- if (!InList (anAISContext, anIO, aSelectionMode))
- {
- anAISContext->Load (anIO, -1, Standard_True);
- anAISContext->Activate (anIO, aSelectionMode);
- }
+ anAISContext->Deactivate (anIO, 0);
+ anAISContext->Load (anIO, -1, Standard_True);
+ anAISContext->Activate (anIO, aSelectionMode);
}
}
{
for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
{
- const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
- if (InList (anAISContext, anIO, aSelectionMode))
- {
- anAISContext->Deactivate (anIO, aSelectionMode);
- }
+ anAISContext->Deactivate (aSelectionMode);
}
}
return 1;
}
- anAISContext->HilightNextDetected(aView);
+ anAISContext->HilightNextDetected (aView);
return 0;
}
return 1;
}
- anAISContext->HilightPreviousDetected(aView);
+ anAISContext->HilightPreviousDetected (aView);
return 0;
}
return 1; // TCL_ERROR
}
- TheAISContext()->CloseAllContexts();
-
// Get and check values
TCollection_AsciiString aName(argv[1]);
GetMapOfAIS().Bind(aTriangle, aName);
// Display triangle
- TheAISContext()->Display(aTriangle);
+ TheAISContext()->Display (aTriangle, Standard_True);
return 0;
}
return 1; // TCL_ERROR
}
- TheAISContext()->CloseAllContexts();
-
// Get and check arguments
TCollection_AsciiString aName(argv[1]);
Handle(AIS_Point) aPoint1, aPoint2;
GetMapOfAIS().Bind(aSegment, aName);
// Display segment
- TheAISContext()->Display(aSegment);
+ TheAISContext()->Display (aSegment, Standard_True);
return 0;
}
// select appropriate line type
if (argc == 8)
{
- switch (Draw::Atoi (argv[7]))
+ if (!ViewerTest::ParseLineType (argv[7], aLineType))
{
- case 1: aLineType = Aspect_TOL_DASH; break;
- case 2: aLineType = Aspect_TOL_DOT; break;
- case 3: aLineType = Aspect_TOL_DOTDASH; break;
- default:
- aLineType = Aspect_TOL_SOLID;
+ std::cout << "Syntax error: unknown line type '" << argv[7] << "'\n";
+ return 1;
}
}
aDrawer->SetFaceBoundaryAspect (aBoundaryAspect);
- TheAISContext()->Redisplay (anInterObj);
+ TheAISContext()->Redisplay (anInterObj, Standard_True);
return 0;
}
myMarkerAspect = theMarkerAspect;
}
- DEFINE_STANDARD_RTTI_INLINE(MyPArrayObject,AIS_InteractiveObject);
+ DEFINE_STANDARD_RTTI_INLINE(ViewerTest_MarkersArrayObject,AIS_InteractiveObject);
private:
Handle(AIS_InteractiveObject) anObject =
Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(aName));
- // Enable trianle edge mode
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeOn();
+ // Enable triangle edge mode
+ if (!anObject->Attributes()->HasOwnShadingAspect())
+ {
+ anObject->Attributes()->SetShadingAspect (new Prs3d_ShadingAspect());
+ *anObject->Attributes()->ShadingAspect()->Aspect() = *anObject->Attributes()->Link()->ShadingAspect()->Aspect();
+ }
+ const Handle(Prs3d_ShadingAspect)& aFillAreaAspect = anObject->Attributes()->ShadingAspect();
+ aFillAreaAspect->Aspect()->SetEdgeOn();
// Parse parameters
for (Standard_Integer anIt = 2; anIt < theArgNum; ++anIt)
return 1;
}
- TCollection_AsciiString aType = theArgs[++anIt];
- aType.UpperCase();
-
- if (aType.IsEqual ("SOLID"))
- {
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_SOLID);
- }
- else if (aType.IsEqual ("DASH"))
- {
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_DASH);
- }
- else if (aType.IsEqual ("DOT"))
- {
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_DOT);
- }
- else if (aType.IsEqual ("DOTDASH"))
- {
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_DOTDASH);
- }
- else
+ ++anIt;
+ Aspect_TypeOfLine aTypeEnum = Aspect_TOL_SOLID;
+ if (!ViewerTest::ParseLineType (theArgs[anIt], aTypeEnum))
{
- theDI << theArgs[0] << " error: wrong line type: '" << aType.ToCString() << "'.\n";
+ std::cout << "Syntax error: wrong line type: '" << theArgs[anIt] << "'.\n";
return 1;
}
-
+ anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType (aTypeEnum);
}
else if (aParam.IsEqual ("-color"))
{
aB > 1 ? aB / 255.0 : aB,
Quantity_TOC_RGB);
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeColor (aColor);
+ aFillAreaAspect->Aspect()->SetEdgeColor (aColor);
}
else if (aParam.IsEqual ("-force"))
{
// Update shape presentation as aspect parameters were changed
if (isForceRedisplay)
{
- ViewerTest::GetAISContext()->Redisplay (anObject);
+ ViewerTest::GetAISContext()->Redisplay (anObject, Standard_False);
}
else
{
- anObject->SetAspect (anObject->Attributes()->ShadingAspect());
+ anObject->SetAspect (aFillAreaAspect);
}
//Update view
// Update shape presentation as aspect parameters were changed
if (isForceRedisplay)
{
- ViewerTest::GetAISContext()->Redisplay (anObject);
+ ViewerTest::GetAISContext()->Redisplay (anObject, Standard_False);
}
else
{
"vdrawsphere: vdrawsphere shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToShowEdges=0] [ToPrintInfo=1]\n",
__FILE__,VDrawSphere,group);
+ theCommands.Add ("vlocation",
+ "vlocation name"
+ "\n\t\t: [-reset]"
+ "\n\t\t: [-copyFrom otherName]"
+ "\n\t\t: [-translate X Y [Z]]"
+ "\n\t\t: [-rotate x y z dx dy dz angle]"
+ "\n\t\t: [-scale [X Y Z] scale]"
+ "\n\t\t: [-mirror x y z dx dy dz]"
+ "\n\t\t: [-setLocation X Y [Z]]"
+ "\n\t\t: [-setRotation QX QY QZ QW]"
+ "\n\t\t: [-setScale [X Y Z] scale]"
+ "\n\t\t: Object local transformation management:"
+ "\n\t\t: -reset reset transformation to identity"
+ "\n\t\t: -translate translate object"
+ "\n\t\t: -rotate applies rotation to local transformation"
+ "\n\t\t: -scale applies scale to local transformation"
+ "\n\t\t: -mirror applies mirror to local transformation"
+ "\n\t\t: -setLocation assign object location"
+ "\n\t\t: -setRotation assign object rotation (quaternion)"
+ "\n\t\t: -setScale assign object scale factor",
+ __FILE__, VSetLocation, group);
theCommands.Add ("vsetlocation",
- "vsetlocation [-noupdate|-update] name x y z"
- "\n\t\t: Set new location for an interactive object.",
+ "alias for vlocation",
__FILE__, VSetLocation, group);
theCommands.Add (
"\n",
__FILE__, VPointCloud, group);
- theCommands.Add("vlocreset",
- "vlocreset name1 name2 ...\n\t\t remove object local transformation",
- __FILE__,
- LocalTransformPresentation, group);
-
- theCommands.Add("vlocmove",
- "vlocmove name1 name2 ... name\n\t\t set local transform to match transform of 'name'",
- __FILE__,
- LocalTransformPresentation, group);
-
- theCommands.Add("vloctranslate",
- "vloctranslate name1 name2 ... dx dy dz\n\t\t applies translation to local transformation",
- __FILE__,
- LocalTransformPresentation, group);
-
- theCommands.Add("vlocrotate",
- "vlocrotate name1 name2 ... x y z dx dy dz angle\n\t\t applies rotation to local transformation",
- __FILE__,
- LocalTransformPresentation, group);
-
- theCommands.Add("vlocmirror",
- "vlocmirror name x y z dx dy dz\n\t\t applies mirror to local transformation",
- __FILE__,
- LocalTransformPresentation, group);
-
- theCommands.Add("vlocscale",
- "vlocscale name x y z scale\n\t\t applies scale to local transformation",
- __FILE__,
- LocalTransformPresentation, group);
-
theCommands.Add("vpriority",
"vpriority [-noupdate|-update] name [value]\n\t\t prints or sets the display priority for an object",
__FILE__,