0032079: Coding Rules - rename AIS_KindOfInteractive enumeration values with fully...
authorkgv <kgv@opencascade.com>
Fri, 22 Jan 2021 16:03:45 +0000 (19:03 +0300)
committerkgv <kgv@opencascade.com>
Sat, 30 Jan 2021 17:22:29 +0000 (20:22 +0300)
In addition, several ViewerTest command have been cleared out from duplicated checks.

24 files changed:
src/AIS/AIS_Axis.hxx
src/AIS/AIS_Circle.hxx
src/AIS/AIS_ConnectedInteractive.hxx
src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext.hxx
src/AIS/AIS_InteractiveObject.hxx
src/AIS/AIS_KindOfInteractive.hxx
src/AIS/AIS_Line.hxx
src/AIS/AIS_MultipleConnectedInteractive.cxx
src/AIS/AIS_MultipleConnectedInteractive.hxx
src/AIS/AIS_Plane.cxx
src/AIS/AIS_Plane.hxx
src/AIS/AIS_PlaneTrihedron.hxx
src/AIS/AIS_Point.hxx
src/AIS/AIS_Shape.hxx
src/AIS/AIS_Trihedron.hxx
src/PrsDim/PrsDim_Dimension.hxx
src/PrsDim/PrsDim_Relation.hxx
src/QABugs/QABugs_1.cxx
src/QABugs/QABugs_16.cxx
src/QABugs/QABugs_19.cxx
src/ViewerTest/ViewerTest.cxx
src/ViewerTest/ViewerTest_ObjectCommands.cxx
src/ViewerTest/ViewerTest_RelationCommands.cxx

index eb1273b..5cd764f 100644 (file)
@@ -86,7 +86,7 @@ public:
 
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; }
 
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
 
   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
   
index a17cb80..0d1772d 100644 (file)
@@ -42,7 +42,7 @@ public:
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 6; }
 
   //! Indicates that the type of Interactive Object is a datum.
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
 
   //! Returns the circle component defined in SetCircle.
   const Handle(Geom_Circle)& Circle() const { return myComponent; }
index cebfaac..5bb2578 100644 (file)
@@ -45,7 +45,7 @@ public:
   Standard_EXPORT AIS_ConnectedInteractive(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
   
   //! Returns KOI_Object
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Object; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Object; }
 
   //! Returns 0
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; }
index 441ad8a..0d6069b 100644 (file)
@@ -336,7 +336,7 @@ void AIS_InteractiveContext::ObjectsInside (AIS_ListOfInteractive&      theListO
                                             const AIS_KindOfInteractive theKind,
                                             const Standard_Integer      theSign) const
 {
-  if (theKind == AIS_KOI_None
+  if (theKind == AIS_KindOfInteractive_None
    && theSign == -1)
   {
     for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
@@ -1402,8 +1402,8 @@ void AIS_InteractiveContext::SetDeviationCoefficient (const Handle(AIS_Interacti
 
   // to be modified after the related methods of AIS_Shape are passed to InteractiveObject
   setContextToObject (theIObj);
-  if (theIObj->Type() != AIS_KOI_Object
-   && theIObj->Type() != AIS_KOI_Shape)
+  if (theIObj->Type() != AIS_KindOfInteractive_Object
+   && theIObj->Type() != AIS_KindOfInteractive_Shape)
   {
     return;
   }
@@ -1436,7 +1436,7 @@ void AIS_InteractiveContext::SetDeviationAngle (const Handle(AIS_InteractiveObje
 
   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
   setContextToObject (theIObj);
-  if (theIObj->Type() != AIS_KOI_Shape)
+  if (theIObj->Type() != AIS_KindOfInteractive_Shape)
   {
     return;
   }
@@ -1469,7 +1469,7 @@ void AIS_InteractiveContext::SetAngleAndDeviation (const Handle(AIS_InteractiveO
 
   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
   setContextToObject (theIObj);
-  if (theIObj->Type() != AIS_KOI_Shape)
+  if (theIObj->Type() != AIS_KindOfInteractive_Shape)
   {
     return;
   }
@@ -2224,8 +2224,8 @@ void AIS_InteractiveContext::SetTrihedronSize (const Standard_Real    theVal,
                                                const Standard_Boolean /*updateviewer*/)
 {
   myDefaultDrawer->DatumAspect()->SetAxisLength (theVal, theVal, theVal);
-  Redisplay (AIS_KOI_Datum, 3, Standard_False);
-  Redisplay (AIS_KOI_Datum, 4, Standard_True);
+  Redisplay (AIS_KindOfInteractive_Datum, 3, Standard_False);
+  Redisplay (AIS_KindOfInteractive_Datum, 4, Standard_True);
 }
 
 //=======================================================================
@@ -2237,7 +2237,7 @@ void AIS_InteractiveContext::SetPlaneSize(const Standard_Real    theValX,
                                           const Standard_Boolean theToUpdateViewer)
 {
   myDefaultDrawer->PlaneAspect()->SetPlaneLength (theValX, theValY);
-  Redisplay (AIS_KOI_Datum, 7, theToUpdateViewer);
+  Redisplay (AIS_KindOfInteractive_Datum, 7, theToUpdateViewer);
 }
 
 //=======================================================================
index 875e34f..90375a5 100644 (file)
@@ -869,8 +869,10 @@ public: //! @name common properties
   
   //! fills <aListOfIO> with objects of a particular Type and Signature with no consideration of display status.
   //! by Default, <WhichSignature> = -1 means control only on <WhichKind>.
-  //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1, all the objects are put into the list.
-  Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
+  //! if <WhichKind> = AIS_KindOfInteractive_None and <WhichSignature> = -1, all the objects are put into the list.
+  Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO,
+                                      const AIS_KindOfInteractive WhichKind = AIS_KindOfInteractive_None,
+                                      const Standard_Integer WhichSignature = -1) const;
 
   //! Rebuilds 1st level of BVH selection forcibly
   Standard_EXPORT void RebuildSelectionStructs();
index 8b4f922..60ba4ca 100644 (file)
@@ -47,8 +47,8 @@ class AIS_InteractiveObject : public SelectMgr_SelectableObject
   DEFINE_STANDARD_RTTIEXT(AIS_InteractiveObject, SelectMgr_SelectableObject)
 public:
 
-  //! Returns the kind of Interactive Object; AIS_KOI_None by default.
-  virtual AIS_KindOfInteractive Type() const { return AIS_KOI_None; }
+  //! Returns the kind of Interactive Object; AIS_KindOfInteractive_None by default.
+  virtual AIS_KindOfInteractive Type() const { return AIS_KindOfInteractive_None; }
 
   //! Specifies additional characteristics of Interactive Object of Type(); -1 by default.
   //! Among the datums, this signature is attributed to the shape.
index 4754e79..7151a05 100644 (file)
 #define _AIS_KindOfInteractive_HeaderFile
 
 //! Declares the type of Interactive Object.
-//! This is one of the following:
-//! -   the Datum
-//! -   the Object
-//! -   the Relation
-//! -   the Dimension
-//! -   the None type.
-//! The Datum is the construction element. These include
-//! points, lines, axes and planes. The object brings
-//! together topological shapes. The Relation includes
-//! dimensions and constraints. The Dimension includes
-//! length, radius, diameter and angle dimensions.
-//! When the object is of an unknown type, the None
-//! type is declared.
+//! This type can be used for fast pre-filtering of objects of specific group.
 enum AIS_KindOfInteractive
 {
-AIS_KOI_None,
-AIS_KOI_Datum,
-AIS_KOI_Shape,
-AIS_KOI_Object,
-AIS_KOI_Relation,
-AIS_KOI_Dimension
+  AIS_KindOfInteractive_None,        //!< object of unknown type
+  AIS_KindOfInteractive_Datum,       //!< presentation of construction element (datum)
+                                     //!  such as points, lines, axes and planes
+  AIS_KindOfInteractive_Shape,       //!< presentation of topological shape
+  AIS_KindOfInteractive_Object,      //!< presentation of group of topological shapes
+  AIS_KindOfInteractive_Relation,    //!< presentation of relation  (dimensions and constraints)
+  AIS_KindOfInteractive_Dimension,   //!< presentation of dimension (length, radius, diameter and angle)
+
+  // old aliases
+  AIS_KOI_None = AIS_KindOfInteractive_None,
+  AIS_KOI_Datum = AIS_KindOfInteractive_Datum,
+  AIS_KOI_Shape = AIS_KindOfInteractive_Shape,
+  AIS_KOI_Object = AIS_KindOfInteractive_Object,
+  AIS_KOI_Relation = AIS_KindOfInteractive_Relation,
+  AIS_KOI_Dimension = AIS_KindOfInteractive_Dimension
 };
 
 #endif // _AIS_KindOfInteractive_HeaderFile
index 2345a8b..4f2e8e9 100644 (file)
@@ -41,7 +41,7 @@ public:
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; }
 
   //! Returns the type Datum.
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
 
   //! Constructs an infinite line.
   const Handle(Geom_Line)& Line() const { return myComponent; }
index d201fbd..ad04fe8 100644 (file)
@@ -37,24 +37,6 @@ AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive()
   myHasOwnPresentations = Standard_False;
 }
 
-//=======================================================================
-//function : Type
-//purpose  : 
-//=======================================================================
-AIS_KindOfInteractive AIS_MultipleConnectedInteractive::Type() const
-{
-  return AIS_KOI_Object;
-}
-
-//=======================================================================
-//function : Signature
-//purpose  : 
-//=======================================================================
-Standard_Integer AIS_MultipleConnectedInteractive::Signature() const
-{
-  return 1;
-}
-
 //=======================================================================
 //function : connect
 //purpose  :
index 26a1512..a988233 100644 (file)
@@ -44,9 +44,9 @@ public:
     return connect (theAnotherObj, theLocation, theTrsfPers);
   }
 
-  Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Object; }
+
+  virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; }
   
   //! Returns true if the object is connected to others.
   Standard_EXPORT Standard_Boolean HasConnection() const;
index 169a59f..3f8f064 100644 (file)
@@ -143,24 +143,6 @@ void AIS_Plane::SetComponent(const Handle(Geom_Plane)& aComponent)
   myAutomaticPosition = Standard_True;
 }
 
-//=======================================================================
-//function : Type
-//purpose  : 
-//=======================================================================
-
-AIS_KindOfInteractive AIS_Plane::Type() const 
-{return AIS_KOI_Datum;}
-
-
-//=======================================================================
-//function : Signature
-//purpose  : 
-//=======================================================================
-
-Standard_Integer AIS_Plane::Signature() const 
-{return 7;}
-
-
 //=======================================================================
 //function : Axis2Placement
 //purpose  : 
index 021472a..29f8d15 100644 (file)
@@ -66,9 +66,9 @@ public:
 
   Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
 
-  Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
+  virtual Standard_Integer Signature() const Standard_OVERRIDE { return 7; }
+
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
   
   //! Returns the component specified in SetComponent.
   const Handle(Geom_Plane)& Component() { return myComponent; }
index be79176..73f9af6 100644 (file)
@@ -77,7 +77,7 @@ public:
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 4; }
 
   //! Returns datum as the type of Interactive Object.
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
 
   //! Allows you to provide settings for the color aColor.
   Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
index af5bd90..ed920b7 100644 (file)
@@ -38,7 +38,7 @@ public:
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; }
 
   //! Indicates that a point is a datum.
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
 
   //! Returns the component specified in SetComponent.
   Standard_EXPORT Handle(Geom_Point) Component();
