Drawing: Apply clang format
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QCheckBox>
|
||||
# include <QMessageBox>
|
||||
#include <QCheckBox>
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <Gui/Application.h>
|
||||
@@ -43,26 +43,24 @@ using namespace DrawingGui;
|
||||
|
||||
TaskProjection::TaskProjection()
|
||||
{
|
||||
QString texts[10] =
|
||||
{
|
||||
tr("Visible sharp edges"),
|
||||
tr("Visible smooth edges"),
|
||||
tr("Visible sewn edges"),
|
||||
tr("Visible outline edges"),
|
||||
tr("Visible isoparameters"),
|
||||
tr("Hidden sharp edges"),
|
||||
tr("Hidden smooth edges"),
|
||||
tr("Hidden sewn edges"),
|
||||
tr("Hidden outline edges"),
|
||||
tr("Hidden isoparameters")
|
||||
};
|
||||
QString texts[10] = {tr("Visible sharp edges"),
|
||||
tr("Visible smooth edges"),
|
||||
tr("Visible sewn edges"),
|
||||
tr("Visible outline edges"),
|
||||
tr("Visible isoparameters"),
|
||||
tr("Hidden sharp edges"),
|
||||
tr("Hidden smooth edges"),
|
||||
tr("Hidden sewn edges"),
|
||||
tr("Hidden outline edges"),
|
||||
tr("Hidden isoparameters")};
|
||||
widget = new QWidget();
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout;
|
||||
|
||||
for (int i=0; i<10; i++) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
QCheckBox* cb = new QCheckBox();
|
||||
if (i < 5)
|
||||
if (i < 5) {
|
||||
cb->setChecked(true);
|
||||
}
|
||||
cb->setText(texts[i]);
|
||||
mainLayout->addWidget(cb);
|
||||
boxes.push_back(cb);
|
||||
@@ -70,8 +68,7 @@ TaskProjection::TaskProjection()
|
||||
|
||||
widget->setLayout(mainLayout);
|
||||
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), tr("Project shapes"), false, nullptr);
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), tr("Project shapes"), false, nullptr);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
@@ -85,54 +82,76 @@ bool TaskProjection::accept()
|
||||
{
|
||||
Gui::Document* document = Gui::Application::Instance->activeDocument();
|
||||
if (!document) {
|
||||
QMessageBox::warning(widget, tr("No active document"),
|
||||
tr("There is currently no active document to complete the operation"));
|
||||
QMessageBox::warning(widget,
|
||||
tr("No active document"),
|
||||
tr("There is currently no active document to complete the operation"));
|
||||
return true;
|
||||
}
|
||||
std::list<Gui::MDIView*> mdis = document->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId());
|
||||
std::list<Gui::MDIView*> mdis =
|
||||
document->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId());
|
||||
if (mdis.empty()) {
|
||||
QMessageBox::warning(widget, tr("No active view"),
|
||||
tr("There is currently no active view to complete the operation"));
|
||||
QMessageBox::warning(widget,
|
||||
tr("No active view"),
|
||||
tr("There is currently no active view to complete the operation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(mdis.front())->getViewer();
|
||||
Gui::View3DInventorViewer* viewer =
|
||||
static_cast<Gui::View3DInventor*>(mdis.front())->getViewer();
|
||||
SbVec3f pnt, dir;
|
||||
viewer->getNearPlane(pnt, dir);
|
||||
float x=0, y=1,z=1;
|
||||
dir.getValue(x,y,z);
|
||||
float x = 0, y = 1, z = 1;
|
||||
dir.getValue(x, y, z);
|
||||
|
||||
std::vector<Part::Feature*> shapes = Gui::Selection().getObjectsOfType<Part::Feature>();
|
||||
Gui::Command::openCommand("Project shape");
|
||||
Gui::Command::addModule(Gui::Command::Doc,"Drawing");
|
||||
Gui::Command::addModule(Gui::Command::Doc, "Drawing");
|
||||
for (std::vector<Part::Feature*>::iterator it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
const char* object = (*it)->getNameInDocument();
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.addObject('Drawing::FeatureProjection','%s_proj')",
|
||||
object);
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Direction=FreeCAD.Vector(%f,%f,%f)",
|
||||
x,
|
||||
y,
|
||||
z);
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Source=FreeCAD.ActiveDocument.%s",
|
||||
object);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.addObject('Drawing::FeatureProjection','%s_proj')", object);
|
||||
"FreeCAD.ActiveDocument.ActiveObject.VCompound=%s",
|
||||
(boxes[0]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Direction=FreeCAD.Vector(%f,%f,%f)", x,y,z);
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Rg1LineVCompound=%s",
|
||||
(boxes[1]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Source=FreeCAD.ActiveDocument.%s", object);
|
||||
"FreeCAD.ActiveDocument.ActiveObject.RgNLineVCompound=%s",
|
||||
(boxes[2]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.VCompound=%s", (boxes[0]->isChecked() ? "True" : "False"));
|
||||
"FreeCAD.ActiveDocument.ActiveObject.OutLineVCompound=%s",
|
||||
(boxes[3]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Rg1LineVCompound=%s", (boxes[1]->isChecked() ? "True" : "False"));
|
||||
"FreeCAD.ActiveDocument.ActiveObject.IsoLineVCompound=%s",
|
||||
(boxes[4]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.RgNLineVCompound=%s", (boxes[2]->isChecked() ? "True" : "False"));
|
||||
"FreeCAD.ActiveDocument.ActiveObject.HCompound=%s",
|
||||
(boxes[5]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.OutLineVCompound=%s", (boxes[3]->isChecked() ? "True" : "False"));
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Rg1LineHCompound=%s",
|
||||
(boxes[6]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.IsoLineVCompound=%s", (boxes[4]->isChecked() ? "True" : "False"));
|
||||
"FreeCAD.ActiveDocument.ActiveObject.RgNLineHCompound=%s",
|
||||
(boxes[7]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.HCompound=%s", (boxes[5]->isChecked() ? "True" : "False"));
|
||||
"FreeCAD.ActiveDocument.ActiveObject.OutLineHCompound=%s",
|
||||
(boxes[8]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.Rg1LineHCompound=%s", (boxes[6]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.RgNLineHCompound=%s", (boxes[7]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.OutLineHCompound=%s", (boxes[8]->isChecked() ? "True" : "False"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"FreeCAD.ActiveDocument.ActiveObject.IsoLineHCompound=%s", (boxes[9]->isChecked() ? "True" : "False"));
|
||||
"FreeCAD.ActiveDocument.ActiveObject.IsoLineHCompound=%s",
|
||||
(boxes[9]->isChecked() ? "True" : "False"));
|
||||
}
|
||||
Gui::Command::updateActive();
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
Reference in New Issue
Block a user