diff --git a/src/AIS/AIS_Axis.hxx b/src/AIS/AIS_Axis.hxx index eb1273bef6..5cd764fb1b 100644 --- a/src/AIS/AIS_Axis.hxx +++ b/src/AIS/AIS_Axis.hxx @@ -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; diff --git a/src/AIS/AIS_Circle.hxx b/src/AIS/AIS_Circle.hxx index a17cb803d7..0d1772d098 100644 --- a/src/AIS/AIS_Circle.hxx +++ b/src/AIS/AIS_Circle.hxx @@ -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; } diff --git a/src/AIS/AIS_ConnectedInteractive.hxx b/src/AIS/AIS_ConnectedInteractive.hxx index cebfaac2c5..5bb2578287 100644 --- a/src/AIS/AIS_ConnectedInteractive.hxx +++ b/src/AIS/AIS_ConnectedInteractive.hxx @@ -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; } diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index 441ad8a75e..0d6069b730 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -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); } //======================================================================= diff --git a/src/AIS/AIS_InteractiveContext.hxx b/src/AIS/AIS_InteractiveContext.hxx index 875e34f488..90375a5d5d 100644 --- a/src/AIS/AIS_InteractiveContext.hxx +++ b/src/AIS/AIS_InteractiveContext.hxx @@ -869,8 +869,10 @@ public: //! @name common properties //! fills with objects of a particular Type and Signature with no consideration of display status. //! by Default, = -1 means control only on . - //! if = AIS_KOI_None and = -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 = AIS_KindOfInteractive_None and = -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(); diff --git a/src/AIS/AIS_InteractiveObject.hxx b/src/AIS/AIS_InteractiveObject.hxx index 8b4f9229f1..60ba4ca319 100644 --- a/src/AIS/AIS_InteractiveObject.hxx +++ b/src/AIS/AIS_InteractiveObject.hxx @@ -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. diff --git a/src/AIS/AIS_KindOfInteractive.hxx b/src/AIS/AIS_KindOfInteractive.hxx index 4754e79975..7151a05062 100644 --- a/src/AIS/AIS_KindOfInteractive.hxx +++ b/src/AIS/AIS_KindOfInteractive.hxx @@ -18,27 +18,24 @@ #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 diff --git a/src/AIS/AIS_Line.hxx b/src/AIS/AIS_Line.hxx index 2345a8bfd1..4f2e8e9b2a 100644 --- a/src/AIS/AIS_Line.hxx +++ b/src/AIS/AIS_Line.hxx @@ -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; } diff --git a/src/AIS/AIS_MultipleConnectedInteractive.cxx b/src/AIS/AIS_MultipleConnectedInteractive.cxx index d201fbd319..ad04fe839d 100644 --- a/src/AIS/AIS_MultipleConnectedInteractive.cxx +++ b/src/AIS/AIS_MultipleConnectedInteractive.cxx @@ -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 : diff --git a/src/AIS/AIS_MultipleConnectedInteractive.hxx b/src/AIS/AIS_MultipleConnectedInteractive.hxx index 26a15124d2..a988233815 100644 --- a/src/AIS/AIS_MultipleConnectedInteractive.hxx +++ b/src/AIS/AIS_MultipleConnectedInteractive.hxx @@ -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; diff --git a/src/AIS/AIS_Plane.cxx b/src/AIS/AIS_Plane.cxx index 169a59f88c..3f8f064f12 100644 --- a/src/AIS/AIS_Plane.cxx +++ b/src/AIS/AIS_Plane.cxx @@ -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 : diff --git a/src/AIS/AIS_Plane.hxx b/src/AIS/AIS_Plane.hxx index 021472aa29..29f8d154c1 100644 --- a/src/AIS/AIS_Plane.hxx +++ b/src/AIS/AIS_Plane.hxx @@ -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; } diff --git a/src/AIS/AIS_PlaneTrihedron.hxx b/src/AIS/AIS_PlaneTrihedron.hxx index be79176b8f..73f9af6fcf 100644 --- a/src/AIS/AIS_PlaneTrihedron.hxx +++ b/src/AIS/AIS_PlaneTrihedron.hxx @@ -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; diff --git a/src/AIS/AIS_Point.hxx b/src/AIS/AIS_Point.hxx index af5bd9048e..ed920b733b 100644 --- a/src/AIS/AIS_Point.hxx +++ b/src/AIS/AIS_Point.hxx @@ -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(); diff --git a/src/AIS/AIS_Shape.hxx b/src/AIS/AIS_Shape.hxx index ce3ca48b20..6be0e15b70 100644 --- a/src/AIS/AIS_Shape.hxx +++ b/src/AIS/AIS_Shape.hxx @@ -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; } diff --git a/src/AIS/AIS_Trihedron.hxx b/src/AIS/AIS_Trihedron.hxx index 0ad7f705dd..336bbca5f3 100644 --- a/src/AIS/AIS_Trihedron.hxx +++ b/src/AIS/AIS_Trihedron.hxx @@ -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; diff --git a/src/PrsDim/PrsDim_Dimension.hxx b/src/PrsDim/PrsDim_Dimension.hxx index 769d015f59..85f4eb854e 100644 --- a/src/PrsDim/PrsDim_Dimension.hxx +++ b/src/PrsDim/PrsDim_Dimension.hxx @@ -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 diff --git a/src/PrsDim/PrsDim_Relation.hxx b/src/PrsDim/PrsDim_Relation.hxx index 2d99c13330..97faba8464 100644 --- a/src/PrsDim/PrsDim_Relation.hxx +++ b/src/PrsDim/PrsDim_Relation.hxx @@ -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; } diff --git a/src/QABugs/QABugs_1.cxx b/src/QABugs/QABugs_1.cxx index 244aeb440b..000446cf63 100644 --- a/src/QABugs/QABugs_1.cxx +++ b/src/QABugs/QABugs_1.cxx @@ -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); diff --git a/src/QABugs/QABugs_16.cxx b/src/QABugs/QABugs_16.cxx index 751bccf2fb..7298c8d9e5 100644 --- a/src/QABugs/QABugs_16.cxx +++ b/src/QABugs/QABugs_16.cxx @@ -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); diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index fd952202a1..6bb7864286 100644 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -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; } diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index 1a6fa8e7c6..960a5e92df 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -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); + 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; + } + } - for(Standard_Integer i=0;i<=13 && index==-1;i++) - if(!strcasecmp(name,thefullnames[i])) - index = 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 #include #include @@ -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& 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& 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; diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 58c21eb40c..5a981c7525 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -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< 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) { - - ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName - it (GetMapOfAIS()); - - while ( it.More() ) { - - Handle(AIS_InteractiveObject) aShape = it.Key1(); - - if (!aShape.IsNull() && TheAISContext()->IsSelected(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); - - } - - } - - 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)) + case 1: { - // On verifie que l'AIS InteraciveObject est bien - // un AIS_Trihedron - if (!aShape.IsNull() && - aShape->Type()==AIS_KOI_Datum && aShape->Signature()==3) + 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; + } + } + + NCollection_Sequence aTrihedrons; + if (!aName.IsEmpty()) + { + Handle(AIS_InteractiveObject) aShape; + if (GetMapOfAIS().Find2 (aName, aShape)) + { + if (Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape)) { - 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); - - TheAISContext() ->UpdateCurrentViewer(); + aTrihedrons.Append (aTrihedron); + } + else + { + di << "Syntax error: " << aName << " is not a trihedron"; + return 1; } } } + else if (TheAISContext()->NbSelected() > 0) + { + for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS()); it.More(); it.Next()) + { + const Handle(AIS_InteractiveObject)& aShape = it.Key1(); + if (!aShape.IsNull() + && TheAISContext()->IsSelected (aShape)) + { + if (Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape)) + { + aTrihedrons.Append (aTrihedron); + } + } + } + } + + for (NCollection_Sequence::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); + } + + aTrihedron->SetSize (aSize); + if (hasColor) { aTrihedron->SetColor (aColor); } + else { aTrihedron->UnsetColor(); } + + 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; - } - - // 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); - - 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) - { - 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)); - } - } - TheAISContext()->Display (anAISPlane, Standard_True); + // 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; } - // 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 ) { + // 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; + } + + // 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_KindOfInteractive_Datum + && aShapeC->Signature() == 1)) + { + Message::SendFail ("Syntax error: 3d object is expected to be an AIS_Point"); + 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); + + 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) + { + 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)); + } + } + 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; } + 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; + } - // On recupere les parametres - Handle(AIS_InteractiveObject) theShapeA; - Handle(AIS_InteractiveObject) theShapeB; + Handle(Geom_Point) aGeomPointBA = anAISPointA->Component(); + Handle(Geom_CartesianPoint) aCartPointA = Handle(Geom_CartesianPoint)::DownCast (aGeomPointBA); - // 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); + Handle(Geom_Point) aGeomPointB = anAISPointB->Component(); + Handle(Geom_CartesianPoint) aCartPointB = Handle(Geom_CartesianPoint)::DownCast (aGeomPointB); - 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 ) myGeomPointB= theAISPointB->Component(); - Handle(Geom_CartesianPoint ) myCartPointB= Handle(Geom_CartesianPoint)::DownCast (myGeomPointB); - // Handle(Geom_CartesianPoint ) myCartPointB= *(Handle(Geom_CartesianPoint)*)& (theAISPointB->Component() ) ; - - if (myCartPointB->X()==myCartPointA->X() && myCartPointB->Y()==myCartPointA->Y() && myCartPointB->Z()==myCartPointA->Z() ) { + if (aCartPointB->X() == aCartPointA->X() + && aCartPointB->Y() == aCartPointA->Y() + && aCartPointB->Z() == aCartPointA->Z()) + { // B=A - 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); - - } - - // 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]); + di << "vline error: same points\n"; + return 1; } - 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(AIS_Line) anAISLine = new AIS_Line (aCartPointA, aCartPointB); + GetMapOfAIS().Bind (anAISLine, argv[1]); + TheAISContext()->Display (anAISLine, Standard_True); + } + 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(AIS_Line) theAISLine= new AIS_Line(myCartPointA,myCartPointB ); - GetMapOfAIS().Bind(theAISLine,argv[1] ); - TheAISContext()->Display (theAISLine, Standard_True); + 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) 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 (!aShapeA.IsNull() + && !aShapeB.IsNull() + && aShapeA->Type() == AIS_KindOfInteractive_Datum + && aShapeA->Signature() == 1) { - if (theShapeB->Type()!=AIS_KOI_Datum || theShapeB->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: 2d argument is unexpected to be a point"); + Message::SendFail ("Error: arguments are expected to be 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 ) + + // 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: 3d argument is unexpected to be a point"); + Message::SendFail ("Error: Same points"); + return 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: 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) aGeomPlane = anAISPlane->Component(); + Handle(Geom_Point) aGeomPointB = anAISPointB->Component(); + Handle(Geom_CartesianPoint) aCartPointB = Handle(Geom_CartesianPoint)::DownCast(aGeomPointB); - Handle(Geom_Plane) myGeomPlane = theAISPlane->Component(); - Handle(Geom_Point) myGeomPointB = theAISPointB->Component(); - Handle(Geom_CartesianPoint) myCartPointB = - Handle(Geom_CartesianPoint)::DownCast(myGeomPointB); - - 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 { diff --git a/src/ViewerTest/ViewerTest_RelationCommands.cxx b/src/ViewerTest/ViewerTest_RelationCommands.cxx index 74bb510999..21b73409e7 100644 --- a/src/ViewerTest/ViewerTest_RelationCommands.cxx +++ b/src/ViewerTest/ViewerTest_RelationCommands.cxx @@ -670,7 +670,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/, TCollection_AsciiString aName (theArgs[1]); NCollection_List 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::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); }