From: azv Date: Thu, 22 May 2014 07:19:41 +0000 (+0400) Subject: SketchSolver: porting to Linux (changes for independance of SketchSolver and SketchPl... X-Git-Tag: V_0.2~29^2^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=69a95dfb5edc800765f9b3dc030f34a9b01fa14d;p=modules%2Fshaper.git SketchSolver: porting to Linux (changes for independance of SketchSolver and SketchPlugin) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 05f077144..bef4cdee8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,6 @@ PROJECT (NewGEOM) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH}) -SET(CMAKE_SHARED_LINKER_FLAGS "${SMAKE_SHARED_LINKER_FLAGS} -Wl,-E") - INCLUDE(Common) INCLUDE(FindQt) INCLUDE(FindBoost) @@ -19,6 +17,7 @@ IF(UNIX) MESSAGE(STATUS "Setting -std=c++0x flag for the gcc...") MESSAGE(STATUS "Now gcc flags are: " ${CMAKE_CXX_FLAGS}) + SET(CMAKE_SHARED_LINKER_FLAGS "${SMAKE_SHARED_LINKER_FLAGS} -Wl,-E") ENDIF(CMAKE_COMPILER_IS_GNUCC) ENDIF(UNIX) diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index 37b92f35d..f5a122f47 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -36,6 +36,8 @@ boost::shared_ptr PartSet_OperationSketchBase::preview( if (anObj) aFeature = boost::dynamic_pointer_cast(anObj->featureRef()); } + if (!aFeature) + return boost::shared_ptr(); return aFeature->preview(); } diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index 8c2796b0d..60fb882c0 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -23,11 +23,12 @@ SET(PROJECT_SOURCES SET(PROJECT_LIBRARIES GeomAPI GeomAlgoAPI + ModelAPI ) ADD_DEFINITIONS(-DSKETCHPLUGIN_EXPORTS ${BOOST_DEFINITIONS}) ADD_LIBRARY(SketchPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS}) -TARGET_LINK_LIBRARIES(SketchPlugin ${PROJECT_LIBRARIES} ModelAPI GeomAPI GeomAlgoAPI) +TARGET_LINK_LIBRARIES(SketchPlugin ${PROJECT_LIBRARIES}) INCLUDE_DIRECTORIES( ../ModelAPI diff --git a/src/SketchSolver/CMakeLists.txt b/src/SketchSolver/CMakeLists.txt index 20cd14b87..4656f25d5 100644 --- a/src/SketchSolver/CMakeLists.txt +++ b/src/SketchSolver/CMakeLists.txt @@ -15,6 +15,8 @@ SET(PROJECT_SOURCES SET(PROJECT_LIBRARIES ${SLVS_LIBRARIES} Events + ModelAPI + Model ) INCLUDE_DIRECTORIES( diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index bf9ad5e10..c83e865b8 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -19,6 +19,7 @@ #include #include +#include /// Tolerance for value of parameters const double tolerance = 1.e-10; @@ -26,7 +27,7 @@ const double tolerance = 1.e-10; // Initialization of constraint manager self pointer SketchSolver_ConstraintManager* SketchSolver_ConstraintManager::_self = 0; -/// Global constaint manager object +/// Global constraint manager object SketchSolver_ConstraintManager* myManager = SketchSolver_ConstraintManager::Instance(); /// This value is used to give unique index to the groups @@ -60,6 +61,7 @@ SketchSolver_ConstraintManager::SketchSolver_ConstraintManager() Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_CREATED)); Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_UPDATED)); Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_DELETED)); + Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURES_MOVED)); } SketchSolver_ConstraintManager::~SketchSolver_ConstraintManager() @@ -75,34 +77,29 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa const Model_FeatureUpdatedMessage* aUpdateMsg = dynamic_cast(theMessage); // Only sketches and constraints can be added by Create event - boost::shared_ptr aSketch = - boost::dynamic_pointer_cast(aUpdateMsg->feature()); - if (aSketch) + const std::string& aFeatureKind = aUpdateMsg->feature()->getKind(); + if (aFeatureKind.compare("Sketch") == 0) { + boost::shared_ptr aSketch = + boost::dynamic_pointer_cast(aUpdateMsg->feature()); changeWorkplane(aSketch); return ; } - boost::shared_ptr aConstraint = + boost::shared_ptr aConstraint = boost::dynamic_pointer_cast(aUpdateMsg->feature()); if (aConstraint) - { changeConstraint(aConstraint); - - // Solve the set of constraints - resolveConstraints(); - return ; - } - - // Sketch plugin features only can be updated - boost::shared_ptr aFeature = - boost::dynamic_pointer_cast(aUpdateMsg->feature()); - if (aFeature) + else { - updateEntity(aFeature); - - // Solve the set of constraints - resolveConstraints(); + // Sketch plugin features can be only updated + boost::shared_ptr aFeature = + boost::dynamic_pointer_cast(aUpdateMsg->feature()); + if (aFeature) + updateEntity(aFeature); } + + // Solve the set of constraints + resolveConstraints(); } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_DELETED)) { @@ -126,7 +123,7 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa } } -bool SketchSolver_ConstraintManager::changeWorkplane(boost::shared_ptr theSketch) +bool SketchSolver_ConstraintManager::changeWorkplane(boost::shared_ptr theSketch) { bool aResult = true; // changed when a workplane wrongly updated bool isUpdated = false; @@ -164,7 +161,7 @@ bool SketchSolver_ConstraintManager::changeConstraint( // Process the groups list if (aGroups.size() == 0) { // There are no groups applicable for this constraint => create new one - boost::shared_ptr aWP = findWorkplaneForConstraint(theConstraint); + boost::shared_ptr aWP = findWorkplaneForConstraint(theConstraint); if (!aWP) return false; SketchSolver_ConstraintGroup* aGroup = new SketchSolver_ConstraintGroup(aWP); if (!aGroup->changeConstraint(theConstraint)) @@ -196,15 +193,12 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr anAttrList; + const std::string& aFeatureKind = theFeature->getKind(); // Point - boost::shared_ptr aPoint = - boost::dynamic_pointer_cast(theFeature); - if (aPoint) + if (aFeatureKind.compare("SketchPoint") == 0) anAttrList.push_back(POINT_ATTR_COORD); // Line - boost::shared_ptr aLine = - boost::dynamic_pointer_cast(theFeature); - if (aLine) + else if (aFeatureKind.compare("SketchLine") == 0) { anAttrList.push_back(LINE_ATTR_START); anAttrList.push_back(LINE_ATTR_END); @@ -218,7 +212,7 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr::iterator aGroupIter; for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) { - boost::shared_ptr anAttribute = + boost::shared_ptr anAttribute = boost::dynamic_pointer_cast(theFeature->data()->attribute(*anAttrIter)); (*aGroupIter)->updateEntityIfPossible(anAttribute); } @@ -227,10 +221,10 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr theConstraint, + boost::shared_ptr theConstraint, std::vector& theGroupIDs) const { - boost::shared_ptr aWP = findWorkplaneForConstraint(theConstraint); + boost::shared_ptr aWP = findWorkplaneForConstraint(theConstraint); std::vector::const_iterator aGroupIter; for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) @@ -238,14 +232,14 @@ void SketchSolver_ConstraintManager::findGroups( theGroupIDs.push_back((*aGroupIter)->getId()); } -boost::shared_ptr SketchSolver_ConstraintManager::findWorkplaneForConstraint( +boost::shared_ptr SketchSolver_ConstraintManager::findWorkplaneForConstraint( boost::shared_ptr theConstraint) const { std::vector::const_iterator aGroupIter; for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) { - boost::shared_ptr aWP = (*aGroupIter)->getWorkplane(); - boost::shared_ptr aWPFeatures = + boost::shared_ptr aWP = (*aGroupIter)->getWorkplane(); + boost::shared_ptr aWPFeatures = boost::dynamic_pointer_cast(aWP->data()->attribute(SKETCH_ATTR_FEATURES)); std::list< boost::shared_ptr > aFeaturesList = aWPFeatures->list(); std::list< boost::shared_ptr >::const_iterator anIter; @@ -254,12 +248,12 @@ boost::shared_ptr SketchSolver_ConstraintManager::findWorkp return aWP; // workplane is found } - return boost::shared_ptr(); + return boost::shared_ptr(); } void SketchSolver_ConstraintManager::resolveConstraints() { - std::vector::iterator aGroupIter; + std::vector::iterator aGroupIter; for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) (*aGroupIter)->resolveConstraints(); } @@ -271,7 +265,7 @@ void SketchSolver_ConstraintManager::resolveConstraints() // ======================================================== SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup:: - SketchSolver_ConstraintGroup(boost::shared_ptr theWorkplane) + SketchSolver_ConstraintGroup(boost::shared_ptr theWorkplane) : myID(++myGroupIndexer), myParamMaxID(0), myEntityMaxID(0), @@ -286,7 +280,7 @@ SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup:: // Initialize workplane myWorkplane.h = SLVS_E_UNKNOWN; - addWorkplane(theWorkplane); + assert(addWorkplane(theWorkplane)); } SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::~SketchSolver_ConstraintGroup() @@ -302,7 +296,7 @@ SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::~SketchSolver_Cons } bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::isBaseWorkplane( - boost::shared_ptr theWorkplane) const + boost::shared_ptr theWorkplane) const { return theWorkplane == mySketch; } @@ -337,7 +331,7 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::changeConstra // Get constraint type and verify the constraint parameters are correct int aConstrType = getConstraintType(theConstraint); - if (aConstrType == SLVS_C_UNKNOWN || + if (aConstrType == SLVS_C_UNKNOWN || (aConstrMapIter != myConstraintMap.end() && aConstrIter->type != aConstrType)) return false; @@ -359,7 +353,7 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::changeConstra for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) { aConstrEnt[indAttr] = SLVS_E_UNKNOWN; - boost::shared_ptr aConstrAttr = + boost::shared_ptr aConstrAttr = boost::dynamic_pointer_cast( theConstraint->data()->attribute(CONSTRAINT_ATTRIBUTES[indAttr]) ); @@ -370,8 +364,8 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::changeConstra if (aConstrMapIter == myConstraintMap.end()) { // Create SolveSpace constraint structure - Slvs_Constraint aConstraint = - Slvs_MakeConstraint(++myConstrMaxID, myID, aConstrType, myWorkplane.h, + Slvs_Constraint aConstraint = + Slvs_MakeConstraint(++myConstrMaxID, myID, aConstrType, myWorkplane.h, aDistance, aConstrEnt[0], aConstrEnt[1], aConstrEnt[2], aConstrEnt[3]); myConstraints.push_back(aConstraint); myConstraintMap[theConstraint] = aConstraint.h; @@ -398,7 +392,7 @@ Slvs_hEntity SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::chang // Look over supported types of entities // Point in 3D - boost::shared_ptr aPoint = + boost::shared_ptr aPoint = boost::dynamic_pointer_cast(theEntity); if (aPoint) { @@ -417,7 +411,7 @@ Slvs_hEntity SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::chang } // Point in 2D - boost::shared_ptr aPoint2D = + boost::shared_ptr aPoint2D = boost::dynamic_pointer_cast(theEntity); if (aPoint2D) { @@ -438,29 +432,29 @@ Slvs_hEntity SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::chang } /// \todo Other types of entities - + // Unsupported or wrong entity type return SLVS_E_UNKNOWN; } Slvs_hEntity SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::changeNormal( - boost::shared_ptr theDirX, - boost::shared_ptr theDirY, + boost::shared_ptr theDirX, + boost::shared_ptr theDirY, boost::shared_ptr theNorm) { - boost::shared_ptr aDirX = + boost::shared_ptr aDirX = boost::dynamic_pointer_cast(theDirX); - boost::shared_ptr aDirY = + boost::shared_ptr aDirY = boost::dynamic_pointer_cast(theDirY); - if (!aDirX || !aDirY || + if (!aDirX || !aDirY || (fabs(aDirX->x()) + fabs(aDirX->y()) + fabs(aDirX->z()) < tolerance) || (fabs(aDirY->x()) + fabs(aDirY->y()) + fabs(aDirY->z()) < tolerance)) return SLVS_E_UNKNOWN; // quaternion parameters of normal vector double qw, qx, qy, qz; - Slvs_MakeQuaternion(aDirX->x(), aDirX->y(), aDirX->z(), - aDirY->x(), aDirY->y(), aDirY->z(), + Slvs_MakeQuaternion(aDirX->x(), aDirX->y(), aDirX->z(), + aDirY->x(), aDirY->y(), aDirY->z(), &qw, &qx, &qy, &qz); double aNormCoord[4] = {qw, qx, qy, qz}; @@ -486,7 +480,7 @@ Slvs_hEntity SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::chang return aEntIter->second; // Create a normal - Slvs_Entity aNormal = Slvs_MakeNormal3d(++myEntityMaxID, myID, + Slvs_Entity aNormal = Slvs_MakeNormal3d(++myEntityMaxID, myID, aNormParams[0], aNormParams[1], aNormParams[2], aNormParams[3]); myEntities.push_back(aNormal); myEntityMap[theNorm] = aNormal.h; @@ -495,13 +489,14 @@ Slvs_hEntity SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::chang bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::addWorkplane( - boost::shared_ptr theSketch) + boost::shared_ptr theSketch) { - if (myWorkplane.h) - return false; // the workplane already exists + if (myWorkplane.h || theSketch->getKind().compare("Sketch") != 0) + return false; // the workplane already exists or the function parameter is not Sketch mySketch = theSketch; - return updateWorkplane(); + updateWorkplane(); + return true; } bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateWorkplane() @@ -529,7 +524,7 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateWorkpla Slvs_hParam SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::changeParameter( - const double& theParam, + const double& theParam, std::vector::const_iterator& thePrmIter) { if (thePrmIter != myParams.end()) @@ -556,23 +551,22 @@ Slvs_hParam SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::change int SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::getConstraintType( const boost::shared_ptr& theConstraint) const { + const std::string& aConstraintKind = theConstraint->getKind(); // Constraint for coincidence of two points - boost::shared_ptr aPtEquiv = - boost::dynamic_pointer_cast(theConstraint); - if (aPtEquiv) + if (aConstraintKind.compare("SketchConstraintCoincidence") == 0) { // Verify the constraint has only two attributes and they are points - int aPt2d = 0; // bit-mapped field, each bit indicates whether the attribute is 2D point + int aPt2d = 0; // bit-mapped field, each bit indicates whether the attribute is 2D point int aPt3d = 0; // bit-mapped field, the same information for 3D points for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) { - boost::shared_ptr anAttr = + boost::shared_ptr anAttr = boost::dynamic_pointer_cast( theConstraint->data()->attribute(CONSTRAINT_ATTRIBUTES[indAttr]) ); if (!anAttr) continue; // Verify the attribute is a 2D point - boost::shared_ptr aPoint2D = + boost::shared_ptr aPoint2D = boost::dynamic_pointer_cast(anAttr->attr()); if (aPoint2D) { @@ -580,7 +574,7 @@ int SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::getConstraintT continue; } // Verify the attribute is a 3D point - boost::shared_ptr aPoint3D = + boost::shared_ptr aPoint3D = boost::dynamic_pointer_cast(anAttr->attr()); if (aPoint3D) { @@ -658,7 +652,7 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateGroup() if (aConstrPos < (int)myConstraints.size()) { Slvs_hEntity aConstrEnt[] = { - myConstraints[aConstrPos].ptA, myConstraints[aConstrPos].ptB, + myConstraints[aConstrPos].ptA, myConstraints[aConstrPos].ptB, myConstraints[aConstrPos].entityA, myConstraints[aConstrPos].entityB}; for (int i = 0; i < 4; i++) if (aConstrEnt[i] != SLVS_E_UNKNOWN) @@ -697,7 +691,7 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateGroup() myParamMaxID -= aNbParams; // Remove parameters of the entity int aParamPos = Search(aEntIter->param[0], myParams); - myParams.erase(myParams.begin() + aParamPos, + myParams.erase(myParams.begin() + aParamPos, myParams.begin() + aParamPos + aNbParams); // Remove entity @@ -718,7 +712,7 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateGroup() } void SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateAttribute( - boost::shared_ptr theAttribute, + boost::shared_ptr theAttribute, const Slvs_hEntity& theEntityID) { // Search the position of the first parameter of the entity @@ -728,7 +722,7 @@ void SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateAttribu // Look over supported types of entities // Point in 3D - boost::shared_ptr aPoint = + boost::shared_ptr aPoint = boost::dynamic_pointer_cast(theAttribute); if (aPoint) { @@ -739,7 +733,7 @@ void SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateAttribu } // Point in 2D - boost::shared_ptr aPoint2D = + boost::shared_ptr aPoint2D = boost::dynamic_pointer_cast(theAttribute); if (aPoint2D) { @@ -756,9 +750,9 @@ void SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateEntityI { if (myEntityMap.find(theEntity) != myEntityMap.end()) { - // If the attribute is a point and it is changed (the group needs to rebuild), - // probably user has dragged this point into this position, - // so it is necessary to add constraint which will quarantee the point will not change + // If the attribute is a point and it is changed (the group needs to rebuild), + // probably user has dragged this point into this position, + // so it is necessary to add constraint which will guarantee the point will not change // Store myNeedToSolve flag to verify the entity is really changed bool aNeedToSolveCopy = myNeedToSolve; @@ -769,9 +763,9 @@ void SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::updateEntityI if (myNeedToSolve) // the entity is changed { // Verify the entity is a point and add temporary constraint of permanency - boost::shared_ptr aPoint = + boost::shared_ptr aPoint = boost::dynamic_pointer_cast(theEntity); - boost::shared_ptr aPoint2D = + boost::shared_ptr aPoint2D = boost::dynamic_pointer_cast(theEntity); if (aPoint || aPoint2D) addTemporaryConstraintWhereDragged(theEntity); @@ -790,7 +784,7 @@ void SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::addTemporaryC anEntIter = myEntityMap.find(theEntity); // Create WHERE_DRAGGED constraint - Slvs_Constraint aWDConstr = Slvs_MakeConstraint(++myConstrMaxID, myID, SLVS_C_WHERE_DRAGGED, + Slvs_Constraint aWDConstr = Slvs_MakeConstraint(++myConstrMaxID, myID, SLVS_C_WHERE_DRAGGED, myWorkplane.h, 0.0, anEntIter->second, 0, 0, 0); myConstraints.push_back(aWDConstr); myTempConstraints.push_back(aWDConstr.h); diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.h b/src/SketchSolver/SketchSolver_ConstraintManager.h index b96b6ea19..9cbb23bab 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.h +++ b/src/SketchSolver/SketchSolver_ConstraintManager.h @@ -26,7 +26,7 @@ /** \class SketchSolver_ConstraintManager * \ingroup DataModel - * \brief Listens the changes of SketchPlugin features and transforms the Constraint + * \brief Listens the changes of SketchPlugin features and transforms the Constraint * feature into the format understandable by SolveSpace library. * * Constraints created for SolveSpace library are divided into the groups. @@ -66,11 +66,12 @@ protected: /** \brief Adds or updates a workplane in the manager * \param[in] theSketch the feature to create or update workplane - * \return \c true if the workplane cahnged successfully + * \return \c true if the workplane changed successfully + * \remark Type of theSketch is not verified inside */ - bool changeWorkplane(boost::shared_ptr theSketch); + bool changeWorkplane(boost::shared_ptr theSketch); - /** \brief Removes a workplane from the manager. + /** \brief Removes a workplane from the manager. * All groups based on such workplane will be removed too. * \param[in] theSketch the feature to be removed * \return \c true if the workplane removed successfully @@ -93,14 +94,14 @@ private: * \param[in] theConstraint constraint to be found * \param[out] theGroups list of group indexes interacted with constraint */ - void findGroups(boost::shared_ptr theConstraint, + void findGroups(boost::shared_ptr theConstraint, std::vector& theGroupIDs) const; /** \brief Searches in the list of groups the workplane which constains specified constraint * \param[in] theConstraint constraint to be found - * \return workplane contains the constraint + * \return workplane containing the constraint */ - boost::shared_ptr findWorkplaneForConstraint( + boost::shared_ptr findWorkplaneForConstraint( boost::shared_ptr theConstraint) const; private: @@ -116,9 +117,11 @@ private: class SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup { public: - /** \brief New group based on specified workplane + /** \brief New group based on specified workplane. + * Throws an exception if theWorkplane is not an object of SketchPlugin_Sketch type + * \remark Type of theSketch is not verified inside */ - SketchSolver_ConstraintGroup(boost::shared_ptr theWorkplane); + SketchSolver_ConstraintGroup(boost::shared_ptr theWorkplane); ~SketchSolver_ConstraintGroup(); @@ -138,13 +141,13 @@ public: */ bool isInteract(boost::shared_ptr theConstraint) const; - /** \brief Verifies the specified workplane is the same as a base workplane for this group - * \param[in] theWorkplane workplane to be compared + /** \brief Verifies the specified feature is equal to the base workplane for this group + * \param[in] theWorkplane the feature to be compared with base workplane * \return \c true if workplanes are the same */ - bool isBaseWorkplane(boost::shared_ptr theWorkplane) const; + bool isBaseWorkplane(boost::shared_ptr theWorkplane) const; - boost::shared_ptr getWorkplane() const + boost::shared_ptr getWorkplane() const { return mySketch; } /** \brief Update parameters of workplane. Should be called when Update event is coming. @@ -179,10 +182,10 @@ protected: /** \brief Adds or updates a normal in the group * - * Normal is a special entity in SolveSpace, which defines a direction in 3D and + * Normal is a special entity in SolveSpace, which defines a direction in 3D and * a rotation about this direction. So, SolveSpace represents normals as unit quaternions. * - * To define a normal there should be specified two coordinate axis + * To define a normal there should be specified two coordinate axis * on the plane transversed to created normal. * * \param[in] theDirX first coordinate axis of the plane @@ -190,17 +193,17 @@ protected: * \param[in] theNorm attribute for the normal (used to identify newly created entity) * \return identifier of created or updated normal */ - Slvs_hEntity changeNormal(boost::shared_ptr theDirX, - boost::shared_ptr theDirY, + Slvs_hEntity changeNormal(boost::shared_ptr theDirX, + boost::shared_ptr theDirY, boost::shared_ptr theNorm); /** \brief Adds or updates a parameter in the group * \param[in] theParam the value of parameter - * \param[in] thePrmIter the cell in the list of parameters which should be changed + * \param[in] thePrmIter the cell in the list of parameters which should be changed * (the iterator will be increased if it does not reach the end of the list) * \return identifier of changed parameter; when the parameter cannot be created, returned ID is 0 */ - Slvs_hParam changeParameter(const double& theParam, + Slvs_hParam changeParameter(const double& theParam, std::vector::const_iterator& thePrmIter); /** \brief Compute constraint type according to SolveSpace identifiers @@ -230,7 +233,7 @@ private: * \param[in] theSketch parameters of workplane are the attributes of this sketch * \return \c true if success, \c false if workplane parameters are not consistent */ - bool addWorkplane(boost::shared_ptr theSketch); + bool addWorkplane(boost::shared_ptr theSketch); private: // SolveSpace entities @@ -247,12 +250,12 @@ private: SketchSolver_Solver myConstrSolver; ///< Solver for set of equations obtained by constraints // SketchPlugin entities - boost::shared_ptr mySketch; ///< Equivalent to workplane - std::map, Slvs_hConstraint> - myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints - std::list myTempConstraints; ///< The list of identifiers of temporary constraints + boost::shared_ptr mySketch; ///< Equivalent to workplane + std::map, Slvs_hConstraint> + myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints + std::list myTempConstraints; ///< The list of identifiers of temporary constraints std::map, Slvs_hEntity> - myEntityMap; ///< The map between parameters of constraints and their equivalent SolveSpace entities + myEntityMap; ///< The map between parameters of constraints and their equivalent SolveSpace entities }; #endif