index ce3ca48..6be0e15 100644 (file)
@@ -69,7 +69,7 @@ public:
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; }
 
   //! Returns Object as the type of Interactive Object.
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Shape; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Shape; }
 
   //! Returns true if the Interactive Object accepts shape decomposition.
   virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE { return Standard_True; }
index 0ad7f70..336bbca 100644 (file)
@@ -177,7 +177,7 @@ public:
   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; }
 
   //! Indicates that the type of Interactive Object is datum.
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
 
   //! Removes the settings for color.
   Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
index 769d015..85f4eb8 100644 (file)
@@ -316,7 +316,7 @@ public:
   PrsDim_KindOfDimension KindOfDimension() const { return myKindOfDimension; }
 
   //! @return the kind of interactive.
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Dimension; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Dimension; }
 
   //! Returns true if the class of objects accepts the display mode theMode.
   //! The interactive context can have a default mode of representation for
index 2d99c13..97faba8 100644 (file)
@@ -58,7 +58,7 @@ public:
   //! lines representing the relation between the two shapes.
   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
 
-  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Relation; }
+  virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Relation; }
 
   //! Indicates that the type of dimension is unknown.
   virtual PrsDim_KindOfDimension KindOfDimension() const { return PrsDim_KOD_NONE; }
index 244aeb4..000446c 100644 (file)
@@ -209,7 +209,9 @@ static Standard_Integer OCC10bug (Draw_Interpretor& di, Standard_Integer argc, c
       
     // On verifie que l'AIS InteraciveObject est bien 
     // un AIS_PlaneTrihedron
-    if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) {
+    if (aShape->Type() == AIS_KindOfInteractive_Datum
+     && aShape->Signature() == 4)
+    {
       // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron
       theAISPlaneTri = Handle(AIS_PlaneTrihedron)::DownCast (aShape);
 
index 751bccf..7298c8d 100644 (file)
@@ -287,7 +287,9 @@ static Standard_Integer OCC218bug (Draw_Interpretor& di, Standard_Integer argc,
       
     // On verifie que l'AIS InteraciveObject est bien 
     // un AIS_PlaneTrihedron
-    if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) {
+    if (aShape->Type() == AIS_KindOfInteractive_Datum
+     && aShape->Signature() == 4)
+    {
       // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron
       theAISPlaneTri = Handle(AIS_PlaneTrihedron)::DownCast (aShape);
 
index fd95220..6bb7864 100644 (file)
@@ -2506,7 +2506,7 @@ static Standard_Integer OCC25340 (Draw_Interpretor& /*theDI*/,
     std::cerr << "Error: No opened viewer!\n";
     return 1;
   }
-  Handle(AIS_TypeFilter) aFilter = new AIS_TypeFilter (AIS_KOI_Shape);
+  Handle(AIS_TypeFilter) aFilter = new AIS_TypeFilter (AIS_KindOfInteractive_Shape);
   aCtx->AddFilter (aFilter);
   return 0;
 }
index 1a6fa8e..960a5e9 100644 (file)
@@ -475,42 +475,49 @@ static const char** GetTypeNames()
 //function : GetTypeAndSignfromString
 //purpose  :
 //=======================================================================
-void GetTypeAndSignfromString (const char* name,AIS_KindOfInteractive& TheType,Standard_Integer& TheSign)
+static void GetTypeAndSignfromString (const char* theName,
+                                      AIS_KindOfInteractive& theType,
+                                      Standard_Integer& theSign)
 {
-  const char ** thefullnames = GetTypeNames();
-  Standard_Integer index(-1);
-
-  for(Standard_Integer i=0;i<=13 && index==-1;i++)
-    if(!strcasecmp(name,thefullnames[i]))
-      index = i;
+  const char** aFullNames = GetTypeNames();
+  Standard_Integer anIndex = -1;
+  for (Standard_Integer i = 0; i <= 13 && anIndex == -1; ++i)
+  {
+    if (strcasecmp (theName, aFullNames[i]) == 0)
+    {
+      anIndex = i;
+    }
+  }
 
-  if(index ==-1){
-    TheType = AIS_KOI_None;
-    TheSign = -1;
+  if (anIndex ==-1)
+  {
+    theType = AIS_KindOfInteractive_None;
+    theSign = -1;
     return;
   }
 
-  if(index<=6){
-    TheType = AIS_KOI_Datum;
-    TheSign = index+1;
+  if (anIndex <= 6)
+  {
+    theType = AIS_KindOfInteractive_Datum;
+    theSign = anIndex+1;
   }
-  else if (index <=9){
-    TheType = AIS_KOI_Shape;
-    TheSign = index-7;
+  else if (anIndex <= 9)
+  {
+    theType = AIS_KindOfInteractive_Shape;
+    theSign = anIndex - 7;
   }
-  else if(index<=11){
-    TheType = AIS_KOI_Object;
-    TheSign = index-10;
+  else if (anIndex <= 11)
+  {
+    theType = AIS_KindOfInteractive_Object;
+    theSign = anIndex - 10;
   }
-  else{
-    TheType = AIS_KOI_Relation;
-    TheSign = index-12;
+  else
+  {
+    theType = AIS_KindOfInteractive_Relation;
+    theSign = anIndex - 12;
   }
-
 }
 
-
-
 #include <string.h>
 #include <Draw_Interpretor.hxx>
 #include <Draw.hxx>
@@ -5156,7 +5163,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       aSelMode = aShape->GlobalSelectionMode();
     }
 
-    if (aShape->Type() == AIS_KOI_Datum)
+    if (aShape->Type() == AIS_KindOfInteractive_Datum)
     {
       aCtx->Display (aShape, Standard_False);
     }
@@ -5329,7 +5336,7 @@ static void objInfo (const NCollection_Map<Handle(AIS_InteractiveObject)>& theDe
         << (TheAISContext()->IsSelected  (theObj) ? " Selected" : "         ")
         << (theDetected.Contains (theObj)         ? " Detected" : "         ")
         << " Type: ";
-  if (theObj->Type() == AIS_KOI_Datum)
+  if (theObj->Type() == AIS_KindOfInteractive_Datum)
   {
     // AIS_Datum
     if      (theObj->Signature() == 3) { theDI << " AIS_Trihedron"; }
@@ -5341,12 +5348,12 @@ static void objInfo (const NCollection_Map<Handle(AIS_InteractiveObject)>& theDe
     else if (theObj->Signature() == 4) { theDI << " AIS_PlaneTrihedron"; }
   }
   // AIS_Shape
-  else if (theObj->Type()      == AIS_KOI_Shape
+  else if (theObj->Type()      == AIS_KindOfInteractive_Shape
         && theObj->Signature() == 0)
   {
     theDI << " AIS_Shape";
   }
-  else if (theObj->Type() == AIS_KOI_Relation)
+  else if (theObj->Type() == AIS_KindOfInteractive_Relation)
   {
     // PrsDim_Dimention and AIS_Relation
     Handle(PrsDim_Relation) aRelation = Handle(PrsDim_Relation)::DownCast (theObj);
@@ -5663,7 +5670,7 @@ Standard_Boolean ViewerTest::PickShapes (const TopAbs_ShapeEnum theShapeType,
   aCtx->DisplayedObjects (aDispObjects);
   if (theShapeType == TopAbs_SHAPE)
   {
-    aCtx->AddFilter (new AIS_TypeFilter (AIS_KOI_Shape));
+    aCtx->AddFilter (new AIS_TypeFilter (AIS_KindOfInteractive_Shape));
   }
   else
   {
@@ -5879,7 +5886,7 @@ static int VSelFilter(Draw_Interpretor& , Standard_Integer theArgc,
       Handle(SelectMgr_Filter) aFilter;
       if (aShapeType == TopAbs_SHAPE)
       {
-        aFilter = new AIS_TypeFilter (AIS_KOI_Shape);
+        aFilter = new AIS_TypeFilter (AIS_KindOfInteractive_Shape);
       }
       else
       {
@@ -5901,7 +5908,7 @@ static int VSelFilter(Draw_Interpretor& , Standard_Integer theArgc,
       Handle(SelectMgr_Filter) aFilter;
       if (aShapeType == TopAbs_SHAPE)
       {
-        aFilter = new AIS_TypeFilter (AIS_KOI_Shape);
+        aFilter = new AIS_TypeFilter (AIS_KindOfInteractive_Shape);
       }
       else
       {
@@ -6087,9 +6094,10 @@ static int VEraseType( Draw_Interpretor& , Standard_Integer argc, const char** a
   // en attendant l'amelioration ais pour les dimensions...
   //
   Standard_Integer dimension_status(-1);
-  if(TheType==AIS_KOI_Relation){
-    dimension_status = TheSign ==1 ? 1 : 0;
-    TheSign=-1;
+  if (TheType==AIS_KindOfInteractive_Relation)
+  {
+    dimension_status = TheSign == 1 ? 1 : 0;
+    TheSign = -1;
   }
 
   TheAISContext()->DisplayedObjects(TheType,TheSign,LIO);
@@ -6120,9 +6128,10 @@ static int VDisplayType(Draw_Interpretor& , Standard_Integer argc, const char**
   // en attendant l'amelioration ais pour les dimensions...
   //
   Standard_Integer dimension_status(-1);
-  if(TheType==AIS_KOI_Relation){
-    dimension_status = TheSign ==1 ? 1 : 0;
-    TheSign=-1;
+  if (TheType==AIS_KindOfInteractive_Relation)
+  {
+    dimension_status = TheSign == 1 ? 1 : 0;
+    TheSign = -1;
   }
 
   AIS_ListOfInteractive LIO;
index 58c21eb..5a981c7 100644 (file)
@@ -742,9 +742,7 @@ static int VTrihedron (Draw_Interpretor& ,
 //           if no value, the value is set at 100 by default
 //Draw arg : vsize [name] [size]
 //==============================================================================
-
 static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-
 {
   if (TheAISContext().IsNull())
   {
@@ -752,142 +750,90 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv
     return 1;
   }
 
-  // Declaration de booleens
-  Standard_Boolean             ThereIsName;
-  Standard_Boolean             ThereIsCurrent;
-  Standard_Real                value;
-  Standard_Boolean             hascol;
-
-  Quantity_Color col = Quantity_NOC_BLACK;
-
-  // Verification des arguments
-  if ( argc>3 ) {di<<argv[0]<<" Syntaxe error\n"; return 1;}
-
-  // Verification du nombre d'arguments
-  if (argc==1)      {ThereIsName=Standard_False;value=100;}
-  else if (argc==2) {ThereIsName=Standard_False;value=Draw::Atof(argv[1]);}
-  else              {ThereIsName=Standard_True;value=Draw::Atof(argv[2]);}
-
-  // On set le booleen ThereIsCurrent
-  if (TheAISContext() -> NbSelected() > 0) {ThereIsCurrent=Standard_True;}
-  else {ThereIsCurrent=Standard_False;}
-
-
-
-  //===============================================================
-  // Il n'y a pas de nom  mais des objets selectionnes
-  //===============================================================
-  if (!ThereIsName && ThereIsCurrent)
+  TCollection_AsciiString aName;
+  Standard_Real aSize = 0.0;
+  switch (argc)
   {
+    case 1:
+    {
+      aSize = 100;
+      break;
+    }
+    case 2:
+    {
+      aSize = Draw::Atof (argv[1]);
+      break;
+    }
+    case 3:
+    {
+      aName = argv[1];
+      aSize = Draw::Atof (argv[2]);
+      break;
+    }
+    default:
+    {
+      di << "Syntax error";
+      return 1;
+    }
+  }
 
-    ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
-      it (GetMapOfAIS());
-
-    while ( it.More() ) {
-
-      Handle(AIS_InteractiveObject) aShape = it.Key1();
-
-      if (!aShape.IsNull() &&  TheAISContext()->IsSelected(aShape) )
+  NCollection_Sequence<Handle(AIS_Trihedron)> aTrihedrons;
+  if (!aName.IsEmpty())
+  {
+    Handle(AIS_InteractiveObject) aShape;
+    if (GetMapOfAIS().Find2 (aName, aShape))
+    {
+      if (Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape))
       {
-
-        // On verifie que l'AIS InteraciveObject selectionne est bien
-        // un AIS_Trihedron
-        if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==3) {
-
-          if (aShape->HasColor())
-          {
-            hascol = Standard_True;
-
-            // On recupere la couleur de aShape
-            aShape->Color (col);
-          }
-          else
-          {
-            hascol = Standard_False;
-          }
-
-          // On downcast aShape  de AIS_InteractiveObject a AIS_Trihedron
-          // pour lui appliquer la methode SetSize()
-          Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape);
-
-          // C'est bien un triedre,on chage sa valeur!
-          aTrihedron->SetSize(value);
-
-          // On donne la couleur au Trihedron
-          if(hascol)   aTrihedron->SetColor(col);
-          else         aTrihedron->UnsetColor();
-
-
-          // The trihedron hasn't be errased from the map
-          // so you just have to redisplay it
-          TheAISContext() ->Redisplay(aTrihedron,Standard_False);
-
-        }
-
+        aTrihedrons.Append (aTrihedron);
+      }
+      else
+      {
+        di << "Syntax error: " << aName << " is not a trihedron";
+        return 1;
       }
-
-      it.Next();
     }
-
-    TheAISContext() ->UpdateCurrentViewer();
   }
-
-  //===============================================================
-  // Il n'y a pas d'arguments et aucuns objets selectionne Rien A Faire!
-  //===============================================================
-
-
-
-  //===============================================================
-  // Il y a un nom de triedre passe en argument
-  //===============================================================
-  if (ThereIsName) {
-    TCollection_AsciiString name=argv[1];
-
-    // on verifie que ce nom correspond bien a une shape
-    Handle(AIS_InteractiveObject) aShape;
-    if (GetMapOfAIS().Find2(name, aShape))
+  else if (TheAISContext()->NbSelected() > 0)
+  {
+    for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS()); it.More(); it.Next())
     {
-      // On verifie que l'AIS InteraciveObject est bien
-      // un AIS_Trihedron
-      if (!aShape.IsNull() &&
-        aShape->Type()==AIS_KOI_Datum && aShape->Signature()==3)
+      const Handle(AIS_InteractiveObject)& aShape = it.Key1();
+      if (!aShape.IsNull()
+       && TheAISContext()->IsSelected (aShape))
       {
-        if (aShape->HasColor())
-        {
-          hascol=Standard_True;
-
-          // On recupere la couleur de aShape
-          aShape->Color (col);
-        }
-        else
+        if (Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape))
         {
-          hascol = Standard_False;
+          aTrihedrons.Append (aTrihedron);
         }
+      }
+    }
+  }
 
-        // On downcast aShape de AIS_InteractiveObject a AIS_Trihedron
-        // pour lui appliquer la methode SetSize()
-        Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape);
-
-        // C'est bien un triedre,on chage sa valeur
-        aTrihedron->SetSize(value);
-
-        // On donne la couleur au Trihedron
-        if(hascol)   aTrihedron->SetColor(col);
-        else         aTrihedron->UnsetColor();
+  for (NCollection_Sequence<Handle(AIS_Trihedron)>::Iterator anObjIter (aTrihedrons); anObjIter.More(); anObjIter.Next())
+  {
+    const Handle(AIS_Trihedron)& aTrihedron = anObjIter.Value();
+    Quantity_Color aColor = Quantity_NOC_BLACK;
+    const bool hasColor = aTrihedron->HasColor();
+    if (hasColor)
+    {
+      aTrihedron->Color (aColor);
+    }
 
-        // The trihedron hasn't be errased from the map
-        // so you just have to redisplay it
-        TheAISContext() ->Redisplay(aTrihedron,Standard_False);
+    aTrihedron->SetSize (aSize);
+    if (hasColor) { aTrihedron->SetColor (aColor); }
+    else          { aTrihedron->UnsetColor(); }
 
-        TheAISContext() ->UpdateCurrentViewer();
-      }
-    }
+    TheAISContext()->Redisplay (aTrihedron, Standard_False);
+  }
+  if (!aTrihedrons.IsEmpty())
+  {
+    TheAISContext()->UpdateCurrentViewer();
   }
+
   return 0;
 }
 
-
 //==============================================================================
 
 //==============================================================================
@@ -1283,111 +1229,112 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
     }
 
     // The first argument is an AIS_Point
-    if (!aShapeA.IsNull() &&
-        aShapeA->Type()==AIS_KOI_Datum &&
-        aShapeA->Signature()==1)
+    if (!aShapeA.IsNull()
+      && aShapeA->Type() == AIS_KindOfInteractive_Datum
+      && aShapeA->Signature() == 1)
     {
-        // The second argument must also be an AIS_Point
-        Handle(AIS_InteractiveObject) aShapeB;
-        if (argc<5 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
-        {
-          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)))
-        {
-          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)) 
-        {
-          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)))
-        {
-          Message::SendFail ("Syntax error: 3d object is expected to be an AIS_Point");
-          return 1;
-        }
+      // The second argument must also be an AIS_Point
+      Handle(AIS_InteractiveObject) aShapeB;
+      if (argc<5 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
+      {
+        Message::SendFail ("Syntax error: 2nd name is not displayed");
+        return 1;
+      }
 
-        // Treatment of objects A, B, C
-        // Downcast an AIS_IO to AIS_Point
-        Handle(AIS_Point) anAISPointA = Handle(AIS_Point)::DownCast( aShapeA);
-        Handle(AIS_Point) anAISPointB = Handle(AIS_Point)::DownCast( aShapeB);
-        Handle(AIS_Point) anAISPointC = Handle(AIS_Point)::DownCast( aShapeC);
+      // If B is not an AIS_Point
+      if (aShapeB.IsNull()
+      || !(aShapeB->Type() == AIS_KindOfInteractive_Datum
+        && aShapeB->Signature() == 1))
+      {
+        Message::SendFail ("Syntax error: 2nd object is expected to be an AIS_Point");
+        return 1;
+      }
 
-        Handle(Geom_CartesianPoint ) aCartPointA = 
-          Handle(Geom_CartesianPoint)::DownCast( anAISPointA->Component());
+      // The third object is an AIS_Point
+      Handle(AIS_InteractiveObject) aShapeC;
+      if (!GetMapOfAIS().Find2(argv[4], aShapeC))
+      {
+        Message::SendFail ("Syntax error: 3d name is not displayed");
+        return 1;
+      }
 
-        Handle(Geom_CartesianPoint ) aCartPointB = 
-          Handle(Geom_CartesianPoint)::DownCast( anAISPointB->Component());
+      // If C is not an AIS_Point
+      if (aShapeC.IsNull()
+      || !(aShapeC->Type() == AIS_KindOfInteractive_Datum
+        && aShapeC->Signature() == 1))
+      {
+        Message::SendFail ("Syntax error: 3d object is expected to be an AIS_Point");
+        return 1;
+      }
 
-        Handle(Geom_CartesianPoint ) aCartPointC = 
-          Handle(Geom_CartesianPoint)::DownCast( anAISPointC->Component());
+      // Treatment of objects A, B, C
+      // Downcast an AIS_IO to AIS_Point
+      Handle(AIS_Point) anAISPointA = Handle(AIS_Point)::DownCast (aShapeA);
+      Handle(AIS_Point) anAISPointB = Handle(AIS_Point)::DownCast (aShapeB);
+      Handle(AIS_Point) anAISPointC = Handle(AIS_Point)::DownCast (aShapeC);
 
-        // Verification that the three points are different
-        if(Abs(aCartPointB->X()-aCartPointA->X())<=Precision::Confusion() &&
-           Abs(aCartPointB->Y()-aCartPointA->Y())<=Precision::Confusion() &&
-           Abs(aCartPointB->Z()-aCartPointA->Z())<=Precision::Confusion())
-        {
-          // B=A
-          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
-          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())
+      Handle(Geom_CartesianPoint ) aCartPointA = Handle(Geom_CartesianPoint)::DownCast (anAISPointA->Component());
+      Handle(Geom_CartesianPoint ) aCartPointB = Handle(Geom_CartesianPoint)::DownCast (anAISPointB->Component());
+      Handle(Geom_CartesianPoint ) aCartPointC = Handle(Geom_CartesianPoint)::DownCast (anAISPointC->Component());
+
+      // Verification that the three points are different
+      if (Abs(aCartPointB->X()-aCartPointA->X()) <= Precision::Confusion()
+       && Abs(aCartPointB->Y()-aCartPointA->Y()) <= Precision::Confusion()
+       && Abs(aCartPointB->Z()-aCartPointA->Z()) <= Precision::Confusion())
+      {
+        // B=A
+        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
+        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
+        Message::SendFail ("Error: same points");
+        return 1;
+      }
+
+      gp_Pnt A = aCartPointA->Pnt();
+      gp_Pnt B = aCartPointB->Pnt();
+      gp_Pnt C = aCartPointC->Pnt();
+
+      // Construction of AIS_Plane
+      GC_MakePlane MkPlane (A,B,C);
+      Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
+      Handle(AIS_Plane)  anAISPlane = new AIS_Plane (aGeomPlane);
+      GetMapOfAIS().Bind (anAISPlane, aName);
+      if (argc == 6)
+      {
+        Standard_Integer aType = Draw::Atoi (argv[5]);
+        if (aType != 0 && aType != 1)
         {
-          // C=B
-          Message::SendFail ("Error: same points");
+          Message::SendFail("Syntax error: wrong type of sensitivity.\n"
+                            "Should be one of the following values:\n"
+                            "0 - Interior\n"
+                            "1 - Boundary");
           return 1;
         }
-
-        gp_Pnt A = aCartPointA->Pnt();
-        gp_Pnt B = aCartPointB->Pnt();
-        gp_Pnt C = aCartPointC->Pnt();
-
-        // Construction of AIS_Plane
-        GC_MakePlane MkPlane (A,B,C);
-        Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
-        Handle(AIS_Plane)  anAISPlane = new AIS_Plane(aGeomPlane );
-        GetMapOfAIS().Bind (anAISPlane,aName );
-        if (argc == 6)
+        else
         {
-          Standard_Integer aType = Draw::Atoi (argv[5]);
-          if (aType != 0 && aType != 1)
-          {
-            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
-          {
-            anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
-          }
+          anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
         }
-        TheAISContext()->Display (anAISPlane, Standard_True);
       }
-
-      // The first argument is an AIS_Axis
-      // Creation of a plane orthogonal to the axis through a point
-    else if (aShapeA->Type()==AIS_KOI_Datum && aShapeA->Signature()==2 ) {
+      TheAISContext()->Display (anAISPlane, Standard_True);
+    }
+    // The first argument is an AIS_Axis
+    // Creation of a plane orthogonal to the axis through a point
+    else if (aShapeA->Type() == AIS_KindOfInteractive_Datum
+          && aShapeA->Signature() == 2)
+    {
       // The second argument should be an AIS_Point
       Handle(AIS_InteractiveObject) aShapeB;
       if (argc!=4 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
@@ -1396,8 +1343,9 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
         return 1;
       }
       // If B is not an AIS_Point
-      if (aShapeB.IsNull() ||
-        (!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
+      if (aShapeB.IsNull()
+      || !(aShapeB->Type() == AIS_KindOfInteractive_Datum
+        && aShapeB->Signature() == 1))
       {
         Message::SendFail ("Syntax error: 2d object is expected to be an AIS_Point");
         return 1;
@@ -1407,14 +1355,13 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
       Handle(AIS_Axis) anAISAxisA = Handle(AIS_Axis)::DownCast(aShapeA);
       Handle(AIS_Point) anAISPointB = Handle(AIS_Point)::DownCast(aShapeB);
 
-      Handle(Geom_Line ) aGeomLineA = anAISAxisA ->Component();
-      Handle(Geom_Point) aGeomPointB = anAISPointB->Component()  ;
+      Handle(Geom_Line ) aGeomLineA = anAISAxisA->Component();
+      Handle(Geom_Point) aGeomPointB = anAISPointB->Component();
 
       gp_Ax1 anAxis = aGeomLineA->Position();
-      Handle(Geom_CartesianPoint) aCartPointB = 
-        Handle(Geom_CartesianPoint)::DownCast(aGeomPointB);
+      Handle(Geom_CartesianPoint) aCartPointB = Handle(Geom_CartesianPoint)::DownCast(aGeomPointB);
 
-      gp_Dir D =anAxis.Direction();
+      gp_Dir D = anAxis.Direction();
       gp_Pnt B = aCartPointB->Pnt();
 
       // Construction of AIS_Plane
@@ -1438,11 +1385,11 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
         }
       }
       TheAISContext()->Display (anAISPlane, Standard_True);
-
     }
-    // The first argumnet is an AIS_Plane
+    // The first argument is an AIS_Plane
     // Creation of a plane parallel to the plane passing through the point
-    else if (aShapeA->Type()==AIS_KOI_Datum && aShapeA->Signature()==7)
+    else if (aShapeA->Type() == AIS_KindOfInteractive_Datum
+          && aShapeA->Signature() == 7)
     {
       // The second argument should be an AIS_Point
       Handle(AIS_InteractiveObject) aShapeB;
@@ -1452,8 +1399,9 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
         return 1;
       }
       // B should be an AIS_Point
-      if (aShapeB.IsNull() ||
-         (!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
+      if (aShapeB.IsNull()
+       || !(aShapeB->Type()==AIS_KindOfInteractive_Datum
+         && aShapeB->Signature() == 1))
       {
         Message::SendFail ("Syntax error: 2d object is expected to be an AIS_Point");
         return 1;
@@ -1466,8 +1414,7 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
       Handle(Geom_Plane) aNewGeomPlane= anAISPlaneA->Component();
       Handle(Geom_Point) aGeomPointB = anAISPointB->Component();
 
-      Handle(Geom_CartesianPoint) aCartPointB = 
-        Handle(Geom_CartesianPoint)::DownCast(aGeomPointB);
+      Handle(Geom_CartesianPoint) aCartPointB = Handle(Geom_CartesianPoint)::DownCast(aGeomPointB);
       gp_Pnt B= aCartPointB->Pnt();
 
       // Construction of an AIS_Plane
@@ -1888,78 +1835,57 @@ static int VChangePlane (Draw_Interpretor& /*theDi*/, Standard_Integer theArgsNb
 
 static int VLineBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
-  // Verifications
-  if (argc!=4 && argc!=8 && argc!=2 )  {di<<"vline error: number of arguments not correct \n";return 1; }
-
-  // On recupere les parametres
-  Handle(AIS_InteractiveObject) theShapeA;
-  Handle(AIS_InteractiveObject) theShapeB;
-
-  // Parametres: AIS_Point AIS_Point
-  // ===============================
-  if (argc==4) {
-    GetMapOfAIS().Find2 (argv[2], theShapeA);
-    // On verifie que c'est bien une AIS_Point
-    if (!theShapeA.IsNull() &&
-      theShapeA->Type()==AIS_KOI_Datum && theShapeA->Signature()==1) {
-        // on recupere le deuxieme AIS_Point
-        GetMapOfAIS().Find2 (argv[3], theShapeB);
-        if (theShapeB.IsNull() ||
-          (!(theShapeB->Type()==AIS_KOI_Datum && theShapeB->Signature()==1)))
-        {
-          di <<"vline error: wrong type of 2de argument.\n";
-          return 1;
-        }
-      }
-    else {di <<"vline error: wrong type of 1st argument.\n";return 1; }
-    // Les deux parametres sont du bon type. On verifie que les points ne sont pas confondus
-    Handle(AIS_Point) theAISPointA= Handle(AIS_Point)::DownCast (theShapeA);
-    Handle(AIS_Point) theAISPointB= Handle(AIS_Point)::DownCast (theShapeB);
+  if (argc == 4)   // parameters: AIS_Point AIS_Point
+  {
+    Handle(AIS_InteractiveObject) aShapeA, aShapeB;
+    GetMapOfAIS().Find2 (argv[2], aShapeA);
+    GetMapOfAIS().Find2 (argv[3], aShapeB);
+    Handle(AIS_Point) anAISPointA = Handle(AIS_Point)::DownCast (aShapeA);
+    Handle(AIS_Point) anAISPointB = Handle(AIS_Point)::DownCast (aShapeB);
+    if (anAISPointA.IsNull()
+     || anAISPointB.IsNull())
+    {
+      di << "vline error: wrong type of arguments\n";
+      return 1;
+    }
 
-    Handle(Geom_Point ) myGeomPointBA=  theAISPointA->Component();
-    Handle(Geom_CartesianPoint ) myCartPointA= Handle(Geom_CartesianPoint)::DownCast (myGeomPointBA);
-    //    Handle(Geom_CartesianPoint ) myCartPointA= *(Handle(Geom_CartesianPoint)*)& (theAISPointA->Component() ) ;
+    Handle(Geom_Point) aGeomPointBA = anAISPointA->Component();
+    Handle(Geom_CartesianPoint) aCartPointA = Handle(Geom_CartesianPoint)::DownCast (aGeomPointBA);
 
-    Handle(Geom_Point ) myGeomPointB=  theAISPointB->Component();
-    Handle(Geom_CartesianPoint ) myCartPointB= Handle(Geom_CartesianPoint)::DownCast (myGeomPointB);
-    //    Handle(Geom_CartesianPoint ) myCartPointB= *(Handle(Geom_CartesianPoint)*)& (theAISPointB->Component() ) ;
+    Handle(Geom_Point) aGeomPointB = anAISPointB->Component();
+    Handle(Geom_CartesianPoint) aCartPointB = Handle(Geom_CartesianPoint)::DownCast (aGeomPointB);
 
-    if (myCartPointB->X()==myCartPointA->X() && myCartPointB->Y()==myCartPointA->Y() && myCartPointB->Z()==myCartPointA->Z() ) {
+    if (aCartPointB->X() == aCartPointA->X()
+     && aCartPointB->Y() == aCartPointA->Y()
+     && aCartPointB->Z() == aCartPointA->Z())
+    {
       // B=A
-      di<<"vline error: same points\n";return 1;
+      di << "vline error: same points\n";
+      return 1;
     }
-    // Les deux points sont OK...Construction de l'AIS_Line (en faite, le segment AB)
-    Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
-    GetMapOfAIS().Bind(theAISLine,argv[1] );
-    TheAISContext()->Display (theAISLine, Standard_True);
 
+    Handle(AIS_Line) anAISLine = new AIS_Line (aCartPointA, aCartPointB);
+    GetMapOfAIS().Bind (anAISLine, argv[1]);
+    TheAISContext()->Display (anAISLine, Standard_True);
   }
-
-  // Parametres 6 Reals
-  // ==================
-
-  else if (argc==8) {
-    // On verifie que les deux points ne sont pas confondus
-
-    Standard_Real coord[6];
-    for(Standard_Integer i=0;i<=2;i++){
-      coord[i]=Draw::Atof(argv[2+i]);
-      coord[i+3]=Draw::Atof(argv[5+i]);
+  else if (argc == 8) // parametres 6 reals
+  {
+    Standard_Real aCoord[6] = {};
+    for (Standard_Integer i = 0; i <= 2; ++i)
+    {
+      aCoord[i]     = Draw::Atof (argv[2 + i]);
+      aCoord[i + 3] = Draw::Atof (argv[5 + i]);
     }
 
-    Handle(Geom_CartesianPoint ) myCartPointA=new Geom_CartesianPoint (coord[0],coord[1],coord[2] );
-    Handle(Geom_CartesianPoint ) myCartPointB=new Geom_CartesianPoint (coord[3],coord[4],coord[5] );
+    Handle(Geom_CartesianPoint) aCartPointA = new Geom_CartesianPoint (aCoord[0], aCoord[1], aCoord[2]);
+    Handle(Geom_CartesianPoint) aCartPointB = new Geom_CartesianPoint (aCoord[3], aCoord[4], aCoord[5]);
 
-    Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
-    GetMapOfAIS().Bind(theAISLine,argv[1] );
-    TheAISContext()->Display (theAISLine, Standard_True);
+    Handle(AIS_Line) anAISLine = new AIS_Line (aCartPointA, aCartPointB);
+    GetMapOfAIS().Bind (anAISLine, argv[1]);
+    TheAISContext()->Display (anAISLine, Standard_True);
 
   }
-
-  // Pas de parametres: Selection dans le viewer.
-  // ============================================
-
-  else
+  else if (argc == 2) // selection in 3D viewer
   {
     TopTools_ListOfShape aShapes;
     ViewerTest::GetSelectedShapes (aShapes);
@@ -1971,9 +1897,8 @@ static int VLineBuilder(Draw_Interpretor& di, Standard_Integer argc, const char*
 
     const TopoDS_Shape& aShapeA = aShapes.First();
     const TopoDS_Shape& aShapeB = aShapes.Last();
-
-    if (!(aShapeA.ShapeType() == TopAbs_VERTEX
-       && aShapeB.ShapeType() == TopAbs_VERTEX))
+    if (aShapeA.ShapeType() != TopAbs_VERTEX
+     || aShapeB.ShapeType() != TopAbs_VERTEX)
     {
       Message::SendFail ("Error: you should select two different vertex.");
       return 1;
@@ -1983,12 +1908,17 @@ static int VLineBuilder(Draw_Interpretor& di, Standard_Integer argc, const char*
     gp_Pnt A = BRep_Tool::Pnt (TopoDS::Vertex (aShapeA));
     gp_Pnt B = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
 
-    Handle(Geom_CartesianPoint ) myCartPointA=new Geom_CartesianPoint(A);
-    Handle(Geom_CartesianPoint ) myCartPointB=new Geom_CartesianPoint(B);
+    Handle(Geom_CartesianPoint) aCartPointA = new Geom_CartesianPoint (A);
+    Handle(Geom_CartesianPoint) aCartPointB = new Geom_CartesianPoint (B);
 
-    Handle(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB );
-    GetMapOfAIS().Bind(theAISLine,argv[1] );
-    TheAISContext()->Display (theAISLine, Standard_True);
+    Handle(AIS_Line) anAISLine = new AIS_Line (aCartPointA, aCartPointB);
+    GetMapOfAIS().Bind (anAISLine, argv[1]);
+    TheAISContext()->Display (anAISLine, Standard_True);
+  }
+  else
+  {
+    di << "Syntax error: wrong number of arguments";
+    return 1;
   }
 
   return 0;
@@ -2137,164 +2067,137 @@ void DisplayCircle (Handle (Geom_Circle) theGeomCircle,
 
 static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const char** argv)
 {
-  // Verification of the arguments
-  if (argc>6 || argc<2) 
+  if (argc > 6 || argc < 2)
   { 
     Message::SendFail ("Syntax error: wrong number of arguments");
     return 1;
   }
 
-  // There are all arguments
   if (argc == 6) 
   {
-    // Get arguments
-    TCollection_AsciiString aName(argv[1]);
+    TCollection_AsciiString aName (argv[1]);
     Standard_Boolean isFilled = Draw::Atoi(argv[5]) != 0;
 
-    Handle(AIS_InteractiveObject) theShapeA, theShapeB;
-    GetMapOfAIS().Find2 (argv[2], theShapeA);
-    GetMapOfAIS().Find2 (argv[3], theShapeB);
+    Handle(AIS_InteractiveObject) aShapeA, aShapeB;
+    GetMapOfAIS().Find2 (argv[2], aShapeA);
+    GetMapOfAIS().Find2 (argv[3], aShapeB);
 
     // Arguments: AIS_Point AIS_Point AIS_Point
-    // ========================================
-    if (!theShapeA.IsNull() && !theShapeB.IsNull() &&
-      theShapeA->Type()==AIS_KOI_Datum && theShapeA->Signature()==1)
-    {
-      if (theShapeB->Type()!=AIS_KOI_Datum || theShapeB->Signature()!=1 ) 
+    if (!aShapeA.IsNull()
+     && !aShapeB.IsNull()
+     &&  aShapeA->Type() == AIS_KindOfInteractive_Datum
+     &&  aShapeA->Signature() == 1)
+    {
+      Handle(AIS_InteractiveObject) aShapeC;
+      GetMapOfAIS().Find2 (argv[4], aShapeC);
+      Handle(AIS_Point) anAISPointA = Handle(AIS_Point)::DownCast (aShapeA);
+      Handle(AIS_Point) anAISPointB = Handle(AIS_Point)::DownCast (aShapeB);
+      Handle(AIS_Point) anAISPointC = Handle(AIS_Point)::DownCast (aShapeC);
+      if (anAISPointA.IsNull()
+       || anAISPointB.IsNull()
+       || anAISPointC.IsNull())
+      {
+        Message::SendFail ("Error: arguments are expected to be points");
+        return 1;
+      }
+
+      // Verify that the three points are different
+      Handle(Geom_CartesianPoint) aCartPointA = Handle(Geom_CartesianPoint)::DownCast (anAISPointA->Component());
+      Handle(Geom_CartesianPoint) aCartPointB = Handle(Geom_CartesianPoint)::DownCast (anAISPointB->Component());
+      Handle(Geom_CartesianPoint) aCartPointC = Handle(Geom_CartesianPoint)::DownCast (anAISPointC->Component());
+      // Test A=B
+      if (Abs(aCartPointA->X() - aCartPointB->X()) <= Precision::Confusion()
+       && Abs(aCartPointA->Y() - aCartPointB->Y()) <= Precision::Confusion()
+       && Abs(aCartPointA->Z() - aCartPointB->Z()) <= Precision::Confusion())
       {
-        Message::SendFail ("Error: 2d argument is unexpected to be a point");
+        Message::SendFail ("Error: Same points");
         return 1;
       }
-      // The third object must be a point
-      Handle(AIS_InteractiveObject) theShapeC;
-      GetMapOfAIS().Find2 (argv[4], theShapeC);
-      if (theShapeC.IsNull() ||
-        theShapeC->Type()!=AIS_KOI_Datum || theShapeC->Signature()!=1 ) 
+      // Test A=C
+      if (Abs(aCartPointA->X() - aCartPointC->X()) <= Precision::Confusion()
+       && Abs(aCartPointA->Y() - aCartPointC->Y()) <= Precision::Confusion()
+       && Abs(aCartPointA->Z() - aCartPointC->Z()) <= Precision::Confusion())
       {
-        Message::SendFail ("Error: 3d argument is unexpected to be a point");
+        Message::SendFail ("Error: Same points");
+        return 1;
+      }
+      // Test B=C
+      if (Abs(aCartPointB->X() - aCartPointC->X()) <= Precision::Confusion()
+       && Abs(aCartPointB->Y() - aCartPointC->Y()) <= Precision::Confusion()
+       && Abs(aCartPointB->Z() - aCartPointC->Z()) <= Precision::Confusion())
+      {
+        Message::SendFail ("Error: Same points");
+        return 1;
+      }
+      // Construction of the circle
+      GC_MakeCircle aCir = GC_MakeCircle (aCartPointA->Pnt(), aCartPointB->Pnt(), aCartPointC->Pnt());
+      Handle (Geom_Circle) aGeomCircle;
+      try
+      {
+        aGeomCircle = aCir.Value();
+      }
+      catch (StdFail_NotDone const&)
+      {
+        Message::SendFail ("Error: can't create circle");
         return 1;
       }
-        // tag
-        // Verify that the three points are different
-        Handle(AIS_Point) theAISPointA = Handle(AIS_Point)::DownCast(theShapeA);
-        Handle(AIS_Point) theAISPointB = Handle(AIS_Point)::DownCast(theShapeB);
-        Handle(AIS_Point) theAISPointC = Handle(AIS_Point)::DownCast(theShapeC);
-        
-        Handle(Geom_Point) myGeomPointA = theAISPointA->Component();
-        Handle(Geom_CartesianPoint) myCartPointA = 
-          Handle(Geom_CartesianPoint)::DownCast(myGeomPointA);
-
-        Handle(Geom_Point) myGeomPointB = theAISPointB->Component();
-        Handle(Geom_CartesianPoint) myCartPointB =
-          Handle(Geom_CartesianPoint)::DownCast(myGeomPointB);
-
-        Handle(Geom_Point) myGeomPointC = theAISPointC->Component();
-        Handle(Geom_CartesianPoint) myCartPointC =
-          Handle(Geom_CartesianPoint)::DownCast(myGeomPointC);
-
-        // Test A=B
-        if (Abs(myCartPointA->X()-myCartPointB->X()) <= Precision::Confusion() && 
-            Abs(myCartPointA->Y()-myCartPointB->Y()) <= Precision::Confusion() && 
-            Abs(myCartPointA->Z()-myCartPointB->Z()) <= Precision::Confusion() ) 
-        {
-          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() ) 
-        {
-          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() ) 
-        {
-          Message::SendFail ("Error: Same points");
-          return 1;
-        }
-        // Construction of the circle
-        GC_MakeCircle Cir = GC_MakeCircle (myCartPointA->Pnt(), 
-          myCartPointB->Pnt(), myCartPointC->Pnt() );
-        Handle (Geom_Circle) theGeomCircle;
-        try 
-        {
-          theGeomCircle = Cir.Value();
-        }
-        catch (StdFail_NotDone const&)
-        {
-          Message::SendFail ("Error: can't create circle");
-          return -1;
-        }
 
-        DisplayCircle(theGeomCircle, aName, isFilled);
+      DisplayCircle (aGeomCircle, aName, isFilled);
     }
 
     // Arguments: AIS_Plane AIS_Point Real
-    // ===================================
-    else if (theShapeA->Type() == AIS_KOI_Datum && 
-      theShapeA->Signature() == 7 ) 
+    else if (aShapeA->Type() == AIS_KindOfInteractive_Datum
+          && aShapeA->Signature() == 7)
     {
-      if (theShapeB->Type() != AIS_KOI_Datum || 
-        theShapeB->Signature() != 1 ) 
+      Handle(AIS_Plane) anAISPlane  = Handle(AIS_Plane)::DownCast (aShapeA);
+      Handle(AIS_Point) anAISPointB = Handle(AIS_Point)::DownCast (aShapeB);
+      if (anAISPointB.IsNull())
       {
-        Message::SendFail ("Error: 2d element is a unexpected to be a point");
+        Message::SendFail ("Error: 2d element is a expected to be a point");
         return 1;
       }
+
       // Check that the radius is >= 0
-      if (Draw::Atof(argv[4]) <= 0 ) 
+      const Standard_Real anR = Draw::Atof (argv[4]);
+      if (anR <= 0)
       {
         Message::SendFail ("Syntax error: the radius must be >=0");
         return 1;
       }
 
       // Recover the normal to the plane
-      Handle(AIS_Plane) theAISPlane = Handle(AIS_Plane)::DownCast(theShapeA);
-      Handle(AIS_Point) theAISPointB = Handle(AIS_Point)::DownCast(theShapeB); 
-
-      Handle(Geom_Plane) myGeomPlane = theAISPlane->Component();
-      Handle(Geom_Point) myGeomPointB = theAISPointB->Component();
-      Handle(Geom_CartesianPoint) myCartPointB = 
-        Handle(Geom_CartesianPoint)::DownCast(myGeomPointB);
+      Handle(Geom_Plane) aGeomPlane  = anAISPlane->Component();
+      Handle(Geom_Point) aGeomPointB = anAISPointB->Component();
+      Handle(Geom_CartesianPoint) aCartPointB = Handle(Geom_CartesianPoint)::DownCast(aGeomPointB);
 
-      gp_Pln mygpPlane = myGeomPlane->Pln();
-      gp_Ax1 thegpAxe = mygpPlane.Axis();
-      gp_Dir theDir = thegpAxe.Direction();
-      gp_Pnt theCenter = myCartPointB->Pnt();
-      Standard_Real TheR = Draw::Atof(argv[4]);
-      GC_MakeCircle Cir = GC_MakeCircle (theCenter, theDir ,TheR);
-      Handle (Geom_Circle) theGeomCircle;
-      try 
+      gp_Pln aGpPlane = aGeomPlane->Pln();
+      gp_Ax1 aGpAxe = aGpPlane.Axis();
+      gp_Dir aDir = aGpAxe.Direction();
+      gp_Pnt aCenter = aCartPointB->Pnt();
+      GC_MakeCircle aCir = GC_MakeCircle (aCenter, aDir, anR);
+      Handle(Geom_Circle) aGeomCircle;
+      try
       {
-        theGeomCircle = Cir.Value();
+        aGeomCircle = aCir.Value();
       }
       catch (StdFail_NotDone const&)
       {
         Message::SendFail ("Error: can't create circle");
-        return -1;
+        return 1;
       }
 
-      DisplayCircle(theGeomCircle, aName, isFilled);
-
+      DisplayCircle (aGeomCircle, aName, isFilled);
     }
-
-    // Error
     else
     {
       Message::SendFail ("Error: 1st argument has an unexpected type");
       return 1;
     }
-
   }
-  // No arguments: selection in the viewer
-  // =========================================
-  else 
+  else // No arguments: selection in the viewer
   {
     // Get the name of the circle 
-    TCollection_AsciiString aName(argv[1]);
+    TCollection_AsciiString aName (argv[1]);
 
     TopTools_ListOfShape aShapes;
     ViewerTest::GetSelectedShapes (aShapes);
@@ -2305,7 +2208,7 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
     }
 
     const TopoDS_Shape& aShapeA = aShapes.First();
-    if (aShapeA.ShapeType() == TopAbs_VERTEX ) 
+    if (aShapeA.ShapeType() == TopAbs_VERTEX)
     {
       if (aShapes.Extent() != 3)
       {
@@ -2331,64 +2234,63 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
       gp_Pnt B = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
       gp_Pnt C = BRep_Tool::Pnt (TopoDS::Vertex (aShapeC));
 
-      GC_MakeCircle Cir = GC_MakeCircle (A, B, C);
-      Handle (Geom_Circle) theGeomCircle;
-      try 
+      GC_MakeCircle aCir = GC_MakeCircle (A, B, C);
+      Handle(Geom_Circle) aGeomCircle;
+      try
       {
-        theGeomCircle = Cir.Value();
+        aGeomCircle = aCir.Value();
       }
       catch (StdFail_NotDone const&)
       {
         Message::SendFail ("Error: can't create circle");
-        return -1;
+        return 1;
       }
 
-      DisplayCircle(theGeomCircle, aName, isFilled);
-
+      DisplayCircle (aGeomCircle, aName, isFilled);
     }
     else if (aShapeA.ShapeType() == TopAbs_FACE)
     {
       const TopoDS_Shape& aShapeB = aShapes.Last();
 
       // Recover the radius 
-      Standard_Real theRad;
-      do 
+      Standard_Real aRad = 0.0;
+      do
       {
         std::cout << " Enter the value of the radius:\n";
-        std::cin >> theRad;
-      } while (theRad <= 0);
-      
+        std::cin >> aRad;
+      } while (aRad <= 0);
+
       // Get filled status
       Standard_Boolean isFilled;
       std::cout << "Enter filled status (0 or 1)\n";
       std::cin >> isFilled;
 
       // Recover the normal to the plane. tag
-      TopoDS_Face myFace = TopoDS::Face(aShapeA);
-      BRepAdaptor_Surface mySurface (myFace, Standard_False);
-      gp_Pln myPlane = mySurface.Plane();
-      Handle(Geom_Plane) theGeomPlane = new Geom_Plane (myPlane);
-      gp_Pln mygpPlane = theGeomPlane->Pln();
-      gp_Ax1 thegpAxe = mygpPlane.Axis();
-      gp_Dir theDir = thegpAxe.Direction();
+      TopoDS_Face aFace = TopoDS::Face (aShapeA);
+      BRepAdaptor_Surface aSurface (aFace, Standard_False);
+      gp_Pln aPlane = aSurface.Plane();
+      Handle(Geom_Plane) aGeomPlane = new Geom_Plane (aPlane);
+      gp_Pln aGpPlane = aGeomPlane->Pln();
+      gp_Ax1 aGpAxe = aGpPlane.Axis();
+      gp_Dir aDir = aGpAxe.Direction();
 
       // Recover the center
-      gp_Pnt theCenter = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
+      gp_Pnt aCenter = BRep_Tool::Pnt (TopoDS::Vertex (aShapeB));
 
       // Construct the circle
-      GC_MakeCircle Cir = GC_MakeCircle (theCenter, theDir ,theRad);
-      Handle (Geom_Circle) theGeomCircle;
-      try 
+      GC_MakeCircle aCir = GC_MakeCircle (aCenter, aDir, aRad);
+      Handle(Geom_Circle) aGeomCircle;
+      try
       {
-        theGeomCircle = Cir.Value();
+        aGeomCircle = aCir.Value();
       }
       catch (StdFail_NotDone const&)
       {
         Message::SendFail ("Error: can't create circle");
-        return -1;
+        return 1;
       }
 
-      DisplayCircle(theGeomCircle, aName, isFilled);
+      DisplayCircle (aGeomCircle, aName, isFilled);
     }
     else
     {
index 74bb510..21b7340 100644 (file)
@@ -670,7 +670,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
   TCollection_AsciiString aName (theArgs[1]);
 
   NCollection_List<Handle(AIS_InteractiveObject)> aShapes;
-  Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect;
+  Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
   Standard_Boolean isPlaneCustom = Standard_False;
   gp_Pln aWorkingPlane;
 
@@ -718,8 +718,9 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
     {
       if (aShapes.Extent() == 1)
       {
-        if (aShapes.First()->Type() == AIS_KOI_Shape
-          && (Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape().ShapeType() != TopAbs_EDGE)
+        Handle(AIS_Shape) aFirstShapePrs = Handle(AIS_Shape)::DownCast(aShapes.First());
+        if (aFirstShapePrs.IsNull()
+         || aFirstShapePrs->Shape().ShapeType() != TopAbs_EDGE)
         {
           Message::SendFail ("Error: wrong shape type");
           return 1;
@@ -731,7 +732,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
         }
 
         // Adjust working plane
-        TopoDS_Edge anEdge = TopoDS::Edge ((Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape());
+        TopoDS_Edge anEdge = TopoDS::Edge (aFirstShapePrs->Shape());
         TopoDS_Vertex aFirst, aSecond;
         TopExp::Vertices (anEdge, aFirst, aSecond);
         aDim = new PrsDim_LengthDimension (anEdge, aWorkingPlane);
@@ -744,22 +745,22 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
         TopoDS_Shape aShape1, aShape2;
 
         // Getting shapes
-        if (aShapes.First()->DynamicType() == STANDARD_TYPE (AIS_Point))
+        if (Handle(AIS_Point) aPntPrs = Handle(AIS_Point)::DownCast (aShapes.First()))
         {
-          aShape1 = Handle(AIS_Point)::DownCast (aShapes.First ())->Vertex();
+          aShape1 = aPntPrs->Vertex();
         }
-        else if (aShapes.First()->Type() == AIS_KOI_Shape)
+        else if (Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aShapes.First()))
         {
-          aShape1 = (Handle(AIS_Shape)::DownCast (aShapes.First()))->Shape();
+          aShape1 = aShapePrs->Shape();
         }
 
-        if (aShapes.Last()->DynamicType() == STANDARD_TYPE (AIS_Point))
+        if (Handle(AIS_Point) aPntPrs = Handle(AIS_Point)::DownCast (aShapes.Last ()))
         {
-          aShape2 = Handle(AIS_Point)::DownCast (aShapes.Last ())->Vertex();
+          aShape2 = aPntPrs->Vertex();
         }
-        else if (aShapes.Last()->Type() == AIS_KOI_Shape)
+        else if (Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aShapes.Last()))
         {
-          aShape2 = (Handle(AIS_Shape)::DownCast (aShapes.Last()))->Shape();
+          aShape2 = aShapePrs->Shape();
         }
 
         if (aShape1.IsNull() || aShape2.IsNull())
@@ -811,51 +812,59 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
     }
     case PrsDim_KOD_PLANEANGLE:
     {
-      if (aShapes.Extent() == 1 && aShapes.First()->Type()==AIS_KOI_Shape)
+      switch (aShapes.Extent())
       {
-        Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(aShapes.First());
-        if (aShape->Shape().ShapeType() == TopAbs_FACE)
-          aDim = new PrsDim_AngleDimension (TopoDS::Face(aShape->Shape()));
-      }
-      if (aShapes.Extent() == 2)
-      {
-        Handle(AIS_Shape) aShape1 = Handle(AIS_Shape)::DownCast(aShapes.First());
-        Handle(AIS_Shape) aShape2 = Handle(AIS_Shape)::DownCast(aShapes.Last());
-        if (!aShape1.IsNull() && !aShape2.IsNull()
-          && aShape1->Shape().ShapeType() == TopAbs_EDGE
-          && aShape2->Shape().ShapeType() == TopAbs_EDGE)
-          aDim = new PrsDim_AngleDimension (TopoDS::Edge(aShape1->Shape()),TopoDS::Edge(aShape2->Shape()));
-        else
+        case 1:
         {
-          Message::SendFail ("Error: wrong shapes for angle dimension");
-          return 1;
+          if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(aShapes.First()))
+          {
+            if (aShape->Shape().ShapeType() == TopAbs_FACE)
+            {
+              aDim = new PrsDim_AngleDimension (TopoDS::Face(aShape->Shape()));
+            }
+          }
+          break;
+        }
+        case 2:
+        {
+          Handle(AIS_Shape) aShape1 = Handle(AIS_Shape)::DownCast(aShapes.First());
+          Handle(AIS_Shape) aShape2 = Handle(AIS_Shape)::DownCast(aShapes.Last());
+          if (!aShape1.IsNull() && !aShape2.IsNull()
+            && aShape1->Shape().ShapeType() == TopAbs_EDGE
+            && aShape2->Shape().ShapeType() == TopAbs_EDGE)
+          {
+            aDim = new PrsDim_AngleDimension (TopoDS::Edge(aShape1->Shape()), TopoDS::Edge(aShape2->Shape()));
+          }
+          else
+          {
+            Message::SendFail ("Error: wrong shapes for angle dimension");
+            return 1;
+          }
+          break;
+        }
+        case 3:
+        {
+          gp_Pnt aPnts[3];
+          Standard_Integer aPntIndex = 0;
+          for (NCollection_List<Handle(AIS_InteractiveObject)>::Iterator aPntIter (aShapes); aPntIter.More(); aPntIter.Next())
+          {
+            if (Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast (aPntIter.Value()))
+            {
+              aPnts[aPntIndex++] = aPoint->Component()->Pnt();
+            }
+          }
+          if (aPntIndex == 3)
+          {
+            aDim = new PrsDim_AngleDimension (aPnts[0], aPnts[1], aPnts[2]);
+          }
+          break;
         }
       }
-      else if (aShapes.Extent() == 3)
-      {
-        gp_Pnt aP1, aP2, aP3;
-        Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast (aShapes.First());
-        if (aPoint.IsNull())
-          return 1;
-        aP1 = aPoint->Component()->Pnt();
-        aShapes.RemoveFirst();
-        aPoint = Handle(AIS_Point)::DownCast (aShapes.First());
-        if (aPoint.IsNull())
-          return 1;
-        aP2 = aPoint->Component()->Pnt();
-        aShapes.RemoveFirst();
-        aPoint = Handle(AIS_Point)::DownCast (aShapes.First());
-        if (aPoint.IsNull())
-          return 1;
-        aP3 = aPoint->Component()->Pnt();
-        aDim = new PrsDim_AngleDimension (aP1, aP2, aP3);
-      }
-      else
+      if (aDim.IsNull())
       {
         Message::SendFail ("Error: wrong number of shapes to build dimension");
         return 1;
       }
-
       break;
     }
     case PrsDim_KOD_RADIUS: // radius of the circle
@@ -1790,7 +1799,8 @@ static int VMoveDim (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
        return 1;
      }
 
-     if (aPickedObj->Type() != AIS_KOI_Dimension && aPickedObj->Type() != AIS_KOI_Relation)
+     if (aPickedObj->Type() != AIS_KindOfInteractive_Dimension
+      && aPickedObj->Type() != AIS_KindOfInteractive_Relation)
      {
        theDi << theArgVec[0] << " error: no dimension or relation with this name.\n";
        return 1;
@@ -1814,8 +1824,9 @@ static int VMoveDim (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
         aPickedObj = TheAISContext()->SelectedInteractive();
       }
 
-      isPicked = (!aPickedObj.IsNull() && (aPickedObj->Type() == AIS_KOI_Dimension || aPickedObj->Type() == AIS_KOI_Relation));
-
+      isPicked = (!aPickedObj.IsNull()
+               && (aPickedObj->Type() == AIS_KindOfInteractive_Dimension
+                || aPickedObj->Type() == AIS_KindOfInteractive_Relation));
       if (isPicked)
       {
         break;
@@ -1844,7 +1855,7 @@ static int VMoveDim (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
     while (ViewerMainLoop (aPickArgNum, aPickArgVec)) { }
 
     // Set text position, update relation or dimension.
-    if (aPickedObj->Type() == AIS_KOI_Relation)
+    if (aPickedObj->Type() == AIS_KindOfInteractive_Relation)
     {
       Handle(PrsDim_Relation) aRelation = Handle(PrsDim_Relation)::DownCast (aPickedObj);
       aPoint = Get3DPointAtMousePosition();
@@ -1892,9 +1903,8 @@ static int VMoveDim (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
   }
 
   // Set text position, update relation or dimension.
-  if (aPickedObj->Type() == AIS_KOI_Relation)
+  if (Handle(PrsDim_Relation) aRelation = Handle(PrsDim_Relation)::DownCast (aPickedObj))
   {
-    Handle(PrsDim_Relation) aRelation = Handle(PrsDim_Relation)::DownCast (aPickedObj);
     aRelation->SetPosition (aPoint);
     TheAISContext()->Redisplay (aRelation, Standard_True);
   }