#include <Font_BRepFont.hxx>
#include <Font_BRepTextBuilder.hxx>
#include <Font_FontMgr.hxx>
-
+#include <Message.hxx>
#include <NCollection_List.hxx>
#include <OSD_Chronometer.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitivePrimitiveArray.hxx>
-#include <Select3D_SensitiveTriangle.hxx>
-#include <Select3D_SensitiveCurve.hxx>
#include <Select3D_SensitivePoint.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <StdPrs_Curve.hxx>
extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theName,
const Handle(AIS_InteractiveObject)& theAISObj,
Standard_Boolean theReplaceIfExists = Standard_True);
-extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
extern Handle(AIS_InteractiveContext)& TheAISContext();
namespace
if ((aMapOfArgs.IsBound ("xaxis") && !aMapOfArgs.IsBound ("zaxis"))
|| (!aMapOfArgs.IsBound ("xaxis") && aMapOfArgs.IsBound ("zaxis")))
{
- std::cout << "Syntax error: -xaxis and -zaxis parameters are to set together.\n";
+ Message::SendFail ("Syntax error: -xaxis and -zaxis parameters are to set together");
return Standard_False;
}
if (!aZDir.IsNormal (aXDir, M_PI / 180.0))
{
- std::cout << "Syntax error - parameters 'xaxis' and 'zaxis' are not applied as VectorX is not normal to VectorZ\n";
+ Message::SendFail ("Syntax error - parameters 'xaxis' and 'zaxis' are not applied as VectorX is not normal to VectorZ");
return Standard_False;
}
}
else if (aValues->Size() != 0)
{
- std::cout << "Syntax error: -hidelabels expects parameter 'on' or 'off' after.\n";
+ Message::SendFail ("Syntax error: -hidelabels expects parameter 'on' or 'off' after");
return Standard_False;
}
}
else if (aValues->Size() != 0)
{
- std::cout << "Syntax error: -hidearrows expects parameter 'on' or 'off' after.\n";
+ Message::SendFail ("Syntax error: -hidearrows expects parameter 'on' or 'off' after");
return Standard_False;
}
NCollection_List<Prs3d_DatumParts> aParts;
if (aValues->Size() < 2)
{
- std::cout << "Syntax error: -color wrong parameters.\n";
+ Message::SendFail ("Syntax error: -color wrong parameters");
return Standard_False;
}
Quantity_Color aColor;
if (!convertToColor (aValues, aColor))
{
- std::cout << "Syntax error: -color wrong parameters.\n";
+ Message::SendFail ("Syntax error: -color wrong parameters");
return Standard_False;
}
Quantity_Color aColor;
if (!convertToColor (aValues, aColor))
{
- std::cout << "Syntax error: -textcolor wrong parameters.\n";
+ Message::SendFail ("Syntax error: -textcolor wrong parameters");
return Standard_False;
}
theTrihedron->SetTextColor (aColor);
Quantity_Color aColor;
if (!convertToColor (aValues, aColor))
{
- std::cout << "Syntax error: -arrowcolor wrong parameters.\n";
+ Message::SendFail ("Syntax error: -arrowcolor wrong parameters");
return Standard_False;
}
theTrihedron->SetArrowColor (aColor);
NCollection_List<Prs3d_DatumAttribute> anAttributes;
if (aValues->Size() != 2)
{
- std::cout << "Syntax error: -attribute wrong parameters.\n";
+ Message::SendFail ("Syntax error: -attribute wrong parameters");
return Standard_False;
}
if (aValues->Size() < 2
|| !convertToDatumPart (aValues->Value (1), aDatumPart))
{
- std::cout << "Syntax error: -priority wrong parameters.\n";
+ Message::SendFail ("Syntax error: -priority wrong parameters");
return Standard_False;
}
theTrihedron->SetSelectionPriority (aDatumPart, aValues->Value (2).IntegerValue());
}
else
{
- std::cout << "Syntax error: -labels wrong parameters.\n";
+ Message::SendFail ("Syntax error: -labels wrong parameters");
return Standard_False;
}
}
if (aValues->Size() < 1
|| !convertToDatumAxes (aValues->Value (1), aDatumAxes))
{
- std::cout << "Syntax error: -drawaxes wrong parameters.\n";
+ Message::SendFail ("Syntax error: -drawaxes wrong parameters");
return Standard_False;
}
if (!theTrihedron->Attributes()->HasOwnDatumAspect())
}
return Standard_True;
}
+
+ //! Auxiliary function to parse font aspect style argument
+ static Standard_Boolean parseFontStyle (const TCollection_AsciiString& theArg,
+ Font_FontAspect& theAspect)
+ {
+ if (theArg == "regular"
+ || *theArg.ToCString() == 'r')
+ {
+ theAspect = Font_FA_Regular;
+ return Standard_True;
+ }
+ else if (theArg == "bolditalic"
+ || theArg == "bold-italic"
+ || theArg == "italic-bold"
+ || theArg == "italicbold")
+ {
+ theAspect = Font_FA_BoldItalic;
+ return Standard_True;
+ }
+ else if (theArg == "bold"
+ || *theArg.ToCString() == 'b')
+ {
+ theAspect = Font_FA_Bold;
+ return Standard_True;
+ }
+ else if (theArg == "italic"
+ || *theArg.ToCString() == 'i')
+ {
+ theAspect = Font_FA_Italic;
+ return Standard_True;
+ }
+ return Standard_False;
+ }
+
+ //! Auxiliary function to parse font strict level argument
+ static Standard_Integer parseFontStrictLevel (const Standard_Integer theArgNb,
+ const char** theArgVec,
+ Font_StrictLevel& theLevel)
+ {
+ if (theArgNb >= 1)
+ {
+ TCollection_AsciiString anArg (theArgVec[0]);
+ anArg.LowerCase();
+ if (anArg == "any")
+ {
+ theLevel = Font_StrictLevel_Any;
+ return 1;
+ }
+ else if (anArg == "aliases")
+ {
+ theLevel = Font_StrictLevel_Aliases;
+ return 1;
+ }
+ else if (anArg == "strict")
+ {
+ theLevel = Font_StrictLevel_Strict;
+ return 1;
+ }
+ }
+ theLevel = Font_StrictLevel_Strict;
+ return 0;
+ }
}
//==============================================================================
{
if (theArgsNum != 2)
{
- std::cerr << theArgVec[0]<< " error.\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.";
return 1;
}
if (aShapes.Extent() != 1)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
{
if (theArgsNb < 2)
{
- std::cout << "Syntax error: the wrong number of input parameters.\n";
+ Message::SendFail ("Syntax error: the wrong number of input parameters");
return 1;
}
aTrihedron = Handle(AIS_Trihedron)::DownCast (anObject);
if (aTrihedron.IsNull())
{
- std::cout << "Syntax error: no trihedron with this name.\n";
+ Message::SendFail ("Syntax error: no trihedron with this name");
return 1;
}
}
if (TheAISContext()->NbSelected() != 1)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
Handle(AIS_Plane) aPlane = Handle(AIS_Plane)::DownCast (aTest);
if (aPlane.IsNull())
{
- std::cerr << "Error: Selected shape is not a plane.\n";
+ Message::SendFail ("Error: Selected shape is not a plane.");
return 1;
}
if ( !strcasecmp(argv[0], "vaxis")) {
if (aShapes.Extent() != 2 && aShapes.Extent() != 1)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wron number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
const TopoDS_Shape& aShapeB = aShapes.Last();
if (aShapeB.ShapeType() != TopAbs_VERTEX)
{
- std::cerr << "Syntax error: You should select two vertices or one edge.\n";
+ Message::SendFail ("Syntax error: You should select two vertices or one edge.");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
if (!(aShapeA.ShapeType() == TopAbs_EDGE
&& aShapeB.ShapeType() == TopAbs_VERTEX))
{
- std::cerr << "Syntax error: You should select face and then vertex.\n";
+ Message::SendFail ("Syntax error: You should select face and then vertex.");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
if (!(aShapeA.ShapeType() == TopAbs_EDGE
&& aShapeB.ShapeType() == TopAbs_VERTEX))
{
- std::cerr << "Syntax error: You should select face and then vertex.\n";
+ Message::SendFail ("Syntax error: You should select face and then vertex.");
return 1;
}
//==============================================================================
//function : VPointBuilder
-//purpose : Build an AIS_Point from coordinates or with a selected vertex or edge
-//Draw arg : vpoint PoinName [Xa] [Ya] [Za]
+//purpose :
//==============================================================================
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <AIS_Point.hxx>
#include <Geom_CartesianPoint.hxx>
-static int VPointBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+static int VPointBuilder(Draw_Interpretor& ,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
{
- // Declarations
- Standard_Boolean HasArg;
- TCollection_AsciiString name;
-
- // Verification
- if (argc<2 || argc>5 ) {di<<" Syntaxe error\n";return 1;}
- if (argc==5) HasArg=Standard_True;
- else HasArg=Standard_False;
-
- name=argv[1];
-
- // Il y a des arguments: teste l'unique constructeur AIS_Pnt::AIS_Pnt(Point from Geom)
- if (HasArg) {
- Standard_Real thecoord[3];
- for(Standard_Integer i=0;i<=2;i++)
- thecoord[i]=Draw::Atof(argv[2+i]);
- 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, Standard_True);
- }
-
- // Il n'a pas d'arguments
- else
+ TCollection_AsciiString aName;
+ gp_Pnt aPnt (RealLast(), 0.0, 0.0);
+ bool is2d = false, isNoSel = false;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
- TopTools_ListOfShape aShapes;
- ViewerTest::GetSelectedShapes (aShapes);
-
- if (aShapes.Extent() != 1)
+ TCollection_AsciiString anArg (theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "-2d")
+ {
+ is2d = true;
+ }
+ else if (anArg == "-nosel"
+ || anArg == "-noselection")
+ {
+ isNoSel = true;
+ }
+ else if (aName.IsEmpty())
+ {
+ aName = theArgVec[anArgIter];
+ }
+ else if (aPnt.X() == RealLast()
+ && anArgIter + 1 < theArgNb
+ && Draw::ParseReal (theArgVec[anArgIter + 0], aPnt.ChangeCoord().ChangeCoord (1))
+ && Draw::ParseReal (theArgVec[anArgIter + 1], aPnt.ChangeCoord().ChangeCoord (2)))
+ {
+ if (anArgIter + 2 < theArgNb
+ && TCollection_AsciiString (theArgVec[anArgIter + 2]) != "-2d"
+ && Draw::ParseReal (theArgVec[anArgIter + 2], aPnt.ChangeCoord().ChangeCoord (3)))
+ {
+ anArgIter += 2;
+ }
+ else
+ {
+ anArgIter += 1;
+ }
+ }
+ else
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
- std::cerr << "\tYou should select one edge or vertex.\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'\n";
return 1;
}
+ }
- const TopoDS_Shape& aShapeA = aShapes.First();
-
- if (aShapeA.ShapeType()==TopAbs_VERTEX )
+ if (aPnt.X() == RealLast())
+ {
+ TopTools_ListOfShape aShapes;
+ ViewerTest::GetSelectedShapes (aShapes);
+ TopoDS_Shape aShapeA;
+ if (aShapes.Extent() == 1)
{
- 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, Standard_True);
+ aShapeA = aShapes.First();
}
- else
+ switch (!aShapeA.IsNull() ? aShapeA.ShapeType() : TopAbs_SHAPE)
{
- TopoDS_Edge myEdge=TopoDS::Edge(aShapeA);
- TopoDS_Vertex myVertexA,myVertexB;
- TopExp::Vertices (myEdge ,myVertexA ,myVertexB );
- gp_Pnt A=BRep_Tool::Pnt(myVertexA );
- gp_Pnt B=BRep_Tool::Pnt(myVertexB );
- // M est le milieu de [AB]
- 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, Standard_True);
+ case TopAbs_VERTEX:
+ {
+ aPnt = BRep_Tool::Pnt (TopoDS::Vertex (aShapeA));
+ break;
+ }
+ case TopAbs_EDGE: // edge middle point
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge (aShapeA);
+ TopoDS_Vertex aVertPair[2];
+ TopExp::Vertices (anEdge, aVertPair[0], aVertPair[1]);
+ const gp_Pnt A = BRep_Tool::Pnt (aVertPair[0]);
+ const gp_Pnt B = BRep_Tool::Pnt (aVertPair[1]);
+ aPnt = (A.XYZ() + B.XYZ()) / 2;
+ break;
+ }
+ default:
+ {
+ Message::SendFail() << "Error: Wrong number of selected shapes.\n"
+ << "\tYou should select one edge or vertex.";
+ return 1;
+ }
}
+ }
+ if (is2d)
+ {
+ aPnt.SetY (-aPnt.Y());
+ }
+ Handle(Geom_CartesianPoint ) aGeomPoint = new Geom_CartesianPoint (aPnt);
+ Handle(AIS_Point) aPointPrs = new AIS_Point (aGeomPoint);
+ if (is2d)
+ {
+ aPointPrs->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_UPPER));
+ aPointPrs->SetZLayer (Graphic3d_ZLayerId_TopOSD);
+ }
+ ViewerTest::Display (aName, aPointPrs);
+ if (isNoSel)
+ {
+ ViewerTest::GetAISContext()->Deactivate (aPointPrs);
}
return 0;
-
}
//==============================================================================
// Verification
if (argc<2 || argc>6 )
{
- std::cout<<" Syntax error\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
if (argc == 6 || argc==5 || argc==4)
Handle(AIS_InteractiveObject) aShapeA;
if (!GetMapOfAIS().Find2 (argv[2], aShapeA))
{
- std::cout<<"vplane: error 1st name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 1st name is not displayed");
return 1;
}
Handle(AIS_InteractiveObject) aShapeB;
if (argc<5 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
- std::cout<<"vplane: error 2nd name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 2nd name is not displayed");
return 1;
}
// If B is not an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
{
- std::cout<<"vplane: error 2nd object is expected to be an AIS_Point.\n";
+ Message::SendFail ("Syntax error: 2nd object is expected to be an AIS_Point");
return 1;
}
// The third object is an AIS_Point
Handle(AIS_InteractiveObject) aShapeC;
if (!GetMapOfAIS().Find2(argv[4], aShapeC))
{
- std::cout<<"vplane: error 3d name doesn't exist in the GetMapOfAIS().\n";
+ Message::SendFail ("Syntax error: 3d name is not displayed");
return 1;
}
// If C is not an AIS_Point
if (aShapeC.IsNull() ||
(!(aShapeC->Type()==AIS_KOI_Datum && aShapeC->Signature()==1)))
{
- std::cout<<"vplane: error 3d object is expected to be an AIS_Point.\n";
+ Message::SendFail ("Syntax error: 3d object is expected to be an AIS_Point");
return 1;
}
Abs(aCartPointB->Z()-aCartPointA->Z())<=Precision::Confusion())
{
// B=A
- std::cout<<"vplane error: same points\n";return 1;
+ Message::SendFail ("Error: same points");
+ 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;
+ Message::SendFail ("Error: same points");
+ 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;
+ Message::SendFail ("Error: same points");
+ return 1;
}
gp_Pnt A = aCartPointA->Pnt();
Standard_Integer aType = Draw::Atoi (argv[5]);
if (aType != 0 && aType != 1)
{
- std::cout << "vplane error: wrong type of sensitivity!\n"
- << "Should be one of the following values:\n"
- << "0 - Interior\n"
- << "1 - Boundary"
- << std::endl;
+ Message::SendFail("Syntax error: wrong type of sensitivity.\n"
+ "Should be one of the following values:\n"
+ "0 - Interior\n"
+ "1 - Boundary");
return 1;
}
else
Handle(AIS_InteractiveObject) aShapeB;
if (argc!=4 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
- std::cout<<"vplane: error 2d name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 2d name is not displayed");
return 1;
}
// If B is not an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
{
- std::cout<<"vplane: error 2d object is expected to be an AIS_Point\n";
+ Message::SendFail ("Syntax error: 2d object is expected to be an AIS_Point");
return 1;
}
Standard_Integer aType = Draw::Atoi (argv[4]);
if (aType != 0 && aType != 1)
{
- std::cout << "vplane error: wrong type of sensitivity!\n"
- << "Should be one of the following values:\n"
- << "0 - Interior\n"
- << "1 - Boundary"
- << std::endl;
+ Message::SendFail ("Syntax error: wrong type of sensitivity!\n"
+ "Should be one of the following values:\n"
+ "0 - Interior\n"
+ "1 - Boundary");
return 1;
}
else
Handle(AIS_InteractiveObject) aShapeB;
if (argc!=4 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
- std::cout<<"vplane: error 2d name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 2d name is not displayed");
return 1;
}
// B should be an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
{
- std::cout<<"vplane: error 2d object is expected to be an AIS_Point\n";
+ Message::SendFail ("Syntax error: 2d object is expected to be an AIS_Point");
return 1;
}
Standard_Integer aType = Draw::Atoi (argv[4]);
if (aType != 0 && aType != 1)
{
- std::cout << "vplane error: wrong type of sensitivity!\n"
- << "Should be one of the following values:\n"
- << "0 - Interior\n"
- << "1 - Boundary"
- << std::endl;
+ Message::SendFail ("Syntax error: wrong type of sensitivity!\n"
+ "Should be one of the following values:\n"
+ "0 - Interior\n"
+ "1 - Boundary");
return 1;
}
else
// Error
else
{
- std::cout<<"vplane: error 1st object is not an AIS\n";
+ Message::SendFail ("Syntax error: 1st object is not an AIS");
return 1;
}
}
{
if (aShapes.Extent() < 1 || aShapes.Extent() > 3)
{
- std::cerr << "Error: Wront number of selected shapes.\n";
- std::cerr << "\tYou should one of variant: face, edge and vertex or three vertices.\n";
+ Message::SendFail() << "Error: Wront number of selected shapes.\n"
+ << "\tYou should one of variant: face, edge and vertex or three vertices.";
return 1;
}
const TopoDS_Shape& aShapeB = aShapes.Last();
if (aShapeB.ShapeType() != TopAbs_EDGE)
{
- std::cerr << "Syntax error: Together with vertex should be edge.\n";
+ Message::SendFail ("Syntax error: Together with vertex should be edge.");
return 1;
}
if (OrthoProj.SquareDistance(1)<Precision::Approximation())
{
// The vertex is on the edge
- std::cout<<" vplane: error point is on the edge\n";
+ Message::SendFail ("Error: point is on the edge");
return 1;
}
else
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";
+ Message::SendFail ("Syntax error: You should one of variant: face, edge and vertex or three vertices.");
return 1;
}
}
else
{
- std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ Message::SendFail ("Syntax error: You should one of variant: face, edge and vertex or three vertices.");
return 1;
}
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
const TopoDS_Shape& aShapeB = aShapes.Last();
if (aShapeB.ShapeType() != TopAbs_VERTEX)
{
- std::cerr << "Syntax error: Together with edge should be vertex.\n";
+ Message::SendFail ("Syntax error: Together with edge should be vertex.");
return 1;
}
if (OrthoProj.SquareDistance(1)<Precision::Approximation())
{
// The vertex is on the edge
- std::cout<<" vplane: error point is on the edge\n";
+ Message::SendFail ("Error point is on the edge");
return 1;
}
}
else
{
- std::cout<<" vplane: error\n";
+ Message::SendFail ("Error: surface is not Plane");
return 1;
}
}
else
{
- std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ Message::SendFail ("Syntax error: You should one of variant: face, edge and vertex or three vertices");
return 1;
}
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
if (!(aShapeA->ShapeType() == TopAbs_VERTEX
&& aShapeB->ShapeType() == TopAbs_FACE))
{
- std::cerr << "Syntax error: you should select face and vertex.\n";
+ Message::SendFail ("Syntax error: you should select face and vertex.");
return 1;
}
}
else
{
- std::cerr << "Error: Builded surface is not a plane.\n";
+ Message::SendFail ("Error: Builded surface is not a plane.");
return 1;
}
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
if (!(aShapeA->ShapeType() == TopAbs_EDGE
&& aShapeB->ShapeType() == TopAbs_FACE))
{
- std::cerr << "Error: you should select edge and face.\n";
+ Message::SendFail ("Error: you should select edge and face.");
return 1;
}
>Precision::Confusion())
{
// the edge is not parallel to the face
- std::cout<<" vplaneortho error: the edge is not parallel to the face\n";
+ Message::SendFail ("Error: the edge is not parallel to the face");
return 1;
}
// the edge is OK
}
else
{
- std::cout<<" vplaneortho: error\n";
+ Message::SendFail ("Error: surface is not Plane");
return 1;
}
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << theArgVec[0] << "AIS context is not available.\n";
+ Message::SendFail ("Error: no active viewer.");
return 1;
}
if (theArgsNb < 3 || theArgsNb > 11)
{
- std::cerr << theArgVec[0]
- << ": incorrect number of command arguments.\n"
- << "Type help for more information.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
if ( aPlane.IsNull() )
{
- std::cout << theArgVec[0]
- << ": there is no interactive plane with the given name."
- << "Type help for more information.\n";
+ Message::SendFail() << "Syntax error: there is no interactive plane with the given name '" << aName << "'.";
return 1;
}
ViewerTest::GetSelectedShapes (aShapes);
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
if (!(aShapeA.ShapeType() == TopAbs_VERTEX
&& aShapeB.ShapeType() == TopAbs_VERTEX))
{
- std::cerr << "Error: you should select two different vertex.\n";
+ Message::SendFail ("Error: you should select two different vertex.");
return 1;
}
const Standard_Integer /*theMode*/)
{
Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner(this);
- Handle(Select3D_SensitiveCircle) aSensitiveCircle = new Select3D_SensitiveCircle(anEntityOwner,
- myCircle, myFilledStatus);
+ Handle(Select3D_SensitiveCircle) aSensitiveCircle = new Select3D_SensitiveCircle (anEntityOwner, myCircle->Circ(), myFilledStatus);
theSelection->Add(aSensitiveCircle);
}
// Verification of the arguments
if (argc>6 || argc<2)
{
- std::cout << "vcircle error: expect 4 arguments.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Syntax error: wrong number of arguments");
+ return 1;
}
// There are all arguments
{
if (theShapeB->Type()!=AIS_KOI_Datum || theShapeB->Signature()!=1 )
{
- std::cout << "vcircle error: 2d argument is unexpected to be a point.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 2d argument is unexpected to be a point");
+ return 1;
}
// The third object must be a point
Handle(AIS_InteractiveObject) theShapeC;
if (theShapeC.IsNull() ||
theShapeC->Type()!=AIS_KOI_Datum || theShapeC->Signature()!=1 )
{
- std::cout << "vcircle error: 3d argument is unexpected to be a point.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 3d argument is unexpected to be a point");
+ return 1;
}
// tag
// Verify that the three points are different
Abs(myCartPointA->Y()-myCartPointB->Y()) <= Precision::Confusion() &&
Abs(myCartPointA->Z()-myCartPointB->Z()) <= Precision::Confusion() )
{
- std::cout << "vcircle error: Same points.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: Same points");
+ return 1;
}
// Test A=C
if (Abs(myCartPointA->X()-myCartPointC->X()) <= Precision::Confusion() &&
Abs(myCartPointA->Y()-myCartPointC->Y()) <= Precision::Confusion() &&
Abs(myCartPointA->Z()-myCartPointC->Z()) <= Precision::Confusion() )
{
- std::cout << "vcircle error: Same points.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: Same points");
+ return 1;
}
// Test B=C
if (Abs(myCartPointB->X()-myCartPointC->X()) <= Precision::Confusion() &&
Abs(myCartPointB->Y()-myCartPointC->Y()) <= Precision::Confusion() &&
Abs(myCartPointB->Z()-myCartPointC->Z()) <= Precision::Confusion() )
{
- std::cout << "vcircle error: Same points.\n";
- return 1;// TCL_ERROR
+ Message::SendFail ("Error: Same points");
+ return 1;
}
// Construction of the circle
GC_MakeCircle Cir = GC_MakeCircle (myCartPointA->Pnt(),
{
theGeomCircle = Cir.Value();
}
- catch (StdFail_NotDone)
+ catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
-
+
DisplayCircle(theGeomCircle, aName, isFilled);
}
if (theShapeB->Type() != AIS_KOI_Datum ||
theShapeB->Signature() != 1 )
{
- std::cout << "vcircle error: 2d element is a unexpected to be a point.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 2d element is a unexpected to be a point");
+ return 1;
}
// Check that the radius is >= 0
if (Draw::Atof(argv[4]) <= 0 )
{
- std::cout << "vcircle error: the radius must be >=0.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Syntax error: the radius must be >=0");
+ return 1;
}
// Recover the normal to the plane
{
theGeomCircle = Cir.Value();
}
- catch (StdFail_NotDone)
+ catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
DisplayCircle(theGeomCircle, aName, isFilled);
// Error
else
{
- std::cout << "vcircle error: 1st argument is a unexpected type.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 1st argument has an unexpected type");
+ return 1;
}
}
ViewerTest::GetSelectedShapes (aShapes);
if (aShapes.Extent() != 3 && aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
{
if (aShapes.Extent() != 3)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
// Get isFilled
Standard_Boolean isFilled;
std::cout << "Enter filled status (0 or 1)\n";
- cin >> isFilled;
+ std::cin >> isFilled;
// Construction of the circle
gp_Pnt A = BRep_Tool::Pnt (TopoDS::Vertex (aShapeA));
{
theGeomCircle = Cir.Value();
}
- catch (StdFail_NotDone)
+ catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
DisplayCircle(theGeomCircle, aName, isFilled);
do
{
std::cout << " Enter the value of the radius:\n";
- cin >> theRad;
+ std::cin >> theRad;
} while (theRad <= 0);
// Get filled status
Standard_Boolean isFilled;
std::cout << "Enter filled status (0 or 1)\n";
- cin >> isFilled;
+ std::cin >> isFilled;
// Recover the normal to the plane. tag
TopoDS_Face myFace = TopoDS::Face(aShapeA);
{
theGeomCircle = Cir.Value();
}
- catch (StdFail_NotDone)
+ catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
DisplayCircle(theGeomCircle, aName, isFilled);
}
else
{
- std::cerr << "Error: You should select face and vertex or three vertices.\n";
+ Message::SendFail ("Error: You should select face and vertex or three vertices.");
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (theArgsNb < 3)
{
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments. See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
else if (aContext.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (anArgIt + 3 >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else if (aParam == "-color")
{
- if (anArgIt + 1 >= theArgsNb)
- {
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
- return 1;
- }
-
- 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())
+ Quantity_Color aColor;
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIt - 1,
+ theArgVec + anArgIt + 1,
+ aColor);
+ if (aNbParsed == 0)
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
-
- const Graphic3d_Vec3d anRGB (aColor.RealValue(),
- aGreen.RealValue(),
- aBlue.RealValue());
-
- aTextPrs->SetColor (Quantity_Color (anRGB.r(), anRGB.g(), anRGB.b(), Quantity_TOC_RGB));
- anArgIt += 3;
+ anArgIt += aNbParsed;
+ aTextPrs->SetColor (aColor);
}
else if (aParam == "-halign")
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
TCollection_AsciiString anOption (theArgVec[anArgIt]);
anOption.LowerCase();
- if (anOption.IsEqual ("regular"))
+ Font_FontAspect aFontAspect = Font_FA_Undefined;
+ if (!parseFontStyle (anOption, aFontAspect))
{
- 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);
+ Message::SendFail() << "Syntax error: unknown font aspect '" << anOption << "'";
+ return 1;
}
+ aTextPrs->SetFontAspect (aFontAspect);
}
else if (aParam == "-font")
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (anArgIt + 6 >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
aTextPrs->SetFlipping (Standard_True);
}
+ else if (aParam == "-ownanchor")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ aTextPrs->SetOwnAnchorPoint (Draw::Atoi (theArgVec[anArgIt]) == 1);
+ }
else if (aParam == "-disptype"
|| aParam == "-displaytype")
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
TCollection_AsciiString aType (theArgVec[anArgIt]);
aDisplayType = Aspect_TODT_SHADOW;
else
{
- std::cout << "Error: wrong display type '" << aType << "'.\n";
+ Message::SendFail() << "Syntax error: wrong display type '" << aType << "'";
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;
- }
-
- 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;
- }
-
- TCollection_AsciiString aGreen (theArgVec[anArgIt + 2]);
- TCollection_AsciiString aBlue (theArgVec[anArgIt + 3]);
- if (!aColor.IsRealValue()
- || !aGreen.IsRealValue()
- || !aBlue.IsRealValue())
+ Quantity_Color aColor;
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIt - 1,
+ theArgVec + anArgIt + 1,
+ aColor);
+ if (aNbParsed == 0)
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
-
- const Graphic3d_Vec3d anRGB (aColor.RealValue(),
- aGreen.RealValue(),
- aBlue.RealValue());
-
- aTextPrs->SetColorSubTitle (Quantity_Color (anRGB.r(), anRGB.g(), anRGB.b(), Quantity_TOC_RGB));
- anArgIt += 3;
+ anArgIt += aNbParsed;
+ aTextPrs->SetColorSubTitle (aColor);
}
else if (aParam == "-2d")
{
{
if (anArgIt + 2 >= theArgsNb)
{
- std::cerr << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'.";
return 1;
}
if (!aX.IsIntegerValue()
|| !aY.IsIntegerValue())
{
- std::cerr << "Error: wrong syntax at '" << aParam << "'.\n";
+ Message::SendFail() << "Error: wrong syntax at '" << aParam << "'.";
return 1;
}
if (anArgIt + 1 < theArgsNb)
}
else
{
- std::cout << "Error: unknown argument '" << aParam << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << aParam << "'";
return 1;
}
}
#include <TopoDS_Shape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopAbs.hxx>
-#include <StdSelect_ShapeTypeFilter.hxx>
#include <AIS_InteractiveObject.hxx>
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << "Call vinit before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
else if (argc < 3)
{
- std::cout << "Use: " << argv[0]
- << " shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToShowEdges=0]\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.\n"
+ << "Use: " << argv[0] << " shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToShowEdges=0]";
return 1;
}
// Setting material properties, very important for desirable visual result!
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_PLASTIC);
- aMat.SetAmbient (0.2f);
- aMat.SetSpecular (0.5f);
+ aMat.SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.04f)));
+ aMat.SetSpecularColor(Quantity_Color (Graphic3d_Vec3 (0.50f)));
Handle(Graphic3d_AspectFillArea3d) anAspect
= new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID,
Quantity_NOC_RED,
aMat,
aMat);
Handle(Prs3d_ShadingAspect) aShAsp = new Prs3d_ShadingAspect();
- if (toShowEdges)
- {
- anAspect->SetEdgeOn();
- }
- else
- {
- anAspect->SetEdgeOff();
- }
+ anAspect->SetDrawEdges (toShowEdges);
aShAsp->SetAspect (anAspect);
aShape->Attributes()->SetShadingAspect (aShAsp);
gp_Ax2 aProjAx;
bool hasViewDirArg = false;
Prs3d_TypeOfHLR anAlgoType = Prs3d_TOH_PolyAlgo;
- bool toShowTangentEdges = false, toShowHiddenEdges = false;
+ bool toShowCNEdges = false, toShowHiddenEdges = false;
int aNbIsolines = 0;
if (Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext())
{
}
else
{
- std::cout << "Syntax error: unknown algo type '" << anArgNext << "'\n";
+ Message::SendFail() << "Syntax error: unknown algo type '" << anArgNext << "'";
return 1;
}
}
|| anArgCase == "-tangentedges"
|| anArgCase == "-tangent")
{
- toShowTangentEdges = true;
+ toShowCNEdges = true;
if (anArgIter + 1 < theArgNb
- && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toShowTangentEdges))
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toShowCNEdges))
{
++anArgIter;
}
BRepTools::Read (aSh, theArgVec[anArgIter], aBrepBuilder);
if (aSh.IsNull())
{
- std::cout << "Syntax error: no shape with name " << theArgVec[anArgIter] << " found\n";
+ Message::SendFail() << "Syntax error: no shape with name " << theArgVec[anArgIter] << " found";
return 1;
}
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if (aHlrName.IsEmpty() || aSh.IsNull()
|| (ViewerTest::GetAISContext().IsNull() && hasViewDirArg))
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
aVisible[HLRBRep_Sharp] = aHLRToShape.VCompound();
aVisible[HLRBRep_OutLine] = aHLRToShape.OutLineVCompound(); // extract visible outlines
- aVisible[HLRBRep_RgNLine] = aHLRToShape.RgNLineVCompound();
- if (toShowTangentEdges)
+ aVisible[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineVCompound();
+ if (toShowCNEdges)
{
- aVisible[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineVCompound();
+ aVisible[HLRBRep_RgNLine] = aHLRToShape.RgNLineVCompound();
}
if (toShowHiddenEdges)
{
aHidden[HLRBRep_Sharp] = aHLRToShape.HCompound();
aHidden[HLRBRep_OutLine] = aHLRToShape.OutLineHCompound();
- aHidden[HLRBRep_RgNLine] = aHLRToShape.RgNLineHCompound();
- if (toShowTangentEdges)
+ aHidden[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineHCompound();
+ if (toShowCNEdges)
{
- aHidden[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineHCompound();
+ aHidden[HLRBRep_RgNLine] = aHLRToShape.RgNLineHCompound();
}
}
}
HLRBRep_HLRToShape aHLRToShape (aHlrAlgo);
aVisible[HLRBRep_Sharp] = aHLRToShape.VCompound();
aVisible[HLRBRep_OutLine] = aHLRToShape.OutLineVCompound();
- aVisible[HLRBRep_RgNLine] = aHLRToShape.RgNLineVCompound();
- if (toShowTangentEdges)
+ aVisible[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineVCompound();
+ if (toShowCNEdges)
{
- aVisible[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineVCompound();
+ aVisible[HLRBRep_RgNLine] = aHLRToShape.RgNLineVCompound();
}
aVisible[HLRBRep_IsoLine] = aHLRToShape.IsoLineVCompound();
{
aHidden[HLRBRep_Sharp] = aHLRToShape.HCompound();
aHidden[HLRBRep_OutLine] = aHLRToShape.OutLineHCompound();
- aHidden[HLRBRep_RgNLine] = aHLRToShape.RgNLineHCompound();
- if (toShowTangentEdges)
+ aHidden[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineHCompound();
+ if (toShowCNEdges)
{
- aHidden[HLRBRep_Rg1Line] = aHLRToShape.Rg1LineHCompound();
+ aHidden[HLRBRep_RgNLine] = aHLRToShape.RgNLineHCompound();
}
aHidden[HLRBRep_IsoLine] = aHLRToShape.IsoLineHCompound();
}
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
+ //! Sets color to this interactive object
+ //! @param theColor the color to be set
+ virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
+
private:
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
Standard_Integer theArgCount,
Standard_Integer theMaxArgs);
+ //! Sets color for the shading aspect of the drawer used in this interactive object
+ //! @param theColor the color to be set
+ void setColorForShadingAspect(const Quantity_Color& theColor);
+
+ //! Replaces shading aspect from myDrawer->Link() with the own shading aspect of myDrawer for this interactive object
+ void replaceShadingAspect();
+
protected:
Handle(Graphic3d_AspectMarker3d) myMarkerAspect;
{
aGroup->SetGroupPrimitivesAspect (myMarkerAspect);
}
- aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
- aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
+ else
+ {
+ aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
+ }
aGroup->AddPrimitiveArray (myPArray);
}
|| !myPArray->Attributes()->IsMutable()
|| (!myPArray->Indices().IsNull() && !myPArray->Indices()->IsMutable()))
{
- std::cout << "Syntax error: array cannot be patched\n";
+ Message::SendFail ("Syntax error: array cannot be patched");
return Standard_False;
}
// unknown command
else
{
- std::cout << "Syntax error: unknown argument '" << theDesc->Value(anArgIndex) << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theDesc->Value(anArgIndex) << "'";
return Standard_False;
}
}
return Standard_True;
}
+//=======================================================================
+// function : SetColor
+// purpose :
+//=======================================================================
+void MyPArrayObject::SetColor (const Quantity_Color& theColor)
+{
+ AIS_InteractiveObject::SetColor (theColor);
+ setColorForShadingAspect (theColor);
+ if (myMarkerAspect)
+ {
+ myMarkerAspect->SetColor (theColor);
+ }
+ SynchronizeAspects();
+}
+
void MyPArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode)
{
return true;
}
+//=======================================================================
+// function : setColorForShadingAspect
+// purpose :
+//=======================================================================
+void MyPArrayObject::setColorForShadingAspect (const Quantity_Color& theColor)
+{
+ if (myDrawer->SetupOwnShadingAspect())
+ {
+ replaceShadingAspect();
+ }
+ myDrawer->ShadingAspect()->SetColor (theColor);
+}
+
+//=======================================================================
+// function : replaceShadingAspect
+// purpose :
+//=======================================================================
+void MyPArrayObject::replaceShadingAspect()
+{
+ if (!myDrawer->Link())
+ {
+ return;
+ }
+ Graphic3d_MapOfAspectsToAspects anAspectReplacementMap;
+ anAspectReplacementMap.Bind (myDrawer->Link()->ShadingAspect()->Aspect(), myDrawer->ShadingAspect()->Aspect());
+ replaceAspects (anAspectReplacementMap);
+}
+
//=============================================================================
//function : VDrawPArray
//purpose : Draws primitives array from list of vertexes, bounds, edges
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << "Error: no active Viewer\n";
+ Message::SendFail ("Error: no active Viewer");
return 1;
}
else if (argc < 3)
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
Handle(Graphic3d_ArrayOfPrimitives) aTris = StdPrs_ShadedShape::FillTriangles (aShape);
if (aShape.IsNull())
{
- std::cout << "Syntax error: shape '" << aShapeName << "' is not found\n";
+ Message::SendFail() << "Syntax error: shape '" << aShapeName << "' is not found";
return 1;
}
else if (aTris.IsNull())
{
- std::cout << "Syntax error: shape '" << aShapeName << "' is not triangulated\n";
+ Message::SendFail() << "Syntax error: shape '" << aShapeName << "' is not triangulated";
return 1;
}
}
if (aPObject.IsNull())
{
- std::cout << "Syntax error: object '" << aName << "' cannot be found\n";
+ Message::SendFail() << "Syntax error: object '" << aName << "' cannot be found";
return 1;
}
}
}
if (aPrimType == Graphic3d_TOPA_UNDEFINED)
{
- std::cout << "Syntax error: unexpected type of primitives array\n";
+ Message::SendFail ("Syntax error: unexpected type of primitives array");
return 1;
}
ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
GetMapOfAIS().Find2 (aName, anObj);
if (anObj.IsNull())
{
- std::cout << "Error: object '" << aName << "' is not displayed!\n";
+ Message::SendFail() << "Error: object '" << aName << "' is not displayed";
return 1;
}
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
GetMapOfAIS().Find2 (aName2, anObj2);
if (anObj2.IsNull())
{
- std::cout << "Error: object '" << aName2 << "' is not displayed!\n";
+ Message::SendFail() << "Error: object '" << aName2 << "' is not displayed";
return 1;
}
toPrintInfo = Standard_False;
if (anArgIter + 7 >= theArgNb)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
{
if (anArg == "-setscale")
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
toPrintInfo = Standard_False;
if (anArgIter + 6 >= theArgNb)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
else if (anArg == "-setrotation")
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
}
else if (anArg == "-setlocation")
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
Standard_Integer aNbParsed = parseTranslationVec (theArgNb - anArgIter, theArgVec + anArgIter, aLocVec);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter = anArgIter + aNbParsed - 1;
}
else
{
- std::cout << "Error: unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Error: unknown argument '" << anArg << "'";
return 1;
}
}
if (anObj.IsNull())
{
- std::cout << "Syntax error - wrong number of arguments\n";
+ Message::SendFail ("Syntax error - wrong number of arguments");
return 1;
}
else if (!toPrintInfo)
return 0;
}
+//! Find displayed object.
+static Handle(AIS_InteractiveObject) findConnectedObject (const TCollection_AsciiString& theName)
+{
+ Handle(AIS_InteractiveObject) aPrs;
+ if (!GetMapOfAIS().Find2 (theName, aPrs))
+ {
+ return Handle(AIS_InteractiveObject)();
+ }
+ if (Handle(AIS_ConnectedInteractive) aConnected = Handle(AIS_ConnectedInteractive)::DownCast (aPrs))
+ {
+ return aConnected;
+ }
+ else if (Handle(AIS_MultipleConnectedInteractive) aMultiCon = Handle(AIS_MultipleConnectedInteractive)::DownCast (aPrs))
+ {
+ return aMultiCon;
+ }
+
+ // replace already displayed object with connected one
+ TheAISContext()->Remove (aPrs, false);
+ Handle(AIS_ConnectedInteractive) aConnected = new AIS_ConnectedInteractive();
+ if (aPrs->HasDisplayMode())
+ {
+ aConnected->SetDisplayMode (aPrs->DisplayMode());
+ }
+ aConnected->Connect (aPrs, aPrs->LocalTransformationGeom());
+ if (!aPrs->TransformPersistence().IsNull())
+ {
+ aConnected->SetTransformPersistence (aPrs->TransformPersistence());
+ }
+ ViewerTest::Display (theName, aConnected, false);
+ return aConnected;
+}
+
//===============================================================================================
//function : VConnect
-//purpose : Creates and displays AIS_ConnectedInteractive object from input object and location
-//Draw arg : vconnect name Xo Yo Zo object1 object2 ... [color=NAME]
+//purpose : Creates and displays AIS_ConnectedInteractive object from input object and location
//===============================================================================================
-
-static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
- Standard_Integer argc,
- const char ** argv)
+static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
+ Standard_Integer argc,
+ const char ** argv)
{
- // Check the viewer
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "vconnect error : call vinit before\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: no active viewer");
+ return 1;
}
- // Check argumnets
if (argc < 6)
{
- std::cout << "vconnect error: expect at least 5 arguments\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Syntax error: expect at least 5 arguments");
+ return 1;
}
// Get values
Standard_Integer anArgIter = 1;
- TCollection_AsciiString aName (argv[anArgIter++]);
- Handle(AIS_MultipleConnectedInteractive) anOriginObject;
+ const TCollection_AsciiString aName (argv[anArgIter++]);
+ Handle(AIS_MultipleConnectedInteractive) aMultiConObject;
TCollection_AsciiString aColorString (argv[argc-1]);
Standard_CString aColorName = "";
Standard_Boolean hasColor = Standard_False;
aColorString.Remove (1, 6);
aColorName = aColorString.ToCString();
}
- Handle(AIS_InteractiveObject) anObject;
- // AIS_MultipleConnectedInteractive
const Standard_Integer aNbShapes = hasColor ? (argc - 1) : argc;
for (Standard_Integer i = 5; i < aNbShapes; ++i)
{
TCollection_AsciiString anOriginObjectName (argv[i]);
+ Handle(AIS_InteractiveObject) anObject;
if (aName.IsEqual (anOriginObjectName))
{
- std::cout << "vconnect error: equal names for connected objects\n";
+ Message::SendFail ("Syntax error: equal names for connected objects");
continue;
}
- if (GetMapOfAIS().Find2 (anOriginObjectName, anObject))
- {
- if (anObject.IsNull())
- {
- std::cout << "Object " << anOriginObjectName << " is used for non AIS viewer\n";
- continue;
- }
- }
- else
+
+ anObject = findConnectedObject (anOriginObjectName);
+ if (anObject.IsNull())
{
- Standard_CString aOriginName = anOriginObjectName.ToCString();
- TopoDS_Shape aTDShape = DBRep::Get (aOriginName);
+ TopoDS_Shape aTDShape = DBRep::Get (anOriginObjectName);
if (aTDShape.IsNull())
{
- std::cout << "vconnect error: object " << anOriginObjectName << " doesn't exist\n";
- continue;
+ Message::SendFail() << "Syntax error: object " << anOriginObjectName << " doesn't exist";
+ return 1;
}
- anObject = new AIS_Shape (aTDShape);
+ Handle(AIS_Shape) aShapePrs = new AIS_Shape (aTDShape);
+ Handle(AIS_ConnectedInteractive) aConnectedOrig = new AIS_ConnectedInteractive();
+ aConnectedOrig->Connect (aShapePrs);
+ anObject = aConnectedOrig;
+
aContext->Load (anObject);
anObject->SetColor (ViewerTest::GetColorFromName (aColorName));
}
- if (anOriginObject.IsNull())
+ if (aMultiConObject.IsNull())
{
- anOriginObject = new AIS_MultipleConnectedInteractive();
+ aMultiConObject = new AIS_MultipleConnectedInteractive();
}
- anOriginObject->Connect (anObject);
+ aMultiConObject->Connect (anObject);
}
- if (anOriginObject.IsNull())
+ if (aMultiConObject.IsNull())
{
- std::cout << "vconect error : can't connect input objects\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Syntax error: can't connect input objects");
+ return 1;
}
- // Get location data
- Standard_Real aXo = Draw::Atof (argv[anArgIter++]);
- Standard_Real aYo = Draw::Atof (argv[anArgIter++]);
- Standard_Real aZo = Draw::Atof (argv[anArgIter++]);
-
// Create transformation
- gp_Vec aTranslation (aXo, aYo, aZo);
-
gp_Trsf aTrsf;
- aTrsf.SetTranslationPart (aTranslation);
+ aTrsf.SetTranslationPart (gp_Vec (Draw::Atof (argv[anArgIter + 0]),
+ Draw::Atof (argv[anArgIter + 1]),
+ Draw::Atof (argv[anArgIter + 2])));
TopLoc_Location aLocation (aTrsf);
+ anArgIter += 3;
- anOriginObject->SetLocalTransformation (aTrsf);
-
- // Check if there is another object with given name
- // and remove it from context
- Handle(AIS_InteractiveObject) anObj;
- if (GetMapOfAIS().Find2 (aName, anObj))
- {
- TheAISContext()->Remove(anObj, Standard_False);
- GetMapOfAIS().UnBind2(aName);
- }
-
- // Bind connected object to its name
- GetMapOfAIS().Bind (anOriginObject, aName);
-
- // Display connected object
- TheAISContext()->Display (anOriginObject, Standard_True);
+ aMultiConObject->SetLocalTransformation (aTrsf);
+ ViewerTest::Display (aName, aMultiConObject, true);
return 0;
}
//===============================================================================================
//function : VConnectTo
//purpose : Creates and displays AIS_ConnectedInteractive object from input object and location
-//Draw arg : vconnectto name Xo Yo Zo object [-nodisplay|-noupdate|-update]
//===============================================================================================
-
-static Standard_Integer VConnectTo (Draw_Interpretor& /*di*/,
- Standard_Integer argc,
- const char ** argv)
+static Standard_Integer VConnectTo (Draw_Interpretor& /*di*/,
+ Standard_Integer argc,
+ const char ** argv)
{
- // 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
+ Message::SendFail ("Error: no active viewer");
+ return 1;
}
- // Check argumnets
if (argc != 6 && argc != 7)
{
- std::cout << "vconnect error: expect at least 5 arguments\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Syntax error: expect at least 5 arguments");
+ return 1;
}
- // Get values
Standard_Integer anArgIter = 1;
TCollection_AsciiString aName (argv[anArgIter++]);
Handle(AIS_InteractiveObject) anOriginObject;
TCollection_AsciiString anOriginObjectName(argv[5]);
if (aName.IsEqual (anOriginObjectName))
{
- std::cout << "vconnect error: equal names for connected objects\n";
- return 1; // TCL_ERROR
- }
- if (GetMapOfAIS().Find2 (anOriginObjectName, anOriginObject))
- {
- if (anOriginObject.IsNull())
- {
- std::cout << "Object " << anOriginObjectName << " is used for non AIS viewer\n";
- return 1; // TCL_ERROR
- }
+ Message::SendFail ("Syntax error: equal names for connected objects");
+ return 1;
}
- else
+ anOriginObject = findConnectedObject (anOriginObjectName);
+ if (anOriginObject.IsNull())
{
- Standard_CString aOriginName = anOriginObjectName.ToCString();
- TopoDS_Shape aTDShape = DBRep::Get (aOriginName);
+ TopoDS_Shape aTDShape = DBRep::Get (anOriginObjectName);
if (aTDShape.IsNull())
{
- std::cout << "vconnect error: object " << anOriginObjectName << " doesn't exist\n";
- return 1; // TCL_ERROR
+ Message::SendFail() << "Syntax error: object " << anOriginObjectName << " doesn't exist";
+ return 1;
}
- anOriginObject = new AIS_Shape (aTDShape);
- GetMapOfAIS().Bind (anOriginObject, anOriginObjectName);
- }
-
- // Get location data
- Standard_Real aXo = Draw::Atof (argv[anArgIter++]);
- Standard_Real aYo = Draw::Atof (argv[anArgIter++]);
- Standard_Real aZo = Draw::Atof (argv[anArgIter++]);
- // Create transformation
- gp_Vec aTranslation (aXo, aYo, aZo);
+ Handle(AIS_Shape) aShapePrs = new AIS_Shape (aTDShape);
+ Handle(AIS_ConnectedInteractive) aConnectedOrig = new AIS_ConnectedInteractive();
+ aConnectedOrig->Connect (aShapePrs);
- gp_Trsf aTrsf;
- aTrsf.SetTranslationPart (aTranslation);
-
- Handle(AIS_ConnectedInteractive) aConnected;
+ anOriginObject = aConnectedOrig;
+ GetMapOfAIS().Bind (aConnectedOrig, anOriginObjectName);
+ }
- aConnected = new AIS_ConnectedInteractive();
+ // Create transformation
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslationPart (gp_Vec (Draw::Atof (argv[anArgIter + 0]),
+ Draw::Atof (argv[anArgIter + 1]),
+ Draw::Atof (argv[anArgIter + 2])));
+ anArgIter += 3;
+ Handle(AIS_ConnectedInteractive) aConnected = new AIS_ConnectedInteractive();
aConnected->Connect (anOriginObject, aTrsf);
-
- // Check if there is another object with given name
- // and remove it from context
- Handle(AIS_InteractiveObject) anObj;
- if (GetMapOfAIS().Find2 (aName, anObj))
- {
- TheAISContext()->Remove (anObj, Standard_False);
- GetMapOfAIS().UnBind2(aName);
- }
-
- // Bind connected object to its name
- GetMapOfAIS().Bind (aConnected, aName);
-
if (argc == 7)
{
TCollection_AsciiString anArg = argv[6];
anArg.LowerCase();
if (anArg == "-nodisplay")
+ {
+ // bind connected object without displaying it
+ Handle(AIS_InteractiveObject) anObj;
+ if (GetMapOfAIS().Find2 (aName, anObj))
+ {
+ TheAISContext()->Remove (anObj, false);
+ GetMapOfAIS().UnBind2 (aName);
+ }
+ GetMapOfAIS().Bind (aConnected, aName);
return 0;
+ }
if (!anUpdateTool.parseRedrawMode (anArg))
{
- std::cout << "Warning! Unknown argument '" << anArg << "' passed, -nodisplay|-noupdate|-update expected at this point.\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << anArg << "'";
+ return 1;
}
}
- // Display connected object
- TheAISContext()->Display (aConnected, Standard_False);
-
+ ViewerTest::Display (aName, aConnected, false);
return 0;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << "ERROR : use 'vinit' command before \n";
+ Message::SendFail( "Error: no active viewer");
return 1;
}
if (argc != 3)
{
- std::cout << "ERROR : Usage : " << argv[0] << " name object\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.\nUsage: " << argv[0] << " name object";
return 1;
}
Handle(AIS_MultipleConnectedInteractive) anAssembly;
if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
//function : VAddConnected
//purpose :
//=======================================================================
-static Standard_Integer VAddConnected (Draw_Interpretor& di,
+static Standard_Integer VAddConnected (Draw_Interpretor& ,
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";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
-
+
if (argc != 6)
{
- std::cout << argv[0] << " error: expect 5 arguments\n";
+ Message::SendFail ("Syntax error: expect 5 arguments");
return 1;
}
- TCollection_AsciiString aName (argv[1]);
- TCollection_AsciiString anObject (argv[5]);
- Standard_Real aX = Draw::Atof (argv[2]);
- Standard_Real aY = Draw::Atof (argv[3]);
- Standard_Real aZ = Draw::Atof (argv[4]);
+ const TCollection_AsciiString aName (argv[1]);
+ const Standard_Real aX = Draw::Atof (argv[2]);
+ const Standard_Real aY = Draw::Atof (argv[3]);
+ const Standard_Real aZ = Draw::Atof (argv[4]);
+ const TCollection_AsciiString anObjectName (argv[5]);
// find object
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
Handle(AIS_MultipleConnectedInteractive) anAssembly;
- if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before\n";
- return 1;
+ Handle(AIS_InteractiveObject) aPrs;
+ aMap.Find2 (aName, aPrs);
+ anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aPrs);
+ if (anAssembly.IsNull())
+ {
+ Message::SendFail() << "Syntax error: '" << aName << "' is not an assembly";
+ return 1;
+ }
}
- anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
- if (anAssembly.IsNull())
+ Handle(AIS_InteractiveObject) anIObj = findConnectedObject (anObjectName);
+ if (anIObj.IsNull())
{
- di << "Not an assembly\n";
+ Message::SendFail() << "Syntax error: '" << anObjectName << "' is not displayed";
return 1;
}
- Handle(AIS_InteractiveObject) anIObj;
- if (!aMap.Find2 (anObject, anIObj))
- {
- std::cout << "Use 'vdisplay' before\n";
- return 1;
- }
-
gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec (aX, aY, aZ));
TheAISContext()->Display (anAssembly, Standard_False);
TheAISContext()->RecomputeSelectionOnly (anAssembly);
aContext->UpdateCurrentViewer();
-
return 0;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << "ERROR : use 'vinit' command before \n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc != 2)
{
- std::cout << "ERROR : Usage : " << argv[0] << " name\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.\nUsage: " << argv[0] << " name";
return 1;
}
Handle(AIS_MultipleConnectedInteractive) anAssembly;
if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
if (anAssembly.IsNull())
{
- std::cout << "Not an assembly\n";
+ Message::SendFail ("Syntax error: Not an assembly");
return 1;
}
return 0;
}
+//=======================================================================
+//function : VChild
+//purpose :
+//=======================================================================
+static Standard_Integer VChild (Draw_Interpretor& ,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ if (aContext.IsNull())
+ {
+ Message::SendFail ("Error: no active viewer");
+ return 1;
+ }
+
+ int toAdd = -1;
+ Handle(AIS_InteractiveObject) aParent;
+ bool hasActions = false;
+ int toInheritTrsf = -1;
+ ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
+ for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anUpdateTool.parseRedrawMode (anArg))
+ {
+ continue;
+ }
+ else if (anArg == "-add")
+ {
+ toAdd = 1;
+ continue;
+ }
+ else if (anArg == "-remove")
+ {
+ toAdd = 0;
+ continue;
+ }
+ else if (anArg == "-inheritparenttrsf"
+ || anArg == "-inheritparentloc"
+ || anArg == "-inheritparentlocation"
+ || anArg == "-inheritparent"
+ || anArg == "-noinheritparenttrsf"
+ || anArg == "-noinheritparentloc"
+ || anArg == "-noinheritparentlocation"
+ || anArg == "-noinheritparent"
+ || anArg == "-ignoreparenttrsf"
+ || anArg == "-ignoreparentloc"
+ || anArg == "-ignoreparentlocation"
+ || anArg == "-ignoreparent")
+ {
+ bool aVal = true;
+ if (anArgIter + 1 < theNbArgs
+ && ViewerTest::ParseOnOff(theArgVec[anArgIter + 1], aVal))
+ {
+ ++anArgIter;
+ }
+ if (anArg.StartsWith("-no")
+ || anArg.StartsWith("-ignore"))
+ {
+ aVal = !aVal;
+ }
+ toInheritTrsf = aVal ? 1 : 0;
+ continue;
+ }
+
+ Handle(AIS_InteractiveObject) aChild;
+ if (!GetMapOfAIS().Find2 (theArgVec[anArgIter], aChild))
+ {
+ Message::SendFail() << "Syntax error: object '" << theArgVec[anArgIter] << "' is not found";
+ return 1;
+ }
+
+ if (aParent.IsNull())
+ {
+ aParent = aChild;
+ }
+ else if (toAdd == -1)
+ {
+ Message::SendFail ("Syntax error: no action specified");
+ return 1;
+ }
+ else
+ {
+ hasActions = true;
+ if (toAdd == 1)
+ {
+ if(toInheritTrsf == 0)
+ aParent->AddChildWithCurrentTransformation(aChild);
+ else
+ aParent->AddChild (aChild);
+ }
+ else
+ {
+ if (toInheritTrsf == 0)
+ aParent->RemoveChildWithRestoreTransformation(aChild);
+ else
+ aParent->RemoveChild (aChild);
+ }
+ }
+ }
+ if (!hasActions)
+ {
+ Message::SendFail ("Syntax error: not enough arguments");
+ return 1;
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : VParent
+//purpose :
+//=======================================================================
+static Standard_Integer VParent(Draw_Interpretor&,
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
+{
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ if (aContext.IsNull())
+ {
+ Message::SendFail ("Error: no active viewer");
+ return 1;
+ }
+
+ if (theNbArgs < 2 )
+ {
+ Message::SendFail ("Syntax error: wrong number of arguments");
+ return 1;
+ }
+
+ TCollection_AsciiString aName(theArgVec[1]);
+ Handle(AIS_InteractiveObject) aParent;
+ if (!GetMapOfAIS().Find2(theArgVec[1], aParent))
+ {
+ Message::SendFail() << "Syntax error: object '" << theArgVec[1] << "' is not found";
+ return 1;
+ }
+
+ ViewerTest_AutoUpdater anUpdateTool(aContext, ViewerTest::CurrentView());
+ for (Standard_Integer anArgIter = 2; anArgIter < theNbArgs; ++anArgIter)
+ {
+ TCollection_AsciiString anArg(theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "-ignorevisu")
+ aParent->SetPropagateVisualState(Standard_False);
+ }
+ return 0;
+}
+
//===============================================================================================
//function : VSetSelectionMode
//purpose : vselmode
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
if (anAISContext.IsNull())
{
- std::cout << "Error: no active Viewer\n";
+ Message::SendFail ("Error: no active Viewer");
return 1;
}
if (anObjNames.Size() < 2
|| !ViewerTest::ParseOnOff (anObjNames.Last().ToCString(), toTurnOn))
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
anObjNames.Remove (anObjNames.Upper());
}
else
{
- std::cout << "Syntax error: unknown selection mode '" << aSelModeString << "'\n";
+ Message::SendFail() << "Syntax error: unknown selection mode '" << aSelModeString << "'";
return 1;
}
}
GetMapOfAIS().Find2 (aNameIO, anIO);
if (anIO.IsNull())
{
- std::cout << "Syntax error: undefined presentable object " << aNameIO << "\n";
+ Message::SendFail() << "Syntax error: undefined presentable object " << aNameIO;
return 1;
}
aTargetIOs.Append (anIO);
if (anAISContext.IsNull())
{
- std::cerr << "Call vinit before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (anAISContext.IsNull())
{
- std::cerr << "Call vinit before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc != (2 + aPrims->VertexNumberAllocated()))
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
if (aShape.IsNull()
|| aShape.ShapeType() != TopAbs_VERTEX)
{
- std::cout << "Syntax error: argument " << aName << " must be a point\n";
+ Message::SendFail() << "Syntax error: argument " << aName << " must be a point";
return 1;
}
aPnts[aPntIter] = BRep_Tool::Pnt (TopoDS::Vertex (aShape));
{
if (aPnts[aPnt2Iter].IsEqual (aPnts[aPntIter], Precision::Confusion()))
{
- std::cout << "Syntax error: points should not be equal\n";
+ Message::SendFail ("Syntax error: points should not be equal");
return 1;
}
}
aPrims->AddVertex (aPnts[aPntIter]);
}
- ViewerTest::Display (argv[1], new MyPArrayObject (aPrims));
+ Handle(AIS_InteractiveObject) aPrs = new MyPArrayObject (aPrims);
+ if (!isTri)
+ {
+ aPrs->Attributes()->SetupOwnShadingAspect();
+ aPrs->Attributes()->ShadingAspect()->Aspect()->SetColor (aPrs->Attributes()->LineAspect()->Aspect()->Color());
+ }
+ ViewerTest::Display (argv[1], aPrs);
return 0;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- di << argv[0] << "Call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
GetMapOfAIS().Find2 (aName, anInterObj);
if (anInterObj.IsNull())
{
- std::cout << "Syntax error: object '" << aName << "' is not displayed\n";
+ Message::SendFail() << "Syntax error: object '" << aName << "' is not displayed";
return 1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << " Call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc > 2 && argc != 5)
{
- std::cout << "Usage : " << argv[0] << " [object [mode factor units]] - sets/gets polygon offset parameters for an object,"
- "without arguments prints the default values" << std::endl;
+ Message::SendFail() << "Syntax error: wrong number of arguments.\n"
+ "Usage: " << argv[0] << " [object [mode factor units]] - sets/gets polygon offset parameters for an object,"
+ "without arguments prints the default values";
return 1;
}
if (!GetMapOfAIS().Find2 (aName, anInterObj)
|| anInterObj.IsNull())
{
- std::cout << "Syntax error: object '" << aName << "' is not displayed\n";
+ Message::SendFail() << "Syntax error: object '" << aName << "' is not displayed";
return 1;
}
}
return 0;
}
-//=======================================================================
-//function : VShowFaceBoundaries
-//purpose : Set face boundaries drawing on/off for ais object
-//=======================================================================
-static Standard_Integer VShowFaceBoundary (Draw_Interpretor& /*di*/,
- Standard_Integer argc,
- const char ** argv)
-{
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext ();
- if (aContext.IsNull ())
- {
- std::cout << argv[0] << " Call 'vinit' before!\n";
- return 1;
- }
-
- if ((argc != 3 && argc < 6) || argc > 8)
- {
- std::cout << "Usage :\n " << argv[0]
- << " ObjectName isOn [R G B [LineWidth [LineStyle]]]\n"
- << " ObjectName - name of AIS interactive object. \n"
- << " if ObjectName = \"\", then set as default\n"
- << " settings for all newly displayed objects\n"
- << " isOn - flag indicating whether the boundaries\n"
- << " should be turned on or off (can be set\n"
- << " to 0 (off) or 1 (on)).\n"
- << " R, G, B - red, green and blue components of boundary\n"
- << " color in range (0 - 255).\n"
- << " (default is (0, 0, 0)\n"
- << " LineWidth - line width\n"
- << " (default is 1)\n"
- << " LineStyle - line fill style :\n"
- << " 0 - solid \n"
- << " 1 - dashed \n"
- << " 2 - dot \n"
- << " 3 - dashdot\n"
- << " (default is solid)";
- return 1;
- }
-
- TCollection_AsciiString aName (argv[1]);
-
- Standard_Real aRed = 0.0;
- Standard_Real aGreen = 0.0;
- Standard_Real aBlue = 0.0;
- Standard_Real aWidth = 1.0;
- Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
-
- // find object
- Handle(AIS_InteractiveObject) anInterObj;
-
- // if name is empty - apply attributes for default aspect
- if (!aName.IsEmpty ())
- {
- if (!GetMapOfAIS().Find2 (aName, anInterObj)
- || anInterObj.IsNull())
- {
- std::cout << "Use 'vdisplay' on " << aName << " before" << std::endl;
- return 1;
- }
- }
-
- const Handle(Prs3d_Drawer)& aDrawer = (aName.IsEmpty ()) ?
- TheAISContext ()->DefaultDrawer () : anInterObj->Attributes ();
-
- // turn boundaries on/off
- Standard_Boolean isBoundaryDraw = (Draw::Atoi (argv[2]) == 1);
- aDrawer->SetFaceBoundaryDraw (isBoundaryDraw);
-
- // set boundary line color
- if (argc >= 6)
- {
- // Text color
- aRed = Draw::Atof (argv[3])/255.;
- aGreen = Draw::Atof (argv[4])/255.;
- aBlue = Draw::Atof (argv[5])/255.;
- }
-
- // set line width
- if (argc >= 7)
- {
- aWidth = (Standard_Real)Draw::Atof (argv[6]);
- }
-
- // select appropriate line type
- if (argc == 8)
- {
- if (!ViewerTest::ParseLineType (argv[7], aLineType))
- {
- std::cout << "Syntax error: unknown line type '" << argv[7] << "'\n";
- return 1;
- }
- }
-
- Quantity_Color aColor (aRed, aGreen, aBlue, Quantity_TOC_RGB);
-
- Handle(Prs3d_LineAspect) aBoundaryAspect =
- new Prs3d_LineAspect (aColor, aLineType, aWidth);
-
- aDrawer->SetFaceBoundaryAspect (aBoundaryAspect);
-
- TheAISContext()->Redisplay (anInterObj, Standard_True);
-
- return 0;
-}
-
// This class is used for testing markers.
-
class ViewerTest_MarkersArrayObject : public AIS_InteractiveObject
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cerr << "Call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (theArgNb < 5)
{
- std::cerr << "Usage :\n " << theArgVec[0]
- << "name X Y Z [PointsOnSide=10] [MarkerType=0] [Scale=1.0] [FileName=ImageFile]\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
}
else
{
- std::cerr << "Wrong argument: " << anArg << "\n";
+ Message::SendFail() << "Syntax error: wrong argument '" << anArg << "'";
return 1;
}
}
anImage = new Image_AlienPixMap();
if (!anImage->Load (aFileName))
{
- std::cerr << "Could not load image from file '" << aFileName << "'!\n";
+ Message::SendFail() << "Error: could not load image from file '" << aFileName << "'!";
return 1;
}
if (anImage->Format() == Image_Format_Gray)
return 0;
}
-//! Auxiliary function to parse font aspect style argument
-static Standard_Boolean parseFontStyle (const TCollection_AsciiString& theArg,
- Font_FontAspect& theAspect)
-{
- if (theArg == "regular"
- || *theArg.ToCString() == 'r')
- {
- theAspect = Font_FA_Regular;
- return Standard_True;
- }
- else if (theArg == "bolditalic")
- {
- theAspect = Font_FA_BoldItalic;
- return Standard_True;
- }
- else if (theArg == "bold"
- || *theArg.ToCString() == 'b')
- {
- theAspect = Font_FA_Bold;
- return Standard_True;
- }
- else if (theArg == "italic"
- || *theArg.ToCString() == 'i')
- {
- theAspect = Font_FA_Italic;
- return Standard_True;
- }
- return Standard_False;
-}
-
-//! Auxiliary function
-static TCollection_AsciiString fontStyleString (const Font_FontAspect theAspect)
-{
- switch (theAspect)
- {
- case Font_FA_Regular: return "regular";
- case Font_FA_BoldItalic: return "bolditalic";
- case Font_FA_Bold: return "bold";
- case Font_FA_Italic: return "italic";
- default: return "undefined";
- }
-}
-
//=======================================================================
//function : TextToBrep
//purpose : Tool for conversion text to occt-shapes
// Check arguments
if (theArgNb < 3)
{
- std::cerr << "Error: " << theArgVec[0] << " - invalid syntax\n";
+ Message::SendFail() << "Error: " << theArgVec[0] << " - invalid syntax";
return 1;
}
Graphic3d_HorizontalTextAlignment aHJustification = Graphic3d_HTA_LEFT;
Graphic3d_VerticalTextAlignment aVJustification = Graphic3d_VTA_BOTTOM;
-
+ Font_StrictLevel aStrictLevel = Font_StrictLevel_Any;
for (; anArgIt < theArgNb; ++anArgIt)
{
TCollection_AsciiString aParam (theArgVec[anArgIt]);
{
if (anArgIt + 3 >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong syntax at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong syntax at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
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"))
+ if (!parseFontStyle (anOption, aFontAspect))
{
- aFontAspect = Font_FA_BoldItalic;
- }
- else
- {
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: unknown font aspect '" << anOption << "'";
return 1;
}
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
aFontName = theArgVec[anArgIt];
}
+ else if (aParam == "-strict")
+ {
+ anArgIt += parseFontStrictLevel (theArgNb - anArgIt - 1,
+ theArgVec + anArgIt + 1,
+ aStrictLevel);
+ }
else if (aParam == "-composite")
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (anArgIt + 6 >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cerr << "Warning! Unknown argument '" << aParam << "'\n";
+ Message::SendFail() << "Warning! Unknown argument '" << aParam << "'";
}
}
aFont.SetCompositeCurveMode (anIsCompositeCurve);
- if (!aFont.Init (aFontName.ToCString(), aFontAspect, aTextHeight))
+ if (!aFont.FindAndInit (aFontName.ToCString(), aFontAspect, aTextHeight, aStrictLevel))
{
- std::cerr << "Font initialization error\n";
+ Message::SendFail ("Error: unable to load Font");
return 1;
}
//function : VFont
//purpose : Font management
//=======================================================================
+struct FontComparator
+{
+ bool operator() (const Handle(Font_SystemFont)& theFontA,
+ const Handle(Font_SystemFont)& theFontB)
+ {
+ return theFontA->FontKey().IsLess (theFontB->FontKey());
+ }
+};
static int VFont (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
Handle(Font_FontMgr) aMgr = Font_FontMgr::GetInstance();
- if (theArgNb < 2)
- {
- // just print the list of available fonts
- Standard_Boolean isFirst = Standard_True;
- for (Font_NListOfSystemFont::Iterator anIter (aMgr->GetAvailableFonts());
- anIter.More(); anIter.Next())
- {
- const Handle(Font_SystemFont)& aFont = anIter.Value();
- if (!isFirst)
- {
- theDI << "\n";
- }
-
- theDI << aFont->FontName()->String()
- << " " << fontStyleString (aFont->FontAspect())
- << " " << aFont->FontPath()->String();
- isFirst = Standard_False;
- }
- return 0;
- }
-
+ bool toPrintList = theArgNb < 2, toPrintNames = false;
+ Font_StrictLevel aStrictLevel = Font_StrictLevel_Any;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
const TCollection_AsciiString anArg (theArgVec[anArgIter]);
TCollection_AsciiString anArgCase (anArg);
anArgCase.LowerCase();
- if (anArgCase == "find")
+ if (anArgCase == "-strict")
{
- if (++anArgIter >= theArgNb)
- {
- std::cerr << "Wrong syntax at argument '" << anArg.ToCString() << "'!\n";
- return 1;
- }
-
- Standard_CString aFontName = theArgVec[anArgIter];
- Font_FontAspect aFontAspect = Font_FA_Undefined;
+ anArgIter += parseFontStrictLevel (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ aStrictLevel);
+ }
+ else if (anArgCase == "-clear")
+ {
+ aMgr->ClearFontDataBase();
+ }
+ else if (anArgCase == "-init")
+ {
+ aMgr->InitFontDataBase();
+ }
+ else if (anArgCase == "-list")
+ {
+ toPrintList = true;
+ }
+ else if (anArgCase == "-names")
+ {
+ toPrintList = true;
+ toPrintNames = true;
+ }
+ else if (anArgIter + 1 < theArgNb
+ && (anArgCase == "-find"
+ || anArgCase == "-findinfo"
+ || anArgCase == "-findall"
+ || anArgCase == "find"))
+ {
+ const TCollection_AsciiString aFontName (theArgVec[++anArgIter]);
+ Font_FontAspect aFontAspect = Font_FA_Undefined;
if (++anArgIter < theArgNb)
{
anArgCase = theArgVec[anArgIter];
--anArgIter;
}
}
- Handle(Font_SystemFont) aFont = aMgr->FindFont (new TCollection_HAsciiString (aFontName), aFontAspect, -1);
- if (aFont.IsNull())
+
+ const bool toFindAll = (anArgCase == "-findall");
+ const bool toPrintInfo = (anArgCase == "-findinfo");
+ TCollection_AsciiString aResult;
+ if (toFindAll
+ || aFontName.Search ("*") != -1)
{
- std::cerr << "Error: font '" << aFontName << "' is not found!\n";
- continue;
- }
+ const Font_NListOfSystemFont aFonts = aMgr->GetAvailableFonts();
+ std::vector<Handle(Font_SystemFont)> aFontsSorted;
+ aFontsSorted.reserve (aFonts.Size());
+ for (Font_NListOfSystemFont::Iterator aFontIter (aFonts); aFontIter.More(); aFontIter.Next())
+ {
+ aFontsSorted.push_back (aFontIter.Value());
+ }
+ std::stable_sort (aFontsSorted.begin(), aFontsSorted.end(), FontComparator());
+ for (std::vector<Handle(Font_SystemFont)>::iterator aFontIter = aFontsSorted.begin(); aFontIter != aFontsSorted.end(); ++aFontIter)
+ {
+ const Handle(Font_SystemFont)& aFont = *aFontIter;
+ const TCollection_AsciiString aCheck = TCollection_AsciiString ("string match -nocase \"") + aFontName + "\" \"" + aFont->FontName() + "\"";
+ if (theDI.Eval (aCheck.ToCString()) == 0
+ && *theDI.Result() != '1')
+ {
+ theDI.Reset();
+ continue;
+ }
- theDI << aFont->FontName()->String()
- << " " << fontStyleString (aFont->FontAspect())
- << " " << aFont->FontPath()->String();
- }
- else if (anArgCase == "add"
- || anArgCase == "register")
- {
- if (++anArgIter >= theArgNb)
+ theDI.Reset();
+ if (!aResult.IsEmpty())
+ {
+ aResult += "\n";
+ }
+
+ aResult += toPrintInfo ? aFont->ToString() : aFont->FontName();
+ if (!toFindAll)
+ {
+ break;
+ }
+ }
+ }
+ else if (Handle(Font_SystemFont) aFont = aMgr->FindFont (aFontName, aStrictLevel, aFontAspect))
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'!\n";
- return 1;
+ aResult = toPrintInfo ? aFont->ToString() : aFont->FontName();
}
+ if (!aResult.IsEmpty())
+ {
+ theDI << aResult;
+ }
+ else
+ {
+ Message::SendFail() << "Error: font '" << aFontName << "' is not found";
+ }
+ }
+ else if (anArgIter + 1 < theArgNb
+ && (anArgCase == "-add"
+ || anArgCase == "add"
+ || anArgCase == "-register"
+ || anArgCase == "register"))
+ {
+ ++anArgIter;
Standard_CString aFontPath = theArgVec[anArgIter++];
TCollection_AsciiString aFontName;
Font_FontAspect aFontAspect = Font_FA_Undefined;
{
anArgCase = theArgVec[anArgIter];
anArgCase.LowerCase();
- if (aFontAspect == Font_FA_Undefined
+ if (aFontAspect == Font_FontAspect_UNDEFINED
&& parseFontStyle (anArgCase, aFontAspect))
{
continue;
Handle(Font_SystemFont) aFont = aMgr->CheckFont (aFontPath);
if (aFont.IsNull())
{
- std::cerr << "Error: font '" << aFontPath << "' is not found!\n";
+ Message::SendFail() << "Error: font '" << aFontPath << "' is not found!";
continue;
}
- if (aFontAspect != Font_FA_Undefined
+ if (aFontAspect != Font_FontAspect_UNDEFINED
|| !aFontName.IsEmpty())
{
- if (aFontAspect == Font_FA_Undefined)
+ TCollection_AsciiString aName = aFont->FontName();
+ if (!aFontName.IsEmpty())
{
- aFontAspect = aFont->FontAspect();
+ aName = aFontName;
}
- Handle(TCollection_HAsciiString) aName = aFont->FontName();
- if (!aFontName.IsEmpty())
+ Handle(Font_SystemFont) aFont2 = new Font_SystemFont (aName);
+ if (aFontAspect != Font_FontAspect_UNDEFINED)
{
- aName = new TCollection_HAsciiString (aFontName);
+ aFont2->SetFontPath (aFontAspect, aFontPath, 0);
}
- aFont = new Font_SystemFont (aName, aFontAspect, new TCollection_HAsciiString (aFontPath));
+ else
+ {
+ for (int anAspectIter = 0; anAspectIter < Font_FontAspect_NB; ++anAspectIter)
+ {
+ aFont2->SetFontPath ((Font_FontAspect )anAspectIter,
+ aFont->FontPath ((Font_FontAspect )anAspectIter),
+ aFont->FontFaceId ((Font_FontAspect )anAspectIter));
+ }
+ }
+ aFont = aFont2;
}
if (isSingelStroke != -1)
{
}
aMgr->RegisterFont (aFont, Standard_True);
- theDI << aFont->FontName()->String()
- << " " << fontStyleString (aFont->FontAspect())
- << " " << aFont->FontPath()->String();
+ theDI << aFont->ToString();
+ }
+ else if (anArgCase == "-verbose"
+ || anArgCase == "-trace")
+ {
+ bool toEnable = true;
+ if (anArgIter + 1 < theArgNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+ {
+ ++anArgIter;
+ }
+ aMgr->SetTraceAliases (toEnable);
+ }
+ else if (anArgCase == "-unicodefallback"
+ || anArgCase == "-fallback"
+ || anArgCase == "-touseunicodesubsetfallback")
+ {
+ bool toEnable = true;
+ if (anArgIter + 1 < theArgNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+ {
+ ++anArgIter;
+ }
+ Font_FontMgr::ToUseUnicodeSubsetFallback() = toEnable;
}
else
{
- std::cerr << "Warning! Unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Warning! Unknown argument '" << anArg << "'";
}
}
- return 0;
-}
-
-//=======================================================================
-//function : VSetEdgeType
-//purpose : Edges type management
-//=======================================================================
-
-static int VSetEdgeType (Draw_Interpretor& theDI,
- Standard_Integer theArgNum,
- const char** theArgs)
-{
- if (theArgNum < 4 || theArgNum > 9)
- {
- theDI << theArgs[0] << " error: wrong number of parameters. Type 'help "
- << theArgs[0] << "' for more information.\n";
- return 1;
- }
-
- Standard_Boolean isForceRedisplay = Standard_False;
-
- // Get shape name
- TCollection_AsciiString aName(theArgs[1]);
- Handle(AIS_InteractiveObject) anObject;
- if (!GetMapOfAIS().Find2 (aName, anObject))
- {
- theDI << theArgs[0] << " error: wrong object name.\n";
- return 1;
- }
-
- // 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)
+ if (toPrintList)
{
- TCollection_AsciiString aParam ((theArgs[anIt]));
- if (aParam.Value (1) == '-' && !aParam.IsRealValue())
+ // just print the list of available fonts
+ Standard_Boolean isFirst = Standard_True;
+ const Font_NListOfSystemFont aFonts = aMgr->GetAvailableFonts();
+ std::vector<Handle(Font_SystemFont)> aFontsSorted;
+ aFontsSorted.reserve (aFonts.Size());
+ for (Font_NListOfSystemFont::Iterator aFontIter (aFonts); aFontIter.More(); aFontIter.Next())
{
- if (aParam.IsEqual ("-type"))
- {
- if (theArgNum <= anIt + 1)
- {
- theDI << theArgs[0] << " error: wrong number of values for parameter '"
- << aParam.ToCString() << "'.\n";
- return 1;
- }
+ aFontsSorted.push_back (aFontIter.Value());
+ }
+ std::stable_sort (aFontsSorted.begin(), aFontsSorted.end(), FontComparator());
+ for (std::vector<Handle(Font_SystemFont)>::iterator aFontIter = aFontsSorted.begin(); aFontIter != aFontsSorted.end(); ++aFontIter)
+ {
+ const Handle(Font_SystemFont)& aFont = *aFontIter;
- ++anIt;
- Aspect_TypeOfLine aTypeEnum = Aspect_TOL_SOLID;
- if (!ViewerTest::ParseLineType (theArgs[anIt], aTypeEnum))
- {
- std::cout << "Syntax error: wrong line type: '" << theArgs[anIt] << "'.\n";
- return 1;
- }
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType (aTypeEnum);
- }
- else if (aParam.IsEqual ("-color"))
+ if (toPrintNames)
{
- if (theArgNum <= anIt + 3)
+ if (!isFirst)
{
- theDI << theArgs[0] << " error: wrong number of values for parameter '"
- << aParam.ToCString() << "'.\n";
- return 1;
+ theDI << "\n";
}
-
- Standard_Real aR = Draw::Atof(theArgs[++anIt]);
- Standard_Real aG = Draw::Atof(theArgs[++anIt]);
- Standard_Real aB = Draw::Atof(theArgs[++anIt]);
- Quantity_Color aColor = Quantity_Color (aR > 1 ? aR / 255.0 : aR,
- aG > 1 ? aG / 255.0 : aG,
- aB > 1 ? aB / 255.0 : aB,
- Quantity_TOC_RGB);
-
- aFillAreaAspect->Aspect()->SetEdgeColor (aColor);
- }
- else if (aParam.IsEqual ("-force"))
- {
- isForceRedisplay = Standard_True;
+ theDI << "\"" << aFont->FontName() << "\"";
}
else
{
- theDI << theArgs[0] << " error: unknown parameter '"
- << aParam.ToCString() << "'.\n";
- return 1;
+ if (!isFirst)
+ {
+ theDI << "\n";
+ }
+ theDI << aFont->ToString();
}
+ isFirst = Standard_False;
}
+ return 0;
}
- // Update shape presentation as aspect parameters were changed
- if (isForceRedisplay)
- {
- ViewerTest::GetAISContext()->Redisplay (anObject, Standard_False);
- }
- else
- {
- anObject->SetAspect (aFillAreaAspect);
- }
-
- //Update view
- ViewerTest::CurrentView()->Redraw();
-
- return 0;
-}
-
-//=======================================================================
-//function : VUnsetEdgeType
-//purpose : Unsets edges visibility in shading mode
-//=======================================================================
-
-static int VUnsetEdgeType (Draw_Interpretor& theDI,
- Standard_Integer theArgNum,
- const char** theArgs)
-{
- if (theArgNum != 2 && theArgNum != 3)
- {
- theDI << theArgs[0] << " error: wrong number of parameters. Type 'help "
- << theArgs[0] << "' for more information.\n";
- return 1;
- }
-
- Standard_Boolean isForceRedisplay = Standard_False;
-
- // Get shape name
- TCollection_AsciiString aName (theArgs[1]);
- Handle(AIS_InteractiveObject) anObject;
- if (!GetMapOfAIS().Find2 (aName, anObject))
- {
- theDI << theArgs[0] << " error: wrong object name.\n";
- return 1;
- }
-
- // Enable trianle edge mode
- anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeOff();
-
- // Parse parameters
- if (theArgNum == 3)
- {
- TCollection_AsciiString aParam ((theArgs[2]));
- if (aParam.IsEqual ("-force"))
- {
- isForceRedisplay = Standard_True;
- }
- else
- {
- theDI << theArgs[0] << " error: unknown parameter '"
- << aParam.ToCString() << "'.\n";
- return 1;
- }
- }
-
- // Update shape presentation as aspect parameters were changed
- if (isForceRedisplay)
- {
- ViewerTest::GetAISContext()->Redisplay (anObject, Standard_False);
- }
- else
- {
- anObject->SetAspect (anObject->Attributes()->ShadingAspect());
- }
-
- //Update view
- ViewerTest::CurrentView()->Redraw();
-
return 0;
}
-
//=======================================================================
//function : VVertexMode
//purpose : Switches vertex display mode for AIS_Shape or displays the current value
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (theArgNum == 2)
{
- std::cout << "Error: '-set' option not followed by the mode and optional object name(s)" << std::endl;
- std::cout << "Type 'help vvertexmode' for usage hints" << std::endl;
+ Message::SendFail ("Error: '-set' option not followed by the mode and optional object name(s)\n"
+ "Type 'help vvertexmode' for usage hints");
return 1;
}
if (theArgNum > 2
|| !GetMapOfAIS().Find2 (aParam, anObject))
{
- std::cout << "Error: invalid number of arguments" << std::endl;
+ Message::SendFail ("Syntax error: invalid number of arguments");
return 1;
}
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
if (anAISContext.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
case 2 : aCmd = CloudForShape; break;
case 7 : aCmd = CloudSphere; break;
default :
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
Standard_Boolean toRandColors = Standard_False;
Standard_Boolean hasNormals = Standard_True;
Standard_Boolean isSetArgNorm = Standard_False;
+ Standard_Boolean hasUV = Standard_False;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNum; ++anArgIter)
{
Standard_CString anArg = theArgs[anArgIter];
{
if (isSetArgNorm && hasNormals)
{
- std::cout << "Error: wrong syntax - normals can not be enabled with colors at the same time\n";
+ Message::SendFail ("Syntax error: normals can not be enabled with colors at the same time");
return 1;
}
toRandColors = Standard_True;
{
if (toRandColors)
{
- std::cout << "Error: wrong syntax - normals can not be enabled with colors at the same time\n";
+ Message::SendFail ("Syntax error: normals can not be enabled with colors at the same time");
return 1;
}
isSetArgNorm = Standard_True;
isSetArgNorm = Standard_True;
hasNormals = Standard_False;
}
+ else if (aFlag == "-uv"
+ || aFlag == "-texels")
+ {
+ hasUV = Standard_True;
+ }
}
Standard_CString aName = theArgs[1];
+ Graphic3d_ArrayFlags aFlags = Graphic3d_ArrayFlags_None;
+ if (hasNormals)
+ {
+ aFlags |= Graphic3d_ArrayFlags_VertexNormal;
+ }
+ if (toRandColors)
+ {
+ aFlags |= Graphic3d_ArrayFlags_VertexColor;
+ }
+ if (hasUV)
+ {
+ aFlags |= Graphic3d_ArrayFlags_VertexTexel;
+ }
// generate arbitrary set of points
Handle(Graphic3d_ArrayOfPoints) anArrayPoints;
if (aShape.IsNull())
{
- std::cout << "Error: no shape with name '" << aShapeName << "' found\n";
+ Message::SendFail() << "Error: no shape with name '" << aShapeName << "' found";
return 1;
}
}
if (aNbPoints < 3)
{
- std::cout << "Error: shape should be triangulated!\n";
+ Message::SendFail ("Error: shape should be triangulated");
return 1;
}
- anArrayPoints = new Graphic3d_ArrayOfPoints (aNbPoints, toRandColors, hasNormals);
+ anArrayPoints = new Graphic3d_ArrayOfPoints (aNbPoints, aFlags);
for (TopExp_Explorer aFaceIt (aShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceIt.Current());
{
anArrayPoints->SetVertexNormal (anIndexOfPoint, aNormals (aNodeIter));
}
+ if (hasUV
+ && aTriangulation->HasUVNodes())
+ {
+ anArrayPoints->SetVertexTexel (anIndexOfPoint, aTriangulation->UVNode (aNodeIter));
+ }
}
}
}
aDistribution.LowerCase();
if ( aDistribution != "surface" && aDistribution != "volume" )
{
- std::cout << "Error: wrong arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong arguments. See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
gp_Pnt aCenter(aCenterX, aCenterY, aCenterZ);
- anArrayPoints = new Graphic3d_ArrayOfPoints (aNbPoints, toRandColors, hasNormals);
+ anArrayPoints = new Graphic3d_ArrayOfPoints (aNbPoints, aFlags);
for (Standard_Integer aPntIt = 0; aPntIt < aNbPoints; ++aPntIt)
{
Standard_Real anAlpha = (Standard_Real (rand() % 2000) / 1000.0) * M_PI;
{
anArrayPoints->SetVertexNormal (anIndexOfPoint, aDir);
}
+ if (hasUV)
+ {
+ anArrayPoints->SetVertexTexel (anIndexOfPoint, gp_Pnt2d (anAlpha / 2.0 * M_PI,
+ aBeta / 2.0 * M_PI));
+ }
}
}
ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
- std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
--aNbArgs;
if (aPriority < 0 || aPriority > 10)
{
- std::cout << "Error: the specified display priority value '" << aLastArg
- << "' is outside the valid range [0..10]" << std::endl;
+ Message::SendFail() << "Syntax error: the specified display priority value '" << aLastArg
+ << "' is outside the valid range [0..10]";
return 1;
}
}
if (aNbArgs < 2)
{
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
GetMapOfAIS().Find2 (aName, anIObj);
if (anIObj.IsNull())
{
- std::cout << "Error: the object '" << theArgs[1] << "' is not displayed" << std::endl;
+ Message::SendFail() << "Error: the object '" << theArgs[1] << "' is not displayed";
return 1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no view available, call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
else if (theArgNum < 2)
{
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments. See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
Standard_Boolean isOn = Standard_True;
if (aShape.IsNull())
{
- std::cout << "Error: shape with name '" << aShapeName << "' is not found\n";
+ Message::SendFail() << "Error: shape with name '" << aShapeName << "' is not found";
return 1;
}
aLength = anArgIter < theArgNum ? Draw::Atof (theArgs[anArgIter]) : 0.0;
if (Abs (aLength) <= gp::Resolution())
{
- std::cout << "Syntax error: length should not be zero\n";
+ Message::SendFail ("Syntax error: length should not be zero");
return 1;
}
}
aNbAlongU = anArgIter < theArgNum ? Draw::Atoi (theArgs[anArgIter]) : 0;
if (aNbAlongU < 1)
{
- std::cout << "Syntax error: NbAlongU should be >=1\n";
+ Message::SendFail ("Syntax error: NbAlongU should be >=1");
return 1;
}
}
aNbAlongV = anArgIter < theArgNum ? Draw::Atoi (theArgs[anArgIter]) : 0;
if (aNbAlongV < 1)
{
- std::cout << "Syntax error: NbAlongV should be >=1\n";
+ Message::SendFail ("Syntax error: NbAlongV should be >=1");
return 1;
}
}
aNbAlongV = aNbAlongU;
if (aNbAlongU < 1)
{
- std::cout << "Syntax error: NbAlong should be >=1\n";
+ Message::SendFail ("Syntax error: NbAlong should be >=1");
return 1;
}
}
else
{
- std::cout << "Syntax error: unknwon argument '" << aParam << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << aParam << "'";
return 1;
}
}
__FILE__,VAxisBuilder,group);
theCommands.Add("vpoint",
- "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).",
+ "vpoint name [X Y [Z]] [-2d] [-nosel]"
+ "\n\t\t: Creates a point from coordinates."
+ "\n\t\t: If the values are not defined, a point is created from selected vertex or edge (center)."
+ "\n\t\t: -2d defines on-screen 2D point from top-left window corner"
+ "\n\t\t: -nosel creates non-selectable presentation",
__FILE__,VPointBuilder,group);
theCommands.Add("vplane",
"\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: [-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: [-noupdate]"
"\n\t\t: [-plane NormX NormY NormZ DirX DirY DirZ]"
"\n\t\t: [-flipping]"
+ "\n\t\t: [-ownanchor {0|1}=1]"
"\n\t\t: Display text label at specified position.",
__FILE__, VDrawText, group);
"\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: [-inheritParentTrsf {on|off}]"
"\n\t\t: Object local transformation management:"
"\n\t\t: -reset reset transformation to identity"
"\n\t\t: -translate translate object"
"\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",
+ "\n\t\t: -setScale assign object scale factor"
+ "\n\t\t: -inheritParentTrsf option to inherit parent"
+ "\n\t\t: transformation or not (ON by default)",
__FILE__, VSetLocation, group);
theCommands.Add ("vsetlocation",
"alias for vlocation",
__FILE__, VSetLocation, group);
-
+ theCommands.Add ("vchild",
+ "vchild parent [-add] [-remove] [-ignoreParentTrsf {0|1}] child1 [child2] [...]"
+ "\n\t\t: Command for testing low-level presentation connections."
+ "\n\t\t: vconnect command should be used instead.",
+ __FILE__, VChild, group);
+ theCommands.Add("vparent",
+ "vparent parent [-ignoreVisu]"
+ "\n\t\t: Command for testing object properties as parent in the hierarchy."
+ "\n\t\t: Arguments:"
+ "\n\t\t: -ignoreVisu do not propagate the visual state (display/erase/color) to children objects",
+ __FILE__, VParent, group);
theCommands.Add ("vcomputehlr",
"vcomputehlr shapeInput hlrResult [-algoType {algo|polyAlgo}=polyAlgo]"
"\n\t\t: [eyeX eyeY eyeZ dirX dirY dirZ upX upY upZ]"
"vpolygonoffset : [object [mode factor units]] - sets/gets polygon offset parameters for an object, without arguments prints the default values",
__FILE__, VPolygonOffset, group);
- theCommands.Add ("vshowfaceboundary",
- "vshowfaceboundary : ObjectName isOn (1/0) [R G B [LineWidth [LineStyle]]]"
- "- turns on/off drawing of face boundaries for ais object "
- "and defines boundary line style.",
- __FILE__, VShowFaceBoundary, group);
-
theCommands.Add ("vmarkerstest",
"vmarkerstest: name X Y Z [PointsOnSide=10] [MarkerType=0] [Scale=1.0] [FileName=ImageFile]\n",
__FILE__, VMarkersTest, group);
"\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: [-aspect {regular|bold|italic|boldItalic}=regular]"
+ "\n\t\t: [-font font=Courier] [-strict {strict|aliases|any}=any]"
"\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] [singleStroke]]"
- "\n\t\t: [find fontName [regular,bold,italic,bolditalic=undefined]]",
+ "vfont [-add pathToFont [fontName] [regular,bold,italic,boldItalic=undefined] [singleStroke]]"
+ "\n\t\t: [-strict {any|aliases|strict}] [-find fontName [regular,bold,italic,boldItalic=undefined]] [-verbose {on|off}]"
+ "\n\t\t: [-findAll fontNameMask] [-findInfo fontName]"
+ "\n\t\t: [-unicodeFallback {on|off}]"
+ "\n\t\t: [-clear] [-init] [-list] [-names]"
+ "\n\t\t: Work with font registry - register font, list available fonts, find font."
+ "\n\t\t: -findAll is same as -find, but can print more than one font when mask is passed."
+ "\n\t\t: -findInfo is same as -find, but prints complete font information instead of family name.",
__FILE__, VFont, group);
-
- theCommands.Add ("vsetedgetype",
- "vsetedgetype usage:\n"
- "vsetedgetype ShapeName [-force] [-type {solid, dash, dot}] [-color R G B] "
- "\n\t\t: Sets edges type and color for input shape",
- __FILE__, VSetEdgeType, group);
-
- theCommands.Add ("vunsetedgetype",
- "vunsetedgetype usage:\n"
- "vunsetedgetype ShapeName [-force]"
- "\n\t\t: Unsets edges type and color for input shape",
- __FILE__, VUnsetEdgeType, group);
theCommands.Add ("vvertexmode",
"vvertexmode [name | -set {isolated | all | inherited} [name1 name2 ...]]\n"
__FILE__, VVertexMode, group);
theCommands.Add ("vpointcloud",
- "vpointcloud name shape [-randColor] [-normals] [-noNormals]"
+ "vpointcloud name shape [-randColor] [-normals] [-noNormals] [-uv]"
"\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]"
+ " ... [-randColor] [-normals] [-noNormals] [-uv]"
"\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:"