From a85c123c5bc7c48588a5cd648110d66ae1544f8c Mon Sep 17 00:00:00 2001 From: Sergey BELASH Date: Wed, 20 Aug 2014 11:48:14 +0400 Subject: [PATCH] bugfix for libSketchSolver.so: removing unresolved symbols from the SketchPlugin * SketchPlugin_Constraint extracted as interface for the SketchSolver * SketchPlugin_Constraint base implemnetation for the SketchPlugin became SketchPlugin_ConstraintBase * Refactoring: boost::shared_ptr typedefed as AISObjectPtr --- src/GeomAPI/GeomAPI_AISObject.h | 3 + src/GeomAPI/GeomAPI_IPresentable.h | 5 +- src/SketchPlugin/CMakeLists.txt | 3 +- src/SketchPlugin/SketchPlugin_Arc.h | 3 +- src/SketchPlugin/SketchPlugin_Circle.h | 3 +- src/SketchPlugin/SketchPlugin_Constraint.cpp | 11 ---- src/SketchPlugin/SketchPlugin_Constraint.h | 55 ++-------------- .../SketchPlugin_ConstraintBase.cpp | 25 ++++++++ .../SketchPlugin_ConstraintBase.h | 63 +++++++++++++++++++ .../SketchPlugin_ConstraintCoincidence.h | 4 +- .../SketchPlugin_ConstraintDistance.cpp | 9 ++- .../SketchPlugin_ConstraintDistance.h | 7 +-- .../SketchPlugin_ConstraintLength.cpp | 7 +-- .../SketchPlugin_ConstraintLength.h | 7 +-- .../SketchPlugin_ConstraintParallel.cpp | 7 +-- .../SketchPlugin_ConstraintParallel.h | 7 +-- .../SketchPlugin_ConstraintPerpendicular.cpp | 7 +-- .../SketchPlugin_ConstraintPerpendicular.h | 7 +-- .../SketchPlugin_ConstraintRadius.cpp | 7 +-- .../SketchPlugin_ConstraintRadius.h | 7 +-- src/SketchPlugin/SketchPlugin_Feature.cpp | 8 +-- src/SketchPlugin/SketchPlugin_Feature.h | 4 +- src/SketchPlugin/SketchPlugin_Line.h | 3 +- src/SketchPlugin/SketchPlugin_Point.h | 3 +- src/SketchPlugin/SketchPlugin_Sketch.cpp | 9 ++- src/SketchPlugin/SketchPlugin_Sketch.h | 3 +- src/SketchSolver/CMakeLists.txt | 2 +- 27 files changed, 149 insertions(+), 130 deletions(-) delete mode 100644 src/SketchPlugin/SketchPlugin_Constraint.cpp create mode 100644 src/SketchPlugin/SketchPlugin_ConstraintBase.cpp create mode 100644 src/SketchPlugin/SketchPlugin_ConstraintBase.h diff --git a/src/GeomAPI/GeomAPI_AISObject.h b/src/GeomAPI/GeomAPI_AISObject.h index 12b29708b..215aa69b7 100644 --- a/src/GeomAPI/GeomAPI_AISObject.h +++ b/src/GeomAPI/GeomAPI_AISObject.h @@ -98,5 +98,8 @@ public: bool empty() const; }; +//! Pointer on attribute object +typedef boost::shared_ptr AISObjectPtr; + #endif diff --git a/src/GeomAPI/GeomAPI_IPresentable.h b/src/GeomAPI/GeomAPI_IPresentable.h index abb154170..c300c1b42 100644 --- a/src/GeomAPI/GeomAPI_IPresentable.h +++ b/src/GeomAPI/GeomAPI_IPresentable.h @@ -16,10 +16,9 @@ public: /** Returns the AIS preview * \param thePrevious - defines a presentation if it was created previously */ - virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious) = 0; + virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) = 0; }; typedef boost::shared_ptr GeomPresentablePtr; -#endif \ No newline at end of file +#endif diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index 2cbe3e324..6895c3deb 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -11,6 +11,7 @@ SET(PROJECT_HEADERS SketchPlugin_Circle.h SketchPlugin_Arc.h SketchPlugin_Constraint.h + SketchPlugin_ConstraintBase.h SketchPlugin_ConstraintCoincidence.h SketchPlugin_ConstraintDistance.h SketchPlugin_ConstraintLength.h @@ -28,7 +29,7 @@ SET(PROJECT_SOURCES SketchPlugin_Point.cpp SketchPlugin_Circle.cpp SketchPlugin_Arc.cpp - SketchPlugin_Constraint.cpp + SketchPlugin_ConstraintBase.cpp SketchPlugin_ConstraintCoincidence.cpp SketchPlugin_ConstraintDistance.cpp SketchPlugin_ConstraintLength.cpp diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index 3af4e2fd3..26815bc9e 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -54,8 +54,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious) + virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) {return simpleAISObject(firstResult(), thePrevious);} /// Moves the feature diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index 3b8dc851b..5c7cc7aa7 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -49,8 +49,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious) + virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) {return simpleAISObject(firstResult(), thePrevious);} /// Adds sub-feature of the higher level feature (sub-element of the sketch) diff --git a/src/SketchPlugin/SketchPlugin_Constraint.cpp b/src/SketchPlugin/SketchPlugin_Constraint.cpp deleted file mode 100644 index 70e4d7be6..000000000 --- a/src/SketchPlugin/SketchPlugin_Constraint.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// File: SketchPlugin_Constraint.cpp -// Created: 08 May 2014 -// Author: Artem ZHIDKOV - -#include "SketchPlugin_Constraint.h" - -boost::shared_ptr SketchPlugin_Constraint::getAISObject( - boost::shared_ptr thePrevious) -{ - return thePrevious; -} diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index 5417111e3..01fbe230f 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -5,40 +5,18 @@ #ifndef SketchPlugin_Constraint_H_ #define SketchPlugin_Constraint_H_ -#include "SketchPlugin.h" -#include "SketchPlugin_Feature.h" -#include -#include -#include +#include -#include - -#include - - -/* Description: - * Each constraint uses a set of parameters. In the SolveSpace library - * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". - * The "ptA" and "ptB" parameters represents a point in the constraint. - * The "entityA" and "entityB" represents any other object (and a point too). - * And the "valA" represents a real value. - * - * The attributes below are named independent of the SolveSpace. - * Some of them may be unused. - * - * Also the list of possible attributes is provided to simplify assignment. - */ +#include /// Size of the list of constraint attributes const unsigned int CONSTRAINT_ATTR_SIZE = 4; /** \class SketchPlugin_Constraint - * \ingroup DataModel - * \brief Feature for creation of a new constraint between other features. - * Base class for all constraints. + * \brief Abstract interface to the SketchPlugin_ConstraintBase + * For more info see: SketchPlugin_ConstraintBase.h */ -class SketchPlugin_Constraint: public SketchPlugin_Feature, - public GeomAPI_IPresentable +class SketchPlugin_Constraint: public SketchPlugin_Feature { public: /// The value parameter for the constraint @@ -91,29 +69,6 @@ public: return EMPTY_STRING; } - /// \brief Returns to which group in the document must be added feature - SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() - {static std::string MY_GROUP = SketchPlugin_Sketch::ID(); return MY_GROUP;} - - /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch) - * \param theFeature sub-feature - */ - SKETCHPLUGIN_EXPORT virtual const void addSub( - const FeaturePtr& theFeature) {} - - /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); - - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {}; - - /// Return the distance between the feature and the point - /// \param thePoint the point - virtual double distanceToPoint(const boost::shared_ptr& thePoint) { return 0; }; - protected: /// \brief Use plugin manager for features creation SketchPlugin_Constraint() {} diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp b/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp new file mode 100644 index 000000000..b743c0be3 --- /dev/null +++ b/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp @@ -0,0 +1,25 @@ +// File: SketchPlugin_ConstraintBase.cpp +// Created: 08 May 2014 +// Author: Artem ZHIDKOV + +#include "SketchPlugin_ConstraintBase.h" + +AISObjectPtr SketchPlugin_ConstraintBase::getAISObject(AISObjectPtr thePrevious) +{ + return thePrevious; +} + +const void SketchPlugin_ConstraintBase::addSub(const FeaturePtr& theFeature) +{ + +} + +void SketchPlugin_ConstraintBase::move(const double theDeltaX, const double theDeltaY) +{ + +} + +double SketchPlugin_ConstraintBase::distanceToPoint(const boost::shared_ptr& thePoint) +{ + return 0; +} diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.h b/src/SketchPlugin/SketchPlugin_ConstraintBase.h new file mode 100644 index 000000000..e08bf7682 --- /dev/null +++ b/src/SketchPlugin/SketchPlugin_ConstraintBase.h @@ -0,0 +1,63 @@ +// File: SketchPlugin_ConstraintBase.h +// Created: 08 May 2014 +// Author: Artem ZHIDKOV + +#ifndef SketchPlugin_ConstraintBase_H_ +#define SketchPlugin_ConstraintBase_H_ + +#include "SketchPlugin.h" +#include +#include +#include +#include + +#include + +#include + + +/* Description: + * Each constraint uses a set of parameters. In the SolveSpace library + * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". + * The "ptA" and "ptB" parameters represents a point in the constraint. + * The "entityA" and "entityB" represents any other object (and a point too). + * And the "valA" represents a real value. + * + * The attributes below are named independent of the SolveSpace. + * Some of them may be unused. + * + * Also the list of possible attributes is provided to simplify assignment. + */ + +/** \class SketchPlugin_ConstraintBase + * \ingroup DataModel + * \brief Feature for creation of a new constraint between other features. + * Some feature's methods implemented here as dummy to + * Base class for all constraints. + */ +class SketchPlugin_ConstraintBase: public SketchPlugin_Constraint, + public GeomAPI_IPresentable +{ +public: + /// Returns the AIS preview + SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + + /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch) + * \param theFeature sub-feature + */ + SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature); + /// Moves the feature + /// \param theDeltaX the delta for X coordinate is moved + /// \param theDeltaY the delta for Y coordinate is moved + SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); + + /// Return the distance between the feature and the point + /// \param thePoint the point + virtual double distanceToPoint(const boost::shared_ptr& thePoint); + +protected: + /// \brief Use plugin manager for features creation + SketchPlugin_ConstraintBase() {} +}; + +#endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h index 6345f59dc..e6595af30 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h @@ -6,7 +6,7 @@ #define SketchPlugin_ConstraintCoincidence_H_ #include "SketchPlugin.h" -#include "SketchPlugin_Constraint.h" +#include "SketchPlugin_ConstraintBase.h" #include #include @@ -17,7 +17,7 @@ * These constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintCoincidence: public SketchPlugin_Constraint +class SketchPlugin_ConstraintCoincidence: public SketchPlugin_ConstraintBase { public: /// Parallel constraint kind diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index 4d043e48b..ab8bba036 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -62,8 +62,7 @@ void SketchPlugin_ConstraintDistance::execute() } //************************************************************************************* -boost::shared_ptr SketchPlugin_ConstraintDistance::getAISObject( - boost::shared_ptr thePrevious) +AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; @@ -112,9 +111,9 @@ boost::shared_ptr SketchPlugin_ConstraintDistance::getAISObje boost::dynamic_pointer_cast(aData->attribute(SketchPlugin_Constraint::VALUE())); double aValue = aValueAttr->value(); - boost::shared_ptr anAIS = thePrevious; + AISObjectPtr anAIS = thePrevious; if (!anAIS) - anAIS = boost::shared_ptr(new GeomAPI_AISObject); + anAIS = AISObjectPtr(new GeomAPI_AISObject); anAIS->createDistance(aPoint1, aPoint2, aFlyoutPnt, aPlane, aValue); // Set color from preferences @@ -194,4 +193,4 @@ boost::shared_ptr getProjectionPoint(const boost::shared_ptrx(), aPoint1->y(), aPoint2->x(), aPoint2->y()); return aLin2d.project(thePoint); -} \ No newline at end of file +} diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index 790068b95..17d795a89 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -6,7 +6,7 @@ #define SketchPlugin_ConstraintDistance_H_ #include "SketchPlugin.h" -#include "SketchPlugin_Constraint.h" +#include "SketchPlugin_ConstraintBase.h" #include "SketchPlugin_Sketch.h" #include "ModelAPI_Data.h" @@ -25,7 +25,7 @@ class GeomDataAPI_Point2D; * These constraint has three attributes: * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintDistance: public SketchPlugin_Constraint +class SketchPlugin_ConstraintDistance: public SketchPlugin_ConstraintBase { public: /// Distance constraint kind @@ -46,8 +46,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); /// Moves the feature /// \param theDeltaX the delta for X coordinate is moved diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index fcd4a4053..248a9d2c0 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -54,8 +54,7 @@ void SketchPlugin_ConstraintLength::execute() } } -boost::shared_ptr SketchPlugin_ConstraintLength::getAISObject( - boost::shared_ptr thePrevious) +AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; @@ -90,9 +89,9 @@ boost::shared_ptr SketchPlugin_ConstraintLength::getAISObject boost::dynamic_pointer_cast(data()->attribute(SketchPlugin_Constraint::VALUE())); double aValue = aValueAttr->value(); - boost::shared_ptr anAIS = thePrevious; + AISObjectPtr anAIS = thePrevious; if (!anAIS) - anAIS = boost::shared_ptr(new GeomAPI_AISObject); + anAIS = AISObjectPtr(new GeomAPI_AISObject); anAIS->createDistance(aPoint1, aPoint2, aFlyoutPnt, aPlane, aValue); // Set color from preferences diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.h b/src/SketchPlugin/SketchPlugin_ConstraintLength.h index 461cb5ac8..33afa8814 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.h @@ -6,7 +6,7 @@ #define SketchPlugin_ConstraintLength_H_ #include "SketchPlugin.h" -#include "SketchPlugin_Constraint.h" +#include "SketchPlugin_ConstraintBase.h" #include #include @@ -20,7 +20,7 @@ * SketchPlugin_Constraint::VALUE() (length) and SketchPlugin_Constraint::ENTITY_A() (segment), * SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints handle) */ -class SketchPlugin_ConstraintLength: public SketchPlugin_Constraint +class SketchPlugin_ConstraintLength: public SketchPlugin_ConstraintBase { public: /// Length constraint kind @@ -40,8 +40,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); /// Moves the feature /// \param theDeltaX the delta for X coordinate is moved diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp index e9bcfd0a3..c39b4b3db 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp @@ -32,8 +32,7 @@ void SketchPlugin_ConstraintParallel::execute() { } -boost::shared_ptr SketchPlugin_ConstraintParallel::getAISObject( - boost::shared_ptr thePrevious) +AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; @@ -75,9 +74,9 @@ boost::shared_ptr SketchPlugin_ConstraintParallel::getAISObje boost::dynamic_pointer_cast(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); boost::shared_ptr aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); - boost::shared_ptr anAIS = thePrevious; + AISObjectPtr anAIS = thePrevious; if (!anAIS) - anAIS = boost::shared_ptr(new GeomAPI_AISObject); + anAIS = AISObjectPtr(new GeomAPI_AISObject); anAIS->createParallel(aLine1, aLine2, aFlyoutPnt, aPlane); // Set color from preferences diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h index 6e02e1c99..9a77a7a7b 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h @@ -7,7 +7,7 @@ #include "SketchPlugin.h" #include -#include "SketchPlugin_Constraint.h" +#include "SketchPlugin_ConstraintBase.h" #define PARALLEL_COLOR "#ffff00" @@ -19,7 +19,7 @@ * These constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintParallel: public SketchPlugin_Constraint +class SketchPlugin_ConstraintParallel: public SketchPlugin_ConstraintBase { public: /// Parallel constraint kind @@ -39,8 +39,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); /// Moves the feature /// \param theDeltaX the delta for X coordinate is moved diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp index df192e8d9..826fc50b8 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp @@ -32,8 +32,7 @@ void SketchPlugin_ConstraintPerpendicular::execute() { } -boost::shared_ptr SketchPlugin_ConstraintPerpendicular::getAISObject( - boost::shared_ptr thePrevious) +AISObjectPtr SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; @@ -71,9 +70,9 @@ boost::shared_ptr SketchPlugin_ConstraintPerpendicular::getAI boost::dynamic_pointer_cast(anAttr2->object()); if (aConst2) aLine2 = aConst2->shape(); - boost::shared_ptr anAIS = thePrevious; + AISObjectPtr anAIS = thePrevious; if (!anAIS) - anAIS = boost::shared_ptr(new GeomAPI_AISObject); + anAIS = AISObjectPtr(new GeomAPI_AISObject); anAIS->createPerpendicular(aLine1, aLine2, aPlane); // Set color from preferences diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h index ac565f076..b0bc7ff9e 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h @@ -7,7 +7,7 @@ #include "SketchPlugin.h" #include -#include "SketchPlugin_Constraint.h" +#include "SketchPlugin_ConstraintBase.h" #define PERPENDICULAR_COLOR "#ffff00" @@ -18,7 +18,7 @@ * These constraint has two attributes: * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintPerpendicular: public SketchPlugin_Constraint +class SketchPlugin_ConstraintPerpendicular: public SketchPlugin_ConstraintBase { public: /// Perpendicular constraint kind @@ -38,8 +38,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); /// Moves the feature /// \param theDeltaX the delta for X coordinate is moved diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index 31b253d54..c4ab146e2 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -64,8 +64,7 @@ void SketchPlugin_ConstraintRadius::execute() } } -boost::shared_ptr SketchPlugin_ConstraintRadius::getAISObject( - boost::shared_ptr thePrevious) +AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePrevious) { if (!sketch()) return thePrevious; @@ -117,9 +116,9 @@ boost::shared_ptr SketchPlugin_ConstraintRadius::getAISObject if (aValueAttr && aValueAttr->isInitialized()) aValue = aValueAttr->value(); - boost::shared_ptr anAIS = thePrevious; + AISObjectPtr anAIS = thePrevious; if (!anAIS) - anAIS = boost::shared_ptr(new GeomAPI_AISObject); + anAIS = AISObjectPtr(new GeomAPI_AISObject); anAIS->createRadius(aCircle, aFlyoutPnt, aValue); // Set color from preferences diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h index a6f1e16ae..f330a31ec 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h @@ -7,7 +7,7 @@ #include "SketchPlugin.h" #include -#include "SketchPlugin_Constraint.h" +#include "SketchPlugin_ConstraintBase.h" #define RADIUS_COLOR "#ff00ff" @@ -19,7 +19,7 @@ * These constraint has two attributes: * SketchPlugin_Constraint::VALUE() (radius), SketchPlugin_Constraint::ENTITY_A() (a circle) */ -class SketchPlugin_ConstraintRadius: public SketchPlugin_Constraint +class SketchPlugin_ConstraintRadius: public SketchPlugin_ConstraintBase { public: /// Radius constraint kind @@ -38,8 +38,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); + SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); /// Moves the feature /// \param theDeltaX the delta for X coordinate is moved diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index acb48d055..4edfeb8f9 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -35,8 +35,8 @@ SketchPlugin_Sketch* SketchPlugin_Feature::sketch() return mySketch; } -boost::shared_ptr SketchPlugin_Feature::simpleAISObject( - boost::shared_ptr theRes, boost::shared_ptr thePrevious) +AISObjectPtr SketchPlugin_Feature::simpleAISObject( + boost::shared_ptr theRes, AISObjectPtr thePrevious) { boost::shared_ptr aConstr = boost::dynamic_pointer_cast(theRes); @@ -44,9 +44,9 @@ boost::shared_ptr SketchPlugin_Feature::simpleAISObject( boost::shared_ptr aPreview; if (aConstr) aPreview = aConstr->shape(); - boost::shared_ptr aResult = thePrevious; + AISObjectPtr aResult = thePrevious; if (!aResult) - aResult = boost::shared_ptr(new GeomAPI_AISObject()); + aResult = AISObjectPtr(new GeomAPI_AISObject()); aResult->createShape(aPreview); return aResult; } diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index 093bf0258..439f1b4f0 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -24,8 +24,8 @@ class SketchPlugin_Feature: public ModelAPI_Feature { public: /// Simple creation of interactive object by the result of the object - static boost::shared_ptr simpleAISObject( - boost::shared_ptr theRes, boost::shared_ptr thePrevious); + static AISObjectPtr simpleAISObject( + boost::shared_ptr theRes, AISObjectPtr thePrevious); /// Adds sub-feature of the higher level feature (sub-element of the sketch) /// \param theFeature sub-feature diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index 370f26bfb..636b7337d 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -47,8 +47,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious) + SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) {return simpleAISObject(firstResult(), thePrevious);} /// Moves the feature diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index c60526163..fddf2ef5a 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -40,8 +40,7 @@ public: SKETCHPLUGIN_EXPORT virtual void initAttributes(); /// Returns the AIS preview - virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious) + virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) {return simpleAISObject(firstResult(), thePrevious);} /// Moves the feature diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index 0b0381ab7..9236aa008 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -140,14 +140,13 @@ void addPlane(double theX, double theY, double theZ, std::list SketchPlugin_Sketch:: - getAISObject(boost::shared_ptr thePrevious) +AISObjectPtr SketchPlugin_Sketch::getAISObject(AISObjectPtr thePrevious) { boost::shared_ptr aNorm = boost::dynamic_pointer_cast(data()->attribute(SketchPlugin_Sketch::NORM_ID())); if (!aNorm || (aNorm->x() == 0 && aNorm->y() == 0 && aNorm->z() == 0)) { - boost::shared_ptr aAIS = thePrevious; + AISObjectPtr aAIS = thePrevious; if (!aAIS) { std::list > aFaces; @@ -155,7 +154,7 @@ boost::shared_ptr SketchPlugin_Sketch:: addPlane(0, 1, 0, aFaces); // XZ plane addPlane(0, 0, 1, aFaces); // XY plane boost::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces); - aAIS = boost::shared_ptr(new GeomAPI_AISObject()); + aAIS = AISObjectPtr(new GeomAPI_AISObject()); aAIS->createShape(aCompound); std::vector aRGB = Config_PropManager::color("Sketch definition", @@ -169,5 +168,5 @@ boost::shared_ptr SketchPlugin_Sketch:: } return aAIS; } - return boost::shared_ptr(); + return AISObjectPtr(); } diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index c0845fa85..0d5d6ea0a 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -102,8 +102,7 @@ public: /// Returns the basis plane for the sketch boost::shared_ptr plane(); - virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); + virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); protected: /// Creates a plane and append it to the list diff --git a/src/SketchSolver/CMakeLists.txt b/src/SketchSolver/CMakeLists.txt index ae85208d3..46ffb3d91 100644 --- a/src/SketchSolver/CMakeLists.txt +++ b/src/SketchSolver/CMakeLists.txt @@ -34,7 +34,7 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS(-DSKETCHSOLVER_EXPORTS ${BOOST_DEFINITIONS}) -ADD_LIBRARY(SketchSolver SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} +ADD_LIBRARY(SketchSolver MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ) TARGET_LINK_LIBRARIES(SketchSolver ${PROJECT_LIBRARIES} -- 2.39.2