[TD]Cosmetic function overhaul (#14216)
* [TD]Cosmetic geometry and tools update - all cosmetics to store geometry in same form - all cosmetics to survive scaling and rotation - extension functions to survive scaling and rotation * [TD]overhaul leader point storage and editing - add py routine makeLeader(points) * [TD]add leader conversion utility * [TD]Set Leader RotateWithView default to true * [TD]fix intersection vertex position * [TD]add CosmeticEdge::makeLineFromCanonicalPoints * [TD]fix 2 Extension tools - positioning in DrawCosmeticCircle - mishandling of points in execLineParallelPerpendicular * [TD]Remove duplicate constexpr * [TD]fix 2x Cosmetic arc tools * [TD]refactor LineFormat out of Cosmetic * [TD]move cosmetic appearance settings to LineFormat * [TD]remove 2 unused methods * [TD]apply format to blue line & circle tools * [TD]fix ballon arrowhead does not rotate with view * [TD]fix CosmeticCircle3Points * [TD]allow multiple cosmetic object deletions * [TD]fix extend/shorten centerline
This commit is contained in:
@@ -62,6 +62,35 @@ TechDraw::DrawViewPart* CosmeticExtension::getOwner()
|
||||
return static_cast<TechDraw::DrawViewPart*>(getExtendedObject());
|
||||
}
|
||||
|
||||
//! remove cosmetic elements for a list of subelement names
|
||||
void CosmeticExtension::deleteCosmeticElements(std::vector<std::string> removables)
|
||||
{
|
||||
// Base::Console().Message("CEx::deleteCosmeticElements(%d removables)\n", removables.size());
|
||||
for (auto& name : removables) {
|
||||
if (DU::getGeomTypeFromName(name) == "Vertex" &&
|
||||
DU::isCosmeticVertex(getOwner(), name)) {
|
||||
CosmeticVertex* vert = getCosmeticVertexBySelection(name);
|
||||
removeCosmeticVertex(vert->getTagAsString());
|
||||
continue;
|
||||
}
|
||||
if (DU::getGeomTypeFromName(name) == "Edge" &&
|
||||
( DU::isCosmeticEdge(getOwner(), name) ||
|
||||
DU::isCenterLine(getOwner(), name) ) ) {
|
||||
CosmeticEdge* edge = getCosmeticEdgeBySelection(name);
|
||||
if (edge) {
|
||||
// if not edge, something has gone very wrong!
|
||||
removeCosmeticEdge(edge->getTagAsString());
|
||||
continue;
|
||||
}
|
||||
CenterLine* line = getCenterLineBySelection(name);
|
||||
if (line) {
|
||||
removeCenterLine(line->getTagAsString());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//CosmeticVertex x, y are stored as unscaled, but mirrored (inverted Y) values.
|
||||
//if you are creating a CV based on calculations of scaled geometry, you need to
|
||||
@@ -161,13 +190,18 @@ int CosmeticExtension::getCVIndex(const std::string& tag)
|
||||
}
|
||||
|
||||
/// adds a cosmetic vertex to the property list. does not add to display geometry until dvp executes.
|
||||
/// returns unique CV id
|
||||
std::string CosmeticExtension::addCosmeticVertex(const Base::Vector3d& pos)
|
||||
/// returns unique CV id. if the pos parameter is in real world coordinates, then invert should be true
|
||||
/// (the default). if pos is in TD geometry or scene coordinates, then it is already inverted, and
|
||||
/// invert should be set to false.
|
||||
std::string CosmeticExtension::addCosmeticVertex(const Base::Vector3d& pos, bool invert)
|
||||
{
|
||||
// Base::Console().Message("CEx::addCosmeticVertex(%s)\n",
|
||||
// DrawUtil::formatVector(pos).c_str());
|
||||
std::vector<CosmeticVertex*> verts = CosmeticVertexes.getValues();
|
||||
Base::Vector3d tempPos = DrawUtil::invertY(pos);
|
||||
Base::Vector3d tempPos = pos;
|
||||
if (invert) {
|
||||
tempPos = DrawUtil::invertY(pos);
|
||||
}
|
||||
TechDraw::CosmeticVertex* cv = new TechDraw::CosmeticVertex(tempPos);
|
||||
verts.push_back(cv);
|
||||
CosmeticVertexes.setValues(verts);
|
||||
@@ -393,6 +427,8 @@ void CosmeticExtension::removeCosmeticEdge(const std::string& delTag)
|
||||
/// remove the cosmetic edges with the given tags from the list property
|
||||
void CosmeticExtension::removeCosmeticEdge(const std::vector<std::string>& delTags)
|
||||
{
|
||||
// Base::Console().Message("DVP::removeCE(%d tages)\n", delTags.size());
|
||||
std::vector<CosmeticEdge*> cEdges = CosmeticEdges.getValues();
|
||||
for (auto& t: delTags) {
|
||||
removeCosmeticEdge(t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user