[TD]Eliminate replace fcns for Cosmetic objs
This commit is contained in:
@@ -157,20 +157,9 @@ void CosmeticExtension::removeCosmeticVertex(std::vector<std::string> delTags)
|
||||
|
||||
bool CosmeticExtension::replaceCosmeticVertex(CosmeticVertex* newCV)
|
||||
{
|
||||
// Base::Console().Message("DVP::replaceCV(%s)\n", newCV->getTagAsString().c_str());
|
||||
(void) newCV;
|
||||
Base::Console().Message("CX::replaceCosmeticVertex() - deprecated. do not use.\n");
|
||||
bool result = false;
|
||||
std::vector<CosmeticVertex*> cVerts = CosmeticVertexes.getValues();
|
||||
std::vector<CosmeticVertex*> newVerts;
|
||||
std::string tag = newCV->getTagAsString();
|
||||
for (auto& cv: cVerts) {
|
||||
if (cv->getTagAsString() == tag) {
|
||||
newVerts.push_back(newCV);
|
||||
result = true;
|
||||
} else {
|
||||
newVerts.push_back(cv);
|
||||
}
|
||||
}
|
||||
CosmeticVertexes.setValues(newVerts);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -275,23 +264,12 @@ void CosmeticExtension::removeCosmeticEdge(std::vector<std::string> delTags)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CosmeticExtension::replaceCosmeticEdge(CosmeticEdge* newCE)
|
||||
{
|
||||
(void) newCE;
|
||||
Base::Console().Message("CX::replaceCosmeticEdge() - deprecated. do not use.\n");
|
||||
bool result = false;
|
||||
std::vector<CosmeticEdge*> cEdges = CosmeticEdges.getValues();
|
||||
std::vector<CosmeticEdge*> newEdges;
|
||||
std::string tag = newCE->getTagAsString();
|
||||
for (auto& ce: cEdges) {
|
||||
Base::Console().Message("CX::replaceCosmeticEdge - newCE: %X/%s matching: %X/xxx \n",
|
||||
newCE, tag.c_str(), ce);
|
||||
if (ce->getTagAsString() == tag) { //<<<<
|
||||
newEdges.push_back(newCE);
|
||||
result = true;
|
||||
} else {
|
||||
newEdges.push_back(ce);
|
||||
}
|
||||
}
|
||||
CosmeticEdges.setValues(newEdges);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -405,20 +383,9 @@ void CosmeticExtension::removeCenterLine(std::vector<std::string> delTags)
|
||||
|
||||
bool CosmeticExtension::replaceCenterLine(CenterLine* newCL)
|
||||
{
|
||||
// Base::Console().Message("DVP::replaceCL(%s)\n", newCL->getTagAsString().c_str());
|
||||
(void) newCL;
|
||||
Base::Console().Message("CX::replaceCenterLine() - deprecated. do not use.\n");
|
||||
bool result = false;
|
||||
std::vector<CenterLine*> cLines = CenterLines.getValues();
|
||||
std::vector<CenterLine*> newLines;
|
||||
std::string tag = newCL->getTagAsString();
|
||||
for (auto& cl: cLines) {
|
||||
if (cl->getTagAsString() == tag) {
|
||||
newLines.push_back(newCL);
|
||||
result = true;
|
||||
} else {
|
||||
newLines.push_back(cl);
|
||||
}
|
||||
}
|
||||
CenterLines.setValues(newLines);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -488,20 +455,9 @@ TechDraw::GeomFormat* CosmeticExtension::getGeomFormatBySelection(int i) const
|
||||
|
||||
bool CosmeticExtension::replaceGeomFormat(GeomFormat* newGF)
|
||||
{
|
||||
// Base::Console().Message("CEx::replaceGF(%s)\n", newGF->getTagAsString().c_str());
|
||||
(void) newGF;
|
||||
Base::Console().Message("CX::replaceGeomFormat() - deprecated. do not use.\n");
|
||||
bool result = false;
|
||||
std::vector<GeomFormat*> gFormats = GeomFormats.getValues();
|
||||
std::vector<GeomFormat*> newFormats;
|
||||
std::string tag = newGF->getTagAsString();
|
||||
for (auto& gf: gFormats) {
|
||||
if (gf->getTagAsString() == tag) {
|
||||
newFormats.push_back(newGF);
|
||||
result = true;
|
||||
} else {
|
||||
newFormats.push_back(gf);
|
||||
}
|
||||
}
|
||||
GeomFormats.setValues(newFormats);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -281,17 +281,21 @@ PyObject* DrawViewPartPy::removeCosmeticVertex(PyObject *args)
|
||||
|
||||
PyObject* DrawViewPartPy::replaceCosmeticVertex(PyObject *args)
|
||||
{
|
||||
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);
|
||||
(void) 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -464,8 +468,6 @@ PyObject* DrawViewPartPy::getCosmeticEdge(PyObject *args)
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
TechDraw::CosmeticEdge* ce = dvp->getCosmeticEdge(tag);
|
||||
if (ce != nullptr) {
|
||||
// result = new CosmeticEdgePy(new CosmeticEdge(ce));
|
||||
// result = new CosmeticEdgePy(ce->clone());
|
||||
result = ce->getPyObject();
|
||||
} else {
|
||||
Base::Console().Error("DVPPI::getCosmeticEdge - edge %s not found\n", tag);
|
||||
@@ -487,7 +489,6 @@ PyObject* DrawViewPartPy::getCosmeticEdgeBySelection(PyObject *args)
|
||||
TechDraw::CosmeticEdge* ce = dvp->getCosmeticEdgeBySelection(name);
|
||||
if (ce != nullptr) {
|
||||
result = ce->getPyObject();
|
||||
// result = new CosmeticEdgePy(ce->clone());
|
||||
} else {
|
||||
Base::Console().Error("DVPPI::getCosmeticEdgebySelection - edge for name %s not found\n", name);
|
||||
}
|
||||
@@ -496,21 +497,25 @@ PyObject* DrawViewPartPy::getCosmeticEdgeBySelection(PyObject *args)
|
||||
|
||||
PyObject* DrawViewPartPy::replaceCosmeticEdge(PyObject *args)
|
||||
{
|
||||
(void) args;
|
||||
Base::Console().Message("DVPP::replaceCosmeticEdge() - deprecated. do not use.\n");
|
||||
return PyBool_FromLong(0l);
|
||||
|
||||
// Base::Console().Message("DVPPI::replaceCosmeticEdge()\n");
|
||||
bool result = false;
|
||||
PyObject* pNewCE;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(TechDraw::CosmeticEdgePy::Type), &pNewCE)) {
|
||||
throw Py::TypeError("expected (CosmeticEdge)");
|
||||
}
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
TechDraw::CosmeticEdgePy* cePy = static_cast<TechDraw::CosmeticEdgePy*>(pNewCE);
|
||||
TechDraw::CosmeticEdge* ce = cePy->getCosmeticEdgePtr();
|
||||
if (ce != nullptr) {
|
||||
result = dvp->replaceCosmeticEdge(ce); //<<<
|
||||
dvp->refreshCEGeoms();
|
||||
dvp->requestPaint();
|
||||
}
|
||||
return PyBool_FromLong((long) result);
|
||||
// bool result = false;
|
||||
// PyObject* pNewCE;
|
||||
// if (!PyArg_ParseTuple(args, "O!", &(TechDraw::CosmeticEdgePy::Type), &pNewCE)) {
|
||||
// throw Py::TypeError("expected (CosmeticEdge)");
|
||||
// }
|
||||
// DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
// TechDraw::CosmeticEdgePy* cePy = static_cast<TechDraw::CosmeticEdgePy*>(pNewCE);
|
||||
// TechDraw::CosmeticEdge* ce = cePy->getCosmeticEdgePtr();
|
||||
// if (ce != nullptr) {
|
||||
// result = dvp->replaceCosmeticEdge(ce); //<<<
|
||||
// dvp->refreshCEGeoms();
|
||||
// dvp->requestPaint();
|
||||
// }
|
||||
// return PyBool_FromLong((long) result);
|
||||
}
|
||||
|
||||
PyObject* DrawViewPartPy::removeCosmeticEdge(PyObject *args)
|
||||
@@ -589,7 +594,7 @@ PyObject* DrawViewPartPy::getCenterLine(PyObject *args)
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
TechDraw::CenterLine* cl = dvp->getCenterLine(tag);
|
||||
if (cl != nullptr) {
|
||||
result = new CenterLinePy(cl->clone());
|
||||
result = cl->getPyObject();
|
||||
} else {
|
||||
Base::Console().Error("DVPPI::getCenterLine - centerLine %s not found\n", tag);
|
||||
}
|
||||
@@ -609,7 +614,7 @@ PyObject* DrawViewPartPy::getCenterLineBySelection(PyObject *args)
|
||||
|
||||
TechDraw::CenterLine* cl = dvp->getCenterLineBySelection(tag);
|
||||
if (cl != nullptr) {
|
||||
result = new CenterLinePy(cl->clone());
|
||||
result = cl->getPyObject();
|
||||
} else {
|
||||
Base::Console().Error("DVPPI::getCenterLinebySelection - centerLine for tag %s not found\n", tag);
|
||||
}
|
||||
@@ -618,18 +623,22 @@ PyObject* DrawViewPartPy::getCenterLineBySelection(PyObject *args)
|
||||
|
||||
PyObject* DrawViewPartPy::replaceCenterLine(PyObject *args)
|
||||
{
|
||||
(void) args;
|
||||
Base::Console().Message("DVPP::replaceCenterLine() - deprecated. do not use.\n");
|
||||
return PyBool_FromLong(0l);
|
||||
|
||||
// Base::Console().Message("DVPPI::replace CenterLine()\n");
|
||||
PyObject* pNewCL;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(TechDraw::CenterLinePy::Type), &pNewCL)) {
|
||||
throw Py::TypeError("expected (CenterLine)");
|
||||
}
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
TechDraw::CenterLinePy* clPy = static_cast<TechDraw::CenterLinePy*>(pNewCL);
|
||||
TechDraw::CenterLine* cl = clPy->getCenterLinePtr();
|
||||
bool result = dvp->replaceCenterLine(cl);
|
||||
dvp->refreshCLGeoms();
|
||||
dvp->requestPaint();
|
||||
return PyBool_FromLong((long) result);
|
||||
// PyObject* pNewCL;
|
||||
// if (!PyArg_ParseTuple(args, "O!", &(TechDraw::CenterLinePy::Type), &pNewCL)) {
|
||||
// throw Py::TypeError("expected (CenterLine)");
|
||||
// }
|
||||
// DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
// TechDraw::CenterLinePy* clPy = static_cast<TechDraw::CenterLinePy*>(pNewCL);
|
||||
// TechDraw::CenterLine* cl = clPy->getCenterLinePtr();
|
||||
// bool result = dvp->replaceCenterLine(cl);
|
||||
// dvp->refreshCLGeoms();
|
||||
// dvp->requestPaint();
|
||||
// return PyBool_FromLong((long) result);
|
||||
}
|
||||
|
||||
PyObject* DrawViewPartPy::removeCenterLine(PyObject *args)
|
||||
|
||||
@@ -397,7 +397,6 @@ void TaskCenterLine::updateCenterLine(void)
|
||||
m_cl->m_extendBy = ui->qsbExtend->rawValue();
|
||||
m_cl->m_type = m_type;
|
||||
m_cl->m_flip2Line = ui->cbFlip->isChecked();
|
||||
m_partFeat->replaceCenterLine(m_cl);
|
||||
m_partFeat->refreshCLGeoms();
|
||||
m_partFeat->requestPaint();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user