[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:
@@ -343,17 +343,9 @@ void ViewProviderViewPart::handleChangedPropertyType(Base::XMLReader &reader, co
|
||||
|
||||
bool ViewProviderViewPart::onDelete(const std::vector<std::string> & subNames)
|
||||
{
|
||||
// if a cosmetic subelement is in the list of selected subNames then we treat this
|
||||
// as a delete of the subelement and not a delete of the DVP
|
||||
std::vector<std::string> removables = getSelectedCosmetics(subNames);
|
||||
if (!removables.empty()) {
|
||||
// we have cosmetics, so remove them and tell Std_Delete not to remove the DVP
|
||||
deleteCosmeticElements(removables);
|
||||
getViewObject()->recomputeFeature();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Base::Console().Message("VPVP::onDelete(%d subNames)\n", subNames.size());
|
||||
// we cannot delete if the view has a section or detail view
|
||||
(void) subNames;
|
||||
QString bodyMessage;
|
||||
QTextStream bodyMessageStream(&bodyMessage);
|
||||
|
||||
@@ -380,52 +372,6 @@ bool ViewProviderViewPart::canDelete(App::DocumentObject *obj) const
|
||||
return true;
|
||||
}
|
||||
|
||||
//! extract the names of cosmetic subelements from the list of all selected elements
|
||||
std::vector<std::string> ViewProviderViewPart::getSelectedCosmetics(std::vector<std::string> subNames)
|
||||
{
|
||||
|
||||
std::vector<std::string> result;
|
||||
// pick out any cosmetic vertices or edges in the selection
|
||||
for (auto& sub : subNames) {
|
||||
if (DU::getGeomTypeFromName(sub) == "Vertex") {
|
||||
if (DU::isCosmeticVertex(getViewObject(), sub)) {
|
||||
result.emplace_back(sub);
|
||||
}
|
||||
} else if (DU::getGeomTypeFromName(sub) == "Edge") {
|
||||
if (DU::isCosmeticEdge(getViewObject(), sub) ||
|
||||
DU::isCenterLine(getViewObject(), sub)) {
|
||||
result.emplace_back(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//! delete cosmetic elements for a list of subelement names
|
||||
void ViewProviderViewPart::deleteCosmeticElements(std::vector<std::string> removables)
|
||||
{
|
||||
for (auto& name : removables) {
|
||||
if (DU::getGeomTypeFromName(name) == "Vertex") {
|
||||
CosmeticVertex* vert = getViewObject()->getCosmeticVertexBySelection(name);
|
||||
getViewObject()->removeCosmeticVertex(vert->getTagAsString());
|
||||
continue;
|
||||
}
|
||||
if (DU::getGeomTypeFromName(name) == "Edge") {
|
||||
CosmeticEdge* edge = getViewObject()->getCosmeticEdgeBySelection(name);
|
||||
if (edge) {
|
||||
// if not edge, something has gone very wrong!
|
||||
getViewObject()->removeCosmeticEdge(edge->getTagAsString());
|
||||
continue;
|
||||
}
|
||||
CenterLine* line = getViewObject()->getCenterLineBySelection(name);
|
||||
if (line) {
|
||||
getViewObject()->removeCenterLine(line->getTagAsString());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
App::Color ViewProviderViewPart::prefSectionColor()
|
||||
{
|
||||
return PreferencesGui::sectionLineColor();
|
||||
|
||||
Reference in New Issue
Block a user