0031848: [REGRESSION] Visualization - MoveTo() triggers exception "gp_Dir() - input...
[occt.git] / src / ViewerTest / ViewerTest_ObjectCommands.cxx
index 3db6e67..c320a14 100644 (file)
 #include <Prs3d_PointAspect.hxx>
 #include <Prs3d_Presentation.hxx>
 #include <Prs3d_TextAspect.hxx>
+#include <Prs3d_ToolCylinder.hxx>
+#include <Prs3d_ToolSphere.hxx>
+#include <Prs3d_ToolTorus.hxx>
 
 #include <Image_AlienPixMap.hxx>
 #include <TColStd_HArray1OfAsciiString.hxx>
@@ -170,7 +173,7 @@ namespace
       theColorValues->Size() >= 2 ? theColorValues->Value (2).ToCString() : "",
       theColorValues->Size() >= 3 ? theColorValues->Value (3).ToCString() : ""
     };
-    return ViewerTest::ParseColor (theColorValues->Size(), anArgs, theColor) != 0;
+    return Draw::ParseColor (theColorValues->Size(), anArgs, theColor) != 0;
   }
 
   static bool convertToDatumPart (const TCollection_AsciiString& theValue,
@@ -354,7 +357,7 @@ namespace
       Standard_Boolean toHideLabels = Standard_True;
       if (aValues->Size() == 1)
       {
-        ViewerTest::ParseOnOff (aValues->First().ToCString(), toHideLabels);
+        Draw::ParseOnOff (aValues->First().ToCString(), toHideLabels);
       }
       else if (aValues->Size() != 0)
       {
@@ -374,7 +377,7 @@ namespace
       Standard_Boolean toHideArrows = Standard_True;
       if (aValues->Size() == 1)
       {
-        ViewerTest::ParseOnOff (aValues->First().ToCString(), toHideArrows);
+        Draw::ParseOnOff (aValues->First().ToCString(), toHideArrows);
       }
       else if (aValues->Size() != 0)
       {
@@ -2390,6 +2393,8 @@ static int VDrawText (Draw_Interpretor& theDI,
   gp_Dir           aDirection;
   gp_Pnt           aPos;
 
+
+  Handle(Font_TextFormatter) aTextFormatter;
   for (; anArgIt < theArgsNb; ++anArgIt)
   {
     TCollection_AsciiString aParam (theArgVec[anArgIt]);
@@ -2416,9 +2421,9 @@ static int VDrawText (Draw_Interpretor& theDI,
     else if (aParam == "-color")
     {
       Quantity_Color aColor;
-      Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIt - 1,
-                                                           theArgVec + anArgIt + 1,
-                                                           aColor);
+      Standard_Integer aNbParsed = Draw::ParseColor (theArgsNb - anArgIt - 1,
+                                                     theArgVec + anArgIt + 1,
+                                                     aColor);
       if (aNbParsed == 0)
       {
         Message::SendFail() << "Syntax error at '" << aParam << "'";
@@ -2517,6 +2522,20 @@ static int VDrawText (Draw_Interpretor& theDI,
 
       aTextPrs->SetHeight (Draw::Atof(theArgVec[anArgIt]));
     }
+    else if (aParam == "-wrapping")
+    {
+      if (++anArgIt >= theArgsNb)
+      {
+        Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
+        return 1;
+      }
+
+      if (aTextFormatter.IsNull())
+      {
+        aTextFormatter = new Font_TextFormatter();
+      }
+      aTextFormatter->SetWrapping ((Standard_ShortReal)Draw::Atof(theArgVec[anArgIt]));
+    }
     else if (aParam == "-aspect")
     {
       if (++anArgIt >= theArgsNb)
@@ -2610,9 +2629,9 @@ static int VDrawText (Draw_Interpretor& theDI,
           || aParam == "-subtitlecolor")
     {
       Quantity_Color aColor;
-      Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIt - 1,
-                                                           theArgVec + anArgIt + 1,
-                                                           aColor);
+      Standard_Integer aNbParsed = Draw::ParseColor (theArgsNb - anArgIt - 1,
+                                                     theArgVec + anArgIt + 1,
+                                                     aColor);
       if (aNbParsed == 0)
       {
         Message::SendFail() << "Syntax error at '" << aParam << "'";
@@ -2662,6 +2681,8 @@ static int VDrawText (Draw_Interpretor& theDI,
     }
   }
 
+  aTextPrs->SetTextFormatter (aTextFormatter);
+
   if (aHasPlane)
   {
     aTextPrs->SetOrientation3D (gp_Ax2 (aPos, aNormal, aDirection));
@@ -3124,7 +3145,7 @@ static int VComputeHLR (Draw_Interpretor& ,
     {
       toShowHiddenEdges = true;
       if (anArgIter + 1 < theArgNb
-       && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toShowHiddenEdges))
+       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toShowHiddenEdges))
       {
         ++anArgIter;
       }
@@ -3135,7 +3156,7 @@ static int VComputeHLR (Draw_Interpretor& ,
     {
       toShowCNEdges = true;
       if (anArgIter + 1 < theArgNb
-       && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toShowCNEdges))
+       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toShowCNEdges))
       {
         ++anArgIter;
       }
@@ -3958,7 +3979,8 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
       ++anArgIter;
       aContext->SetLocation (anObj, anObj2->LocalTransformation());
     }
-    else if (anArg == "-rotate")
+    else if (anArg == "-rotate"
+          || anArg == "-prerotate")
     {
       toPrintInfo = Standard_False;
       if (anArgIter + 7 >= theArgNb)
@@ -3977,10 +3999,18 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
                                          Draw::Atof (theArgVec[anArgIter + 7]) * (M_PI / 180.0));
       anArgIter += 7;
 
-      aTrsf = anObj->LocalTransformation() * aTrsf;
+      if (anArg == "-prerotate")
+      {
+        aTrsf = anObj->LocalTransformation() * aTrsf;
+      }
+      else
+      {
+        aTrsf = aTrsf * anObj->LocalTransformation();
+     }
       aContext->SetLocation (anObj, aTrsf);
     }
-    else if (anArg == "-translate")
+    else if (anArg == "-translate"
+          || anArg == "-pretranslate")
     {
       toPrintInfo = Standard_False;
       gp_Vec aLocVec;
@@ -3994,10 +4024,18 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
 
       gp_Trsf aTrsf;
       aTrsf.SetTranslationPart (aLocVec);
-      aTrsf = anObj->LocalTransformation() * aTrsf;
+      if (anArg == "-pretranslate")
+      {
+        aTrsf = anObj->LocalTransformation() * aTrsf;
+      }
+      else
+      {
+        aTrsf = aTrsf * anObj->LocalTransformation();
+      }
       aContext->SetLocation (anObj, aTrsf);
     }
     else if (anArg == "-scale"
+          || anArg == "-prescale"
           || anArg == "-setscale")
     {
       toPrintInfo = Standard_False;
@@ -4050,7 +4088,8 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
 
       if (toPrintScale)
       {
-        if (anArg == "-setscale")
+        if (anArg == "-setscale"
+         || anArg == "-prescale")
         {
           Message::SendFail() << "Syntax error at '" << anArg << "'";
           return 1;
@@ -4081,17 +4120,25 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
         if (hasScaleLoc)
         {
           aTrsf.SetScale (aScaleLoc, aScale);
+        }
+        else
+        {
+          aTrsf.SetScaleFactor (aScale);
+        }
+
+        if (anArg == "-prescale")
+        {
           aTrsf = anObj->LocalTransformation() * aTrsf;
         }
         else
         {
-          aTrsf = anObj->LocalTransformation();
-          aTrsf.SetScaleFactor (aTrsf.ScaleFactor() * aScale);
+          aTrsf = aTrsf * anObj->LocalTransformation();
         }
         aContext->SetLocation (anObj, aTrsf);
       }
     }
-    else if (anArg == "-mirror")
+    else if (anArg == "-mirror"
+          || anArg == "-premirror")
     {
       toPrintInfo = Standard_False;
       if (anArgIter + 6 >= theArgNb)
@@ -4108,7 +4155,14 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
                                        Draw::Atof(theArgVec[theArgNb - 2]),
                                        Draw::Atof(theArgVec[theArgNb - 1]))));
       anArgIter += 6;
-      aTrsf = anObj->LocalTransformation() * aTrsf;
+      if (anArg == "-premirror")
+      {
+        aTrsf = anObj->LocalTransformation() * aTrsf;
+      }
+      else
+      {
+        aTrsf = aTrsf * anObj->LocalTransformation();
+      }
       aContext->SetLocation (anObj, aTrsf);
     }
     else if (anArg == "-setrotation"
@@ -4141,7 +4195,7 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
                                      aQuatArgs[2].RealValue(),
                                      aQuatArgs[3].RealValue());
           gp_Trsf aTrsf = anObj->LocalTransformation();
-          aTrsf.SetRotation (aQuat);
+          aTrsf.SetRotationPart (aQuat);
           aContext->SetLocation (anObj, aTrsf);
           continue;
         }
@@ -4287,13 +4341,17 @@ static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
   const TCollection_AsciiString aName (argv[anArgIter++]);
   Handle(AIS_MultipleConnectedInteractive) aMultiConObject;
   TCollection_AsciiString aColorString (argv[argc-1]);
-  Standard_CString aColorName = "";
+  Quantity_Color aColor;
   Standard_Boolean hasColor = Standard_False;
   if (aColorString.Search ("color=") != -1)
   {
     hasColor = Standard_True;
     aColorString.Remove (1, 6);
-    aColorName = aColorString.ToCString();
+    if (!Quantity_Color::ColorFromName (aColorString.ToCString(), aColor))
+    {
+      Message::SendFail() << "Syntax error at " << aColorString;
+      return 1;
+    }
   }
 
   const Standard_Integer aNbShapes = hasColor ? (argc - 1) : argc;
@@ -4322,7 +4380,7 @@ static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
       anObject = aConnectedOrig;
 
       aContext->Load (anObject);
-      anObject->SetColor (ViewerTest::GetColorFromName (aColorName));
+      anObject->SetColor (aColor);
     }
 
     if (aMultiConObject.IsNull())
@@ -4685,7 +4743,7 @@ static Standard_Integer VChild (Draw_Interpretor& ,
     {
       bool aVal = true;
       if (anArgIter + 1 < theNbArgs
-        && ViewerTest::ParseOnOff(theArgVec[anArgIter + 1], aVal))
+        && Draw::ParseOnOff(theArgVec[anArgIter + 1], aVal))
       {
         ++anArgIter;
       }
@@ -4830,7 +4888,7 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
     }
   }
   if (anObjNames.Size() < 2
-  || !ViewerTest::ParseOnOff (anObjNames.Last().ToCString(), toTurnOn))
+  || !Draw::ParseOnOff (anObjNames.Last().ToCString(), toTurnOn))
   {
     Message::SendFail ("Syntax error: wrong number of arguments");
     return 1;
@@ -4993,6 +5051,334 @@ static Standard_Integer VTriangle (Draw_Interpretor& /*di*/,
   return 0;
 }
 
+//===========================================================================
+//function : VTorus
+//purpose  : creates and displays a torus or torus segment
+//===========================================================================
+static Standard_Integer VTorus (Draw_Interpretor& /*di*/,
+                                Standard_Integer theNbArgs,
+                                const char** theArgVec)
+{
+  if (ViewerTest::GetAISContext().IsNull())
+  {
+    Message::SendFail ("Error: no active viewer");
+    return 1;
+  }
+
+  TCollection_AsciiString aName;
+  Standard_Integer aNbSlices = 100, aNbStacks = 100;
+  Standard_Real aMajorRad = -1.0, aMinorRad = -1.0;
+  Standard_Real aPipeAngle = 360.0, aSegAngle1 = 0.0, aSegAngle2 = 360.0;
+  Standard_Real anAngles[3] = { -1.0, -1.0, -1.0 };
+  ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), ViewerTest::CurrentView());
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArg (theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if (anUpdateTool.parseRedrawMode (anArg))
+    {
+      continue;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-nbslices"
+           || anArg == "-slices")
+          && Draw::ParseInteger (theArgVec[anArgIter + 1], aNbSlices))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-nbstacks"
+           || anArg == "-stacks")
+          && Draw::ParseInteger (theArgVec[anArgIter + 1], aNbStacks))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-radius"
+           || anArg == "-majorradius")
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aMajorRad))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-piperadius"
+           || anArg == "-minoradius")
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aMinorRad))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-pipeangle"
+           || anArg == "-angle")
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aPipeAngle))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-segmentanglefrom"
+           || anArg == "-seganglefrom"
+           || anArg == "-segmentangle1"
+           || anArg == "-segangle1")
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aSegAngle1))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-segmentangleto"
+           || anArg == "-segangleto"
+           || anArg == "-segmentangle2"
+           || anArg == "-segangle2")
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aSegAngle2))
+    {
+      ++anArgIter;
+    }
+    else if (aName.IsEmpty())
+    {
+      aName = theArgVec[anArgIter];
+    }
+    else if (aMajorRad < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], aMajorRad))
+    {
+      //
+    }
+    else if (aMinorRad < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], aMinorRad))
+    {
+      //
+    }
+    else if (anAngles[0] < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], anAngles[0]))
+    {
+      //
+    }
+    else if (anAngles[1] < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], anAngles[1]))
+    {
+      //
+    }
+    else if (anAngles[2] < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], anAngles[2]))
+    {
+      //
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+
+  if (anAngles[2] > 0.0)
+  {
+    aSegAngle1 = anAngles[0];
+    aSegAngle2 = anAngles[1];
+    aPipeAngle = anAngles[2];
+  }
+  else if (anAngles[1] > 0.0)
+  {
+    aSegAngle1 = anAngles[0];
+    aSegAngle2 = anAngles[1];
+  }
+  else if (anAngles[0] > 0.0)
+  {
+    aPipeAngle = anAngles[0];
+  }
+
+  aSegAngle1 = aSegAngle1 * (M_PI / 180.0);
+  aSegAngle2 = aSegAngle2 * (M_PI / 180.0);
+  aPipeAngle = aPipeAngle * (M_PI / 180.0);
+
+  if (aMajorRad <= 0 || aMinorRad <= 0 || aNbSlices <= 0 || aNbStacks <= 0
+   || Abs(aSegAngle2 - aSegAngle1) <= Precision::Angular()
+   || Abs(aPipeAngle) <= Precision::Angular())
+  {
+    Message::SendFail ("Syntax error: wrong parameters");
+    return 1;
+  }
+
+  Handle(Graphic3d_ArrayOfTriangles) aTriangles = Prs3d_ToolTorus::Create (aMajorRad, aMinorRad, aSegAngle1, aSegAngle2, aPipeAngle, aNbSlices, aNbStacks, gp_Trsf());
+  Handle(AIS_InteractiveObject) anIO = new MyPArrayObject (aTriangles);
+  ViewerTest::Display (aName, anIO, false);
+  return 0;
+}
+
+//===========================================================================
+//function : VCylinder
+//purpose  : creates and displays a cylinder
+//===========================================================================
+static Standard_Integer VCylinder (Draw_Interpretor& /*di*/,
+                                   Standard_Integer theNbArgs,
+                                   const char** theArgVec)
+{
+  if (ViewerTest::GetAISContext().IsNull())
+  {
+    Message::SendFail ("Error: no active viewer");
+    return 1;
+  }
+
+  TCollection_AsciiString aName;
+  Standard_Integer aNbSlices = 100, aNbStacks = 1;
+  Standard_Real aBotRad = -1.0, aTopRad = -1.0, aHeight = -1.0;
+  ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), ViewerTest::CurrentView());
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArg (theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if (anUpdateTool.parseRedrawMode (anArg))
+    {
+      continue;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-nbslices"
+           || anArg == "-slices")
+          && Draw::ParseInteger (theArgVec[anArgIter + 1], aNbSlices))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-nbstacks"
+           || anArg == "-stacks")
+          && Draw::ParseInteger (theArgVec[anArgIter + 1], aNbStacks))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && anArg == "-radius"
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aBotRad))
+    {
+      aTopRad = aBotRad;
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && anArg == "-bottomradius"
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aBotRad))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && anArg == "-topradius"
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aTopRad))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && anArg == "-height"
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aHeight))
+    {
+      ++anArgIter;
+    }
+    else if (aName.IsEmpty())
+    {
+      aName = theArgVec[anArgIter];
+    }
+    else if (aBotRad < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], aBotRad))
+    {
+      //
+    }
+    else if (aTopRad < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], aTopRad))
+    {
+      //
+    }
+    else if (aHeight < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], aHeight))
+    {
+      //
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+
+  if (aBotRad < 0 || aTopRad < 0 || aHeight <= 0 || aNbSlices < 3)
+  {
+    Message::SendFail ("Syntax error: wrong parameters");
+    return 1;
+  }
+
+  Handle(Graphic3d_ArrayOfTriangles) aTriangles = Prs3d_ToolCylinder::Create (aBotRad, aTopRad, aHeight, aNbSlices, aNbStacks, gp_Trsf());
+  Handle(AIS_InteractiveObject) anIO = new MyPArrayObject (aTriangles);
+  ViewerTest::Display (aName, anIO, false);
+  return 0;
+}
+
+//===========================================================================
+//function : VSphere
+//purpose  : creates and displays a sphere
+//===========================================================================
+static Standard_Integer VSphere (Draw_Interpretor& /*di*/,
+                                 Standard_Integer theNbArgs,
+                                 const char** theArgVec)
+{
+  if (ViewerTest::GetAISContext().IsNull())
+  {
+    Message::SendFail ("Error: no active viewer");
+    return 1;
+  }
+
+  TCollection_AsciiString aName;
+  Standard_Integer aNbSlices = 100, aNbStacks = 100;
+  Standard_Real aRad = -1.0;
+  ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), ViewerTest::CurrentView());
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+  {
+    TCollection_AsciiString anArg (theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if (anUpdateTool.parseRedrawMode (anArg))
+    {
+      continue;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-nbslices"
+           || anArg == "-slices")
+          && Draw::ParseInteger (theArgVec[anArgIter + 1], aNbSlices))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && (anArg == "-nbstacks"
+           || anArg == "-stacks")
+          && Draw::ParseInteger (theArgVec[anArgIter + 1], aNbStacks))
+    {
+      ++anArgIter;
+    }
+    else if (anArgIter + 1 < theNbArgs
+          && anArg == "-radius"
+          && Draw::ParseReal (theArgVec[anArgIter + 1], aRad))
+    {
+      ++anArgIter;
+    }
+    else if (aName.IsEmpty())
+    {
+      aName = theArgVec[anArgIter];
+    }
+    else if (aRad < 0.0
+          && Draw::ParseReal (theArgVec[anArgIter], aRad))
+    {
+      //
+    }
+    else
+    {
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+      return 1;
+    }
+  }
+
+  if (aRad <= 0 || aNbSlices <= 0 || aNbStacks <= 0)
+  {
+    Message::SendFail ("Syntax error: wrong parameters");
+    return 1;
+  }
+
+  Handle(Graphic3d_ArrayOfTriangles) aTriangles = Prs3d_ToolSphere::Create (aRad, aNbSlices, aNbStacks, gp_Trsf());
+  Handle(AIS_InteractiveObject) anIO = new MyPArrayObject (aTriangles);
+  ViewerTest::Display (aName, anIO, false);
+  return 0;
+}
+
 //=======================================================================
 //function : VObjZLayer
 //purpose  : Set or get z layer id for presentable object
