myExpression[0]->setValue(theX);
myExpression[1]->setValue(theY);
owner()->data()->sendAttributeUpdated(this);
+
+ // Testing moving a point with event
+ // auto anOriginalPosition = std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(x(), y()));
+ // auto aCurrentPosition = std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY));
+
+ // AttributePtr aPoint = owner()->data()->attribute(this->id());
+ // const bool isImmutable = aPoint->setImmutable(true);
+
+ // std::shared_ptr<ModelAPI_ObjectMovedMessage> aMessage =
+ // std::shared_ptr<ModelAPI_ObjectMovedMessage>(new ModelAPI_ObjectMovedMessage(this));
+ // aMessage->setMovedAttribute(aPoint, -1);
+ // aMessage->setOriginalPosition(anOriginalPosition);
+ // aMessage->setCurrentPosition(aCurrentPosition);
+ // Events_Loop::loop()->send(aMessage);
+
+ // aPoint->setImmutable(isImmutable);
}
}
)
SET(PROJECT_LIBRARIES
+ ${KERNEL_SALOMELocalTrace}
ModuleBase
ModelGeomAlgo
Config
SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES})
SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES})
-INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI
+INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS}
+ ${PROJECT_SOURCE_DIR}/src/XGUI
${PROJECT_SOURCE_DIR}/src/Config
${PROJECT_SOURCE_DIR}/src/Events
${PROJECT_SOURCE_DIR}/src/Locale
#include <set>
+#include "utilities.h"
+
//#define DEBUG_DO_NOT_BY_ENTER
//#define DEBUG_SKETCHER_ENTITIES
//#define DEBUG_SKETCH_ENTITIES_ON_MOVE
if (anAttr.get() == NULL)
continue;
std::string aAttrId = anAttr->id();
+ MESSAGE("onMouse attr: " << aAttrId);
DataPtr aData = aFeature->data();
if (aData->isValid()) {
AttributePtr aPoint = aData->attribute(aAttrId);
if (aPoint->attributeType() == GeomDataAPI_Point2D::typeId() ||
aPoint->attributeType() == GeomDataAPI_Point2DArray::typeId()) {
bool isImmutable = aPoint->setImmutable(true);
-
+ MESSAGE("move point " << anOriginalPosition->x() << ", " << anOriginalPosition->y())
std::shared_ptr<ModelAPI_ObjectMovedMessage> aMessage = std::shared_ptr
<ModelAPI_ObjectMovedMessage>(new ModelAPI_ObjectMovedMessage(this));
aMessage->setMovedAttribute(aPoint, anAttIt->second);
# coincidences between center point and diagonals
attr = self.__getPoint2DAttrOfSketchPoint(self.refattr(self.CENTER_REF_ID()))
if attr is not None:
+ # aCoincidence = self.__sketch.addFeature("SketchConstraintMiddle")
+ # anAlgoType = aCoincidence.string("middle_type")
+ # anAlgoType.setValue("middle_type_by_line_and_point")
+ # aCoincidence.refattr("ConstraintEntityA").setAttr(attr)
+ # aCoincidence.refattr("ConstraintEntityB").setObject(aDiag1.lastResult())
+
+ # # Debug output
+ # center_point = GeomDataAPI.geomDataAPI_Point2D(attr).pnt()
+ # print('center_point: ', center_point.x(), center_point.y())
+
for line in [aDiag1.lastResult(), aDiag2.lastResult()]:
aCoincidence = self.__sketch.addFeature("SketchConstraintCoincidence")
aCoincidence.refattr("ConstraintEntityA").setAttr(attr)
)
SET(PROJECT_LIBRARIES
+ ${KERNEL_SALOMELocalTrace}
Config
GeomAPI
GeomAlgoAPI
TARGET_LINK_LIBRARIES(SketchPlugin ${PROJECT_LIBRARIES})
INCLUDE_DIRECTORIES(
+ ${KERNEL_INCLUDE_DIRS}
../Config
../Events
../Locale
#include <SketchPlugin_Point.h>
#include <SketchPlugin_Tools.h>
+#include "utilities.h"
+
class RaiiSetBoolFlag {
public:
// Create new point for Middle constraint
void SketchPlugin_ConstraintMiddle::CreatePoint()
{
+ MESSAGE("Create point starts...");
// Wait all objects being created, then send update events
static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent);
Events_Loop::loop()->setFlushed(anUpdateEvent, false);
auto aTrPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(POINT_REF_ID()));
+ MESSAGE("aTrPnt:" << aTrPnt->pnt()->x() << ", " << aTrPnt->pnt()->y());
if (!myPoint)
{
AttributePoint2DPtr aCoord = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
myPoint->attribute(SketchPlugin_Point::COORD_ID()));
aCoord->setValue(aTrPnt->pnt());
+ MESSAGE("aCoord:" << aCoord->pnt()->x() << ", " << aCoord->pnt()->y());
myPoint->execute();
void SketchPlugin_ConstraintMiddle::initAttributes()
{
+ MESSAGE("=============== START ==============");
+ MESSAGE("Init middle constraint attributes...");
+ MESSAGE("====================================");
// To maintain compatibility with older study versions, keep the order of all previously existing attributes:
// 1) ENTITY_A
// 2) ENTITY_B
void SketchPlugin_ConstraintMiddle::execute()
{
+ MESSAGE("Execute(): string(MIDDLE_TYPE())->value(): " << string(MIDDLE_TYPE())->value() << "; MIDDLE_TYPE_BY_LINE(): " << MIDDLE_TYPE_BY_LINE());
if (string(MIDDLE_TYPE())->value() == MIDDLE_TYPE_BY_LINE())
{
+ MESSAGE("string(MIDDLE_TYPE())->value() == MIDDLE_TYPE_BY_LINE() is TRUE");
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(POINT_REF_ID()))->setValue(1., 1.);
AttributeRefAttrPtr aPointRes = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
data()->attribute(SketchPlugin_Constraint::ENTITY_B()));
void SketchPlugin_ConstraintMiddle::attributeChanged(const std::string& theID)
{
+ MESSAGE("attributeChanged! theID: " << theID);
if (theID == MIDDLE_TYPE())
{
if (!myBlockAttribInit) {
AttributePoint2DPtr aCoord = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
myPoint->attribute(SketchPlugin_Point::COORD_ID()));
aCoord->setValue(aTrPnt->pnt());
+ MESSAGE("aCoord:" << aCoord->pnt()->x() << ", " << aCoord->pnt()->y());
myPoint->execute();
}
#include <GeomDataAPI_Point2D.h>
+#include "utilities.h"
+
SketchPlugin_Line::SketchPlugin_Line()
: SketchPlugin_SketchEntity()
{}
// LCOV_EXCL_START
std::string SketchPlugin_Line::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
+ MESSAGE("processEvent(): ID" << theMessage->eventID().eventText());
std::string aFilledAttributeName;
std::shared_ptr<ModelAPI_EventReentrantMessage> aReentrantMessage =
std::shared_ptr<ModelAPI_Data> aNFData = data();
std::shared_ptr<GeomDataAPI_Point2D> aNPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aNFData->attribute(SketchPlugin_Line::START_ID()));
+ MESSAGE("END: " << aSPoint->x() << ", " << aSPoint->y() << "; START: " << aNPoint->x() << ", " << aNPoint->y());
aNPoint->setValue(aSPoint->x(), aSPoint->y());
SketchPlugin_ConstraintCoincidence::createCoincidenceFeature(sketch(), aSPoint, aNPoint);
}
}
void SketchPlugin_Line::attributeChanged(const std::string& theID) {
+ MESSAGE("attributeChanged(): " << theID);
// the second condition for unability to move external segments anywhere
// isCopy() is checked temporary for case when copied lines stored external id state
// to be removed after debug
GeomDataAPI_Point2D>(data()->attribute(END_ID()));
if (aStartAttr->isInitialized() && anEndAttr->isInitialized()) {
double aDistance = aStartAttr->pnt()->distance(anEndAttr->pnt());
+ MESSAGE("START: " << aStartAttr->pnt()->x() << ", " << aStartAttr->pnt()->y() << "; END: " << anEndAttr->pnt()->x() << ", " << anEndAttr->pnt()->y());
data()->real(LENGTH_ID())->setValue(aDistance);
+ SCRUTE(aDistance);
}
}
)
SET(SKETCHSOLVER_LIBRARIES
+ ${KERNEL_SALOMELocalTrace}
Config
Events
ModelAPI
)
INCLUDE_DIRECTORIES(
+ ${KERNEL_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/Config
${PROJECT_SOURCE_DIR}/src/SketchPlugin
${PROJECT_SOURCE_DIR}/src/ModelAPI
#include <SketchPlugin_ConstraintAngle.h>
#include <SketchPlugin_MultiRotation.h>
+#include "utilities.h"
+
PlaneGCSSolver_AttributeBuilder::PlaneGCSSolver_AttributeBuilder(
PlaneGCSSolver_Storage* theStorage)
: PlaneGCSSolver_EntityBuilder(theStorage)
[](double* theParam) { delete theParam; });
}
}
-
+ MESSAGE("update for entity attr: " << theAttribute->attributeType());
return isUpdated || theEntity->update(theAttribute);
}
#include <GeomDataAPI_Point2D.h>
+#include "utilities.h"
+
PlaneGCSSolver_PointWrapper::PlaneGCSSolver_PointWrapper(const GCSPointPtr thePoint)
: myPoint(thePoint)
{
std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
if (aPoint2D) {
+ const double x = *(myPoint->x);
+ const double y = *(myPoint->y);
isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->x(), *(myPoint->x)) || isUpdated;
isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->y(), *(myPoint->y)) || isUpdated;
+ MESSAGE("a: " << aPoint2D->x() << ", " << aPoint2D->y() << "; my: " << x << ", " << y << "; updated: " << isUpdated);
}
return isUpdated;
}
#include <PlaneGCSSolver_Solver.h>
#include <Events_LongOp.h>
+#include "utilities.h"
+
// Multiplier to correlate IDs of SketchPlugin constraint and primitive PlaneGCS constraints
static const int THE_CONSTRAINT_MULT = 100;
anIt != theConstraints.end(); ++anIt) {
GCSConstraintPtr aConstraint = *anIt;
aConstraint->setTag(anID);
+ MESSAGE("addConstraint, ID: " << anID);
myEquationSystem->addConstraint(aConstraint.get());
if (anID > CID_UNKNOWN)
void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID& theID)
{
+ MESSAGE("removeConstraint, theID: " << theID);
ConstraintMap::iterator aFound = myConstraints.find(theID);
if (aFound != myConstraints.end()) {
for (std::list<GCSConstraintPtr>::iterator anIt = aFound->second.begin();
void PlaneGCSSolver_Solver::addParameters(const GCS::SET_pD& theParams)
{
+ MESSAGE("addParameters()");
GCS::SET_pD aParams(theParams);
// leave new parameters only
GCS::VEC_pD::iterator anIt = myParameters.begin();
void PlaneGCSSolver_Solver::initialize()
{
+ MESSAGE("initialize()");
Events_LongOp::start(this);
addFictiveConstraintIfNecessary();
if (myDiagnoseBeforeSolve)
PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Solver::solve()
{
+ MESSAGE("solve()");
// clear list of conflicting constraints
if (myConfCollected) {
myConflictingIDs.clear();
if (myParameters.empty())
return myConstraints.empty() ? STATUS_OK : STATUS_INCONSISTENT;
+ if (!myInitilized)
+ initialize();
+
GCS::SolveStatus aResult = GCS::Success;
Events_LongOp::start(this);
- if (myInitilized) {
- aResult = (GCS::SolveStatus)myEquationSystem->solve();
- } else {
- addFictiveConstraintIfNecessary();
- diagnose();
- aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters);
- }
+ aResult = (GCS::SolveStatus)myEquationSystem->solve();
+ // if (myInitilized) {
+ // aResult = (GCS::SolveStatus)myEquationSystem->solve();
+ // } else {
+ // addFictiveConstraintIfNecessary();
+ // diagnose();
+ // aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters);
+ // }
if (aResult == GCS::Failed) {
// DogLeg solver failed without conflicting constraints, try to use Levenberg-Marquardt solver
removeFictiveConstraint();
myInitilized = false;
+ SCRUTE(aStatus);
return aStatus;
}
#include <cmath>
+#include "utilities.h"
+
static void constraintsToSolver(const ConstraintWrapperPtr& theConstraint,
const SolverPtr& theSolver)
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
EntityWrapperPtr aRelated = entity(theFeature);
+ MESSAGE("update(): theFeature: " << theFeature->getKind());
if (aRelated) // send signal to subscribers
sendNotify = true;
else { // Feature is not exist, create it
}
// send notification to listeners due to at least one attribute is changed
+ MESSAGE("sendNotify: " << sendNotify << " ; isUpdated: " << isUpdated);
if (sendNotify && isUpdated)
notify(theFeature);
bool PlaneGCSSolver_Storage::update(AttributePtr theAttribute, bool theForce)
{
+ MESSAGE("update attr: " << theAttribute->attributeType());
if (!theAttribute->isInitialized())
return false;
PlaneGCSSolver_AttributeBuilder aBuilder(aRelated->isExternal() ? 0 : this);
bool isUpdated = aBuilder.updateAttribute(anAttribute, aRelated);
+ SCRUTE(isUpdated);
if (isUpdated) {
setNeedToResolve(true);
notify(aFeature);
void PlaneGCSSolver_Storage::adjustParametrizationOfArcs()
{
+ MESSAGE("adjustParametrizationOfArcs()!!!");
std::map<EntityWrapperPtr, ConstraintWrapperPtr>::iterator anIt = myAuxConstraintMap.begin();
for (; anIt != myAuxConstraintMap.end(); ++anIt) {
EdgeWrapperPtr anEdge = std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(anIt->first);
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPointWrapper =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(anIt->second);
GCSPointPtr aGCSPoint = aPointWrapper->point();
+ MESSAGE("P1: " << aPoint2D->x() << ", " << aPoint2D->y() << "; P2: " << (*aGCSPoint->x) << ", " << (*aGCSPoint->y));
if (fabs(aPoint2D->x() - (*aGCSPoint->x)) > aTol ||
fabs(aPoint2D->y() - (*aGCSPoint->y)) > aTol) {
+ MESSAGE("Set new value!!!");
aPoint2D->setValue(*aGCSPoint->x, *aGCSPoint->y);
addOwnerToSet(anIt->first, anUpdatedFeatures);
}
#include <cmath>
+#include "utilities.h"
+
#define GCS_EDGE_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(x)
#define GCS_POINT_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(x)
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoint2 = GCS_POINT_WRAPPER(thePoint2);
std::shared_ptr<PlaneGCSSolver_EdgeWrapper> anEntity1 = GCS_EDGE_WRAPPER(theEntity1);
+ MESSAGE("createConstraint(): " << theType);
switch (theType) {
case CONSTRAINT_PT_PT_COINCIDENT:
aResult = createConstraintCoincidence(aPoint1, aPoint2);
std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity,
std::shared_ptr<PlaneGCSSolver_PointWrapper> theAuxParameters)
{
+ MESSAGE("createConstraintMiddlePoint()");
std::list<GCSConstraintPtr> aConstrList;
GCSPointPtr aPoint = thePoint->point();
#include <SketchPlugin_ConstraintCollinear.h>
#include <SketchPlugin_ConstraintMiddle.h>
+#include "utilities.h"
+
static bool hasSamePoint(const std::set<EntityWrapperPtr>& theList,
const EntityWrapperPtr& thePoint);
void PlaneGCSSolver_UpdateCoincidence::update(const FeaturePtr& theFeature)
{
+ MESSAGE("update() " << theFeature->getKind());
if (theFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID() ||
theFeature->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID() ||
theFeature->getKind() == SketchPlugin_ConstraintMiddle::ID() ||
// notify listeners and stop procesing
std::list<SketchSolver_Constraint*>::iterator anIt = myObservers.begin();
for (; anIt != myObservers.end(); ++anIt)
+ {
+ MESSAGE("notify constraint: " << (*anIt)->getType());
(*anIt)->notify(theFeature, this);
+ }
} else
+ {
+ MESSAGE("update next...");
myNext->update(theFeature);
+ }
}
static bool hasAnotherExternalPoint(const std::set<EntityWrapperPtr>& theCoincidences,
#include <PlaneGCSSolver_UpdateFeature.h>
#include <SketchSolver_Constraint.h>
+#include "utilities.h"
+
void PlaneGCSSolver_UpdateFeature::attach(SketchSolver_Constraint* theObserver,
const std::string& theType)
{
void PlaneGCSSolver_UpdateFeature::update(const FeaturePtr& theFeature)
{
+ MESSAGE("update() " << theFeature->getKind());
std::list<SketchSolver_Constraint*>::iterator anIt = myObservers.begin();
for (; anIt != myObservers.end(); ++anIt)
+ {
+ MESSAGE("notify constraint: " << (*anIt)->getType());
(*anIt)->notify(theFeature, this);
+ }
}
#include <math.h>
+#include "utilities.h"
+
SketchSolver_Constraint::SketchSolver_Constraint(
ConstraintPtr theConstraint)
: myBaseConstraint(theConstraint),
void SketchSolver_Constraint::process()
{
+ MESSAGE("process()");
cleanErrorMsg();
if (!myBaseConstraint || !myStorage) {
// Not enough parameters are assigned
bool SketchSolver_Constraint::remove()
{
+ MESSAGE("remove()");
cleanErrorMsg();
myType = CONSTRAINT_UNKNOWN;
myStorage->unsubscribeUpdates(this);
#include <PlaneGCSSolver_Tools.h>
#include <PlaneGCSSolver_UpdateCoincidence.h>
+#include "utilities.h"
+
static bool isArc(EntityWrapperPtr theEntity)
{
+ MESSAGE("isArc(): SketchSolver_EntityType: " << theEntity->type());
return theEntity->type() == ENTITY_ARC || theEntity->type() == ENTITY_ELLIPTIC_ARC;
}
bool SketchSolver_ConstraintMiddle::remove()
{
+ MESSAGE("remove()");
if (myOddPoint) {
std::shared_ptr<PlaneGCSSolver_Storage> aStorage =
std::dynamic_pointer_cast<PlaneGCSSolver_Storage>(myStorage);
void SketchSolver_ConstraintMiddle::notify(const FeaturePtr& theFeature,
PlaneGCSSolver_Update* theUpdater)
{
+ MESSAGE("notify()");
if (theFeature == myBaseConstraint && myInSolver) {
// the constraint is already being updated,
// update the middle point parameter if the constraint is "point-on-arc".
+ SCRUTE(myOddPoint);
if (myOddPoint) {
EntityWrapperPtr anArcEntity =
isArc(myAttributes.front()) ? myAttributes.front() : myAttributes.back();
PlaneGCSSolver_UpdateCoincidence* anUpdater =
static_cast<PlaneGCSSolver_UpdateCoincidence*>(theUpdater);
bool isAccepted = anUpdater->addCoincidence(myAttributes.front(), myAttributes.back());
+ SCRUTE(isAccepted);
+ SCRUTE(myInSolver);
if (isAccepted) {
if (!myInSolver) {
myInSolver = true;
+ SCRUTE(myMiddle);
if (myMiddle) {
// remove previously adde constraint
myStorage->removeConstraint(myBaseConstraint);
#include <cmath>
+#include "utilities.h"
+
#define GCS_EDGE_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(x)
#define GCS_POINT_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(x)
void SketchSolver_ConstraintPerpendicular::process()
{
+ MESSAGE("process()");
cleanErrorMsg();
if (!myBaseConstraint || !myStorage) {
// Not enough parameters are assigned
void SketchSolver_ConstraintPerpendicular::rebuild()
{
+ MESSAGE("rebuild()");
if (mySolverConstraint)
myStorage->removeConstraint(myBaseConstraint);
void SketchSolver_ConstraintPerpendicular::notify(const FeaturePtr& theFeature,
PlaneGCSSolver_Update* theUpdater)
{
+ MESSAGE("notify()");
if (theFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID())
return;
static std::set<FeaturePtr> collectCoincidences(FeaturePtr theFeature1, FeaturePtr theFeature2)
{
+ MESSAGE("collectCoincidences()");
const std::set<AttributePtr>& aRefs1 = theFeature1->data()->refsToMe();
const std::set<AttributePtr>& aRefs2 = theFeature2->data()->refsToMe();
+ MESSAGE("Refs to feature 1: " << aRefs1.size());
+ MESSAGE("Refs to feature 2: " << aRefs2.size());
+
std::set<FeaturePtr> aCoincidences;
std::set<AttributePtr>::const_iterator anIt;
aCoincidences.insert(aRef);
}
+ MESSAGE("Num of coincidences for 1: " << aCoincidences.size());
+
// leave only coincidences referred to the second feature
std::set<FeaturePtr> aCoincidencesBetweenFeatures;
for (anIt = aRefs2.begin(); anIt != aRefs2.end(); ++anIt) {
aCoincidencesBetweenFeatures.insert(aRef);
}
+ MESSAGE("Num of coincidences for both: " << aCoincidencesBetweenFeatures.size());
return aCoincidencesBetweenFeatures;
}
std::set<AttributePtr> coincidentBoundaryPoints(FeaturePtr theFeature1, FeaturePtr theFeature2)
{
+ MESSAGE("coincidentBoundaryPoints()");
std::set<FeaturePtr> aCoincidences = collectCoincidences(theFeature1, theFeature2);
// collect points only
std::set<AttributePtr> aCoincidentPoints;
anAttrB->id() != SketchPlugin_Circle::CENTER_ID()) {
aCoincidentPoints.insert(anAttrA);
aCoincidentPoints.insert(anAttrB);
+ MESSAGE("Added A / B: " << anAttrA->id() << " / " << anAttrB->id());
}
}
+
+ MESSAGE("Collected points: " << aCoincidentPoints.size());
return aCoincidentPoints;
}
const std::set<AttributePtr>& aResRefs = (*anIt)->data()->refsToMe();
aRefs.insert(aResRefs.begin(), aResRefs.end());
}
+ MESSAGE("refsToFeatureAndResults: " << aRefs.size());
return aRefs;
}
// collect all points coincident with the feature
static std::set<AttributePtr> pointsOnFeature(FeaturePtr theFeature)
{
+ MESSAGE("pointsOnFeature()");
std::set<AttributePtr> aPoints;
std::set<AttributePtr> aRefs = refsToFeatureAndResults(theFeature);
}
}
}
+ MESSAGE("pointsOnFeature: " << aPoints.size());
return aPoints;
}
std::set<AttributePtr> coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFeature2)
{
+ MESSAGE("coincidentPoints()");
std::set<AttributePtr> aPointsOnF1 = pointsOnFeature(theFeature1);
std::set<AttributePtr> aPointsOnF2 = pointsOnFeature(theFeature2);
anIt != aPointsOnF1.end(); ++anIt)
if (aPointsOnF2.find(*anIt) != aPointsOnF2.end())
aCommonPoints.insert(*anIt);
+ MESSAGE("Added common points: " << aCommonPoints.size());
return aCommonPoints;
}
void calculateIntersectionPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr theCurve2,
GCSPointPtr& theIntersectionPoint)
{
+ MESSAGE("calculateIntersectionPoint()");
std::shared_ptr<GeomAPI_Ellipse2d> anEllipse = PlaneGCSSolver_Tools::ellipse(theCurve1);
EntityWrapperPtr aCurve2 = theCurve2;
if (!anEllipse) {
#include <Config_Translator.h>
+#include "utilities.h"
+
static void sendMessage(const char* theMessageName)
{
bool aResolved = false;
bool isGroupEmpty = isEmpty() && myStorage->isEmpty();
+ MESSAGE("resolveConstraints(): isGroupEmpty: " << isGroupEmpty);
if (myStorage->isNeedToResolve() &&
(!isGroupEmpty || !myConflictingConstraints.empty() ||
myPrevResult == PlaneGCSSolver_Solver::STATUS_FAILED)) {
#include <ModelAPI_Validator.h>
#include <SketchPlugin_Sketch.h>
+#include "utilities.h"
+
/// Global constraint manager object
static SketchSolver_Manager* myManager = SketchSolver_Manager::instance();
return;
myIsComputed = true;
+ MESSAGE("processEvent(): ID" << theMessage->eventID().eventText());
if (theMessage->eventID() == aCreatedEvent || theMessage->eventID() == anUpdateEvent) {
std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
#include <SketchPlugin_ConstraintMirror.h>
#include <SketchPlugin_ConstraintRigid.h>
+#include "utilities.h"
+
SketchSolver_Storage::SketchSolver_Storage(SolverPtr theSolver)
: mySketchSolver(theSolver),
void SketchSolver_Storage::addEntity(AttributePtr theAttribute,
EntityWrapperPtr theSolverEntity)
{
+ MESSAGE("addEntity()")
if (theSolverEntity) {
myAttributeMap[theAttribute] = theSolverEntity;
setNeedToResolve(true);
#include <SketchPlugin_Arc.h>
#include <SketchPlugin_ConstraintMiddle.h>
+#include "utilities.h"
+
/** \brief Search the entity/parameter with specified ID in the list of elements
* \param[in] theEntityID unique ID of the element
* \param[in] theEntities list of elements
void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const
{
+ MESSAGE("refresh()");
//blockEvents(true);
std::map<AttributePtr, EntityWrapperPtr>::const_iterator anIt = myAttributeMap.begin();