std::shared_ptr<GeomAPI_Shape> aCircleShape;
if(!isInversed->value()) {
- aCircleShape =
+ aCircleShape =
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
} else {
- aCircleShape =
+ aCircleShape =
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal);
}
bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
if (aHasPlane) {
std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
- std::shared_ptr<GeomAPI_Pnt>
+ std::shared_ptr<GeomAPI_Pnt>
aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
std::shared_ptr<GeomAPI_Pnt> aEndPoint = aStartPoint;
if (aTypeAttr && aTypeAttr->isInitialized() &&
aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
- if (aEndAttr->isInitialized() && //
+ if (aEndAttr->isInitialized() && //
aEndAttr->pnt()->distance(aStartAttr->pnt()) > tolerance) {
aEndPoint = aSketch->to3D(aEndAttr->x(), aEndAttr->y());
- std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
+ std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
data()->attribute(PASSED_POINT_ID()));
if (!aPassedAttr->isInitialized()) {
// check that center is bad for the current start and end and must be recomputed
std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(new GeomAPI_Circ2d(
aCenterAttr->pnt(), aStartAttr->pnt()));
- std::shared_ptr<GeomAPI_Pnt2d> aProjection =
+ std::shared_ptr<GeomAPI_Pnt2d> aProjection =
aCircleForArc->project(aEndAttr->pnt());
if (!aProjection.get() || aEndAttr->pnt()->distance(aProjection) > tolerance) {
- std::shared_ptr<GeomAPI_XY> aDir =
+ std::shared_ptr<GeomAPI_XY> aDir =
aEndAttr->pnt()->xy()->decreased(aStartAttr->pnt()->xy())->multiplied(0.5);
double x = aDir->x();
double y = aDir->y();
AttributeBooleanPtr isInversed =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()));
- std::shared_ptr<GeomAPI_Shape> aCircleShape =
+ std::shared_ptr<GeomAPI_Shape> aCircleShape =
(isInversed->isInitialized() && isInversed->value()) ?
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal) :
GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
}
}
// make a visible point
- std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
+ std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
GeomAlgoAPI_PointBuilder::vertex(aCenter);
aShapes.push_back(aCenterPointShape);
}
bool isValid = false;
if (anArcType == ARC_TYPE_THREE_POINTS())
- isValid = aStartAttr->isInitialized() &&
+ isValid = aStartAttr->isInitialized() &&
anEndAttr->isInitialized() && aPassedAttr->isInitialized();
else
- isValid = aCenterAttr->isInitialized() &&
+ isValid = aCenterAttr->isInitialized() &&
aStartAttr->isInitialized() && anEndAttr->isInitialized();
return isValid;
std::dynamic_pointer_cast<ModelAPI_AttributeString>(attribute(ARC_TYPE()));
// this is before others since here end attribute may be changed, but with the special behavior
- if (aTypeAttr->value() == ARC_TYPE_TANGENT() &&
+ if (aTypeAttr->value() == ARC_TYPE_TANGENT() &&
(theID == TANGENT_POINT_ID() || theID == END_ID())) {
SketchPlugin_Sketch* aSketch = sketch();
AttributeRefAttrPtr aTangPtAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
std::shared_ptr<GeomAPI_Pnt2d> aMidPnt(
new GeomAPI_Pnt2d(aEndPntCoord->added(aTangPnt2d->xy())->multiplied(0.5)));
- // compute center of arc by calculating intersection of
+ // compute center of arc by calculating intersection of
// orthogonal line and middle perpendicular
std::shared_ptr<GeomAPI_Lin2d> anOrthoLine(new GeomAPI_Lin2d(aTangPnt2d, anOrthoDir));
std::shared_ptr<GeomAPI_Lin2d> aMiddleLine(new GeomAPI_Lin2d(aMidPnt, aMidDir));
}
}
// update all other attributes due to the base attributes values
- if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
+ if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
// update passed point due to start, end and center
if (aCenter->distance(aStart) > tolerance && aCenter->distance(anEnd) > tolerance) {
// project passed point t othe circle
std::shared_ptr<GeomAPI_Dir2d> aMidDir(new GeomAPI_Dir2d(aMidDirXY));
if ((aStartDir->cross(aMidDir) > 0) ^ !isReversed())
aMidDir->reverse();
- std::shared_ptr<GeomAPI_XY> aPassedPnt =
+ std::shared_ptr<GeomAPI_XY> aPassedPnt =
aCenter->xy()->added(aMidDir->xy()->multiplied(aCenter->distance(aStart)));
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()))->
setValue(aPassedPnt->x(), aPassedPnt->y());
adjustPeriod(aStartParam);
adjustPeriod(aEndParam);
// use the passed point for the angle calculation
- if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
+ if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()));
double aPassedParam;
}
if (theID == RADIUS_ID()) {
- if (!aStartAttr->isInitialized() || !anEndAttr->isInitialized() ||
+ if (!aStartAttr->isInitialized() || !anEndAttr->isInitialized() ||
!aCenterAttr->isInitialized())
return;
// move center and passed point
double aRadius = aRadiusAttr->value();
data()->blockSendAttributeUpdated(true);
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
aStartDir(new GeomAPI_Dir2d(aStart->xy()->decreased(aCenter->xy())));
- std::shared_ptr<GeomAPI_XY>
+ std::shared_ptr<GeomAPI_XY>
aNewStart = aStartDir->xy()->multiplied(aRadius)->added(aCenter->xy());
aStartAttr->setValue(aNewStart->x(), aNewStart->y());
- std::shared_ptr<GeomAPI_Dir2d>
+ std::shared_ptr<GeomAPI_Dir2d>
anEndDir(new GeomAPI_Dir2d(anEnd->xy()->decreased(aCenter->xy())));
- std::shared_ptr<GeomAPI_XY>
+ std::shared_ptr<GeomAPI_XY>
aNewEnd = anEndDir->xy()->multiplied(aRadius)->added(aCenter->xy());
anEndAttr->setValue(aNewEnd->x(), aNewEnd->y());
data()->blockSendAttributeUpdated(false);