From 6d31c8100e6a561ec496f1ea1d010984da58c0b5 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 5 Sep 2018 12:40:58 +0300 Subject: [PATCH] Optimization of SketchPrs objects parameters --- .../SketchPlugin_ConstraintCoincidence.cpp | 3 +- .../SketchPlugin_ConstraintCollinear.cpp | 2 +- .../SketchPlugin_ConstraintEqual.cpp | 1 - .../SketchPlugin_ConstraintHorizontal.cpp | 1 - .../SketchPlugin_ConstraintMiddle.cpp | 1 - .../SketchPlugin_ConstraintMirror.cpp | 1 - .../SketchPlugin_ConstraintParallel.cpp | 1 - .../SketchPlugin_ConstraintPerpendicular.cpp | 2 +- .../SketchPlugin_ConstraintRigid.cpp | 3 +- .../SketchPlugin_ConstraintTangent.cpp | 1 - .../SketchPlugin_ConstraintVertical.cpp | 1 - .../SketchPlugin_MultiRotation.cpp | 1 - .../SketchPlugin_MultiTranslation.cpp | 1 - src/SketcherPrs/SketcherPrs_Coincident.cpp | 6 +-- src/SketcherPrs/SketcherPrs_Coincident.h | 5 ++- src/SketcherPrs/SketcherPrs_Collinear.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Collinear.h | 5 +-- src/SketcherPrs/SketcherPrs_Equal.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Equal.h | 4 +- src/SketcherPrs/SketcherPrs_Factory.cpp | 43 ++++++++----------- src/SketcherPrs/SketcherPrs_Factory.h | 16 +++---- src/SketcherPrs/SketcherPrs_HVDirection.cpp | 6 +-- src/SketcherPrs/SketcherPrs_HVDirection.h | 5 +-- src/SketcherPrs/SketcherPrs_Middle.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Middle.h | 4 +- src/SketcherPrs/SketcherPrs_Mirror.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Mirror.h | 4 +- src/SketcherPrs/SketcherPrs_Parallel.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Parallel.h | 4 +- src/SketcherPrs/SketcherPrs_Perpendicular.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Perpendicular.h | 4 +- src/SketcherPrs/SketcherPrs_Rigid.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Rigid.h | 4 +- src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 5 +-- src/SketcherPrs/SketcherPrs_SymbolPrs.h | 6 +-- src/SketcherPrs/SketcherPrs_Tangent.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Tangent.h | 4 +- .../SketcherPrs_Transformation.cpp | 5 +-- src/SketcherPrs/SketcherPrs_Transformation.h | 5 +-- 39 files changed, 71 insertions(+), 123 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp index 619ca41ac..ac7b9961b 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp @@ -52,8 +52,7 @@ AISObjectPtr SketchPlugin_ConstraintCoincidence::getAISObject(AISObjectPtr thePr if (!sketch()) return thePrevious; - AISObjectPtr anAIS = SketcherPrs_Factory::coincidentConstraint(this, sketch()->coordinatePlane(), - thePrevious); + AISObjectPtr anAIS = SketcherPrs_Factory::coincidentConstraint(this, sketch(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp index e36287b4c..c1742919f 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp @@ -42,7 +42,7 @@ AISObjectPtr SketchPlugin_ConstraintCollinear::getAISObject(AISObjectPtr thePrev return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::collinearConstraint( - this, sketch(), sketch()->coordinatePlane(), thePrevious); + this, sketch(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp b/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp index 7be8935aa..f03f7dab1 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp @@ -51,7 +51,6 @@ AISObjectPtr SketchPlugin_ConstraintEqual::getAISObject(AISObjectPtr thePrevious return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::equalConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp index 6ebf472e8..545102700 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp @@ -51,7 +51,6 @@ AISObjectPtr SketchPlugin_ConstraintHorizontal::getAISObject(AISObjectPtr thePre return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp index 620b0691a..c7a8982ca 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp @@ -42,7 +42,6 @@ AISObjectPtr SketchPlugin_ConstraintMiddle::getAISObject(AISObjectPtr thePreviou return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::middleConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp index ec7be3a79..310a3f456 100755 --- a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp @@ -210,7 +210,6 @@ AISObjectPtr SketchPlugin_ConstraintMirror::getAISObject(AISObjectPtr thePreviou return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::mirrorConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp index 9ddda85aa..4af4bf865 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp @@ -57,7 +57,6 @@ AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevi return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::parallelConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp index 258e30dc0..c922096b0 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp @@ -56,7 +56,7 @@ AISObjectPtr SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr the return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); + thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp index 67eba8044..36c329e4a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp @@ -47,6 +47,5 @@ AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious { if (!sketch()) return thePrevious; - return SketcherPrs_Factory::rigidConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); + return SketcherPrs_Factory::rigidConstraint(this, sketch(), thePrevious); } \ No newline at end of file diff --git a/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp b/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp index 37fa4e0de..4a41cac55 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp @@ -51,7 +51,6 @@ AISObjectPtr SketchPlugin_ConstraintTangent::getAISObject(AISObjectPtr thePrevio return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::tangentConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp b/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp index 3debcfd37..db4be31c0 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp @@ -50,7 +50,6 @@ AISObjectPtr SketchPlugin_ConstraintVertical::getAISObject(AISObjectPtr thePrevi return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::verticalConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp index 6a9a1596e..0b798f30c 100755 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp @@ -233,7 +233,6 @@ AISObjectPtr SketchPlugin_MultiRotation::getAISObject(AISObjectPtr thePrevious) return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::rotateConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp index b927739d1..cd5b731ed 100755 --- a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp @@ -213,7 +213,6 @@ AISObjectPtr SketchPlugin_MultiTranslation::getAISObject(AISObjectPtr thePreviou return thePrevious; AISObjectPtr anAIS = SketcherPrs_Factory::translateConstraint(this, sketch(), - sketch()->coordinatePlane(), thePrevious); return anAIS; } diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index fc2f3e36a..9e4c24723 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -46,8 +46,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject); SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) -: AIS_InteractiveObject(), myConstraint(theConstraint), mySketcherPlane(thePlane), + SketchPlugin_Sketch* theSketch) +: AIS_InteractiveObject(), myConstraint(theConstraint), mySketch(theSketch), myPoint(gp_Pnt(0.0, 0.0, 0.0)), myIsCustomColor(false) { } @@ -85,7 +85,7 @@ void SketcherPrs_Coincident::Compute( const Standard_Integer theMode) { gp_Pnt aPoint; - bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane, aPoint); + bool aReadyToDisplay = readyToDisplay(myConstraint, mySketch->coordinatePlane(), aPoint); if (aReadyToDisplay) myPoint = aPoint; diff --git a/src/SketcherPrs/SketcherPrs_Coincident.h b/src/SketcherPrs/SketcherPrs_Coincident.h index 4b6d4effc..b33ba40cc 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.h +++ b/src/SketcherPrs/SketcherPrs_Coincident.h @@ -22,6 +22,7 @@ #define SketcherPrs_Coincident_H #include +#include #include #include @@ -42,7 +43,7 @@ public: /// \param theConstraint a constraint object /// \param thePlane plane of a sketch Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketch); /// Defines color for the presentation /// \param aColor a color object @@ -82,7 +83,7 @@ private: private: ModelAPI_Feature* myConstraint; - std::shared_ptr mySketcherPlane; + SketchPlugin_Sketch* mySketch; gp_Pnt myPoint; bool myIsCustomColor; /// state if the presentation is visualized in custom color Quantity_Color myCustomColor; /// the color of mid ring if there is a conflict diff --git a/src/SketcherPrs/SketcherPrs_Collinear.cpp b/src/SketcherPrs/SketcherPrs_Collinear.cpp index fba498a28..9e98f2132 100755 --- a/src/SketcherPrs/SketcherPrs_Collinear.cpp +++ b/src/SketcherPrs/SketcherPrs_Collinear.cpp @@ -33,9 +33,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Collinear.h b/src/SketcherPrs/SketcherPrs_Collinear.h index dfa4d853e..7e42b0efb 100755 --- a/src/SketcherPrs/SketcherPrs_Collinear.h +++ b/src/SketcherPrs/SketcherPrs_Collinear.h @@ -37,10 +37,9 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); + DEFINE_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs) /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation diff --git a/src/SketcherPrs/SketcherPrs_Equal.cpp b/src/SketcherPrs/SketcherPrs_Equal.cpp index 7077e1a7a..3c9d26168 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.cpp +++ b/src/SketcherPrs/SketcherPrs_Equal.cpp @@ -33,9 +33,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Equal.h b/src/SketcherPrs/SketcherPrs_Equal.h index 0b2066d38..b56a6e9b9 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.h +++ b/src/SketcherPrs/SketcherPrs_Equal.h @@ -37,10 +37,8 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs) /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation diff --git a/src/SketcherPrs/SketcherPrs_Factory.cpp b/src/SketcherPrs/SketcherPrs_Factory.cpp index 6059e0ce0..68e05f94c 100644 --- a/src/SketcherPrs/SketcherPrs_Factory.cpp +++ b/src/SketcherPrs/SketcherPrs_Factory.cpp @@ -38,17 +38,16 @@ // Macros for constraint presentation definition #define CONSTRAINT_PRS_IMPL(NAME, CLASS) \ AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \ - ModelAPI_CompositeFeature* theSketcher, \ - const std::shared_ptr& thePlane, \ + SketchPlugin_Sketch* theSketcher, \ AISObjectPtr thePrevious) \ { \ std::shared_ptr anAISObj; \ - if (CLASS::IsReadyToDisplay(theConstraint, thePlane)) { \ + if (CLASS::IsReadyToDisplay(theConstraint, theSketcher->coordinatePlane())) { \ if (thePrevious.get()) \ anAISObj = thePrevious; \ else { \ anAISObj = AISObjectPtr(new GeomAPI_AISObject()); \ - Handle(CLASS) aPrs = new CLASS(theConstraint, theSketcher, thePlane); \ + Handle(CLASS) aPrs = new CLASS(theConstraint, theSketcher); \ anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \ } \ } \ @@ -64,6 +63,7 @@ CONSTRAINT_PRS_IMPL(equalConstraint, SketcherPrs_Equal); CONSTRAINT_PRS_IMPL(tangentConstraint, SketcherPrs_Tangent); CONSTRAINT_PRS_IMPL(middleConstraint, SketcherPrs_Middle); CONSTRAINT_PRS_IMPL(mirrorConstraint, SketcherPrs_Mirror); +CONSTRAINT_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident); @@ -86,25 +86,22 @@ AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \ } -CONSTRAINT2_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident); CONSTRAINT2_PRS_IMPL(angleConstraint, SketcherPrs_Angle); CONSTRAINT2_PRS_IMPL(radiusConstraint, SketcherPrs_Radius); CONSTRAINT2_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension); // Non-standard constraints definition AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, - AISObjectPtr thePrevious) + SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_HVDirection::IsReadyToDisplay(theConstraint, thePlane)) { + if (SketcherPrs_HVDirection::IsReadyToDisplay(theConstraint, theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_HVDirection) aPrs = - new SketcherPrs_HVDirection(theConstraint, theSketcher, thePlane, true); + new SketcherPrs_HVDirection(theConstraint, theSketcher, true); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } @@ -112,18 +109,16 @@ AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theCons } AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, - AISObjectPtr thePrevious) + SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_HVDirection::IsReadyToDisplay(theConstraint, thePlane)) { + if (SketcherPrs_HVDirection::IsReadyToDisplay(theConstraint, theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_HVDirection) aPrs = - new SketcherPrs_HVDirection(theConstraint, theSketcher, thePlane, false); + new SketcherPrs_HVDirection(theConstraint, theSketcher, false); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } @@ -131,18 +126,17 @@ AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstr } AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, - AISObjectPtr thePrevious) + SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, thePlane)) { + if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, + theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_Transformation) aPrs = - new SketcherPrs_Transformation(theConstraint, theSketcher, thePlane, true); + new SketcherPrs_Transformation(theConstraint, theSketcher, true); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } @@ -150,18 +144,17 @@ AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConst } AISObjectPtr SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, - AISObjectPtr thePrevious) + SketchPlugin_Sketch* theSketcher, AISObjectPtr thePrevious) { std::shared_ptr anAISObj; - if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, thePlane)) { + if (SketcherPrs_Transformation::IsReadyToDisplay(theConstraint, + theSketcher->coordinatePlane())) { if (thePrevious.get()) anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); Handle(SketcherPrs_Transformation) aPrs = - new SketcherPrs_Transformation(theConstraint, theSketcher, thePlane, false); + new SketcherPrs_Transformation(theConstraint, theSketcher, false); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } diff --git a/src/SketcherPrs/SketcherPrs_Factory.h b/src/SketcherPrs/SketcherPrs_Factory.h index f59bd0d61..ef6908dae 100644 --- a/src/SketcherPrs/SketcherPrs_Factory.h +++ b/src/SketcherPrs/SketcherPrs_Factory.h @@ -22,6 +22,7 @@ #define SketcherPrs_Factory_H_ #include "SketcherPrs.h" +#include #include #include @@ -31,8 +32,7 @@ #define GET_CONSTRAINT_PRS(NAME) \ static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \ - ModelAPI_CompositeFeature* theSketcher, \ - const std::shared_ptr& thePlane, \ + SketchPlugin_Sketch* theSketcher, \ AISObjectPtr thePrevious); /** @@ -113,16 +113,16 @@ public: /// \param thePrevious the previous presentation GET_CONSTRAINT_PRS(rotateConstraint) -#define GET_CONSTRAINT2_PRS(NAME) \ - static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \ - const std::shared_ptr& thePlane, \ - AISObjectPtr thePrevious); - /// Creates coincedent constraint presentation /// \param theConstraint the constraint /// \param thePlane the current sketch plane /// \param thePrevious the previous presentation - GET_CONSTRAINT2_PRS(coincidentConstraint) + GET_CONSTRAINT_PRS(coincidentConstraint) + +#define GET_CONSTRAINT2_PRS(NAME) \ + static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \ + const std::shared_ptr& thePlane, \ + AISObjectPtr thePrevious); /// Creates angle constraint presentation /// \param theConstraint the constraint diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index d599d492c..e9d1d1413 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -33,10 +33,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, - bool isHorisontal) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane), + SketchPlugin_Sketch* theSketcher, bool isHorisontal) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher), myIsHorisontal(isHorisontal) { } diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.h b/src/SketcherPrs/SketcherPrs_HVDirection.h index 07ffa9a07..15f8f7c9e 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.h +++ b/src/SketcherPrs/SketcherPrs_HVDirection.h @@ -38,12 +38,9 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch /// \param isHorisontal a flag horizontal or vertical presentation Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, - bool isHorisontal); + SketchPlugin_Sketch* theSketcher, bool isHorisontal); DEFINE_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs) diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index ef272b49d..00b82636f 100755 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -33,9 +33,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Middle.h b/src/SketcherPrs/SketcherPrs_Middle.h index e5fbda622..4f3352bd0 100755 --- a/src/SketcherPrs/SketcherPrs_Middle.h +++ b/src/SketcherPrs/SketcherPrs_Middle.h @@ -37,10 +37,8 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs) /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index 33a650116..684669486 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -35,9 +35,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Mirror::SketcherPrs_Mirror(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Mirror.h b/src/SketcherPrs/SketcherPrs_Mirror.h index 7857e7118..fc7624c66 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.h +++ b/src/SketcherPrs/SketcherPrs_Mirror.h @@ -37,10 +37,8 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Mirror(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs) /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation diff --git a/src/SketcherPrs/SketcherPrs_Parallel.cpp b/src/SketcherPrs/SketcherPrs_Parallel.cpp index 90cdfd129..0860b6e68 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.cpp +++ b/src/SketcherPrs/SketcherPrs_Parallel.cpp @@ -34,9 +34,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Parallel.h b/src/SketcherPrs/SketcherPrs_Parallel.h index d963fcc8b..767688c56 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.h +++ b/src/SketcherPrs/SketcherPrs_Parallel.h @@ -37,10 +37,8 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs) /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp index 237301ee4..7c94af55a 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp @@ -37,9 +37,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.h b/src/SketcherPrs/SketcherPrs_Perpendicular.h index b075d4aa4..c0c7a4448 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.h +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.h @@ -39,10 +39,8 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs) diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index 88ad963b7..19c8fa211 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -51,9 +51,8 @@ static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Rigid.h b/src/SketcherPrs/SketcherPrs_Rigid.h index e35045ab7..af9dec23b 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.h +++ b/src/SketcherPrs/SketcherPrs_Rigid.h @@ -39,10 +39,8 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Rigid, SketcherPrs_SymbolPrs) diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index a2e51cbd4..f74c6b5db 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -119,10 +119,9 @@ std::map SketcherPrs_SymbolPrs::myIconsM SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) + SketchPlugin_Sketch* theSketcher) : AIS_InteractiveObject(), myConstraint(theConstraint), - myPlane(thePlane), myIsCustomColor(false), + myPlane(theSketcher->coordinatePlane()), myIsCustomColor(false), mySketcher(theSketcher) { SetAutoHilight(Standard_False); diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index 669f7a555..b552bf612 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -22,9 +22,9 @@ #define SketcherPrs_SymbolPrs_H #include "SketcherPrs_SensitivePoint.h" +#include #include #include -#include #include #include @@ -56,8 +56,7 @@ public: /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); virtual ~SketcherPrs_SymbolPrs(); @@ -66,7 +65,6 @@ public: const SelectMgr_SequenceOfOwner& theOwners); //! Method which hilight an owner belonging to - //! this selectable object ( for fast presentation draw ) Standard_EXPORT virtual void HilightOwnerWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM, const Handle(Prs3d_Drawer)& theStyle, diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index bf998d812..46db38c8e 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -40,9 +40,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane) + SketchPlugin_Sketch* theSketcher) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher) { } diff --git a/src/SketcherPrs/SketcherPrs_Tangent.h b/src/SketcherPrs/SketcherPrs_Tangent.h index 6da05ce52..d8e06aac6 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.h +++ b/src/SketcherPrs/SketcherPrs_Tangent.h @@ -38,10 +38,8 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane); + SketchPlugin_Sketch* theSketcher); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs) diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index ed54c1258..78d35e008 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -42,10 +42,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Transformation, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, + SketchPlugin_Sketch* theSketcher, bool isTranslation) - : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane), myIsTranslation(isTranslation) + : SketcherPrs_SymbolPrs(theConstraint, theSketcher), myIsTranslation(isTranslation) { } diff --git a/src/SketcherPrs/SketcherPrs_Transformation.h b/src/SketcherPrs/SketcherPrs_Transformation.h index e68397ff4..1119c4516 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.h +++ b/src/SketcherPrs/SketcherPrs_Transformation.h @@ -38,12 +38,9 @@ public: /// Constructor /// \param theConstraint a constraint feature /// \param theSketcher a sketcher object - /// \param thePlane a coordinate plane of current sketch /// \param isTranslation a flag is it translation or rotation Standard_EXPORT SketcherPrs_Transformation(ModelAPI_Feature* theConstraint, - ModelAPI_CompositeFeature* theSketcher, - const std::shared_ptr& thePlane, - bool isTranslation); + SketchPlugin_Sketch* theSketcher, bool isTranslation); DEFINE_STANDARD_RTTIEXT(SketcherPrs_Transformation, SketcherPrs_SymbolPrs) -- 2.39.2