// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <ViewerTest.hxx>
-#include <string.h>
-
#include <Quantity_NameOfColor.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw.hxx>
#include <DBRep.hxx>
#include <Font_BRepFont.hxx>
+#include <Font_BRepTextBuilder.hxx>
#include <Font_FontMgr.hxx>
#include <OSD_Chronometer.hxx>
#include <TCollection_AsciiString.hxx>
-#include <Visual3d_View.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
#include <V3d.hxx>
#include <AIS_Shape.hxx>
#include <AIS_DisplayMode.hxx>
+#include <AIS_PointCloud.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <AIS_MapOfInteractive.hxx>
+#include <ViewerTest_AutoUpdater.hxx>
#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
#include <ViewerTest_EventManager.hxx>
#include <Standard_Real.hxx>
#include <AIS_Circle.hxx>
-#include <AIS_Drawer.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <AIS_MultipleConnectedInteractive.hxx>
#include <AIS_ConnectedInteractive.hxx>
+#include <AIS_TextLabel.hxx>
#include <TopLoc_Location.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <BRepExtrema_ExtPC.hxx>
#include <BRepExtrema_ExtPF.hxx>
+#include <Prs3d_DatumAspect.hxx>
+#include <Prs3d_Drawer.hxx>
#include <Prs3d_VertexDrawMode.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_TextAspect.hxx>
#include <Image_AlienPixMap.hxx>
#include <TColStd_HArray1OfAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-#ifdef WNT
-#define _CRT_SECURE_NO_DEPRECATE
-#pragma warning (disable:4996)
+#if defined(_MSC_VER)
+# define _CRT_SECURE_NO_DEPRECATE
+# pragma warning (disable:4996)
#endif
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
{
// Verification des arguments
- if ( argc!=2) {di<<argv[0]<<" error"<<"\n"; return 1;}
+ if ( argc!=2) {di<<argv[0]<<" error\n"; return 1;}
// Declarations
Standard_Integer myCurrentIndex;
myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
// On active les modes de selections faces.
TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
- di<<" Select a face ."<<"\n";
+ di<<" Select a face .\n";
// Boucle d'attente waitpick.
Standard_Integer argccc = 5;
//Draw arg : vtrihedron name [Xo] [Yo] [Zo] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw]
//==============================================================================
-static int VTrihedron (Draw_Interpretor& theDi,
+static int VTrihedron (Draw_Interpretor& /*theDi*/,
Standard_Integer theArgsNb,
const char** theArgVec)
{
- if (theArgsNb != 2 && theArgsNb != 5 && theArgsNb != 11)
+ if (theArgsNb < 2 || theArgsNb > 11)
+ {
+ std::cout << theArgVec[0] << " syntax error\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;
+ }
+
+ aMapOfArgs(aParseKey)->Append (anArg);
+ }
+
+ // Check parameters
+ if ( (aMapOfArgs.IsBound ("xaxis") && !aMapOfArgs.IsBound ("zaxis"))
+ || (!aMapOfArgs.IsBound ("xaxis") && aMapOfArgs.IsBound ("zaxis")) )
{
- theDi << theArgVec[0] << " Syntax error\n";
+ 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())
+ {
+ 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() )
+ {
+ continue;
+ }
+ }
+
+ // Process parameters
gp_Pnt anOrigin (0.0, 0.0, 0.0);
gp_Dir aDirZ = gp::DZ();
gp_Dir aDirX = gp::DX();
- Standard_Integer anArgIter = 2; // 1st is an IO name
- if (anArgIter < theArgsNb)
+
+ Handle(TColStd_HSequenceOfAsciiString) aValues;
+
+ if (aMapOfArgs.Find ("origin", aValues))
{
- anOrigin.SetX (Draw::Atof (theArgVec[anArgIter++]));
- anOrigin.SetY (Draw::Atof (theArgVec[anArgIter++]));
- anOrigin.SetZ (Draw::Atof (theArgVec[anArgIter++]));
- if (anArgIter < theArgsNb)
- {
- Standard_Real aX = Draw::Atof (theArgVec[anArgIter++]);
- Standard_Real aY = Draw::Atof (theArgVec[anArgIter++]);
- Standard_Real aZ = Draw::Atof (theArgVec[anArgIter++]);
- aDirZ.SetCoord (aX, aY, aZ);
+ anOrigin.SetX (aValues->Value(1).RealValue());
+ anOrigin.SetY (aValues->Value(2).RealValue());
+ anOrigin.SetZ (aValues->Value(3).RealValue());
+ }
- aX = Draw::Atof (theArgVec[anArgIter++]);
- aY = Draw::Atof (theArgVec[anArgIter++]);
- aZ = Draw::Atof (theArgVec[anArgIter++]);
- aDirX.SetCoord (aX, aY, aZ);
- }
+ Handle(TColStd_HSequenceOfAsciiString) aValues2;
+ if (aMapOfArgs.Find ("xaxis", aValues) && aMapOfArgs.Find ("zaxis", aValues2))
+ {
+ 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);
}
if (!aDirZ.IsNormal (aDirX, M_PI / 180.0))
{
- theDi << theArgVec[0] << " - VectorX is not normal to VectorZ\n";
+ std::cout << theArgVec[0] << " error - VectorX is not normal to VectorZ\n";
return 1;
}
Handle(Geom_Axis2Placement) aPlacement = new Geom_Axis2Placement (anOrigin, aDirZ, aDirX);
Handle(AIS_Trihedron) aShape = new AIS_Trihedron (aPlacement);
+
+ if (aMapOfArgs.Find ("hidelabels", aValues))
+ {
+ 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], aShape);
return 0;
}
Quantity_NameOfColor col = Quantity_NOC_BLACK ;
// Verification des arguments
- if ( argc>3 ) {di<<argv[0]<<" Syntaxe error"<<"\n"; return 1;}
+ if ( argc>3 ) {di<<argv[0]<<" Syntaxe error\n"; return 1;}
// Verification du nombre d'arguments
if (argc==1) {ThereIsName=Standard_False;value=100;}
TheAISContext()->CloseLocalContext();
// On set le booleen ThereIsCurrent
- if (TheAISContext() -> NbCurrents() > 0) {ThereIsCurrent=Standard_True;}
+ if (TheAISContext() -> NbSelected() > 0) {ThereIsCurrent=Standard_True;}
else {ThereIsCurrent=Standard_False;}
Handle(AIS_InteractiveObject) aShape=
Handle(AIS_InteractiveObject)::DownCast(it.Key1());
- if (!aShape.IsNull() && TheAISContext()->IsCurrent(aShape) )
+ if (!aShape.IsNull() && TheAISContext()->IsSelected(aShape) )
{
// On verifie que l'AIS InteraciveObject selectionne est bien
// On downcast aShape de AIS_InteractiveObject a AIS_Trihedron
// pour lui appliquer la methode SetSize()
- Handle(AIS_Trihedron) aTrihedron = *(Handle(AIS_Trihedron)*) &aShape;
+ Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape);
// C'est bien un triedre,on chage sa valeur!
aTrihedron->SetSize(value);
// On downcast aShape de AIS_InteractiveObject a AIS_Trihedron
// pour lui appliquer la methode SetSize()
- Handle(AIS_Trihedron) aTrihedron = *(Handle(AIS_Trihedron)*) &aShape;
+ Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape);
// C'est bien un triedre,on chage sa valeur
aTrihedron->SetSize(value);
{
// Verification des arguments
- if ( argc!=2) {di<<argv[0]<<" error"<<"\n"; return 1;}
+ if ( argc!=2) {di<<argv[0]<<" error\n"; return 1;}
// Declarations
Standard_Integer myCurrentIndex;
if (!ShapeA.IsNull() &&
ShapeA->Type()==AIS_KOI_Datum && ShapeA->Signature()==3 ) {
// on le downcast
- Handle(AIS_Trihedron) TrihedronA =((*(Handle(AIS_Trihedron)*)&ShapeA));
+ 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();
}
- di<<" Select a plane."<<"\n";
+ di<<" Select a plane.\n";
// Boucle d'attente waitpick.
Standard_Integer argccc = 5;
const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
Handle(AIS_InteractiveObject) theIOB;
for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
- theIOB = TheAISContext()->Interactive();
+ theIOB = TheAISContext()->SelectedInteractive();
}
// on le downcast
- Handle(AIS_Plane) PlaneB =((*(Handle(AIS_Plane)*)&theIOB));
+ Handle(AIS_Plane) PlaneB =(Handle(AIS_Plane)::DownCast (theIOB));
// Fermeture du contexte local.
TheAISContext()->CloseLocalContext(myCurrentIndex);
Standard_Integer MyCurrentIndex;
// Verification
- if (argc<2 || argc>8 ) {di<<" Syntaxe error"<<"\n";return 1;}
+ if (argc<2 || argc>8 ) {di<<" Syntaxe error\n";return 1;}
if (argc==8) HasArg=Standard_True;
else HasArg=Standard_False;
// 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";
+ di<<" Select an edge or a vertex.\n";
// Boucle d'attente waitpick.
Standard_Integer argcc = 5;
if (ShapeA.ShapeType()==TopAbs_VERTEX) {
// on desactive le mode edge
TheAISContext()->DeactivateStandardMode(AIS_Shape::SelectionType(2) );
- di<<" Select a different vertex."<<"\n";
+ di<<" Select a different vertex.\n";
TopoDS_Shape ShapeB;
do {
// Active le mode edge
TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(2) );
- di<<" Select an edge."<<"\n";
+ di<<" Select an edge.\n";
// Boucle d'attente waitpick.
Standard_Integer argcc = 5;
// Active le mode vertex et deactive edges
TheAISContext()->DeactivateStandardMode(AIS_Shape::SelectionType(2) );
TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(1) );
- di<<" Select a vertex."<<"\n";
+ di<<" Select a vertex.\n";
// Boucle d'attente waitpick.
Standard_Integer argccc = 5;
// Active le mode edge
TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(2) );
- di<<" Select an edge."<<"\n";
+ di<<" Select an edge.\n";
// Boucle d'attente waitpick.
Standard_Integer argcc = 5;
// Active le mode vertex et deactive edges
TheAISContext()->DeactivateStandardMode(AIS_Shape::SelectionType(2) );
TheAISContext()->ActivateStandardMode(AIS_Shape::SelectionType(1) );
- di<<" Slect a vertex."<<"\n";
+ di<<" Slect a vertex.\n";
// Boucle d'attente waitpick.
Standard_Integer argccc = 5;
Standard_Integer myCurrentIndex;
// Verification
- if (argc<2 || argc>5 ) {di<<" Syntaxe error"<<"\n";return 1;}
+ if (argc<2 || argc>5 ) {di<<" Syntaxe error\n";return 1;}
if (argc==5) HasArg=Standard_True;
else HasArg=Standard_False;
// 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";
+ di<<" Select a vertex or an edge(build the middle)\n";
// Boucle d'attente waitpick.
Standard_Integer argcc = 5;
Abs(aCartPointB->Z()-aCartPointA->Z())<=Precision::Confusion())
{
// B=A
- std::cout<<"vplane error: same points"<<"\n";return 1;
+ std::cout<<"vplane error: same points\n";return 1;
}
if(Abs(aCartPointC->X()-aCartPointA->X())<=Precision::Confusion() &&
Abs(aCartPointC->Y()-aCartPointA->Y())<=Precision::Confusion() &&
Abs(aCartPointC->Z()-aCartPointA->Z())<=Precision::Confusion())
{
// C=A
- std::cout<<"vplane error: same points"<<"\n";return 1;
+ std::cout<<"vplane error: same points\n";return 1;
}
if(Abs(aCartPointC->X()-aCartPointB->X())<=Precision::Confusion() &&
Abs(aCartPointC->Y()-aCartPointB->Y())<=Precision::Confusion() &&
Abs(aCartPointC->Z()-aCartPointB->Z())<=Precision::Confusion())
{
// C=B
- std::cout<<"vplane error: same points"<<"\n";return 1;
+ std::cout<<"vplane error: same points\n";return 1;
}
gp_Pnt A = aCartPointA->Pnt();
}
else
{
- std::cout<<" vplanepara: error"<<"\n";return 1;
+ std::cout<<" vplanepara: error\n";return 1;
}
}
}
aPlane->SetComponent (new Geom_Plane (aCenterPnt, aDirection));
aPlane->SetSize (aSizeX, aSizeY);
- if (isUpdate)
- {
- aContextAIS->Update (aPlane, Standard_True);
- }
+ aContextAIS->Update (aPlane, isUpdate);
return 0;
}
{
Standard_Integer myCurrentIndex;
// Verifications
- if (argc!=4 && argc!=8 && argc!=2 ) {di<<"vline error: number of arguments not correct "<<"\n";return 1; }
+ if (argc!=4 && argc!=8 && argc!=2 ) {di<<"vline error: number of arguments not correct \n";return 1; }
// Fermeture des contextes
TheAISContext()->CloseAllContexts();
if (theShapeA.IsNull() ||
(!(theShapeB->Type()==AIS_KOI_Datum && theShapeB->Signature()==1)))
{
- di <<"vline error: wrong type of 2de argument."<<"\n";
+ di <<"vline error: wrong type of 2de argument.\n";
return 1;
}
}
- else {di <<"vline error: wrong type of 1st argument."<<"\n";return 1; }
+ else {di <<"vline error: wrong type of 1st argument.\n";return 1; }
// Les deux parametres sont du bon type. On verifie que les points ne sont pas confondus
- Handle(AIS_Point) theAISPointA= *(Handle(AIS_Point)*)& theShapeA;
- Handle(AIS_Point) theAISPointB= *(Handle(AIS_Point)*)& theShapeB;
+ Handle(AIS_Point) theAISPointA= Handle(AIS_Point)::DownCast (theShapeA);
+ Handle(AIS_Point) theAISPointB= Handle(AIS_Point)::DownCast (theShapeB);
Handle(Geom_Point ) myGeomPointBA= theAISPointA->Component();
- Handle(Geom_CartesianPoint ) myCartPointA= *((Handle(Geom_CartesianPoint)*)& myGeomPointBA);
+ Handle(Geom_CartesianPoint ) myCartPointA= Handle(Geom_CartesianPoint)::DownCast (myGeomPointBA);
// Handle(Geom_CartesianPoint ) myCartPointA= *(Handle(Geom_CartesianPoint)*)& (theAISPointA->Component() ) ;
Handle(Geom_Point ) myGeomPointB= theAISPointB->Component();
- Handle(Geom_CartesianPoint ) myCartPointB= *((Handle(Geom_CartesianPoint)*)& myGeomPointB);
+ Handle(Geom_CartesianPoint ) myCartPointB= Handle(Geom_CartesianPoint)::DownCast (myGeomPointB);
// Handle(Geom_CartesianPoint ) myCartPointB= *(Handle(Geom_CartesianPoint)*)& (theAISPointB->Component() ) ;
if (myCartPointB->X()==myCartPointA->X() && myCartPointB->Y()==myCartPointA->Y() && myCartPointB->Z()==myCartPointA->Z() ) {
// B=A
- di<<"vline error: same points"<<"\n";return 1;
+ di<<"vline error: same points\n";return 1;
}
// Les deux points sont OK...Construction de l'AIS_Line (en faite, le segment AB)
Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
// Active le mode Vertex.
TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
- di<<" Select a vertex "<<"\n";
+ di<<" Select a vertex \n";
// Boucle d'attente waitpick.
Standard_Integer argcc = 5;
// ShapeA est un Vertex
if (ShapeA.ShapeType()==TopAbs_VERTEX ) {
- di<<" Select a different vertex."<<"\n";
+ di<<" Select a different vertex.\n";
TopoDS_Shape ShapeB;
do {
}
else {
- di<<"vline error."<<"\n";
+ di<<"vline error.\n";
}
}
return aCircle;
}
-DEFINE_STANDARD_HANDLE(FilledCircle, AIS_InteractiveObject)
-
class FilledCircle : public AIS_InteractiveObject
{
public:
// CASCADE RTTI
- DEFINE_STANDARD_RTTI(FilledCircle);
+ DEFINE_STANDARD_RTTI_INLINE(FilledCircle,AIS_InteractiveObject);
FilledCircle(gp_Pnt theCenter, Standard_Real theRadius);
FilledCircle(Handle(Geom_Circle) theCircle);
// Virtual methods implementation
void Compute ( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
- const Standard_Integer theMode);
+ const Standard_Integer theMode) Standard_OVERRIDE;
void ComputeSelection ( const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Integer theMode);
+ const Standard_Integer theMode) Standard_OVERRIDE;
protected:
Handle(Geom_Circle) myCircle;
};
-IMPLEMENT_STANDARD_HANDLE(FilledCircle, AIS_InteractiveObject)
-IMPLEMENT_STANDARD_RTTIEXT(FilledCircle, AIS_InteractiveObject)
FilledCircle::FilledCircle(gp_Pnt theCenter, Standard_Real theRadius)
{
return 0;
}
-
-//===============================================================================================
+//=======================================================================
//function : VDrawText
-//author : psn
-//purpose : Create a text.
-//Draw arg : vdrawtext name [X] [Y] [Z] [R] [G] [B] [hor_align] [ver_align] [angle] [zoomable]
-//===============================================================================================
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Structure.hxx>
-#include <Graphic3d_AspectText3d.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_StructureManager.hxx>
-#include <Graphic3d_VerticalTextAlignment.hxx>
-#include <Graphic3d_HorizontalTextAlignment.hxx>
-
-#include <Font_NameOfFont.hxx>
-
-#include <Visual3d_ViewManager.hxx>
-
-#include <Standard_DefineHandle.hxx>
+//purpose :
+//=======================================================================
+static int VDrawText (Draw_Interpretor& theDI,
+ Standard_Integer theArgsNb,
+ const char** theArgVec)
+{
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ if (theArgsNb < 3)
+ {
+ std::cout << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+ else if (aContext.IsNull())
+ {
+ std::cout << "Error: no active view!\n";
+ return 1;
+ }
-#include <Prs3d_Root.hxx>
-#include <Prs3d_Text.hxx>
-#include <Prs3d_TextAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <PrsMgr_PresentationManager3d.hxx>
+ Standard_Integer anArgIt = 1;
+ TCollection_ExtendedString aName (theArgVec[anArgIt++], Standard_True);
+ TCollection_ExtendedString aText (theArgVec[anArgIt++], Standard_True);
+ Handle(AIS_TextLabel) aTextPrs;
+ ViewerTest_AutoUpdater anAutoUpdater (aContext, ViewerTest::CurrentView());
-#include <TCollection_ExtendedString.hxx>
-#include <TCollection_AsciiString.hxx>
+ if (GetMapOfAIS().IsBound2 (aName))
+ {
+ aTextPrs = Handle(AIS_TextLabel)::DownCast (GetMapOfAIS().Find2 (aName));
+ }
+ else
+ {
+ aTextPrs = new AIS_TextLabel();
+ aTextPrs->SetFont ("Courier");
+ }
-#include <gp_Pnt.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <Quantity_Color.hxx>
+ aTextPrs->SetText (aText);
+ Graphic3d_TransModeFlags aTrsfPersFlags = Graphic3d_TMF_None;
+ gp_Pnt aTPPosition;
+ Aspect_TypeOfDisplayText aDisplayType = Aspect_TODT_NORMAL;
-DEFINE_STANDARD_HANDLE(MyTextClass, AIS_InteractiveObject)
-class MyTextClass:public AIS_InteractiveObject
-{
-public:
- // CASCADE RTTI
- DEFINE_STANDARD_RTTI(MyTextClass );
-
- MyTextClass(){};
-
- MyTextClass
- (
- const TCollection_ExtendedString& , const gp_Pnt& ,
- Quantity_Color color,
- Standard_Integer aHJust,
- Standard_Integer aVJust ,
- Standard_Real Angle ,
- Standard_Boolean Zoom ,
- Standard_Real Height,
- Font_FontAspect FontAspect,
- Standard_CString Font
- );
+ Standard_Boolean aHasPlane = Standard_False;
+ gp_Dir aNormal;
+ gp_Dir aDirection;
+ gp_Pnt aPos;
-private:
+ for (; anArgIt < theArgsNb; ++anArgIt)
+ {
+ TCollection_AsciiString aParam (theArgVec[anArgIt]);
+ aParam.LowerCase();
- void Compute ( const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
- const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode);
+ if (anAutoUpdater.parseRedrawMode (aParam))
+ {
+ continue;
+ }
+ else if (aParam == "-pos"
+ || aParam == "-position")
+ {
+ if (anArgIt + 3 >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
- void ComputeSelection ( const Handle(SelectMgr_Selection)& /*aSelection*/,
- const Standard_Integer /*aMode*/){} ;
+ aPos.SetX (Draw::Atof (theArgVec[++anArgIt]));
+ aPos.SetY (Draw::Atof (theArgVec[++anArgIt]));
+ aPos.SetZ (Draw::Atof (theArgVec[++anArgIt]));
+ aTextPrs->SetPosition (aPos);
+ }
+ else if (aParam == "-color")
+ {
+ if (anArgIt + 1 >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
-protected:
- TCollection_ExtendedString aText;
- gp_Pnt aPosition;
- Standard_Real Red;
- Standard_Real Green;
- Standard_Real Blue;
- Standard_Real aAngle;
- Standard_Real aHeight;
- Standard_Boolean aZoomable;
- Quantity_Color aColor;
- TCollection_AsciiString aFont;
- Font_FontAspect aFontAspect;
- Graphic3d_HorizontalTextAlignment aHJustification;
- Graphic3d_VerticalTextAlignment aVJustification;
-};
+ TCollection_AsciiString aColor (theArgVec[anArgIt + 1]);
+ Quantity_NameOfColor aNameOfColor = Quantity_NOC_BLACK;
+ if (Quantity_Color::ColorFromName (aColor.ToCString(), aNameOfColor))
+ {
+ anArgIt += 1;
+ aTextPrs->SetColor (aNameOfColor);
+ continue;
+ }
+ else if (anArgIt + 3 >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ TCollection_AsciiString aGreen (theArgVec[anArgIt + 2]);
+ TCollection_AsciiString aBlue (theArgVec[anArgIt + 3]);
+ if (!aColor.IsRealValue()
+ || !aGreen.IsRealValue()
+ || !aBlue.IsRealValue())
+ {
+ std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ const Graphic3d_Vec3d anRGB (aColor.RealValue(),
+ aGreen.RealValue(),
+ aBlue.RealValue());
-IMPLEMENT_STANDARD_HANDLE(MyTextClass, AIS_InteractiveObject)
-IMPLEMENT_STANDARD_RTTIEXT(MyTextClass, AIS_InteractiveObject)
+ aTextPrs->SetColor (Quantity_Color (anRGB.r(), anRGB.g(), anRGB.b(), Quantity_TOC_RGB));
+ anArgIt += 3;
+ }
+ else if (aParam == "-halign")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ TCollection_AsciiString aType (theArgVec[anArgIt]);
+ aType.LowerCase();
+ if (aType == "left")
+ {
+ aTextPrs->SetHJustification (Graphic3d_HTA_LEFT);
+ }
+ else if (aType == "center")
+ {
+ aTextPrs->SetHJustification (Graphic3d_HTA_CENTER);
+ }
+ else if (aType == "right")
+ {
+ aTextPrs->SetHJustification (Graphic3d_HTA_RIGHT);
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ }
+ else if (aParam == "-valign")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
-MyTextClass::MyTextClass( const TCollection_ExtendedString& text, const gp_Pnt& position,
- Quantity_Color color = Quantity_NOC_YELLOW,
- Standard_Integer aHJust = Graphic3d_HTA_LEFT,
- Standard_Integer aVJust = Graphic3d_VTA_BOTTOM,
- Standard_Real angle = 0.0 ,
- Standard_Boolean zoomable = Standard_True,
- Standard_Real height = 12.,
- Font_FontAspect fontAspect = Font_FA_Regular,
- Standard_CString font = "Courier")
-{
- aText = text;
- aPosition = position;
- aHJustification = Graphic3d_HorizontalTextAlignment(aHJust);
- aVJustification = Graphic3d_VerticalTextAlignment(aVJust);
- aAngle = angle;
- aZoomable = zoomable;
- aHeight = height;
- aColor = color;
- aFontAspect = fontAspect;
- aFont = font;
-};
+ TCollection_AsciiString aType (theArgVec[anArgIt]);
+ aType.LowerCase();
+ if (aType == "top")
+ {
+ aTextPrs->SetVJustification (Graphic3d_VTA_TOP);
+ }
+ else if (aType == "center")
+ {
+ aTextPrs->SetVJustification (Graphic3d_VTA_CENTER);
+ }
+ else if (aType == "bottom")
+ {
+ aTextPrs->SetVJustification (Graphic3d_VTA_BOTTOM);
+ }
+ else if (aType == "topfirstline")
+ {
+ aTextPrs->SetVJustification (Graphic3d_VTA_TOPFIRSTLINE);
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ }
+ else if (aParam == "-angle")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ aTextPrs->SetAngle (Draw::Atof (theArgVec[anArgIt]) * (M_PI / 180.0));
+ }
+ else if (aParam == "-zoom")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ aTextPrs->SetZoomable (Draw::Atoi (theArgVec[anArgIt]) == 1);
+ }
+ else if (aParam == "-height")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
-//////////////////////////////////////////////////////////////////////////////
-void MyTextClass::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
- const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer /*aMode*/)
-{
+ aTextPrs->SetHeight (Draw::Atof(theArgVec[anArgIt]));
+ }
+ else if (aParam == "-aspect")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
- aPresentation->Clear();
+ TCollection_AsciiString anOption (theArgVec[anArgIt]);
+ anOption.LowerCase();
+ if (anOption.IsEqual ("regular"))
+ {
+ aTextPrs->SetFontAspect (Font_FA_Regular);
+ }
+ else if (anOption.IsEqual ("bold"))
+ {
+ aTextPrs->SetFontAspect (Font_FA_Bold);
+ }
+ else if (anOption.IsEqual ("italic"))
+ {
+ aTextPrs->SetFontAspect (Font_FA_Italic);
+ }
+ else if (anOption.IsEqual ("bolditalic"))
+ {
+ aTextPrs->SetFontAspect (Font_FA_BoldItalic);
+ }
+ }
+ else if (aParam == "-font")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
- Handle(Prs3d_TextAspect) asp = myDrawer->TextAspect();
-
- asp->SetFont(aFont.ToCString());
- asp->SetColor(aColor);
- asp->SetHeight(aHeight); // I am changing the myHeight value
-
- asp->SetHorizontalJustification(aHJustification);
- asp->SetVerticalJustification(aVJustification);
- asp->Aspect()->SetTextZoomable(aZoomable);
- asp->Aspect()->SetTextAngle(aAngle);
- asp->Aspect()->SetTextFontAspect(aFontAspect);
- Prs3d_Text::Draw(aPresentation, asp, aText, aPosition);
-
- /* This comment code is worked
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- Handle(Graphic3d_AspectFillArea3d) aspect = myDrawer->ShadingAspect()->Aspect();
- Graphic3d_Vertex vertices_text;
- vertices_text.SetCoord(aPosition.X(),aPosition.Y(),aPosition.Y());
- TheGroup->SetPrimitivesAspect(aspect);
- TheGroup->Text(aText,vertices_text,aHeight,Standard_True);
- */
-};
+ aTextPrs->SetFont (theArgVec[anArgIt]);
+ }
+ else if (aParam == "-plane")
+ {
+ if (anArgIt + 6 >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
-static int VDrawText (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
- // Check arguments
- if (argc < 14)
- {
- di<<"Error: "<<argv[0]<<" - invalid number of arguments\n";
- di<<"Usage: type help "<<argv[0]<<"\n";
- return 1; //TCL_ERROR
- }
+ Standard_Real aX = Draw::Atof (theArgVec[++anArgIt]);
+ Standard_Real aY = Draw::Atof (theArgVec[++anArgIt]);
+ Standard_Real aZ = Draw::Atof (theArgVec[++anArgIt]);
+ aNormal.SetCoord (aX, aY, aZ);
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ aX = Draw::Atof (theArgVec[++anArgIt]);
+ aY = Draw::Atof (theArgVec[++anArgIt]);
+ aZ = Draw::Atof (theArgVec[++anArgIt]);
+ aDirection.SetCoord (aX, aY, aZ);
- // Create 3D view if it doesn't exist
- if ( aContext.IsNull() )
- {
- ViewerTest::ViewerInit();
- aContext = ViewerTest::GetAISContext();
- if( aContext.IsNull() )
+ aHasPlane = Standard_True;
+ }
+ else if (aParam == "-flipping")
{
- di << "Error: Cannot create a 3D view\n";
- return 1; //TCL_ERROR
+ aTextPrs->SetFlipping (Standard_True);
}
- }
-
- // Text position
- const Standard_Real X = Draw::Atof(argv[2]);
- const Standard_Real Y = Draw::Atof(argv[3]);
- const Standard_Real Z = Draw::Atof(argv[4]);
- const gp_Pnt pnt(X,Y,Z);
-
- // Text color
- const Quantity_Parameter R = Draw::Atof(argv[5])/255.;
- const Quantity_Parameter G = Draw::Atof(argv[6])/255.;
- const Quantity_Parameter B = Draw::Atof(argv[7])/255.;
- const Quantity_Color aColor( R, G, B, Quantity_TOC_RGB );
+ else if (aParam == "-disptype"
+ || aParam == "-displaytype")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ TCollection_AsciiString aType (theArgVec[anArgIt]);
+ aType.LowerCase();
+ if (aType == "subtitle")
+ aDisplayType = Aspect_TODT_SUBTITLE;
+ else if (aType == "decal")
+ aDisplayType = Aspect_TODT_DEKALE;
+ else if (aType == "blend")
+ aDisplayType = Aspect_TODT_BLEND;
+ else if (aType == "dimension")
+ aDisplayType = Aspect_TODT_DIMENSION;
+ else if (aType == "normal")
+ aDisplayType = Aspect_TODT_NORMAL;
+ else
+ {
+ std::cout << "Error: wrong display type '" << aType << "'.\n";
+ return 1;
+ }
+ }
+ else if (aParam == "-subcolor"
+ || aParam == "-subtitlecolor")
+ {
+ if (anArgIt + 1 >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
- // Text alignment
- const int hor_align = Draw::Atoi(argv[8]);
- const int ver_align = Draw::Atoi(argv[9]);
+ TCollection_AsciiString aColor (theArgVec[anArgIt + 1]);
+ Quantity_NameOfColor aNameOfColor = Quantity_NOC_BLACK;
+ if (Quantity_Color::ColorFromName (aColor.ToCString(), aNameOfColor))
+ {
+ anArgIt += 1;
+ aTextPrs->SetColorSubTitle (aNameOfColor);
+ continue;
+ }
+ else if (anArgIt + 3 >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
- // Text angle
- const Standard_Real angle = Draw::Atof(argv[10]);
+ TCollection_AsciiString aGreen (theArgVec[anArgIt + 2]);
+ TCollection_AsciiString aBlue (theArgVec[anArgIt + 3]);
+ if (!aColor.IsRealValue()
+ || !aGreen.IsRealValue()
+ || !aBlue.IsRealValue())
+ {
+ std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
- // Text zooming
- const Standard_Boolean zoom = Draw::Atoi(argv[11]);
+ const Graphic3d_Vec3d anRGB (aColor.RealValue(),
+ aGreen.RealValue(),
+ aBlue.RealValue());
- // Text height
- const Standard_Real height = Draw::Atof(argv[12]);
+ aTextPrs->SetColorSubTitle (Quantity_Color (anRGB.r(), anRGB.g(), anRGB.b(), Quantity_TOC_RGB));
+ anArgIt += 3;
+ }
+ else if (aParam == "-2d")
+ {
+ aTrsfPersFlags = Graphic3d_TMF_2d;
+ }
+ else if (aParam == "-trsfperspos"
+ || aParam == "-perspos")
+ {
+ if (anArgIt + 2 >= theArgsNb)
+ {
+ std::cerr << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
- // Text aspect
- const Font_FontAspect aspect = Font_FontAspect(Draw::Atoi(argv[13]));
+ TCollection_AsciiString aX (theArgVec[++anArgIt]);
+ TCollection_AsciiString aY (theArgVec[++anArgIt]);
+ TCollection_AsciiString aZ = "0";
+ if (!aX.IsIntegerValue()
+ || !aY.IsIntegerValue())
+ {
+ std::cerr << "Error: wrong syntax at '" << aParam << "'.\n";
+ return 1;
+ }
+ if (anArgIt + 1 < theArgsNb)
+ {
+ TCollection_AsciiString aTemp = theArgVec[anArgIt + 1];
+ if (aTemp.IsIntegerValue())
+ {
+ aZ = aTemp;
+ ++anArgIt;
+ }
+ }
+ aTPPosition.SetCoord (aX.IntegerValue(), aY.IntegerValue(), aZ.IntegerValue());
+ }
+ else
+ {
+ std::cout << "Error: unknown argument '" << aParam << "'\n";
+ return 1;
+ }
+ }
- // Text font
- TCollection_AsciiString font;
- if(argc < 15)
- font.AssignCat("Courier");
- else
- font.AssignCat(argv[14]);
+ if (aHasPlane)
+ {
+ aTextPrs->SetOrientation3D (gp_Ax2 (aPos, aNormal, aDirection));
+ }
- // Text is multibyte
- const Standard_Boolean isMultibyte = (argc < 16)? Standard_False : (Draw::Atoi(argv[15]) != 0);
+ aTextPrs->SetDisplayType (aDisplayType);
- // Read text string
- TCollection_ExtendedString name;
- if (isMultibyte)
+ if (aTrsfPersFlags != Graphic3d_TMF_None)
{
- const char *str = argv[1];
- while ( *str || *(str+1)=='\x0A' || *(str+1)=='\x0B' || *(str+1)=='\x0C' || *(str+1)=='\x0D'
- || *(str+1)=='\x07' || *(str+1)=='\x08' || *(str+1)=='\x09' )
+ aTextPrs->SetTransformPersistence (aTrsfPersFlags, aTPPosition);
+ aTextPrs->SetZLayer(Graphic3d_ZLayerId_TopOSD);
+ if (aTextPrs->Position().Z() != 0)
{
- unsigned short c1 = *str++;
- unsigned short c2 = *str++;
- if (!c2) break;
- name += (Standard_ExtCharacter)((c1 << 8) | c2);
+ aTextPrs->SetPosition (gp_Pnt(aTextPrs->Position().X(), aTextPrs->Position().Y(), 0));
}
}
- else
- {
- name += argv[1];
- }
-
- if (name.Length())
+ else if (aTrsfPersFlags != aTextPrs->TransformPersistence().Flags)
{
- Handle(MyTextClass) myT = new MyTextClass(name,pnt,aColor,hor_align,ver_align,angle,zoom,height,aspect,font.ToCString());
- aContext->Display(myT,Standard_True);
+ aTextPrs->SetTransformPersistence (aTrsfPersFlags);
}
-
+ ViewerTest::Display (aName, aTextPrs, Standard_False);
return 0;
}
#include <TShort_HArray1OfShortReal.hxx>
#include <AIS_Triangulation.hxx>
-#include <StdPrs_ToolShadedShape.hxx>
+#include <StdPrs_ToolTriangulatedShape.hxx>
#include <Poly_Connect.hxx>
#include <TColgp_Array1OfDir.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <TopExp_Explorer.hxx>
#include <TopAbs.hxx>
#include <StdSelect_ShapeTypeFilter.hxx>
+#include <AIS_InteractiveObject.hxx>
//===============================================================================================
Nor = gp_Dir(eqPlan);
else
Nor = gp_Dir(0., 0., 1.);
-
- Standard_Integer j = (i - PointsOfArray.Lower()) * 3;
- Normals->SetValue(j + 1, (Standard_ShortReal)Nor.X());
- Normals->SetValue(j + 2, (Standard_ShortReal)Nor.Y());
- Normals->SetValue(j + 3, (Standard_ShortReal)Nor.Z());
+
+ Standard_Integer k = (i - PointsOfArray.Lower()) * 3;
+ Normals->SetValue(k + 1, (Standard_ShortReal)Nor.X());
+ Normals->SetValue(k + 2, (Standard_ShortReal)Nor.Y());
+ Normals->SetValue(k + 3, (Standard_ShortReal)Nor.Z());
}
delete pc;
if ( argc != 3 && argc != 12 )
{
di << "Usage: " << argv[0] << " ShapeName HlrName "
- << "[ eye_x eye_y eye_z dir_x dir_y dir_z upx upy upz ]" << "\n"
+ << "[ eye_x eye_y eye_z dir_x dir_y dir_z upx upy upz ]\n"
<< " ShapeName - name of the initial shape\n"
<< " HlrName - result hlr object from initial shape\n"
<< " eye, dir are eye position and look direction\n"
// This class is a wrap for Graphic3d_ArrayOfPrimitives; it is used for
// manipulating and displaying such an array with AIS context
-DEFINE_STANDARD_HANDLE(MyPArrayObject, AIS_InteractiveObject)
+
class MyPArrayObject : public AIS_InteractiveObject
{
myMarkerAspect = theMarkerAspect;
}
- DEFINE_STANDARD_RTTI(MyPArrayObject);
+ DEFINE_STANDARD_RTTI_INLINE(MyPArrayObject,AIS_InteractiveObject);
private:
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode);
+ const Standard_Integer aMode) Standard_OVERRIDE;
void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Integer /*theMode*/);
+ const Standard_Integer /*theMode*/) Standard_OVERRIDE;
bool CheckInputCommand (const TCollection_AsciiString theCommand,
const Handle(TColStd_HArray1OfAsciiString) theArgsArray,
};
-IMPLEMENT_STANDARD_HANDLE(MyPArrayObject, AIS_InteractiveObject)
-IMPLEMENT_STANDARD_RTTIEXT(MyPArrayObject, AIS_InteractiveObject)
void MyPArrayObject::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
//purpose : Change location of AIS interactive object
//=======================================================================
-static Standard_Integer VSetLocation (Draw_Interpretor& di,
- Standard_Integer argc,
- const char ** argv)
+static Standard_Integer VSetLocation (Draw_Interpretor& /*di*/,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
- std::cout << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+ std::cout << "Error: no active view!\n";
return 1;
}
- if (argc != 5)
- {
- std::cout << "ERROR : Usage : " << argv[0] << " name x y z; new location" << "\n";
- return 1;
- }
+ TCollection_AsciiString aName;
+ gp_Vec aLocVec;
+ Standard_Boolean isSetLoc = Standard_False;
- TCollection_AsciiString aName (argv[1]);
- Standard_Real aX = Draw::Atof (argv[2]);
- Standard_Real aY = Draw::Atof (argv[3]);
- Standard_Real aZ = Draw::Atof (argv[4]);
+ Standard_Integer anArgIter = 1;
+ for (; anArgIter < theArgNb; ++anArgIter)
+ {
+ Standard_CString anArg = theArgVec[anArgIter];
+ if (anUpdateTool.parseRedrawMode (theArgVec[anArgIter]))
+ {
+ continue;
+ }
+ else if (aName.IsEmpty())
+ {
+ aName = anArg;
+ }
+ else if (!isSetLoc)
+ {
+ isSetLoc = Standard_True;
+ if (anArgIter + 1 >= theArgNb)
+ {
+ std::cout << "Error: syntax error at '" << anArg << "'\n";
+ return 1;
+ }
+ aLocVec.SetX (Draw::Atof (theArgVec[anArgIter++]));
+ aLocVec.SetY (Draw::Atof (theArgVec[anArgIter]));
+ if (anArgIter + 1 < theArgNb)
+ {
+ aLocVec.SetZ (Draw::Atof (theArgVec[++anArgIter]));
+ }
+ }
+ else
+ {
+ std::cout << "Error: unknown argument '" << anArg << "'\n";
+ return 1;
+ }
+ }
// find object
- ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+ const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
Handle(AIS_InteractiveObject) anIObj;
- if (!aMap.IsBound2 (aName))
+ if (aMap.IsBound2 (aName))
+ {
+ anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
+ }
+ if (anIObj.IsNull())
{
- std::cout << "Use 'vdisplay' before" << "\n";
+ std::cout << "Error: object '" << aName << "' is not displayed!\n";
return 1;
}
- else
+
+ 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)
{
- anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
+ 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;
+
+ // Prefix 'vloc'
+ aName += 4;
+
+ if (!strcmp (aName, "reset"))
+ {
+ isReset = Standard_True;
+ }
+ else if (!strcmp (aName, "move"))
+ {
+ if (theArgNb < 3)
+ {
+ std::cout << "Error: too few arguments.\n";
+ return 1;
+ }
+
+ const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- // not an AIS_InteractiveObject
+ Handle(AIS_InteractiveObject) anIObj;
+ if (aMap.IsBound2 (theArgVec[theArgNb - 1]))
+ {
+ anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (theArgVec[theArgNb - 1]));
+ }
+
+ if (anIObj.IsNull())
+ {
+ std::cout << "Error: object '" << theArgVec[theArgNb - 1] << "' is not displayed!\n";
+ return 1;
+ }
+
+ isMove = Standard_True;
+
+ aTrsf = anIObj->Transformation();
+ aLast = theArgNb - 1;
+ }
+ else if (!strcmp (aName, "translate"))
+ {
+ if (theArgNb < 5)
+ {
+ std::cout << "Error: too few arguments.\n";
+ return 1;
+ }
+ 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)
+ {
+ 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));
+
+ aLast = theArgNb - 7;
+ }
+ else if (!strcmp (aName, "mirror"))
+ {
+ if (theArgNb < 8)
+ {
+ std::cout << "Error: too few arguments.\n";
+ return 1;
+ }
+
+ 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)
+ {
+ std::cout << "Error: too few arguments.\n";
+ return 1;
+ }
+
+ 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;
+ }
+
+ 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 << argv[1] << " : Not an AIS interactive object" << "\n";
+ std::cout << "Error: object '" << theArgVec[anIdx] << "' is not displayed!\n";
return 1;
}
+
+ if (isReset)
+ {
+ // aTrsf already identity
+ }
+ else if (isMove)
+ {
+ aTrsf = anIObj->LocalTransformation() * anIObj->Transformation().Inverted() * aTrsf;
+ }
+ else
+ {
+ aTrsf = anIObj->LocalTransformation() * aTrsf;
+ }
- gp_Trsf aTrsf;
- aTrsf.SetTranslation (gp_Vec (aX, aY, aZ));
TopLoc_Location aLocation (aTrsf);
aContext->SetLocation (anIObj, aLocation);
- aContext->UpdateCurrentViewer();
}
return 0;
}
else
{
- Standard_CString aName = anOriginObjectName.ToCString();
- TopoDS_Shape aTDShape = DBRep::Get (aName);
+ Standard_CString aOriginName = anOriginObjectName.ToCString();
+ TopoDS_Shape aTDShape = DBRep::Get (aOriginName);
if (aTDShape.IsNull())
{
std::cout << "vconnect error: object " << anOriginObjectName << " doesn't exist\n";
continue;
}
anObject = new AIS_Shape (aTDShape);
+ aContext->Load (anObject);
anObject->SetColor (ViewerTest::GetColorFromName (aColorName));
}
//===============================================================================================
//function : VConnectTo
//purpose : Creates and displays AIS_ConnectedInteractive object from input object and location
-//Draw arg : vconnectto name Xo Yo Zo object
+//Draw arg : vconnectto name Xo Yo Zo object [-nodisplay|-noupdate|-update]
//===============================================================================================
static Standard_Integer VConnectTo (Draw_Interpretor& /*di*/,
{
// Check the viewer
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
std::cout << "vconnect error : call vinit before\n";
return 1; // TCL_ERROR
}
// Check argumnets
- if (argc != 6)
+ if (argc != 6 && argc != 7)
{
std::cout << "vconnect error: expect at least 5 arguments\n";
return 1; // TCL_ERROR
}
else
{
- Standard_CString aName = anOriginObjectName.ToCString();
- TopoDS_Shape aTDShape = DBRep::Get (aName);
+ Standard_CString aOriginName = anOriginObjectName.ToCString();
+ TopoDS_Shape aTDShape = DBRep::Get (aOriginName);
if (aTDShape.IsNull())
{
std::cout << "vconnect error: object " << anOriginObjectName << " doesn't exist\n";
return 1; // TCL_ERROR
}
anOriginObject = new AIS_Shape (aTDShape);
+ GetMapOfAIS().Bind (anOriginObject, anOriginObjectName);
}
// Get location data
// Bind connected object to its name
GetMapOfAIS().Bind (aConnected, aName);
+ if (argc == 7)
+ {
+ TCollection_AsciiString anArg = argv[6];
+ anArg.LowerCase();
+ if (anArg == "-nodisplay")
+ return 0;
+
+ if (!anUpdateTool.parseRedrawMode (anArg))
+ {
+ std::cout << "Warning! Unknown argument '" << anArg << "' passed, -nodisplay|-noupdate|-update expected at this point.\n";
+ }
+ }
+
// Display connected object
- TheAISContext()->Display (aConnected);
+ TheAISContext()->Display (aConnected, Standard_False);
return 0;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+ std::cout << argv[0] << "ERROR : use 'vinit' command before \n";
return 1;
}
if (argc != 3)
{
- std::cout << "ERROR : Usage : " << argv[0] << " name object" << "\n";
+ std::cout << "ERROR : Usage : " << argv[0] << " name object\n";
return 1;
}
Handle(AIS_MultipleConnectedInteractive) anAssembly;
if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before" << "\n";
+ std::cout << "Use 'vdisplay' before\n";
return 1;
}
anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
if (anAssembly.IsNull())
{
- di << "Not an assembly" << "\n";
+ di << "Not an assembly\n";
return 1;
}
}
else
{
- std::cout << "Use 'vdisplay' before" << "\n";
+ std::cout << "Use 'vdisplay' before\n";
return 1;
}
}
anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (anObject));
}
- anAssembly->Disconnect (anIObj);
+ aContext->Disconnect (anAssembly, anIObj);
aContext->UpdateCurrentViewer();
return 0;
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << "error : use 'vinit' command before " << "\n";
+ std::cout << argv[0] << "error : use 'vinit' command before \n";
return 1;
}
Handle(AIS_MultipleConnectedInteractive) anAssembly;
if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before" << "\n";
+ std::cout << "Use 'vdisplay' before\n";
return 1;
}
anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
if (anAssembly.IsNull())
{
- di << "Not an assembly" << "\n";
+ di << "Not an assembly\n";
return 1;
}
Handle(AIS_InteractiveObject) anIObj;
if (!aMap.IsBound2 (anObject))
{
- std::cout << "Use 'vdisplay' before" << "\n";
+ std::cout << "Use 'vdisplay' before\n";
return 1;
}
//function : VListConnected
//purpose :
//=======================================================================
-static Standard_Integer VListConnected (Draw_Interpretor& di,
+static Standard_Integer VListConnected (Draw_Interpretor& /*di*/,
Standard_Integer argc,
const char ** argv)
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+ std::cout << argv[0] << "ERROR : use 'vinit' command before \n";
return 1;
}
if (argc != 2)
{
- std::cout << "ERROR : Usage : " << argv[0] << " name" << "\n";
+ std::cout << "ERROR : Usage : " << argv[0] << " name\n";
return 1;
}
Handle(AIS_MultipleConnectedInteractive) anAssembly;
if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before" << "\n";
+ std::cout << "Use 'vdisplay' before\n";
return 1;
}
anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
if (anAssembly.IsNull())
{
- std::cout << "Not an assembly" << "\n";
+ std::cout << "Not an assembly\n";
return 1;
}
{
if (GetMapOfAIS().IsBound1 (anIter.Value()))
{
- TCollection_AsciiString aName = GetMapOfAIS().Find1 (anIter.Value());
- std::cout << aCounter << ") " << aName << " (" << anIter.Value()->DynamicType()->Name() << ")";
+ TCollection_AsciiString aCuurrentName = GetMapOfAIS().Find1 (anIter.Value());
+ std::cout << aCounter << ") " << aCuurrentName << " (" << anIter.Value()->DynamicType()->Name() << ")";
}
std::cout << aCounter << ") " << anIter.Value()->DynamicType()->Name();
}
return Standard_False;
}
-};
+}
//===============================================================================================
//function : VSetSelectionMode
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
if (anAISContext.IsNull())
{
- std::cerr << "Call vinit before!\n";
+ std::cerr << "Call vinit before!" << std::endl;
return 1;
}
// Check the arguments
- if (theArgc != 3 && theArgc != 4)
+ if (theArgc < 3 && theArgc > 5)
{
std::cerr << "vselmode error : expects at least 2 arguments.\n"
- << "Type help "<< theArgv[0] <<" for more information.";
+ << "Type help "<< theArgv[0] <<" for more information." << std::endl;
return 1;
}
+ TCollection_AsciiString aLastArg (theArgv[theArgc - 1]);
+ aLastArg.LowerCase();
+ Standard_Boolean isToOpenLocalCtx = aLastArg == "-local";
+
// get objects to change selection mode
AIS_ListOfInteractive aTargetIOs;
- if (theArgc == 3)
+ Standard_Integer anArgNb = isToOpenLocalCtx ? theArgc - 1 : theArgc;
+ if (anArgNb == 3)
{
anAISContext->DisplayedObjects (aTargetIOs);
}
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aNameIO));
if (anIO.IsNull())
{
- std::cerr << "vselmode error : object name is used for non AIS viewer\n";
+ std::cerr << "vselmode error : object name is used for non AIS viewer" << std::endl;
return 1;
}
aTargetIOs.Append (anIO);
}
}
- const Standard_Integer aSelectionMode = Draw::Atoi (theArgc == 3 ? theArgv[1] : theArgv[2]);
- const Standard_Boolean toTurnOn = Draw::Atoi (theArgc == 3 ? theArgv[2] : theArgv[3]);
+ const Standard_Integer aSelectionMode = Draw::Atoi (anArgNb == 3 ? theArgv[1] : theArgv[2]);
+ const Standard_Boolean toTurnOn = Draw::Atoi (anArgNb == 3 ? theArgv[2] : theArgv[3]);
if (aSelectionMode == 0 && anAISContext->HasOpenedContext())
{
anAISContext->CloseLocalContext();
}
+ if (aSelectionMode == 0)
+ {
+ if (toTurnOn)
+ {
+ for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
+ {
+ const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
+ TColStd_ListOfInteger anActiveModes;
+ anAISContext->ActivatedModes (anIO, anActiveModes);
+ if (!anActiveModes.IsEmpty())
+ {
+ anAISContext->Deactivate (anIO);
+ }
+ if (!InList (anAISContext, anIO, aSelectionMode))
+ {
+ anAISContext->Activate (anIO);
+ }
+ }
+ }
+ else
+ {
+ for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
+ {
+ const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
+ if (InList (anAISContext, anIO, aSelectionMode))
+ {
+ anAISContext->Deactivate (anIO);
+ }
+ }
+ }
+ }
+
if (aSelectionMode != 0 && toTurnOn) // Turn on specified mode
{
- if (!anAISContext->HasOpenedContext())
+ if (!anAISContext->HasOpenedContext() && isToOpenLocalCtx)
{
anAISContext->OpenLocalContext (Standard_False);
}
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);
if (aSelectionMode != 0 && !toTurnOn) // Turn off specified mode
{
- if (!anAISContext->HasOpenedContext())
- {
- return 0;
- }
-
for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
{
const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
return 0;
}
+//===============================================================================================
+//function : VSelectionNext
+//purpose :
+//===============================================================================================
+static Standard_Integer VSelectionNext(Draw_Interpretor& /*theDI*/,
+ Standard_Integer /*theArgsNb*/,
+ const char** /*theArgVec*/)
+{
+ // Check errors
+ Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+
+ if (anAISContext.IsNull())
+ {
+ std::cerr << "Call vinit before!" << std::endl;
+ return 1;
+ }
+
+ anAISContext->HilightNextDetected(aView);
+ return 0;
+}
+
+//===============================================================================================
+//function : VSelectionPrevious
+//purpose :
+//===============================================================================================
+static Standard_Integer VSelectionPrevious(Draw_Interpretor& /*theDI*/,
+ Standard_Integer /*theArgsNb*/,
+ const char** /*theArgVec*/)
+{
+ // Check errors
+ Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+
+ if (anAISContext.IsNull())
+ {
+ std::cerr << "Call vinit before!" << std::endl;
+ return 1;
+ }
+
+ anAISContext->HilightPreviousDetected(aView);
+ return 0;
+}
+
+
//==========================================================================
//class : Triangle
//purpose : creates Triangle based on AIS_InteractiveObject.
// This class was implemented for testing Select3D_SensitiveTriangle
//===========================================================================
-DEFINE_STANDARD_HANDLE(Triangle, AIS_InteractiveObject)
+
class Triangle: public AIS_InteractiveObject
{
public:
// CASCADE RTTI
- DEFINE_STANDARD_RTTI(FilledCircle);
+ DEFINE_STANDARD_RTTI_INLINE(Triangle,AIS_InteractiveObject);
Triangle (const gp_Pnt& theP1,
const gp_Pnt& theP2,
const gp_Pnt& theP3);
protected:
void Compute ( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
- const Standard_Integer theMode);
+ const Standard_Integer theMode) Standard_OVERRIDE;
void ComputeSelection ( const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Integer theMode);
+ const Standard_Integer theMode) Standard_OVERRIDE;
private:
gp_Pnt myPoint1;
gp_Pnt myPoint2;
gp_Pnt myPoint3;
};
-IMPLEMENT_STANDARD_HANDLE(Triangle, AIS_InteractiveObject)
-IMPLEMENT_STANDARD_RTTIEXT(Triangle, AIS_InteractiveObject)
+
Triangle::Triangle (const gp_Pnt& theP1,
const gp_Pnt& theP2,
//class : SegmentObject
//purpose: creates segment based on AIS_InteractiveObject.
// This class was implemented for testing Select3D_SensitiveCurve
-DEFINE_STANDARD_HANDLE(SegmentObject, AIS_InteractiveObject)
+
class SegmentObject: public AIS_InteractiveObject
{
public:
// CASCADE RTTI
- DEFINE_STANDARD_RTTI(SegmentObject);
+ DEFINE_STANDARD_RTTI_INLINE(SegmentObject,AIS_InteractiveObject);
SegmentObject (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2);
protected:
void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
- const Standard_Integer theMode);
+ const Standard_Integer theMode) Standard_OVERRIDE;
void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Integer theMode);
+ const Standard_Integer theMode) Standard_OVERRIDE;
private:
gp_Pnt myPoint1;
gp_Pnt myPoint2;
};
-IMPLEMENT_STANDARD_HANDLE(SegmentObject, AIS_InteractiveObject)
-IMPLEMENT_STANDARD_RTTIEXT(SegmentObject, AIS_InteractiveObject)
+
SegmentObject::SegmentObject (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2)
{
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
if (!aMap.IsBound2 (aName))
{
- di << "Use 'vdisplay' before" << "\n";
+ di << "Use 'vdisplay' before\n";
return 1;
}
}
// This class is used for testing markers.
-DEFINE_STANDARD_HANDLE(ViewerTest_MarkersArrayObject, AIS_InteractiveObject)
+
class ViewerTest_MarkersArrayObject : public AIS_InteractiveObject
{
myMarkerAspect = theMarkerAspect;
}
- DEFINE_STANDARD_RTTI(MyPArrayObject);
+ DEFINE_STANDARD_RTTI_INLINE(MyPArrayObject,AIS_InteractiveObject);
private:
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode);
+ const Standard_Integer aMode) Standard_OVERRIDE;
void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Integer /*theMode*/);
+ const Standard_Integer /*theMode*/) Standard_OVERRIDE;
protected:
Handle(Graphic3d_AspectMarker3d) myMarkerAspect;
};
-IMPLEMENT_STANDARD_HANDLE(ViewerTest_MarkersArrayObject, AIS_InteractiveObject)
-IMPLEMENT_STANDARD_RTTIEXT(ViewerTest_MarkersArrayObject, AIS_InteractiveObject)
void ViewerTest_MarkersArrayObject::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
std::cerr << "Could not load image from file '" << aFileName << "'!\n";
return 1;
}
+ if (anImage->Format() == Image_PixMap::ImgGray)
+ {
+ anImage->SetFormat (Image_PixMap::ImgAlpha);
+ }
+ else if (anImage->Format() == Image_PixMap::ImgGrayF)
+ {
+ anImage->SetFormat (Image_PixMap::ImgAlphaF);
+ }
anAspect = new Graphic3d_AspectMarker3d (anImage);
}
else
//function : TextToBrep
//purpose : Tool for conversion text to occt-shapes
//=======================================================================
-
static int TextToBRep (Draw_Interpretor& /*theDI*/,
Standard_Integer theArgNb,
const char** theArgVec)
{
// Check arguments
- if (theArgNb < 5)
+ if (theArgNb < 3)
{
std::cerr << "Error: " << theArgVec[0] << " - invalid syntax\n";
return 1;
}
- Standard_Integer anArgIter = 1;
- Standard_CString aResName = theArgVec[anArgIter++];
- Standard_CString aText = theArgVec[anArgIter++];
- Standard_CString aFontName = theArgVec[anArgIter++];
- const Standard_Real aSize = Atof (theArgVec[anArgIter++]);
+ Standard_Integer anArgIt = 1;
+ Standard_CString aName = theArgVec[anArgIt++];
+ Standard_CString aText = theArgVec[anArgIt++];
- Font_BRepFont aFont;
- Font_FontAspect aFontAspect = Font_FA_Regular;
- Standard_Boolean isCompositeCurve = Standard_False;
- gp_Ax3 aPenAx3 (gp::XOY());
- gp_Pnt aPenLoc;
- while (anArgIter < theArgNb)
+ Font_BRepFont aFont;
+ TCollection_AsciiString aFontName ("Courier");
+ Standard_Real aTextHeight = 16.0;
+ Font_FontAspect aFontAspect = Font_FA_Regular;
+ Standard_Boolean anIsCompositeCurve = Standard_False;
+ gp_Ax3 aPenAx3 (gp::XOY());
+ gp_Dir aNormal (0.0, 0.0, 1.0);
+ gp_Dir aDirection (1.0, 0.0, 0.0);
+ gp_Pnt aPenLoc;
+
+ Graphic3d_HorizontalTextAlignment aHJustification = Graphic3d_HTA_LEFT;
+ Graphic3d_VerticalTextAlignment aVJustification = Graphic3d_VTA_BOTTOM;
+
+ for (; anArgIt < theArgNb; ++anArgIt)
{
- const TCollection_AsciiString anArg (theArgVec[anArgIter++]);
- TCollection_AsciiString anArgCase (anArg);
- anArgCase.LowerCase();
- if (anArgCase.Search ("x=") > -1)
+ TCollection_AsciiString aParam (theArgVec[anArgIt]);
+ aParam.LowerCase();
+
+ if (aParam == "-pos"
+ || aParam == "-position")
{
- aPenLoc.SetX (anArg.Token ("=", 2).RealValue());
+ if (anArgIt + 3 >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ aPenLoc.SetX (Draw::Atof(theArgVec[++anArgIt]));
+ aPenLoc.SetY (Draw::Atof(theArgVec[++anArgIt]));
+ aPenLoc.SetZ (Draw::Atof(theArgVec[++anArgIt]));
}
- else if (anArgCase.Search ("y=") > -1)
+ else if (aParam == "-halign")
{
- aPenLoc.SetY (anArg.Token ("=", 2).RealValue());
+ if (++anArgIt >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aType (theArgVec[anArgIt]);
+ aType.LowerCase();
+ if (aType == "left")
+ {
+ aHJustification = Graphic3d_HTA_LEFT;
+ }
+ else if (aType == "center")
+ {
+ aHJustification = Graphic3d_HTA_CENTER;
+ }
+ else if (aType == "right")
+ {
+ aHJustification = Graphic3d_HTA_RIGHT;
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ }
+ else if (aParam == "-valign")
+ {
+ if (++anArgIt >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aType (theArgVec[anArgIt]);
+ aType.LowerCase();
+ if (aType == "top")
+ {
+ aVJustification = Graphic3d_VTA_TOP;
+ }
+ else if (aType == "center")
+ {
+ aVJustification = Graphic3d_VTA_CENTER;
+ }
+ else if (aType == "bottom")
+ {
+ aVJustification = Graphic3d_VTA_BOTTOM;
+ }
+ else if (aType == "topfirstline")
+ {
+ aVJustification = Graphic3d_VTA_TOPFIRSTLINE;
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
}
- else if (anArgCase.Search ("z=") > -1)
+ else if (aParam == "-height")
{
- aPenLoc.SetZ (anArg.Token ("=", 2).RealValue());
+ if (++anArgIt >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ aTextHeight = Draw::Atof(theArgVec[anArgIt]);
+ }
+ else if (aParam == "-aspect")
+ {
+ if (++anArgIt >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ TCollection_AsciiString anOption (theArgVec[anArgIt]);
+ anOption.LowerCase();
+
+ if (anOption.IsEqual ("regular"))
+ {
+ aFontAspect = Font_FA_Regular;
+ }
+ else if (anOption.IsEqual ("bold"))
+ {
+ aFontAspect = Font_FA_Bold;
+ }
+ else if (anOption.IsEqual ("italic"))
+ {
+ aFontAspect = Font_FA_Italic;
+ }
+ else if (anOption.IsEqual ("bolditalic"))
+ {
+ aFontAspect = Font_FA_BoldItalic;
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ }
+ else if (aParam == "-font")
+ {
+ if (++anArgIt >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ aFontName = theArgVec[anArgIt];
}
- else if (anArgCase.Search ("composite=") > -1)
+ else if (aParam == "-composite")
{
- isCompositeCurve = (anArg.Token ("=", 2).IntegerValue() == 1);
+ if (++anArgIt >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ ViewerTest::ParseOnOff (theArgVec[anArgIt], anIsCompositeCurve);
}
- else if (parseFontStyle (anArgCase, aFontAspect))
+ else if (aParam == "-plane")
{
- //
+ if (anArgIt + 6 >= theArgNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+
+ Standard_Real aX = Draw::Atof (theArgVec[++anArgIt]);
+ Standard_Real aY = Draw::Atof (theArgVec[++anArgIt]);
+ Standard_Real aZ = Draw::Atof (theArgVec[++anArgIt]);
+ aNormal.SetCoord (aX, aY, aZ);
+
+ aX = Draw::Atof (theArgVec[++anArgIt]);
+ aY = Draw::Atof (theArgVec[++anArgIt]);
+ aZ = Draw::Atof (theArgVec[++anArgIt]);
+ aDirection.SetCoord (aX, aY, aZ);
}
else
{
- std::cerr << "Warning! Unknown argument '" << anArg.ToCString() << "'\n";
+ std::cerr << "Warning! Unknown argument '" << aParam << "'\n";
}
}
- aFont.SetCompositeCurveMode (isCompositeCurve);
- if (!aFont.Init (aFontName, aFontAspect, aSize))
+ aFont.SetCompositeCurveMode (anIsCompositeCurve);
+ if (!aFont.Init (aFontName.ToCString(), aFontAspect, aTextHeight))
{
std::cerr << "Font initialization error\n";
return 1;
}
- aPenAx3.SetLocation (aPenLoc);
- DBRep::Set (aResName, aFont.RenderText (aText, aPenAx3));
+ aPenAx3 = gp_Ax3 (aPenLoc, aNormal, aDirection);
+
+ Font_BRepTextBuilder aBuilder;
+ DBRep::Set (aName, aBuilder.Perform (aFont, aText, aPenAx3, aHJustification, aVJustification));
return 0;
}
return 0;
}
+//=======================================================================
+//function : VPointCloud
+//purpose : Create interactive object for arbitary set of points.
+//=======================================================================
+static Standard_Integer VPointCloud (Draw_Interpretor& theDI,
+ Standard_Integer theArgNum,
+ const char** theArgs)
+{
+ Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
+ if (anAISContext.IsNull())
+ {
+ std::cerr << "Error: no active view!\n";
+ return 1;
+ }
+
+ // command to execute
+ enum Command
+ {
+ CloudForShape, // generate point cloud for shape
+ CloudSphere, // generate point cloud for generic sphere
+ Unknow
+ };
+
+ // count number of non-optional command arguments
+ Command aCmd = Unknow;
+ Standard_Integer aCmdArgs = 0;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNum; ++anArgIter)
+ {
+ Standard_CString anArg = theArgs[anArgIter];
+ TCollection_AsciiString aFlag (anArg);
+ aFlag.LowerCase();
+ if (aFlag.IsRealValue() || aFlag.Search ("-") != 1)
+ {
+ aCmdArgs++;
+ }
+ }
+ switch (aCmdArgs)
+ {
+ case 2 : aCmd = CloudForShape; break;
+ case 7 : aCmd = CloudSphere; break;
+ default :
+ std::cout << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgs[0]);
+ return 1;
+ }
+
+ // parse options
+ Standard_Boolean toRandColors = Standard_False;
+ Standard_Boolean hasNormals = Standard_True;
+ Standard_Boolean isSetArgNorm = Standard_False;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNum; ++anArgIter)
+ {
+ Standard_CString anArg = theArgs[anArgIter];
+ TCollection_AsciiString aFlag (anArg);
+ aFlag.LowerCase();
+ if (aFlag == "-randcolors"
+ || aFlag == "-randcolor")
+ {
+ if (isSetArgNorm && hasNormals)
+ {
+ std::cout << "Error: wrong syntax - normals can not be enabled with colors at the same time\n";
+ return 1;
+ }
+ toRandColors = Standard_True;
+ hasNormals = Standard_False;
+ }
+ else if (aFlag == "-normals"
+ || aFlag == "-normal")
+ {
+ if (toRandColors)
+ {
+ std::cout << "Error: wrong syntax - normals can not be enabled with colors at the same time\n";
+ return 1;
+ }
+ isSetArgNorm = Standard_True;
+ hasNormals = Standard_True;
+ }
+ else if (aFlag == "-nonormals"
+ || aFlag == "-nonormal")
+ {
+ isSetArgNorm = Standard_True;
+ hasNormals = Standard_False;
+ }
+ }
+
+ Standard_CString aName = theArgs[1];
+
+ // generate arbitrary set of points
+ Handle(Graphic3d_ArrayOfPoints) anArrayPoints;
+ if (aCmd == CloudForShape)
+ {
+ Standard_CString aShapeName = theArgs[2];
+ TopoDS_Shape aShape = DBRep::Get (aShapeName);
+
+ if (aShape.IsNull())
+ {
+ std::cout << "Error: no shape with name '" << aShapeName << "' found\n";
+ return 1;
+ }
+
+ // calculate number of points
+ TopLoc_Location aLocation;
+ Standard_Integer aNbPoints = 0;
+ for (TopExp_Explorer aFaceIt (aShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
+ {
+ const TopoDS_Face& aFace = TopoDS::Face (aFaceIt.Current());
+ Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (aFace, aLocation);
+ if (!aTriangulation.IsNull())
+ {
+ aNbPoints += aTriangulation->NbNodes();
+ }
+ }
+ if (aNbPoints < 3)
+ {
+ std::cout << "Error: shape should be triangulated!\n";
+ return 1;
+ }
+
+ anArrayPoints = new Graphic3d_ArrayOfPoints (aNbPoints, toRandColors, hasNormals);
+ for (TopExp_Explorer aFaceIt (aShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
+ {
+ const TopoDS_Face& aFace = TopoDS::Face (aFaceIt.Current());
+ Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (aFace, aLocation);
+ if (aTriangulation.IsNull())
+ {
+ continue;
+ }
+
+ const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes();
+ const gp_Trsf& aTrsf = aLocation.Transformation();
+
+ // extract normals from nodes
+ TColgp_Array1OfDir aNormals (aNodes.Lower(), hasNormals ? aNodes.Upper() : aNodes.Lower());
+ if (hasNormals)
+ {
+ Poly_Connect aPolyConnect (aTriangulation);
+ StdPrs_ToolTriangulatedShape::Normal (aFace, aPolyConnect, aNormals);
+ }
+
+ for (Standard_Integer aNodeIter = aNodes.Lower(); aNodeIter <= aNodes.Upper(); ++aNodeIter)
+ {
+ gp_Pnt aPoint = aNodes (aNodeIter);
+ if (!aLocation.IsIdentity())
+ {
+ aPoint.Transform (aTrsf);
+ if (hasNormals)
+ {
+ aNormals (aNodeIter).Transform (aTrsf);
+ }
+ }
+
+ // add vertex into array of points
+ const Standard_Integer anIndexOfPoint = anArrayPoints->AddVertex (aPoint);
+ if (toRandColors)
+ {
+ Quantity_Color aColor (360.0 * Standard_Real(anIndexOfPoint) / Standard_Real(aNbPoints),
+ 1.0, 0.5, Quantity_TOC_HLS);
+ anArrayPoints->SetVertexColor (anIndexOfPoint, aColor);
+ }
+
+ if (hasNormals)
+ {
+ anArrayPoints->SetVertexNormal (anIndexOfPoint, aNormals (aNodeIter));
+ }
+ }
+ }
+ }
+ else if (aCmd == CloudSphere)
+ {
+ Standard_Real aCenterX = Draw::Atof (theArgs[2]);
+ Standard_Real aCenterY = Draw::Atof (theArgs[3]);
+ Standard_Real aCenterZ = Draw::Atof (theArgs[4]);
+ Standard_Real aRadius = Draw::Atof (theArgs[5]);
+ Standard_Integer aNbPoints = Draw::Atoi (theArgs[6]);
+
+ TCollection_AsciiString aDistribution = TCollection_AsciiString(theArgs[7]);
+ aDistribution.LowerCase();
+ if ( aDistribution != "surface" && aDistribution != "volume" )
+ {
+ std::cout << "Error: wrong arguments! See usage:\n";
+ theDI.PrintHelp (theArgs[0]);
+ return 1;
+ }
+ Standard_Boolean isSurface = aDistribution == "surface";
+
+ gp_Pnt aCenter(aCenterX, aCenterY, aCenterZ);
+
+ anArrayPoints = new Graphic3d_ArrayOfPoints (aNbPoints, toRandColors, hasNormals);
+ for (Standard_Integer aPntIt = 0; aPntIt < aNbPoints; ++aPntIt)
+ {
+ Standard_Real anAlpha = (Standard_Real (rand() % 2000) / 1000.0) * M_PI;
+ Standard_Real aBeta = (Standard_Real (rand() % 2000) / 1000.0) * M_PI;
+ Standard_Real aDistance = isSurface ?
+ aRadius : (Standard_Real (rand() % aNbPoints) / aNbPoints) * aRadius;
+
+ gp_Dir aDir (Cos (anAlpha) * Sin (aBeta),
+ Sin (anAlpha),
+ Cos (anAlpha) * Cos (aBeta));
+ gp_Pnt aPoint = aCenter.Translated (aDir.XYZ() * aDistance);
+
+ const Standard_Integer anIndexOfPoint = anArrayPoints->AddVertex (aPoint);
+ if (toRandColors)
+ {
+ Quantity_Color aColor (360.0 * Standard_Real (anIndexOfPoint) / Standard_Real (aNbPoints),
+ 1.0, 0.5, Quantity_TOC_HLS);
+ anArrayPoints->SetVertexColor (anIndexOfPoint, aColor);
+ }
+
+ if (hasNormals)
+ {
+ anArrayPoints->SetVertexNormal (anIndexOfPoint, aDir);
+ }
+ }
+ }
+
+ // set array of points in point cloud object
+ Handle(AIS_PointCloud) aPointCloud = new AIS_PointCloud();
+ aPointCloud->SetPoints (anArrayPoints);
+ VDisplayAISObject (aName, aPointCloud);
+ return 0;
+}
+
+//=======================================================================
+//function : VPriority
+//purpose : Prints or sets the display priority for an object
+//=======================================================================
+
+static int VPriority (Draw_Interpretor& theDI,
+ Standard_Integer theArgNum,
+ const char** theArgs)
+{
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
+ if (aContext.IsNull())
+ {
+ std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
+ return 1;
+ }
+
+ TCollection_AsciiString aLastArg (theArgs[theArgNum - 1]);
+ Standard_Integer aPriority = -1;
+ Standard_Integer aNbArgs = theArgNum;
+ if (aLastArg.IsIntegerValue())
+ {
+ aPriority = aLastArg.IntegerValue();
+ --aNbArgs;
+ if (aPriority < 0 || aPriority > 10)
+ {
+ std::cout << "Error: the specified display priority value '" << aLastArg
+ << "' is outside the valid range [0..10]" << std::endl;
+ return 1;
+ }
+ }
+ else
+ {
+ anUpdateTool.Invalidate();
+ }
+
+ if (aNbArgs < 2)
+ {
+ std::cout << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgs[0]);
+ return 1;
+ }
+
+ for (Standard_Integer anArgIter = 1; anArgIter < aNbArgs; ++anArgIter)
+ {
+ if (anUpdateTool.parseRedrawMode (theArgs[anArgIter]))
+ {
+ continue;
+ }
+
+ TCollection_AsciiString aName (theArgs[anArgIter]);
+ Handle(AIS_InteractiveObject) anIObj;
+ if (GetMapOfAIS().IsBound2 (aName))
+ {
+ anIObj = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
+ }
+
+ if (anIObj.IsNull())
+ {
+ std::cout << "Error: the object '" << theArgs[1] << "' is not displayed" << std::endl;
+ return 1;
+ }
+
+ if (aPriority < 1)
+ {
+ theDI << aContext->DisplayPriority (anIObj) << " ";
+ }
+ else
+ {
+ aContext->SetDisplayPriority (anIObj, aPriority);
+ }
+ }
+ return 0;
+}
+
//=======================================================================
//function : ObjectsCommands
//purpose :
{
const char *group ="AISObjects";
theCommands.Add("vtrihedron",
- "vtrihedron : vtrihedron name [Xo] [Yo] [Zo] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw] ",
+ "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("vtri2d",
- "vtri2d Name Selection in the viewer only ",
+ "vtri2d Name"
+ "\n\t\t: Creates a plane with a 2D trihedron from an interactively selected face.",
__FILE__,VTrihedron2D ,group);
theCommands.Add("vplanetri",
- "vplanetri Name Selection in the viewer only ",
+ "vplanetri name"
+ "\n\t\t: Create a plane from a trihedron selection. If no arguments are set, the default",
__FILE__,VPlaneTrihedron ,group);
theCommands.Add("vsize",
- "vsize : vsize [name(Default=Current)] [size(Default=100)] ",
+ "vsize : vsize [name(Default=Current)] [size(Default=100)] "
+ "\n\t\t: Changes the size of a named or selected trihedron."
+ "\n\t\t: If the name is not defined: it affects the selected trihedrons otherwise nothing is done."
+ "\n\t\t: If the value is not defined: it is set to 100 by default.",
__FILE__,VSize,group);
theCommands.Add("vaxis",
- "vaxis nom [Xa] [Ya] [Za] [Xb] [Yb] [Zb]",
+ "vaxis name [Xa] [Ya] [Za] [Xb] [Yb] [Zb]"
+ "\n\t\t: Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge",
__FILE__,VAxisBuilder,group);
theCommands.Add("vaxispara",
- "vaxispara nom ",
+ "vaxispara name "
+ "\n\t\t: Creates an axis by interactive selection of an edge and a vertex.",
__FILE__,VAxisBuilder,group);
theCommands.Add("vaxisortho",
- "vaxisotho nom ",
+ "vaxisortho name "
+ "\n\t\t: Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.",
__FILE__,VAxisBuilder,group);
theCommands.Add("vpoint",
- "vpoint PointName [Xa] [Ya] [Za] ",
+ "vpoint PointName [Xa] [Ya] [Za] "
+ "\n\t\t: Creates a point from coordinates. If the values are not defined,"
+ "\n\t\t: a point is created by interactive selection of a vertice or an edge (in the center of the edge).",
__FILE__,VPointBuilder,group);
theCommands.Add("vplane",
- "vplane PlaneName [AxisName/PlaneName/PointName] [PointName/PointName/PointName] [Nothing/Nothing/PointName] [TypeOfSensitivity]",
+ "vplane PlaneName [AxisName/PlaneName/PointName] [PointName/PointName/PointName] [Nothing/Nothing/PointName] [TypeOfSensitivity {0|1}]"
+ "\n\t\t: Creates a plane from named or interactively selected entities."
+ "\n\t\t: TypeOfSensitivity:"
+ "\n\t\t: 0 - Interior"
+ "\n\t\t: 1 - Boundary",
__FILE__,VPlaneBuilder,group);
theCommands.Add ("vchangeplane", "vchangeplane usage: \n"
__FILE__, VChangePlane, group);
theCommands.Add("vplanepara",
- "vplanepara PlaneName ",
+ "vplanepara PlaneName "
+ "\n\t\t: Creates a plane from interactively selected vertex and face.",
__FILE__,VPlaneBuilder,group);
theCommands.Add("vplaneortho",
- "vplaneortho PlaneName ",
+ "vplaneortho PlaneName "
+ "\n\t\t: Creates a plane from interactive selected face and coplanar edge. ",
__FILE__,VPlaneBuilder,group);
theCommands.Add("vline",
- "vline: vline LineName [Xa/PointName] [Ya/PointName] [Za] [Xb] [Yb] [Zb] ",
+ "vline LineName [Xa/PointName] [Ya/PointName] [Za] [Xb] [Yb] [Zb] "
+ "\n\t\t: Creates a line from coordinates, named or interactively selected vertices. ",
__FILE__,VLineBuilder,group);
theCommands.Add("vcircle",
- "vcircle CircleName [PointName PointName PointName IsFilled]\n\t\t\t\t\t[PlaneName PointName Radius IsFilled]",
+ "vcircle CircleName [PointName PointName PointName IsFilled]\n\t\t\t\t\t[PlaneName PointName Radius IsFilled]"
+ "\n\t\t: Creates a circle from named or interactively selected entities."
+ "\n\t\t: Parameter IsFilled is defined as 0 or 1.",
__FILE__,VCircleBuilder,group);
- theCommands.Add("vdrawtext",
- "vdrawtext : vdrawtext name X Y Z R G B hor_align ver_align angle zoomable height Aspect [Font [isMultiByte]]",
- __FILE__,VDrawText,group);
+ theCommands.Add ("vdrawtext",
+ "vdrawtext name text"
+ "\n\t\t: [-pos X=0 Y=0 Z=0]"
+ "\n\t\t: [-color {R G B|name}=yellow]"
+ "\n\t\t: [-halign {left|center|right}=left]"
+ "\n\t\t: [-valign {top|center|bottom|topfirstline}=bottom}]"
+ "\n\t\t: [-angle angle=0]"
+ "\n\t\t: [-zoom {0|1}=0]"
+ "\n\t\t: [-height height=16]"
+ "\n\t\t: [-aspect {regular|bold|italic|bolditalic}=regular]"
+ "\n\t\t: [-font font=Times]"
+ "\n\t\t: [-2d]"
+ "\n\t\t: [-perspos {X Y Z}=0 0 0], where"
+ "\n\t\t X and Y define the coordinate origin in 2d space relative to the view window"
+ "\n\t\t Example: X=0 Y=0 is center, X=1 Y=1 is upper right corner etc..."
+ "\n\t\t Z coordinate defines the gap from border of view window (except center position)."
+ "\n\t\t: [-disptype {blend|decal|subtitle|dimension|normal}=normal}"
+ "\n\t\t: [-subcolor {R G B|name}=white]"
+ "\n\t\t: [-noupdate]"
+ "\n\t\t: [-plane NormX NormY NormZ DirX DirY DirZ]"
+ "\n\t\t: [-flipping]"
+ "\n\t\t: Display text label at specified position.",
+ __FILE__, VDrawText, group);
theCommands.Add("vdrawsphere",
"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 ("vsetlocation",
- "vsetlocation : name x y z; set new location for an interactive object",
+ "vsetlocation [-noupdate|-update] name x y z"
+ "\n\t\t: Set new location for an interactive object.",
__FILE__, VSetLocation, group);
theCommands.Add (
__FILE__,VDrawPArray,group);
theCommands.Add("vconnect",
- "vconnect : assembly_name Xo Yo Zo object1 object2 ..."
- " Makes an assembly of object instances located in point (Xo Yo Zo).",
+ "vconnect name Xo Yo Zo object1 object2 ... [color=NAME]"
+ "\n\t\t: Creates and displays AIS_ConnectedInteractive object from input object and location.",
__FILE__, VConnect, group);
theCommands.Add("vconnectto",
- "vconnectto : instance_name Xo Yo Zo object"
- " Makes an instance 'instance_name' of 'object' with position (Xo Yo Zo).",
+ "vconnectto : instance_name Xo Yo Zo object [-nodisplay|-noupdate|-update]"
+ " Makes an instance 'instance_name' of 'object' with position (Xo Yo Zo)."
+ "\n\t\t: -nodisplay - only creates interactive object, but not displays it",
__FILE__, VConnectTo,group);
theCommands.Add("vdisconnect",
" 0 if mode is to be switched off\n",
__FILE__, VSetSelectionMode, group);
+ theCommands.Add("vselnext",
+ "vselnext : hilight next detected",
+ __FILE__, VSelectionNext, group);
+
+ theCommands.Add("vselprev",
+ "vselnext : hilight previous detected",
+ __FILE__, VSelectionPrevious, group);
+
theCommands.Add("vtriangle",
- "vtriangle Name PointName PointName PointName",
+ "vtriangle Name PointName PointName PointName"
+ "\n\t\t: Creates and displays a filled triangle from named points.",
__FILE__, VTriangle,group);
theCommands.Add("vsegment",
- "vsegment Name PointName PointName",
+ "vsegment Name PointName PointName"
+ "\n\t\t: Creates and displays a segment from named points.",
__FILE__, VSegment,group);
theCommands.Add("vobjzlayer",
__FILE__, VMarkersTest, group);
theCommands.Add ("text2brep",
- "text2brep: res text fontName fontSize [x=0.0 y=0.0 z=0.0 composite=1 {regular,bold,italic,bolditalic=regular}]\n",
+ "text2brep: name text"
+ "\n\t\t: [-pos X=0 Y=0 Z=0]"
+ "\n\t\t: [-halign {left|center|right}=left]"
+ "\n\t\t: [-valign {top|center|bottom|topfirstline}=bottom}]"
+ "\n\t\t: [-height height=16]"
+ "\n\t\t: [-aspect {regular|bold|italic|bolditalic}=regular]"
+ "\n\t\t: [-font font=Courier]"
+ "\n\t\t: [-composite {on|off}=off]"
+ "\n\t\t: [-plane NormX NormY NormZ DirX DirY DirZ]",
__FILE__, TextToBRep, group);
theCommands.Add ("vfont",
"vfont [add pathToFont [fontName] [regular,bold,italic,bolditalic=undefined]]"
"vvertexmode -set {isolated | all | inherited} - sets the default vertex draw mode and updates the mode for all displayed objects\n"
"vvertexmode -set {isolated | all | inherited} name1 name2 ... - sets the vertex draw mode for the specified object(s)\n",
__FILE__, VVertexMode, group);
+
+ theCommands.Add ("vpointcloud",
+ "vpointcloud name shape [-randColor] [-normals] [-noNormals]"
+ "\n\t\t: Create an interactive object for arbitary set of points"
+ "\n\t\t: from triangulated shape."
+ "\n"
+ "vpointcloud name x y z r npts {surface|volume}\n"
+ " ... [-randColor] [-normals] [-noNormals]"
+ "\n\t\t: Create arbitrary set of points (npts) randomly distributed"
+ "\n\t\t: on spheric surface or within spheric volume (x y z r)."
+ "\n\t\t:"
+ "\n\t\t: Additional options:"
+ "\n\t\t: -randColor - generate random color per point"
+ "\n\t\t: -normals - generate normal per point (default)"
+ "\n\t\t: -noNormals - do not generate normal per point"
+ "\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__,
+ VPriority, group);
}