Skip to content

Commit

Permalink
[TD]Fix Inverted Y coord for midpoint and quad
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Jul 20, 2019
1 parent 82c17b3 commit 741dddf
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/Mod/TechDraw/Gui/CommandAnnotate.cpp
Expand Up @@ -356,18 +356,16 @@ void execMidpoints(Gui::Command* cmd)
}
}

//combine 2 loops?
const std::vector<TechDraw::BaseGeom*> edges = objFeat->getEdgeGeometry();
double scale = objFeat->getScale();
for (auto& s: SubNames) {
int GeoId(TechDraw::DrawUtil::getIndexFromName(s));
TechDraw::BaseGeom* geom = edges.at(GeoId);
Base::Vector3d mid = geom->getMidPoint();
// Base::Vector3d mid3(mid.x / scale, - mid.y / scale, 0.0);
mid = DrawUtil::invertY(mid);
objFeat->addCosmeticVertex(mid / scale);
}
cmd->updateActive();
// Base::Console().Message("execMidpoints - exits\n");
}

void execQuadrant(Gui::Command* cmd)
Expand Down Expand Up @@ -397,32 +395,18 @@ void execQuadrant(Gui::Command* cmd)
}
}

//combine 2 loops?
const std::vector<TechDraw::BaseGeom*> edges = objFeat->getEdgeGeometry();
double scale = objFeat->getScale();
bool nonCircles = false;
for (auto& s: SubNames) {
int GeoId(TechDraw::DrawUtil::getIndexFromName(s));
TechDraw::BaseGeom* geom = edges.at(GeoId);
//TODO: should this be restricted to circles??
// if (geom->geomType == TechDraw::CIRCLE) {
std::vector<Base::Vector3d> quads = geom->getQuads();
for (auto& q: quads) {
// Base::Vector3d q3(q.x / scale, - q.y / scale, 0.0);
objFeat->addCosmeticVertex(q / scale);
Base::Vector3d iq = DrawUtil::invertY(q);
objFeat->addCosmeticVertex(iq / scale);
}
// } else {
// nonCircles = true;
// }
}
if (nonCircles) {
std::stringstream edgeMsg;
edgeMsg << "Non circular edges found in selection.";
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr(edgeMsg.str().c_str()));
}
cmd->updateActive();
// Base::Console().Message("execQuadrant - exits\n");
}

DEF_STD_CMD_A(CmdTechDrawCosmeticVertex);
Expand Down

0 comments on commit 741dddf

Please sign in to comment.