Implement the possibility to collect underconstrained features in SketchSolver plugin.
myDiagnoseBeforeSolve = false;
}
+void PlaneGCSSolver_Solver::getFreeParameters(GCS::VEC_pD& theFreeParams) const
+{
+ myEquationSystem->getDependentParams(theFreeParams);
+}
+
void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary()
{
bool hasOnlyMovement = true;
/// \brief Check conflicting/redundant constraints and DoF
void diagnose(const GCS::Algorithm& theAlgo = GCS::DogLeg);
+ /// \brief Return the list of modifiable parameters
+ void getFreeParameters(GCS::VEC_pD& theFreeParams) const;
+
/// \brief Degrees of freedom
int dof();
}
return PlaneGCSSolver_Solver::STATUS_OK;
}
+
+
+void PlaneGCSSolver_Storage::getUnderconstrainedGeometry(std::set<FeaturePtr>& theFeatures) const
+{
+ std::vector<double*> aFreeParams;
+ mySketchSolver->getFreeParameters(aFreeParams);
+ if (aFreeParams.empty())
+ return;
+
+ std::map<double*, FeaturePtr> aParamOfFeatures;
+ for (std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIt = myFeatureMap.begin();
+ aFIt != myFeatureMap.end(); ++aFIt) {
+ GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(aFIt->second);
+ for (GCS::SET_pD::iterator aPIt = aParams.begin(); aPIt != aParams.end(); ++aPIt)
+ aParamOfFeatures[*aPIt] = aFIt->first;
+ }
+
+ for (std::vector<double*>::iterator anIt = aFreeParams.begin();
+ anIt != aFreeParams.end(); ++anIt) {
+ std::map<double*, FeaturePtr>::iterator aFound = aParamOfFeatures.find(*anIt);
+ if (aFound != aParamOfFeatures.end())
+ theFeatures.insert(aFound->second);
+ }
+}
/// Reversed arcs should have the last parameter lesser than the first parameter.
virtual void adjustParametrizationOfArcs();
+ /// \brief Return list of features which are not fully constrained
+ virtual void getUnderconstrainedGeometry(std::set<FeaturePtr>& theFeatures) const;
+
private:
/// \brief Convert feature using specified builder.
EntityWrapperPtr createFeature(const FeaturePtr& theFeature,
return false;
return true;
}
+
+void SketchSolver_Group::underconstrainedFeatures(std::set<FeaturePtr>& theFeatures) const
+{
+ myStorage->getUnderconstrainedGeometry(theFeatures);
+}
*/
bool resolveConstraints();
+ /// \brief Find the list of features, which are not fully constrained.
+ void underconstrainedFeatures(std::set<FeaturePtr>& theFeatures) const;
+
/// \brief Block or unblock events sent by features in this group
void blockEvents(bool isBlocked);
}
myIsComputed = false;
}
+//// else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURES_OF_FREEDOM)) {
+//// FeaturePtr aComposite = theMessage->sketch();
+//// std::shared_ptr<SketchPlugin_Feature> aSketch =
+//// std::dynamic_pointer_cast<SketchPlugin_Feature>(aComposite);
+//// if (aSketch) {
+//// SketchGroupPtr aGroup = findGroup(aSketch);
+////
+//// std::set<FeaturePtr> aFreeFeatures;
+//// aGroup->underconstrainedFeatures(aFreeFeatures);
+////
+//// // TODO: send features to GUI
+//// }
+//// }
// resolve constraints if needed
bool needToUpdate = needToResolve && resolveConstraints();
/// \brief Return list of conflicting constraints
std::set<ObjectPtr> getConflictingConstraints(SolverPtr theSolver) const;
+ /// \brief Return list of features which are not fully constrained
+ virtual void getUnderconstrainedGeometry(std::set<FeaturePtr>& theFeatures) const = 0;
+
/// \brief Verify, the sketch contains degenerated geometry
/// after resolving the set of constraints
/// \return STATUS_OK if the geometry is valid, STATUS_DEGENERATED otherwise.