Sketcher: Sketch solver interface using geometry state extension for BSpline knot checks

========================================================================================

Until this commit, B-Spline knots were stored, and checked at solver level as sketch points GeomPoints having the
construction status set to true.

This behaviour is removed to eventually enable normal non-construction points to define the shape out of edit mode.

This commit leverages the new mechanism for the solver interface.
This commit is contained in:
Abdullah Tahiri
2020-11-21 07:30:58 +01:00
committed by abdullahtahiriyo
parent 02737a3b5b
commit ffe2ecaa4a

View File

@@ -58,6 +58,8 @@
#include "Sketch.h"
#include "Constraint.h"
#include "GeometryFacade.h"
using namespace Sketcher;
using namespace Base;
using namespace Part;
@@ -320,12 +322,13 @@ int Sketch::addGeometry(const Part::Geometry *geo, bool fixed)
{
if (geo->getTypeId() == GeomPoint::getClassTypeId()) { // add a point
const GeomPoint *point = static_cast<const GeomPoint*>(geo);
auto pointf = GeometryFacade::getFacade(point);
// create the definition struct for that geom
if( point->getConstruction() == false ) {
return addPoint(*point, fixed);
if( pointf->getInternalType() == InternalType::BSplineKnotPoint ) {
return addPoint(*point, true);
}
else {
return addPoint(*point, true);
return addPoint(*point, fixed);
}
} else if (geo->getTypeId() == GeomLineSegment::getClassTypeId()) { // add a line
const GeomLineSegment *lineSeg = static_cast<const GeomLineSegment*>(geo);
@@ -2898,8 +2901,9 @@ bool Sketch::updateGeometry()
try {
if (it->type == Point) {
GeomPoint *point = static_cast<GeomPoint*>(it->geo);
auto pointf = GeometryFacade::getFacade(point);
if(!point->getConstruction()) {
if(!(pointf->getInternalType() == InternalType::BSplineKnotPoint)) {
point->setPoint(Vector3d(*Points[it->startPointId].x,
*Points[it->startPointId].y,
0.0)
@@ -3051,7 +3055,9 @@ bool Sketch::updateGeometry()
if (Geoms[*it5].type == Point) {
GeomPoint *point = static_cast<GeomPoint*>(Geoms[*it5].geo);
if(point->getConstruction()) {
auto pointf = GeometryFacade::getFacade(point);
if(pointf->getInternalType() == InternalType::BSplineKnotPoint) {
point->setPoint(bsp->pointAtParameter(knots[index]));
}
}