Surface: apply clang format
This commit is contained in:
@@ -22,16 +22,16 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QAction>
|
||||
# include <QMenu>
|
||||
# include <QMessageBox>
|
||||
# include <QTimer>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
# include <GeomAbs_Shape.hxx>
|
||||
# include <TopExp.hxx>
|
||||
# include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
# include <TopTools_IndexedMapOfShape.hxx>
|
||||
# include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#endif
|
||||
|
||||
#include <App/Document.h>
|
||||
@@ -45,16 +45,17 @@
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
|
||||
#include "TaskFilling.h"
|
||||
#include "ui_TaskFilling.h"
|
||||
#include "TaskFillingEdge.h"
|
||||
#include "TaskFillingVertex.h"
|
||||
#include "ui_TaskFilling.h"
|
||||
|
||||
|
||||
using namespace SurfaceGui;
|
||||
|
||||
PROPERTY_SOURCE(SurfaceGui::ViewProviderFilling, PartGui::ViewProviderSpline)
|
||||
|
||||
namespace SurfaceGui {
|
||||
namespace SurfaceGui
|
||||
{
|
||||
|
||||
void ViewProviderFilling::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
{
|
||||
@@ -66,20 +67,21 @@ void ViewProviderFilling::setupContextMenu(QMenu* menu, QObject* receiver, const
|
||||
|
||||
bool ViewProviderFilling::setEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// When double-clicking on the item for this sketch the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
|
||||
Surface::Filling* obj = static_cast<Surface::Filling*>(this->getObject());
|
||||
Surface::Filling* obj = static_cast<Surface::Filling*>(this->getObject());
|
||||
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
|
||||
// start the edit dialog
|
||||
if (dlg) {
|
||||
TaskFilling* tDlg = qobject_cast<TaskFilling*>(dlg);
|
||||
if (tDlg)
|
||||
if (tDlg) {
|
||||
tDlg->setEditedObject(obj);
|
||||
}
|
||||
Gui::Control().showDialog(dlg);
|
||||
}
|
||||
else {
|
||||
@@ -108,72 +110,78 @@ void ViewProviderFilling::highlightReferences(ShapeType type, const References&
|
||||
Part::Feature* base = dynamic_cast<Part::Feature*>(it.first);
|
||||
if (base) {
|
||||
PartGui::ViewProviderPartExt* svp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
Gui::Application::Instance->getViewProvider(base));
|
||||
Gui::Application::Instance->getViewProvider(base));
|
||||
if (svp) {
|
||||
switch (type) {
|
||||
case ViewProviderFilling::Vertex:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape vMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_VERTEX, vMap);
|
||||
colors.resize(vMap.Extent(), svp->PointColor.getValue());
|
||||
case ViewProviderFilling::Vertex:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape vMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_VERTEX, vMap);
|
||||
colors.resize(vMap.Extent(), svp->PointColor.getValue());
|
||||
|
||||
for (const auto& jt : it.second) {
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(6)) - 1);
|
||||
if (idx < colors.size())
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
for (const auto& jt : it.second) {
|
||||
// check again that the index is in range because it's possible that
|
||||
// the sub-names are invalid
|
||||
std::size_t idx =
|
||||
static_cast<std::size_t>(std::stoi(jt.substr(6)) - 1);
|
||||
if (idx < colors.size()) {
|
||||
colors[idx] = App::Color(1.0, 0.0, 1.0);// magenta
|
||||
}
|
||||
}
|
||||
|
||||
svp->setHighlightedPoints(colors);
|
||||
}
|
||||
|
||||
svp->setHighlightedPoints(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedPoints();
|
||||
}
|
||||
break;
|
||||
case ViewProviderFilling::Edge:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape eMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
if (idx < colors.size())
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
else {
|
||||
svp->unsetHighlightedPoints();
|
||||
}
|
||||
break;
|
||||
case ViewProviderFilling::Edge:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape eMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
svp->setHighlightedEdges(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedEdges();
|
||||
}
|
||||
break;
|
||||
case ViewProviderFilling::Face:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape fMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_FACE, fMap);
|
||||
colors.resize(fMap.Extent(), svp->ShapeColor.getValue());
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx =
|
||||
static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that
|
||||
// the sub-names are invalid
|
||||
if (idx < colors.size()) {
|
||||
colors[idx] = App::Color(1.0, 0.0, 1.0);// magenta
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
if (idx < colors.size())
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
svp->setHighlightedEdges(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedEdges();
|
||||
}
|
||||
break;
|
||||
case ViewProviderFilling::Face:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape fMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_FACE, fMap);
|
||||
colors.resize(fMap.Extent(), svp->ShapeColor.getValue());
|
||||
|
||||
svp->setHighlightedFaces(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedFaces();
|
||||
}
|
||||
break;
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx =
|
||||
static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that
|
||||
// the sub-names are invalid
|
||||
if (idx < colors.size()) {
|
||||
colors[idx] = App::Color(1.0, 0.0, 1.0);// magenta
|
||||
}
|
||||
}
|
||||
|
||||
svp->setHighlightedFaces(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedFaces();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,42 +190,44 @@ void ViewProviderFilling::highlightReferences(ShapeType type, const References&
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class FillingPanel::ShapeSelection : public Gui::SelectionFilterGate
|
||||
class FillingPanel::ShapeSelection: public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
ShapeSelection(FillingPanel::SelectionMode& mode, Surface::Filling* editedObject)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, mode(mode)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
}
|
||||
{}
|
||||
~ShapeSelection() override
|
||||
{
|
||||
mode = FillingPanel::None;
|
||||
}
|
||||
/**
|
||||
* Allow the user to pick only edges.
|
||||
*/
|
||||
* Allow the user to pick only edges.
|
||||
*/
|
||||
bool allow(App::Document*, App::DocumentObject* pObj, const char* sSubName) override
|
||||
{
|
||||
// don't allow references to itself
|
||||
if (pObj == editedObject)
|
||||
if (pObj == editedObject) {
|
||||
return false;
|
||||
if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
}
|
||||
if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sSubName || sSubName[0] == '\0')
|
||||
if (!sSubName || sSubName[0] == '\0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case FillingPanel::InitFace:
|
||||
return allowFace(pObj, sSubName);
|
||||
case FillingPanel::AppendEdge:
|
||||
return allowEdge(true, pObj, sSubName);
|
||||
case FillingPanel::RemoveEdge:
|
||||
return allowEdge(false, pObj, sSubName);
|
||||
default:
|
||||
return false;
|
||||
case FillingPanel::InitFace:
|
||||
return allowFace(pObj, sSubName);
|
||||
case FillingPanel::AppendEdge:
|
||||
return allowEdge(true, pObj, sSubName);
|
||||
case FillingPanel::RemoveEdge:
|
||||
return allowEdge(false, pObj, sSubName);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,22 +235,25 @@ private:
|
||||
bool allowFace(App::DocumentObject*, const char* sSubName)
|
||||
{
|
||||
std::string element(sSubName);
|
||||
if (element.substr(0,4) != "Face")
|
||||
if (element.substr(0, 4) != "Face") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool allowEdge(bool appendEdges, App::DocumentObject* pObj, const char* sSubName)
|
||||
{
|
||||
std::string element(sSubName);
|
||||
if (element.substr(0,4) != "Edge")
|
||||
if (element.substr(0, 4) != "Edge") {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto links = editedObject->BoundaryEdges.getSubListValues();
|
||||
for (const auto& it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (const auto& jt : it.second) {
|
||||
if (jt == sSubName)
|
||||
if (jt == sSubName) {
|
||||
return !appendEdges;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,7 +289,10 @@ FillingPanel::FillingPanel(ViewProviderFilling* vp, Surface::Filling* obj)
|
||||
connect(action, &QAction::triggered, this, &FillingPanel::onDeleteEdge);
|
||||
ui->listBoundary->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
connect(ui->listBoundary->model(), &QAbstractItemModel::rowsMoved, this, &FillingPanel::onIndexesMoved);
|
||||
// clang-format off
|
||||
connect(ui->listBoundary->model(), &QAbstractItemModel::rowsMoved,
|
||||
this, &FillingPanel::onIndexesMoved);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -290,6 +306,7 @@ FillingPanel::~FillingPanel()
|
||||
|
||||
void FillingPanel::setupConnections()
|
||||
{
|
||||
// clang-format off
|
||||
connect(ui->buttonInitFace, &QPushButton::clicked,
|
||||
this, &FillingPanel::onButtonInitFaceClicked);
|
||||
connect(ui->buttonEdgeAdd, &QToolButton::toggled,
|
||||
@@ -304,6 +321,7 @@ void FillingPanel::setupConnections()
|
||||
this, &FillingPanel::onButtonAcceptClicked);
|
||||
connect(ui->buttonIgnore, &QPushButton::clicked,
|
||||
this, &FillingPanel::onButtonIgnoreClicked);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void FillingPanel::appendButtons(Gui::ButtonGroup* buttonGroup)
|
||||
@@ -322,9 +340,9 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
|
||||
App::DocumentObject* initFace = editedObject->InitialFace.getValue();
|
||||
const std::vector<std::string>& subList = editedObject->InitialFace.getSubValues();
|
||||
if (initFace && subList.size() == 1) {
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(initFace->Label.getValue()),
|
||||
QString::fromStdString(subList.front()));
|
||||
QString text =
|
||||
QString::fromLatin1("%1.%2").arg(QString::fromUtf8(initFace->Label.getValue()),
|
||||
QString::fromStdString(subList.front()));
|
||||
ui->lineInitFaceName->setText(text);
|
||||
}
|
||||
|
||||
@@ -348,7 +366,7 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
|
||||
}
|
||||
|
||||
App::Document* doc = editedObject->getDocument();
|
||||
for (std::size_t i=0; i<count; i++) {
|
||||
for (std::size_t i = 0; i < count; i++) {
|
||||
App::DocumentObject* obj = objects[i];
|
||||
std::string edge = edges[i];
|
||||
std::string face = faces[i];
|
||||
@@ -356,9 +374,8 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listBoundary);
|
||||
ui->listBoundary->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()),
|
||||
QString::fromStdString(edge));
|
||||
QString text = QString::fromLatin1("%1.%2").arg(QString::fromUtf8(obj->Label.getValue()),
|
||||
QString::fromStdString(edge));
|
||||
item->setText(text);
|
||||
|
||||
// The user data field of a list widget item
|
||||
@@ -381,7 +398,7 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
|
||||
attachDocument(Gui::Application::Instance->getDocument(doc));
|
||||
}
|
||||
|
||||
void FillingPanel::changeEvent(QEvent *e)
|
||||
void FillingPanel::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
@@ -397,12 +414,13 @@ void FillingPanel::open()
|
||||
|
||||
// highlight the boundary edges
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
true);
|
||||
|
||||
// highlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.emplace_back(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues());
|
||||
editedObject->InitialFace.getSubValues());
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, true);
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
@@ -444,12 +462,13 @@ void FillingPanel::slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj)
|
||||
// referenced part objects. The dialog will be deleted later.
|
||||
if (this->vp == &Obj) {
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
false);
|
||||
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.emplace_back(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues());
|
||||
editedObject->InitialFace.getSubValues());
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
}
|
||||
}
|
||||
@@ -459,21 +478,24 @@ bool FillingPanel::accept()
|
||||
selectionMode = None;
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
|
||||
if (editedObject->mustExecute())
|
||||
if (editedObject->mustExecute()) {
|
||||
editedObject->recomputeFeature();
|
||||
}
|
||||
if (!editedObject->isValid()) {
|
||||
QMessageBox::warning(this, tr("Invalid object"),
|
||||
QString::fromLatin1(editedObject->getStatusString()));
|
||||
QMessageBox::warning(this,
|
||||
tr("Invalid object"),
|
||||
QString::fromLatin1(editedObject->getStatusString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
false);
|
||||
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.emplace_back(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues());
|
||||
editedObject->InitialFace.getSubValues());
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
|
||||
return true;
|
||||
@@ -483,12 +505,13 @@ bool FillingPanel::reject()
|
||||
{
|
||||
if (!editedObject.expired()) {
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
false);
|
||||
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.emplace_back(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues());
|
||||
editedObject->InitialFace.getSubValues());
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
}
|
||||
|
||||
@@ -506,7 +529,7 @@ void FillingPanel::onLineInitFaceNameTextChanged(const QString& text)
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.emplace_back(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues());
|
||||
editedObject->InitialFace.getSubValues());
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
|
||||
editedObject->InitialFace.setValue(nullptr);
|
||||
@@ -569,7 +592,10 @@ void FillingPanel::onListBoundaryItemDoubleClicked(QListWidgetItem* item)
|
||||
TopTools_IndexedMapOfShape faces;
|
||||
TopExp::MapShapes(shape.getShape(), TopAbs_FACE, faces);
|
||||
TopTools_IndexedDataMapOfShapeListOfShape edge2Face;
|
||||
TopExp::MapShapesAndAncestors(shape.getShape(), TopAbs_EDGE, TopAbs_FACE, edge2Face);
|
||||
TopExp::MapShapesAndAncestors(shape.getShape(),
|
||||
TopAbs_EDGE,
|
||||
TopAbs_FACE,
|
||||
edge2Face);
|
||||
const TopTools_ListOfShape& adj_faces = edge2Face.FindFromKey(edge);
|
||||
if (adj_faces.Extent() > 0) {
|
||||
int n = adj_faces.Extent();
|
||||
@@ -578,9 +604,12 @@ void FillingPanel::onListBoundaryItemDoubleClicked(QListWidgetItem* item)
|
||||
// fill up the combo boxes
|
||||
modifyBoundary(true);
|
||||
ui->comboBoxFaces->addItem(tr("None"), QByteArray(""));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("C0"), static_cast<int>(GeomAbs_C0));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("G1"), static_cast<int>(GeomAbs_G1));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("G2"), static_cast<int>(GeomAbs_G2));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("C0"),
|
||||
static_cast<int>(GeomAbs_C0));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("G1"),
|
||||
static_cast<int>(GeomAbs_G1));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("G2"),
|
||||
static_cast<int>(GeomAbs_G2));
|
||||
TopTools_ListIteratorOfListOfShape it(adj_faces);
|
||||
for (; it.More(); it.Next()) {
|
||||
const TopoDS_Shape& F = it.Value();
|
||||
@@ -613,16 +642,17 @@ void FillingPanel::onListBoundaryItemDoubleClicked(QListWidgetItem* item)
|
||||
|
||||
void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
{
|
||||
if (selectionMode == None)
|
||||
if (selectionMode == None) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.Type == Gui::SelectionChanges::AddSelection) {
|
||||
checkOpenCommand();
|
||||
if (selectionMode == InitFace) {
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
QString text = QString::fromLatin1("%1.%2").arg(
|
||||
QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
ui->lineInitFaceName->setText(text);
|
||||
|
||||
std::vector<std::string> subList;
|
||||
@@ -642,9 +672,9 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
ui->listBoundary->addItem(item);
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
QString text = QString::fromLatin1("%1.%2").arg(
|
||||
QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
@@ -675,7 +705,8 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
true);
|
||||
}
|
||||
else if (selectionMode == RemoveEdge) {
|
||||
Gui::SelectionObject sel(msg);
|
||||
@@ -685,10 +716,10 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
data << QByteArray(msg.pSubName);
|
||||
|
||||
// only the three first elements must match
|
||||
for (int i=0; i<ui->listBoundary->count(); i++) {
|
||||
for (int i = 0; i < ui->listBoundary->count(); i++) {
|
||||
QListWidgetItem* item = ui->listBoundary->item(i);
|
||||
QList<QVariant> userdata = item->data(Qt::UserRole).toList();
|
||||
if (userdata.mid(0,3) == data) {
|
||||
if (userdata.mid(0, 3) == data) {
|
||||
ui->listBoundary->takeItem(i);
|
||||
delete item;
|
||||
break;
|
||||
@@ -696,7 +727,8 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
false);
|
||||
App::DocumentObject* obj = sel.getObject();
|
||||
std::string sub = msg.pSubName;
|
||||
auto objects = editedObject->BoundaryEdges.getValues();
|
||||
@@ -729,7 +761,8 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
}
|
||||
}
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
true);
|
||||
}
|
||||
|
||||
editedObject->recomputeFeature();
|
||||
@@ -756,7 +789,8 @@ void FillingPanel::onDeleteEdge()
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
false);
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
if (*it == obj && *jt == sub) {
|
||||
std::size_t index = std::distance(objects.begin(), it);
|
||||
@@ -782,7 +816,8 @@ void FillingPanel::onDeleteEdge()
|
||||
}
|
||||
}
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
editedObject->BoundaryEdges.getSubListValues(),
|
||||
true);
|
||||
|
||||
editedObject->recomputeFeature();
|
||||
}
|
||||
@@ -791,8 +826,9 @@ void FillingPanel::onDeleteEdge()
|
||||
void FillingPanel::onIndexesMoved()
|
||||
{
|
||||
QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender());
|
||||
if (!model)
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> objects;
|
||||
std::vector<std::string> element;
|
||||
@@ -909,17 +945,19 @@ TaskFilling::TaskFilling(ViewProviderFilling* vp, Surface::Filling* obj)
|
||||
// first task box
|
||||
widget1 = new FillingPanel(vp, obj);
|
||||
widget1->appendButtons(buttonGroup);
|
||||
Gui::TaskView::TaskBox* taskbox1 = new Gui::TaskView::TaskBox(
|
||||
Gui::BitmapFactory().pixmap("Surface_Filling"),
|
||||
widget1->windowTitle(), true, nullptr);
|
||||
Gui::TaskView::TaskBox* taskbox1 =
|
||||
new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("Surface_Filling"),
|
||||
widget1->windowTitle(),
|
||||
true,
|
||||
nullptr);
|
||||
taskbox1->groupLayout()->addWidget(widget1);
|
||||
Content.push_back(taskbox1);
|
||||
|
||||
// second task box
|
||||
widget2 = new FillingEdgePanel(vp, obj);
|
||||
widget2->appendButtons(buttonGroup);
|
||||
Gui::TaskView::TaskBox* taskbox2 = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), widget2->windowTitle(), true, nullptr);
|
||||
Gui::TaskView::TaskBox* taskbox2 =
|
||||
new Gui::TaskView::TaskBox(QPixmap(), widget2->windowTitle(), true, nullptr);
|
||||
taskbox2->groupLayout()->addWidget(widget2);
|
||||
Content.push_back(taskbox2);
|
||||
taskbox2->hideGroupBox();
|
||||
@@ -927,8 +965,8 @@ TaskFilling::TaskFilling(ViewProviderFilling* vp, Surface::Filling* obj)
|
||||
// third task box
|
||||
widget3 = new FillingVertexPanel(vp, obj);
|
||||
widget3->appendButtons(buttonGroup);
|
||||
Gui::TaskView::TaskBox* taskbox3 = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), widget3->windowTitle(), true, nullptr);
|
||||
Gui::TaskView::TaskBox* taskbox3 =
|
||||
new Gui::TaskView::TaskBox(QPixmap(), widget3->windowTitle(), true, nullptr);
|
||||
taskbox3->groupLayout()->addWidget(widget3);
|
||||
Content.push_back(taskbox3);
|
||||
taskbox3->hideGroupBox();
|
||||
@@ -958,7 +996,7 @@ bool TaskFilling::accept()
|
||||
widget2->reject();
|
||||
widget3->reject();
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
}
|
||||
|
||||
@@ -972,13 +1010,13 @@ bool TaskFilling::reject()
|
||||
widget2->reject();
|
||||
widget3->reject();
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
}
|
||||
}// namespace SurfaceGui
|
||||
|
||||
#include "moc_TaskFilling.cpp"
|
||||
|
||||
Reference in New Issue
Block a user