diff --git a/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui b/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui
index ebdb52a5b9..f093eb5ffc 100644
--- a/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui
+++ b/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui
@@ -98,6 +98,14 @@
-
+ -
+
+
+
+ :/icons/edit-cleartext.svg:/icons/edit-cleartext.svg
+
+
+
-
@@ -244,7 +252,9 @@
-
+
+
+
comboBoxMode
diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp
index 90e7396a5f..62312c1d95 100644
--- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp
+++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp
@@ -156,7 +156,7 @@ TaskPipeParameters::~TaskPipeParameters()
//setting visibility to true is needed when preselecting profile and path prior to invoking sweep
Gui::cmdGuiObject(pipe, "Visibility = True");
- static_cast(vp)->highlightReferences(false, false);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, false);
}
}
catch (const Base::Exception& e) {
@@ -224,7 +224,6 @@ void TaskPipeParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
}
clearButtons();
- static_cast(vp)->highlightReferences(false, false);
recomputeFeature();
}
@@ -246,12 +245,12 @@ void TaskPipeParameters::onButtonRefAdd(bool checked) {
//hideObject();
Gui::Selection().clearSelection();
selectionMode = refAdd;
- static_cast(vp)->highlightReferences(true, false);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, true);
}
else {
Gui::Selection().clearSelection();
selectionMode = none;
- static_cast(vp)->highlightReferences(false, false);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, false);
}
}
@@ -262,12 +261,12 @@ void TaskPipeParameters::onButtonRefRemove(bool checked) {
//hideObject();
Gui::Selection().clearSelection();
selectionMode = refRemove;
- static_cast(vp)->highlightReferences(true, false);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, true);
}
else {
Gui::Selection().clearSelection();
selectionMode = none;
- static_cast(vp)->highlightReferences(false, false);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, false);
}
}
@@ -278,7 +277,12 @@ void TaskPipeParameters::onBaseButton(bool checked) {
//hideObject();
Gui::Selection().clearSelection();
selectionMode = refObjAdd;
- //DressUpView->highlightReferences(true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, true);
+ }
+ else {
+ Gui::Selection().clearSelection();
+ selectionMode = none;
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, false);
}
}
@@ -293,12 +297,16 @@ void TaskPipeParameters::onProfileButton(bool checked)
pvp->setVisible(true);
}
- static_cast(vp)->highlightReferences(false, false);
//clearButtons(refRemove);
//hideObject();
Gui::Selection().clearSelection();
selectionMode = refProfile;
- //DressUpView->highlightReferences(true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Profile, true);
+ }
+ else {
+ Gui::Selection().clearSelection();
+ selectionMode = none;
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Profile, false);
}
}
@@ -359,6 +367,8 @@ bool TaskPipeParameters::referenceSelected(const SelectionChanges& msg) const {
PartDesign::Pipe* pipe = static_cast(vp->getObject());
Gui::Document* doc = vp->getDocument();
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Profile, false);
+
bool success = true;
App::DocumentObject* profile = pipe->getDocument()->getObject(msg.pObjectName);
if (profile) {
@@ -385,6 +395,7 @@ bool TaskPipeParameters::referenceSelected(const SelectionChanges& msg) const {
std::vector::iterator f = std::find(refs.begin(), refs.end(), subName);
if (selectionMode == refObjAdd) {
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Spine, false);
refs.clear();
}
else if (selectionMode == refAdd) {
@@ -446,6 +457,8 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, bool /*newO
this, SLOT(onButtonRefRemove(bool)));
connect(ui->buttonProfileBase, SIGNAL(toggled(bool)),
this, SLOT(onBaseButton(bool)));
+ connect(ui->buttonProfileClear, SIGNAL(clicked()),
+ this, SLOT(onClearButton()));
connect(ui->stackedWidget, SIGNAL(currentChanged(int)),
this, SLOT(updateUI(int)));
connect(ui->curvelinear, SIGNAL(toggled(bool)),
@@ -517,7 +530,7 @@ TaskPipeOrientation::~TaskPipeOrientation()
auxSpineShow = false;
}
- static_cast(vp)->highlightReferences(false, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
}
}
catch (const Base::RuntimeError&) {
@@ -549,12 +562,12 @@ void TaskPipeOrientation::onButtonRefAdd(bool checked) {
if (checked) {
Gui::Selection().clearSelection();
selectionMode = refAdd;
- static_cast(vp)->highlightReferences(true, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, true);
}
else {
Gui::Selection().clearSelection();
selectionMode = none;
- static_cast(vp)->highlightReferences(false, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
}
}
@@ -563,12 +576,12 @@ void TaskPipeOrientation::onButtonRefRemove(bool checked) {
if (checked) {
Gui::Selection().clearSelection();
selectionMode = refRemove;
- static_cast(vp)->highlightReferences(true, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, true);
}
else {
Gui::Selection().clearSelection();
selectionMode = none;
- static_cast(vp)->highlightReferences(false, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
}
}
@@ -577,7 +590,22 @@ void TaskPipeOrientation::onBaseButton(bool checked)
if (checked) {
Gui::Selection().clearSelection();
selectionMode = refObjAdd;
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, true);
}
+ else {
+ Gui::Selection().clearSelection();
+ selectionMode = none;
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
+ }
+}
+
+void TaskPipeOrientation::onClearButton()
+{
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
+
+ ui->listWidgetReferences->clear();
+ ui->profileBaseEdit->clear();
+ static_cast(vp->getObject())->AuxillerySpine.setValue(nullptr);
}
void TaskPipeOrientation::onCurvelinearChanged(bool checked)
@@ -639,7 +667,7 @@ void TaskPipeOrientation::onSelectionChanged(const SelectionChanges& msg) {
}
clearButtons();
- static_cast(vp)->highlightReferences(false, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
recomputeFeature();
}
@@ -808,7 +836,12 @@ void TaskPipeScaling::onButtonRefAdd(bool checked) {
if (checked) {
Gui::Selection().clearSelection();
selectionMode = refAdd;
- //static_cast(vp)->highlightReferences(true, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Section, true);
+ }
+ else {
+ Gui::Selection().clearSelection();
+ selectionMode = none;
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Section, false);
}
}
@@ -817,7 +850,12 @@ void TaskPipeScaling::onButtonRefRemove(bool checked) {
if (checked) {
Gui::Selection().clearSelection();
selectionMode = refRemove;
- //static_cast(vp)->highlightReferences(true, true);
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Section, true);
+ }
+ else {
+ Gui::Selection().clearSelection();
+ selectionMode = none;
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Section, false);
}
}
@@ -850,7 +888,6 @@ void TaskPipeScaling::onSelectionChanged(const SelectionChanges& msg) {
}
clearButtons();
- //static_cast(vp)->highlightReferences(false, true);
recomputeFeature();
}
clearButtons();
@@ -892,6 +929,7 @@ bool TaskPipeScaling::referenceSelected(const SelectionChanges& msg) const {
return false;
}
+ static_cast(vp)->highlightReferences(ViewProviderPipe::Section, false);
static_cast(vp->getObject())->Sections.setValues(refs);
return true;
}
diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.h b/src/Mod/PartDesign/Gui/TaskPipeParameters.h
index 3c474c2533..cd4ad127b2 100644
--- a/src/Mod/PartDesign/Gui/TaskPipeParameters.h
+++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.h
@@ -102,6 +102,7 @@ private Q_SLOTS:
void onButtonRefRemove(bool checked);
void updateUI(int idx);
void onBaseButton(bool checked);
+ void onClearButton();
void onCurvelinearChanged(bool checked);
void onBinormalChanged(double);
void onDeleteItem();
diff --git a/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp b/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp
index dfeae56676..24c52f9245 100644
--- a/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp
+++ b/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp
@@ -129,46 +129,71 @@ bool ViewProviderPipe::onDelete(const std::vector &s)
-void ViewProviderPipe::highlightReferences(const bool on, bool auxiliary)
+void ViewProviderPipe::highlightReferences(ViewProviderPipe::Reference mode, bool on)
{
PartDesign::Pipe* pcPipe = static_cast(getObject());
- Part::Feature* base;
- if(!auxiliary)
- base = static_cast(pcPipe->Spine.getValue());
- else
- base = static_cast(pcPipe->AuxillerySpine.getValue());
- if (base == NULL) return;
+ switch (mode) {
+ case Spine:
+ highlightReferences(dynamic_cast(pcPipe->Spine.getValue()),
+ pcPipe->Spine.getSubValuesStartsWith("Edge"), on);
+ break;
+ case AuxiliarySpine:
+ highlightReferences(dynamic_cast(pcPipe->AuxillerySpine.getValue()),
+ pcPipe->AuxillerySpine.getSubValuesStartsWith("Edge"), on);
+ break;
+ case Profile:
+ highlightReferences(dynamic_cast(pcPipe->Profile.getValue()),
+ pcPipe->Profile.getSubValuesStartsWith("Edge"), on);
+ break;
+ case Section:
+ {
+ std::vector sections = pcPipe->Sections.getValues();
+ for (auto it : sections) {
+ highlightReferences(dynamic_cast(it),
+ std::vector(), on);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void ViewProviderPipe::highlightReferences(Part::Feature* base, const std::vector& edges, bool on) {
+
PartGui::ViewProviderPart* svp = dynamic_cast(
Gui::Application::Instance->getViewProvider(base));
- if (svp == NULL) return;
+ if (svp == nullptr)
+ return;
- std::vector edges;
- if(!auxiliary)
- edges = pcPipe->Spine.getSubValuesStartsWith("Edge");
- else
- edges = pcPipe->AuxillerySpine.getSubValuesStartsWith("Edge");
+ std::vector& edgeColors = originalLineColors[base->getID()];
if (on) {
- if (!edges.empty() && originalLineColors.empty()) {
+ if (edgeColors.empty()) {
TopTools_IndexedMapOfShape eMap;
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
- originalLineColors = svp->LineColorArray.getValues();
- std::vector colors = originalLineColors;
+ edgeColors = svp->LineColorArray.getValues();
+ std::vector colors = edgeColors;
colors.resize(eMap.Extent(), svp->LineColor.getValue());
- for (std::string e : edges) {
- int idx = std::stoi(e.substr(4)) - 1;
- assert ( idx >= 0 );
- if ( idx < (ssize_t) colors.size() )
- colors[idx] = App::Color(1.0,0.0,1.0); // magenta
+ if (!edges.empty()) {
+ for (std::string e : edges) {
+ int idx = std::stoi(e.substr(4)) - 1;
+ assert ( idx >= 0 );
+ if ( idx < (ssize_t) colors.size() )
+ colors[idx] = App::Color(1.0,0.0,1.0); // magenta
+ }
+ }
+ else {
+ std::fill(colors.begin(), colors.end(), App::Color(0.6,0.0,1.0)); // purple
}
svp->LineColorArray.setValues(colors);
}
} else {
- if (!edges.empty() && !originalLineColors.empty()) {
- svp->LineColorArray.setValues(originalLineColors);
- originalLineColors.clear();
+ if (!edgeColors.empty()) {
+ svp->LineColorArray.setValues(edgeColors);
+ edgeColors.clear();
}
}
}
diff --git a/src/Mod/PartDesign/Gui/ViewProviderPipe.h b/src/Mod/PartDesign/Gui/ViewProviderPipe.h
index b70cf443f5..7fbf6647ed 100644
--- a/src/Mod/PartDesign/Gui/ViewProviderPipe.h
+++ b/src/Mod/PartDesign/Gui/ViewProviderPipe.h
@@ -25,6 +25,7 @@
#define PARTGUI_ViewProviderPipe_H
#include "ViewProviderAddSub.h"
+#include