Fix build errors with Sketcher, Support of workbenches with delayed retrieval of class name

This commit is contained in:
wmayer 2012-03-22 19:59:50 +01:00
parent ac75725737
commit 723d6cde00
4 changed files with 15 additions and 8 deletions

View File

@ -947,6 +947,13 @@ bool Application::activateWorkbench(const char* name)
// import the matching module first
Py::Callable activate(handler.getAttr(std::string("Initialize")));
activate.apply(args);
// Dependent on the implementation of a workbench handler the type
// can be defined after the call of Initialize()
if (type.empty()) {
Py::String result(method.apply(args));
type = result.as_std_string();
}
}
// does the Python workbench handler have changed the workbench?

View File

@ -276,7 +276,7 @@ namespace GCS
bool internal;
public:
ConstraintTangentCircumf(Point &p1, Point &p2,
double *rad1, double *rad2, bool internal_=false);
double *rd1, double *rd2, bool internal_=false);
virtual ConstraintType getTypeId();
virtual void rescale(double coef=1.);
virtual double error();

View File

@ -407,9 +407,9 @@ int System::addConstraintTangentCircle2Arc(Circle &c, Arc &a, int tagId)
double dx = *(a.start.x) - *(c.center.x);
double dy = *(a.start.y) - *(c.center.y);
if (dx * cos(*(a.startAngle)) + dy * sin(*(a.startAngle)) > 0)
addConstraintP2PAngle(c.center, a.start, a.startAngle, 0, tagId);
return addConstraintP2PAngle(c.center, a.start, a.startAngle, 0, tagId);
else
addConstraintP2PAngle(c.center, a.start, a.startAngle, M_PI, tagId);
return addConstraintP2PAngle(c.center, a.start, a.startAngle, M_PI, tagId);
}
int System::addConstraintTangentArc2Circle(Arc &a, Circle &c, int tagId)
@ -418,9 +418,9 @@ int System::addConstraintTangentArc2Circle(Arc &a, Circle &c, int tagId)
double dx = *(a.end.x) - *(c.center.x);
double dy = *(a.end.y) - *(c.center.y);
if (dx * cos(*(a.endAngle)) + dy * sin(*(a.endAngle)) > 0)
addConstraintP2PAngle(c.center, a.end, a.endAngle, 0, tagId);
return addConstraintP2PAngle(c.center, a.end, a.endAngle, 0, tagId);
else
addConstraintP2PAngle(c.center, a.end, a.endAngle, M_PI, tagId);
return addConstraintP2PAngle(c.center, a.end, a.endAngle, M_PI, tagId);
}
int System::addConstraintTangentArc2Arc(Arc &a1, bool reverse1, Arc &a2, bool reverse2,
@ -433,9 +433,9 @@ int System::addConstraintTangentArc2Arc(Arc &a1, bool reverse1, Arc &a2, bool re
double *angle1 = reverse1 ? a1.startAngle : a1.endAngle;
double *angle2 = reverse2 ? a2.endAngle : a2.startAngle;
if (cos(*angle1) * cos(*angle2) + sin(*angle1) * sin(*angle2) > 0)
addConstraintEqual(angle1, angle2, tagId);
return addConstraintEqual(angle1, angle2, tagId);
else
addConstraintP2PAngle(p2, a2.center, angle1, 0, tagId);
return addConstraintP2PAngle(p2, a2.center, angle1, 0, tagId);
}
int System::addConstraintCircleRadius(Circle &c, double *radius, int tagId)

View File

@ -101,7 +101,7 @@ namespace GCS
int addConstraintMidpointOnLine(Line &l1, Line &l2, int tagId=0);
int addConstraintMidpointOnLine(Point &l1p1, Point &l1p2, Point &l2p1, Point &l2p2,
int tagId=0);
int addConstraintTangentCircumf(Point &p1, Point &p2, double *rad1, double *rad2,
int addConstraintTangentCircumf(Point &p1, Point &p2, double *rd1, double *rd2,
bool internal=false, int tagId=0);
// derived constraints