[TD]Py Cosmetic Vertex, Line, Circle Arc
This commit is contained in:
@@ -154,12 +154,6 @@ DrawViewPart::DrawViewPart(void) :
|
||||
|
||||
geometryObject = nullptr;
|
||||
getRunControl();
|
||||
|
||||
// Base::Vector3d org(0.0,0.0,0.0); //App side coords
|
||||
// addRandomVertex(org);
|
||||
// Base::Vector3d pt(11.0,11.0,0.0);
|
||||
// addRandomVertex(pt);
|
||||
|
||||
}
|
||||
|
||||
DrawViewPart::~DrawViewPart()
|
||||
@@ -291,8 +285,8 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
|
||||
}
|
||||
|
||||
rebuildCosmoVertex();
|
||||
rebuildCosmoEdge();
|
||||
|
||||
// rebuildCosmoEdge();
|
||||
|
||||
App::Document* doc = getDocument();
|
||||
bool isRestoring = doc->testStatus(App::Document::Status::Restoring);
|
||||
const std::vector<App::DocumentObject*>& links = Source.getValues();
|
||||
@@ -322,18 +316,18 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
|
||||
gp_Pnt inputCenter;
|
||||
Base::Vector3d stdOrg(0.0,0.0,0.0);
|
||||
|
||||
inputCenter = TechDrawGeometry::findCentroid(shape,
|
||||
inputCenter = TechDraw::findCentroid(shape,
|
||||
getViewAxis(stdOrg,Direction.getValue()));
|
||||
|
||||
shapeCentroid = Base::Vector3d(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
|
||||
TopoDS_Shape mirroredShape;
|
||||
mirroredShape = TechDrawGeometry::mirrorShape(shape,
|
||||
mirroredShape = TechDraw::mirrorShape(shape,
|
||||
inputCenter,
|
||||
getScale());
|
||||
|
||||
gp_Ax2 viewAxis = getViewAxis(shapeCentroid,Direction.getValue());
|
||||
if (!DrawUtil::fpCompare(Rotation.getValue(),0.0)) {
|
||||
mirroredShape = TechDrawGeometry::rotateShape(mirroredShape,
|
||||
mirroredShape = TechDraw::rotateShape(mirroredShape,
|
||||
viewAxis,
|
||||
Rotation.getValue());
|
||||
}
|
||||
@@ -352,16 +346,16 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
|
||||
}
|
||||
|
||||
//add back the cosmetic vertices
|
||||
for (auto& v: cosmoVertex) {
|
||||
int idx = geometryObject->addRandomVertex(v->pageLocation * getScale());
|
||||
for (auto& v: vertexCosmetic) {
|
||||
int idx = geometryObject->addCosmeticVertex(v->point() * getScale());
|
||||
v->linkGeom = idx;
|
||||
}
|
||||
|
||||
//add the cosmetic Edges to geometry Edges list
|
||||
for (auto& e: cosmoEdge) {
|
||||
TechDrawGeometry::BaseGeom* scaledGeom = e->scaledGeometry(getScale());
|
||||
int idx = geometryObject->addRandomEdge(scaledGeom);
|
||||
e->linkGeom = idx;
|
||||
for (auto& e: edgeCosmetic) {
|
||||
TechDraw::BaseGeom* scaledGeom = e->scaledGeometry(getScale());
|
||||
int idx = geometryObject->addCosmeticEdge(scaledGeom);
|
||||
e->m_linkGeom = idx;
|
||||
}
|
||||
|
||||
auto end = chrono::high_resolution_clock::now();
|
||||
@@ -373,7 +367,6 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
|
||||
#endif //#if MOD_TECHDRAW_HANDLE_FACES
|
||||
|
||||
requestPaint();
|
||||
// Base::Console().Message("DVP::execute - %s - exits\n",getNameInDocument());
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
@@ -412,10 +405,10 @@ void DrawViewPart::onChanged(const App::Property* prop)
|
||||
}
|
||||
|
||||
//note: slightly different than routine with same name in DrawProjectSplit
|
||||
TechDrawGeometry::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape shape, gp_Ax2 viewAxis)
|
||||
TechDraw::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape shape, gp_Ax2 viewAxis)
|
||||
{
|
||||
// Base::Console().Message("DVP::buildGO() - %s\n", getNameInDocument());
|
||||
TechDrawGeometry::GeometryObject* go = new TechDrawGeometry::GeometryObject(getNameInDocument(), this);
|
||||
TechDraw::GeometryObject* go = new TechDraw::GeometryObject(getNameInDocument(), this);
|
||||
go->setIsoCount(IsoCount.getValue());
|
||||
go->isPerspective(Perspective.getValue());
|
||||
go->setFocus(Focus.getValue());
|
||||
@@ -435,38 +428,38 @@ TechDrawGeometry::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape
|
||||
|
||||
auto start = chrono::high_resolution_clock::now();
|
||||
|
||||
go->extractGeometry(TechDrawGeometry::ecHARD, //always show the hard&outline visible lines
|
||||
go->extractGeometry(TechDraw::ecHARD, //always show the hard&outline visible lines
|
||||
true);
|
||||
go->extractGeometry(TechDrawGeometry::ecOUTLINE,
|
||||
go->extractGeometry(TechDraw::ecOUTLINE,
|
||||
true);
|
||||
if (SmoothVisible.getValue()) {
|
||||
go->extractGeometry(TechDrawGeometry::ecSMOOTH,
|
||||
go->extractGeometry(TechDraw::ecSMOOTH,
|
||||
true);
|
||||
}
|
||||
if (SeamVisible.getValue()) {
|
||||
go->extractGeometry(TechDrawGeometry::ecSEAM,
|
||||
go->extractGeometry(TechDraw::ecSEAM,
|
||||
true);
|
||||
}
|
||||
if ((IsoVisible.getValue()) && (IsoCount.getValue() > 0)) {
|
||||
go->extractGeometry(TechDrawGeometry::ecUVISO,
|
||||
go->extractGeometry(TechDraw::ecUVISO,
|
||||
true);
|
||||
}
|
||||
if (HardHidden.getValue()) {
|
||||
go->extractGeometry(TechDrawGeometry::ecHARD,
|
||||
go->extractGeometry(TechDraw::ecHARD,
|
||||
false);
|
||||
go->extractGeometry(TechDrawGeometry::ecOUTLINE,
|
||||
go->extractGeometry(TechDraw::ecOUTLINE,
|
||||
false);
|
||||
}
|
||||
if (SmoothHidden.getValue()) {
|
||||
go->extractGeometry(TechDrawGeometry::ecSMOOTH,
|
||||
go->extractGeometry(TechDraw::ecSMOOTH,
|
||||
false);
|
||||
}
|
||||
if (SeamHidden.getValue()) {
|
||||
go->extractGeometry(TechDrawGeometry::ecSEAM,
|
||||
go->extractGeometry(TechDraw::ecSEAM,
|
||||
false);
|
||||
}
|
||||
if (IsoHidden.getValue() && (IsoCount.getValue() > 0)) {
|
||||
go->extractGeometry(TechDrawGeometry::ecUVISO,
|
||||
go->extractGeometry(TechDraw::ecUVISO,
|
||||
false);
|
||||
}
|
||||
auto end = chrono::high_resolution_clock::now();
|
||||
@@ -474,7 +467,7 @@ TechDrawGeometry::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape
|
||||
double diffOut = chrono::duration <double, milli> (diff).count();
|
||||
Base::Console().Log("TIMING - %s DVP spent: %.3f millisecs in GO::extractGeometry\n",getNameInDocument(),diffOut);
|
||||
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> & edges = go->getEdgeGeometry();
|
||||
const std::vector<TechDraw::BaseGeom *> & edges = go->getEdgeGeometry();
|
||||
if (edges.empty()) {
|
||||
Base::Console().Log("DVP::buildGO - NO extracted edges!\n");
|
||||
}
|
||||
@@ -486,9 +479,9 @@ TechDrawGeometry::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape
|
||||
void DrawViewPart::extractFaces()
|
||||
{
|
||||
geometryObject->clearFaceGeom();
|
||||
const std::vector<TechDrawGeometry::BaseGeom*>& goEdges =
|
||||
const std::vector<TechDraw::BaseGeom*>& goEdges =
|
||||
geometryObject->getVisibleFaceEdges(SmoothVisible.getValue(),SeamVisible.getValue());
|
||||
std::vector<TechDrawGeometry::BaseGeom*>::const_iterator itEdge = goEdges.begin();
|
||||
std::vector<TechDraw::BaseGeom*>::const_iterator itEdge = goEdges.begin();
|
||||
std::vector<TopoDS_Edge> origEdges;
|
||||
for (;itEdge != goEdges.end(); itEdge++) {
|
||||
origEdges.push_back((*itEdge)->occEdge);
|
||||
@@ -594,9 +587,9 @@ void DrawViewPart::extractFaces()
|
||||
std::vector<TopoDS_Wire>::iterator itWire = sortedWires.begin();
|
||||
for (; itWire != sortedWires.end(); itWire++) {
|
||||
//version 1: 1 wire/face - no voids in face
|
||||
TechDrawGeometry::Face* f = new TechDrawGeometry::Face();
|
||||
TechDraw::Face* f = new TechDraw::Face();
|
||||
const TopoDS_Wire& wire = (*itWire);
|
||||
TechDrawGeometry::Wire* w = new TechDrawGeometry::Wire(wire);
|
||||
TechDraw::Wire* w = new TechDraw::Wire(wire);
|
||||
f->wires.push_back(w);
|
||||
geometryObject->addFaceGeom(f);
|
||||
}
|
||||
@@ -659,25 +652,25 @@ std::vector<TechDraw::DrawViewBalloon*> DrawViewPart::getBalloons() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::vector<TechDrawGeometry::Vertex *> & DrawViewPart::getVertexGeometry() const
|
||||
const std::vector<TechDraw::Vertex *> & DrawViewPart::getVertexGeometry() const
|
||||
{
|
||||
return geometryObject->getVertexGeometry();
|
||||
}
|
||||
|
||||
const std::vector<TechDrawGeometry::Face *> & DrawViewPart::getFaceGeometry() const
|
||||
const std::vector<TechDraw::Face *> & DrawViewPart::getFaceGeometry() const
|
||||
{
|
||||
return geometryObject->getFaceGeometry();
|
||||
}
|
||||
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> & DrawViewPart::getEdgeGeometry() const
|
||||
const std::vector<TechDraw::BaseGeom *> & DrawViewPart::getEdgeGeometry() const
|
||||
{
|
||||
return geometryObject->getEdgeGeometry();
|
||||
}
|
||||
|
||||
//! returns existing BaseGeom of 2D Edge(idx)
|
||||
TechDrawGeometry::BaseGeom* DrawViewPart::getProjEdgeByIndex(int idx) const
|
||||
TechDraw::BaseGeom* DrawViewPart::getProjEdgeByIndex(int idx) const
|
||||
{
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> &geoms = getEdgeGeometry();
|
||||
const std::vector<TechDraw::BaseGeom *> &geoms = getEdgeGeometry();
|
||||
if (geoms.empty()) {
|
||||
Base::Console().Log("INFO - getProjEdgeByIndex(%d) - no Edge Geometry. Probably restoring?\n",idx);
|
||||
return NULL;
|
||||
@@ -690,9 +683,9 @@ TechDrawGeometry::BaseGeom* DrawViewPart::getProjEdgeByIndex(int idx) const
|
||||
}
|
||||
|
||||
//! returns existing geometry of 2D Vertex(idx)
|
||||
TechDrawGeometry::Vertex* DrawViewPart::getProjVertexByIndex(int idx) const
|
||||
TechDraw::Vertex* DrawViewPart::getProjVertexByIndex(int idx) const
|
||||
{
|
||||
const std::vector<TechDrawGeometry::Vertex *> &geoms = getVertexGeometry();
|
||||
const std::vector<TechDraw::Vertex *> &geoms = getVertexGeometry();
|
||||
if (geoms.empty()) {
|
||||
Base::Console().Log("INFO - getProjVertexByIndex(%d) - no Vertex Geometry. Probably restoring?\n",idx);
|
||||
return NULL;
|
||||
@@ -705,12 +698,12 @@ TechDrawGeometry::Vertex* DrawViewPart::getProjVertexByIndex(int idx) const
|
||||
}
|
||||
|
||||
//! returns existing geometry of 2D Face(idx)
|
||||
std::vector<TechDrawGeometry::BaseGeom*> DrawViewPart::getFaceEdgesByIndex(int idx) const
|
||||
std::vector<TechDraw::BaseGeom*> DrawViewPart::getFaceEdgesByIndex(int idx) const
|
||||
{
|
||||
std::vector<TechDrawGeometry::BaseGeom*> result;
|
||||
const std::vector<TechDrawGeometry::Face *>& faces = getFaceGeometry();
|
||||
std::vector<TechDraw::BaseGeom*> result;
|
||||
const std::vector<TechDraw::Face *>& faces = getFaceGeometry();
|
||||
if (idx < (int) faces.size()) {
|
||||
TechDrawGeometry::Face* projFace = faces.at(idx);
|
||||
TechDraw::Face* projFace = faces.at(idx);
|
||||
for (auto& w: projFace->wires) {
|
||||
for (auto& g:w->geoms) {
|
||||
if (g->cosmetic) {
|
||||
@@ -727,8 +720,8 @@ std::vector<TopoDS_Wire> DrawViewPart::getWireForFace(int idx) const
|
||||
{
|
||||
std::vector<TopoDS_Wire> result;
|
||||
std::vector<TopoDS_Edge> edges;
|
||||
const std::vector<TechDrawGeometry::Face *>& faces = getFaceGeometry();
|
||||
TechDrawGeometry::Face * ourFace = faces.at(idx);
|
||||
const std::vector<TechDraw::Face *>& faces = getFaceGeometry();
|
||||
TechDraw::Face * ourFace = faces.at(idx);
|
||||
for (auto& w:ourFace->wires) {
|
||||
edges.clear();
|
||||
int i = 0;
|
||||
@@ -800,8 +793,8 @@ bool DrawViewPart::hasGeometry(void) const
|
||||
if (geometryObject == nullptr) {
|
||||
return result;
|
||||
}
|
||||
const std::vector<TechDrawGeometry::Vertex*> &verts = getVertexGeometry();
|
||||
const std::vector<TechDrawGeometry::BaseGeom*> &edges = getEdgeGeometry();
|
||||
const std::vector<TechDraw::Vertex*> &verts = getVertexGeometry();
|
||||
const std::vector<TechDraw::BaseGeom*> &edges = getEdgeGeometry();
|
||||
if (verts.empty() &&
|
||||
edges.empty() ) {
|
||||
result = false;
|
||||
@@ -816,7 +809,7 @@ gp_Ax2 DrawViewPart::getViewAxis(const Base::Vector3d& pt,
|
||||
const Base::Vector3d& axis,
|
||||
const bool flip) const
|
||||
{
|
||||
gp_Ax2 viewAxis = TechDrawGeometry::getViewAxis(pt,axis,flip);
|
||||
gp_Ax2 viewAxis = TechDraw::getViewAxis(pt,axis,flip);
|
||||
|
||||
return viewAxis;
|
||||
}
|
||||
@@ -860,7 +853,7 @@ std::vector<DrawViewDetail*> DrawViewPart::getDetailRefs(void) const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> DrawViewPart::getVisibleFaceEdges() const
|
||||
const std::vector<TechDraw::BaseGeom *> DrawViewPart::getVisibleFaceEdges() const
|
||||
{
|
||||
return geometryObject->getVisibleFaceEdges(SmoothVisible.getValue(),SeamVisible.getValue());
|
||||
}
|
||||
@@ -894,44 +887,6 @@ bool DrawViewPart::showSectionEdges(void)
|
||||
return m_sectionEdges;
|
||||
}
|
||||
|
||||
//build cosmoVertex from CosmeticVertexList
|
||||
void DrawViewPart::rebuildCosmoVertex(void)
|
||||
{
|
||||
// Base::Console().Message("DVP::rebuildCosmoVertx()\n");
|
||||
cosmoVertex.clear();
|
||||
std::vector<std::string> restoreVerts = CosmeticVertexList.getValues();
|
||||
for (auto& rv: restoreVerts) {
|
||||
if (!rv.empty()) {
|
||||
CosmeticVertex* cv = new CosmeticVertex();
|
||||
bool rc = cv->fromCSV(rv);
|
||||
if (rc) {
|
||||
cosmoVertex.push_back(cv);
|
||||
} else {
|
||||
delete cv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//build cosmoEdge from CosmeticEdgeList
|
||||
void DrawViewPart::rebuildCosmoEdge(void)
|
||||
{
|
||||
// Base::Console().Message("DVP::rebuildCosmoEdge()\n");
|
||||
cosmoEdge.clear();
|
||||
std::vector<std::string> restoreEdges = CosmeticEdgeList.getValues();
|
||||
for (auto& re: restoreEdges) {
|
||||
if (!re.empty()) {
|
||||
CosmeticEdge* ce = new CosmeticEdge();
|
||||
bool rc = ce->fromCSV(re);
|
||||
if (rc) {
|
||||
cosmoEdge.push_back(ce);
|
||||
} else {
|
||||
delete ce;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! remove features that are useless without this DVP
|
||||
//! hatches, geomhatches, dimensions,...
|
||||
void DrawViewPart::unsetupObject()
|
||||
@@ -1008,13 +963,51 @@ bool DrawViewPart::isIso(void) const
|
||||
//* Cosmetics
|
||||
//********
|
||||
|
||||
// adds a cosmetic vertex to cosmoVertex and CosmeticVertexList
|
||||
int DrawViewPart::addRandomVertex(Base::Vector3d pos)
|
||||
//build vertexCosmetic from CosmeticVertexList
|
||||
void DrawViewPart::rebuildCosmoVertex(void)
|
||||
{
|
||||
// Base::Console().Message("DVP::addRandomVertex(%s)\n", DrawUtil::formatVector(pos).c_str());
|
||||
int newIdx = -1;
|
||||
// Base::Console().Message("DVP::rebuildCosmoVertex()\n");
|
||||
vertexCosmetic.clear();
|
||||
std::vector<std::string> restoreVerts = CosmeticVertexList.getValues();
|
||||
for (auto& rv: restoreVerts) {
|
||||
if (!rv.empty()) {
|
||||
CosmeticVertex* cv = new CosmeticVertex();
|
||||
bool rc = cv->fromCSV(rv);
|
||||
if (rc) {
|
||||
vertexCosmetic.push_back(cv);
|
||||
} else {
|
||||
delete cv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//build edgeCosmetic from CosmeticEdgeList
|
||||
void DrawViewPart::rebuildCosmoEdge(void)
|
||||
{
|
||||
// Base::Console().Message("DVP::rebuildCosmoEdge()\n");
|
||||
edgeCosmetic.clear();
|
||||
std::vector<std::string> restoreEdges = CosmeticEdgeList.getValues();
|
||||
for (auto& re: restoreEdges) {
|
||||
if (!re.empty()) {
|
||||
CosmeticEdge* ce = new CosmeticEdge();
|
||||
bool rc = ce->fromCSV(re);
|
||||
if (rc) {
|
||||
edgeCosmetic.push_back(ce);
|
||||
} else {
|
||||
delete ce;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// adds a cosmetic vertex to vertexCosmetic and CosmeticVertexList
|
||||
int DrawViewPart::addCosmeticVertex(Base::Vector3d pos)
|
||||
{
|
||||
// Base::Console().Message("DVP::addCosmeticVertex(%s)\n", DrawUtil::formatVector(pos).c_str());
|
||||
TechDraw::CosmeticVertex* rVert = new TechDraw::CosmeticVertex(pos);
|
||||
cosmoVertex.push_back(rVert);
|
||||
vertexCosmetic.push_back(rVert);
|
||||
int newIdx = (int) (vertexCosmetic.size() - 1);
|
||||
stuffCosmeticVertexList();
|
||||
return newIdx;
|
||||
}
|
||||
@@ -1031,12 +1024,12 @@ void DrawViewPart::stuffCosmeticVertexList(void)
|
||||
CosmeticVertexList.setValues(saveVerts);
|
||||
}
|
||||
|
||||
void DrawViewPart::removeRandomVertex(TechDraw::CosmeticVertex* cv)
|
||||
void DrawViewPart::removeCosmeticVertex(TechDraw::CosmeticVertex* cv)
|
||||
{
|
||||
// Base::Console().Message("DVP::removeRandomVertex(cv) - cvs in: %d\n", cosmoVertex.size());
|
||||
// Base::Console().Message("DVP::removeCosmeticVertex(cv) - cvs in: %d\n", vertexCosmetic.size());
|
||||
bool found = false;
|
||||
std::vector<TechDraw::CosmeticVertex*> newCosmoVertex;
|
||||
for (auto& v: cosmoVertex) {
|
||||
for (auto& v: vertexCosmetic) {
|
||||
if (cv == v) {
|
||||
found = true;
|
||||
continue;
|
||||
@@ -1049,16 +1042,16 @@ void DrawViewPart::removeRandomVertex(TechDraw::CosmeticVertex* cv)
|
||||
delete cv;
|
||||
}
|
||||
|
||||
cosmoVertex = newCosmoVertex;
|
||||
vertexCosmetic = newCosmoVertex;
|
||||
stuffCosmeticVertexList();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void DrawViewPart::removeRandomVertex(int idx)
|
||||
void DrawViewPart::removeCosmeticVertex(int idx)
|
||||
{
|
||||
if (idx < (int) cosmoVertex.size()) {
|
||||
TechDraw::CosmeticVertex* cvSave = cosmoVertex.at(idx);
|
||||
cosmoVertex.erase(cosmoVertex.begin() + idx);
|
||||
if (idx < (int) vertexCosmetic.size()) {
|
||||
TechDraw::CosmeticVertex* cvSave = vertexCosmetic.at(idx);
|
||||
vertexCosmetic.erase(vertexCosmetic.begin() + idx);
|
||||
delete cvSave;
|
||||
}
|
||||
|
||||
@@ -1092,51 +1085,63 @@ TechDraw::CosmeticVertex* DrawViewPart::getCosmeticVertexByLink(int idx) const
|
||||
return result;
|
||||
}
|
||||
|
||||
void DrawViewPart::clearCV(void)
|
||||
void DrawViewPart::clearCosmeticVertices(void)
|
||||
{
|
||||
// Base::Console().Message("DVP::clearCV()\n");
|
||||
cosmoVertex.clear();
|
||||
// Base::Console().Message("DVP::clearCosmeticVertices()\n");
|
||||
vertexCosmetic.clear();
|
||||
std::vector<std::string> noVerts;
|
||||
CosmeticVertexList.setValues(noVerts);
|
||||
}
|
||||
|
||||
// adds a cosmetic edge to cosmoEdge and CosmeticEdgeList
|
||||
int DrawViewPart::addRandomEdge(Base::Vector3d p1, Base::Vector3d p2)
|
||||
void DrawViewPart::clearCosmeticEdges(void)
|
||||
{
|
||||
// Base::Console().Message("DVP::addRandomEdge(%s, %s)\n",
|
||||
// Base::Console().Message("DVP::clearCosmeticEdges()\n");
|
||||
edgeCosmetic.clear();
|
||||
std::vector<std::string> noEdges;
|
||||
CosmeticEdgeList.setValues(noEdges);
|
||||
}
|
||||
|
||||
// adds a cosmetic edge to edgeCosmetic and CosmeticEdgeList
|
||||
int DrawViewPart::addCosmeticEdge(Base::Vector3d p1, Base::Vector3d p2)
|
||||
{
|
||||
// Base::Console().Message("DVP::addCosmeticEdge(%s, %s)\n",
|
||||
// DrawUtil::formatVector(p1).c_str(),
|
||||
// DrawUtil::formatVector(p2).c_str());
|
||||
int newIdx = -1;
|
||||
TechDraw::CosmeticEdge* rEdge = new TechDraw::CosmeticEdge(p1, p2);
|
||||
cosmoEdge.push_back(rEdge);
|
||||
|
||||
//stuff stringList
|
||||
std::vector<std::string> saveEdges;
|
||||
const std::vector<TechDraw::CosmeticEdge*> cosEdges = getCosmeticEdge();
|
||||
for (auto& ce: cosEdges) {
|
||||
std::string csv = ce->toCSV();
|
||||
saveEdges.push_back(csv);
|
||||
}
|
||||
stuffCosmeticEdgeList();
|
||||
TechDraw::CosmeticEdge* ce = new TechDraw::CosmeticEdge(p1, p2);
|
||||
edgeCosmetic.push_back(ce);
|
||||
int newIdx = (int) (edgeCosmetic.size() - 1);
|
||||
// stuffCosmeticEdgeList();
|
||||
std::string csv = ce->toCSV();
|
||||
std::vector<std::string> edgeList = CosmeticEdgeList.getValues();
|
||||
edgeList.push_back(csv);
|
||||
CosmeticEdgeList.setValues(edgeList);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
int DrawViewPart::addRandomEdge(TopoDS_Edge e)
|
||||
int DrawViewPart::addCosmeticEdge(TopoDS_Edge e)
|
||||
{
|
||||
// Base::Console().Message("DVP::addRandomEdge(TopoDS_Edge)\n");
|
||||
int newIdx = -1;
|
||||
TechDraw::CosmeticEdge* rEdge = new TechDraw::CosmeticEdge(e);
|
||||
cosmoEdge.push_back(rEdge);
|
||||
stuffCosmeticEdgeList();
|
||||
// Base::Console().Message("DVP::addCosmeticEdge(TopoDS_Edge)\n");
|
||||
TechDraw::CosmeticEdge* ce = new TechDraw::CosmeticEdge(e);
|
||||
edgeCosmetic.push_back(ce);
|
||||
int newIdx = (int) (edgeCosmetic.size() - 1);
|
||||
// stuffCosmeticEdgeList();
|
||||
std::string csv = ce->toCSV();
|
||||
std::vector<std::string> edgeList = CosmeticEdgeList.getValues();
|
||||
edgeList.push_back(csv);
|
||||
CosmeticEdgeList.setValues(edgeList);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
int DrawViewPart::addRandomEdge(CosmeticEdge* ce)
|
||||
int DrawViewPart::addCosmeticEdge(CosmeticEdge* ce)
|
||||
{
|
||||
// Base::Console().Message("DVP::addRandomEdge(CosmeticEdge)\n");
|
||||
int newIdx = -1;
|
||||
cosmoEdge.push_back(ce);
|
||||
stuffCosmeticEdgeList();
|
||||
// Base::Console().Message("DVP::addCosmeticEdge(CosmeticEdge)\n");
|
||||
edgeCosmetic.push_back(ce);
|
||||
int newIdx = (int) (edgeCosmetic.size() - 1);
|
||||
// stuffCosmeticEdgeList();
|
||||
std::string csv = ce->toCSV();
|
||||
std::vector<std::string> edgeList = CosmeticEdgeList.getValues();
|
||||
edgeList.push_back(csv);
|
||||
CosmeticEdgeList.setValues(edgeList);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
@@ -1152,12 +1157,12 @@ void DrawViewPart::stuffCosmeticEdgeList(void)
|
||||
CosmeticEdgeList.setValues(saveEdges);
|
||||
}
|
||||
|
||||
void DrawViewPart::removeRandomEdge(TechDraw::CosmeticEdge* ce)
|
||||
void DrawViewPart::removeCosmeticEdge(TechDraw::CosmeticEdge* ce)
|
||||
{
|
||||
// Base::Console().Message("DVP::removeRandomEdge(ce) - ces in: %d\n", cosmoEdge.size());
|
||||
// Base::Console().Message("DVP::removeCosmeticEdge(ce) - ces in: %d\n", edgeCosmetic.size());
|
||||
bool found = false;
|
||||
std::vector<TechDraw::CosmeticEdge*> newCosmoEdge;
|
||||
for (auto& e: cosmoEdge) {
|
||||
for (auto& e: edgeCosmetic) {
|
||||
if (ce == e) {
|
||||
found = true;
|
||||
continue;
|
||||
@@ -1169,17 +1174,17 @@ void DrawViewPart::removeRandomEdge(TechDraw::CosmeticEdge* ce)
|
||||
(found) ) {
|
||||
delete ce;
|
||||
}
|
||||
cosmoEdge = newCosmoEdge;
|
||||
edgeCosmetic = newCosmoEdge;
|
||||
stuffCosmeticEdgeList();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void DrawViewPart::removeRandomEdge(int idx)
|
||||
void DrawViewPart::removeCosmeticEdge(int idx)
|
||||
{
|
||||
// Base::Console().Message("DVP::removeRandomEdge(%d) - ces in: %d\n", idx, cosmoEdge.size());
|
||||
if (idx < (int) cosmoEdge.size()) {
|
||||
TechDraw::CosmeticEdge* ceSave = cosmoEdge.at(idx);
|
||||
cosmoEdge.erase(cosmoEdge.begin() + idx);
|
||||
// Base::Console().Message("DVP::removeCosmeticEdge(%d) - ces in: %d\n", idx, edgeCosmetic.size());
|
||||
if (idx < (int) edgeCosmetic.size()) {
|
||||
TechDraw::CosmeticEdge* ceSave = edgeCosmetic.at(idx);
|
||||
edgeCosmetic.erase(edgeCosmetic.begin() + idx);
|
||||
delete ceSave;
|
||||
}
|
||||
stuffCosmeticEdgeList();
|
||||
@@ -1204,7 +1209,7 @@ TechDraw::CosmeticEdge* DrawViewPart::getCosmeticEdgeByLink(int idx) const
|
||||
CosmeticEdge* result = nullptr;
|
||||
const std::vector<TechDraw::CosmeticEdge*> edges = getCosmeticEdge();
|
||||
for (auto& ce: edges) {
|
||||
if (ce->linkGeom == idx) {
|
||||
if (ce->m_linkGeom == idx) {
|
||||
result = ce;
|
||||
break;
|
||||
}
|
||||
@@ -1212,14 +1217,6 @@ TechDraw::CosmeticEdge* DrawViewPart::getCosmeticEdgeByLink(int idx) const
|
||||
return result;
|
||||
}
|
||||
|
||||
void DrawViewPart::clearCE(void)
|
||||
{
|
||||
// Base::Console().Message("DVP::clearCE()\n");
|
||||
cosmoEdge.clear();
|
||||
std::vector<std::string> noEdges;
|
||||
CosmeticEdgeList.setValues(noEdges);
|
||||
}
|
||||
|
||||
PyObject *DrawViewPart::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
|
||||
Reference in New Issue
Block a user