Moved DrawUtil.cpp member functions to DrawViewPart.cpp
Updated ownership of member functions & updated headers Removed redundant ownership lines Removed reference to removed ownership line Removed owner from function head static reference removed from header file, function heads updated attempt to fix CosmeticExtension.cpp attempt to fix CosmeticExtension.cpp #2 attempt to fix CosmeticExtension.cpp #3 CosmeticExtension.cpp refactored based on DrawUtil member functions move
This commit is contained in:
committed by
Benjamin Nauck
parent
a8183e0b30
commit
35bae9a3ff
@@ -66,16 +66,17 @@ TechDraw::DrawViewPart* CosmeticExtension::getOwner()
|
||||
void CosmeticExtension::deleteCosmeticElements(std::vector<std::string> removables)
|
||||
{
|
||||
// Base::Console().Message("CEx::deleteCosmeticElements(%d removables)\n", removables.size());
|
||||
DrawViewPart* viewPart = getOwner();
|
||||
for (auto& name : removables) {
|
||||
if (DU::getGeomTypeFromName(name) == "Vertex" &&
|
||||
DU::isCosmeticVertex(getOwner(), name)) {
|
||||
viewPart->isCosmeticVertex(name)) {
|
||||
CosmeticVertex* vert = getCosmeticVertexBySelection(name);
|
||||
removeCosmeticVertex(vert->getTagAsString());
|
||||
continue;
|
||||
}
|
||||
if (DU::getGeomTypeFromName(name) == "Edge" &&
|
||||
( DU::isCosmeticEdge(getOwner(), name) ||
|
||||
DU::isCenterLine(getOwner(), name) ) ) {
|
||||
( viewPart->isCosmeticEdge(name) ||
|
||||
viewPart->isCenterLine(name))) {
|
||||
CosmeticEdge* edge = getCosmeticEdgeBySelection(name);
|
||||
if (edge) {
|
||||
// if not edge, something has gone very wrong!
|
||||
|
||||
@@ -1859,40 +1859,6 @@ std::string DrawUtil::translateArbitrary(std::string context, std::string baseNa
|
||||
return qTranslated.toStdString() + suffix;
|
||||
}
|
||||
|
||||
// true if owner->element is a cosmetic vertex
|
||||
bool DrawUtil::isCosmeticVertex(App::DocumentObject* owner, std::string element)
|
||||
{
|
||||
auto ownerView = static_cast<TechDraw::DrawViewPart*>(owner);
|
||||
auto vertexIndex = DrawUtil::getIndexFromName(element);
|
||||
auto vertex = ownerView->getProjVertexByIndex(vertexIndex);
|
||||
if (vertex) {
|
||||
return vertex->getCosmetic();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// true if owner->element is a cosmetic edge
|
||||
bool DrawUtil::isCosmeticEdge(App::DocumentObject* owner, std::string element)
|
||||
{
|
||||
auto ownerView = static_cast<TechDraw::DrawViewPart*>(owner);
|
||||
auto edge = ownerView->getEdge(element);
|
||||
if (edge && edge->source() == SourceType::COSMETICEDGE && edge->getCosmetic()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// true if owner->element is a center line
|
||||
bool DrawUtil::isCenterLine(App::DocumentObject* owner, std::string element)
|
||||
{
|
||||
auto ownerView = static_cast<TechDraw::DrawViewPart*>(owner);
|
||||
auto edge = ownerView->getEdge(element);
|
||||
if (edge && edge->source() == SourceType::CENTERLINE && edge->getCosmetic()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! convert a filespec (string) containing '\' to only use '/'.
|
||||
//! prevents situation where '\' is interpreted as an escape of the next character in Python
|
||||
//! commands.
|
||||
|
||||
@@ -247,10 +247,6 @@ public:
|
||||
|
||||
static std::string translateArbitrary(std::string context, std::string baseName, std::string uniqueName);
|
||||
|
||||
static bool isCosmeticVertex(App::DocumentObject* owner, std::string element);
|
||||
static bool isCosmeticEdge(App::DocumentObject* owner, std::string element);
|
||||
static bool isCenterLine(App::DocumentObject* owner, std::string element);
|
||||
|
||||
static Base::Vector3d toAppSpace(const DrawViewPart& dvp, const Base::Vector3d& inPoint);
|
||||
static Base::Vector3d toAppSpace(const DrawViewPart& dvp, const QPointF& inPoint);
|
||||
|
||||
|
||||
@@ -1501,6 +1501,37 @@ void DrawViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char
|
||||
}
|
||||
}
|
||||
|
||||
// true if owner->element is a cosmetic vertex
|
||||
bool DrawViewPart::isCosmeticVertex(const std::string& element)
|
||||
{
|
||||
auto vertexIndex = DrawUtil::getIndexFromName(element);
|
||||
auto vertex = getProjVertexByIndex(vertexIndex);
|
||||
if (vertex) {
|
||||
return vertex->getCosmetic();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// true if owner->element is a cosmetic edge
|
||||
bool DrawViewPart::isCosmeticEdge(const std::string& element)
|
||||
{
|
||||
auto edge = getEdge(element);
|
||||
if (edge && edge->source() == SourceType::COSMETICEDGE && edge->getCosmetic()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// true if owner->element is a center line
|
||||
bool DrawViewPart::isCenterLine(const std::string& element)
|
||||
{
|
||||
auto edge = getEdge(element);
|
||||
if (edge && edge->source() == SourceType::CENTERLINE && edge->getCosmetic()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// debugging ----------------------------------------------------------------------------
|
||||
|
||||
void DrawViewPart::dumpVerts(std::string text)
|
||||
|
||||
@@ -239,6 +239,10 @@ public:
|
||||
virtual bool waitingForResult() const;
|
||||
void progressValueChanged(int v);
|
||||
|
||||
bool isCosmeticVertex(const std::string& element);
|
||||
bool isCosmeticEdge(const std::string& element);
|
||||
bool isCenterLine(const std::string& element);
|
||||
|
||||
public Q_SLOTS:
|
||||
void onHlrFinished(void);
|
||||
void onFacesFinished(void);
|
||||
|
||||
Reference in New Issue
Block a user