rename 2d tool classes to be consistent with 3d classes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1247,21 +1247,21 @@ static const char *cursor_createcopy[]={
|
||||
{
|
||||
setCursor(QPixmap(cursor_createcopy),7,7);
|
||||
Origin = static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->getPoint(OriginGeoId, OriginPos);
|
||||
EditCurve[0] = Base::Vector2D(Origin.x,Origin.y);
|
||||
EditCurve[0] = Base::Vector2d(Origin.x,Origin.y);
|
||||
}
|
||||
|
||||
virtual void mouseMove(Base::Vector2D onSketchPos)
|
||||
virtual void mouseMove(Base::Vector2d onSketchPos)
|
||||
{
|
||||
if (Mode==STATUS_SEEK_First) {
|
||||
float length = (onSketchPos - EditCurve[0]).Length();
|
||||
float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2D(1.f,0.f));
|
||||
float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2d(1.f,0.f));
|
||||
SbString text;
|
||||
text.sprintf(" (%.1f,%.1fdeg)", length, angle * 180 / M_PI);
|
||||
setPositionText(onSketchPos, text);
|
||||
|
||||
EditCurve[1] = onSketchPos;
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.0,0.0),AutoConstraint::VERTEX)) {
|
||||
if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.0,0.0),AutoConstraint::VERTEX)) {
|
||||
renderSuggestConstraintsCursor(sugConstr1);
|
||||
return;
|
||||
}
|
||||
@@ -1270,7 +1270,7 @@ static const char *cursor_createcopy[]={
|
||||
applyCursor();
|
||||
}
|
||||
|
||||
virtual bool pressButton(Base::Vector2D onSketchPos)
|
||||
virtual bool pressButton(Base::Vector2d onSketchPos)
|
||||
{
|
||||
if (Mode==STATUS_SEEK_First){
|
||||
EditCurve[1] = onSketchPos;
|
||||
@@ -1281,12 +1281,12 @@ static const char *cursor_createcopy[]={
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool releaseButton(Base::Vector2D onSketchPos)
|
||||
virtual bool releaseButton(Base::Vector2d onSketchPos)
|
||||
{
|
||||
Q_UNUSED(onSketchPos);
|
||||
if (Mode==STATUS_End){
|
||||
|
||||
Base::Vector2D vector = EditCurve[1]-EditCurve[0];
|
||||
Base::Vector2d vector = EditCurve[1]-EditCurve[0];
|
||||
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
@@ -1300,7 +1300,7 @@ static const char *cursor_createcopy[]={
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc, "App.ActiveDocument.%s.addCopy(%s,App.Vector(%f,%f,0),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
geoIdList.c_str(), vector.fX, vector.fY,
|
||||
geoIdList.c_str(), vector.x, vector.y,
|
||||
(Clone?"True":"False"));
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
@@ -1336,7 +1336,7 @@ static const char *cursor_createcopy[]={
|
||||
Sketcher::PointPos OriginPos;
|
||||
int nElements;
|
||||
bool Clone;
|
||||
std::vector<Base::Vector2D> EditCurve;
|
||||
std::vector<Base::Vector2d> EditCurve;
|
||||
std::vector<AutoConstraint> sugConstr1;
|
||||
};
|
||||
|
||||
@@ -1692,21 +1692,21 @@ static const char *cursor_createrectangulararray[]={
|
||||
{
|
||||
setCursor(QPixmap(cursor_createrectangulararray),7,7);
|
||||
Origin = static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->getPoint(OriginGeoId, OriginPos);
|
||||
EditCurve[0] = Base::Vector2D(Origin.x,Origin.y);
|
||||
EditCurve[0] = Base::Vector2d(Origin.x,Origin.y);
|
||||
}
|
||||
|
||||
virtual void mouseMove(Base::Vector2D onSketchPos)
|
||||
virtual void mouseMove(Base::Vector2d onSketchPos)
|
||||
{
|
||||
if (Mode==STATUS_SEEK_First) {
|
||||
float length = (onSketchPos - EditCurve[0]).Length();
|
||||
float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2D(1.f,0.f));
|
||||
float angle = (onSketchPos - EditCurve[0]).GetAngle(Base::Vector2d(1.f,0.f));
|
||||
SbString text;
|
||||
text.sprintf(" (%.1f,%.1fdeg)", length, angle * 180 / M_PI);
|
||||
setPositionText(onSketchPos, text);
|
||||
|
||||
EditCurve[1] = onSketchPos;
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2D(0.0,0.0),AutoConstraint::VERTEX)) {
|
||||
if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.0,0.0),AutoConstraint::VERTEX)) {
|
||||
renderSuggestConstraintsCursor(sugConstr1);
|
||||
return;
|
||||
}
|
||||
@@ -1715,7 +1715,7 @@ static const char *cursor_createrectangulararray[]={
|
||||
applyCursor();
|
||||
}
|
||||
|
||||
virtual bool pressButton(Base::Vector2D onSketchPos)
|
||||
virtual bool pressButton(Base::Vector2d onSketchPos)
|
||||
{
|
||||
if (Mode==STATUS_SEEK_First){
|
||||
EditCurve[1] = onSketchPos;
|
||||
@@ -1726,12 +1726,12 @@ static const char *cursor_createrectangulararray[]={
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool releaseButton(Base::Vector2D onSketchPos)
|
||||
virtual bool releaseButton(Base::Vector2d onSketchPos)
|
||||
{
|
||||
Q_UNUSED(onSketchPos);
|
||||
if (Mode==STATUS_End){
|
||||
|
||||
Base::Vector2D vector = EditCurve[1]-EditCurve[0];
|
||||
Base::Vector2d vector = EditCurve[1]-EditCurve[0];
|
||||
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
@@ -1745,7 +1745,7 @@ static const char *cursor_createrectangulararray[]={
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc, "App.ActiveDocument.%s.addRectangularArray(%s, App.Vector(%f,%f,0),%s,%d,%d,%s,%f)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
geoIdList.c_str(), vector.fX, vector.fY,
|
||||
geoIdList.c_str(), vector.x, vector.y,
|
||||
(Clone?"True":"False"),
|
||||
Cols, Rows,
|
||||
(ConstraintSeparation?"True":"False"),
|
||||
@@ -1788,7 +1788,7 @@ static const char *cursor_createrectangulararray[]={
|
||||
int Cols;
|
||||
bool ConstraintSeparation;
|
||||
bool EqualVerticalHorizontalSpacing;
|
||||
std::vector<Base::Vector2D> EditCurve;
|
||||
std::vector<Base::Vector2d> EditCurve;
|
||||
std::vector<AutoConstraint> sugConstr1;
|
||||
};
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ DrawSketchHandler::~DrawSketchHandler()
|
||||
void DrawSketchHandler::quit(void)
|
||||
{
|
||||
assert(sketchgui);
|
||||
sketchgui->drawEdit(std::vector<Base::Vector2D>());
|
||||
sketchgui->drawEdit(std::vector<Base::Vector2d>());
|
||||
resetPositionText();
|
||||
|
||||
unsetCursor();
|
||||
@@ -133,7 +133,7 @@ void DrawSketchHandler::unsetCursor(void)
|
||||
}
|
||||
|
||||
int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggestedConstraints,
|
||||
const Base::Vector2D& Pos, const Base::Vector2D& Dir,
|
||||
const Base::Vector2d& Pos, const Base::Vector2d& Dir,
|
||||
AutoConstraint::TargetType type)
|
||||
{
|
||||
suggestedConstraints.clear();
|
||||
@@ -191,7 +191,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
constr.Type = Sketcher::Tangent;
|
||||
|
||||
if(constr.Type == Sketcher::Tangent && Dir.Length() > 1e-8 && hitShapeDir.Length() > 1e-8) { // We are hitting a line and have hitting vector information
|
||||
Base::Vector3d dir3d = Base::Vector3d(Dir.fX,Dir.fY,0);
|
||||
Base::Vector3d dir3d = Base::Vector3d(Dir.x,Dir.y,0);
|
||||
double cosangle=dir3d.Normalize()*hitShapeDir.Normalize();
|
||||
|
||||
// the angle between the line and the hitting direction are over around 6 degrees (it is substantially parallel)
|
||||
@@ -221,7 +221,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
constr.Type = Sketcher::None;
|
||||
constr.GeoId = Constraint::GeoUndef;
|
||||
constr.PosId = Sketcher::none;
|
||||
double angle = std::abs(atan2(Dir.fY, Dir.fX));
|
||||
double angle = std::abs(atan2(Dir.y, Dir.x));
|
||||
if (angle < angleDevRad || (M_PI - angle) < angleDevRad )
|
||||
// Suggest horizontal constraint
|
||||
constr.Type = Sketcher::Horizontal;
|
||||
@@ -243,9 +243,9 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
// Get geometry list
|
||||
const std::vector<Part::Geometry *> geomlist = sketchgui->getSketchObject()->getCompleteGeometry();
|
||||
|
||||
Base::Vector3d tmpPos(Pos.fX, Pos.fY, 0.f); // Current cursor point
|
||||
Base::Vector3d tmpDir(Dir.fX, Dir.fY, 0.f); // Direction of line
|
||||
Base::Vector3d tmpStart(Pos.fX-Dir.fX, Pos.fY-Dir.fY, 0.f); // Start point
|
||||
Base::Vector3d tmpPos(Pos.x, Pos.y, 0.f); // Current cursor point
|
||||
Base::Vector3d tmpDir(Dir.x, Dir.y, 0.f); // Direction of line
|
||||
Base::Vector3d tmpStart(Pos.x-Dir.x, Pos.y-Dir.y, 0.f); // Start point
|
||||
|
||||
// Iterate through geometry
|
||||
int i = 0;
|
||||
@@ -287,7 +287,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
Base::Vector3d focus1P = center + cf * majdir;
|
||||
Base::Vector3d focus2P = center - cf * majdir;
|
||||
|
||||
Base::Vector3d norm = Base::Vector3d(Dir.fY,-Dir.fX).Normalize();
|
||||
Base::Vector3d norm = Base::Vector3d(Dir.y,-Dir.x).Normalize();
|
||||
|
||||
double distancetoline = norm*(tmpPos - focus1P); // distance focus1 to line
|
||||
|
||||
@@ -342,7 +342,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
Base::Vector3d focus1P = center + cf * majdir;
|
||||
Base::Vector3d focus2P = center - cf * majdir;
|
||||
|
||||
Base::Vector3d norm = Base::Vector3d(Dir.fY,-Dir.fX).Normalize();
|
||||
Base::Vector3d norm = Base::Vector3d(Dir.y,-Dir.x).Normalize();
|
||||
|
||||
double distancetoline = norm*(tmpPos - focus1P); // distance focus1 to line
|
||||
|
||||
@@ -581,13 +581,13 @@ void DrawSketchHandler::renderSuggestConstraintsCursor(std::vector<AutoConstrain
|
||||
applyCursor(newCursor);
|
||||
}
|
||||
|
||||
void DrawSketchHandler::setPositionText(const Base::Vector2D &Pos, const SbString &text)
|
||||
void DrawSketchHandler::setPositionText(const Base::Vector2d &Pos, const SbString &text)
|
||||
{
|
||||
sketchgui->setPositionText(Pos, text);
|
||||
}
|
||||
|
||||
|
||||
void DrawSketchHandler::setPositionText(const Base::Vector2D &Pos)
|
||||
void DrawSketchHandler::setPositionText(const Base::Vector2d &Pos)
|
||||
{
|
||||
sketchgui->setPositionText(Pos);
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ public:
|
||||
|
||||
virtual void activated(ViewProviderSketch *){}
|
||||
virtual void deactivated(ViewProviderSketch *){}
|
||||
virtual void mouseMove(Base::Vector2D onSketchPos)=0;
|
||||
virtual bool pressButton(Base::Vector2D onSketchPos)=0;
|
||||
virtual bool releaseButton(Base::Vector2D onSketchPos)=0;
|
||||
virtual void mouseMove(Base::Vector2d onSketchPos)=0;
|
||||
virtual bool pressButton(Base::Vector2d onSketchPos)=0;
|
||||
virtual bool releaseButton(Base::Vector2d onSketchPos)=0;
|
||||
virtual bool onSelectionChanged(const Gui::SelectionChanges&) { return false; }
|
||||
virtual void registerPressedKey(bool /*pressed*/, int /*key*/){}
|
||||
|
||||
@@ -80,13 +80,13 @@ public:
|
||||
int getHighestCurveIndex(void);
|
||||
|
||||
int seekAutoConstraint(std::vector<AutoConstraint> &suggestedConstraints,
|
||||
const Base::Vector2D &Pos, const Base::Vector2D &Dir,
|
||||
const Base::Vector2d &Pos, const Base::Vector2d &Dir,
|
||||
AutoConstraint::TargetType type = AutoConstraint::VERTEX);
|
||||
void createAutoConstraints(const std::vector<AutoConstraint> &autoConstrs,
|
||||
int geoId, Sketcher::PointPos pointPos=Sketcher::none);
|
||||
|
||||
void setPositionText(const Base::Vector2D &Pos, const SbString &text);
|
||||
void setPositionText(const Base::Vector2D &Pos);
|
||||
void setPositionText(const Base::Vector2d &Pos, const SbString &text);
|
||||
void setPositionText(const Base::Vector2d &Pos);
|
||||
void resetPositionText(void);
|
||||
void renderSuggestConstraintsCursor(std::vector<AutoConstraint> &suggestedConstraints);
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ void ViewProviderSketch::deactivateHandler()
|
||||
{
|
||||
assert(edit);
|
||||
if(edit->sketchHandler != 0){
|
||||
std::vector<Base::Vector2D> editCurve;
|
||||
std::vector<Base::Vector2d> editCurve;
|
||||
editCurve.clear();
|
||||
drawEdit(editCurve); // erase any line
|
||||
edit->sketchHandler->deactivated(this);
|
||||
@@ -612,7 +612,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
return done;
|
||||
}
|
||||
case STATUS_SKETCH_UseHandler:
|
||||
return edit->sketchHandler->pressButton(Base::Vector2D(x,y));
|
||||
return edit->sketchHandler->pressButton(Base::Vector2d(x,y));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -799,7 +799,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
Gui::Command::openCommand("Drag Constraint");
|
||||
for(std::set<int>::iterator it = edit->DragConstraintSet.begin();
|
||||
it != edit->DragConstraintSet.end(); ++it) {
|
||||
moveConstraint(*it, Base::Vector2D(x, y));
|
||||
moveConstraint(*it, Base::Vector2d(x, y));
|
||||
//updateColor();
|
||||
}
|
||||
edit->PreselectConstraintSet = edit->DragConstraintSet;
|
||||
@@ -823,7 +823,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
Mode = STATUS_NONE;
|
||||
return true;
|
||||
case STATUS_SKETCH_UseHandler:
|
||||
return edit->sketchHandler->releaseButton(Base::Vector2D(x,y));
|
||||
return edit->sketchHandler->releaseButton(Base::Vector2d(x,y));
|
||||
case STATUS_NONE:
|
||||
default:
|
||||
return false;
|
||||
@@ -1108,7 +1108,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
Base::Vector3d vec(x-xInit,y-yInit,0);
|
||||
if (GeoId != Sketcher::Constraint::GeoUndef && PosId != Sketcher::none) {
|
||||
if (getSketchObject()->getSolvedSketch().movePoint(GeoId, PosId, vec, relative) == 0) {
|
||||
setPositionText(Base::Vector2D(x,y));
|
||||
setPositionText(Base::Vector2d(x,y));
|
||||
draw(true);
|
||||
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().SolveTime));
|
||||
} else {
|
||||
@@ -1122,7 +1122,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
if (edit->DragCurve != -1) {
|
||||
Base::Vector3d vec(x-xInit,y-yInit,0);
|
||||
if (getSketchObject()->getSolvedSketch().movePoint(edit->DragCurve, Sketcher::none, vec, relative) == 0) {
|
||||
setPositionText(Base::Vector2D(x,y));
|
||||
setPositionText(Base::Vector2d(x,y));
|
||||
draw(true);
|
||||
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().SolveTime));
|
||||
} else {
|
||||
@@ -1134,11 +1134,11 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
if (edit->DragConstraintSet.empty() == false) {
|
||||
for(std::set<int>::iterator it = edit->DragConstraintSet.begin();
|
||||
it != edit->DragConstraintSet.end(); ++it)
|
||||
moveConstraint(*it, Base::Vector2D(x,y));
|
||||
moveConstraint(*it, Base::Vector2d(x,y));
|
||||
}
|
||||
return true;
|
||||
case STATUS_SKETCH_UseHandler:
|
||||
edit->sketchHandler->mouseMove(Base::Vector2D(x,y));
|
||||
edit->sketchHandler->mouseMove(Base::Vector2d(x,y));
|
||||
if (preselectChanged) {
|
||||
this->drawConstraintIcons();
|
||||
this->updateColor();
|
||||
@@ -1166,7 +1166,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPos)
|
||||
void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPos)
|
||||
{
|
||||
// are we in edit?
|
||||
if (!edit)
|
||||
@@ -1227,7 +1227,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo
|
||||
angle = (startangle + endangle)/2;
|
||||
}
|
||||
else {
|
||||
Base::Vector3d tmpDir = Base::Vector3d(toPos.fX, toPos.fY, 0) - p1;
|
||||
Base::Vector3d tmpDir = Base::Vector3d(toPos.x, toPos.y, 0) - p1;
|
||||
angle = atan2(tmpDir.y, tmpDir.x);
|
||||
}
|
||||
p2 = p1 + radius * Base::Vector3d(cos(angle),sin(angle),0.);
|
||||
@@ -1236,7 +1236,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo
|
||||
const Part::GeomCircle *circle = static_cast<const Part::GeomCircle *>(geo);
|
||||
double radius = circle->getRadius();
|
||||
p1 = circle->getCenter();
|
||||
Base::Vector3d tmpDir = Base::Vector3d(toPos.fX, toPos.fY, 0) - p1;
|
||||
Base::Vector3d tmpDir = Base::Vector3d(toPos.x, toPos.y, 0) - p1;
|
||||
double angle = atan2(tmpDir.y, tmpDir.x);
|
||||
p2 = p1 + radius * Base::Vector3d(cos(angle),sin(angle),0.);
|
||||
}
|
||||
@@ -1245,7 +1245,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo
|
||||
} else
|
||||
return;
|
||||
|
||||
Base::Vector3d vec = Base::Vector3d(toPos.fX, toPos.fY, 0) - p2;
|
||||
Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p2;
|
||||
|
||||
Base::Vector3d dir;
|
||||
if (Constr->Type == Distance || Constr->Type == Radius)
|
||||
@@ -1263,7 +1263,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo
|
||||
Constr->LabelDistance = vec.x * norm.x + vec.y * norm.y;
|
||||
if (Constr->Type == Distance ||
|
||||
Constr->Type == DistanceX || Constr->Type == DistanceY) {
|
||||
vec = Base::Vector3d(toPos.fX, toPos.fY, 0) - (p2 + p1) / 2;
|
||||
vec = Base::Vector3d(toPos.x, toPos.y, 0) - (p2 + p1) / 2;
|
||||
Constr->LabelPosition = vec.x * dir.x + vec.y * dir.y;
|
||||
}
|
||||
}
|
||||
@@ -1325,7 +1325,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo
|
||||
} else
|
||||
return;
|
||||
|
||||
Base::Vector3d vec = Base::Vector3d(toPos.fX, toPos.fY, 0) - p0;
|
||||
Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0;
|
||||
Constr->LabelDistance = vec.Length()/2;
|
||||
}
|
||||
|
||||
@@ -1872,11 +1872,11 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
std::vector<SbVec2f> corners = viewer->getGLPolygon(corners0);
|
||||
|
||||
// all calculations with polygon and proj are in dimensionless [0 1] screen coordinates
|
||||
Base::Polygon2D polygon;
|
||||
polygon.Add(Base::Vector2D(corners[0].getValue()[0], corners[0].getValue()[1]));
|
||||
polygon.Add(Base::Vector2D(corners[0].getValue()[0], corners[1].getValue()[1]));
|
||||
polygon.Add(Base::Vector2D(corners[1].getValue()[0], corners[1].getValue()[1]));
|
||||
polygon.Add(Base::Vector2D(corners[1].getValue()[0], corners[0].getValue()[1]));
|
||||
Base::Polygon2d polygon;
|
||||
polygon.Add(Base::Vector2d(corners[0].getValue()[0], corners[0].getValue()[1]));
|
||||
polygon.Add(Base::Vector2d(corners[0].getValue()[0], corners[1].getValue()[1]));
|
||||
polygon.Add(Base::Vector2d(corners[1].getValue()[0], corners[1].getValue()[1]));
|
||||
polygon.Add(Base::Vector2d(corners[1].getValue()[0], corners[0].getValue()[1]));
|
||||
|
||||
Gui::ViewVolumeProjection proj(viewer->getSoRenderManager()->getCamera()->getViewVolume());
|
||||
|
||||
@@ -1908,7 +1908,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
pnt0 = proj(pnt0);
|
||||
VertexId += 1;
|
||||
|
||||
if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y))) {
|
||||
if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y))) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId + 1;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
@@ -1923,8 +1923,8 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
pnt2 = proj(pnt2);
|
||||
VertexId += 2;
|
||||
|
||||
bool pnt1Inside = polygon.Contains(Base::Vector2D(pnt1.x, pnt1.y));
|
||||
bool pnt2Inside = polygon.Contains(Base::Vector2D(pnt2.x, pnt2.y));
|
||||
bool pnt1Inside = polygon.Contains(Base::Vector2d(pnt1.x, pnt1.y));
|
||||
bool pnt2Inside = polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y));
|
||||
if (pnt1Inside) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId;
|
||||
@@ -1952,7 +1952,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
Plm.multVec(pnt0, pnt0);
|
||||
pnt0 = proj(pnt0);
|
||||
|
||||
if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y))) {
|
||||
if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y))) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId + 1;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
@@ -1972,7 +1972,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
0.f);
|
||||
Plm.multVec(pnt, pnt);
|
||||
pnt = proj(pnt);
|
||||
if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) {
|
||||
if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) {
|
||||
bpolyInside = false;
|
||||
break;
|
||||
}
|
||||
@@ -1994,7 +1994,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
Plm.multVec(pnt0, pnt0);
|
||||
pnt0 = proj(pnt0);
|
||||
|
||||
if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y))) {
|
||||
if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y))) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId + 1;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
@@ -2015,7 +2015,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
pnt = pnt0 + (cos(angle)*a)*majdir + sin(angle)*b*mindir;
|
||||
Plm.multVec(pnt, pnt);
|
||||
pnt = proj(pnt);
|
||||
if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) {
|
||||
if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) {
|
||||
bpolyInside = false;
|
||||
break;
|
||||
}
|
||||
@@ -2045,21 +2045,21 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
pnt1 = proj(pnt1);
|
||||
pnt2 = proj(pnt2);
|
||||
|
||||
bool pnt0Inside = polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y));
|
||||
bool pnt0Inside = polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y));
|
||||
if (pnt0Inside) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId - 1;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
}
|
||||
|
||||
bool pnt1Inside = polygon.Contains(Base::Vector2D(pnt1.x, pnt1.y));
|
||||
bool pnt1Inside = polygon.Contains(Base::Vector2d(pnt1.x, pnt1.y));
|
||||
if (pnt1Inside) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
}
|
||||
|
||||
if (polygon.Contains(Base::Vector2D(pnt2.x, pnt2.y))) {
|
||||
if (polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y))) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId + 1;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
@@ -2087,7 +2087,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
0.f);
|
||||
Plm.multVec(pnt, pnt);
|
||||
pnt = proj(pnt);
|
||||
if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) {
|
||||
if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) {
|
||||
bpolyInside = false;
|
||||
break;
|
||||
}
|
||||
@@ -2116,21 +2116,21 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
pnt1 = proj(pnt1);
|
||||
pnt2 = proj(pnt2);
|
||||
|
||||
bool pnt0Inside = polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y));
|
||||
bool pnt0Inside = polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y));
|
||||
if (pnt0Inside) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId - 1;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
}
|
||||
|
||||
bool pnt1Inside = polygon.Contains(Base::Vector2D(pnt1.x, pnt1.y));
|
||||
bool pnt1Inside = polygon.Contains(Base::Vector2d(pnt1.x, pnt1.y));
|
||||
if (pnt1Inside) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
}
|
||||
|
||||
if (polygon.Contains(Base::Vector2D(pnt2.x, pnt2.y))) {
|
||||
if (polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y))) {
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << VertexId + 1;
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
|
||||
@@ -2159,7 +2159,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
pnt = pnt0 + cos(angle)*a*majdir + sin(angle)*b*mindir;
|
||||
Plm.multVec(pnt, pnt);
|
||||
pnt = proj(pnt);
|
||||
if (!polygon.Contains(Base::Vector2D(pnt.x, pnt.y))) {
|
||||
if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) {
|
||||
bpolyInside = false;
|
||||
break;
|
||||
}
|
||||
@@ -2181,7 +2181,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
||||
}
|
||||
|
||||
pnt0 = proj(Plm.getPosition());
|
||||
if (polygon.Contains(Base::Vector2D(pnt0.x, pnt0.y)))
|
||||
if (polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y)))
|
||||
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), "RootPoint");
|
||||
}
|
||||
|
||||
@@ -4108,7 +4108,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderSketch::drawEdit(const std::vector<Base::Vector2D> &EditCurve)
|
||||
void ViewProviderSketch::drawEdit(const std::vector<Base::Vector2d> &EditCurve)
|
||||
{
|
||||
assert(edit);
|
||||
|
||||
@@ -4118,8 +4118,8 @@ void ViewProviderSketch::drawEdit(const std::vector<Base::Vector2D> &EditCurve)
|
||||
int32_t *index = edit->EditCurveSet->numVertices.startEditing();
|
||||
|
||||
int i=0; // setting up the line set
|
||||
for (std::vector<Base::Vector2D>::const_iterator it = EditCurve.begin(); it != EditCurve.end(); ++it,i++)
|
||||
verts[i].setValue(it->fX,it->fY,zEdit);
|
||||
for (std::vector<Base::Vector2d>::const_iterator it = EditCurve.begin(); it != EditCurve.end(); ++it,i++)
|
||||
verts[i].setValue(it->x,it->y,zEdit);
|
||||
|
||||
index[0] = EditCurve.size();
|
||||
edit->EditCurvesCoordinate->point.finishEditing();
|
||||
@@ -4720,18 +4720,18 @@ void ViewProviderSketch::unsetEditViewer(Gui::View3DInventorViewer* viewer)
|
||||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(true);
|
||||
}
|
||||
|
||||
void ViewProviderSketch::setPositionText(const Base::Vector2D &Pos, const SbString &text)
|
||||
void ViewProviderSketch::setPositionText(const Base::Vector2d &Pos, const SbString &text)
|
||||
{
|
||||
edit->textX->string = text;
|
||||
edit->textPos->translation = SbVec3f(Pos.fX,Pos.fY,zText);
|
||||
edit->textPos->translation = SbVec3f(Pos.x,Pos.y,zText);
|
||||
}
|
||||
|
||||
void ViewProviderSketch::setPositionText(const Base::Vector2D &Pos)
|
||||
void ViewProviderSketch::setPositionText(const Base::Vector2d &Pos)
|
||||
{
|
||||
SbString text;
|
||||
text.sprintf(" (%.1f,%.1f)", Pos.fX, Pos.fY);
|
||||
text.sprintf(" (%.1f,%.1f)", Pos.x, Pos.y);
|
||||
edit->textX->string = text;
|
||||
edit->textPos->translation = SbVec3f(Pos.fX,Pos.fY,zText);
|
||||
edit->textPos->translation = SbVec3f(Pos.x,Pos.y,zText);
|
||||
}
|
||||
|
||||
void ViewProviderSketch::resetPositionText(void)
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
void draw(bool temp=false);
|
||||
|
||||
/// draw the edit curve
|
||||
void drawEdit(const std::vector<Base::Vector2D> &EditCurve);
|
||||
void drawEdit(const std::vector<Base::Vector2d> &EditCurve);
|
||||
|
||||
/// Is the view provider selectable
|
||||
bool isSelectable(void) const;
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
void snapToGrid(double &x, double &y);
|
||||
|
||||
/// moves a selected constraint
|
||||
void moveConstraint(int constNum, const Base::Vector2D &toPos);
|
||||
void moveConstraint(int constNum, const Base::Vector2d &toPos);
|
||||
/// finds a free position for placing a constraint icon
|
||||
Base::Vector3d seekConstraintPosition(const Base::Vector3d &origPos,
|
||||
const Base::Vector3d &norm,
|
||||
@@ -342,8 +342,8 @@ protected:
|
||||
SbVec3s getDisplayedSize(const SoImage *) const;
|
||||
//@}
|
||||
|
||||
void setPositionText(const Base::Vector2D &Pos, const SbString &txt);
|
||||
void setPositionText(const Base::Vector2D &Pos);
|
||||
void setPositionText(const Base::Vector2d &Pos, const SbString &txt);
|
||||
void setPositionText(const Base::Vector2d &Pos);
|
||||
void resetPositionText(void);
|
||||
|
||||
// handle preselection and selection of points
|
||||
|
||||
Reference in New Issue
Block a user