[TD]makeCosmeticLine Y inversion

This commit is contained in:
wandererfan
2020-07-11 10:53:58 -04:00
committed by WandererFan
parent ac76f16aa3
commit 862b2cdf83
2 changed files with 18 additions and 33 deletions

View File

@@ -346,13 +346,14 @@ CosmeticEdge::CosmeticEdge()
initialize();
}
//TODO: set permaStart/permaEnd in ctors. Need scale.
CosmeticEdge::CosmeticEdge(CosmeticEdge* ce)
{
// Base::Console().Message("CE::CE(ce)\n");
TechDraw::BaseGeom* newGeom = ce->m_geometry->copy();
//these endpoints are already YInverted
permaStart = ce->permaStart;
permaEnd = ce->permaEnd;
permaEnd = ce->permaEnd;
permaRadius = ce->permaRadius;
m_geometry = newGeom;
m_format = ce->m_format;
initialize();
@@ -376,8 +377,16 @@ CosmeticEdge::CosmeticEdge(TopoDS_Edge e)
{
// Base::Console().Message("CE::CE(TopoDS_Edge)\n");
m_geometry = TechDraw::BaseGeom::baseFactory(e);
//we assume input edge is already in Yinverted coordinates
permaStart = m_geometry->getStartPoint();
permaEnd = m_geometry->getEndPoint();
if ((m_geometry->geomType == TechDraw::GeomType::CIRCLE) ||
(m_geometry->geomType == TechDraw::GeomType::ARCOFCIRCLE) ) {
TechDraw::Circle* circ = static_cast<TechDraw::Circle*>(m_geometry);
permaStart = circ->center;
permaEnd = circ->center;
permaRadius = circ->radius;
}
initialize();
}
@@ -387,6 +396,13 @@ CosmeticEdge::CosmeticEdge(TechDraw::BaseGeom* g)
m_geometry = g;
permaStart = m_geometry->getStartPoint();
permaEnd = m_geometry->getEndPoint();
if ((g->geomType == TechDraw::GeomType::CIRCLE) ||
(g->geomType == TechDraw::GeomType::ARCOFCIRCLE)) {
TechDraw::Circle* circ = static_cast<TechDraw::Circle*>(g);
permaStart = circ->center;
permaEnd = circ->center;
permaRadius = circ->radius;
}
initialize();
}
@@ -408,14 +424,6 @@ void CosmeticEdge::initialize(void)
m_geometry->setCosmeticTag(getTagAsString());
}
//why is this needed? isn't permaxxxx always unscaled??
//void CosmeticEdge::unscaleEnds(double scale)
//{
// permaStart = permaStart / scale;
// permaEnd = permaEnd / scale;
// permaRadius = permaRadius / scale;
//}
TechDraw::BaseGeom* CosmeticEdge::scaledGeometry(double scale)
{
TechDraw::BaseGeom* newGeom = nullptr;

View File

@@ -193,7 +193,6 @@ PyObject* DrawViewPartPy::makeCosmeticVertex3d(PyObject *args)
//get by unique tag
PyObject* DrawViewPartPy::getCosmeticVertex(PyObject *args)
{
// Base::Console().Message("DVPP::getCosmeticVertex()\n");
PyObject* result = nullptr;
char* id; //unique tag
if (!PyArg_ParseTuple(args, "s", &id)) {
@@ -212,7 +211,6 @@ PyObject* DrawViewPartPy::getCosmeticVertex(PyObject *args)
//get by selection name
PyObject* DrawViewPartPy::getCosmeticVertexBySelection(PyObject *args)
{
// Base::Console().Message("DVPP::getCosmeticVertexBySelection()\n");
PyObject* result = nullptr;
char* selName; //Selection routine name - "Vertex0"
if (!PyArg_ParseTuple(args, "s", &selName)) {
@@ -231,7 +229,6 @@ PyObject* DrawViewPartPy::getCosmeticVertexBySelection(PyObject *args)
PyObject* DrawViewPartPy::removeCosmeticVertex(PyObject *args)
{
// Base::Console().Message("DVPP::removeCosmeticVertex()\n");
DrawViewPart* dvp = getDrawViewPartPtr();
if (dvp == nullptr) {
return Py_None;
@@ -285,17 +282,6 @@ PyObject* DrawViewPartPy::replaceCosmeticVertex(PyObject *args)
Base::Console().Message("DVPP::replaceCosmeticVertex() - deprecated. do not use.\n");
return PyBool_FromLong(0l);
// PyObject* pNewCV = nullptr;
// if (!PyArg_ParseTuple(args, "O!", &(TechDraw::CosmeticVertexPy::Type), &pNewCV)) {
// throw Py::TypeError("expected (CosmeticVertex)");
// }
// DrawViewPart* dvp = getDrawViewPartPtr();
// TechDraw::CosmeticVertexPy* cvPy = static_cast<TechDraw::CosmeticVertexPy*>(pNewCV);
// TechDraw::CosmeticVertex* cv = cvPy->getCosmeticVertexPtr();
// bool result = dvp->replaceCosmeticVertex(cv);
// dvp->refreshCVGeoms();
// dvp->requestPaint();
// return PyBool_FromLong((long) result);
}
@@ -318,14 +304,11 @@ PyObject* DrawViewPartPy::makeCosmeticLine(PyObject *args)
}
DrawViewPart* dvp = getDrawViewPartPtr();
//points inverted in addCosmeticEdge(p1, p2)
Base::Vector3d pnt1 = static_cast<Base::VectorPy*>(pPnt1)->value();
Base::Vector3d pnt2 = static_cast<Base::VectorPy*>(pPnt2)->value();
std::string newTag = dvp->addCosmeticEdge(pnt1, pnt2);
TechDraw::CosmeticEdge* ce = dvp->getCosmeticEdge(newTag);
if (ce != nullptr) {
ce->permaStart = pnt1;
ce->permaEnd = pnt2;
ce->m_format.m_style = style;
ce->m_format.m_weight = weight;
if (pColor == nullptr) {
@@ -348,8 +331,6 @@ PyObject* DrawViewPartPy::makeCosmeticCircle(PyObject *args)
{
PyObject* pPnt1 = nullptr;
double radius = 5.0;
// double angle1 = 0.0;
// double angle2 = 360.0;
int style = LineFormat::getDefEdgeStyle();
double weight = LineFormat::getDefEdgeWidth();
App::Color defCol = LineFormat::getDefEdgeColor();
@@ -368,8 +349,6 @@ PyObject* DrawViewPartPy::makeCosmeticCircle(PyObject *args)
std::string newTag = dvp->addCosmeticEdge(bg);
TechDraw::CosmeticEdge* ce = dvp->getCosmeticEdge(newTag);
if (ce != nullptr) {
ce->permaStart = pnt1;
ce->permaEnd = pnt1;
ce->permaRadius = radius;
ce->m_format.m_style = style;
ce->m_format.m_weight = weight;
@@ -413,8 +392,6 @@ PyObject* DrawViewPartPy::makeCosmeticCircleArc(PyObject *args)
std::string newTag = dvp->addCosmeticEdge(bg);
TechDraw::CosmeticEdge* ce = dvp->getCosmeticEdge(newTag);
if (ce != nullptr) {
ce->permaStart = pnt1;
ce->permaEnd = pnt1;
ce->permaRadius = radius;
ce->m_format.m_style = style;
ce->m_format.m_weight = weight;