@@ -5187,9 +5573,9 @@ void ViewerTest_MarkersArrayObject::Compute (const Handle(PrsMgr_PresentationMan
   aPresentation->Clear();
   if (!myMarkerAspect.IsNull())
   {
-    Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect);
+    aPresentation->CurrentGroup()->SetGroupPrimitivesAspect (myMarkerAspect);
   }
-  Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (anArray);
+  aPresentation->CurrentGroup()->AddPrimitiveArray (anArray);
 }
 
 void ViewerTest_MarkersArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
@@ -5471,7 +5857,7 @@ static int TextToBRep (Draw_Interpretor& /*theDI*/,
         return 1;
       }
 
-      ViewerTest::ParseOnOff (theArgVec[anArgIt], anIsCompositeCurve);
+      Draw::ParseOnOff (theArgVec[anArgIt], anIsCompositeCurve);
     }
     else if (aParam == "-plane")
     {
@@ -5705,12 +6091,58 @@ static int VFont (Draw_Interpretor& theDI,
       aMgr->RegisterFont (aFont, Standard_True);
       theDI << aFont->ToString();
     }
+    else if (anArgCase == "-aliases")
+    {
+      TCollection_AsciiString anAliasName;
+      TColStd_SequenceOfHAsciiString aNames;
+      if (anArgIter + 1 < theArgNb
+      && *theArgVec[anArgIter + 1] != '-')
+      {
+        anAliasName = theArgVec[++anArgIter];
+      }
+      if (!anAliasName.IsEmpty())
+      {
+        aMgr->GetFontAliases (aNames, anAliasName);
+      }
+      else
+      {
+        aMgr->GetAllAliases (aNames);
+      }
+      for (TColStd_SequenceOfHAsciiString::Iterator aNameIter (aNames); aNameIter.More(); aNameIter.Next())
+      {
+        theDI << "{" << aNameIter.Value()->String() << "} ";
+      }
+    }
+    else if (anArgIter + 2 < theArgNb
+          && anArgCase == "-addalias")
+    {
+      TCollection_AsciiString anAliasName(theArgVec[++anArgIter]);
+      TCollection_AsciiString aFontName  (theArgVec[++anArgIter]);
+      aMgr->AddFontAlias (anAliasName, aFontName);
+    }
+    else if (anArgIter + 2 < theArgNb
+          && anArgCase == "-removealias")
+    {
+      TCollection_AsciiString anAliasName(theArgVec[++anArgIter]);
+      TCollection_AsciiString aFontName  (theArgVec[++anArgIter]);
+      aMgr->RemoveFontAlias (anAliasName, aFontName);
+    }
+    else if (anArgIter + 1 < theArgNb
+          && anArgCase == "-clearalias")
+    {
+      TCollection_AsciiString anAliasName(theArgVec[++anArgIter]);
+      aMgr->RemoveFontAlias (anAliasName, "");
+    }
+    else if (anArgCase == "-clearaliases")
+    {
+      aMgr->RemoveFontAlias ("", "");
+    }
     else if (anArgCase == "-verbose"
           || anArgCase == "-trace")
     {
       bool toEnable = true;
       if (anArgIter + 1 < theArgNb
-       && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
       {
         ++anArgIter;
       }
@@ -5722,7 +6154,7 @@ static int VFont (Draw_Interpretor& theDI,
     {
       bool toEnable = true;
       if (anArgIter + 1 < theArgNb
-       && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+       && Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
       {
         ++anArgIter;
       }
@@ -6231,7 +6663,7 @@ protected:
       DBRep_DrawableShape::addSurfaceNormals (aNormalMap, myshape, NormalLength, NbAlongU, NbAlongV);
     }
 
-    Handle(Graphic3d_Group) aPrsGroup = Prs3d_Root::NewGroup (thePrs);
+    Handle(Graphic3d_Group) aPrsGroup = thePrs->NewGroup();
     aPrsGroup->SetGroupPrimitivesAspect (myDrawer->ArrowAspect()->Aspect());
 
     const Standard_Real aArrowAngle  = myDrawer->ArrowAspect()->Angle();
@@ -6308,7 +6740,7 @@ static int VNormals (Draw_Interpretor& theDI,
     TCollection_AsciiString aParam (theArgs[anArgIter]);
     aParam.LowerCase();
     if (anArgIter == 2
-     && ViewerTest::ParseOnOff (aParam.ToCString(), isOn))
+     && Draw::ParseOnOff (aParam.ToCString(), isOn))
     {
       continue;
     }
@@ -6333,7 +6765,7 @@ static int VNormals (Draw_Interpretor& theDI,
     {
       isOriented = Standard_True;
       if (anArgIter + 1 < theArgNum
-        && ViewerTest::ParseOnOff (theArgs[anArgIter + 1], isOriented))
+        && Draw::ParseOnOff (theArgs[anArgIter + 1], isOriented))
       {
         ++anArgIter;
       }
@@ -6545,6 +6977,7 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
                    "\n\t\t: [-angle angle=0]"
                    "\n\t\t: [-zoom {0|1}=0]"
                    "\n\t\t: [-height height=16]"
+                   "\n\t\t: [-wrapping width=40]"
                    "\n\t\t: [-aspect {regular|bold|italic|boldItalic}=regular]"
                    "\n\t\t: [-font font=Times]"
                    "\n\t\t: [-2d]"
@@ -6567,27 +7000,24 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
 
   theCommands.Add ("vlocation",
                 "vlocation name"
-      "\n\t\t:   [-reset]"
-      "\n\t\t:   [-copyFrom otherName]"
-      "\n\t\t:   [-translate X Y [Z]]"
-      "\n\t\t:   [-rotate x y z dx dy dz angle]"
-      "\n\t\t:   [-scale [X Y Z] scale]"
-      "\n\t\t:   [-mirror x y z dx dy dz]"
-      "\n\t\t:   [-setLocation X Y [Z]]"
-      "\n\t\t:   [-setRotation QX QY QZ QW]"
-      "\n\t\t:   [-setScale [X Y Z] scale]"
-      "\n\t\t:   [-inheritParentTrsf {on|off}]"
+      "\n\t\t:   [-reset] [-copyFrom otherName]"
+      "\n\t\t:   [-translate    X Y [Z]] [-rotate    x y z dx dy dz angle] [-scale    [X Y Z] scale]"
+      "\n\t\t:   [-pretranslate X Y [Z]] [-prerotate x y z dx dy dz angle] [-prescale [X Y Z] scale]"
+      "\n\t\t:   [-mirror x y z dx dy dz] [-premirror x y z dx dy dz]"
+      "\n\t\t:   [-setLocation X Y [Z]] [-setRotation QX QY QZ QW] [-setScale [X Y Z] scale]"
       "\n\t\t: Object local transformation management:"
-      "\n\t\t:   -reset       reset transformation to identity"
-      "\n\t\t:   -translate   translate object"
-      "\n\t\t:   -rotate      applies rotation to local transformation"
-      "\n\t\t:   -scale       applies scale    to local transformation"
-      "\n\t\t:   -mirror      applies mirror   to local transformation"
-      "\n\t\t:   -setLocation assign object location"
-      "\n\t\t:   -setRotation assign object rotation (quaternion)"
-      "\n\t\t:   -setScale    assign object scale factor"
-      "\n\t\t:   -inheritParentTrsf option to inherit parent"
-      "\n\t\t:                transformation or not (ON by default)",
+      "\n\t\t:   -reset        resets transformation to identity"
+      "\n\t\t:   -translate    applies translation vector"
+      "\n\t\t:   -rotate       applies rotation around axis"
+      "\n\t\t:   -scale        applies scale factor with optional anchor"
+      "\n\t\t:   -mirror       applies mirror transformation"
+      "\n\t\t:   -pretranslate pre-multiplies translation vector"
+      "\n\t\t:   -prerotate    pre-multiplies rotation around axis"
+      "\n\t\t:   -prescale     pre-multiplies scale  transformation"
+      "\n\t\t:   -premirror    pre-multiplies mirror transformation"
+      "\n\t\t:   -setLocation  overrides translation part"
+      "\n\t\t:   -setRotation  overrides rotation part with specified quaternion"
+      "\n\t\t:   -setScale     overrides scale factor",
         __FILE__, VSetLocation, group);
   theCommands.Add ("vsetlocation",
                    "alias for vlocation",
@@ -6692,6 +7122,36 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
     "\n\t\t: Creates and displays a segment from named points.", 
     __FILE__, VTriangle,group);
 
+  theCommands.Add ("vtorus",
+                   "vtorus name [R1 R2 [Angle1=0 Angle2=360] [Angle=360]]"
+                   "\n\t\t:             [-radius R1] [-pipeRadius R2]"
+                   "\n\t\t:             [-pipeAngle Angle=360] [-segmentAngle1 Angle1=0 -segmentAngle2 Angle2=360]"
+                   "\n\t\t:             [-nbSlices Number=100] [-nbStacks Number=100] [-noupdate]"
+                   "\n\t\t: Creates and displays a torus or torus segment."
+                   "\n\t\t: Parameters of the torus :"
+                   "\n\t\t: - R1     distance from the center of the pipe to the center of the torus"
+                   "\n\t\t: - R2     radius of the pipe"
+                   "\n\t\t: - Angle1 first angle to create a torus ring segment"
+                   "\n\t\t: - Angle2 second angle to create a torus ring segment"
+                   "\n\t\t: - Angle  angle to create a torus pipe segment",
+                   __FILE__, VTorus, group);
+
+  theCommands.Add ("vcylinder",
+                   "vcylinder name [R1 R2 Height] [-height H] [-radius R] [-bottomRadius R1 -topRadius R2]"
+                   "\n\t\t:                [-nbSlices Number=100] [-noupdate]"
+                   "\n\t\t: Creates and displays a cylinder."
+                   "\n\t\t: Parameters of the cylinder :"
+                   "\n\t\t: - R1     cylinder bottom radius"
+                   "\n\t\t: - R2     cylinder top radius"
+                   "\n\t\t: - Height cylinder height",
+                   __FILE__, VCylinder, group);
+
+  theCommands.Add ("vsphere",
+                   "vsphere name [-radius] R"
+                   "\n\t\t:              [-nbSlices Number=100] [-nbStacks Number=100] [-noupdate]"
+                   "\n\t\t: Creates and displays a sphere.",
+                   __FILE__, VSphere, group);
+
   theCommands.Add("vobjzlayer",
     "vobjzlayer : set/get object [layerid] - set or get z layer id for the interactive object",
     __FILE__, VObjZLayer, group);
@@ -6721,6 +7181,7 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
                    "\n\t\t:        [-findAll fontNameMask] [-findInfo fontName]"
                    "\n\t\t:        [-unicodeFallback {on|off}]"
                    "\n\t\t:        [-clear] [-init] [-list] [-names]"
+                   "\n\t\t:        [-aliases [aliasName]] [-addAlias Alias FontName] [-removeAlias Alias FontName] [-clearAlias Alias] [-clearAliases]"
                    "\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.",