[FEM] post object: some whitespace and style fixes
all made by MSVC
This commit is contained in:
@@ -110,16 +110,16 @@ void PointMarker::customEvent(QEvent*)
|
||||
const SbVec3f& pt1 = vp->pCoords->point[0];
|
||||
const SbVec3f& pt2 = vp->pCoords->point[1];
|
||||
|
||||
if(m_name == "DataAlongLine"){
|
||||
PointsChanged(pt1[0],pt1[1], pt1[2], pt2[0],pt2[1], pt2[2]);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point1 = App.Vector(%f, %f, %f)", m_name.c_str(), pt1[0],pt1[1], pt1[2]);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point2 = App.Vector(%f, %f, %f)", m_name.c_str(), pt2[0],pt2[1], pt2[2]);
|
||||
if (m_name == "DataAlongLine") {
|
||||
PointsChanged(pt1[0], pt1[1], pt1[2], pt2[0], pt2[1], pt2[2]);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Point1 = App.Vector(%f, %f, %f)", m_name.c_str(), pt1[0], pt1[1], pt1[2]);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Point2 = App.Vector(%f, %f, %f)", m_name.c_str(), pt2[0], pt2[1], pt2[2]);
|
||||
}
|
||||
Gui::Command::doCommand(Gui::Command::Doc, ObjectInvisible().c_str());
|
||||
}
|
||||
|
||||
std::string PointMarker::ObjectInvisible(){
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
std::string PointMarker::ObjectInvisible() {
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
if \"Mesh\" in amesh.TypeId:\n\
|
||||
aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\
|
||||
for apart in App.activeDocument().Objects:\n\
|
||||
@@ -165,7 +165,7 @@ void DataMarker::addPoint(const SbVec3f& pt)
|
||||
{
|
||||
int ct = countPoints();
|
||||
vp->pCoords->point.set1Value(ct, pt);
|
||||
vp->pMarker->numPoints=ct+1;
|
||||
vp->pMarker->numPoints = ct + 1;
|
||||
|
||||
}
|
||||
|
||||
@@ -178,15 +178,15 @@ void DataMarker::customEvent(QEvent*)
|
||||
{
|
||||
const SbVec3f& pt1 = vp->pCoords->point[0];
|
||||
|
||||
if(m_name == "DataAtPoint"){
|
||||
PointsChanged(pt1[0],pt1[1], pt1[2]);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", m_name.c_str(), pt1[0],pt1[1], pt1[2]);
|
||||
if (m_name == "DataAtPoint") {
|
||||
PointsChanged(pt1[0], pt1[1], pt1[2]);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", m_name.c_str(), pt1[0], pt1[1], pt1[2]);
|
||||
}
|
||||
Gui::Command::doCommand(Gui::Command::Doc, ObjectInvisible().c_str());
|
||||
}
|
||||
|
||||
std::string DataMarker::ObjectInvisible(){
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
std::string DataMarker::ObjectInvisible() {
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
if \"Mesh\" in amesh.TypeId:\n\
|
||||
aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\
|
||||
for apart in App.activeDocument().Objects:\n\
|
||||
@@ -203,7 +203,7 @@ ViewProviderDataMarker::ViewProviderDataMarker()
|
||||
pCoords->point.setNum(0);
|
||||
pMarker = new SoMarkerSet();
|
||||
pMarker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_FILLED", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 9));
|
||||
pMarker->numPoints=0;
|
||||
pMarker->numPoints = 0;
|
||||
pMarker->ref();
|
||||
|
||||
SoGroup* grp = new SoGroup();
|
||||
@@ -224,7 +224,7 @@ ViewProviderDataMarker::~ViewProviderDataMarker()
|
||||
// TaskDialog
|
||||
// ***************************************************************************
|
||||
|
||||
TaskDlgPost::TaskDlgPost(Gui::ViewProviderDocumentObject *view)
|
||||
TaskDlgPost::TaskDlgPost(Gui::ViewProviderDocumentObject* view)
|
||||
: TaskDialog(), m_view(view)
|
||||
{
|
||||
assert(view);
|
||||
@@ -239,11 +239,11 @@ QDialogButtonBox::StandardButtons TaskDlgPost::getStandardButtons(void) const {
|
||||
|
||||
//check if we only have gui task boxes
|
||||
bool guionly = true;
|
||||
for(std::vector<TaskPostBox*>::const_iterator it = m_boxes.begin(); it != m_boxes.end(); ++it)
|
||||
for (std::vector<TaskPostBox*>::const_iterator it = m_boxes.begin(); it != m_boxes.end(); ++it)
|
||||
guionly = guionly && (*it)->isGuiTaskOnly();
|
||||
|
||||
if(!guionly)
|
||||
return QDialogButtonBox::Apply|QDialogButtonBox::Ok|QDialogButtonBox::Cancel;
|
||||
if (!guionly)
|
||||
return QDialogButtonBox::Apply | QDialogButtonBox::Ok | QDialogButtonBox::Cancel;
|
||||
else
|
||||
return QDialogButtonBox::Ok;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ void TaskDlgPost::open()
|
||||
|
||||
void TaskDlgPost::clicked(int button)
|
||||
{
|
||||
if(button == QDialogButtonBox::Apply)
|
||||
if (button == QDialogButtonBox::Apply)
|
||||
getView()->getObject()->getDocument()->recompute();
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ bool TaskDlgPost::accept()
|
||||
|
||||
try {
|
||||
std::vector<TaskPostBox*>::iterator it = m_boxes.begin();
|
||||
for(;it != m_boxes.end(); ++it)
|
||||
for (; it != m_boxes.end(); ++it)
|
||||
(*it)->applyPythonCode();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -281,7 +281,7 @@ bool TaskDlgPost::accept()
|
||||
return false;
|
||||
}
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -289,20 +289,20 @@ bool TaskDlgPost::reject()
|
||||
{
|
||||
// roll back the done things
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TaskDlgPost::modifyStandardButtons(QDialogButtonBox* box) {
|
||||
|
||||
if(box->button(QDialogButtonBox::Apply))
|
||||
if (box->button(QDialogButtonBox::Apply))
|
||||
box->button(QDialogButtonBox::Apply)->setDefault(true);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// some task box methods
|
||||
TaskPostBox::TaskPostBox(Gui::ViewProviderDocumentObject* view, const QPixmap &icon, const QString &title, QWidget* parent)
|
||||
TaskPostBox::TaskPostBox(Gui::ViewProviderDocumentObject* view, const QPixmap& icon, const QString& title, QWidget* parent)
|
||||
: TaskBox(icon, title, true, parent) {
|
||||
|
||||
m_view = view;
|
||||
@@ -321,7 +321,7 @@ bool TaskPostBox::autoApply() {
|
||||
|
||||
void TaskPostBox::recompute() {
|
||||
|
||||
if(autoApply())
|
||||
if (autoApply())
|
||||
App::GetApplication().getActiveDocument()->recompute();
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ void TaskPostBox::updateEnumerationList(App::PropertyEnumeration& prop, QComboBo
|
||||
|
||||
QStringList list;
|
||||
std::vector<std::string> vec = prop.getEnumVector();
|
||||
for(std::vector<std::string>::iterator it = vec.begin(); it != vec.end(); ++it ) {
|
||||
for (std::vector<std::string>::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
list.push_back(QString::fromStdString(*it));
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ void TaskPostBox::updateEnumerationList(App::PropertyEnumeration& prop, QComboBo
|
||||
|
||||
// ***************************************************************************
|
||||
// post pipeline results
|
||||
TaskPostDisplay::TaskPostDisplay(Gui::ViewProviderDocumentObject* view, QWidget *parent)
|
||||
TaskPostDisplay::TaskPostDisplay(Gui::ViewProviderDocumentObject* view, QWidget* parent)
|
||||
: TaskPostBox(view, Gui::BitmapFactory().pixmap("FEM_ResultShow"), tr("Result display options"), parent)
|
||||
{
|
||||
//we need a separate container widget to add all controls to
|
||||
@@ -402,7 +402,7 @@ void TaskPostDisplay::applyPythonCode() {
|
||||
// ***************************************************************************
|
||||
// ?
|
||||
// the icon fem-post-geo-plane might be wrong but I do not know any better since the plane is one of the implicit functions
|
||||
TaskPostFunction::TaskPostFunction(ViewProviderDocumentObject* view, QWidget* parent): TaskPostBox(view, Gui::BitmapFactory().pixmap("fem-post-geo-plane"), tr("Implicit function"), parent) {
|
||||
TaskPostFunction::TaskPostFunction(ViewProviderDocumentObject* view, QWidget* parent) : TaskPostBox(view, Gui::BitmapFactory().pixmap("fem-post-geo-plane"), tr("Implicit function"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostFunction::getClassTypeId()));
|
||||
|
||||
@@ -425,11 +425,11 @@ void TaskPostFunction::applyPythonCode() {
|
||||
// ***************************************************************************
|
||||
// region clip filter
|
||||
TaskPostClip::TaskPostClip(ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent)
|
||||
: TaskPostBox(view,Gui::BitmapFactory().pixmap("FEM_PostFilterClipRegion"), tr("Clip region, choose implicit function"), parent) {
|
||||
: TaskPostBox(view, Gui::BitmapFactory().pixmap("FEM_PostFilterClipRegion"), tr("Clip region, choose implicit function"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostClip::getClassTypeId()));
|
||||
assert(function);
|
||||
Q_UNUSED(function)
|
||||
Q_UNUSED(function);
|
||||
|
||||
fwidget = nullptr;
|
||||
|
||||
@@ -441,14 +441,14 @@ TaskPostClip::TaskPostClip(ViewProviderDocumentObject* view, App::PropertyLink*
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
//the layout for the container widget
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
ui->Container->setLayout(layout);
|
||||
|
||||
//fill up the combo box with possible functions
|
||||
collectImplicitFunctions();
|
||||
|
||||
//add the function creation command
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
Gui::Command* cmd = rcCmdMgr.getCommandByName("FEM_PostCreateFunctions");
|
||||
if (cmd && cmd->getAction())
|
||||
cmd->getAction()->addTo(ui->CreateButton);
|
||||
@@ -472,15 +472,15 @@ void TaskPostClip::collectImplicitFunctions() {
|
||||
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
Fem::FemPostPipeline* pipeline = pipelines.front();
|
||||
if (pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
ui->FunctionBox->clear();
|
||||
QStringList items;
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
for(std::size_t i=0; i<funcs.size(); ++i)
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
for (std::size_t i = 0; i < funcs.size(); ++i)
|
||||
items.push_back(QString::fromLatin1(funcs[i]->getNameInDocument()));
|
||||
|
||||
ui->FunctionBox->addItems(items);
|
||||
@@ -500,13 +500,13 @@ void TaskPostClip::on_FunctionBox_currentIndexChanged(int idx) {
|
||||
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
Fem::FemPostPipeline* pipeline = pipelines.front();
|
||||
if (pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
if(idx>=0)
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
if (idx >= 0)
|
||||
static_cast<Fem::FemPostClipFilter*>(getObject())->Function.setValue(funcs[idx]);
|
||||
else
|
||||
static_cast<Fem::FemPostClipFilter*>(getObject())->Function.setValue(nullptr);
|
||||
@@ -515,15 +515,15 @@ void TaskPostClip::on_FunctionBox_currentIndexChanged(int idx) {
|
||||
|
||||
//load the correct view
|
||||
Fem::FemPostFunction* fobj = static_cast<Fem::FemPostFunction*>(
|
||||
static_cast<Fem::FemPostClipFilter*>(getObject())->Function.getValue());
|
||||
static_cast<Fem::FemPostClipFilter*>(getObject())->Function.getValue());
|
||||
Gui::ViewProvider* view = nullptr;
|
||||
if(fobj)
|
||||
if (fobj)
|
||||
view = Gui::Application::Instance->activeDocument()->getViewProvider(fobj);
|
||||
|
||||
if(fwidget)
|
||||
if (fwidget)
|
||||
fwidget->deleteLater();
|
||||
|
||||
if(view) {
|
||||
if (view) {
|
||||
fwidget = static_cast<FemGui::ViewProviderFemPostFunction*>(view)->createControlWidget();
|
||||
fwidget->setParent(ui->Container);
|
||||
fwidget->setViewProvider(static_cast<FemGui::ViewProviderFemPostFunction*>(view));
|
||||
@@ -547,7 +547,7 @@ void TaskPostClip::on_InsideOut_toggled(bool val) {
|
||||
// ***************************************************************************
|
||||
// data along a line
|
||||
TaskPostDataAlongLine::TaskPostDataAlongLine(ViewProviderDocumentObject* view, QWidget* parent)
|
||||
: TaskPostBox(view,Gui::BitmapFactory().pixmap("FEM_PostFilterDataAlongLine"), tr("Data along a line options"), parent) {
|
||||
: TaskPostBox(view, Gui::BitmapFactory().pixmap("FEM_PostFilterDataAlongLine"), tr("Data along a line options"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostDataAlongLine::getClassTypeId()));
|
||||
|
||||
@@ -594,7 +594,7 @@ void TaskPostDataAlongLine::applyPythonCode() {
|
||||
|
||||
}
|
||||
|
||||
static const char * cursor_triangle[] = {
|
||||
static const char* cursor_triangle[] = {
|
||||
"32 32 3 1",
|
||||
" c None",
|
||||
". c #FFFFFF",
|
||||
@@ -615,7 +615,7 @@ static const char * cursor_triangle[] = {
|
||||
" + ++++ + ",
|
||||
" + ++ ++ + ",
|
||||
" + ++++++++ + ",
|
||||
" ++ ++ ++ ++ "};
|
||||
" ++ ++ ++ ++ " };
|
||||
|
||||
void TaskPostDataAlongLine::on_SelectPoints_clicked() {
|
||||
|
||||
@@ -635,12 +635,11 @@ void TaskPostDataAlongLine::on_SelectPoints_clicked() {
|
||||
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
|
||||
FemGui::TaskPostDataAlongLine::pointCallback, marker);
|
||||
connect(marker, SIGNAL(PointsChanged(double, double, double, double, double, double)), this, SLOT(onChange(double, double, double, double, double, double)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
std::string TaskPostDataAlongLine::ObjectVisible(){
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
std::string TaskPostDataAlongLine::ObjectVisible() {
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
if \"Mesh\" in amesh.TypeId:\n\
|
||||
aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\
|
||||
for apart in App.activeDocument().Objects:\n\
|
||||
@@ -651,9 +650,9 @@ return "for amesh in App.activeDocument().Objects:\n\
|
||||
void TaskPostDataAlongLine::on_CreatePlot_clicked() {
|
||||
|
||||
std::string ObjName = static_cast<Fem::FemPostDataAlongLineFilter*>(getObject())->Label.getValue();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"x = App.ActiveDocument.%s.XAxisData",ObjName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"y = App.ActiveDocument.%s.YAxisData",ObjName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"title = App.ActiveDocument.%s.PlotData",ObjName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "x = App.ActiveDocument.%s.XAxisData", ObjName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "y = App.ActiveDocument.%s.YAxisData", ObjName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "title = App.ActiveDocument.%s.PlotData", ObjName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, Plot().c_str());
|
||||
recompute();
|
||||
}
|
||||
@@ -667,43 +666,38 @@ void TaskPostDataAlongLine::onChange(double x1, double y1, double z1, double x2,
|
||||
ui->point1X->setValue(x1);
|
||||
ui->point1Y->setValue(y1);
|
||||
ui->point1Z->setValue(z1);
|
||||
|
||||
}
|
||||
|
||||
void TaskPostDataAlongLine::point1Changed(double) {
|
||||
|
||||
Base::Vector3d vec(ui->point1X->value(), ui->point1Y->value(), ui->point1Z->value());
|
||||
std::string ObjName = static_cast<Fem::FemPostDataAlongLineFilter*>(getObject())->Label.getValue();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point1 = App.Vector(%f, %f, %f)",ObjName.c_str(), ui->point1X->value(), ui->point1Y->value(), ui->point1Z->value());
|
||||
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Point1 = App.Vector(%f, %f, %f)", ObjName.c_str(), ui->point1X->value(), ui->point1Y->value(), ui->point1Z->value());
|
||||
}
|
||||
|
||||
void TaskPostDataAlongLine::point2Changed(double) {
|
||||
|
||||
Base::Vector3d vec(ui->point2X->value(), ui->point2Y->value(), ui->point2Z->value());
|
||||
std::string ObjName = static_cast<Fem::FemPostDataAlongLineFilter*>(getObject())->Label.getValue();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point2 = App.Vector(%f, %f, %f)", ObjName.c_str(), ui->point2X->value(), ui->point2Y->value(), ui->point2Z->value());
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Point2 = App.Vector(%f, %f, %f)", ObjName.c_str(), ui->point2X->value(), ui->point2Y->value(), ui->point2Z->value());
|
||||
}
|
||||
|
||||
void TaskPostDataAlongLine::resolutionChanged(int val) {
|
||||
|
||||
static_cast<Fem::FemPostDataAlongLineFilter*>(getObject())->Resolution.setValue(val);
|
||||
|
||||
}
|
||||
|
||||
void TaskPostDataAlongLine::pointCallback(void * ud, SoEventCallback * n)
|
||||
void TaskPostDataAlongLine::pointCallback(void* ud, SoEventCallback* n)
|
||||
{
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
PointMarker *pm = reinterpret_cast<PointMarker*>(ud);
|
||||
const SoMouseButtonEvent* mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
PointMarker* pm = reinterpret_cast<PointMarker*>(ud);
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
|
||||
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
|
||||
const SoPickedPoint * point = n->getPickedPoint();
|
||||
const SoPickedPoint* point = n->getPickedPoint();
|
||||
if (point == nullptr) {
|
||||
Base::Console().Message("No point picked.\n");
|
||||
return;
|
||||
@@ -712,7 +706,7 @@ void TaskPostDataAlongLine::pointCallback(void * ud, SoEventCallback * n)
|
||||
n->setHandled();
|
||||
pm->addPoint(point->getPoint());
|
||||
if (pm->countPoints() == 2) {
|
||||
QEvent *e = new QEvent(QEvent::User);
|
||||
QEvent* e = new QEvent(QEvent::User);
|
||||
QApplication::postEvent(pm, e);
|
||||
// leave mode
|
||||
view->setEditing(false);
|
||||
@@ -758,13 +752,12 @@ plt.ylabel(title)\n\
|
||||
plt.title(title)\n\
|
||||
plt.grid()\n\
|
||||
plt.show()\n";
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// data at point
|
||||
TaskPostDataAtPoint::TaskPostDataAtPoint(ViewProviderDocumentObject* view, QWidget* parent)
|
||||
: TaskPostBox(view,Gui::BitmapFactory().pixmap("FEM_PostFilterDataAtPoint"), tr("Data at point options"), parent) {
|
||||
: TaskPostBox(view, Gui::BitmapFactory().pixmap("FEM_PostFilterDataAtPoint"), tr("Data at point options"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostDataAtPoint::getClassTypeId()));
|
||||
|
||||
@@ -797,7 +790,7 @@ void TaskPostDataAtPoint::applyPythonCode() {
|
||||
|
||||
}
|
||||
|
||||
static const char * cursor_star[] = {
|
||||
static const char* cursor_star[] = {
|
||||
"32 32 3 1",
|
||||
" c None",
|
||||
". c #FFFFFF",
|
||||
@@ -818,7 +811,7 @@ static const char * cursor_star[] = {
|
||||
" + ++++ + ",
|
||||
" + ++ ++ + ",
|
||||
" + ++++++++ + ",
|
||||
" ++ ++ ++ ++ "};
|
||||
" ++ ++ ++ ++ " };
|
||||
|
||||
void TaskPostDataAtPoint::on_SelectPoint_clicked() {
|
||||
|
||||
@@ -838,14 +831,13 @@ void TaskPostDataAtPoint::on_SelectPoint_clicked() {
|
||||
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
|
||||
FemGui::TaskPostDataAtPoint::pointCallback, marker);
|
||||
connect(marker, SIGNAL(PointsChanged(double, double, double)), this, SLOT(onChange(double, double, double)));
|
||||
}
|
||||
getTypedView<ViewProviderFemPostObject>()->DisplayMode.setValue(1);
|
||||
updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->Field, ui->Field);
|
||||
|
||||
}
|
||||
getTypedView<ViewProviderFemPostObject>()->DisplayMode.setValue(1);
|
||||
updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->Field, ui->Field);
|
||||
}
|
||||
|
||||
std::string TaskPostDataAtPoint::ObjectVisible(){
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
std::string TaskPostDataAtPoint::ObjectVisible() {
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
if \"Mesh\" in amesh.TypeId:\n\
|
||||
aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\
|
||||
for apart in App.activeDocument().Objects:\n\
|
||||
@@ -858,28 +850,26 @@ void TaskPostDataAtPoint::onChange(double x, double y, double z) {
|
||||
ui->centerX->setValue(x);
|
||||
ui->centerY->setValue(y);
|
||||
ui->centerZ->setValue(z);
|
||||
|
||||
}
|
||||
|
||||
void TaskPostDataAtPoint::centerChanged(double) {
|
||||
|
||||
Base::Vector3d vec(ui->centerX->value(), ui->centerY->value(), ui->centerZ->value());
|
||||
std::string ObjName = static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Label.getValue();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)",ObjName.c_str(), ui->centerX->value(), ui->centerY->value(), ui->centerZ->value());
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", ObjName.c_str(), ui->centerX->value(), ui->centerY->value(), ui->centerZ->value());
|
||||
}
|
||||
|
||||
void TaskPostDataAtPoint::pointCallback(void * ud, SoEventCallback * n)
|
||||
void TaskPostDataAtPoint::pointCallback(void* ud, SoEventCallback* n)
|
||||
{
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
DataMarker *pm = reinterpret_cast<DataMarker*>(ud);
|
||||
const SoMouseButtonEvent* mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
DataMarker* pm = reinterpret_cast<DataMarker*>(ud);
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
|
||||
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
|
||||
const SoPickedPoint * point = n->getPickedPoint();
|
||||
const SoPickedPoint* point = n->getPickedPoint();
|
||||
if (point == nullptr) {
|
||||
Base::Console().Message("No point picked.\n");
|
||||
return;
|
||||
@@ -888,7 +878,7 @@ void TaskPostDataAtPoint::pointCallback(void * ud, SoEventCallback * n)
|
||||
n->setHandled();
|
||||
pm->addPoint(point->getPoint());
|
||||
if (pm->countPoints() == 1) {
|
||||
QEvent *e = new QEvent(QEvent::User);
|
||||
QEvent* e = new QEvent(QEvent::User);
|
||||
QApplication::postEvent(pm, e);
|
||||
// leave mode
|
||||
view->setEditing(false);
|
||||
@@ -908,20 +898,20 @@ void TaskPostDataAtPoint::on_Field_activated(int i) {
|
||||
getTypedView<ViewProviderFemPostObject>()->Field.setValue(i);
|
||||
std::string FieldName = ui->Field->currentText().toStdString();
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->FieldName.setValue(FieldName);
|
||||
if ((FieldName == "Von Mises stress") || (FieldName == "Max shear stress (Tresca)") || (FieldName == "Maximum Principal stress") || (FieldName == "Minimum Principal stress") || (FieldName == "Median Principal stress") || (FieldName == "Stress vectors")){
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.setValue("MPa");
|
||||
if ((FieldName == "Von Mises stress") || (FieldName == "Max shear stress (Tresca)") || (FieldName == "Maximum Principal stress") || (FieldName == "Minimum Principal stress") || (FieldName == "Median Principal stress") || (FieldName == "Stress vectors")) {
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.setValue("MPa");
|
||||
}
|
||||
else if (FieldName == "Displacement"){
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.setValue("mm");
|
||||
else if (FieldName == "Displacement") {
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.setValue("mm");
|
||||
}
|
||||
else if (FieldName == "Temperature"){
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.setValue("K");
|
||||
else if (FieldName == "Temperature") {
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.setValue("K");
|
||||
}
|
||||
|
||||
std::string PointData = " The value at that location is " + std::to_string(static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->PointData[0]) + " " +static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.getValue() + "\n";
|
||||
std::string PointData = " The value at that location is " + std::to_string(static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->PointData[0]) + " " + static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.getValue() + "\n";
|
||||
QMessageBox::information(Gui::getMainWindow(),
|
||||
qApp->translate("CmdFemPostCreateDataAtPointFilter", "Data At Point"),
|
||||
qApp->translate("CmdFemPostCreateDataAtPointFilter", PointData.c_str()));
|
||||
qApp->translate("CmdFemPostCreateDataAtPointFilter", "Data At Point"),
|
||||
qApp->translate("CmdFemPostCreateDataAtPointFilter", PointData.c_str()));
|
||||
Base::Console().Error(PointData.c_str());
|
||||
}
|
||||
|
||||
@@ -1002,14 +992,14 @@ void TaskPostScalarClip::on_Scalar_currentIndexChanged(int idx) {
|
||||
void TaskPostScalarClip::on_Slider_valueChanged(int v) {
|
||||
|
||||
App::PropertyFloatConstraint& value = static_cast<Fem::FemPostScalarClipFilter*>(getObject())->Value;
|
||||
double val = value.getConstraints()->LowerBound * (1-double(v)/100.) + double(v)/100.*value.getConstraints()->UpperBound;
|
||||
double val = value.getConstraints()->LowerBound * (1 - double(v) / 100.) + double(v) / 100. * value.getConstraints()->UpperBound;
|
||||
|
||||
value.setValue(val);
|
||||
recompute();
|
||||
|
||||
//don't forget to sync the spinbox
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( val );
|
||||
ui->Value->setValue(val);
|
||||
ui->Value->blockSignals(false);
|
||||
}
|
||||
|
||||
@@ -1021,7 +1011,7 @@ void TaskPostScalarClip::on_Value_valueChanged(double v) {
|
||||
|
||||
//don't forget to sync the slider
|
||||
ui->Slider->blockSignals(true);
|
||||
ui->Slider->setValue(int(((v- value.getConstraints()->LowerBound)/(value.getConstraints()->UpperBound - value.getConstraints()->LowerBound))*100.));
|
||||
ui->Slider->setValue(int(((v - value.getConstraints()->LowerBound) / (value.getConstraints()->UpperBound - value.getConstraints()->LowerBound)) * 100.));
|
||||
ui->Slider->blockSignals(false);
|
||||
}
|
||||
|
||||
@@ -1060,10 +1050,10 @@ TaskPostWarpVector::TaskPostWarpVector(ViewProviderDocumentObject* view, QWidget
|
||||
// TODO if warp is set to standard 1.0, find a smarter way for standard min, max and warp_factor
|
||||
// may be depend on grid boundbox and min max vector values
|
||||
ui->Max->blockSignals(true);
|
||||
ui->Max->setValue( warp_factor==0 ? 1 : warp_factor * 10.);
|
||||
ui->Max->setValue(warp_factor == 0 ? 1 : warp_factor * 10.);
|
||||
ui->Max->blockSignals(false);
|
||||
ui->Min->blockSignals(true);
|
||||
ui->Min->setValue( warp_factor==0 ? 0 : warp_factor / 10.);
|
||||
ui->Min->setValue(warp_factor == 0 ? 0 : warp_factor / 10.);
|
||||
ui->Min->blockSignals(false);
|
||||
|
||||
// sync slider
|
||||
@@ -1103,7 +1093,7 @@ void TaskPostWarpVector::on_Slider_valueChanged(int slider_value) {
|
||||
// warp_factor = min + ( slider_value x --------------- )
|
||||
// 100
|
||||
//
|
||||
double warp_factor = ui->Min->value() + (( ui->Max->value() - ui->Min->value()) / 100.) * slider_value;
|
||||
double warp_factor = ui->Min->value() + ((ui->Max->value() - ui->Min->value()) / 100.) * slider_value;
|
||||
static_cast<Fem::FemPostWarpVectorFilter*>(getObject())->Factor.setValue(warp_factor);
|
||||
recompute();
|
||||
|
||||
@@ -1177,13 +1167,13 @@ void TaskPostWarpVector::on_Min_valueChanged(double) {
|
||||
// ***************************************************************************
|
||||
// function clip filter
|
||||
TaskPostCut::TaskPostCut(ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent)
|
||||
: TaskPostBox(view,Gui::BitmapFactory().pixmap("FEM_PostFilterCutFunction"), tr("Function cut, choose implicit function"), parent) {
|
||||
: TaskPostBox(view, Gui::BitmapFactory().pixmap("FEM_PostFilterCutFunction"), tr("Function cut, choose implicit function"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostCut::getClassTypeId()));
|
||||
assert(function);
|
||||
Q_UNUSED(function)
|
||||
|
||||
fwidget = nullptr;
|
||||
fwidget = nullptr;
|
||||
|
||||
//we load the views widget
|
||||
proxy = new QWidget(this);
|
||||
@@ -1193,14 +1183,14 @@ TaskPostCut::TaskPostCut(ViewProviderDocumentObject* view, App::PropertyLink* fu
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
//the layout for the container widget
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
ui->Container->setLayout(layout);
|
||||
|
||||
//fill up the combo box with possible functions
|
||||
collectImplicitFunctions();
|
||||
|
||||
//add the function creation command
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
Gui::Command* cmd = rcCmdMgr.getCommandByName("FEM_PostCreateFunctions");
|
||||
if (cmd && cmd->getAction())
|
||||
cmd->getAction()->addTo(ui->CreateButton);
|
||||
@@ -1220,15 +1210,15 @@ void TaskPostCut::collectImplicitFunctions() {
|
||||
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
Fem::FemPostPipeline* pipeline = pipelines.front();
|
||||
if (pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
ui->FunctionBox->clear();
|
||||
QStringList items;
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
for(std::size_t i=0; i<funcs.size(); ++i)
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
for (std::size_t i = 0; i < funcs.size(); ++i)
|
||||
items.push_back(QString::fromLatin1(funcs[i]->getNameInDocument()));
|
||||
|
||||
ui->FunctionBox->addItems(items);
|
||||
@@ -1248,13 +1238,13 @@ void TaskPostCut::on_FunctionBox_currentIndexChanged(int idx) {
|
||||
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
Fem::FemPostPipeline* pipeline = pipelines.front();
|
||||
if (pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
if(idx>=0)
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
if (idx >= 0)
|
||||
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.setValue(funcs[idx]);
|
||||
else
|
||||
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.setValue(nullptr);
|
||||
@@ -1263,15 +1253,15 @@ void TaskPostCut::on_FunctionBox_currentIndexChanged(int idx) {
|
||||
|
||||
//load the correct view
|
||||
Fem::FemPostFunction* fobj = static_cast<Fem::FemPostFunction*>(
|
||||
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.getValue());
|
||||
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.getValue());
|
||||
Gui::ViewProvider* view = nullptr;
|
||||
if(fobj)
|
||||
if (fobj)
|
||||
view = Gui::Application::Instance->activeDocument()->getViewProvider(fobj);
|
||||
|
||||
if(fwidget)
|
||||
if (fwidget)
|
||||
fwidget->deleteLater();
|
||||
|
||||
if(view) {
|
||||
if (view) {
|
||||
fwidget = static_cast<FemGui::ViewProviderFemPostFunction*>(view)->createControlWidget();
|
||||
fwidget->setParent(ui->Container);
|
||||
fwidget->setViewProvider(static_cast<FemGui::ViewProviderFemPostFunction*>(view));
|
||||
|
||||
@@ -45,7 +45,7 @@ void ViewProviderFemPostClip::setupTaskDialog(TaskDlgPost* dlg) {
|
||||
|
||||
//add the function box
|
||||
dlg->appendBox(new TaskPostClip(dlg->getView(),
|
||||
&static_cast<Fem::FemPostClipFilter*>(dlg->getView()->getObject())->Function));
|
||||
&static_cast<Fem::FemPostClipFilter*>(dlg->getView()->getObject())->Function));
|
||||
|
||||
//add the display options
|
||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||
@@ -144,7 +144,7 @@ void ViewProviderFemPostCut::setupTaskDialog(TaskDlgPost* dlg) {
|
||||
|
||||
//add the function box
|
||||
dlg->appendBox(new TaskPostCut(dlg->getView(),
|
||||
&static_cast<Fem::FemPostCutFilter*>(dlg->getView()->getObject())->Function));
|
||||
&static_cast<Fem::FemPostCutFilter*>(dlg->getView()->getObject())->Function));
|
||||
|
||||
//add the display options
|
||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||
|
||||
@@ -81,7 +81,7 @@ void FunctionWidget::setViewProvider(ViewProviderFemPostFunction* view) {
|
||||
|
||||
void FunctionWidget::onObjectsChanged(const App::DocumentObject& obj, const App::Property& p) {
|
||||
|
||||
if(&obj == m_object)
|
||||
if (&obj == m_object)
|
||||
onChange(p);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ void ViewProviderFemPostFunctionProvider::onChanged(const App::Property* prop) {
|
||||
void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop) {
|
||||
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||
|
||||
if(strcmp(prop->getName(), "Functions") == 0) {
|
||||
if (strcmp(prop->getName(), "Functions") == 0) {
|
||||
updateSize();
|
||||
}
|
||||
}
|
||||
@@ -122,9 +122,9 @@ void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop)
|
||||
void ViewProviderFemPostFunctionProvider::updateSize() {
|
||||
|
||||
std::vector< App::DocumentObject* > vec = claimChildren();
|
||||
for(std::vector< App::DocumentObject* >::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
for (std::vector< App::DocumentObject* >::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
|
||||
if(!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId()))
|
||||
if (!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId()))
|
||||
continue;
|
||||
|
||||
ViewProviderFemPostFunction* vp = static_cast<FemGui::ViewProviderFemPostFunction*>(Gui::Application::Instance->getViewProvider(*it));
|
||||
@@ -154,7 +154,7 @@ ViewProviderFemPostFunction::ViewProviderFemPostFunction()
|
||||
|
||||
m_scale = new SoScale();
|
||||
m_scale->ref();
|
||||
m_scale->scaleFactor = SbVec3f(1,1,1);
|
||||
m_scale->scaleFactor = SbVec3f(1, 1, 1);
|
||||
}
|
||||
|
||||
ViewProviderFemPostFunction::~ViewProviderFemPostFunction()
|
||||
@@ -165,13 +165,13 @@ ViewProviderFemPostFunction::~ViewProviderFemPostFunction()
|
||||
//transform is unref'd when it is replaced by the dragger
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj)
|
||||
void ViewProviderFemPostFunction::attach(App::DocumentObject* pcObj)
|
||||
{
|
||||
ViewProviderDocumentObject::attach(pcObj);
|
||||
|
||||
// setup the graph for editing the function unit geometry
|
||||
SoMaterial* color = new SoMaterial();
|
||||
color->diffuseColor.setValue(0,0,1);
|
||||
color->diffuseColor.setValue(0, 0, 1);
|
||||
color->transparency.setValue(0.5);
|
||||
|
||||
m_transform = new SoTransform;
|
||||
@@ -197,7 +197,7 @@ void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj)
|
||||
sa.setSearchingAll(FALSE);
|
||||
sa.setNode(m_transform);
|
||||
sa.apply(pcEditNode);
|
||||
SoPath * path = sa.getPath();
|
||||
SoPath* path = sa.getPath();
|
||||
if (path) {
|
||||
m_manip->replaceNode(path);
|
||||
|
||||
@@ -231,7 +231,7 @@ std::vector<std::string> ViewProviderFemPostFunction::getDisplayModes(void) cons
|
||||
return StrList;
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::dragStartCallback(void *data, SoDragger *)
|
||||
void ViewProviderFemPostFunction::dragStartCallback(void* data, SoDragger*)
|
||||
{
|
||||
// This is called when a manipulator is about to manipulating
|
||||
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Edit Mirror"));
|
||||
@@ -242,24 +242,24 @@ void ViewProviderFemPostFunction::dragStartCallback(void *data, SoDragger *)
|
||||
that->m_autoRecompute = hGrp->GetBool("PostAutoRecompute", false);
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::dragFinishCallback(void *data, SoDragger *)
|
||||
void ViewProviderFemPostFunction::dragFinishCallback(void* data, SoDragger*)
|
||||
{
|
||||
// This is called when a manipulator has done manipulating
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
if(that->m_autoRecompute)
|
||||
if (that->m_autoRecompute)
|
||||
that->getObject()->getDocument()->recompute();
|
||||
|
||||
reinterpret_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = false;
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::dragMotionCallback(void *data, SoDragger *drag)
|
||||
void ViewProviderFemPostFunction::dragMotionCallback(void* data, SoDragger* drag)
|
||||
{
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
that->draggerUpdate(drag);
|
||||
|
||||
if(that->m_autoRecompute)
|
||||
if (that->m_autoRecompute)
|
||||
that->getObject()->getDocument()->recompute();
|
||||
}
|
||||
|
||||
@@ -267,10 +267,10 @@ void ViewProviderFemPostFunction::dragMotionCallback(void *data, SoDragger *drag
|
||||
bool ViewProviderFemPostFunction::setEdit(int ModNum) {
|
||||
|
||||
|
||||
if (ModNum == ViewProvider::Default || ModNum == 1 ) {
|
||||
if (ModNum == ViewProvider::Default || ModNum == 1) {
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgPost *postDlg = qobject_cast<TaskDlgPost*>(dlg);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
TaskDlgPost* postDlg = qobject_cast<TaskDlgPost*>(dlg);
|
||||
if (postDlg && postDlg->getView() != this)
|
||||
postDlg = nullptr; // another pad left open its task panel
|
||||
if (dlg && !postDlg) {
|
||||
@@ -317,7 +317,7 @@ void ViewProviderFemPostFunction::onChanged(const App::Property* prop) {
|
||||
|
||||
Gui::ViewProviderDocumentObject::onChanged(prop);
|
||||
|
||||
if(m_autoscale)
|
||||
if (m_autoscale)
|
||||
m_scale->scaleFactor = SbVec3f(AutoScaleFactorX.getValue(), AutoScaleFactorY.getValue(), AutoScaleFactorZ.getValue());
|
||||
}
|
||||
|
||||
@@ -337,9 +337,9 @@ ViewProviderFemPostPlaneFunction::ViewProviderFemPostPlaneFunction() {
|
||||
SoCoordinate3* points = new SoCoordinate3();
|
||||
points->point.setNum(4);
|
||||
points->point.set1Value(0, -0.5, -0.5, 0);
|
||||
points->point.set1Value(1, -0.5, 0.5, 0);
|
||||
points->point.set1Value(2, 0.5, 0.5, 0);
|
||||
points->point.set1Value(3, 0.5, -0.5, 0);
|
||||
points->point.set1Value(1, -0.5, 0.5, 0);
|
||||
points->point.set1Value(2, 0.5, 0.5, 0);
|
||||
points->point.set1Value(3, 0.5, -0.5, 0);
|
||||
points->point.set1Value(4, -0.5, -0.5, 0);
|
||||
SoLineSet* line = new SoLineSet();
|
||||
getGeometryNode()->addChild(points);
|
||||
@@ -359,28 +359,28 @@ void ViewProviderFemPostPlaneFunction::draggerUpdate(SoDragger* m) {
|
||||
SbRotation rot, scaleDir;
|
||||
const SbVec3f& center = dragger->center.getValue();
|
||||
|
||||
SbVec3f norm(0,0,1);
|
||||
dragger->rotation.getValue().multVec(norm,norm);
|
||||
SbVec3f norm(0, 0, 1);
|
||||
dragger->rotation.getValue().multVec(norm, norm);
|
||||
func->Origin.setValue(center[0], center[1], center[2]);
|
||||
func->Normal.setValue(norm[0],norm[1],norm[2]);
|
||||
func->Normal.setValue(norm[0], norm[1], norm[2]);
|
||||
|
||||
SbVec3f t = static_cast<SoCenterballManip*>(getManipulator())->translation.getValue();
|
||||
SbVec3f rt, irt;
|
||||
dragger->rotation.getValue().multVec(t,rt);
|
||||
dragger->rotation.getValue().inverse().multVec(t,irt);
|
||||
dragger->rotation.getValue().multVec(t, rt);
|
||||
dragger->rotation.getValue().inverse().multVec(t, irt);
|
||||
}
|
||||
|
||||
void ViewProviderFemPostPlaneFunction::updateData(const App::Property* p) {
|
||||
|
||||
Fem::FemPostPlaneFunction* func = static_cast<Fem::FemPostPlaneFunction*>(getObject());
|
||||
|
||||
if(!isDragging() && (p == &func->Origin || p == &func->Normal)) {
|
||||
if (!isDragging() && (p == &func->Origin || p == &func->Normal)) {
|
||||
|
||||
Base::Vector3d trans = func->Origin.getValue();
|
||||
Base::Vector3d norm = func->Normal.getValue();
|
||||
|
||||
norm = norm / norm.Length();
|
||||
SbRotation rot(SbVec3f(0.,0.,1.), SbVec3f(norm.x, norm.y, norm.z));
|
||||
SbRotation rot(SbVec3f(0., 0., 1.), SbVec3f(norm.x, norm.y, norm.z));
|
||||
|
||||
SbMatrix t, translate;
|
||||
t.setRotate(rot);
|
||||
@@ -429,13 +429,13 @@ void PlaneWidget::setViewProvider(ViewProviderFemPostFunction* view) {
|
||||
void PlaneWidget::onChange(const App::Property& p) {
|
||||
|
||||
setBlockObjectUpdates(true);
|
||||
if(strcmp(p.getName(), "Normal") == 0) {
|
||||
if (strcmp(p.getName(), "Normal") == 0) {
|
||||
const Base::Vector3d& vec = static_cast<const App::PropertyVector*>(&p)->getValue();
|
||||
ui->normalX->setValue(vec.x);
|
||||
ui->normalY->setValue(vec.y);
|
||||
ui->normalZ->setValue(vec.z);
|
||||
}
|
||||
else if(strcmp(p.getName(), "Origin") == 0) {
|
||||
else if (strcmp(p.getName(), "Origin") == 0) {
|
||||
const Base::Vector3d& vec = static_cast<const App::PropertyVectorDistance*>(&p)->getValue();
|
||||
ui->originX->setValue(vec.x);
|
||||
ui->originY->setValue(vec.y);
|
||||
@@ -446,15 +446,15 @@ void PlaneWidget::onChange(const App::Property& p) {
|
||||
|
||||
void PlaneWidget::normalChanged(double) {
|
||||
|
||||
if(!blockObjectUpdates()) {
|
||||
if (!blockObjectUpdates()) {
|
||||
Base::Vector3d vec(ui->normalX->value(), ui->normalY->value(), ui->normalZ->value());
|
||||
static_cast<Fem::FemPostPlaneFunction*>(getObject())->Normal.setValue(vec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlaneWidget::originChanged(double) {
|
||||
|
||||
if(!blockObjectUpdates()) {
|
||||
if (!blockObjectUpdates()) {
|
||||
Base::Vector3d vec(ui->originX->value(), ui->originY->value(), ui->originZ->value());
|
||||
static_cast<Fem::FemPostPlaneFunction*>(getObject())->Origin.setValue(vec);
|
||||
}
|
||||
@@ -474,21 +474,21 @@ ViewProviderFemPostSphereFunction::ViewProviderFemPostSphereFunction() {
|
||||
|
||||
//setup the visualisation geometry
|
||||
SoCoordinate3* points = new SoCoordinate3();
|
||||
points->point.setNum(2*84);
|
||||
points->point.setNum(2 * 84);
|
||||
int idx = 0;
|
||||
for(int i=0; i<4; i++) {
|
||||
for(int j=0; j<21; j++) {
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(2*M_PI/20*j) * std::cos(M_PI/4*i),
|
||||
std::sin(2*M_PI/20*j) * std::sin(M_PI/4*i),
|
||||
std::cos(2*M_PI/20*j) ));
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 21; j++) {
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(2 * M_PI / 20 * j) * std::cos(M_PI / 4 * i),
|
||||
std::sin(2 * M_PI / 20 * j) * std::sin(M_PI / 4 * i),
|
||||
std::cos(2 * M_PI / 20 * j)));
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
for(int i=0; i<4; i++) {
|
||||
for(int j=0; j<21; j++) {
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(M_PI/4*i) * std::cos(2*M_PI/20*j),
|
||||
std::sin(M_PI/4*i) * std::sin(2*M_PI/20*j),
|
||||
std::cos(M_PI/4*i) ));
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 21; j++) {
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(M_PI / 4 * i) * std::cos(2 * M_PI / 20 * j),
|
||||
std::sin(M_PI / 4 * i) * std::sin(2 * M_PI / 20 * j),
|
||||
std::cos(M_PI / 4 * i)));
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
@@ -529,7 +529,7 @@ void ViewProviderFemPostSphereFunction::draggerUpdate(SoDragger* m) {
|
||||
SbRotation rot, scaleDir;
|
||||
const SbVec3f& center = dragger->translation.getValue();
|
||||
|
||||
SbVec3f norm(0,0,1);
|
||||
SbVec3f norm(0, 0, 1);
|
||||
func->Center.setValue(center[0], center[1], center[2]);
|
||||
func->Radius.setValue(dragger->scaleFactor.getValue()[0]);
|
||||
}
|
||||
@@ -538,7 +538,7 @@ void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) {
|
||||
|
||||
Fem::FemPostSphereFunction* func = static_cast<Fem::FemPostSphereFunction*>(getObject());
|
||||
|
||||
if(!isDragging() && (p == &func->Center || p == &func->Radius)) {
|
||||
if (!isDragging() && (p == &func->Center || p == &func->Radius)) {
|
||||
|
||||
Base::Vector3d trans = func->Center.getValue();
|
||||
double radius = func->Radius.getValue();
|
||||
@@ -548,7 +548,6 @@ void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) {
|
||||
translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z));
|
||||
t.multRight(translate);
|
||||
getManipulator()->setMatrix(t);
|
||||
|
||||
}
|
||||
Gui::ViewProviderDocumentObject::updateData(p);
|
||||
}
|
||||
@@ -588,11 +587,11 @@ void SphereWidget::setViewProvider(ViewProviderFemPostFunction* view) {
|
||||
void SphereWidget::onChange(const App::Property& p) {
|
||||
|
||||
setBlockObjectUpdates(true);
|
||||
if(strcmp(p.getName(), "Radius") == 0) {
|
||||
if (strcmp(p.getName(), "Radius") == 0) {
|
||||
double val = static_cast<const App::PropertyDistance*>(&p)->getValue();
|
||||
ui->radius->setValue(val);
|
||||
}
|
||||
else if(strcmp(p.getName(), "Center") == 0) {
|
||||
else if (strcmp(p.getName(), "Center") == 0) {
|
||||
const Base::Vector3d& vec = static_cast<const App::PropertyVectorDistance*>(&p)->getValue();
|
||||
ui->centerX->setValue(vec.x);
|
||||
ui->centerY->setValue(vec.y);
|
||||
@@ -603,15 +602,15 @@ void SphereWidget::onChange(const App::Property& p) {
|
||||
|
||||
void SphereWidget::centerChanged(double) {
|
||||
|
||||
if(!blockObjectUpdates()) {
|
||||
if (!blockObjectUpdates()) {
|
||||
Base::Vector3d vec(ui->centerX->value(), ui->centerY->value(), ui->centerZ->value());
|
||||
static_cast<Fem::FemPostSphereFunction*>(getObject())->Center.setValue(vec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SphereWidget::radiusChanged(double) {
|
||||
|
||||
if(!blockObjectUpdates()) {
|
||||
if (!blockObjectUpdates()) {
|
||||
static_cast<Fem::FemPostSphereFunction*>(getObject())->Radius.setValue(ui->radius->value());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemPostObject, Gui::ViewProviderDocumentObje
|
||||
|
||||
ViewProviderFemPostObject::ViewProviderFemPostObject() : m_blockPropertyChanges(false)
|
||||
{
|
||||
//initialize the properties
|
||||
ADD_PROPERTY_TYPE(Field,((long)0), "Coloring", App::Prop_None, "Select the field used for calculating the color");
|
||||
ADD_PROPERTY_TYPE(VectorMode,((long)0), "Coloring", App::Prop_None, "Select what to show for a vector field");
|
||||
//initialize the properties
|
||||
ADD_PROPERTY_TYPE(Field, ((long)0), "Coloring", App::Prop_None, "Select the field used for calculating the color");
|
||||
ADD_PROPERTY_TYPE(VectorMode, ((long)0), "Coloring", App::Prop_None, "Select what to show for a vector field");
|
||||
ADD_PROPERTY(Transparency, (0));
|
||||
ADD_PROPERTY(Scale, (1.0));
|
||||
|
||||
@@ -113,7 +113,7 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() : m_blockPropertyChanges(
|
||||
m_colorBar->ref();
|
||||
|
||||
//create the vtk algorithms we use for visualisation
|
||||
m_outline = vtkSmartPointer<vtkOutlineCornerFilter>::New();
|
||||
m_outline = vtkSmartPointer<vtkOutlineCornerFilter>::New();
|
||||
m_points = vtkSmartPointer<vtkVertexGlyphFilter>::New();
|
||||
m_pointsSurface = vtkSmartPointer<vtkVertexGlyphFilter>::New();
|
||||
m_surface = vtkSmartPointer<vtkGeometryFilter>::New();
|
||||
@@ -150,7 +150,7 @@ ViewProviderFemPostObject::~ViewProviderFemPostObject()
|
||||
m_colorRoot->unref();
|
||||
}
|
||||
|
||||
void ViewProviderFemPostObject::attach(App::DocumentObject *pcObj)
|
||||
void ViewProviderFemPostObject::attach(App::DocumentObject* pcObj)
|
||||
{
|
||||
ViewProviderDocumentObject::attach(pcObj);
|
||||
|
||||
@@ -165,8 +165,8 @@ void ViewProviderFemPostObject::attach(App::DocumentObject *pcObj)
|
||||
m_seperator->addChild(m_faces);
|
||||
|
||||
// Check for an already existing color bar
|
||||
Gui::SoFCColorBar* pcBar = ((Gui::SoFCColorBar*)findFrontRootOfType( Gui::SoFCColorBar::getClassTypeId() ));
|
||||
if ( pcBar ) {
|
||||
Gui::SoFCColorBar* pcBar = ((Gui::SoFCColorBar*)findFrontRootOfType(Gui::SoFCColorBar::getClassTypeId()));
|
||||
if (pcBar) {
|
||||
float fMin = m_colorBar->getMinValue();
|
||||
float fMax = m_colorBar->getMaxValue();
|
||||
|
||||
@@ -197,24 +197,24 @@ SoSeparator* ViewProviderFemPostObject::getFrontRoot(void) const {
|
||||
|
||||
void ViewProviderFemPostObject::setDisplayMode(const char* ModeName)
|
||||
{
|
||||
if (strcmp("Outline",ModeName)==0)
|
||||
if (strcmp("Outline", ModeName) == 0)
|
||||
m_currentAlgorithm = m_outline;
|
||||
else if (strcmp("Surface with Edges",ModeName)==0)
|
||||
else if (strcmp("Surface with Edges", ModeName) == 0)
|
||||
m_currentAlgorithm = m_surfaceEdges;
|
||||
else if (strcmp("Surface",ModeName)==0)
|
||||
else if (strcmp("Surface", ModeName) == 0)
|
||||
m_currentAlgorithm = m_surface;
|
||||
else if (strcmp("Wireframe",ModeName)==0)
|
||||
else if (strcmp("Wireframe", ModeName) == 0)
|
||||
m_currentAlgorithm = m_wireframe;
|
||||
else if (strcmp("Wireframe (surface only)",ModeName)==0)
|
||||
else if (strcmp("Wireframe (surface only)", ModeName) == 0)
|
||||
m_currentAlgorithm = m_wireframeSurface;
|
||||
else if (strcmp("Nodes",ModeName)==0)
|
||||
else if (strcmp("Nodes", ModeName) == 0)
|
||||
m_currentAlgorithm = m_points;
|
||||
else if (strcmp("Nodes (surface only)",ModeName)==0)
|
||||
else if (strcmp("Nodes (surface only)", ModeName) == 0)
|
||||
m_currentAlgorithm = m_pointsSurface;
|
||||
|
||||
updateVtk();
|
||||
|
||||
ViewProviderDocumentObject::setDisplayMode( ModeName );
|
||||
ViewProviderDocumentObject::setDisplayMode(ModeName);
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderFemPostObject::getDisplayModes(void) const
|
||||
@@ -232,7 +232,7 @@ std::vector<std::string> ViewProviderFemPostObject::getDisplayModes(void) const
|
||||
|
||||
void ViewProviderFemPostObject::updateVtk() {
|
||||
|
||||
if(!setupPipeline())
|
||||
if (!setupPipeline())
|
||||
return;
|
||||
|
||||
m_currentAlgorithm->Update();
|
||||
@@ -247,21 +247,21 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
|
||||
//coloring
|
||||
std::string val;
|
||||
if(Field.getEnums() && Field.getValue() >= 0)
|
||||
if (Field.getEnums() && Field.getValue() >= 0)
|
||||
val = Field.getValueAsString();
|
||||
|
||||
std::vector<std::string> colorArrays;
|
||||
colorArrays.push_back("None");
|
||||
|
||||
vtkPointData* point = poly->GetPointData();
|
||||
for(int i=0; i<point->GetNumberOfArrays(); ++i) {
|
||||
for (int i = 0; i < point->GetNumberOfArrays(); ++i) {
|
||||
std::string FieldName = point->GetArrayName(i);
|
||||
if (FieldName != "Texture Coordinates")
|
||||
colorArrays.push_back(FieldName);
|
||||
}
|
||||
|
||||
vtkCellData* cell = poly->GetCellData();
|
||||
for(int i=0; i<cell->GetNumberOfArrays(); ++i)
|
||||
for (int i = 0; i < cell->GetNumberOfArrays(); ++i)
|
||||
colorArrays.push_back(cell->GetArrayName(i));
|
||||
|
||||
App::Enumeration empty;
|
||||
@@ -270,32 +270,32 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
Field.setValue(m_coloringEnum);
|
||||
|
||||
std::vector<std::string>::iterator it = std::find(colorArrays.begin(), colorArrays.end(), val);
|
||||
if(!val.empty() && it != colorArrays.end())
|
||||
if (!val.empty() && it != colorArrays.end())
|
||||
Field.setValue(val.c_str());
|
||||
|
||||
Field.purgeTouched();
|
||||
|
||||
//Vector mode
|
||||
if(VectorMode.getEnums() && VectorMode.getValue() >= 0)
|
||||
if (VectorMode.getEnums() && VectorMode.getValue() >= 0)
|
||||
val = VectorMode.getValueAsString();
|
||||
|
||||
colorArrays.clear();
|
||||
if(Field.getValue() == 0)
|
||||
if (Field.getValue() == 0)
|
||||
colorArrays.push_back("Not a vector");
|
||||
else {
|
||||
int array = Field.getValue() - 1; //0 is none
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkDataArray* data = pd->GetPointData()->GetArray(array);
|
||||
|
||||
if(data->GetNumberOfComponents() == 1)
|
||||
if (data->GetNumberOfComponents() == 1)
|
||||
colorArrays.push_back("Not a vector");
|
||||
else {
|
||||
colorArrays.push_back("Magnitude");
|
||||
if(data->GetNumberOfComponents() >= 2) {
|
||||
if (data->GetNumberOfComponents() >= 2) {
|
||||
colorArrays.push_back("X");
|
||||
colorArrays.push_back("Y");
|
||||
}
|
||||
if(data->GetNumberOfComponents() >= 3)
|
||||
if (data->GetNumberOfComponents() >= 3)
|
||||
colorArrays.push_back("Z");
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
VectorMode.setValue(m_vectorEnum);
|
||||
|
||||
it = std::find(colorArrays.begin(), colorArrays.end(), val);
|
||||
if(!val.empty() && it != colorArrays.end())
|
||||
if (!val.empty() && it != colorArrays.end())
|
||||
VectorMode.setValue(val.c_str());
|
||||
|
||||
m_blockPropertyChanges = false;
|
||||
@@ -315,11 +315,11 @@ void ViewProviderFemPostObject::update3D() {
|
||||
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
|
||||
vtkPointData *pntData;
|
||||
vtkPoints *points;
|
||||
vtkDataArray *normals = nullptr;
|
||||
vtkDataArray *tcoords = nullptr;
|
||||
vtkCellArray *cells;
|
||||
vtkPointData* pntData;
|
||||
vtkPoints* points;
|
||||
vtkDataArray* normals = nullptr;
|
||||
vtkDataArray* tcoords = nullptr;
|
||||
vtkCellArray* cells;
|
||||
vtkIdType npts = 0;
|
||||
vtkIdTypePtr indx = nullptr;
|
||||
|
||||
@@ -340,7 +340,7 @@ void ViewProviderFemPostObject::update3D() {
|
||||
m_faces->coordIndex.startEditing();
|
||||
int soidx = 0;
|
||||
cells = pd->GetPolys();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_faces->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
@@ -355,35 +355,34 @@ void ViewProviderFemPostObject::update3D() {
|
||||
else
|
||||
m_faces->coordIndex.setNum(0);
|
||||
|
||||
|
||||
// write out tstrips if any
|
||||
if (pd->GetNumberOfStrips() > 0) {
|
||||
if (pd->GetNumberOfStrips() > 0) {
|
||||
|
||||
int soidx = 0;
|
||||
cells = pd->GetStrips();
|
||||
m_triangleStrips->coordIndex.startEditing();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
int soidx = 0;
|
||||
cells = pd->GetStrips();
|
||||
m_triangleStrips->coordIndex.startEditing();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, -1);
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.setNum(soidx);
|
||||
m_triangleStrips->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_triangleStrips->coordIndex.setNum(0);
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, -1);
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.setNum(soidx);
|
||||
m_triangleStrips->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_triangleStrips->coordIndex.setNum(0);
|
||||
|
||||
// write out lines if any
|
||||
if (pd->GetNumberOfLines() > 0) {
|
||||
// write out lines if any
|
||||
if (pd->GetNumberOfLines() > 0) {
|
||||
|
||||
int soidx = 0;
|
||||
cells = pd->GetLines();
|
||||
m_lines->coordIndex.startEditing();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_lines->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
++soidx;
|
||||
@@ -393,34 +392,34 @@ void ViewProviderFemPostObject::update3D() {
|
||||
}
|
||||
m_lines->coordIndex.setNum(soidx);
|
||||
m_lines->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_lines->coordIndex.setNum(0);
|
||||
}
|
||||
else
|
||||
m_lines->coordIndex.setNum(0);
|
||||
|
||||
// write out verts if any
|
||||
if (pd->GetNumberOfVerts() > 0){
|
||||
// write out verts if any
|
||||
if (pd->GetNumberOfVerts() > 0) {
|
||||
|
||||
int soidx = 0;
|
||||
cells = pd->GetVerts();
|
||||
m_markers->coordIndex.startEditing();
|
||||
m_markers->coordIndex.setNum(pd->GetNumberOfVerts());
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
m_markers->coordIndex.set1Value(soidx, static_cast<int>(indx[0]));
|
||||
++soidx;
|
||||
}
|
||||
m_markers->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_markers->coordIndex.setNum(0);
|
||||
}
|
||||
else
|
||||
m_markers->coordIndex.setNum(0);
|
||||
}
|
||||
|
||||
void ViewProviderFemPostObject::WritePointData(vtkPoints* points, vtkDataArray* normals, vtkDataArray* tcoords) {
|
||||
|
||||
Q_UNUSED(tcoords)
|
||||
double *p;
|
||||
Q_UNUSED(tcoords);
|
||||
double* p;
|
||||
int i;
|
||||
|
||||
if(!points)
|
||||
if (!points)
|
||||
return;
|
||||
|
||||
// if the object contains "Elmer" but no scale has been set, we set it to 1000.0
|
||||
@@ -457,12 +456,12 @@ void ViewProviderFemPostObject::WritePointData(vtkPoints* points, vtkDataArray*
|
||||
|
||||
void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
|
||||
if(!setupPipeline())
|
||||
if (!setupPipeline())
|
||||
return;
|
||||
|
||||
if(Field.getEnumVector().empty() || Field.getValue() == 0) {
|
||||
if (Field.getEnumVector().empty() || Field.getValue() == 0) {
|
||||
|
||||
m_material->diffuseColor.setValue(SbColor(0.8,0.8,0.8));
|
||||
m_material->diffuseColor.setValue(SbColor(0.8, 0.8, 0.8));
|
||||
m_material->transparency.setValue(0.);
|
||||
m_materialBinding->value = SoMaterialBinding::OVERALL;
|
||||
m_materialBinding->touch();
|
||||
@@ -471,11 +470,11 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
|
||||
|
||||
int array = Field.getValue() - 1; //0 is none
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkDataArray* data = pd->GetPointData()->GetArray(array);
|
||||
|
||||
int component = VectorMode.getValue() - 1; //0 is either "Not a vector" or magnitude, for -1 is correct for magnitude. x y and z are one number too high
|
||||
if(strcmp(VectorMode.getValueAsString(), "Not a vector")==0)
|
||||
if (strcmp(VectorMode.getValueAsString(), "Not a vector") == 0)
|
||||
component = 0;
|
||||
|
||||
//build the lookuptable
|
||||
@@ -490,11 +489,11 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
for (int i = 0; i < pd->GetNumberOfPoints(); i++) {
|
||||
|
||||
double value = 0;
|
||||
if(component >= 0)
|
||||
if (component >= 0)
|
||||
value = data->GetComponent(i, component);
|
||||
else {
|
||||
for(int j=0; j<data->GetNumberOfComponents(); ++j)
|
||||
value += std::pow(data->GetComponent(i, j),2);
|
||||
for (int j = 0; j < data->GetNumberOfComponents(); ++j)
|
||||
value += std::pow(data->GetComponent(i, j), 2);
|
||||
|
||||
value = std::sqrt(value);
|
||||
}
|
||||
@@ -514,7 +513,7 @@ void ViewProviderFemPostObject::WriteTransparency() {
|
||||
|
||||
void ViewProviderFemPostObject::updateData(const App::Property* p) {
|
||||
|
||||
if( strcmp(p->getName(), "Data") == 0 ) {
|
||||
if (strcmp(p->getName(), "Data") == 0) {
|
||||
updateVtk();
|
||||
}
|
||||
}
|
||||
@@ -523,10 +522,9 @@ bool ViewProviderFemPostObject::setupPipeline() {
|
||||
|
||||
vtkDataObject* data = static_cast<Fem::FemPostObject*>(getObject())->Data.getValue();
|
||||
|
||||
if(!data)
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
|
||||
m_outline->SetInputData(data);
|
||||
m_surface->SetInputData(data);
|
||||
m_wireframe->SetInputData(data);
|
||||
@@ -576,10 +574,10 @@ bool ViewProviderFemPostObject::doubleClicked(void) {
|
||||
|
||||
bool ViewProviderFemPostObject::setEdit(int ModNum) {
|
||||
|
||||
if (ModNum == ViewProvider::Default || ModNum == 1 ) {
|
||||
if (ModNum == ViewProvider::Default || ModNum == 1) {
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgPost *postDlg = qobject_cast<TaskDlgPost*>(dlg);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
TaskDlgPost* postDlg = qobject_cast<TaskDlgPost*>(dlg);
|
||||
if (postDlg && postDlg->getView() != this)
|
||||
postDlg = nullptr; // another pad left open its task panel
|
||||
if (dlg && !postDlg) {
|
||||
|
||||
Reference in New Issue
Block a user