[TD]minor code clean ups

This commit is contained in:
wandererfan
2020-05-15 16:31:58 -04:00
committed by WandererFan
parent 530e2a1837
commit 393cf75276
4 changed files with 9 additions and 74 deletions

View File

@@ -37,7 +37,9 @@ using namespace TechDraw;
// returns a string which represents the object e.g. when printed in python
std::string CenterLinePy::representation(void) const
{
return "<CenterLine object>";
std::stringstream ss;
ss << "<CenterLine object> at " << std::hex << this;
return ss.str();
}
PyObject *CenterLinePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
@@ -108,68 +110,8 @@ PyObject* CenterLinePy::copy(PyObject *args)
return cpy;
}
//PyObject* CenterLinePy::setFormat(PyObject* args)
//{
//// Base::Console().Message("CLPI::setFormat()\n");
// PyObject* pTuple;
// int style = 1;
// double weight = 0.50;
// double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
// App::Color c(red, blue, green, alpha);
// bool visible = 1;
// if (!PyArg_ParseTuple(args, "O", &pTuple)) {
// return NULL;
// }
//
// TechDraw::CenterLine* cl = this->getCenterLinePtr();
// if (PyTuple_Check(pTuple)) {
// int tSize = (int) PyTuple_Size(pTuple);
// if (tSize > 3) {
// PyObject* pStyle = PyTuple_GetItem(pTuple,0);
// style = (int) PyLong_AsLong(pStyle);
// PyObject* pWeight = PyTuple_GetItem(pTuple,1);
// weight = PyFloat_AsDouble(pWeight);
// PyObject* pColor = PyTuple_GetItem(pTuple,2);
// c = DrawUtil::pyTupleToColor(pColor);
// PyObject* pVisible = PyTuple_GetItem(pTuple,3);
// visible = (bool) PyLong_AsLong(pVisible);
// cl->m_format.m_style = style;
// cl->m_format.m_weight = weight;
// cl->m_format.m_color = c;
// cl->m_format.m_visible = visible;
// }
// } else {
// Base::Console().Error("CLPI::setFormat - not a tuple!\n");
// }
//
// return Py_None;
//}
//PyObject* CenterLinePy::getFormat(PyObject *args)
//{
// (void) args;
//// Base::Console().Message("CLPI::getFormat()\n");
// TechDraw::CenterLine* cl = this->getCenterLinePtr();
// PyObject* pStyle = PyLong_FromLong((long) cl->m_format.m_style);
// PyObject* pWeight = PyFloat_FromDouble(cl->m_format.m_weight);
// PyObject* pColor = DrawUtil::colorToPyTuple(cl->m_format.m_color);
// PyObject* pVisible = PyBool_FromLong((long) cl->m_format.m_visible);
// PyObject* result = PyTuple_New(4);
// PyTuple_SET_ITEM(result, 0, pStyle);
// PyTuple_SET_ITEM(result, 1, pWeight);
// PyTuple_SET_ITEM(result, 2, pColor);
// PyTuple_SET_ITEM(result, 3, pVisible);
// return result;
//}
Py::Object CenterLinePy::getFormat(void) const
{
// Base::Console().Message("CLP::getFormat()\n");
TechDraw::CenterLine* cl = this->getCenterLinePtr();
PyObject* pStyle = PyLong_FromLong((long) cl->m_format.m_style);
@@ -189,7 +131,6 @@ Py::Object CenterLinePy::getFormat(void) const
void CenterLinePy::setFormat(Py::Object arg)
{
// Base::Console().Message("CLP::setFormat()\n");
PyObject* pTuple = arg.ptr();
int style = 1;
double weight = 0.50;
@@ -209,7 +150,6 @@ void CenterLinePy::setFormat(Py::Object arg)
c = DrawUtil::pyTupleToColor(pColor);
PyObject* pVisible = PyTuple_GetItem(pTuple,3);
visible = (bool) PyLong_AsLong(pVisible);
cl->m_format.m_style = style;
cl->m_format.m_weight = weight;
cl->m_format.m_color = c;

View File

@@ -122,16 +122,12 @@ PyObject* CosmeticEdgePy::copy(PyObject *args)
void CosmeticEdgePy::setFormat(Py::Object arg)
{
// Base::Console().Message("CEP::setFormat()\n");
PyObject* pTuple = arg.ptr();
int style = 1;
double weight = 0.50;
double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
App::Color c(red, blue, green, alpha);
bool visible = 1;
// if (!PyArg_ParseTuple(args, "O", &pTuple)) {
// return NULL;
// }
TechDraw::CosmeticEdge* ce = this->getCosmeticEdgePtr();
if (PyTuple_Check(pTuple)) {
@@ -158,7 +154,6 @@ void CosmeticEdgePy::setFormat(Py::Object arg)
Py::Object CosmeticEdgePy::getFormat(void) const
{
// Base::Console().Message("CEP::getFormat()\n");
TechDraw::CosmeticEdge* ce = this->getCosmeticEdgePtr();
PyObject* pStyle = PyLong_FromLong((long) ce->m_format.m_style);

View File

@@ -1264,7 +1264,7 @@ void DrawViewPart::clearCosmeticEdges(void)
//add the cosmetic edges to geometry edge list
void DrawViewPart::addCosmeticEdgesToGeom(void)
{
Base::Console().Message("CEx::addCosmeticEdgesToGeom()\n");
// Base::Console().Message("CEx::addCosmeticEdgesToGeom()\n");
const std::vector<TechDraw::CosmeticEdge*> cEdges = CosmeticEdges.getValues();
for (auto& ce: cEdges) {
TechDraw::BaseGeom* scaledGeom = ce->scaledGeometry(getScale());
@@ -1295,7 +1295,7 @@ int DrawViewPart::add1CEToGE(std::string tag)
//update Edge geometry with current CE's
void DrawViewPart::refreshCEGeoms(void)
{
Base::Console().Message("DVP::refreshCEGeoms()\n");
// Base::Console().Message("DVP::refreshCEGeoms()\n");
std::vector<TechDraw::BaseGeom *> gEdges = getEdgeGeometry();
std::vector<TechDraw::BaseGeom *> oldGEdges;
for (auto& ge :gEdges) {

View File

@@ -636,7 +636,7 @@ int GeometryObject::addCosmeticVertex(Base::Vector3d pos, std::string tagString)
// insertGeomForCE(ce)
int GeometryObject::addCosmeticEdge(CosmeticEdge* ce)
{
Base::Console().Message("GO::addCosmeticEdge(%X) 0\n", ce);
// Base::Console().Message("GO::addCosmeticEdge(%X) 0\n", ce);
double scale = m_parent->getScale();
TechDraw::BaseGeom* e = ce->scaledGeometry(scale);
e->cosmetic = true;
@@ -652,7 +652,7 @@ int GeometryObject::addCosmeticEdge(CosmeticEdge* ce)
int GeometryObject::addCosmeticEdge(Base::Vector3d start,
Base::Vector3d end)
{
Base::Console().Message("GO::addCosmeticEdge() 1 - deprec?\n");
// Base::Console().Message("GO::addCosmeticEdge() 1 - deprec?\n");
gp_Pnt gp1(start.x, start.y, start.z);
gp_Pnt gp2(end.x, end.y, end.z);
TopoDS_Edge occEdge = BRepBuilderAPI_MakeEdge(gp1, gp2);
@@ -670,7 +670,7 @@ int GeometryObject::addCosmeticEdge(Base::Vector3d start,
Base::Vector3d end,
std::string tagString)
{
Base::Console().Message("GO::addCosmeticEdge() 2\n");
// Base::Console().Message("GO::addCosmeticEdge() 2\n");
gp_Pnt gp1(start.x, start.y, start.z);
gp_Pnt gp2(end.x, end.y, end.z);
TopoDS_Edge occEdge = BRepBuilderAPI_MakeEdge(gp1, gp2);
@@ -687,7 +687,7 @@ int GeometryObject::addCosmeticEdge(Base::Vector3d start,
int GeometryObject::addCosmeticEdge(TechDraw::BaseGeom* base,
std::string tagString)
{
Base::Console().Message("GO::addCosmeticEdge(%X, %s) 3\n", base, tagString.c_str());
// Base::Console().Message("GO::addCosmeticEdge(%X, %s) 3\n", base, tagString.c_str());
base->cosmetic = true;
base->hlrVisible = true;
base->source(1); //1-CosmeticEdge, 2-CenterLine