"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ui_modules/drawingoptions.cpp" between
mathmod-10.1-source.zip and mathmod-11.0-source.zip

About: MathMod is a mathematical modeling software that visualize and animate implicit and parametric surfaces.

drawingoptions.cpp  (mathmod-10.1-source):drawingoptions.cpp  (mathmod-11.0-source)
/*************************************************************************** /***************************************************************************
* Copyright (C) 2020 by Abderrahman Taha * * Copyright (C) 2021 by Abderrahman Taha *
* * * *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the * * along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/ ***************************************************************************/
#include "drawingoptions.h" #include "drawingoptions.h"
#include <qmessagebox.h> #include <qmessagebox.h>
static int indexcurrentFormula = -1; static int IndexcurrentComponent = -1;
static int indexcurrentSet = 0; static int indexcurrentSet = 0;
static int CurrentFormulaType = -1; // 0:Pariso; 1:Parametric; 2:Isosurface static int CurrentFormulaType = -1; // 0:Pariso; 1:Parametric; 2:Isosurface
static QTreeWidgetItem *MyselectionItemReference; static QTreeWidgetItem *MyselectionItemReference;
static QStringList qlstPos, qlstStep, qlstmin, qlstmax, qlstnames; static QStringList qlstPos, qlstStep, qlstmin, qlstmax, qlstnames;
// Error messages returned by ErrorMsg(): // Error messages returned by ErrorMsg():
static const char *ScriptErrorMessage[] = static const char *ScriptErrorMessage[] =
{ {
"SCRIPT_NO_ERROR", // 0 "SCRIPT_NO_ERROR", // 0
"MAXGRID_OUT_OF_RANGE", // 1 "MAXGRID_OUT_OF_RANGE", // 1
skipping to change at line 106 skipping to change at line 106
editorwindow->show(); editorwindow->show();
} }
void DrawingOptions::colorsoptions() void DrawingOptions::colorsoptions()
{ {
ColorsOptions *colorwindow = new ColorsOptions(); ColorsOptions *colorwindow = new ColorsOptions();
connect(colorwindow->ui.color_2, SIGNAL(activated(int)), this,SLOT(oncolor_2 activated(int))); connect(colorwindow->ui.color_2, SIGNAL(activated(int)), this,SLOT(oncolor_2 activated(int)));
connect(colorwindow->ui.red_2, SIGNAL(valueChanged(int)), this,SLOT(onred_2v alueChanged(int))); connect(colorwindow->ui.red_2, SIGNAL(valueChanged(int)), this,SLOT(onred_2v alueChanged(int)));
connect(colorwindow->ui.green_2, SIGNAL(valueChanged(int)), this,SLOT(ongree n_2valueChanged(int))); connect(colorwindow->ui.green_2, SIGNAL(valueChanged(int)), this,SLOT(ongree n_2valueChanged(int)));
connect(colorwindow->ui.blue_2, SIGNAL(valueChanged(int)), this,SLOT(onblue_ 2valueChanged(int))); connect(colorwindow->ui.blue_2, SIGNAL(valueChanged(int)), this,SLOT(onblue_ 2valueChanged(int)));
connect(colorwindow->ui.transparent_2, SIGNAL(valueChanged(int)), this,SLOT(
ontransparent_2valueChanged(int)));
connect(colorwindow->ui.transparence_2, SIGNAL(clicked(bool)), this,SLOT(ont
ransparence_2clicked(bool)));
colorwindow->show(); colorwindow->show();
} }
void DrawingOptions::videoplay() void DrawingOptions::videoplay()
{ {
QImage buf = MathmodRef->ui.glWidget->Copyscreenshot(); QImage buf = MathmodRef->Copyscreenshot();
screenimage *player = new screenimage(buf); screenimage *player = new screenimage(buf);
player->connectcontrols(); player->connectcontrols();
player->show(); player->show();
} }
DrawingOptions::~DrawingOptions() DrawingOptions::~DrawingOptions()
{ {
delete[] SliderArray; delete[] SliderArray;
} }
DrawingOptions::DrawingOptions(QWidget *parent) : QMainWindow(parent) DrawingOptions::DrawingOptions(QWidget *parent) : QMainWindow(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
indexcurrentFormula = -1; IndexcurrentComponent = -1;
IsolistItemRef = nullptr; IsolistItemRef = nullptr;
select.selectedoptions.showall = false; select.selectedoptions.showall = false;
select.selectedoptions.sensitive = false; select.selectedoptions.sensitive = false;
select.selectedoptions.AND = true; select.selectedoptions.AND = true;
select.selectedoptions.parsefunctions = true; select.selectedoptions.parsefunctions = true;
select.selectedoptions.parsenames = true; select.selectedoptions.parsenames = true;
select.selectedoptions.parsecmpnames = true; select.selectedoptions.parsecmpnames = true;
connect(sliderconf.ui.SaveButton, SIGNAL(clicked()), this,SLOT(update_slider _param())); connect(sliderconf.ui.SaveButton, SIGNAL(clicked()), this,SLOT(update_slider _param()));
connect(sliderconf.ui.ParametersComboBox, SIGNAL(activated(int)), this,SLOT( update_infos_param(int))); connect(sliderconf.ui.ParametersComboBox, SIGNAL(activated(int)), this,SLOT( update_infos_param(int)));
connect(addnewparam.ui.SaveButton, SIGNAL(clicked()), this,SLOT(add_new_para m())); connect(addnewparam.ui.SaveButton, SIGNAL(clicked()), this,SLOT(add_new_para m()));
skipping to change at line 276 skipping to change at line 274
SliderArray[19].SliderLabelMax = ui.C20labelMax; SliderArray[19].SliderLabelMax = ui.C20labelMax;
SliderArray[19].SliderLabelMin = ui.C20labelMin; SliderArray[19].SliderLabelMin = ui.C20labelMin;
SliderArray[19].SliderGroupeBox = ui.groupBox_28; SliderArray[19].SliderGroupeBox = ui.groupBox_28;
} }
void DrawingOptions::on_xyzg_valueChanged(int value) void DrawingOptions::on_xyzg_valueChanged(int value)
{ {
ui.Isogroupbox->setTitle("Grid/MaxGrid = (" + ui.Isogroupbox->setTitle("Grid/MaxGrid = (" +
QString::number(ui.xyzg->value()) + " / " + QString::number(ui.xyzg->value()) + " / " +
QString::number(Parameters->IsoMaxGrid) + ")"); QString::number(Parameters->IsoMaxGrid) + ")");
if (!MathmodRef->ui.glWidget->IsoObjet->isRunning()) if (!MathmodRef->IsoObjet->isRunning())
{ {
(MathmodRef->RootObjet.CurrentJsonObject["ParIso"].isArray()) ? (MathmodRef->RootObjet.CurrentJsonObject["ParIso"].isArray()) ?
MathmodRef->xyzg_valueChanged(value, PARISO_TYPE) : MathmodRef->xyzg_val ueChanged(value, ISO_TYPE); MathmodRef->xyzg_valueChanged(value, PARISO_TYPE) : MathmodRef->xyzg_val ueChanged(value, ISO_TYPE);
} }
else else
{ {
ui.ChangeGrid->blockSignals(true); ui.ChangeGrid->blockSignals(true);
ui.ChangeGrid->setChecked(false); ui.ChangeGrid->setChecked(false);
ui.ChangeGrid->blockSignals(false); ui.ChangeGrid->blockSignals(false);
MathmodRef->xyzactivated = -1; MathmodRef->xyzactivated = -1;
skipping to change at line 475 skipping to change at line 473
UpdateDescription(0, PAR_4D_TYPE, currentstruct); UpdateDescription(0, PAR_4D_TYPE, currentstruct);
} }
void DrawingOptions::UpdatePar3DModelDetailsPage(TreeStruct &currentstruct) void DrawingOptions::UpdatePar3DModelDetailsPage(TreeStruct &currentstruct)
{ {
ui.ParamComponent->clear(); ui.ParamComponent->clear();
if (!currentstruct.name.empty()) if (!currentstruct.name.empty())
ui.groupBox->setTitle(currentstruct.name.at(0)); ui.groupBox->setTitle(currentstruct.name.at(0));
ui.ParamComponent->insertItems(0, currentstruct.Component); ui.ParamComponent->insertItems(0, currentstruct.Component);
ui.stackedProperties->setCurrentIndex(2); ui.stackedProperties->setCurrentIndex(2);
ui.ShowParComp->setChecked(true);
ui.ShowParComp->setText("Show");
UpdateDescription(0, PAR_TYPE, currentstruct); UpdateDescription(0, PAR_TYPE, currentstruct);
} }
void DrawingOptions::UpdateIsoModelDetailsPage(TreeStruct &currentstruct) void DrawingOptions::UpdateIsoModelDetailsPage(TreeStruct &currentstruct)
{ {
ui.stackedProperties->setCurrentIndex(1); ui.stackedProperties->setCurrentIndex(1);
if (!currentstruct.name.empty()) if (!currentstruct.name.empty())
ui.groupBox->setTitle(currentstruct.name.at(0)); ui.groupBox->setTitle(currentstruct.name.at(0));
ui.IsoComponent->clear(); ui.IsoComponent->clear();
ui.IsoComponent->insertItems(0, currentstruct.Component); ui.IsoComponent->insertItems(0, currentstruct.Component);
ui.ShowIsoComp->setChecked(true);
ui.ShowIsoComp->setText("Show");
UpdateDescription(0, ISO_TYPE, currentstruct); UpdateDescription(0, ISO_TYPE, currentstruct);
} }
void DrawingOptions::UpdateScriptEditorAndTreeObject() void DrawingOptions::UpdateScriptEditorAndTreeObject()
{ {
// Update the current Tree Object: // Update the current Tree Object:
if (ShowCurrentObjectTree) if (ShowCurrentObjectTree)
UpdateTreeObject(); UpdateTreeObject();
// Update the "Script Edit" page // Update the "Script Edit" page
ui.ParamEdit->setText(MathmodRef->RootObjet.CurrentTreestruct.text); ui.ParamEdit->setText(MathmodRef->RootObjet.CurrentTreestruct.text);
skipping to change at line 572 skipping to change at line 574
void DrawingOptions::ShowSliders(const QJsonObject &Jobj) void DrawingOptions::ShowSliders(const QJsonObject &Jobj)
{ {
QString result; QString result;
QJsonArray lst; QJsonArray lst;
QJsonObject QObj; QJsonObject QObj;
if (Jobj["Sliders"].isObject()) if (Jobj["Sliders"].isObject())
{ {
// Hide all sliders // Hide all sliders
HideSliders(); HideSliders();
QObj = Jobj["Sliders"].toObject(); QObj = Jobj["Sliders"].toObject();
// Min // Min
lst = QObj["Min"].toArray(); lst = QObj["Min"].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
qlstmin = result.split(";", QString::SkipEmptyParts); qlstmin = result.split(";", QString::SkipEmptyParts);
// Max // Max
lst = QObj["Max"].toArray(); lst = QObj["Max"].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
qlstmax = result.split(";", QString::SkipEmptyParts); qlstmax = result.split(";", QString::SkipEmptyParts);
// Position // Position
lst = QObj["Position"].toArray(); lst = QObj["Position"].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
qlstPos = result.split(";", QString::SkipEmptyParts); qlstPos = result.split(";", QString::SkipEmptyParts);
for (int i = 0; i < qlstPos.size(); ++i) for (int i = 0; i < qlstPos.size(); ++i)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->SliderValues.push_b ack( MathmodRef->IsoObjet->masterthread->SliderValues.push_back(
qlstPos.at(i).toDouble()); qlstPos.at(i).toDouble());
MathmodRef->ui.glWidget->ParObjet->masterthread->SliderValues.push_b ack( MathmodRef->ParObjet->masterthread->SliderValues.push_back(
qlstPos.at(i).toDouble()); qlstPos.at(i).toDouble());
} }
// Name // Name
lst = QObj["Name"].toArray(); lst = QObj["Name"].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
qlstnames = result.split(";", QString::SkipEmptyParts); qlstnames = result.split(";", QString::SkipEmptyParts);
for (int i = 0; i < qlstnames.size(); ++i) for (int i = 0; i < qlstnames.size(); ++i)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->SliderNames.push_ba ck( MathmodRef->IsoObjet->masterthread->SliderNames.push_back(
qlstnames.at(i).toStdString()); qlstnames.at(i).toStdString());
MathmodRef->ui.glWidget->ParObjet->masterthread->SliderNames.push_ba ck( MathmodRef->ParObjet->masterthread->SliderNames.push_back(
qlstnames.at(i).toStdString()); qlstnames.at(i).toStdString());
} }
MathmodRef->ui.glWidget->IsoObjet->masterthread->Nb_Sliders = MathmodRef->IsoObjet->masterthread->Nb_Sliders =
uint(qlstnames.size()); uint(qlstnames.size());
MathmodRef->ui.glWidget->ParObjet->masterthread->Nb_Sliders = MathmodRef->ParObjet->masterthread->Nb_Sliders =
uint(qlstnames.size()); uint(qlstnames.size());
ui.ParametersList->clear(); ui.ParametersList->clear();
ui.ParametersList->addItem("Parameters List (" + ui.ParametersList->addItem("Parameters List (" +
QString::number(qlstnames.size()) + ")"); QString::number(qlstnames.size()) + ")");
ui.ParametersList->addItems(qlstnames); ui.ParametersList->addItems(qlstnames);
sliderconf.ui.ParametersComboBox->clear(); sliderconf.ui.ParametersComboBox->clear();
sliderconf.ui.ParametersComboBox->addItem( sliderconf.ui.ParametersComboBox->addItem(
"Parameters List (" + QString::number(qlstnames.size()) + ")"); "Parameters List (" + QString::number(qlstnames.size()) + ")");
sliderconf.ui.ParametersComboBox->addItems(qlstnames); sliderconf.ui.ParametersComboBox->addItems(qlstnames);
// Step // Step
skipping to change at line 644 skipping to change at line 644
} }
else else
{ {
for (int i = 1; i < NbSets + 1; i++) for (int i = 1; i < NbSets + 1; i++)
{ {
qlist += "Set_" + QString::number(i); qlist += "Set_" + QString::number(i);
} }
} }
ui.PredefinedSets->addItems(qlist); ui.PredefinedSets->addItems(qlist);
} }
for (int sl = 0; sl < 20; sl++) for (int sl = 0; sl < 20; sl++)
{ {
if (qlstnames.size() >= (sl + 1)) if (qlstnames.size() >= (sl + 1))
{ {
(SliderArray[sl].SliderScrollBar)->blockSignals(true); (SliderArray[sl].SliderScrollBar)->blockSignals(true);
(SliderArray[sl].SliderScrollBar)->setMaximum(qlstmax.at(sl).toI nt()); (SliderArray[sl].SliderScrollBar)->setMaximum(qlstmax.at(sl).toI nt());
(SliderArray[sl].SliderScrollBar)->setMinimum(qlstmin.at(sl).toI nt()); (SliderArray[sl].SliderScrollBar)->setMinimum(qlstmin.at(sl).toI nt());
(SliderArray[sl].SliderScrollBar) (SliderArray[sl].SliderScrollBar)
->setSingleStep(qlstStep.at(sl).toInt()); ->setSingleStep(qlstStep.at(sl).toInt());
(SliderArray[sl].SliderScrollBar)->setPageStep(qlstStep.at(sl).t oInt()); (SliderArray[sl].SliderScrollBar)->setPageStep(qlstStep.at(sl).t oInt());
skipping to change at line 669 skipping to change at line 668
qlstStep.at(sl) + ")"); qlstStep.at(sl) + ")");
(SliderArray[sl].SliderLabelMin)->setText(qlstmin.at(sl)); (SliderArray[sl].SliderLabelMin)->setText(qlstmin.at(sl));
(SliderArray[sl].SliderLabelMax)->setText(qlstmax.at(sl)); (SliderArray[sl].SliderLabelMax)->setText(qlstmax.at(sl));
(SliderArray[sl].SliderScrollBar)->blockSignals(false); (SliderArray[sl].SliderScrollBar)->blockSignals(false);
(SliderArray[sl].SliderGroupeBox)->show(); (SliderArray[sl].SliderGroupeBox)->show();
} }
} }
} }
else else
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Nb_Sliders = 0; MathmodRef->IsoObjet->masterthread->Nb_Sliders = 0;
MathmodRef->ui.glWidget->ParObjet->masterthread->Nb_Sliders = 0; MathmodRef->ParObjet->masterthread->Nb_Sliders = 0;
HideSliders(); HideSliders();
} }
} }
void DrawingOptions::DrawJsonModel(const QJsonObject &Jobj, int textureIndex, void DrawingOptions::DrawJsonModel(const QJsonObject &Jobj, int textureIndex,
bool Inspect) bool Inspect)
{ {
if (!(MathmodRef->ui.glWidget)->ParObjet->isRunning() && if (!MathmodRef->ParObjet->isRunning() &&
!(MathmodRef->ui.glWidget)->IsoObjet->isRunning()) !MathmodRef->IsoObjet->isRunning())
{ {
if (Inspect & !VerifiedJsonModel(Jobj, Inspect)) if (Inspect & !VerifiedJsonModel(Jobj, Inspect))
return; return;
ShowJsonModel(Jobj, textureIndex); ShowJsonModel(Jobj, textureIndex);
UpdateScriptEditorAndTreeObject(); UpdateScriptEditorAndTreeObject();
} }
} }
QString DrawingOptions::MandatoryParFieldToQString(const MandatoryParField &idx) QString DrawingOptions::MandatoryParFieldToQString(const MandatoryParField &idx)
{ {
skipping to change at line 818 skipping to change at line 816
if(!VerifyIsoFieldEmptySpace(QObj, Opt)) if(!VerifyIsoFieldEmptySpace(QObj, Opt))
return false; return false;
} }
return true; return true;
} }
bool DrawingOptions::VerifiedIsoJsonModel(const QJsonObject &QObj) bool DrawingOptions::VerifiedIsoJsonModel(const QJsonObject &QObj)
{ {
QJsonArray lst; QJsonArray lst;
int NbFxyz; int NbFxyz;
if (!VerifyIsoEmptySpace(QObj)) if (!VerifyIsoEmptySpace(QObj))
{ {
scriptErrorType = EMPTY_MANDATORY_FIELD; scriptErrorType = EMPTY_MANDATORY_FIELD;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
// Fxyz // Fxyz
NbFxyz = (QObj["Fxyz"].toArray()).size(); NbFxyz = (QObj["Fxyz"].toArray()).size();
if ((QObj["Xmax"].toArray()).size() != NbFxyz) if ((QObj["Xmax"].toArray()).size() != NbFxyz)
{ {
scriptErrorType = XMAX_NBCOMPONENT_MISMATCH; scriptErrorType = XMAX_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Ymax"].toArray()).size() != NbFxyz) if ((QObj["Ymax"].toArray()).size() != NbFxyz)
{ {
skipping to change at line 864 skipping to change at line 860
scriptErrorType = YMIN_NBCOMPONENT_MISMATCH; scriptErrorType = YMIN_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Zmin"].toArray()).size() != NbFxyz) if ((QObj["Zmin"].toArray()).size() != NbFxyz)
{ {
scriptErrorType = ZMIN_NBCOMPONENT_MISMATCH; scriptErrorType = ZMIN_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Component"].toArray()).size() != NbFxyz) if ((QObj["Component"].toArray()).size() != NbFxyz)
{ {
scriptErrorType = COMPONENT_NBCOMPONENT_MISMATCH; scriptErrorType = COMPONENT_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if (((lst = QObj["Grid"].toArray()).size() > 0) && (lst.size() != NbFxyz)) if (((lst = QObj["Grid"].toArray()).size() > 0) && (lst.size() != NbFxyz))
{ {
scriptErrorType = GRID_NBCOMPONENT_MISMATCH; scriptErrorType = GRID_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
skipping to change at line 908 skipping to change at line 903
ErrorMsg(); ErrorMsg();
return false; return false;
} }
return true; return true;
} }
bool DrawingOptions::VerifiedParJsonModel(const QJsonObject &QObj) bool DrawingOptions::VerifiedParJsonModel(const QJsonObject &QObj)
{ {
QJsonArray lst; QJsonArray lst;
int NbFx; int NbFx;
if (!VerifyParEmptySpace(QObj)) if (!VerifyParEmptySpace(QObj))
{ {
scriptErrorType = EMPTY_MANDATORY_FIELD; scriptErrorType = EMPTY_MANDATORY_FIELD;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
// Fx // Fx
NbFx = (QObj["Fx"].toArray()).size(); NbFx = (QObj["Fx"].toArray()).size();
// Fy // Fy
if ((QObj["Fy"].toArray()).size() != NbFx) if ((QObj["Fy"].toArray()).size() != NbFx)
{ {
scriptErrorType = FY_FX_MISMATCH; scriptErrorType = FY_FX_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
// Fz // Fz
skipping to change at line 939 skipping to change at line 932
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if (((QObj["Fw"].toArray()).size() != 0) && if (((QObj["Fw"].toArray()).size() != 0) &&
((QObj["Fw"].toArray()).size() != NbFx)) ((QObj["Fw"].toArray()).size() != NbFx))
{ {
scriptErrorType = FW_FX_MISMATCH; scriptErrorType = FW_FX_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Umax"].toArray()).size() != NbFx) if ((QObj["Umax"].toArray()).size() != NbFx)
{ {
scriptErrorType = UMAX_NBCOMPONENT_MISMATCH; scriptErrorType = UMAX_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Vmax"].toArray()).size() != NbFx) if ((QObj["Vmax"].toArray()).size() != NbFx)
{ {
scriptErrorType = VMAX_NBCOMPONENT_MISMATCH; scriptErrorType = VMAX_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if (((QObj["Wmax"].toArray()).size() > 0) && if (((QObj["Wmax"].toArray()).size() > 0) &&
((QObj["Wmax"].toArray()).size() != NbFx)) ((QObj["Wmax"].toArray()).size() != NbFx))
{ {
scriptErrorType = WMAX_NBCOMPONENT_MISMATCH; scriptErrorType = WMAX_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Umin"].toArray()).size() != NbFx) if ((QObj["Umin"].toArray()).size() != NbFx)
{ {
scriptErrorType = UMIN_NBCOMPONENT_MISMATCH; scriptErrorType = UMIN_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Vmin"].toArray()).size() != NbFx) if ((QObj["Vmin"].toArray()).size() != NbFx)
{ {
scriptErrorType = VMIN_NBCOMPONENT_MISMATCH; scriptErrorType = VMIN_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if (((QObj["Wmin"].toArray()).size() > 0) && if (((QObj["Wmin"].toArray()).size() > 0) &&
((QObj["Wmin"].toArray()).size() != NbFx)) ((QObj["Wmin"].toArray()).size() != NbFx))
{ {
scriptErrorType = WMIN_NBCOMPONENT_MISMATCH; scriptErrorType = WMIN_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if ((QObj["Component"].toArray()).size() != NbFx) if ((QObj["Component"].toArray()).size() != NbFx)
{ {
scriptErrorType = COMPONENT_NBCOMPONENT_MISMATCH; scriptErrorType = COMPONENT_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
// Start Grid field processing // Start Grid field processing
QString result = ""; QString result = "";
if ((lst = QObj["Grid"].toArray()).size() > 0 && (lst.size() != 2 * NbFx)) if ((lst = QObj["Grid"].toArray()).size() > 0 && (lst.size() != 2 * NbFx))
{ {
scriptErrorType = GRID_NBCOMPONENT_MISMATCH; scriptErrorType = GRID_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if (((lst = QObj["Vect"].toArray()).size() > 1)) if (((lst = QObj["Vect"].toArray()).size() > 1))
{ {
scriptErrorType = VECT_DIMENSION_ERROR; scriptErrorType = VECT_DIMENSION_ERROR;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
if (((QObj["Cnd"].toArray()).size() > 0) && if (((QObj["Cnd"].toArray()).size() > 0) &&
((QObj["Cnd"].toArray()).size() != NbFx)) ((QObj["Cnd"].toArray()).size() != NbFx))
{ {
scriptErrorType = CND_NBCOMPONENT_MISMATCH; scriptErrorType = CND_NBCOMPONENT_MISMATCH;
ErrorMsg(); ErrorMsg();
return false; return false;
} }
return true; return true;
} }
bool DrawingOptions::VerifiedJsonModel(const QJsonObject &Jobj, bool Inspect) bool DrawingOptions::VerifiedJsonModel(const QJsonObject &Jobj, bool Inspect)
{ {
QJsonArray lst; QJsonArray lst;
QJsonObject QObj; QJsonObject QObj;
bool verif = false; bool verif = false;
if (!Inspect) if (!Inspect)
return true; return true;
if (Jobj["Iso3D"].isObject()) if (Jobj["Iso3D"].isObject())
{ {
QObj = Jobj["Iso3D"].toObject(); QObj = Jobj["Iso3D"].toObject();
verif = VerifiedIsoJsonModel(QObj); verif = VerifiedIsoJsonModel(QObj);
if (verif) if (verif)
{ {
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = false; MathmodRef->LocalScene.componentsinfos.pariso = false;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoNbComponen MathmodRef->LocalScene.componentsinfos.ParisoNbComponents =1;
ts =1; MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex =
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCurrentCom 0;
ponentIndex = 0;
} }
return (verif); return (verif);
} }
if (Jobj["Param3D"].isObject()) if (Jobj["Param3D"].isObject())
{ {
QObj = Jobj["Param3D"].toObject(); QObj = Jobj["Param3D"].toObject();
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoNbComponents = 1; MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = 1;
verif = VerifiedParJsonModel(QObj); verif = VerifiedParJsonModel(QObj);
if (verif) if (verif)
{ {
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = false; MathmodRef->LocalScene.componentsinfos.pariso = false;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoNbComponen MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = 1;
ts = 1; MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex =
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCurrentCom 0;
ponentIndex = 0;
} }
return (verif); return (verif);
} }
if (Jobj["ParIso"].isArray()) if (Jobj["ParIso"].isArray())
{ {
QJsonArray listeObj = Jobj["ParIso"].toArray(); QJsonArray listeObj = Jobj["ParIso"].toArray();
QJsonArray listeIsoObj; QJsonArray listeIsoObj;
QJsonArray listeParObj; QJsonArray listeParObj;
for (int i = 0; i < listeObj.size(); i++) for (int i = 0; i < listeObj.size(); i++)
if ((listeObj[i].toObject())["Iso3D"].isObject()) if ((listeObj[i].toObject())["Iso3D"].isObject())
listeIsoObj.append(listeObj[i].toObject()["Iso3D"].toObject()); listeIsoObj.append(listeObj[i].toObject()["Iso3D"].toObject());
else else
listeParObj.append(listeObj[i].toObject()["Param3D"].toObject()) ; listeParObj.append(listeObj[i].toObject()["Param3D"].toObject()) ;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = true; MathmodRef->LocalScene.componentsinfos.pariso = true;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoNbComponents = MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = listeIsoObj.
listeIsoObj.size() + listeParObj.size(); size() + listeParObj.size();
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCurrentCompone MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex = 0;
ntIndex = 0;
for (int i = 0; i < listeIsoObj.size(); i++) for (int i = 0; i < listeIsoObj.size(); i++)
if (!VerifiedIsoJsonModel(listeIsoObj[i].toObject())) if (!VerifiedIsoJsonModel(listeIsoObj[i].toObject()))
return (false); return (false);
for (int i = 0; i < listeParObj.size(); i++) for (int i = 0; i < listeParObj.size(); i++)
if (!VerifiedParJsonModel(listeParObj[i].toObject())) if (!VerifiedParJsonModel(listeParObj[i].toObject()))
return (false); return (false);
} }
return true; return true;
} }
void DrawingOptions::LoadTexture(const QJsonObject &QObj, void DrawingOptions::LoadTexture(const QJsonObject &QObj,
const ModelType &opt) const ModelType &opt)
{ {
QString noise1 = QObj["Noise"].toString(); QString noise1 = QObj["Noise"].toString();
QJsonArray lst = QObj["Colors"].toArray(); QJsonArray lst = QObj["Colors"].toArray();
noise1.replace("\n", ""); noise1.replace("\n", "");
noise1.replace("\t", ""); noise1.replace("\t", "");
noise1.replace(" ", ""); noise1.replace(" ", "");
QString result; QString result;
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
if (opt == ISO_TYPE) if (opt == ISO_TYPE)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Rgbt = result.toStdStri MathmodRef->IsoObjet->masterthread->Rgbt = result.toStdString();
ng(); MathmodRef->IsoObjet->masterthread->Noise = noise1.toStdString();
MathmodRef->ui.glWidget->IsoObjet->masterthread->Noise = noise1.toStdStr MathmodRef->IsoObjet->masterthread->RgbtSize = uint(lst.size());
ing();
MathmodRef->ui.glWidget->IsoObjet->masterthread->RgbtSize = uint(lst.siz
e());
} }
else if (opt == PAR_TYPE || opt == PAR_4D_TYPE) else if (opt == PAR_TYPE || opt == PAR_4D_TYPE)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Rgbt = result.toStdStri MathmodRef->ParObjet->masterthread->Rgbt = result.toStdString();
ng(); MathmodRef->ParObjet->masterthread->Noise = noise1.toStdString();
MathmodRef->ui.glWidget->ParObjet->masterthread->Noise = noise1.toStdStr MathmodRef->ParObjet->masterthread->RgbtSize = uint(lst.size());
ing();
MathmodRef->ui.glWidget->ParObjet->masterthread->RgbtSize = uint(lst.siz
e());
} }
MathmodRef->RootObjet.CurrentTreestruct.Noise = noise1; MathmodRef->RootObjet.CurrentTreestruct.Noise = noise1;
MathmodRef->RootObjet.CurrentTreestruct.RGBT = result.split(";", QString::Sk ipEmptyParts); MathmodRef->RootObjet.CurrentTreestruct.RGBT = result.split(";", QString::Sk ipEmptyParts);
} }
void DrawingOptions::LoadPigment(const QJsonObject &QObj, void DrawingOptions::LoadPigment(const QJsonObject &QObj,
const ModelType &opt) const ModelType &opt)
{ {
QString noise = ""; QString noise = "";
QJsonArray tmp; QJsonArray tmp;
skipping to change at line 1116 skipping to change at line 1100
int VRgbtSize = 0; int VRgbtSize = 0;
for (int j = 0; j < lst.size(); j++) for (int j = 0; j < lst.size(); j++)
{ {
tmp = (lst[j].toObject())["Color"].toObject()["Vrgba"].toArray(); tmp = (lst[j].toObject())["Color"].toObject()["Vrgba"].toArray();
for (int k = 0; k < tmp.count(); k++) for (int k = 0; k < tmp.count(); k++)
{ {
result += tmp[k].toString() + ";"; result += tmp[k].toString() + ";";
VRgbtSize++; VRgbtSize++;
} }
} }
strtmp.replace("\n", ""); strtmp.replace("\n", "");
strtmp.replace("\t", ""); strtmp.replace("\t", "");
strtmp.replace(" ", ""); strtmp.replace(" ", "");
noise.replace("\n", ""); noise.replace("\n", "");
noise.replace("\t", ""); noise.replace("\t", "");
noise.replace(" ", ""); noise.replace(" ", "");
result.replace("\n", ""); result.replace("\n", "");
result.replace("\t", ""); result.replace("\t", "");
result.replace(" ", ""); result.replace(" ", "");
if (opt == ISO_TYPE) if (opt == ISO_TYPE)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Gradient = strtmp.toStd MathmodRef->IsoObjet->masterthread->Gradient = strtmp.toStdString();
String(); MathmodRef->IsoObjet->masterthread->VRgbt = result.toStdString();
MathmodRef->ui.glWidget->IsoObjet->masterthread->VRgbt = result.toStdStr MathmodRef->IsoObjet->masterthread->Noise = noise.toStdString();
ing(); MathmodRef->IsoObjet->masterthread->VRgbtSize = uint(VRgbtSize);
MathmodRef->ui.glWidget->IsoObjet->masterthread->Noise = noise.toStdStri
ng();
MathmodRef->ui.glWidget->IsoObjet->masterthread->VRgbtSize = uint(VRgbtS
ize);
} }
else if (opt == PAR_TYPE || opt == PAR_4D_TYPE) else if (opt == PAR_TYPE || opt == PAR_4D_TYPE)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Gradient = strtmp.toStd MathmodRef->ParObjet->masterthread->Gradient = strtmp.toStdString();
String(); MathmodRef->ParObjet->masterthread->VRgbt = result.toStdString();
MathmodRef->ui.glWidget->ParObjet->masterthread->VRgbt = result.toStdStr MathmodRef->ParObjet->masterthread->Noise = noise.toStdString();
ing(); MathmodRef->ParObjet->masterthread->VRgbtSize = uint(VRgbtSize);
MathmodRef->ui.glWidget->ParObjet->masterthread->Noise = noise.toStdStri
ng();
MathmodRef->ui.glWidget->ParObjet->masterthread->VRgbtSize = uint(VRgbtS
ize);
} }
MathmodRef->RootObjet.CurrentTreestruct.Noise = noise; MathmodRef->RootObjet.CurrentTreestruct.Noise = noise;
MathmodRef->RootObjet.CurrentTreestruct.VRGBT = MathmodRef->RootObjet.CurrentTreestruct.VRGBT =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
void DrawingOptions::ShowJsonModel(const QJsonObject &Jobj, int textureIndex) void DrawingOptions::ShowJsonModel(const QJsonObject &Jobj, int textureIndex)
{ {
QString result; QString result;
QJsonArray lst; QJsonArray lst;
QJsonObject QObj, QIso, QPar; QJsonObject QObj, QIso, QPar;
QJsonObject QTextureObj, QPigmentObj; QJsonObject QTextureObj, QPigmentObj;
bool loadtext, loadpigm; bool loadtext, loadpigm;
QJsonDocument document; QJsonDocument document;
if (textureIndex != -1) if (textureIndex != -1)
{ {
if (textureIndex < 1000) if (textureIndex < 1000)
QTextureObj = MathmodRef->collection.JTextures[textureIndex] QTextureObj = MathmodRef->collection.JTextures[textureIndex]
.toObject()["Texture"] .toObject()["Texture"]
.toObject(); .toObject();
else else
QPigmentObj = MathmodRef->collection.JPigments[textureIndex - 1000] QPigmentObj = MathmodRef->collection.JPigments[textureIndex - 1000]
.toObject()["Pigment"] .toObject()["Pigment"]
.toObject(); .toObject();
skipping to change at line 1180 skipping to change at line 1158
{ {
if (Jobj["Texture"].isObject()) if (Jobj["Texture"].isObject())
QTextureObj = Jobj["Texture"].toObject(); QTextureObj = Jobj["Texture"].toObject();
if (Jobj["Pigment"].isObject()) if (Jobj["Pigment"].isObject())
QPigmentObj = Jobj["Pigment"].toObject(); QPigmentObj = Jobj["Pigment"].toObject();
} }
ShowSliders(Jobj); ShowSliders(Jobj);
updateCurrentTreestruct(); updateCurrentTreestruct();
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCondition.clear(); MathmodRef->LocalScene.componentsinfos.ParisoCondition.clear();
if (Jobj["ParIso"].isArray()) if (Jobj["ParIso"].isArray())
{ {
QJsonArray listeObj = Jobj["ParIso"].toArray(); QJsonArray listeObj = Jobj["ParIso"].toArray();
QJsonArray listeIsoObj; QJsonArray listeIsoObj;
QJsonArray listeParObj; QJsonArray listeParObj;
for (int i = 0; i < listeObj.size(); i++) for (int i = 0; i < listeObj.size(); i++)
if ((listeObj[i].toObject())["Iso3D"].isObject()) if ((listeObj[i].toObject())["Iso3D"].isObject())
listeIsoObj.append(listeObj[i].toObject()); listeIsoObj.append(listeObj[i].toObject());
else else
listeParObj.append(listeObj[i].toObject()); listeParObj.append(listeObj[i].toObject());
skipping to change at line 1203 skipping to change at line 1181
QPar = listeParObj[0].toObject(); QPar = listeParObj[0].toObject();
if (listeIsoObj.size() > 0) if (listeIsoObj.size() > 0)
QIso = listeIsoObj[0].toObject(); QIso = listeIsoObj[0].toObject();
loadtext = loadpigm = false; loadtext = loadpigm = false;
if (QPar["Texture"].isObject()) if (QPar["Texture"].isObject())
QTextureObj = QPar["Texture"].toObject(); QTextureObj = QPar["Texture"].toObject();
if (QPar["Pigment"].isObject()) if (QPar["Pigment"].isObject())
QPigmentObj = QPar["Pigment"].toObject(); QPigmentObj = QPar["Pigment"].toObject();
// Colors // Colors
loadtext = MathmodRef->ui.glWidget->ParObjet->masterthread->rgbtnotnull = loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull =
(QPar["Texture"].isObject() || (QPar["Texture"].isObject() ||
((textureIndex < 1000) && (textureIndex != -1))); ((textureIndex < 1000) && (textureIndex != -1)));
// Pigment // Pigment
loadpigm = MathmodRef->ui.glWidget->ParObjet->masterthread->vrgbtnotnull = loadpigm = MathmodRef->ParObjet->masterthread->vrgbtnotnull =
(QPar["Pigment"].isObject() || (QPar["Pigment"].isObject() ||
((textureIndex != -1) && (textureIndex > 999))); ((textureIndex != -1) && (textureIndex > 999)));
LoadMandatoryAndOptionnalFields(QPar["Param3D"].toObject(), PAR_TYPE, LoadMandatoryAndOptionnalFields(QPar["Param3D"].toObject(), PAR_TYPE,
loadtext, QTextureObj, loadpigm, loadtext, QTextureObj, loadpigm,
QPigmentObj); QPigmentObj);
// Save this Current Parametric Tree struct // Save this Current Parametric Tree struct
MathmodRef->RootObjet.CurrentParisoTreestruct.push_back( MathmodRef->RootObjet.CurrentParisoTreestruct.push_back(
MathmodRef->RootObjet.CurrentTreestruct); MathmodRef->RootObjet.CurrentTreestruct);
loadtext = loadpigm = false; loadtext = loadpigm = false;
if (QIso["Texture"].isObject()) if (QIso["Texture"].isObject())
QTextureObj = QIso["Texture"].toObject(); QTextureObj = QIso["Texture"].toObject();
if (QIso["Pigment"].isObject()) if (QIso["Pigment"].isObject())
QPigmentObj = QIso["Pigment"].toObject(); QPigmentObj = QIso["Pigment"].toObject();
// Colors // Colors
loadtext = MathmodRef->ui.glWidget->IsoObjet->masterthread->rgbtnotnull = loadtext = MathmodRef->IsoObjet->masterthread->rgbtnotnull =
(QIso["Texture"].isObject() || (QIso["Texture"].isObject() ||
((textureIndex < 1000) && (textureIndex != -1))); ((textureIndex < 1000) && (textureIndex != -1)));
// Pigment // Pigment
loadpigm = MathmodRef->ui.glWidget->IsoObjet->masterthread->vrgbtnotnull = loadpigm = MathmodRef->IsoObjet->masterthread->vrgbtnotnull =
(QIso["Pigment"].isObject() || (QIso["Pigment"].isObject() ||
((textureIndex != -1) && (textureIndex > 999))); ((textureIndex != -1) && (textureIndex > 999)));
LoadMandatoryAndOptionnalFields(QIso["Iso3D"].toObject(), ISO_TYPE, LoadMandatoryAndOptionnalFields(QIso["Iso3D"].toObject(), ISO_TYPE,
loadtext, QTextureObj, loadpigm, loadtext, QTextureObj, loadpigm,
QPigmentObj); QPigmentObj);
// Save this Current Isosurface Tree struct // Save this Current Isosurface Tree struct
MathmodRef->RootObjet.CurrentParisoTreestruct.push_back( MathmodRef->RootObjet.CurrentParisoTreestruct.push_back(
MathmodRef->RootObjet.CurrentTreestruct); MathmodRef->RootObjet.CurrentTreestruct);
document.setObject(Jobj); document.setObject(Jobj);
MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJson() ); MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJson() );
// Update the current pariso struct // Update the current pariso struct
MathmodRef->RootObjet.CurrentJsonObject = Jobj; MathmodRef->RootObjet.CurrentJsonObject = Jobj;
CurrentFormulaType = 2; CurrentFormulaType = 2;
/// process the new surface /// process the new surface
if (textureIndex == -1) if (textureIndex == -1)
{ {
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = true; MathmodRef->LocalScene.componentsinfos.pariso = true;
MathmodRef->ParisoObjectProcess(); MathmodRef->ParisoObjectProcess();
} }
ui.parisogroupbox->show(); ui.parisogroupbox->show();
} }
else else
{ {
ui.parisogroupbox->hide(); ui.parisogroupbox->hide();
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = false; MathmodRef->LocalScene.componentsinfos.pariso = false;
if (Jobj["Iso3D"].isObject()) if (Jobj["Iso3D"].isObject())
{ {
QObj = Jobj["Iso3D"].toObject(); QObj = Jobj["Iso3D"].toObject();
// Colors // Colors
loadtext = MathmodRef->ui.glWidget->IsoObjet->masterthread->rgbtnotn ull = loadtext = MathmodRef->IsoObjet->masterthread->rgbtnotnull =
(Jobj["Texture"].isObject() || (Jobj["Texture"].isObject() ||
((textureIndex < 1000) && (textureIndex != -1))); ((textureIndex < 1000) && (textureIndex != -1)));
// Pigment // Pigment
loadpigm = MathmodRef->ui.glWidget->IsoObjet->masterthread->vrgbtnot null = loadpigm = MathmodRef->IsoObjet->masterthread->vrgbtnotnull =
(Jobj["Pigment"].isObject() || (Jobj["Pigment"].isObject() ||
((textureIndex != -1) && (textureIndex > 999))); ((textureIndex != -1) && (textureIndex > 999)));
LoadMandatoryAndOptionnalFields(QObj, ISO_TYPE, loadtext, QTextureOb j, LoadMandatoryAndOptionnalFields(QObj, ISO_TYPE, loadtext, QTextureOb j,
loadpigm, QPigmentObj); loadpigm, QPigmentObj);
QJsonObject Jobjtmp = Jobj; QJsonObject Jobjtmp = Jobj;
// Some keys cleaning.. // Some keys cleaning..
Jobjtmp.remove("ParIso"); Jobjtmp.remove("ParIso");
Jobjtmp.remove("Param3D"); Jobjtmp.remove("Param3D");
skipping to change at line 1296 skipping to change at line 1274
{ {
if (MathmodRef->RootObjet.CurrentTreestruct.fxyz.count() > 0) if (MathmodRef->RootObjet.CurrentTreestruct.fxyz.count() > 0)
MathmodRef->ProcessNewIsoSurface(); MathmodRef->ProcessNewIsoSurface();
} }
else else
{ {
int result = MathmodRef->ParseIso(); int result = MathmodRef->ParseIso();
if (result == -1) if (result == -1)
return; return;
textureIndex < 1000 textureIndex < 1000
? MathmodRef->ui.glWidget->CalculateTexturePoints(1) ? MathmodRef->CalculateTexturePoints(1)
: MathmodRef->ui.glWidget->CalculatePigmentPoints(1); : MathmodRef->CalculatePigmentPoints(1);
MathmodRef->ui.glWidget->update(); MathmodRef->LocalScene.componentsinfos.Interleave=true;
MathmodRef->update();
} }
} }
else if (Jobj["Param3D"].isObject()) else if (Jobj["Param3D"].isObject())
{ {
QObj = Jobj["Param3D"].toObject(); QObj = Jobj["Param3D"].toObject();
// Colors // Colors
loadtext = MathmodRef->ui.glWidget->ParObjet->masterthread->rgbtnotn ull = loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull =
(Jobj["Texture"].isObject() || (Jobj["Texture"].isObject() ||
((textureIndex < 1000) && (textureIndex != -1))); ((textureIndex < 1000) && (textureIndex != -1)));
// Pigment // Pigment
loadpigm = MathmodRef->ui.glWidget->ParObjet->masterthread->vrgbtnot null = loadpigm = MathmodRef->ParObjet->masterthread->vrgbtnotnull =
(Jobj["Pigment"].isObject() || (Jobj["Pigment"].isObject() ||
((textureIndex != -1) && (textureIndex > 999))); ((textureIndex != -1) && (textureIndex > 999)));
LoadMandatoryAndOptionnalFields(QObj, PAR_TYPE, loadtext, QTextureOb j, LoadMandatoryAndOptionnalFields(QObj, PAR_TYPE, loadtext, QTextureOb j,
loadpigm, QPigmentObj); loadpigm, QPigmentObj);
QJsonObject Jobjtmp = Jobj; QJsonObject Jobjtmp = Jobj;
// Some keys cleaning.. // Some keys cleaning..
Jobjtmp.remove("ParIso"); Jobjtmp.remove("ParIso");
Jobjtmp.remove("Iso3D"); Jobjtmp.remove("Iso3D");
skipping to change at line 1340 skipping to change at line 1319
if (textureIndex == -1) if (textureIndex == -1)
{ {
MathmodRef->ParametricSurfaceProcess(1); MathmodRef->ParametricSurfaceProcess(1);
} }
else else
{ {
int result = MathmodRef->ParsePar(); int result = MathmodRef->ParsePar();
if (result == -1) if (result == -1)
return; return;
textureIndex < 1000 textureIndex < 1000
? MathmodRef->ui.glWidget->CalculateTexturePoints(0) ? MathmodRef->CalculateTexturePoints(0)
: MathmodRef->ui.glWidget->CalculatePigmentPoints(0); : MathmodRef->CalculatePigmentPoints(0);
MathmodRef->ui.glWidget->update(); MathmodRef->LocalScene.componentsinfos.Interleave=true;
MathmodRef->update();
} }
} }
else if (Jobj["Param4D"].isObject()) else if (Jobj["Param4D"].isObject())
{ {
QObj = Jobj["Param4D"].toObject(); QObj = Jobj["Param4D"].toObject();
// Colors // Colors
loadtext = MathmodRef->ui.glWidget->ParObjet->masterthread->rgbtnotn ull = loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull =
(Jobj["Texture"].isObject() || (Jobj["Texture"].isObject() ||
((textureIndex < 1000) && (textureIndex != -1))); ((textureIndex < 1000) && (textureIndex != -1)));
// Pigment // Pigment
loadpigm = MathmodRef->ui.glWidget->ParObjet->masterthread->vrgbtnot null = loadpigm = MathmodRef->ParObjet->masterthread->vrgbtnotnull =
(Jobj["Pigment"].isObject() || (Jobj["Pigment"].isObject() ||
((textureIndex != -1) && (textureIndex > 1000))); ((textureIndex != -1) && (textureIndex > 1000)));
LoadMandatoryAndOptionnalFields(QObj, PAR_4D_TYPE, loadtext, QTextur eObj, LoadMandatoryAndOptionnalFields(QObj, PAR_4D_TYPE, loadtext, QTextur eObj,
loadpigm, QPigmentObj); loadpigm, QPigmentObj);
QJsonObject Jobjtmp = Jobj; QJsonObject Jobjtmp = Jobj;
// Some keys cleaning.. // Some keys cleaning..
Jobjtmp.remove("Iso3D"); Jobjtmp.remove("Iso3D");
Jobjtmp.remove("Param3D"); Jobjtmp.remove("Param3D");
skipping to change at line 1386 skipping to change at line 1366
if (textureIndex == -1) if (textureIndex == -1)
{ {
MathmodRef->ParametricSurfaceProcess(3); MathmodRef->ParametricSurfaceProcess(3);
} }
else else
{ {
int result = MathmodRef->ParsePar(); int result = MathmodRef->ParsePar();
if (result == -1) if (result == -1)
return; return;
textureIndex < 1000 textureIndex < 1000
? MathmodRef->ui.glWidget->CalculateTexturePoints(0) ? MathmodRef->CalculateTexturePoints(0)
: MathmodRef->ui.glWidget->CalculatePigmentPoints(0); : MathmodRef->CalculatePigmentPoints(0);
MathmodRef->ui.glWidget->update(); MathmodRef->LocalScene.componentsinfos.Interleave=true;
MathmodRef->update();
} }
} }
} }
} }
void DrawingOptions::updateCurrentTreestruct() void DrawingOptions::updateCurrentTreestruct()
{ {
// Initialize the current Object struct // Initialize the current Object struct
MathmodRef->RootObjet.CurrentTreestruct MathmodRef->RootObjet.CurrentTreestruct
.fw = MathmodRef->RootObjet.CurrentTreestruct .fw = MathmodRef->RootObjet.CurrentTreestruct
.fx = MathmodRef->RootObjet.CurrentTreestruct .fx = MathmodRef->RootObjet.CurrentTreestruct
.fy = MathmodRef->RootObjet.CurrentTreestruct.fz = .fy = MathmodRef->RootObjet.CurrentTreestruct.fz =
MathmodRef->RootObjet.CurrentTreestruct MathmodRef->RootObjet.CurrentTreestruct
.Cnd = MathmodRef->RootObjet.CurrentTreestruct .Cnd = MathmodRef->RootObjet.CurrentTreestruct
.RGBT = MathmodRef->RootObjet.CurrentTreestruct .RGBT = MathmodRef->RootObjet.CurrentTreestruct.Const =
.Const = MathmodRef->RootObjet.CurrentTreestruct
MathmodRef->RootObjet.CurrentTreestruct .Funct = MathmodRef->RootObjet.CurrentTreestruct.VRGBT =
.Funct = MathmodRef->RootObjet.CurrentT MathmodRef->RootObjet.CurrentTreestruct
reestruct.VRGBT = .Gradient = MathmodRef->RootObjet.CurrentTreestruct.fxyz =
MathmodRef->RootObjet.CurrentTr MathmodRef->RootObjet.CurrentTreestruct
eestruct .umin = MathmodRef->RootObjet.CurrentTreestruct.umax =
.Gradient = MathmodRef->RootObj MathmodRef->RootObjet.CurrentTreestruct
et.CurrentTreestruct.fxyz = .vmin = MathmodRef->RootObjet.CurrentTreestruct.vmax =
MathmodRef->RootObjet.C MathmodRef->RootObjet.CurrentTreestruct
urrentTreestruct .xmin = MathmodRef->RootObjet.CurrentTreestruct
.umin = MathmodRef->Roo .xmax = MathmodRef->RootObjet
tObjet.CurrentTreestruct.umax = .CurrentTreestruct.ymin =
MathmodRef->Roo MathmodRef->RootObjet.CurrentTreestruct.ymax =
tObjet.CurrentTreestruct MathmodRef->RootObjet.CurrentTreestruct.zmin = MathmodRef->RootObjet
.vmin = Mathmod .CurrentTreestruct.zmax = MathmodRef->RootObjet.CurrentTreestruct.tmin = Mat
Ref->RootObjet.CurrentTreestruct.vmax = hmodRef->RootObjet
Mathmod .CurrentTreestruct.tmax = MathmodRef->RootObjet
Ref->RootObjet.CurrentTreestruct .CurrentTreestruct.name = MathmodRef->RootObjet
.xmin = .CurrentTreestruct.Component = MathmodRef->RootObjet
MathmodRef->RootObjet.CurrentTreestruct .CurrentTreestruct.Grid = QStringList();
.xmax = MathmodRef->RootObjet
.CurrentTreestruct.ymin =
MathmodRef->RootObjet.CurrentTreestruct.ymax =
MathmodRef->RootObjet.CurrentTreestruct
.zmin = MathmodRef->RootObjet
.CurrentTreestruct.zmax =
MathmodRef->RootObjet.CurrentTreestruct
.tmin = MathmodRef->RootObjet
.CurrentTreestruct.tmax =
MathmodRef->RootObjet
.CurrentTreestruct.name
=
MathmodRef->Roo
tObjet
.CurrentTreestr
uct.Component =
Mathmod
Ref->RootObjet
.Curren
tTreestruct.Grid =
QStringList();
MathmodRef->RootObjet.CurrentTreestruct.Noise = MathmodRef->RootObjet.CurrentTreestruct.Noise =
MathmodRef->RootObjet.CurrentTreestruct.text = ""; MathmodRef->RootObjet.CurrentTreestruct.text = "";
MathmodRef->RootObjet.CurrentTreestruct.type = UNDEFINED_TYPE; MathmodRef->RootObjet.CurrentTreestruct.type = UNDEFINED_TYPE;
// Initialize the current JSON Object // Initialize the current JSON Object
MathmodRef->RootObjet.CurrentJsonObject = QJsonObject(); MathmodRef->RootObjet.CurrentJsonObject = QJsonObject();
// Initialize the Current Pariso Trees truct // Initialize the Current Pariso Trees truct
MathmodRef->RootObjet.CurrentParisoTreestruct.clear(); MathmodRef->RootObjet.CurrentParisoTreestruct.clear();
} }
void DrawingOptions::MandatoryParFieldprocess(const QJsonObject &QObj, void DrawingOptions::MandatoryParFieldprocess(const QJsonObject &QObj,
skipping to change at line 1451 skipping to change at line 1425
const ModelType &mod) const ModelType &mod)
{ {
QString result, arg = MandatoryParFieldToQString(idx); QString result, arg = MandatoryParFieldToQString(idx);
QJsonArray lst; QJsonArray lst;
lst = QObj[arg].toArray(); lst = QObj[arg].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
switch (idx) switch (idx)
{ {
case PAR_FX: case PAR_FX:
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_X = MathmodRef->ParObjet->masterthread->expression_X =
result.toStdString(); result.toStdString();
MathmodRef->ui.glWidget->ParObjet->masterthread->componentsNumber = MathmodRef->ParObjet->masterthread->componentsNumber =
uint(lst.size()); uint(lst.size());
MathmodRef->RootObjet.CurrentTreestruct.fx = MathmodRef->RootObjet.CurrentTreestruct.fx =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_FY: case PAR_FY:
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_Y = MathmodRef->ParObjet->masterthread->expression_Y =
result.toStdString(); result.toStdString();
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_YSize = MathmodRef->ParObjet->masterthread->expression_YSize =
lst.size(); lst.size();
MathmodRef->RootObjet.CurrentTreestruct.fy = MathmodRef->RootObjet.CurrentTreestruct.fy =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_FZ: case PAR_FZ:
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_Z = MathmodRef->ParObjet->masterthread->expression_Z =
result.toStdString(); result.toStdString();
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_ZSize = MathmodRef->ParObjet->masterthread->expression_ZSize =
lst.size(); lst.size();
MathmodRef->RootObjet.CurrentTreestruct.fz = MathmodRef->RootObjet.CurrentTreestruct.fz =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_FW: case PAR_FW:
if (mod == PAR_4D_TYPE) if (mod == PAR_4D_TYPE)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_W = MathmodRef->ParObjet->masterthread->expression_W =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.fw = MathmodRef->RootObjet.CurrentTreestruct.fw =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
break; break;
case PAR_UMIN: case PAR_UMIN:
MathmodRef->ui.glWidget->ParObjet->masterthread->inf_u = MathmodRef->ParObjet->masterthread->inf_u =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.umin = MathmodRef->RootObjet.CurrentTreestruct.umin =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_UMAX: case PAR_UMAX:
MathmodRef->ui.glWidget->ParObjet->masterthread->sup_u = MathmodRef->ParObjet->masterthread->sup_u =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.umax = MathmodRef->RootObjet.CurrentTreestruct.umax =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_VMAX: case PAR_VMAX:
MathmodRef->ui.glWidget->ParObjet->masterthread->sup_v = MathmodRef->ParObjet->masterthread->sup_v =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.vmax = MathmodRef->RootObjet.CurrentTreestruct.vmax =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_VMIN: case PAR_VMIN:
MathmodRef->ui.glWidget->ParObjet->masterthread->inf_v = MathmodRef->ParObjet->masterthread->inf_v =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.vmin = MathmodRef->RootObjet.CurrentTreestruct.vmin =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_COMP: case PAR_COMP:
MathmodRef->RootObjet.CurrentTreestruct.Component = MathmodRef->RootObjet.CurrentTreestruct.Component =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case PAR_NAME: case PAR_NAME:
MathmodRef->RootObjet.CurrentTreestruct.name = MathmodRef->RootObjet.CurrentTreestruct.name =
skipping to change at line 1529 skipping to change at line 1503
const MandatoryIsoField &idx) const MandatoryIsoField &idx)
{ {
QString result, arg = MandatoryIsoFieldToQString(idx); QString result, arg = MandatoryIsoFieldToQString(idx);
QJsonArray lst; QJsonArray lst;
lst = QObj[arg].toArray(); lst = QObj[arg].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
switch (idx) switch (idx)
{ {
case ISO_FXYZ: case ISO_FXYZ:
MathmodRef->ui.glWidget->IsoObjet->masterthread->ImplicitFunction = MathmodRef->IsoObjet->masterthread->ImplicitFunction =
result.toStdString(); result.toStdString();
MathmodRef->ui.glWidget->IsoObjet->masterthread->componentsNumber = MathmodRef->IsoObjet->masterthread->componentsNumber =
uint(lst.size()); uint(lst.size());
MathmodRef->RootObjet.CurrentTreestruct.fxyz = MathmodRef->RootObjet.CurrentTreestruct.fxyz =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_XMAX: case ISO_XMAX:
MathmodRef->ui.glWidget->IsoObjet->masterthread->XlimitSup = MathmodRef->IsoObjet->masterthread->XlimitSup =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.xmax = MathmodRef->RootObjet.CurrentTreestruct.xmax =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_YMAX: case ISO_YMAX:
MathmodRef->ui.glWidget->IsoObjet->masterthread->YlimitSup = MathmodRef->IsoObjet->masterthread->YlimitSup =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.ymax = MathmodRef->RootObjet.CurrentTreestruct.ymax =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_ZMAX: case ISO_ZMAX:
MathmodRef->ui.glWidget->IsoObjet->masterthread->ZlimitSup = MathmodRef->IsoObjet->masterthread->ZlimitSup =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.zmax = MathmodRef->RootObjet.CurrentTreestruct.zmax =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_XMIN: case ISO_XMIN:
MathmodRef->ui.glWidget->IsoObjet->masterthread->XlimitInf = MathmodRef->IsoObjet->masterthread->XlimitInf =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.xmin = MathmodRef->RootObjet.CurrentTreestruct.xmin =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_YMIN: case ISO_YMIN:
MathmodRef->ui.glWidget->IsoObjet->masterthread->YlimitInf = MathmodRef->IsoObjet->masterthread->YlimitInf =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.ymin = MathmodRef->RootObjet.CurrentTreestruct.ymin =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_ZMIN: case ISO_ZMIN:
MathmodRef->ui.glWidget->IsoObjet->masterthread->ZlimitInf = MathmodRef->IsoObjet->masterthread->ZlimitInf =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.zmin = MathmodRef->RootObjet.CurrentTreestruct.zmin =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_COMP: case ISO_COMP:
MathmodRef->RootObjet.CurrentTreestruct.Component = MathmodRef->RootObjet.CurrentTreestruct.Component =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
break; break;
case ISO_NAME: case ISO_NAME:
MathmodRef->RootObjet.CurrentTreestruct.name = MathmodRef->RootObjet.CurrentTreestruct.name =
skipping to change at line 1593 skipping to change at line 1567
void DrawingOptions::OptionalIsoScriptFieldprocess( void DrawingOptions::OptionalIsoScriptFieldprocess(
const QJsonObject &QObj, OptionnalIsoScriptFIELD idx) const QJsonObject &QObj, OptionnalIsoScriptFIELD idx)
{ {
QString result, arg = ""; QString result, arg = "";
QJsonArray lst; QJsonArray lst;
bool argnotnull = false; bool argnotnull = false;
switch (idx) switch (idx)
{ {
case ISO_VECT: case ISO_VECT:
arg = "Vect"; arg = "Vect";
argnotnull = MathmodRef->ui.glWidget->IsoObjet->masterthread->vectnotnul l = argnotnull = MathmodRef->IsoObjet->masterthread->vectnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case ISO_GRID: case ISO_GRID:
arg = "Grid"; arg = "Grid";
argnotnull = MathmodRef->ui.glWidget->IsoObjet->masterthread->gridnotnul l = argnotnull = MathmodRef->IsoObjet->masterthread->gridnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case ISO_CND: case ISO_CND:
arg = "Cnd"; arg = "Cnd";
argnotnull = MathmodRef->ui.glWidget->IsoObjet->masterthread->cndnotnull = argnotnull = MathmodRef->IsoObjet->masterthread->cndnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case ISO_CONST: case ISO_CONST:
arg = "Const"; arg = "Const";
argnotnull = MathmodRef->ui.glWidget->IsoObjet->masterthread->constnotnu ll = argnotnull = MathmodRef->IsoObjet->masterthread->constnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case ISO_FUNCT: case ISO_FUNCT:
arg = "Funct"; arg = "Funct";
argnotnull = MathmodRef->ui.glWidget->IsoObjet->masterthread->functnotnu ll = argnotnull = MathmodRef->IsoObjet->masterthread->functnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
} }
if (argnotnull) if (argnotnull)
{ {
lst = QObj[arg].toArray(); lst = QObj[arg].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
} }
switch (idx) switch (idx)
{ {
case ISO_VECT: case ISO_VECT:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->vect.clear(); MathmodRef->IsoObjet->masterthread->vect.clear();
for (int j = 0; j < lst.size(); j++) for (int j = 0; j < lst.size(); j++)
MathmodRef->ui.glWidget->IsoObjet->masterthread->vect.push_back( MathmodRef->IsoObjet->masterthread->vect.push_back(
(lst[j].toString()).toUInt()); (lst[j].toString()).toUInt());
MathmodRef->ui.glWidget->IsoObjet->masterthread->Vect = MathmodRef->IsoObjet->masterthread->Vect =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.Vect = MathmodRef->RootObjet.CurrentTreestruct.Vect =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Vect = ""; MathmodRef->IsoObjet->masterthread->Vect = "";
} }
break; break;
case ISO_GRID: case ISO_GRID:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->grid.clear(); MathmodRef->IsoObjet->masterthread->grid.clear();
for (int j = 0; j < lst.size(); j++) for (int j = 0; j < lst.size(); j++)
MathmodRef->ui.glWidget->IsoObjet->masterthread->grid.push_back( MathmodRef->IsoObjet->masterthread->grid.push_back(
(lst[j].toString()).toUInt()); (lst[j].toString()).toUInt());
MathmodRef->ui.glWidget->IsoObjet->masterthread->Grid = MathmodRef->IsoObjet->masterthread->Grid =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.Grid = MathmodRef->RootObjet.CurrentTreestruct.Grid =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Grid = ""; MathmodRef->IsoObjet->masterthread->Grid = "";
} }
break; break;
case ISO_CND: case ISO_CND:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Condition = result. toStdString(); MathmodRef->IsoObjet->masterthread->Condition = result.toStdString() ;
for(int i=0; i<lst.size(); i++) for(int i=0; i<lst.size(); i++)
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCondit ion.push_back((lst[i].toString()).replace(" ", "")==""); MathmodRef->LocalScene.componentsinfos.ParisoCondition.push_back ((lst[i].toString()).replace(" ", "")=="");
MathmodRef->RootObjet.CurrentTreestruct.Cnd = result.split(";"); MathmodRef->RootObjet.CurrentTreestruct.Cnd = result.split(";");
} }
else else
{ {
for(int i=0; i<lst.size(); i++) for(int i=0; i<lst.size(); i++)
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCondit MathmodRef->LocalScene.componentsinfos.ParisoCondition.push_back
ion.push_back(false); (false);
MathmodRef->ui.glWidget->IsoObjet->masterthread->Condition = ""; MathmodRef->IsoObjet->masterthread->Condition = "";
} }
break; break;
case ISO_FUNCT: case ISO_FUNCT:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Funct = result.toSt MathmodRef->IsoObjet->masterthread->Funct = result.toStdString();
dString(); MathmodRef->IsoObjet->masterthread->FunctSize = uint(lst.size());
MathmodRef->ui.glWidget->IsoObjet->masterthread->FunctSize = uint(ls
t.size());
MathmodRef->RootObjet.CurrentTreestruct.Funct = result.split(";", QS tring::SkipEmptyParts); MathmodRef->RootObjet.CurrentTreestruct.Funct = result.split(";", QS tring::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Funct = ""; MathmodRef->IsoObjet->masterthread->Funct = "";
MathmodRef->ui.glWidget->IsoObjet->masterthread->FunctSize = 0; MathmodRef->IsoObjet->masterthread->FunctSize = 0;
} }
break; break;
case ISO_CONST: case ISO_CONST:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Const = MathmodRef->IsoObjet->masterthread->Const =
result.toStdString(); result.toStdString();
MathmodRef->ui.glWidget->IsoObjet->masterthread->ConstSize = MathmodRef->IsoObjet->masterthread->ConstSize =
uint(lst.size()); uint(lst.size());
MathmodRef->RootObjet.CurrentTreestruct.Const = MathmodRef->RootObjet.CurrentTreestruct.Const =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->Const = ""; MathmodRef->IsoObjet->masterthread->Const = "";
MathmodRef->ui.glWidget->IsoObjet->masterthread->ConstSize = 0; MathmodRef->IsoObjet->masterthread->ConstSize = 0;
} }
break; break;
} }
} }
void DrawingOptions::OptionalParScriptFieldprocess( void DrawingOptions::OptionalParScriptFieldprocess(
const QJsonObject &QObj, OptionnalParScriptFIELD idx) const QJsonObject &QObj, OptionnalParScriptFIELD idx)
{ {
QString result, arg = ""; QString result, arg = "";
QJsonArray lst; QJsonArray lst;
bool argnotnull = false; bool argnotnull = false;
switch (idx) switch (idx)
{ {
case PAR_VECT: case PAR_VECT:
arg = "Vect"; arg = "Vect";
argnotnull = MathmodRef->ui.glWidget->ParObjet->masterthread->vectnotnul l = argnotnull = MathmodRef->ParObjet->masterthread->vectnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case PAR_GRID: case PAR_GRID:
arg = "Grid"; arg = "Grid";
argnotnull = MathmodRef->ui.glWidget->ParObjet->masterthread->gridnotnul l = argnotnull = MathmodRef->ParObjet->masterthread->gridnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case PAR_CONST: case PAR_CONST:
arg = "Const"; arg = "Const";
argnotnull = MathmodRef->ui.glWidget->ParObjet->masterthread->constnotnu ll = argnotnull = MathmodRef->ParObjet->masterthread->constnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case PAR_FUNCT: case PAR_FUNCT:
arg = "Funct"; arg = "Funct";
argnotnull = MathmodRef->ui.glWidget->ParObjet->masterthread->functnotnu ll = argnotnull = MathmodRef->ParObjet->masterthread->functnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
case PAR_CND: case PAR_CND:
arg = "Cnd"; arg = "Cnd";
argnotnull = MathmodRef->ui.glWidget->ParObjet->masterthread->cndnotnull = argnotnull = MathmodRef->ParObjet->masterthread->cndnotnull =
QObj[arg].isArray(); QObj[arg].isArray();
break; break;
} }
if (argnotnull) if (argnotnull)
{ {
lst = QObj[arg].toArray(); lst = QObj[arg].toArray();
ObjArrayToString(lst, result); ObjArrayToString(lst, result);
} }
switch (idx) switch (idx)
{ {
case PAR_VECT: case PAR_VECT:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->vect.clear(); MathmodRef->ParObjet->masterthread->vect.clear();
for (int j = 0; j < lst.size(); j++) for (int j = 0; j < lst.size(); j++)
MathmodRef->ui.glWidget->ParObjet->masterthread->vect.push_back( MathmodRef->ParObjet->masterthread->vect.push_back(
(lst[j].toString()).toUInt()); (lst[j].toString()).toUInt());
MathmodRef->ui.glWidget->ParObjet->masterthread->Vect = MathmodRef->ParObjet->masterthread->Vect =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.Vect = MathmodRef->RootObjet.CurrentTreestruct.Vect =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Vect = ""; MathmodRef->ParObjet->masterthread->Vect = "";
} }
break; break;
case PAR_GRID: case PAR_GRID:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->grid.clear(); MathmodRef->ParObjet->masterthread->grid.clear();
for (int j = 0; j < lst.size(); j++) for (int j = 0; j < lst.size(); j++)
MathmodRef->ui.glWidget->ParObjet->masterthread->grid.push_back( MathmodRef->ParObjet->masterthread->grid.push_back(
(lst[j].toString()).toUInt()); (lst[j].toString()).toUInt());
MathmodRef->ui.glWidget->ParObjet->masterthread->Grid = MathmodRef->ParObjet->masterthread->Grid =
result.toStdString(); result.toStdString();
MathmodRef->RootObjet.CurrentTreestruct.Grid = MathmodRef->RootObjet.CurrentTreestruct.Grid =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Grid = ""; MathmodRef->ParObjet->masterthread->Grid = "";
} }
break; break;
case PAR_CND: case PAR_CND:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_CND = re sult.toStdString(); MathmodRef->ParObjet->masterthread->expression_CND = result.toStdStr ing();
for(int i=0; i<lst.size(); i++) for(int i=0; i<lst.size(); i++)
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCondit ion.push_back((lst[i].toString()).replace(" ", "") == ""); MathmodRef->LocalScene.componentsinfos.ParisoCondition.push_back ((lst[i].toString()).replace(" ", "") == "");
MathmodRef->RootObjet.CurrentTreestruct.Cnd = result.split(";"); MathmodRef->RootObjet.CurrentTreestruct.Cnd = result.split(";");
} }
else else
{ {
for(int i=0; i<lst.size(); i++) for(int i=0; i<lst.size(); i++)
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCondit MathmodRef->LocalScene.componentsinfos.ParisoCondition.push_back
ion.push_back(false); (false);
MathmodRef->ui.glWidget->ParObjet->masterthread->expression_CND = "" MathmodRef->ParObjet->masterthread->expression_CND = "";
;
} }
break; break;
case PAR_CONST: case PAR_CONST:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Const = result.toSt MathmodRef->ParObjet->masterthread->Const = result.toStdString();
dString(); MathmodRef->ParObjet->masterthread->ConstSize = uint(lst.size());
MathmodRef->ui.glWidget->ParObjet->masterthread->ConstSize = uint(ls
t.size());
MathmodRef->RootObjet.CurrentTreestruct.Const = result.split(";", QS tring::SkipEmptyParts); MathmodRef->RootObjet.CurrentTreestruct.Const = result.split(";", QS tring::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Const = ""; MathmodRef->ParObjet->masterthread->Const = "";
MathmodRef->ui.glWidget->ParObjet->masterthread->ConstSize = 0; MathmodRef->ParObjet->masterthread->ConstSize = 0;
} }
break; break;
case PAR_FUNCT: case PAR_FUNCT:
if (argnotnull) if (argnotnull)
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Funct = MathmodRef->ParObjet->masterthread->Funct =
result.toStdString(); result.toStdString();
MathmodRef->ui.glWidget->ParObjet->masterthread->FunctSize = MathmodRef->ParObjet->masterthread->FunctSize =
uint(lst.size()); uint(lst.size());
MathmodRef->RootObjet.CurrentTreestruct.Funct = MathmodRef->RootObjet.CurrentTreestruct.Funct =
result.split(";", QString::SkipEmptyParts); result.split(";", QString::SkipEmptyParts);
} }
else else
{ {
MathmodRef->ui.glWidget->ParObjet->masterthread->Funct = ""; MathmodRef->ParObjet->masterthread->Funct = "";
MathmodRef->ui.glWidget->ParObjet->masterthread->FunctSize = 0; MathmodRef->ParObjet->masterthread->FunctSize = 0;
} }
break; break;
} }
} }
void DrawingOptions::BuildAllVect() void DrawingOptions::BuildAllVect()
{ {
const OptionnalIsoScriptFIELD optiso[] = {ISO_GRID, ISO_VECT, ISO_CND, ISO_C ONST, ISO_FUNCT}; const OptionnalIsoScriptFIELD optiso[] = {ISO_GRID, ISO_VECT, ISO_CND, ISO_C ONST, ISO_FUNCT};
OptIsoFields = std::vector<OptionnalIsoScriptFIELD>( OptIsoFields = std::vector<OptionnalIsoScriptFIELD>(
optiso, optiso + sizeof(optiso) / sizeof(OptionnalIsoScri ptFIELD)); optiso, optiso + sizeof(optiso) / sizeof(OptionnalIsoScri ptFIELD));
skipping to change at line 1862 skipping to change at line 1836
int DrawingOptions::JSON_choice_activated(const QString &arg1) int DrawingOptions::JSON_choice_activated(const QString &arg1)
{ {
QString result; QString result;
QJsonArray array = JSONMathModels["MathModels"].toArray(); QJsonArray array = JSONMathModels["MathModels"].toArray();
QJsonArray lst; QJsonArray lst;
QJsonObject QObj, QObj1; QJsonObject QObj, QObj1;
QJsonObject QTextureObj, QPigmentObj; QJsonObject QTextureObj, QPigmentObj;
bool loadtext, loadpigm; bool loadtext, loadpigm;
QMessageBox msgBox; QMessageBox msgBox;
updateCurrentTreestruct(); updateCurrentTreestruct();
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCondition.clear(); MathmodRef->LocalScene.componentsinfos.ParisoCondition.clear();
for (int i = 0; i < array.size(); i++) for (int i = 0; i < array.size(); i++)
{ {
if ((QObj1 = array[i].toObject())["ParIso"].isArray() && if ((QObj1 = array[i].toObject())["ParIso"].isArray() &&
(QObj1)["Name"].toString() == arg1) (QObj1)["Name"].toString() == arg1)
{ {
if (!VerifiedJsonModel((array[i].toObject()))) if (!VerifiedJsonModel((array[i].toObject())))
return (0); return (0);
ShowSliders(array[i].toObject()); ShowSliders(array[i].toObject());
QJsonArray listeObj = QObj1["ParIso"].toArray(); QJsonArray listeObj = QObj1["ParIso"].toArray();
QJsonArray listeIsoObj; QJsonArray listeIsoObj;
skipping to change at line 1891 skipping to change at line 1865
if (listeParObj.size() > 0) if (listeParObj.size() > 0)
QPar = listeParObj[0].toObject(); QPar = listeParObj[0].toObject();
if (listeIsoObj.size() > 0) if (listeIsoObj.size() > 0)
QIso = listeIsoObj[0].toObject(); QIso = listeIsoObj[0].toObject();
loadtext = loadpigm = false; loadtext = loadpigm = false;
if (QPar["Texture"].isObject()) if (QPar["Texture"].isObject())
QTextureObj = QPar["Texture"].toObject(); QTextureObj = QPar["Texture"].toObject();
if (QPar["Pigment"].isObject()) if (QPar["Pigment"].isObject())
QPigmentObj = QPar["Pigment"].toObject(); QPigmentObj = QPar["Pigment"].toObject();
// Colors // Colors
loadtext = MathmodRef->ui.glWidget->ParObjet->masterthread->rgbtnotn ull = loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull =
(QPar["Texture"].isObject()); (QPar["Texture"].isObject());
// Pigment // Pigment
loadpigm = MathmodRef->ui.glWidget->ParObjet->masterthread->vrgbtnot null = loadpigm = MathmodRef->ParObjet->masterthread->vrgbtnotnull =
(QPar["Pigment"].isObject()); (QPar["Pigment"].isObject());
LoadMandatoryAndOptionnalFields(QPar["Param3D"].toObject(), PAR_TYPE , LoadMandatoryAndOptionnalFields(QPar["Param3D"].toObject(), PAR_TYPE ,
loadtext, QTextureObj, loadpigm, loadtext, QTextureObj, loadpigm,
QPigmentObj); QPigmentObj);
// Save this Current Parametric Tree struct // Save this Current Parametric Tree struct
MathmodRef->RootObjet.CurrentParisoTreestruct.push_back( MathmodRef->RootObjet.CurrentParisoTreestruct.push_back(
MathmodRef->RootObjet.CurrentTreestruct); MathmodRef->RootObjet.CurrentTreestruct);
loadtext = loadpigm = false; loadtext = loadpigm = false;
if (QIso["Texture"].isObject()) if (QIso["Texture"].isObject())
QTextureObj = QIso["Texture"].toObject(); QTextureObj = QIso["Texture"].toObject();
if (QIso["Pigment"].isObject()) if (QIso["Pigment"].isObject())
QPigmentObj = QIso["Pigment"].toObject(); QPigmentObj = QIso["Pigment"].toObject();
// Colors // Colors
loadtext = MathmodRef->ui.glWidget->IsoObjet->masterthread->rgbtnotn ull = loadtext = MathmodRef->IsoObjet->masterthread->rgbtnotnull =
(QIso["Texture"].isObject()); (QIso["Texture"].isObject());
// Pigment // Pigment
loadpigm = MathmodRef->ui.glWidget->IsoObjet->masterthread->vrgbtnot null = loadpigm = MathmodRef->IsoObjet->masterthread->vrgbtnotnull =
(QIso["Pigment"].isObject()); (QIso["Pigment"].isObject());
LoadMandatoryAndOptionnalFields(QIso["Iso3D"].toObject(), ISO_TYPE, LoadMandatoryAndOptionnalFields(QIso["Iso3D"].toObject(), ISO_TYPE,
loadtext, QTextureObj, loadpigm, loadtext, QTextureObj, loadpigm,
QPigmentObj); QPigmentObj);
// Save this Current Isosurface Tree struct // Save this Current Isosurface Tree struct
MathmodRef->RootObjet.CurrentParisoTreestruct.push_back( MathmodRef->RootObjet.CurrentParisoTreestruct.push_back(
MathmodRef->RootObjet.CurrentTreestruct); MathmodRef->RootObjet.CurrentTreestruct);
QJsonDocument document; QJsonDocument document;
document.setObject(QObj1); document.setObject(QObj1);
MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on()); MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on());
// Update the current pariso struct // Update the current pariso struct
MathmodRef->RootObjet.CurrentJsonObject = QObj1; MathmodRef->RootObjet.CurrentJsonObject = QObj1;
CurrentFormulaType = 2; CurrentFormulaType = 2;
/// process the new surface /// process the new surface
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCurrentCom MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex =
ponentIndex = 0; 0;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoNbComponen MathmodRef->LocalScene.componentsinfos.ParisoNbComponents =2;
ts =2; MathmodRef->LocalScene.componentsinfos.pariso = true;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = true;
MathmodRef->ParisoObjectProcess(); MathmodRef->ParisoObjectProcess();
ui.parisogroupbox->show(); ui.parisogroupbox->show();
return (1); return (1);
} }
else else
{ {
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = false; MathmodRef->LocalScene.componentsinfos.pariso = false;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoNbComponen MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = 1;
ts = 1; MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex =
MathmodRef->ui.glWidget->LocalScene.componentsinfos.ParisoCurrentCom 0;
ponentIndex = 0;
ui.parisogroupbox->hide(); ui.parisogroupbox->hide();
if ((QObj1 = array[i].toObject())["Iso3D"].isObject() && if ((QObj1 = array[i].toObject())["Iso3D"].isObject() &&
(QObj = (array[i].toObject())["Iso3D"].toObject())["Name"] (QObj = (array[i].toObject())["Iso3D"].toObject())["Name"]
.toArray()[0] .toArray()[0]
.toString() == arg1) .toString() == arg1)
{ {
if (!VerifiedJsonModel((array[i].toObject()))) if (!VerifiedJsonModel((array[i].toObject())))
return (0); return (0);
ShowSliders(array[i].toObject()); ShowSliders(array[i].toObject());
// Colors // Colors
if ((loadtext = MathmodRef->ui.glWidget->IsoObjet->masterthread- >rgbtnotnull = QObj1["Texture"].isObject())) if ((loadtext = MathmodRef->IsoObjet->masterthread->rgbtnotnull = QObj1["Texture"].isObject()))
QTextureObj = QObj1["Texture"].toObject(); QTextureObj = QObj1["Texture"].toObject();
// Pigment // Pigment
if ((loadpigm = MathmodRef->ui.glWidget->IsoObjet->masterthread- >vrgbtnotnull = QObj1["Pigment"].isObject())) if ((loadpigm = MathmodRef->IsoObjet->masterthread->vrgbtnotnull = QObj1["Pigment"].isObject()))
QPigmentObj = QObj1["Pigment"].toObject(); QPigmentObj = QObj1["Pigment"].toObject();
LoadMandatoryAndOptionnalFields(QObj, ISO_TYPE, loadtext, QTextu reObj, LoadMandatoryAndOptionnalFields(QObj, ISO_TYPE, loadtext, QTextu reObj,
loadpigm, QPigmentObj); loadpigm, QPigmentObj);
QJsonDocument document; QJsonDocument document;
document.setObject(array[i].toObject()); document.setObject(array[i].toObject());
MathmodRef->RootObjet.CurrentTreestruct.text = MathmodRef->RootObjet.CurrentTreestruct.text =
QString(document.toJson()); QString(document.toJson());
// Update the current parametric struct // Update the current parametric struct
// MathmodRef->RootObjet.CurrentIsoStruct = // MathmodRef->RootObjet.CurrentIsoStruct =
// MathmodRef->RootObjet.IsoTable[indextable]; // MathmodRef->RootObjet.IsoTable[indextable];
skipping to change at line 1978 skipping to change at line 1952
else if ((array[i].toObject())["Param3D"].isObject() && else if ((array[i].toObject())["Param3D"].isObject() &&
(QObj = (array[i].toObject())["Param3D"].toObject())["Name" ] (QObj = (array[i].toObject())["Param3D"].toObject())["Name" ]
.toArray()[0] .toArray()[0]
.toString() == arg1) .toString() == arg1)
{ {
if (!VerifiedJsonModel((array[i].toObject()))) if (!VerifiedJsonModel((array[i].toObject())))
return (0); return (0);
ShowSliders(array[i].toObject()); ShowSliders(array[i].toObject());
// Colors // Colors
if ((loadtext = if ((loadtext =
MathmodRef->ui.glWidget->ParObjet->masterthread->rgb tnotnull = MathmodRef->ParObjet->masterthread->rgbtnotnull =
QObj1["Texture"].isObject())) QObj1["Texture"].isObject()))
QTextureObj = QObj1["Texture"].toObject(); QTextureObj = QObj1["Texture"].toObject();
// Pigment // Pigment
if ((loadpigm = if ((loadpigm =
MathmodRef->ui.glWidget->ParObjet->masterthread->vrg btnotnull = MathmodRef->ParObjet->masterthread->vrgbtnotnull =
QObj1["Pigment"].isObject())) QObj1["Pigment"].isObject()))
QPigmentObj = QObj1["Pigment"].toObject(); QPigmentObj = QObj1["Pigment"].toObject();
LoadMandatoryAndOptionnalFields(QObj, PAR_TYPE, loadtext, QTextu reObj, LoadMandatoryAndOptionnalFields(QObj, PAR_TYPE, loadtext, QTextu reObj,
loadpigm, QPigmentObj); loadpigm, QPigmentObj);
QJsonDocument document; QJsonDocument document;
document.setObject(array[i].toObject()); document.setObject(array[i].toObject());
MathmodRef->RootObjet.CurrentTreestruct.text = MathmodRef->RootObjet.CurrentTreestruct.text =
QString(document.toJson()); QString(document.toJson());
MathmodRef->RootObjet.CurrentJsonObject = array[i].toObject(); MathmodRef->RootObjet.CurrentJsonObject = array[i].toObject();
skipping to change at line 2009 skipping to change at line 1983
else if ((array[i].toObject())["Param4D"].isObject() && else if ((array[i].toObject())["Param4D"].isObject() &&
(QObj = (array[i].toObject())["Param4D"].toObject())["Name" ] (QObj = (array[i].toObject())["Param4D"].toObject())["Name" ]
.toArray()[0] .toArray()[0]
.toString() == arg1) .toString() == arg1)
{ {
if (!VerifiedJsonModel((array[i].toObject()))) if (!VerifiedJsonModel((array[i].toObject())))
return (0); return (0);
ShowSliders(array[i].toObject()); ShowSliders(array[i].toObject());
// Colors // Colors
if ((loadtext = if ((loadtext =
MathmodRef->ui.glWidget->ParObjet->masterthread->rgb tnotnull = MathmodRef->ParObjet->masterthread->rgbtnotnull =
QObj1["Texture"].isObject())) QObj1["Texture"].isObject()))
QTextureObj = QObj1["Texture"].toObject(); QTextureObj = QObj1["Texture"].toObject();
// Pigment // Pigment
if ((loadpigm = if ((loadpigm =
MathmodRef->ui.glWidget->ParObjet->masterthread->vrg btnotnull = MathmodRef->ParObjet->masterthread->vrgbtnotnull =
QObj1["Pigment"].isObject())) QObj1["Pigment"].isObject()))
QPigmentObj = QObj1["Pigment"].toObject(); QPigmentObj = QObj1["Pigment"].toObject();
LoadMandatoryAndOptionnalFields(QObj, PAR_4D_TYPE, loadtext, LoadMandatoryAndOptionnalFields(QObj, PAR_4D_TYPE, loadtext,
QTextureObj, loadpigm, QPigmentO bj); QTextureObj, loadpigm, QPigmentO bj);
QJsonDocument document; QJsonDocument document;
document.setObject(array[i].toObject()); document.setObject(array[i].toObject());
MathmodRef->RootObjet.CurrentTreestruct.text = MathmodRef->RootObjet.CurrentTreestruct.text =
QString(document.toJson()); QString(document.toJson());
MathmodRef->RootObjet.CurrentJsonObject = array[i].toObject(); MathmodRef->RootObjet.CurrentJsonObject = array[i].toObject();
CurrentFormulaType = 3; CurrentFormulaType = 3;
skipping to change at line 2040 skipping to change at line 2014
} }
return (0); return (0);
} }
void DrawingOptions::LoadMandatoryAndOptionnalFields( void DrawingOptions::LoadMandatoryAndOptionnalFields(
const QJsonObject &qobj, const ModelType &mod, bool loadtext, const QJsonObject &qobj, const ModelType &mod, bool loadtext,
const QJsonObject &QTextureObj, bool loadpigm, const QJsonObject &QTextureObj, bool loadpigm,
const QJsonObject &QPigmentObj) const QJsonObject &QPigmentObj)
{ {
// We First deactivate the pariso flag // We First deactivate the pariso flag
MathmodRef->ui.glWidget->LocalScene.componentsinfos.pariso = false; MathmodRef->LocalScene.componentsinfos.pariso = false;
MathmodRef->RootObjet.CurrentTreestruct.type = mod; MathmodRef->RootObjet.CurrentTreestruct.type = mod;
switch (mod) switch (mod)
{ {
case PAR_TYPE: case PAR_TYPE:
for (std::vector<MandatoryParField>::const_iterator it = for (std::vector<MandatoryParField>::const_iterator it =
MandParFields.begin(); MandParFields.begin();
it != MandParFields.end(); ++it) it != MandParFields.end(); ++it)
{ {
MandatoryParField Opt = *it; MandatoryParField Opt = *it;
MandatoryParFieldprocess(qobj, Opt); MandatoryParFieldprocess(qobj, Opt);
skipping to change at line 2167 skipping to change at line 2141
if (arg1 == "Infos") if (arg1 == "Infos")
{ {
MathmodRef->iso_infos(); MathmodRef->iso_infos();
return; return;
} }
if (arg1 == "Fill") if (arg1 == "Fill")
{ {
MathmodRef->fill(); MathmodRef->fill();
return; return;
} }
if (arg1 == "Smooth")
{
MathmodRef->smoothline();
return;
}
if (arg1 == "Mesh") if (arg1 == "Mesh")
{ {
MathmodRef->Mesh(); MathmodRef->Mesh();
return; return;
} }
} }
void DrawingOptions::slot_checkBox_clicked() void DrawingOptions::slot_checkBox_clicked()
{ {
MathmodRef->slot_uv_clicked(); MathmodRef->slot_uv_clicked();
skipping to change at line 2408 skipping to change at line 2377
current = 15; current = 15;
break; break;
case 16: case 16:
// Save the equation: // Save the equation:
name = name.trimmed(); name = name.trimmed();
if (FctType == 0) if (FctType == 0)
{ {
EquationsNumber++; EquationsNumber++;
if (name == "") if (name == "")
name = "_" + QString::number(EquationsNumber); name = "_" + QString::number(EquationsNumber);
xlimit = xlimit.trimmed(); xlimit = xlimit.trimmed();
separator = xlimit.indexOf(","); separator = xlimit.indexOf(",");
xmin = xlimit.left(separator); xmin = xlimit.left(separator);
xmax = xlimit.remove(xmin + ","); xmax = xlimit.remove(xmin + ",");
ylimit = ylimit.trimmed(); ylimit = ylimit.trimmed();
separator = ylimit.indexOf(","); separator = ylimit.indexOf(",");
ymin = ylimit.left(separator); ymin = ylimit.left(separator);
ymax = ylimit.remove(ymin + ","); ymax = ylimit.remove(ymin + ",");
zlimit = zlimit.trimmed(); zlimit = zlimit.trimmed();
separator = zlimit.indexOf(","); separator = zlimit.indexOf(",");
zmin = zlimit.left(separator); zmin = zlimit.left(separator);
zmax = zlimit.remove(zmin + ","); zmax = zlimit.remove(zmin + ",");
if (JsonString != "") if (JsonString != "")
JsonString += ","; JsonString += ",";
JsonString += "{\"Iso3D\": { \ JsonString += "{\"Iso3D\": { \
\"Description \": [ \"" + \"Description \": [ \"" +
comments + "\"], "; comments + "\"], ";
JsonString += "\"Name\": [\"" + name + "\"], "; JsonString += "\"Name\": [\"" + name + "\"], ";
JsonString += "\"Component\": [\"" + name + "\"], "; JsonString += "\"Component\": [\"" + name + "\"], ";
JsonString += "\"Fxyz\": [\"" + IsoFct.trimmed() + "\"], "; JsonString += "\"Fxyz\": [\"" + IsoFct.trimmed() + "\"], ";
JsonString += "\"Cnd\": [\"" + condition + "\"], "; JsonString += "\"Cnd\": [\"" + condition + "\"], ";
JsonString += "\"Xmin\": [\"" + xmin + "\"], "; JsonString += "\"Xmin\": [\"" + xmin + "\"], ";
JsonString += "\"Xmax\": [\"" + xmax + "\"], "; JsonString += "\"Xmax\": [\"" + xmax + "\"], ";
JsonString += "\"Ymin\": [\"" + ymin + "\"], "; JsonString += "\"Ymin\": [\"" + ymin + "\"], ";
JsonString += "\"Ymax\": [\"" + ymax + "\"], "; JsonString += "\"Ymax\": [\"" + ymax + "\"], ";
JsonString += "\"Zmin\": [\"" + zmin + "\"], "; JsonString += "\"Zmin\": [\"" + zmin + "\"], ";
JsonString += "\"Zmax\": [\"" + zmax + "\"] "; JsonString += "\"Zmax\": [\"" + zmax + "\"] ";
JsonString += "}}"; JsonString += "}}";
} }
else if (FctType == 1) else if (FctType == 1)
{ {
EquationsNumber++; EquationsNumber++;
if (name == "") if (name == "")
name = "_" + QString::number(EquationsNumber); name = "_" + QString::number(EquationsNumber);
ulimit = ulimit.trimmed(); ulimit = ulimit.trimmed();
separator = ulimit.indexOf(","); separator = ulimit.indexOf(",");
umin = ulimit.left(separator); umin = ulimit.left(separator);
umax = ulimit.remove(umin + ","); umax = ulimit.remove(umin + ",");
vlimit = vlimit.trimmed(); vlimit = vlimit.trimmed();
separator = vlimit.indexOf(","); separator = vlimit.indexOf(",");
vmin = vlimit.left(separator); vmin = vlimit.left(separator);
vmax = vlimit.remove(vmin + ","); vmax = vlimit.remove(vmin + ",");
if (JsonString != "") if (JsonString != "")
JsonString += ","; JsonString += ",";
JsonString += "{\"Param3D\": { \ JsonString += "{\"Param3D\": { \
\"Description \": [ \"" + \"Description \": [ \"" +
comments + "\"],"; comments + "\"],";
JsonString += "\"Name\": [\"" + name + "\"],"; JsonString += "\"Name\": [\"" + name + "\"],";
JsonString += "\"Component\": [\"" + name + "\"],"; JsonString += "\"Component\": [\"" + name + "\"],";
JsonString += "\"Fx\": [\"" + Xfct.trimmed() + "\"],"; JsonString += "\"Fx\": [\"" + Xfct.trimmed() + "\"],";
JsonString += "\"Fy\": [\"" + Yfct.trimmed() + "\"],"; JsonString += "\"Fy\": [\"" + Yfct.trimmed() + "\"],";
JsonString += "\"Fz\": [\"" + Zfct.trimmed() + "\"],"; JsonString += "\"Fz\": [\"" + Zfct.trimmed() + "\"],";
JsonString += "\"Cnd\": [\"" + condition + "\"],"; JsonString += "\"Cnd\": [\"" + condition + "\"],";
JsonString += "\"Umin\": [\"" + umin + "\"],"; JsonString += "\"Umin\": [\"" + umin + "\"],";
JsonString += "\"Umax\": [\"" + umax + "\"],"; JsonString += "\"Umax\": [\"" + umax + "\"],";
JsonString += "\"Vmin\": [\"" + vmin + "\"],"; JsonString += "\"Vmin\": [\"" + vmin + "\"],";
JsonString += "\"Vmax\": [\"" + vmax + "\"]"; JsonString += "\"Vmax\": [\"" + vmax + "\"]";
JsonString += "}}"; JsonString += "}}";
} }
current = 16; current = 16;
// Init all Parameters fo new formula: // Init all Parameters fo new formula:
IsoFct = Xfct = Yfct = Zfct = name = comments = condition = ""; IsoFct = Xfct = Yfct = Zfct = name = comments = condition = "";
umin = umax = vmin = vmax = xmin = xmax = ymin = ymax = zmin umin = umax = vmin = vmax = xmin = xmax = ymin = ymax = zmin
= zmax = = zmax = "";
"";
ulimit = vlimit = xlimit = ylimit = zlimit = ""; ulimit = vlimit = xlimit = ylimit = zlimit = "";
FctType = -1; FctType = -1;
break; break;
case 18: case 18:
if (current == 1) if (current == 1)
IsoFct += line; IsoFct += line;
else if (current == 2) else if (current == 2)
xlimit += line; xlimit += line;
else if (current == 3) else if (current == 3)
ylimit += line; ylimit += line;
else if (current == 4) else if (current == 4)
zlimit += line; zlimit += line;
else if (current == 21) else if (current == 21)
Xfct += line; Xfct += line;
else if (current == 22) else if (current == 22)
Yfct += line; Yfct += line;
else if (current == 23) else if (current == 23)
Zfct += line; Zfct += line;
else if (current == 24) else if (current == 24)
ulimit += line; ulimit += line;
else if (current == 25) else if (current == 25)
vlimit += line; vlimit += line;
else if (current == 5) else if (current == 5)
condition += line; condition += line;
else if (current == 6) else if (current == 6)
Au += line; Au += line;
else if (current == 7) else if (current == 7)
Bu += line; Bu += line;
else if (current == 8) else if (current == 8)
Cu += line; Cu += line;
else if (current == 9) else if (current == 9)
Duv += line; Duv += line;
skipping to change at line 2553 skipping to change at line 2489
comments += line; comments += line;
else if (current == 13) else if (current == 13)
comments += line; comments += line;
else if (current == 14) else if (current == 14)
comments += line; comments += line;
else if (current == 15) else if (current == 15)
name += line; name += line;
break; break;
} }
} }
file.close(); file.close();
JsonString = " { \"MathModels\": [ " + JsonString + "]}"; JsonString = " { \"MathModels\": [ " + JsonString + "]}";
QFile f(filename.replace(".k3ds", ".js")); QFile f(filename.replace(".k3ds", ".js"));
if (f.exists()) if (f.exists())
f.remove(); f.remove();
if (!f.open(QIODevice::ReadWrite | QIODevice::Text)) if (!f.open(QIODevice::ReadWrite | QIODevice::Text))
{ {
statusBar()->showMessage(tr("Could not write to %1").arg(filenam statusBar()->showMessage(tr("Could not write to %1").arg(filenam
e), e),2000);
2000);
return; return;
} }
QTextStream t(&f); QTextStream t(&f);
t << JsonString; t << JsonString;
f.close(); f.close();
} }
} }
} }
QTreeWidgetItem *DrawingOptions::ChildItemTreeProperty(QTreeWidgetItem *item, QTreeWidgetItem *DrawingOptions::ChildItemTreeProperty(QTreeWidgetItem *item,
skipping to change at line 2586 skipping to change at line 2518
{ {
int childcount = item->childCount(); int childcount = item->childCount();
for (int j = 0; j < childcount; j++) for (int j = 0; j < childcount; j++)
{ {
if ((item->child(j))->text(0).contains(proprty)) if ((item->child(j))->text(0).contains(proprty))
return item->child(j); return item->child(j);
} }
return nullptr; return nullptr;
} }
void DrawingOptions::ParseItemTree(QTreeWidgetItem *item, QList<bool> &list, void DrawingOptions::ParseItemTree(QTreeWidgetItem *item, QList<bool> &list, boo
bool viewall) l viewall)
{ {
int childcount = item->childCount(); int childcount = item->childCount();
bool sel = false; bool sel = false;
bool result; bool result;
for (int j = 0; j < childcount; j++) for (int j = 0; j < childcount; j++)
{ {
item->child(j)->setForeground(0, QColor(255, 255, 255, 255)); item->child(j)->setForeground(0, QColor(255, 255, 255, 255));
if (!viewall) if (!viewall)
{ {
result = false; result = false;
skipping to change at line 2624 skipping to change at line 2555
void DrawingOptions::SearchListModels() void DrawingOptions::SearchListModels()
{ {
QTreeWidgetItem *Toplevel; QTreeWidgetItem *Toplevel;
QTreeWidgetItem *Childlevel = nullptr; QTreeWidgetItem *Childlevel = nullptr;
QTreeWidgetItem *SubChildlevel; QTreeWidgetItem *SubChildlevel;
int topcount = ui.ObjectClasse->topLevelItemCount(); int topcount = ui.ObjectClasse->topLevelItemCount();
int childcount; int childcount;
bool sel1 = false; bool sel1 = false;
int searchresult = 0; int searchresult = 0;
// init boolean lists: // init boolean lists:
for (int i = 0; i < select.selectedoptions.selectedwords.count() - 1; i++) for (int i = 0; i < select.selectedoptions.selectedwords.count() - 1; i++)
{ {
select.selectedoptions.namelist.append(false); select.selectedoptions.namelist.append(false);
select.selectedoptions.functlist.append(false); select.selectedoptions.functlist.append(false);
select.selectedoptions.cmpnamelist.append(false); select.selectedoptions.cmpnamelist.append(false);
select.selectedoptions.complist.append(false); select.selectedoptions.complist.append(false);
} }
for (int i = 0; i < topcount; ++i) for (int i = 0; i < topcount; ++i)
{ {
Toplevel = ui.ObjectClasse->topLevelItem(i); Toplevel = ui.ObjectClasse->topLevelItem(i);
childcount = Toplevel->childCount(); childcount = Toplevel->childCount();
searchresult = 0; searchresult = 0;
for (int j = 0; j < childcount; j++) for (int j = 0; j < childcount; j++)
{ {
sel1 = true; sel1 = true;
if (!select.selectedoptions.showall) if (!select.selectedoptions.showall)
{ {
skipping to change at line 2686 skipping to change at line 2615
if (select.selectedoptions.parsecmpnames && if (select.selectedoptions.parsecmpnames &&
(Childlevel = ChildItemTreeProperty(Toplevel->child(j), (Childlevel = ChildItemTreeProperty(Toplevel->child(j),
"Components")) != nullptr) "Components")) != nullptr)
{ {
ParseItemTree(Childlevel, select.selectedoptions.cmpnamelist ); ParseItemTree(Childlevel, select.selectedoptions.cmpnamelist );
int ct = Childlevel->childCount(); int ct = Childlevel->childCount();
for (int m = 0; m < ct; m++) for (int m = 0; m < ct; m++)
ParseItemTree(Childlevel->child(m), ParseItemTree(Childlevel->child(m),
select.selectedoptions.complist); select.selectedoptions.complist);
} }
// now look in the search results // now look in the search results
if (select.selectedoptions.AND) if (select.selectedoptions.AND)
{ {
sel1 = true; sel1 = true;
for (int l = 0; l < select.selectedoptions.selectedwords.cou nt() - 1; for (int l = 0; l < select.selectedoptions.selectedwords.cou nt() - 1;
l++) l++)
sel1 = sel1 && (select.selectedoptions.namelist.at(l) || sel1 = sel1 && (select.selectedoptions.namelist.at(l) ||
select.selectedoptions.functlist.at(l) | | select.selectedoptions.functlist.at(l) | |
select.selectedoptions.cmpnamelist.at(l) || select.selectedoptions.cmpnamelist.at(l) ||
select.selectedoptions.complist.at(l)); select.selectedoptions.complist.at(l));
skipping to change at line 2727 skipping to change at line 2655
ParseItemTree(SubChildlevel, select.selectedoptions.func tlist, ParseItemTree(SubChildlevel, select.selectedoptions.func tlist,
true); true);
} }
// Components names and their childs: // Components names and their childs:
if ((Childlevel = ChildItemTreeProperty(Toplevel->child(j), if ((Childlevel = ChildItemTreeProperty(Toplevel->child(j),
"Components")) != nullpt r) "Components")) != nullpt r)
{ {
ParseItemTree(Childlevel, select.selectedoptions.cmpnamelist , true); ParseItemTree(Childlevel, select.selectedoptions.cmpnamelist , true);
int ct = Childlevel->childCount(); int ct = Childlevel->childCount();
for (int m = 0; m < ct; m++) for (int m = 0; m < ct; m++)
ParseItemTree(Childlevel->child(m), select.selectedoptio ParseItemTree(Childlevel->child(m), select.selectedoptio
ns.complist, ns.complist, true);
true);
} }
} }
// Now count and show only scripts with appropiate search results: // Now count and show only scripts with appropiate search results:
if (sel1) if (sel1)
searchresult++; searchresult++;
(Toplevel->child(j))->setHidden(!sel1); (Toplevel->child(j))->setHidden(!sel1);
if (Toplevel->text(0).contains("IsoSurfaces")) if (Toplevel->text(0).contains("IsoSurfaces"))
Toplevel->setText(0, "IsoSurfaces (" + QString::number(searchres ult) + Toplevel->setText(0, "IsoSurfaces (" + QString::number(searchres ult) +
")"); ")");
else if (Toplevel->text(0).contains("Parametric")) else if (Toplevel->text(0).contains("Parametric"))
Toplevel->setText(0, Toplevel->setText(0,
"Parametric (" + QString::number(searchresult) + ")"); "Parametric (" + QString::number(searchresult) + ")");
else else
Toplevel->setText(0, "My Selection (" + QString::number(searchre sult) + Toplevel->setText(0, "My Selection (" + QString::number(searchre sult) +
")"); ")");
} }
} }
// Clear boolean lists: // Clear boolean lists:
select.selectedoptions.namelist.clear(); select.selectedoptions.namelist.clear();
select.selectedoptions.functlist.clear(); select.selectedoptions.functlist.clear();
select.selectedoptions.cmpnamelist.clear(); select.selectedoptions.cmpnamelist.clear();
select.selectedoptions.complist.clear(); select.selectedoptions.complist.clear();
} }
void DrawingOptions::AddListModels(bool update) void DrawingOptions::AddListModels(bool update)
{ {
if (!update) if (!update)
{ {
QMenu *contextMenu = new QMenu(ui.ObjectClasse); QMenu *contextMenu = new QMenu(ui.ObjectClasse);
ui.ObjectClasse->setContextMenuPolicy(Qt::ActionsContextMenu); ui.ObjectClasse->setContextMenuPolicy(Qt::ActionsContextMenu);
QAction *addElement = QAction *addElement =
new QAction("Add Current Model to MySelection", contextMenu); new QAction("Add Current Model to MySelection", contextMenu);
QAction *deleteElement = QAction *deleteElement =
new QAction("Erase selected row from MySelection", contextMenu); new QAction("Erase selected row from MySelection", contextMenu);
QAction *separator = new QAction(ui.ObjectClasse); QAction *separator = new QAction(ui.ObjectClasse);
separator->setSeparator(true); separator->setSeparator(true);
ui.ObjectClasse->addAction(addElement); ui.ObjectClasse->addAction(addElement);
ui.ObjectClasse->addAction(separator); ui.ObjectClasse->addAction(separator);
ui.ObjectClasse->addAction(deleteElement); ui.ObjectClasse->addAction(deleteElement);
connect(addElement, SIGNAL(triggered()), this, connect(addElement, SIGNAL(triggered()), this,
SLOT(slot_pushButton_2_clicked())); SLOT(slot_pushButton_2_clicked()));
connect(deleteElement, SIGNAL(triggered()), this, connect(deleteElement, SIGNAL(triggered()), this,
SLOT(slot_unselect_clicked())); SLOT(slot_unselect_clicked()));
} }
QColor greenColor = QColor(0, 255, 0, 50); QColor greenColor = QColor(0, 255, 0, 50);
// Parametric: // Parametric:
skipping to change at line 2797 skipping to change at line 2720
nameitem->setText(0, MathmodRef->collection.JPar[i].Name[0]); nameitem->setText(0, MathmodRef->collection.JPar[i].Name[0]);
if (MathmodRef->collection.JPar[i].Component.count() > 0) if (MathmodRef->collection.JPar[i].Component.count() > 0)
{ {
QTreeWidgetItem *cmpitem = new QTreeWidgetItem(nameitem); QTreeWidgetItem *cmpitem = new QTreeWidgetItem(nameitem);
cmpitem->setText(0, "Components"); cmpitem->setText(0, "Components");
for (int j = 0; j < MathmodRef->collection.JPar[i].Component.count() ; for (int j = 0; j < MathmodRef->collection.JPar[i].Component.count() ;
j++) j++)
{ {
QTreeWidgetItem *cmpitem2 = new QTreeWidgetItem(cmpitem); QTreeWidgetItem *cmpitem2 = new QTreeWidgetItem(cmpitem);
cmpitem2->setText(0, MathmodRef->collection.JPar[i].Component.at (j)); cmpitem2->setText(0, MathmodRef->collection.JPar[i].Component.at (j));
QTreeWidgetItem *cmpitem3 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem3 = new QTreeWidgetItem(cmpitem2);
cmpitem3->setText(0, "X(u,v) = " + cmpitem3->setText(0, "X(u,v) = " +
MathmodRef->collection.JPar[i].Fx.at(j)); MathmodRef->collection.JPar[i].Fx.at(j));
QTreeWidgetItem *cmpitem4 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem4 = new QTreeWidgetItem(cmpitem2);
cmpitem4->setText(0, "Y(u,v) = " + cmpitem4->setText(0, "Y(u,v) = " +
MathmodRef->collection.JPar[i].Fy.at(j)); MathmodRef->collection.JPar[i].Fy.at(j));
QTreeWidgetItem *cmpitem5 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem5 = new QTreeWidgetItem(cmpitem2);
cmpitem5->setText(0, "Z(u,v) = " + cmpitem5->setText(0, "Z(u,v) = " +
MathmodRef->collection.JPar[i].Fz.at(j)); MathmodRef->collection.JPar[i].Fz.at(j));
QTreeWidgetItem *cmpitem6 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem6 = new QTreeWidgetItem(cmpitem2);
cmpitem6->setText( cmpitem6->setText(
0, "U = [" + MathmodRef->collection.JPar[i].Umin.at(j) + ", " + 0, "U = [" + MathmodRef->collection.JPar[i].Umin.at(j) + ", " +
MathmodRef->collection.JPar[i].Umax.at(j) + "]"); MathmodRef->collection.JPar[i].Umax.at(j) + "]");
QTreeWidgetItem *cmpitem7 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem7 = new QTreeWidgetItem(cmpitem2);
cmpitem7->setText( cmpitem7->setText(
0, "V = [" + MathmodRef->collection.JPar[i].Vmin.at(j) + ", " + 0, "V = [" + MathmodRef->collection.JPar[i].Vmin.at(j) + ", " +
MathmodRef->collection.JPar[i].Vmax.at(j) + "]"); MathmodRef->collection.JPar[i].Vmax.at(j) + "]");
// Grid resolution: // Grid resolution:
if (MathmodRef->collection.JPar[i].Grid.size() > 0 && if (MathmodRef->collection.JPar[i].Grid.size() > 0 &&
2 * j + 1 < MathmodRef->collection.JPar[i].Grid.size()) 2 * j + 1 < MathmodRef->collection.JPar[i].Grid.size())
{ {
QTreeWidgetItem *cmpitem8 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem8 = new QTreeWidgetItem(cmpitem2);
cmpitem8->setText( cmpitem8->setText(
0, "Grid = (" + MathmodRef->collection.JPar[i].Grid.at(2 * j) + 0, "Grid = (" + MathmodRef->collection.JPar[i].Grid.at(2 * j) +
" , " + MathmodRef->collection.JPar[i].Grid.at(2 * j + 1 ) + " , " + MathmodRef->collection.JPar[i].Grid.at(2 * j + 1 ) +
")"); ")");
} }
} }
} }
// Add Global parameters: // Add Global parameters:
if (MathmodRef->collection.JPar[i].Csts.count() || if (MathmodRef->collection.JPar[i].Csts.count() ||
MathmodRef->collection.JPar[i].Funct.count()) MathmodRef->collection.JPar[i].Funct.count())
{ {
QTreeWidgetItem *parameteritem = new QTreeWidgetItem(nameitem); QTreeWidgetItem *parameteritem = new QTreeWidgetItem(nameitem);
parameteritem->setText(0, "Parameters:"); parameteritem->setText(0, "Parameters:");
if (MathmodRef->collection.JPar[i].Csts.count() > 0) if (MathmodRef->collection.JPar[i].Csts.count() > 0)
{ {
QTreeWidgetItem *cstitem = new QTreeWidgetItem(parameteritem); QTreeWidgetItem *cstitem = new QTreeWidgetItem(parameteritem);
cstitem->setText(0, "Constantes:"); cstitem->setText(0, "Constantes:");
for (int j = 0; j < MathmodRef->collection.JPar[i].Csts.count(); j++) for (int j = 0; j < MathmodRef->collection.JPar[i].Csts.count(); j++)
{ {
QTreeWidgetItem *cstitem2 = new QTreeWidgetItem(cstitem); QTreeWidgetItem *cstitem2 = new QTreeWidgetItem(cstitem);
cstitem2->setText(0, MathmodRef->collection.JPar[i].Csts.at( j)); cstitem2->setText(0, MathmodRef->collection.JPar[i].Csts.at( j));
} }
} }
if (MathmodRef->collection.JPar[i].Funct.count() > 0) if (MathmodRef->collection.JPar[i].Funct.count() > 0)
{ {
QTreeWidgetItem *fctitem = new QTreeWidgetItem(parameteritem); QTreeWidgetItem *fctitem = new QTreeWidgetItem(parameteritem);
fctitem->setText(0, "Functions:"); fctitem->setText(0, "Functions:");
for (int j = 0; j < MathmodRef->collection.JPar[i].Funct.count() ; j++) for (int j = 0; j < MathmodRef->collection.JPar[i].Funct.count() ; j++)
{ {
QTreeWidgetItem *fctitem2 = new QTreeWidgetItem(fctitem); QTreeWidgetItem *fctitem2 = new QTreeWidgetItem(fctitem);
fctitem2->setText(0, MathmodRef->collection.JPar[i].Funct.at (j)); fctitem2->setText(0, MathmodRef->collection.JPar[i].Funct.at (j));
} }
} }
} }
} }
ParlistItem->sortChildren(0, Qt::AscendingOrder); ParlistItem->sortChildren(0, Qt::AscendingOrder);
// Iso: // Iso:
QTreeWidgetItem *IsolistItem = IsolistItemRef = QTreeWidgetItem *IsolistItem = IsolistItemRef =
new QTreeWidgetItem(ui.ObjectClasse); new QTreeWidgetItem(ui.ObjectClasse);
Text = "IsoSurfaces (" + Text = "IsoSurfaces (" +
QString::number(MathmodRef->collection.JIso.count()) + ")"; QString::number(MathmodRef->collection.JIso.count()) + ")";
IsolistItem->setBackground(0, greenColor); IsolistItem->setBackground(0, greenColor);
IsolistItem->setText(0, Text); IsolistItem->setText(0, Text);
for (int i = 0; i < MathmodRef->collection.JIso.count(); ++i) for (int i = 0; i < MathmodRef->collection.JIso.count(); ++i)
{ {
QTreeWidgetItem *nameitem = new QTreeWidgetItem(IsolistItem); QTreeWidgetItem *nameitem = new QTreeWidgetItem(IsolistItem);
nameitem->setText(0, MathmodRef->collection.JIso[i].Name[0]); nameitem->setText(0, MathmodRef->collection.JIso[i].Name[0]);
if (MathmodRef->collection.JIso[i].Component.count() > 0) if (MathmodRef->collection.JIso[i].Component.count() > 0)
{ {
QTreeWidgetItem *cmpitem = new QTreeWidgetItem(nameitem); QTreeWidgetItem *cmpitem = new QTreeWidgetItem(nameitem);
cmpitem->setText(0, "Components"); cmpitem->setText(0, "Components");
for (int j = 0; j < MathmodRef->collection.JIso[i].Component.count() ; for (int j = 0; j < MathmodRef->collection.JIso[i].Component.count() ;
j++) j++)
{ {
QTreeWidgetItem *cmpitem2 = new QTreeWidgetItem(cmpitem); QTreeWidgetItem *cmpitem2 = new QTreeWidgetItem(cmpitem);
cmpitem2->setText(0, MathmodRef->collection.JIso[i].Component.at (j)); cmpitem2->setText(0, MathmodRef->collection.JIso[i].Component.at (j));
QTreeWidgetItem *cmpitem3 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem3 = new QTreeWidgetItem(cmpitem2);
cmpitem3->setText(0, "F(x,y,z) = " + cmpitem3->setText(0, "F(x,y,z) = " +
MathmodRef->collection.JIso[i].Fxyz.at(j)); MathmodRef->collection.JIso[i].Fxyz.at(j));
QTreeWidgetItem *cmpitem6 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem6 = new QTreeWidgetItem(cmpitem2);
cmpitem6->setText( cmpitem6->setText(
0, "X = [" + MathmodRef->collection.JIso[i].Xmin.at(j) + ", " + 0, "X = [" + MathmodRef->collection.JIso[i].Xmin.at(j) + ", " +
MathmodRef->collection.JIso[i].Xmax.at(j) + "]"); MathmodRef->collection.JIso[i].Xmax.at(j) + "]");
QTreeWidgetItem *cmpitem7 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem7 = new QTreeWidgetItem(cmpitem2);
cmpitem7->setText( cmpitem7->setText(
0, "Y = [" + MathmodRef->collection.JIso[i].Ymin.at(j) + ", " + 0, "Y = [" + MathmodRef->collection.JIso[i].Ymin.at(j) + ", " +
MathmodRef->collection.JIso[i].Ymax.at(j) + "]"); MathmodRef->collection.JIso[i].Ymax.at(j) + "]");
QTreeWidgetItem *cmpitem8 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem8 = new QTreeWidgetItem(cmpitem2);
cmpitem8->setText( cmpitem8->setText(
0, "Z = [" + MathmodRef->collection.JIso[i].Zmin.at(j) + ", " + 0, "Z = [" + MathmodRef->collection.JIso[i].Zmin.at(j) + ", " +
MathmodRef->collection.JIso[i].Zmax.at(j) + "]"); MathmodRef->collection.JIso[i].Zmax.at(j) + "]");
// Grid resolution: // Grid resolution:
if (MathmodRef->collection.JIso[i].Grid.size() > 0 && if (MathmodRef->collection.JIso[i].Grid.size() > 0 &&
j < MathmodRef->collection.JIso[i].Grid.size()) j < MathmodRef->collection.JIso[i].Grid.size())
{ {
QTreeWidgetItem *cmpitem9 = new QTreeWidgetItem(cmpitem2); QTreeWidgetItem *cmpitem9 = new QTreeWidgetItem(cmpitem2);
cmpitem9->setText(0, "Grid = " + cmpitem9->setText(0, "Grid = " +
MathmodRef->collection.JIso[i].Grid.at(j)) ; MathmodRef->collection.JIso[i].Grid.at(j)) ;
} }
} }
} }
// Add Global parameters: // Add Global parameters:
if (MathmodRef->collection.JIso[i].Csts.count() || if (MathmodRef->collection.JIso[i].Csts.count() ||
MathmodRef->collection.JIso[i].Funct.count()) MathmodRef->collection.JIso[i].Funct.count())
{ {
QTreeWidgetItem *parameteritem = new QTreeWidgetItem(nameitem); QTreeWidgetItem *parameteritem = new QTreeWidgetItem(nameitem);
parameteritem->setText(0, "Parameters:"); parameteritem->setText(0, "Parameters:");
if (MathmodRef->collection.JIso[i].Csts.count() > 0) if (MathmodRef->collection.JIso[i].Csts.count() > 0)
{ {
QTreeWidgetItem *cstitem = new QTreeWidgetItem(parameteritem); QTreeWidgetItem *cstitem = new QTreeWidgetItem(parameteritem);
cstitem->setText(0, "Constantes:"); cstitem->setText(0, "Constantes:");
for (int j = 0; j < MathmodRef->collection.JIso[i].Csts.count(); j++) for (int j = 0; j < MathmodRef->collection.JIso[i].Csts.count(); j++)
{ {
QTreeWidgetItem *cstitem2 = new QTreeWidgetItem(cstitem); QTreeWidgetItem *cstitem2 = new QTreeWidgetItem(cstitem);
cstitem2->setText(0, MathmodRef->collection.JIso[i].Csts.at( j)); cstitem2->setText(0, MathmodRef->collection.JIso[i].Csts.at( j));
} }
} }
if (MathmodRef->collection.JIso[i].Funct.count() > 0) if (MathmodRef->collection.JIso[i].Funct.count() > 0)
{ {
QTreeWidgetItem *fctitem = new QTreeWidgetItem(parameteritem); QTreeWidgetItem *fctitem = new QTreeWidgetItem(parameteritem);
fctitem->setText(0, "Functions:"); fctitem->setText(0, "Functions:");
for (int j = 0; j < MathmodRef->collection.JIso[i].Funct.count() ; j++) for (int j = 0; j < MathmodRef->collection.JIso[i].Funct.count() ; j++)
{ {
QTreeWidgetItem *fctitem2 = new QTreeWidgetItem(fctitem); QTreeWidgetItem *fctitem2 = new QTreeWidgetItem(fctitem);
fctitem2->setText(0, MathmodRef->collection.JIso[i].Funct.at (j)); fctitem2->setText(0, MathmodRef->collection.JIso[i].Funct.at (j));
} }
} }
} }
} }
IsolistItemRef->sortChildren(0, Qt::AscendingOrder); IsolistItemRef->sortChildren(0, Qt::AscendingOrder);
// Parametric: // Parametric:
QTreeWidgetItem *ParisolistItem = new QTreeWidgetItem(ui.ObjectClasse); QTreeWidgetItem *ParisolistItem = new QTreeWidgetItem(ui.ObjectClasse);
Text = "Pariso (" + Text = "Pariso (" +
QString::number(MathmodRef->collection.JParIso.count()) + ")" ; QString::number(MathmodRef->collection.JParIso.count()) + ")" ;
ParisolistItem->setBackground(0, greenColor); ParisolistItem->setBackground(0, greenColor);
ParisolistItem->setText(0, Text); ParisolistItem->setText(0, Text);
for (int i = 0; i < MathmodRef->collection.JParIso.count(); ++i) for (int i = 0; i < MathmodRef->collection.JParIso.count(); ++i)
{ {
QTreeWidgetItem *nameitem = new QTreeWidgetItem(ParisolistItem); QTreeWidgetItem *nameitem = new QTreeWidgetItem(ParisolistItem);
nameitem->setText(0, MathmodRef->collection.JParIso[i].Name); nameitem->setText(0, MathmodRef->collection.JParIso[i].Name);
} }
ParisolistItem->sortChildren(0, Qt::AscendingOrder); ParisolistItem->sortChildren(0, Qt::AscendingOrder);
// My Selection: // My Selection:
// Isosurfaces: // Isosurfaces:
QTreeWidgetItem *MyselectionItem = new QTreeWidgetItem(ui.ObjectClasse); QTreeWidgetItem *MyselectionItem = new QTreeWidgetItem(ui.ObjectClasse);
MyselectionItemReference = MyselectionItem; MyselectionItemReference = MyselectionItem;
MyselectionItem->setBackground(0, greenColor); MyselectionItem->setBackground(0, greenColor);
MyselectionItem->setText(0, "My Selection"); MyselectionItem->setText(0, "My Selection");
return; return;
} }
void DrawingOptions::on_pushButton_clicked() void DrawingOptions::on_pushButton_clicked()
{ {
static int checked = 1; static int checked = 1;
checked *= -1; checked *= -1;
(checked == -1) ? ui.ObjectClasse->hide() : ui.ObjectClasse->show(); (checked == -1) ? ui.ObjectClasse->hide() : ui.ObjectClasse->show();
} }
void DrawingOptions::on_action_Exit_triggered() void DrawingOptions::on_action_Exit_triggered()
{ {
MathmodRef->LabelInfos.close();
MathmodRef->close(); MathmodRef->close();
this->close(); this->close();
} }
void DrawingOptions::on_actionTriangles_triggered() void DrawingOptions::on_actionTriangles_triggered()
{ {
MathmodRef->slot_triangles_clicked(); MathmodRef->slot_triangles_clicked();
} }
void DrawingOptions::on_actionNormales_triggered()
{
MathmodRef->draw_norm_clicked();
}
void DrawingOptions::on_actionInfos_triggered() void DrawingOptions::on_actionInfos_triggered()
{ {
MathmodRef->iso_infos(); MathmodRef->iso_infos();
} }
void DrawingOptions::on_actionFill_triggered() void DrawingOptions::on_actionFill_triggered()
{ {
MathmodRef->fill(); MathmodRef->fill();
} }
void DrawingOptions::on_actionSmooth_triggered()
{
MathmodRef->smoothline();
}
void DrawingOptions::on_ObjectClasse_clicked(const QModelIndex &index) void DrawingOptions::on_ObjectClasse_clicked(const QModelIndex &index)
{ {
if (!MathmodRef->ui.glWidget->IsoObjet->isRunning() && if (!MathmodRef->IsoObjet->isRunning() &&
!MathmodRef->ui.glWidget->ParObjet->isRunning()) !MathmodRef->ParObjet->isRunning())
{ {
on_InitTButton_clicked(); on_InitTButton_clicked();
// int result; // int result;
QString tst; QString tst;
MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula = -1; MathmodRef->LocalScene.IndexCurrentFormula = -1;
if (index.data().isValid()) if (index.data().isValid())
{ {
QVariant data = index.data(); QVariant data = index.data();
QString s = data.toString(); QString s = data.toString();
QModelIndex parent = index.parent(); QModelIndex parent = index.parent();
if (parent.data().isValid()) if (parent.data().isValid())
{ {
QString prt = parent.data().toString(); QString prt = parent.data().toString();
if (prt != "My Selection") if (prt != "My Selection")
{ {
skipping to change at line 3089 skipping to change at line 2982
MyselectionItemReference->indexOfChild(ui.ObjectClasse->currentItem()); MyselectionItemReference->indexOfChild(ui.ObjectClasse->currentItem());
MathmodRef->RootObjet.MyJsonObjectSelection.removeAt(index); MathmodRef->RootObjet.MyJsonObjectSelection.removeAt(index);
MyselectionItemReference->removeChild(ui.ObjectClasse->currentItem()); MyselectionItemReference->removeChild(ui.ObjectClasse->currentItem());
} }
void DrawingOptions::slot_XYZscrollBar_valueChanged(int value) void DrawingOptions::slot_XYZscrollBar_valueChanged(int value)
{ {
MathmodRef->xyzg_valueChanged(value, ISO_TYPE); MathmodRef->xyzg_valueChanged(value, ISO_TYPE);
} }
void DrawingOptions::UpdateDescription(int position, ModelType type, void DrawingOptions::UpdateDescription(int position, ModelType type, TreeStruct
TreeStruct &currentstruct) &currentstruct)
{ {
if (type == PAR_TYPE) if (type == PAR_TYPE)
{ {
if (position > -1) if (position > -1)
{ {
indexcurrentFormula = position; IndexcurrentComponent = position;
MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula == position MathmodRef->LocalScene.IndexCurrentFormula == position
? MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula = -1 ? MathmodRef->LocalScene.IndexCurrentFormula = -1
: MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula = : MathmodRef->LocalScene.IndexCurrentFormula = position;
position;
// currentFormula = sparent; // currentFormula = sparent;
ui.paramNameEdit->setText(currentstruct.Component.at(position)); ui.paramNameEdit->setText(currentstruct.Component.at(position));
ui.XEdit->setText(currentstruct.fx.at(position)); ui.XEdit->setText(currentstruct.fx.at(position));
ui.YEdit->setText(currentstruct.fy.at(position)); ui.YEdit->setText(currentstruct.fy.at(position));
ui.ZEdit->setText(currentstruct.fz.at(position)); ui.ZEdit->setText(currentstruct.fz.at(position));
ui.umin->setText(currentstruct.umin.at(position)); ui.umin->setText(currentstruct.umin.at(position));
ui.vmin->setText(currentstruct.vmin.at(position)); ui.vmin->setText(currentstruct.vmin.at(position));
ui.umax->setText(currentstruct.umax.at(position)); ui.umax->setText(currentstruct.umax.at(position));
ui.vmax->setText(currentstruct.vmax.at(position)); ui.vmax->setText(currentstruct.vmax.at(position));
if (!currentstruct.Component.empty()) if (!currentstruct.Component.empty())
ui.paramNameEdit->setText(currentstruct.Component.at(position)); ui.paramNameEdit->setText(currentstruct.Component.at(position));
else else
ui.paramNameEdit->setText(""); ui.paramNameEdit->setText("");
if (!currentstruct.Cnd.empty()) if (!currentstruct.Cnd.empty())
{ {
ui.CndUpdateEdit_2->setText(currentstruct.Cnd.at(position)); ui.CndUpdateEdit_2->setText(currentstruct.Cnd.at(position));
} }
else else
{ {
ui.CndUpdateEdit_2->setText(""); ui.CndUpdateEdit_2->setText("");
} }
// Function: // Function:
if (!currentstruct.Funct.empty()) if (!currentstruct.Funct.empty())
{ {
ui.tableWidget_Fct_2->clearContents(); ui.tableWidget_Fct_2->clearContents();
ui.tableWidget_Fct_2->setRowCount(0); ui.tableWidget_Fct_2->setRowCount(0);
for (int i = 0; i < currentstruct.Funct.size(); i++) for (int i = 0; i < currentstruct.Funct.size(); i++)
{ {
ui.tableWidget_Fct_2->setRowCount(i + 1); ui.tableWidget_Fct_2->setRowCount(i + 1);
ui.tableWidget_Fct_2->setItem(i, 0, new QTableWidgetItem(cur rentstruct.Funct.at(i))); ui.tableWidget_Fct_2->setItem(i, 0, new QTableWidgetItem(cur rentstruct.Funct.at(i)));
} }
} }
else else
{ {
ui.tableWidget_Fct_2->clearContents(); ui.tableWidget_Fct_2->clearContents();
ui.tableWidget_Fct_2->setRowCount(0); ui.tableWidget_Fct_2->setRowCount(0);
} }
// Constantes: // Constantes:
if (!currentstruct.Const.empty()) if (!currentstruct.Const.empty())
{ {
ui.tableWidget_Cst_2->clearContents(); ui.tableWidget_Cst_2->clearContents();
ui.tableWidget_Cst_2->setRowCount(0); ui.tableWidget_Cst_2->setRowCount(0);
for (int i = 0; i < currentstruct.Const.size(); i++) for (int i = 0; i < currentstruct.Const.size(); i++)
{ {
ui.tableWidget_Cst_2->setRowCount(i + 1); ui.tableWidget_Cst_2->setRowCount(i + 1);
ui.tableWidget_Cst_2->setItem(i, 0, new QTableWidgetItem(cur rentstruct.Const.at(i))); ui.tableWidget_Cst_2->setItem(i, 0, new QTableWidgetItem(cur rentstruct.Const.at(i)));
} }
} }
else else
{ {
ui.tableWidget_Cst_2->clearContents(); ui.tableWidget_Cst_2->clearContents();
ui.tableWidget_Cst_2->setRowCount(0); ui.tableWidget_Cst_2->setRowCount(0);
} }
} }
ui.stackedProperties->setCurrentIndex(2); ui.stackedProperties->setCurrentIndex(2);
} }
if (type == PAR_4D_TYPE) if (type == PAR_4D_TYPE)
{ {
if (position > -1) if (position > -1)
{ {
indexcurrentFormula = position; IndexcurrentComponent = position;
MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula == position MathmodRef->LocalScene.IndexCurrentFormula == position
? MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula = -1 ? MathmodRef->LocalScene.IndexCurrentFormula = -1
: MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula = : MathmodRef->LocalScene.IndexCurrentFormula = position;
position;
// currentFormula = sparent; // currentFormula = sparent;
ui.paramNameEdit_2->setText(currentstruct.Component.at(position)); ui.paramNameEdit_2->setText(currentstruct.Component.at(position));
ui.XEdit_2->setText(currentstruct.fx.at(position)); ui.XEdit_2->setText(currentstruct.fx.at(position));
ui.YEdit_2->setText(currentstruct.fy.at(position)); ui.YEdit_2->setText(currentstruct.fy.at(position));
ui.ZEdit_2->setText(currentstruct.fz.at(position)); ui.ZEdit_2->setText(currentstruct.fz.at(position));
ui.WEdit_2->setText(currentstruct.fw.at(position)); ui.WEdit_2->setText(currentstruct.fw.at(position));
ui.umin_2->setText(currentstruct.umin.at(position)); ui.umin_2->setText(currentstruct.umin.at(position));
ui.vmin_2->setText(currentstruct.vmin.at(position)); ui.vmin_2->setText(currentstruct.vmin.at(position));
ui.umax_2->setText(currentstruct.umax.at(position)); ui.umax_2->setText(currentstruct.umax.at(position));
ui.vmax_2->setText(currentstruct.vmax.at(position)); ui.vmax_2->setText(currentstruct.vmax.at(position));
if (!currentstruct.Component.empty()) if (!currentstruct.Component.empty())
ui.paramNameEdit_2->setText(currentstruct.Component.at(position) ); ui.paramNameEdit_2->setText(currentstruct.Component.at(position) );
else else
ui.paramNameEdit_2->setText(""); ui.paramNameEdit_2->setText("");
} }
ui.stackedProperties->setCurrentIndex(3); ui.stackedProperties->setCurrentIndex(3);
} }
if (type == ISO_TYPE) if (type == ISO_TYPE)
{ {
if (position > -1) if (position > -1)
{ {
indexcurrentFormula = position; IndexcurrentComponent = position;
MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula == position MathmodRef->LocalScene.IndexCurrentFormula == position
? MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula = -1 ? MathmodRef->LocalScene.IndexCurrentFormula = -1
: MathmodRef->ui.glWidget->LocalScene.IndexCurrentFormula = : MathmodRef->LocalScene.IndexCurrentFormula = position;
position;
ui.UpdateEdit->setText(currentstruct.fxyz.at(position)); ui.UpdateEdit->setText(currentstruct.fxyz.at(position));
ui.xmin->setText(currentstruct.xmin.at(position)); ui.xmin->setText(currentstruct.xmin.at(position));
ui.ymin->setText(currentstruct.ymin.at(position)); ui.ymin->setText(currentstruct.ymin.at(position));
ui.zmin->setText(currentstruct.zmin.at(position)); ui.zmin->setText(currentstruct.zmin.at(position));
ui.xmax->setText(currentstruct.xmax.at(position)); ui.xmax->setText(currentstruct.xmax.at(position));
ui.ymax->setText(currentstruct.ymax.at(position)); ui.ymax->setText(currentstruct.ymax.at(position));
ui.zmax->setText(currentstruct.zmax.at(position)); ui.zmax->setText(currentstruct.zmax.at(position));
if (!currentstruct.Component.empty()) if (!currentstruct.Component.empty())
ui.isoNameEdit->setText(currentstruct.Component.at(position)); ui.isoNameEdit->setText(currentstruct.Component.at(position));
else else
ui.isoNameEdit->setText(""); ui.isoNameEdit->setText("");
if (!currentstruct.Cnd.empty()) if (!currentstruct.Cnd.empty())
{ {
position < currentstruct.Cnd.size() position < currentstruct.Cnd.size()
? ui.CndUpdateEdit->setText(currentstruct.Cnd.at(position)) ? ui.CndUpdateEdit->setText(currentstruct.Cnd.at(position))
: ui.CndUpdateEdit->setText(currentstruct.Cnd.at(0)); : ui.CndUpdateEdit->setText(currentstruct.Cnd.at(0));
} }
else else
{ {
ui.CndUpdateEdit->setText(""); ui.CndUpdateEdit->setText("");
} }
// Function: // Function:
if (!currentstruct.Funct.empty()) if (!currentstruct.Funct.empty())
{ {
ui.tableWidget_Fct->clearContents(); ui.tableWidget_Fct->clearContents();
ui.tableWidget_Fct->setRowCount(0); ui.tableWidget_Fct->setRowCount(0);
for (int i = 0; i < currentstruct.Funct.size(); i++) for (int i = 0; i < currentstruct.Funct.size(); i++)
{ {
ui.tableWidget_Fct->setRowCount(i + 1); ui.tableWidget_Fct->setRowCount(i + 1);
ui.tableWidget_Fct->setItem(i, 0, new QTableWidgetItem(curre ntstruct.Funct.at(i))); ui.tableWidget_Fct->setItem(i, 0, new QTableWidgetItem(curre ntstruct.Funct.at(i)));
} }
} }
else else
{ {
ui.tableWidget_Fct->clearContents(); ui.tableWidget_Fct->clearContents();
ui.tableWidget_Fct->setRowCount(0); ui.tableWidget_Fct->setRowCount(0);
} }
// Constantes: // Constantes:
if (!currentstruct.Const.empty()) if (!currentstruct.Const.empty())
{ {
ui.tableWidget_Cst->clearContents(); ui.tableWidget_Cst->clearContents();
ui.tableWidget_Cst->setRowCount(0); ui.tableWidget_Cst->setRowCount(0);
for (int i = 0; i < currentstruct.Const.size(); i++) for (int i = 0; i < currentstruct.Const.size(); i++)
{ {
ui.tableWidget_Cst->setRowCount(i + 1); ui.tableWidget_Cst->setRowCount(i + 1);
ui.tableWidget_Cst->setItem(i, 0, new QTableWidgetItem(curre ntstruct.Const.at(i))); ui.tableWidget_Cst->setItem(i, 0, new QTableWidgetItem(curre ntstruct.Const.at(i)));
} }
} }
else else
{ {
ui.tableWidget_Cst->clearContents(); ui.tableWidget_Cst->clearContents();
ui.tableWidget_Cst->setRowCount(0); ui.tableWidget_Cst->setRowCount(0);
} }
} }
ui.stackedProperties->setCurrentIndex(1); ui.stackedProperties->setCurrentIndex(1);
} }
} }
void DrawingOptions::oncolor_2activated(int index) void DrawingOptions::oncolor_2activated(int index)
{ {
MathmodRef->ui.glWidget->colorstype(index); MathmodRef->colorstype(index);
} }
void DrawingOptions::onred_2valueChanged(int value) void DrawingOptions::onred_2valueChanged(int value)
{ {
MathmodRef->ui.glWidget->red(value, indexcurrentFormula); MathmodRef->red(value, IndexcurrentComponent);
} }
void DrawingOptions::ongreen_2valueChanged(int value) void DrawingOptions::ongreen_2valueChanged(int value)
{ {
MathmodRef->ui.glWidget->green(value, indexcurrentFormula); MathmodRef->green(value, IndexcurrentComponent);
} }
void DrawingOptions::onblue_2valueChanged(int value) void DrawingOptions::onblue_2valueChanged(int value)
{ {
MathmodRef->ui.glWidget->blue(value, indexcurrentFormula); MathmodRef->blue(value, IndexcurrentComponent);
}
void DrawingOptions::ontransparent_2valueChanged(int value)
{
MathmodRef->ui.glWidget->transparency(value, indexcurrentFormula);
}
void DrawingOptions::ontransparence_2clicked(bool checked)
{
MathmodRef->ui.glWidget->transparence(checked);
} }
void DrawingOptions::on_red_ParIso_valueChanged(int value) void DrawingOptions::on_red_ParIso_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->red(value, indexcurrentFormula); MathmodRef->red(value, IndexcurrentComponent);
} }
void DrawingOptions::on_green_ParIso_valueChanged(int value) void DrawingOptions::on_green_ParIso_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->green(value, indexcurrentFormula); MathmodRef->green(value, IndexcurrentComponent);
} }
void DrawingOptions::on_blue_ParIso_valueChanged(int value) void DrawingOptions::on_blue_ParIso_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->blue(value, indexcurrentFormula); MathmodRef->blue(value, IndexcurrentComponent);
} }
void DrawingOptions::removeat(int idx, QJsonObject& QObj, QString str) void DrawingOptions::removeat(int idx, QJsonObject& QObj, QString str)
{ {
QJsonArray array; QJsonArray array;
array = QObj[str].toArray(); array = QObj[str].toArray();
array.removeAt(idx); array.removeAt(idx);
QObj[str] = array; QObj[str] = array;
} }
skipping to change at line 3368 skipping to change at line 3239
{ {
QJsonArray array; QJsonArray array;
array = QObj[str].toArray(); array = QObj[str].toArray();
array.append(text->toPlainText()); array.append(text->toPlainText());
QObj[str] = array; QObj[str] = array;
} }
void DrawingOptions::on_updateJObject(QJsonObject &copyCurrentObject) void DrawingOptions::on_updateJObject(QJsonObject &copyCurrentObject)
{ {
QJsonArray array; QJsonArray array;
if (copyCurrentObject["Iso3D"].isObject()) if (copyCurrentObject["Iso3D"].isObject())
{ {
if (indexcurrentFormula != -1) if (IndexcurrentComponent != -1)
{ {
QJsonObject copyCurrentObject2 = copyCurrentObject["Iso3D"].toObject (); QJsonObject copyCurrentObject2 = copyCurrentObject["Iso3D"].toObject ();
// Cut the component at the index indexcurrentFormula : // Cut the component at the index indexcurrentFormula :
if ((ui.isoNameEdit->toPlainText()).replace(" ", "") == "") if ((ui.isoNameEdit->toPlainText()).replace(" ", "") == "")
{ {
for(uint ui=0; ui<MandatoryIsosurfaceFields.size(); ui++) for(uint ui=0; ui<MandatoryIsosurfaceFields.size(); ui++)
removeat(indexcurrentFormula, copyCurrentObject2, MandatoryI sosurfaceFields[ui]); removeat(IndexcurrentComponent, copyCurrentObject2, Mandator yIsosurfaceFields[ui]);
removeat2(indexcurrentFormula, copyCurrentObject2, "Grid"); removeat2(IndexcurrentComponent, copyCurrentObject2, "Grid");
removeat2(indexcurrentFormula, copyCurrentObject2, "Cnd"); removeat2(IndexcurrentComponent, copyCurrentObject2, "Cnd");
appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct); appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct);
appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst); appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst);
// Some keys cleaning.. // Some keys cleaning..
copyCurrentObject2.remove("Param3D"); copyCurrentObject2.remove("Param3D");
copyCurrentObject2.remove("Param4D"); copyCurrentObject2.remove("Param4D");
copyCurrentObject["Iso3D"] = copyCurrentObject2; copyCurrentObject["Iso3D"] = copyCurrentObject2;
} }
// Update the component at the index indexcurrentFormula; // Update the component at the index indexcurrentFormula;
else if ((copyCurrentObject["Iso3D"].toObject())["Component"].toArra y().size() > 0 && else if ((copyCurrentObject["Iso3D"].toObject())["Component"].toArra y().size() > 0 &&
indexcurrentFormula > -1 && indexcurrentFormula < IndexcurrentComponent > -1 && IndexcurrentComponent <
(copyCurrentObject["Iso3D"].toObject())["Component"].toArra y().size() && (copyCurrentObject["Iso3D"].toObject())["Component"].toArra y().size() &&
(((copyCurrentObject["Iso3D"].toObject())["Component"].toAr ray())[indexcurrentFormula]).toString().replace(" ", "") == (((copyCurrentObject["Iso3D"].toObject())["Component"].toAr ray())[IndexcurrentComponent]).toString().replace(" ", "") ==
(ui.isoNameEdit->toPlainText()).replace(" ", "")) (ui.isoNameEdit->toPlainText()).replace(" ", ""))
{ {
replaceat(indexcurrentFormula, copyCurrentObject2, "Fxyz", ui.Up replaceat(IndexcurrentComponent, copyCurrentObject2, "Fxyz", ui.
dateEdit); UpdateEdit);
replaceat(indexcurrentFormula, copyCurrentObject2, "Xmin", ui.xm replaceat(IndexcurrentComponent, copyCurrentObject2, "Xmin", ui.
in); xmin);
replaceat(indexcurrentFormula, copyCurrentObject2, "Xmax", ui.xm replaceat(IndexcurrentComponent, copyCurrentObject2, "Xmax", ui.
ax); xmax);
replaceat(indexcurrentFormula, copyCurrentObject2, "Ymin", ui.ym replaceat(IndexcurrentComponent, copyCurrentObject2, "Ymin", ui.
in); ymin);
replaceat(indexcurrentFormula, copyCurrentObject2, "Ymax", ui.ym replaceat(IndexcurrentComponent, copyCurrentObject2, "Ymax", ui.
ax); ymax);
replaceat(indexcurrentFormula, copyCurrentObject2, "Zmin", ui.zm replaceat(IndexcurrentComponent, copyCurrentObject2, "Zmin", ui.
in); zmin);
replaceat(indexcurrentFormula, copyCurrentObject2, "Zmax", ui.zm replaceat(IndexcurrentComponent, copyCurrentObject2, "Zmax", ui.
ax); zmax);
appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct); appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct);
appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst); appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst);
copyCurrentObject2.remove("Param3D"); copyCurrentObject2.remove("Param3D");
copyCurrentObject2.remove("Param4D"); copyCurrentObject2.remove("Param4D");
copyCurrentObject["Iso3D"] = copyCurrentObject2; copyCurrentObject["Iso3D"] = copyCurrentObject2;
} }
else else
{ {
// Add new component: // Add new component:
if ((((copyCurrentObject["Iso3D"].toObject())["Component"].toArr ay())[indexcurrentFormula]).toString().replace(" ", "") != if ((((copyCurrentObject["Iso3D"].toObject())["Component"].toArr ay())[IndexcurrentComponent]).toString().replace(" ", "") !=
(ui.isoNameEdit->toPlainText()).replace(" ", "")) (ui.isoNameEdit->toPlainText()).replace(" ", ""))
{ {
appednew(copyCurrentObject2, "Component", ui.isoNameEdit); appednew(copyCurrentObject2, "Component", ui.isoNameEdit);
appednew(copyCurrentObject2, "Fxyz", ui.UpdateEdit); appednew(copyCurrentObject2, "Fxyz", ui.UpdateEdit);
appednew(copyCurrentObject2, "Xmin", ui.xmin); appednew(copyCurrentObject2, "Xmin", ui.xmin);
appednew(copyCurrentObject2, "Xmax", ui.xmax); appednew(copyCurrentObject2, "Xmax", ui.xmax);
appednew(copyCurrentObject2, "Ymin", ui.ymin); appednew(copyCurrentObject2, "Ymin", ui.ymin);
appednew(copyCurrentObject2, "Ymax", ui.ymax); appednew(copyCurrentObject2, "Ymax", ui.ymax);
appednew(copyCurrentObject2, "Zmin", ui.zmin); appednew(copyCurrentObject2, "Zmin", ui.zmin);
appednew(copyCurrentObject2, "Zmax", ui.zmax); appednew(copyCurrentObject2, "Zmax", ui.zmax);
skipping to change at line 3453 skipping to change at line 3323
{ {
array = copyCurrentObject2["Grid"].toArray(); array = copyCurrentObject2["Grid"].toArray();
array.append(QString::number(ui.xyzg->value())); array.append(QString::number(ui.xyzg->value()));
copyCurrentObject2["Grid"] = array; copyCurrentObject2["Grid"] = array;
} }
else else
copyCurrentObject2.remove("Grid"); copyCurrentObject2.remove("Grid");
} }
else else
{ {
insertat(indexcurrentFormula, copyCurrentObject2, "Fxyz", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Fxyz",
.UpdateEdit); ui.UpdateEdit);
insertat(indexcurrentFormula, copyCurrentObject2, "Xmin", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Xmin",
.xmin); ui.xmin);
insertat(indexcurrentFormula, copyCurrentObject2, "Xmax", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Xmax",
.xmax); ui.xmax);
insertat(indexcurrentFormula, copyCurrentObject2, "Ymin", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Ymin",
.ymin); ui.ymin);
insertat(indexcurrentFormula, copyCurrentObject2, "Ymax", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Ymax",
.ymax); ui.ymax);
insertat(indexcurrentFormula, copyCurrentObject2, "Zmin", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Zmin",
.zmin); ui.zmin);
insertat(indexcurrentFormula, copyCurrentObject2, "Zmax", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Zmax",
.zmax); ui.zmax);
if (copyCurrentObject2["Cnd"].isArray()) if (copyCurrentObject2["Cnd"].isArray())
{ {
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
array.insert(indexcurrentFormula, ui.CndUpdateEdit->toPl ainText()); array.insert(IndexcurrentComponent, ui.CndUpdateEdit->to PlainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
} }
else if (ui.CndUpdateEdit->toPlainText() != "") else if (ui.CndUpdateEdit->toPlainText() != "")
{ {
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
for (int i = 0; i < copyCurrentObject2["Fxyz"].toArray() .count(); for (int i = 0; i < copyCurrentObject2["Fxyz"].toArray() .count();
i++) i++)
array.append(ui.CndUpdateEdit->toPlainText()); array.append(ui.CndUpdateEdit->toPlainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
} }
skipping to change at line 3490 skipping to change at line 3360
appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst); appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst);
copyCurrentObject["Iso3D"] = copyCurrentObject2; copyCurrentObject["Iso3D"] = copyCurrentObject2;
} }
} }
} }
else if (copyCurrentObject["Param3D"].isObject()) else if (copyCurrentObject["Param3D"].isObject())
{ {
copyCurrentObject.remove("Iso3D"); copyCurrentObject.remove("Iso3D");
QJsonObject copyCurrentObject2 = copyCurrentObject["Param3D"].toObject() ; QJsonObject copyCurrentObject2 = copyCurrentObject["Param3D"].toObject() ;
if (indexcurrentFormula != -1) if (IndexcurrentComponent != -1)
{ {
if ((ui.paramNameEdit->toPlainText()).replace(" ", "") == "") if ((ui.paramNameEdit->toPlainText()).replace(" ", "") == "")
{ {
for(uint ui=0; ui<MandatoryParmetric3DFields.size(); ui++) for(uint ui=0; ui<MandatoryParmetric3DFields.size(); ui++)
removeat(indexcurrentFormula, copyCurrentObject2, MandatoryP removeat(IndexcurrentComponent, copyCurrentObject2, Mandator
armetric3DFields[ui]); yParmetric3DFields[ui]);
removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
removeat2(indexcurrentFormula, copyCurrentObject2, "Grid"); removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
removeat2(indexcurrentFormula, copyCurrentObject2, "Cnd"); removeat2(IndexcurrentComponent, copyCurrentObject2, "Cnd");
appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct_2); appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct_2);
appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst_2); appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst_2);
// Some keys cleaning.. // Some keys cleaning..
copyCurrentObject2.remove("Iso3D"); copyCurrentObject2.remove("Iso3D");
copyCurrentObject2.remove("Param4D"); copyCurrentObject2.remove("Param4D");
copyCurrentObject["Param3D"] = copyCurrentObject2; copyCurrentObject["Param3D"] = copyCurrentObject2;
} }
else if (((copyCurrentObject["Param3D"].toObject())["Component"].toA rray()).count() > 0 && else if (((copyCurrentObject["Param3D"].toObject())["Component"].toA rray()).count() > 0 &&
indexcurrentFormula > -1 && indexcurrentFormula < IndexcurrentComponent > -1 && IndexcurrentComponent <
((copyCurrentObject["Param3D"].toObject())["Component"].toA rray()).size() && ((copyCurrentObject["Param3D"].toObject())["Component"].toA rray()).size() &&
((copyCurrentObject["Param3D"].toObject())["Component"].toA rray())[indexcurrentFormula].toString().replace(" ", "") == ((copyCurrentObject["Param3D"].toObject())["Component"].toA rray())[IndexcurrentComponent].toString().replace(" ", "") ==
(ui.paramNameEdit->toPlainText()).replace(" ", "")) (ui.paramNameEdit->toPlainText()).replace(" ", ""))
{ {
replaceat(indexcurrentFormula, copyCurrentObject2, "Fx", ui.XEdi replaceat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui.XE
t); dit);
replaceat(indexcurrentFormula, copyCurrentObject2, "Fy", ui.YEdi replaceat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui.YE
t); dit);
replaceat(indexcurrentFormula, copyCurrentObject2, "Fz", ui.ZEdi replaceat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui.ZE
t); dit);
replaceat(indexcurrentFormula, copyCurrentObject2, "Umin", ui.um replaceat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui.
in); umin);
replaceat(indexcurrentFormula, copyCurrentObject2, "Umax", ui.um replaceat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui.
ax); umax);
replaceat(indexcurrentFormula, copyCurrentObject2, "Vmin", ui.vm replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui.
in); vmin);
replaceat(indexcurrentFormula, copyCurrentObject2, "Vmax", ui.vm replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui.
ax); vmax);
appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct_2); appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct_2);
appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst_2); appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst_2);
if (copyCurrentObject2["Cnd"].isArray() && if (copyCurrentObject2["Cnd"].isArray() &&
copyCurrentObject2["Cnd"].toArray().count() > indexcurre ntFormula) copyCurrentObject2["Cnd"].toArray().count() > Indexcurre ntComponent)
{ {
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
array.replace(indexcurrentFormula, ui.CndUpdateEdit_2->toPla inText()); array.replace(IndexcurrentComponent, ui.CndUpdateEdit_2->toP lainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
} }
else if (ui.CndUpdateEdit_2->toPlainText() != "") else if (ui.CndUpdateEdit_2->toPlainText() != "")
{ {
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
for (int i = 0; i < copyCurrentObject2["Fx"].toArray().count (); i++) for (int i = 0; i < copyCurrentObject2["Fx"].toArray().count (); i++)
array.append(ui.CndUpdateEdit_2->toPlainText()); array.append(ui.CndUpdateEdit_2->toPlainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
} }
else else
copyCurrentObject2.remove("Cnd"); copyCurrentObject2.remove("Cnd");
/****************/
copyCurrentObject["Param3D"] = copyCurrentObject2; copyCurrentObject["Param3D"] = copyCurrentObject2;
} }
else else
{ {
if (((copyCurrentObject["Param3D"].toObject())["Component"].toAr ray())[indexcurrentFormula].toString().replace(" ", "") != if (((copyCurrentObject["Param3D"].toObject())["Component"].toAr ray())[IndexcurrentComponent].toString().replace(" ", "") !=
(ui.paramNameEdit->toPlainText()).replace(" ", "")) (ui.paramNameEdit->toPlainText()).replace(" ", ""))
{ {
appednew(copyCurrentObject2, "Component", ui.paramNameEdit); appednew(copyCurrentObject2, "Component", ui.paramNameEdit);
appednew(copyCurrentObject2, "Fx", ui.XEdit); appednew(copyCurrentObject2, "Fx", ui.XEdit);
appednew(copyCurrentObject2, "Fy", ui.YEdit); appednew(copyCurrentObject2, "Fy", ui.YEdit);
appednew(copyCurrentObject2, "Fz", ui.ZEdit); appednew(copyCurrentObject2, "Fz", ui.ZEdit);
appednew(copyCurrentObject2, "Umin", ui.umin); appednew(copyCurrentObject2, "Umin", ui.umin);
appednew(copyCurrentObject2, "Umax", ui.umax); appednew(copyCurrentObject2, "Umax", ui.umax);
appednew(copyCurrentObject2, "Vmin", ui.vmin); appednew(copyCurrentObject2, "Vmin", ui.vmin);
appednew(copyCurrentObject2, "Vmax", ui.vmax); appednew(copyCurrentObject2, "Vmax", ui.vmax);
if (copyCurrentObject2["Grid"].isArray()) if (copyCurrentObject2["Grid"].isArray())
{ {
array = copyCurrentObject2["Grid"].toArray(); array = copyCurrentObject2["Grid"].toArray();
array.append(QString::number(ui.linecolumn_2->value())); int pos=2*IndexcurrentComponent;
array.append((array.at(pos).toString()));
array.append((array.at(pos+1).toString()));
copyCurrentObject2["Grid"] = array; copyCurrentObject2["Grid"] = array;
} }
else else
copyCurrentObject2.remove("Grid"); copyCurrentObject2.remove("Grid");
if (copyCurrentObject2["Cnd"].isArray()) if (copyCurrentObject2["Cnd"].isArray())
{ {
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
array.append(ui.CndUpdateEdit_2->toPlainText()); array.append(ui.CndUpdateEdit_2->toPlainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
skipping to change at line 3585 skipping to change at line 3451
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
for (int i = 0; i < copyCurrentObject2["Fx"].toArray().c ount(); i++) for (int i = 0; i < copyCurrentObject2["Fx"].toArray().c ount(); i++)
array.append(ui.CndUpdateEdit_2->toPlainText()); array.append(ui.CndUpdateEdit_2->toPlainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
} }
else else
copyCurrentObject2.remove("Cnd"); copyCurrentObject2.remove("Cnd");
} }
else else
{ {
insertat(indexcurrentFormula, copyCurrentObject2, "Fx", ui.X insertat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui
Edit); .XEdit);
insertat(indexcurrentFormula, copyCurrentObject2, "Fy", ui.Y insertat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui
Edit); .YEdit);
insertat(indexcurrentFormula, copyCurrentObject2, "Fz", ui.Z insertat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui
Edit); .ZEdit);
insertat(indexcurrentFormula, copyCurrentObject2, "Umin", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Umin",
.umin); ui.umin);
insertat(indexcurrentFormula, copyCurrentObject2, "Umax", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Umax",
.umax); ui.umax);
insertat(indexcurrentFormula, copyCurrentObject2, "Vmin", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Vmin",
.vmin); ui.vmin);
insertat(indexcurrentFormula, copyCurrentObject2, "Vmax", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Vmax",
.vmax); ui.vmax);
array = copyCurrentObject2["Component"].toArray(); array = copyCurrentObject2["Component"].toArray();
array.insert(indexcurrentFormula, ui.paramNameEdit->toPlainT ext()); array.insert(IndexcurrentComponent, ui.paramNameEdit->toPlai nText());
copyCurrentObject2["Component"] = array; copyCurrentObject2["Component"] = array;
if (copyCurrentObject2["Cnd"].isArray()) if (copyCurrentObject2["Cnd"].isArray())
{ {
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
array.append(ui.CndUpdateEdit_2->toPlainText()); array.append(ui.CndUpdateEdit_2->toPlainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
} }
else if (ui.CndUpdateEdit_2->toPlainText() != "") else if (ui.CndUpdateEdit_2->toPlainText() != "")
{ {
array = copyCurrentObject2["Cnd"].toArray(); array = copyCurrentObject2["Cnd"].toArray();
for (int i = 0; i < copyCurrentObject2["Fx"].toArray().c ount(); i++) for (int i = 0; i < copyCurrentObject2["Fx"].toArray().c ount(); i++)
array.append(ui.CndUpdateEdit_2->toPlainText()); array.append(ui.CndUpdateEdit_2->toPlainText());
copyCurrentObject2["Cnd"] = array; copyCurrentObject2["Cnd"] = array;
} }
else else
copyCurrentObject2.remove("Cnd"); copyCurrentObject2.remove("Cnd");
} }
appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct_2); appendall(copyCurrentObject2, "Funct", ui.tableWidget_Fct_2);
appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst_2); appendall(copyCurrentObject2, "Const", ui.tableWidget_Cst_2);
copyCurrentObject["Param3D"] = copyCurrentObject2; copyCurrentObject["Param3D"] = copyCurrentObject2;
} }
} }
} }
else if (copyCurrentObject["Param4D"].isObject()) else if (copyCurrentObject["Param4D"].isObject())
{ {
copyCurrentObject.remove("Iso3D"); copyCurrentObject.remove("Iso3D");
copyCurrentObject.remove("Param3D"); copyCurrentObject.remove("Param3D");
QJsonObject copyCurrentObject2 = copyCurrentObject["Param4D"].toObject() ; QJsonObject copyCurrentObject2 = copyCurrentObject["Param4D"].toObject() ;
if (indexcurrentFormula != -1) if (IndexcurrentComponent != -1)
{ {
if ((ui.paramNameEdit_2->toPlainText()).replace(" ", "") == "") if ((ui.paramNameEdit_2->toPlainText()).replace(" ", "") == "")
{ {
for(uint ui=0; ui<MandatoryParmetric4DFields.size(); ui++) for(uint ui=0; ui<MandatoryParmetric4DFields.size(); ui++)
removeat(indexcurrentFormula, copyCurrentObject2, MandatoryP removeat(IndexcurrentComponent, copyCurrentObject2, Mandator
armetric4DFields[ui]); yParmetric4DFields[ui]);
removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
removeat2(indexcurrentFormula, copyCurrentObject2, "Grid"); removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
copyCurrentObject["Param4D"] = copyCurrentObject2; copyCurrentObject["Param4D"] = copyCurrentObject2;
} }
else if (((copyCurrentObject["Param4D"].toObject())["Component"].toA rray()).count() > 0 && else if (((copyCurrentObject["Param4D"].toObject())["Component"].toA rray()).count() > 0 &&
indexcurrentFormula > -1 && indexcurrentFormula <((copyCurr IndexcurrentComponent > -1 && IndexcurrentComponent <((copy
entObject["Param4D"].toObject())["Component"].toArray()).size() && CurrentObject["Param4D"].toObject())["Component"].toArray()).size() &&
((copyCurrentObject["Param4D"].toObject())["Component"].toA ((copyCurrentObject["Param4D"].toObject())["Component"].toA
rray())[indexcurrentFormula].toString().replace(" ", "") ==(ui.paramNameEdit_2-> rray())[IndexcurrentComponent].toString().replace(" ", "") ==(ui.paramNameEdit_2
toPlainText()).replace(" ", "")) ->toPlainText()).replace(" ", ""))
{ {
replaceat(indexcurrentFormula, copyCurrentObject2, "Fx", ui.XEdi replaceat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui.XE
t_2); dit_2);
replaceat(indexcurrentFormula, copyCurrentObject2, "Fy", ui.YEdi replaceat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui.YE
t_2); dit_2);
replaceat(indexcurrentFormula, copyCurrentObject2, "Fz", ui.ZEdi replaceat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui.ZE
t_2); dit_2);
replaceat(indexcurrentFormula, copyCurrentObject2, "Fw", ui.WEdi replaceat(IndexcurrentComponent, copyCurrentObject2, "Fw", ui.WE
t_2); dit_2);
replaceat(indexcurrentFormula, copyCurrentObject2, "Umin", ui.um replaceat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui.
in_2); umin_2);
replaceat(indexcurrentFormula, copyCurrentObject2, "Umax", ui.um replaceat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui.
ax_2); umax_2);
replaceat(indexcurrentFormula, copyCurrentObject2, "Vmin", ui.vm replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui.
in_2); vmin_2);
replaceat(indexcurrentFormula, copyCurrentObject2, "Vmax", ui.vm replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui.
ax_2); vmax_2);
copyCurrentObject["Param4D"] = copyCurrentObject2; copyCurrentObject["Param4D"] = copyCurrentObject2;
} }
else else
{ {
if (((copyCurrentObject["Param4D"].toObject())["Component"].toAr ray())[indexcurrentFormula].toString().replace(" ", "") != if (((copyCurrentObject["Param4D"].toObject())["Component"].toAr ray())[IndexcurrentComponent].toString().replace(" ", "") !=
(ui.paramNameEdit_2->toPlainText()).replace(" ", "")) (ui.paramNameEdit_2->toPlainText()).replace(" ", ""))
{ {
appednew(copyCurrentObject2, "Component", ui.paramNameEdit_2 ); appednew(copyCurrentObject2, "Component", ui.paramNameEdit_2 );
appednew(copyCurrentObject2, "Fx", ui.XEdit_2); appednew(copyCurrentObject2, "Fx", ui.XEdit_2);
appednew(copyCurrentObject2, "Fy", ui.YEdit_2); appednew(copyCurrentObject2, "Fy", ui.YEdit_2);
appednew(copyCurrentObject2, "Fz", ui.ZEdit_2); appednew(copyCurrentObject2, "Fz", ui.ZEdit_2);
appednew(copyCurrentObject2, "Fw", ui.WEdit_2); appednew(copyCurrentObject2, "Fw", ui.WEdit_2);
appednew(copyCurrentObject2, "Umin", ui.umin_2); appednew(copyCurrentObject2, "Umin", ui.umin_2);
appednew(copyCurrentObject2, "Umax", ui.umax_2); appednew(copyCurrentObject2, "Umax", ui.umax_2);
appednew(copyCurrentObject2, "Vmin", ui.vmin_2); appednew(copyCurrentObject2, "Vmin", ui.vmin_2);
appednew(copyCurrentObject2, "Vmax", ui.vmax_2); appednew(copyCurrentObject2, "Vmax", ui.vmax_2);
if (copyCurrentObject2["Grid"].isArray()) if (copyCurrentObject2["Grid"].isArray())
{ {
array = copyCurrentObject2["Grid"].toArray(); array = copyCurrentObject2["Grid"].toArray();
array.append(QString::number(ui.linecolumn_2->value())); int pos=2*IndexcurrentComponent;
array.append((array.at(pos).toString()));
array.append((array.at(pos+1).toString()));
copyCurrentObject2["Grid"] = array; copyCurrentObject2["Grid"] = array;
} }
else else
copyCurrentObject2.remove("Grid"); copyCurrentObject2.remove("Grid");
copyCurrentObject["Param4D"] = copyCurrentObject2; copyCurrentObject["Param4D"] = copyCurrentObject2;
} }
else else
{ {
insertat(indexcurrentFormula, copyCurrentObject2, "Component insertat(IndexcurrentComponent, copyCurrentObject2, "Compone
", ui.paramNameEdit_2); nt", ui.paramNameEdit_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Fx", ui.X insertat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui
Edit_2); .XEdit_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Fy", ui.Y insertat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui
Edit_2); .YEdit_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Fz", ui.Z insertat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui
Edit_2); .ZEdit_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Fw", ui.W insertat(IndexcurrentComponent, copyCurrentObject2, "Fw", ui
Edit_2); .WEdit_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Umin", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Umin",
.umin_2); ui.umin_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Umax", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Umax",
.umax_2); ui.umax_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Vmin", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Vmin",
.vmin_2); ui.vmin_2);
insertat(indexcurrentFormula, copyCurrentObject2, "Vmax", ui insertat(IndexcurrentComponent, copyCurrentObject2, "Vmax",
.vmax_2); ui.vmax_2);
copyCurrentObject["Param4D"] = copyCurrentObject2; copyCurrentObject["Param4D"] = copyCurrentObject2;
} }
} }
} }
} }
} }
void DrawingOptions::RunUpdatedJObject(QJsonObject &CurrentObject) void DrawingOptions::RunUpdatedJObject(QJsonObject &CurrentObject)
{ {
if (indexcurrentFormula != -1) if (IndexcurrentComponent != -1)
{ {
if (CurrentObject["Iso3D"].isObject()) if (CurrentObject["Iso3D"].isObject())
{ {
CurrentObject.remove("Param3D"); CurrentObject.remove("Param3D");
CurrentObject.remove("Param4D"); CurrentObject.remove("Param4D");
CurrentObject.remove("ParIso"); CurrentObject.remove("ParIso");
DrawJsonModel(CurrentObject); DrawJsonModel(CurrentObject);
} }
else if (CurrentObject["Param3D"].isObject()) else if (CurrentObject["Param3D"].isObject())
{ {
skipping to change at line 3766 skipping to change at line 3628
{ {
parisoComponent = listeParObj[0].toObject(); parisoComponent = listeParObj[0].toObject();
on_updateJObject(parisoComponent); on_updateJObject(parisoComponent);
QJsonArray newlisteObj; QJsonArray newlisteObj;
newlisteObj.append(parisoComponent); newlisteObj.append(parisoComponent);
if (listeIsoObj.size() > 0) if (listeIsoObj.size() > 0)
newlisteObj.append(listeIsoObj[0].toObject()); newlisteObj.append(listeIsoObj[0].toObject());
CurrentObject["ParIso"] = newlisteObj; CurrentObject["ParIso"] = newlisteObj;
RunUpdatedJObject(CurrentObject); RunUpdatedJObject(CurrentObject);
} }
} }
else else
{ {
CurrentObject.remove("ParIso"); CurrentObject.remove("ParIso");
on_updateJObject(CurrentObject); on_updateJObject(CurrentObject);
RunUpdatedJObject(CurrentObject); RunUpdatedJObject(CurrentObject);
} }
} }
void DrawingOptions::on_updateParam_clicked() void DrawingOptions::on_updateParam_clicked()
{ {
on_updateButton_clicked(); on_updateButton_clicked();
} }
void DrawingOptions::on_actionPolygonWavefront_obj_triggered() void DrawingOptions::on_actionPolygonWavefront_obj_triggered()
{ {
MathmodRef->ui.glWidget->SaveSceneAsObjPoly(); MathmodRef->SaveSceneAsObjPoly();
} }
void DrawingOptions::on_actionColorPolygonWavefront_obj_triggered() void DrawingOptions::on_actionColorPolygonWavefront_obj_triggered()
{ {
MathmodRef->ui.glWidget->SaveSceneAsObjPoly(1); MathmodRef->SaveSceneAsObjPoly(1);
} }
void DrawingOptions::on_linecolumn_2_valueChanged(int value) void DrawingOptions::on_linecolumn_2_valueChanged(int value)
{ {
ui.ParamgroupBox_2->setTitle("Grid(u,v)/MaxGrid = (" + QString::number(value ) + ui.ParamgroupBox_2->setTitle("Grid(u,v)/MaxGrid = (" + QString::number(value ) +
", " + QString::number(value) +") / "+QString:: number(Parameters->ParMaxGrid)); ", " + QString::number(value) +") / "+QString:: number(Parameters->ParMaxGrid));
if (!MathmodRef->ui.glWidget->ParObjet->isRunning()) if (!MathmodRef->ParObjet->isRunning())
{ {
(MathmodRef->RootObjet.CurrentJsonObject["ParIso"].isArray()) ? (MathmodRef->RootObjet.CurrentJsonObject["ParIso"].isArray()) ?
MathmodRef->linecolumn_valueChanged(value, PARISO_TYPE) : MathmodRef->li necolumn_valueChanged(value, PAR_TYPE); MathmodRef->linecolumn_valueChanged(value, PARISO_TYPE) : MathmodRef->li necolumn_valueChanged(value, PAR_TYPE);
} }
else else
{ {
ui.uv->blockSignals(true); ui.uv->blockSignals(true);
ui.uv->setChecked(false); ui.uv->setChecked(false);
ui.uv->blockSignals(false); ui.uv->blockSignals(false);
MathmodRef->uvactivated = -1; MathmodRef->uvactivated = -1;
} }
} }
void DrawingOptions::on_lineScrollBar_valueChanged(int value) void DrawingOptions::on_lineScrollBar_valueChanged(int value)
{ {
ui.ParamgroupBox_2->setTitle( ui.ParamgroupBox_2->setTitle(
"Grid(u,v)/MaxGrid = (" + QString::number(value) + ", " + "Grid(u,v)/MaxGrid = (" + QString::number(value) + ", " +
QString::number(MathmodRef->ui.glWidget->ParObjet->Ugrid) +") / "+QStrin QString::number(MathmodRef->ParObjet->Ugrid) +") / "+QString::number(Par
g::number(Parameters->ParMaxGrid)); ameters->ParMaxGrid));
if (!MathmodRef->ui.glWidget->ParObjet->isRunning()) if (!MathmodRef->ParObjet->isRunning())
{ {
MathmodRef->line_valueChanged(value); MathmodRef->line_valueChanged(value);
} }
else else
{ {
ui.uv->blockSignals(true); ui.uv->blockSignals(true);
ui.uv->setChecked(false); ui.uv->setChecked(false);
ui.uv->blockSignals(false); ui.uv->blockSignals(false);
MathmodRef->uvactivated = -1; MathmodRef->uvactivated = -1;
} }
} }
void DrawingOptions::on_coloneScrollBar_valueChanged(int value) void DrawingOptions::on_coloneScrollBar_valueChanged(int value)
{ {
ui.ParamgroupBox_2->setTitle( ui.ParamgroupBox_2->setTitle(
"Param Grid(u,v)/MaxGrid = (" + "Param Grid(u,v)/MaxGrid = (" +
QString::number(MathmodRef->ui.glWidget->ParObjet->Vgrid) + ", " + QString::number(MathmodRef->ParObjet->Vgrid) + ", " +
QString::number(value) +") / "+QString::number(Parameters->ParMaxGrid)); QString::number(value) +") / "+QString::number(Parameters->ParMaxGrid));
if (!MathmodRef->ui.glWidget->ParObjet->isRunning()) if (!MathmodRef->ParObjet->isRunning())
{ {
MathmodRef->column_valueChanged(value); MathmodRef->column_valueChanged(value);
} }
else else
{ {
ui.uv->blockSignals(true); ui.uv->blockSignals(true);
ui.uv->setChecked(false); ui.uv->setChecked(false);
ui.uv->blockSignals(false); ui.uv->blockSignals(false);
MathmodRef->uvactivated = -1; MathmodRef->uvactivated = -1;
} }
} }
void DrawingOptions::on_IsoComponent_activated(int index) void DrawingOptions::on_IsoComponent_activated(int index)
{ {
UpdateDescription(index, ISO_TYPE, MathmodRef->RootObjet.CurrentTreestruct); UpdateDescription(index, ISO_TYPE, MathmodRef->RootObjet.CurrentTreestruct);
updateShowIsoCmp(index);
}
void DrawingOptions::updateShowParComp(int index)
{
if(MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[index])
{
ui.ShowParComp->setChecked(true);
ui.ShowParComp->setText("Hide");
}
else
{
ui.ShowParComp->setChecked(false);
ui.ShowParComp->setText("Show");
}
}
void DrawingOptions::updateShowIsoCmp(int index)
{
uint idx=0;
if(!MathmodRef->LocalScene.componentsinfos.pariso)
idx = index;
else
idx = MathmodRef->LocalScene.componentsinfos.NbComponentsType[0]+index;
if(MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[idx])
{
ui.ShowIsoComp->setChecked(true);
ui.ShowIsoComp->setText("Hide");
}
else
{
ui.ShowIsoComp->setChecked(false);
ui.ShowIsoComp->setText("Show");
}
} }
void DrawingOptions::on_ParamComponent_activated(int index) void DrawingOptions::on_ParamComponent_activated(int index)
{ {
UpdateDescription(index, PAR_TYPE, MathmodRef->RootObjet.CurrentTreestruct); UpdateDescription(index, PAR_TYPE, MathmodRef->RootObjet.CurrentTreestruct);
updateShowParComp(index);
} }
void DrawingOptions::on_xyzcheckBox2_clicked() void DrawingOptions::on_xyzcheckBox2_clicked()
{ {
MathmodRef->ui.glWidget->LocalScene.animxyz *= -1; MathmodRef->LocalScene.animxyz *= -1;
} }
void DrawingOptions::on_xycheckBox2_clicked() void DrawingOptions::on_xycheckBox2_clicked()
{ {
MathmodRef->ui.glWidget->LocalScene.animx *= -1; MathmodRef->LocalScene.animx *= -1;
} }
void DrawingOptions::on_xyhorizontalScrollBar2_valueChanged(int value) void DrawingOptions::on_xyhorizontalScrollBar2_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->LocalScene.animxValueStep = float(value) / 4; MathmodRef->LocalScene.animxValueStep = float(value) / 4;
} }
void DrawingOptions::on_xzcheckBox2_clicked() void DrawingOptions::on_xzcheckBox2_clicked()
{ {
MathmodRef->ui.glWidget->LocalScene.animy *= -1; MathmodRef->LocalScene.animy *= -1;
} }
void DrawingOptions::on_xzhorizontalScrollBar2_valueChanged(int value) void DrawingOptions::on_xzhorizontalScrollBar2_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->LocalScene.animyValueStep = float(value) / 4; MathmodRef->LocalScene.animyValueStep = float(value) / 4;
} }
void DrawingOptions::on_yzcheckBox2_clicked() void DrawingOptions::on_yzcheckBox2_clicked()
{ {
MathmodRef->ui.glWidget->LocalScene.animz *= -1; MathmodRef->LocalScene.animz *= -1;
} }
void DrawingOptions::on_yzhorizontalScrollBar2_valueChanged(int value) void DrawingOptions::on_yzhorizontalScrollBar2_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->LocalScene.animzValueStep = float(value) / 4; MathmodRef->LocalScene.animzValueStep = float(value) / 4;
} }
void DrawingOptions::on_InitMatrix_2_clicked() void DrawingOptions::on_InitMatrix_2_clicked()
{ {
MathmodRef->ui.glWidget->LocalScene.RotStrength = MathmodRef->LocalScene.RotStrength =
MathmodRef->ui.glWidget->LocalScene.animxValueStep = MathmodRef->LocalScene.animxValueStep =
MathmodRef->ui.glWidget->LocalScene.animyValueStep = MathmodRef->LocalScene.animyValueStep =
MathmodRef->ui.glWidget->LocalScene.animzValueStep = 0.0; MathmodRef->LocalScene.animzValueStep = 0.0;
} }
void DrawingOptions::on_xycheckBox_clicked() void DrawingOptions::on_xycheckBox_clicked()
{ {
MathmodRef->ui.glWidget->ParObjet->tetaxy_ok *= -1; MathmodRef->ParObjet->tetaxy_ok *= -1;
} }
void DrawingOptions::on_xyhorizontalScrollBar_valueChanged(int value) void DrawingOptions::on_xyhorizontalScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->ParObjet->tetaxy = value / 4.0; MathmodRef->ParObjet->tetaxy = value / 4.0;
} }
void DrawingOptions::on_xzcheckBox_clicked() void DrawingOptions::on_xzcheckBox_clicked()
{ {
MathmodRef->ui.glWidget->ParObjet->tetaxz_ok *= -1; MathmodRef->ParObjet->tetaxz_ok *= -1;
} }
void DrawingOptions::on_xzhorizontalScrollBar_valueChanged(int value) void DrawingOptions::on_xzhorizontalScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->ParObjet->tetaxz = value / 4.0; MathmodRef->ParObjet->tetaxz = value / 4.0;
} }
void DrawingOptions::on_yzcheckBox_clicked() void DrawingOptions::on_yzcheckBox_clicked()
{ {
MathmodRef->ui.glWidget->ParObjet->tetayz_ok *= -1; MathmodRef->ParObjet->tetayz_ok *= -1;
} }
void DrawingOptions::on_yzhorizontalScrollBar_valueChanged(int value) void DrawingOptions::on_yzhorizontalScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->ParObjet->tetayz = value / 4.0; MathmodRef->ParObjet->tetayz = value / 4.0;
} }
void DrawingOptions::on_xwcheckBox_clicked() void DrawingOptions::on_xwcheckBox_clicked()
{ {
MathmodRef->ui.glWidget->ParObjet->tetaxw_ok *= -1; MathmodRef->ParObjet->tetaxw_ok *= -1;
} }
void DrawingOptions::on_xwhorizontalScrollBar_valueChanged(int value) void DrawingOptions::on_xwhorizontalScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->ParObjet->tetaxw = value / 4.0; MathmodRef->ParObjet->tetaxw = value / 4.0;
} }
void DrawingOptions::on_ywcheckBox_clicked() void DrawingOptions::on_ywcheckBox_clicked()
{ {
MathmodRef->ui.glWidget->ParObjet->tetayw_ok *= -1; MathmodRef->ParObjet->tetayw_ok *= -1;
} }
void DrawingOptions::on_ywhorizontalScrollBar_valueChanged(int value) void DrawingOptions::on_ywhorizontalScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->ParObjet->tetayw = value / 4.0; MathmodRef->ParObjet->tetayw = value / 4.0;
} }
void DrawingOptions::on_zwcheckBox_clicked() void DrawingOptions::on_zwcheckBox_clicked()
{ {
MathmodRef->ui.glWidget->ParObjet->tetazw_ok *= -1; MathmodRef->ParObjet->tetazw_ok *= -1;
} }
void DrawingOptions::on_zwhorizontalScrollBar_valueChanged(int value) void DrawingOptions::on_zwhorizontalScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->ParObjet->tetazw = value / 4.0; MathmodRef->ParObjet->tetazw = value / 4.0;
} }
void DrawingOptions::on_linecolumn_3_valueChanged(int value) void DrawingOptions::on_linecolumn_3_valueChanged(int value)
{ {
ui.ParamgroupBox_3->setTitle("Grid(u,v)/MaxGrid = (" + QString::number(value ) + ui.ParamgroupBox_3->setTitle("Grid(u,v)/MaxGrid = (" + QString::number(value ) +
", " + QString::number(value) +") / "+QString:: number(Parameters->ParMaxGrid)); ", " + QString::number(value) +") / "+QString:: number(Parameters->ParMaxGrid));
if (!MathmodRef->ui.glWidget->ParObjet->isRunning()) if (!MathmodRef->ParObjet->isRunning())
{ {
MathmodRef->linecolumn_valueChanged_2(value); MathmodRef->linecolumn_valueChanged_2(value);
} }
else else
{ {
ui.uv4D->blockSignals(true); ui.uv4D->blockSignals(true);
ui.uv4D->setChecked(false); ui.uv4D->setChecked(false);
ui.uv4D->blockSignals(false); ui.uv4D->blockSignals(false);
MathmodRef->uvactivated4D = -1; MathmodRef->uvactivated4D = -1;
} }
} }
void DrawingOptions::oncolor_4activated(int index) void DrawingOptions::oncolor_4activated(int index)
{ {
MathmodRef->ui.glWidget->colorstypeParam(index); MathmodRef->colorstypeParam(index);
}
void DrawingOptions::ontransparence_4toggled(bool checked)
{
MathmodRef->ui.glWidget->transparence(checked);
} }
void DrawingOptions::on_uv4D_clicked() void DrawingOptions::on_uv4D_clicked()
{ {
MathmodRef->slot_uv4D_clicked(); MathmodRef->slot_uv4D_clicked();
} }
void DrawingOptions::on_uv_clicked() void DrawingOptions::on_uv_clicked()
{ {
(MathmodRef->RootObjet.CurrentJsonObject["ParIso"].isArray()) ? (MathmodRef->RootObjet.CurrentJsonObject["ParIso"].isArray()) ?
MathmodRef->slot_uv_clicked(PARISO_TYPE) : MathmodRef->slot_uv_clicked(PAR_T YPE); MathmodRef->slot_uv_clicked(PARISO_TYPE) : MathmodRef->slot_uv_clicked(PAR_T YPE);
} }
void DrawingOptions::on_InitMatrix_clicked() void DrawingOptions::on_InitMatrix_clicked()
{ {
MathmodRef->ui.glWidget->ParObjet->mat4D.unit(); MathmodRef->ParObjet->mat4D.unit();
on_calculate_clicked(); on_calculate_clicked();
} }
void DrawingOptions::on_ActivateCND_clicked(bool checked) void DrawingOptions::on_ActivateCND_clicked(bool checked)
{ {
ui.CNDgroupBox->setEnabled(checked); ui.CNDgroupBox->setEnabled(checked);
MathmodRef->ui.glWidget->LocalScene.activarecnd = checked; MathmodRef->LocalScene.activarecnd = checked;
MathmodRef->ui.glWidget->update(); MathmodRef->update();
} }
void DrawingOptions::on_TCNDcheckBox_clicked(bool checked) void DrawingOptions::on_TCNDcheckBox_clicked(bool checked)
{ {
MathmodRef->ui.glWidget->LocalScene.cndoptions[3] = checked; MathmodRef->LocalScene.cndoptions[3] = checked;
MathmodRef->ui.glWidget->update(); MathmodRef->update();
} }
void DrawingOptions::on_FCNDcheckBox_clicked(bool checked) void DrawingOptions::on_FCNDcheckBox_clicked(bool checked)
{ {
MathmodRef->ui.glWidget->LocalScene.cndoptions[0] = checked; MathmodRef->LocalScene.cndoptions[0] = checked;
MathmodRef->ui.glWidget->update(); MathmodRef->update();
} }
void DrawingOptions::on_TNCNDcheckBox_clicked(bool checked) void DrawingOptions::on_TNCNDcheckBox_clicked(bool checked)
{ {
MathmodRef->ui.glWidget->LocalScene.cndoptions[4] = checked; MathmodRef->LocalScene.cndoptions[4] = checked;
MathmodRef->ui.glWidget->update(); MathmodRef->update();
} }
void DrawingOptions::on_FNCNDcheckBox_clicked(bool checked) void DrawingOptions::on_FNCNDcheckBox_clicked(bool checked)
{ {
MathmodRef->ui.glWidget->LocalScene.cndoptions[1] = checked; MathmodRef->LocalScene.cndoptions[1] = checked;
MathmodRef->ui.glWidget->update(); MathmodRef->update();
} }
void DrawingOptions::on_TBordercheckBox_clicked(bool checked) void DrawingOptions::on_TBordercheckBox_clicked(bool checked)
{ {
MathmodRef->ui.glWidget->LocalScene.cndoptions[2] = checked; MathmodRef->LocalScene.cndoptions[2] = checked;
MathmodRef->ui.glWidget->update(); MathmodRef->update();
} }
void DrawingOptions::on_actionMesh_triggered() void DrawingOptions::on_actionMesh_triggered()
{ {
MathmodRef->Mesh(); MathmodRef->Mesh();
} }
void DrawingOptions::on_calculate_clicked() void DrawingOptions::on_calculate_clicked()
{ {
on_InitTButton_clicked(); on_InitTButton_clicked();
skipping to change at line 4076 skipping to change at line 3964
void DrawingOptions::on_actionEditor_triggered() void DrawingOptions::on_actionEditor_triggered()
{ {
editorwin(); editorwin();
} }
void DrawingOptions::on_actionColors_triggered() void DrawingOptions::on_actionColors_triggered()
{ {
colorsoptions(); colorsoptions();
} }
void DrawingOptions::on_actionSmooth_2_clicked()
{
MathmodRef->smoothline();
}
void DrawingOptions::on_Infos_clicked() void DrawingOptions::on_Infos_clicked()
{ {
MathmodRef->iso_infos(); MathmodRef->iso_infos();
} }
void DrawingOptions::on_Mesh_clicked() void DrawingOptions::on_Mesh_clicked()
{ {
MathmodRef->Mesh(); MathmodRef->Mesh();
} }
skipping to change at line 4168 skipping to change at line 4051
void DrawingOptions::Multiplier(int x, int y, int z, QJsonObject &iso, void DrawingOptions::Multiplier(int x, int y, int z, QJsonObject &iso,
int index) int index)
{ {
QString Minx, Miny, Minz, Maxx, Maxy, Maxz; QString Minx, Miny, Minz, Maxx, Maxy, Maxz;
QString Difx, Dify, Difz; QString Difx, Dify, Difz;
QString componentName, fct, cnd, grid; QString componentName, fct, cnd, grid;
QJsonArray oldminx, oldminy, oldminz, oldmaxx, oldmaxy, oldmaxz, oldcmpname, QJsonArray oldminx, oldminy, oldminz, oldmaxx, oldmaxy, oldmaxz, oldcmpname,
oldfxyz, oldcnd, oldgrid; oldfxyz, oldcnd, oldgrid;
bool cndb = false; bool cndb = false;
bool gridb = false; bool gridb = false;
oldminx = iso["Iso3D"].toObject()["Xmin"].toArray(); oldminx = iso["Iso3D"].toObject()["Xmin"].toArray();
oldminy = iso["Iso3D"].toObject()["Ymin"].toArray(); oldminy = iso["Iso3D"].toObject()["Ymin"].toArray();
oldminz = iso["Iso3D"].toObject()["Zmin"].toArray(); oldminz = iso["Iso3D"].toObject()["Zmin"].toArray();
oldmaxx = iso["Iso3D"].toObject()["Xmax"].toArray(); oldmaxx = iso["Iso3D"].toObject()["Xmax"].toArray();
oldmaxy = iso["Iso3D"].toObject()["Ymax"].toArray(); oldmaxy = iso["Iso3D"].toObject()["Ymax"].toArray();
oldmaxz = iso["Iso3D"].toObject()["Zmax"].toArray(); oldmaxz = iso["Iso3D"].toObject()["Zmax"].toArray();
oldcmpname = iso["Iso3D"].toObject()["Component"].toArray(); oldcmpname = iso["Iso3D"].toObject()["Component"].toArray();
oldfxyz = iso["Iso3D"].toObject()["Fxyz"].toArray(); oldfxyz = iso["Iso3D"].toObject()["Fxyz"].toArray();
if ((gridb = (iso["Iso3D"].toObject()["Grid"].isArray()))) if ((gridb = (iso["Iso3D"].toObject()["Grid"].isArray())))
grid = grid =
(oldgrid = iso["Iso3D"].toObject()["Grid"].toArray())[index].toStrin g(); (oldgrid = iso["Iso3D"].toObject()["Grid"].toArray())[index].toStrin g();
if ((cndb = (iso["Iso3D"].toObject()["Cnd"].isArray()))) if ((cndb = (iso["Iso3D"].toObject()["Cnd"].isArray())))
cnd = (oldcnd = iso["Iso3D"].toObject()["Cnd"].toArray())[index].toStrin g(); cnd = (oldcnd = iso["Iso3D"].toObject()["Cnd"].toArray())[index].toStrin g();
componentName = oldcmpname[index].toString(); componentName = oldcmpname[index].toString();
fct = oldfxyz[index].toString(); fct = oldfxyz[index].toString();
Minx = "(" + oldminx[index].toString() + ")"; Minx = "(" + oldminx[index].toString() + ")";
Miny = "(" + oldminy[index].toString() + ")"; Miny = "(" + oldminy[index].toString() + ")";
Minz = "(" + oldminz[index].toString() + ")"; Minz = "(" + oldminz[index].toString() + ")";
Maxx = "(" + oldmaxx[index].toString() + ")"; Maxx = "(" + oldmaxx[index].toString() + ")";
Maxy = "(" + oldmaxy[index].toString() + ")"; Maxy = "(" + oldmaxy[index].toString() + ")";
Maxz = "(" + oldmaxz[index].toString() + ")"; Maxz = "(" + oldmaxz[index].toString() + ")";
Difx = "((" + Maxx + "-" + Minx + ")/" + QString::number(x) + ")"; Difx = "((" + Maxx + "-" + Minx + ")/" + QString::number(x) + ")";
Dify = "((" + Maxy + "-" + Miny + ")/" + QString::number(y) + ")"; Dify = "((" + Maxy + "-" + Miny + ")/" + QString::number(y) + ")";
Difz = "((" + Maxz + "-" + Minz + ")/" + QString::number(z) + ")"; Difz = "((" + Maxz + "-" + Minz + ")/" + QString::number(z) + ")";
int l = 0; int l = 0;
for (int i = 0; i < x; i++) for (int i = 0; i < x; i++)
for (int j = 0; j < y; j++) for (int j = 0; j < y; j++)
for (int k = 0; k < z; k++) for (int k = 0; k < z; k++)
{ {
oldminx.append(Minx + "+" + QString::number(i) + "*" + Difx); oldminx.append(Minx + "+" + QString::number(i) + "*" + Difx);
oldmaxx.append(Minx + "+" + QString::number(i + 1) + "*" + Difx) ; oldmaxx.append(Minx + "+" + QString::number(i + 1) + "*" + Difx) ;
oldminy.append(Miny + "+" + QString::number(j) + "*" + Dify); oldminy.append(Miny + "+" + QString::number(j) + "*" + Dify);
oldmaxy.append(Miny + "+" + QString::number(j + 1) + "*" + Dify) ; oldmaxy.append(Miny + "+" + QString::number(j + 1) + "*" + Dify) ;
oldminz.append(Minz + "+" + QString::number(k) + "*" + Difz); oldminz.append(Minz + "+" + QString::number(k) + "*" + Difz);
oldmaxz.append(Minz + "+" + QString::number(k + 1) + "*" + Difz) ; oldmaxz.append(Minz + "+" + QString::number(k + 1) + "*" + Difz) ;
oldcmpname.append(componentName + QString::number(l)); oldcmpname.append(componentName + QString::number(l));
oldfxyz.append(fct); oldfxyz.append(fct);
if (cndb) if (cndb)
oldcnd.append(cnd); oldcnd.append(cnd);
if (gridb) if (gridb)
oldgrid.append(grid); oldgrid.append(grid);
l++; l++;
} }
oldminx.removeAt(index); oldminx.removeAt(index);
oldminy.removeAt(index); oldminy.removeAt(index);
oldminz.removeAt(index); oldminz.removeAt(index);
oldmaxx.removeAt(index); oldmaxx.removeAt(index);
oldmaxy.removeAt(index); oldmaxy.removeAt(index);
oldmaxz.removeAt(index); oldmaxz.removeAt(index);
oldcmpname.removeAt(index); oldcmpname.removeAt(index);
oldfxyz.removeAt(index); oldfxyz.removeAt(index);
if (cndb) if (cndb)
oldcnd.removeAt(index); oldcnd.removeAt(index);
if (gridb) if (gridb)
oldgrid.removeAt(index); oldgrid.removeAt(index);
QJsonObject tmp = iso["Iso3D"].toObject(); QJsonObject tmp = iso["Iso3D"].toObject();
tmp["Xmin"] = oldminx; tmp["Xmin"] = oldminx;
tmp["Ymin"] = oldminy; tmp["Ymin"] = oldminy;
tmp["Zmin"] = oldminz; tmp["Zmin"] = oldminz;
tmp["Xmax"] = oldmaxx; tmp["Xmax"] = oldmaxx;
tmp["Ymax"] = oldmaxy; tmp["Ymax"] = oldmaxy;
tmp["Zmax"] = oldmaxz; tmp["Zmax"] = oldmaxz;
tmp["Component"] = oldcmpname; tmp["Component"] = oldcmpname;
tmp["Fxyz"] = oldfxyz; tmp["Fxyz"] = oldfxyz;
if (cndb) if (cndb)
skipping to change at line 4271 skipping to change at line 4132
void DrawingOptions::on_Multiplier_clicked() void DrawingOptions::on_Multiplier_clicked()
{ {
int i = ui.xcomboBox->currentIndex(), j = ui.ycomboBox->currentIndex(), int i = ui.xcomboBox->currentIndex(), j = ui.ycomboBox->currentIndex(),
k = ui.zcomboBox->currentIndex(); k = ui.zcomboBox->currentIndex();
if (i > 0 && j > 0 && k > 0) if (i > 0 && j > 0 && k > 0)
{ {
QJsonObject copyCurrentObject = MathmodRef->RootObjet.CurrentJsonObject; QJsonObject copyCurrentObject = MathmodRef->RootObjet.CurrentJsonObject;
// Erase unused Keys: // Erase unused Keys:
copyCurrentObject.remove("Param3D"); copyCurrentObject.remove("Param3D");
copyCurrentObject.remove("Param4D"); copyCurrentObject.remove("Param4D");
Multiplier(i, j, k, copyCurrentObject, IndexcurrentComponent);
Multiplier(i, j, k, copyCurrentObject, indexcurrentFormula);
// Draw here // Draw here
DrawJsonModel(copyCurrentObject); DrawJsonModel(copyCurrentObject);
} }
// Init Combo // Init Combo
ui.xcomboBox->setCurrentIndex(0); ui.xcomboBox->setCurrentIndex(0);
ui.ycomboBox->setCurrentIndex(0); ui.ycomboBox->setCurrentIndex(0);
ui.zcomboBox->setCurrentIndex(0); ui.zcomboBox->setCurrentIndex(0);
} }
void DrawingOptions::UpdateGuiMaxgrid() void DrawingOptions::UpdateGuiMaxgrid()
{ {
int maxgrd = int(Parameters->IsoMaxGrid); int maxgrd = int(Parameters->IsoMaxGrid);
ui.xyzg->blockSignals(true); ui.xyzg->blockSignals(true);
ui.xyzg->setMaximum(maxgrd); ui.xyzg->setMaximum(maxgrd);
ui.xyzg->setValue(int(Parameters->InitIsoGrid)); ui.xyzg->setValue(int(Parameters->InitIsoGrid));
ui.xyzg->blockSignals(false); ui.xyzg->blockSignals(false);
ui.linecolumn_2->blockSignals(true); ui.linecolumn_2->blockSignals(true);
ui.linecolumn_2->setMaximum(int(Parameters->ParMaxGrid)); ui.linecolumn_2->setMaximum(int(Parameters->ParMaxGrid));
ui.linecolumn_2->setValue(int(Parameters->InitParGrid)); ui.linecolumn_2->setValue(int(Parameters->InitParGrid));
ui.linecolumn_2->blockSignals(false); ui.linecolumn_2->blockSignals(false);
ui.linecolumn_3->blockSignals(true); ui.linecolumn_3->blockSignals(true);
ui.linecolumn_3->setMaximum(int(Parameters->ParMaxGrid)); ui.linecolumn_3->setMaximum(int(Parameters->ParMaxGrid));
ui.linecolumn_3->setValue(int(Parameters->InitParGrid)); ui.linecolumn_3->setValue(int(Parameters->InitParGrid));
ui.linecolumn_3->blockSignals(false); ui.linecolumn_3->blockSignals(false);
} }
void DrawingOptions::UpdateGui(int argc) void DrawingOptions::UpdateGui(int argc)
{ {
UpdateGuiMaxgrid(); UpdateGuiMaxgrid();
ListeModelTexture LstModelTexture = (Parameters->LoadCollectionModels( ListeModelTexture LstModelTexture = (Parameters->LoadCollectionModels(
JSONMathModels, MathmodRef->collection, argc)); JSONMathModels, MathmodRef->collection, argc));
// Load the script containing isosurface and parametric formulas: // Load the script containing isosurface and parametric formulas:
ui.choice->insertItems(0, LstModelTexture.listeModels); ui.choice->insertItems(0, LstModelTexture.listeModels);
ui.comboBoxTexture->insertItems(0, LstModelTexture.listeTextures); ui.comboBoxTexture->insertItems(0, LstModelTexture.listeTextures);
ui.comboBoxPigment->insertItems(0, LstModelTexture.listePigments); ui.comboBoxPigment->insertItems(0, LstModelTexture.listePigments);
AddListModels(); AddListModels();
// Threads setting: // Threads setting:
SetThreadValues(Parameters->Threads); SetThreadValues(Parameters->Threads);
// OpenGl specular: // OpenGl specular:
SetSpecularValues(Parameters->Specular); SetSpecularValues(Parameters->Specular);
// OpenGl shininess: // OpenGl shininess:
SetShininessValue(Parameters->Shininess); SetShininessValue(Parameters->Shininess);
// OpenGl diffuse:
SetDiffuseValues(Parameters->Diffuse);
// OpenGl Ambient:
SetAmbientValues(Parameters->Ambient);
// Show the two windows of the application: // Show the two windows of the application:
move(Parameters->ControlX, Parameters->ControlY); move(Parameters->ControlX, Parameters->ControlY);
resize(Parameters->ControlW, Parameters->ControlH); resize(Parameters->ControlW, Parameters->ControlH);
// ui.CndGroupBox->hide(); // ui.CndGroupBox->hide();
// ui.NameLabel->hide(); // ui.NameLabel->hide();
MathmodRef->move(Parameters->GlwinX, Parameters->GlwinY); MathmodRef->move(Parameters->GlwinX, Parameters->GlwinY);
MathmodRef->resize(Parameters->GlwinW, Parameters->GlwinH); MathmodRef->resize(Parameters->GlwinW, Parameters->GlwinH);
//MathmodRef->setFixedSize(Parameters->GlwinW, Parameters->GlwinH);
// Pigment/texture // Pigment/texture
ui.textureEdit->hide(); ui.textureEdit->hide();
// Hide all sliders // Hide all sliders
HideSliders(); HideSliders();
// ProgressBar + text informations (set to minimum size 0) // ProgressBar + text informations (set to minimum size 0)
QList<int> Sizes; QList<int> Sizes;
Sizes << 500 << 300; Sizes << 500 << 300;
ui.splitter_6->setSizes(Sizes); ui.splitter_6->setSizes(Sizes);
ui.Messagetext->setFontPointSize(10); ui.Messagetext->setFontPointSize(10);
} }
void DrawingOptions::on_TimeStepScrollBar_valueChanged(int value) void DrawingOptions::on_TimeStepScrollBar_valueChanged(int value)
{ {
double P = 1.0 / double(value); double P = 1.0 / double(value);
uint maxnbthreads = MathmodRef->ui.glWidget->IsoObjet->WorkerThreadsNumber; uint maxnbthreads = MathmodRef->IsoObjet->WorkerThreadsNumber;
ui.label_5->setText("1/" + QString::number(value)); ui.label_5->setText("1/" + QString::number(value));
MathmodRef->IsoObjet->masterthread->pace = P;
MathmodRef->ui.glWidget->IsoObjet->masterthread->pace = P;
for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++) for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++)
MathmodRef->ui.glWidget->IsoObjet->workerthreads[nbthreds].pace = P; MathmodRef->IsoObjet->workerthreads[nbthreds].pace = P;
MathmodRef->ParObjet->masterthread->pace = P;
MathmodRef->ui.glWidget->ParObjet->masterthread->pace = P;
for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++) for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++)
MathmodRef->ui.glWidget->ParObjet->workerthreads[nbthreds].pace = P; MathmodRef->ParObjet->workerthreads[nbthreds].pace = P;
} }
void DrawingOptions::on_InitTButton_clicked() void DrawingOptions::on_InitTButton_clicked()
{ {
uint maxnbthreads = MathmodRef->ui.glWidget->IsoObjet->WorkerThreadsNumber; uint maxnbthreads = MathmodRef->IsoObjet->WorkerThreadsNumber;
MathmodRef->IsoObjet->masterthread->stepMorph = 0;
MathmodRef->ui.glWidget->IsoObjet->masterthread->stepMorph = 0;
for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++) for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++)
MathmodRef->ui.glWidget->IsoObjet->workerthreads[nbthreds].stepMorph = 0 MathmodRef->IsoObjet->workerthreads[nbthreds].stepMorph = 0;
; MathmodRef->ParObjet->masterthread->stepMorph = 0;
MathmodRef->ui.glWidget->ParObjet->masterthread->stepMorph = 0;
for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++) for (uint nbthreds = 0; nbthreds < maxnbthreads - 1; nbthreds++)
MathmodRef->ui.glWidget->ParObjet->workerthreads[nbthreds].stepMorph = 0 ; MathmodRef->ParObjet->workerthreads[nbthreds].stepMorph = 0;
} }
void DrawingOptions::ShowErrorMessage(QJsonParseError &err, QString &script) void DrawingOptions::ShowErrorMessage(QJsonParseError &err, QString &script)
{ {
QString sortie; QString sortie;
QMessageBox message; QMessageBox message;
message.setWindowTitle("Error at : "); message.setWindowTitle("Error at : ");
sortie = (script); sortie = (script);
int before, after; int before, after;
if (sortie.length() > (err.offset + 30)) if (sortie.length() > (err.offset + 30))
after = 30; after = 30;
else else
after = sortie.length() - err.offset; after = sortie.length() - err.offset;
sortie.truncate(err.offset + after); sortie.truncate(err.offset + after);
if (err.offset - 30 > 0) if (err.offset - 30 > 0)
before = 30; before = 30;
skipping to change at line 4437 skipping to change at line 4294
} }
void DrawingOptions::on_pushButton_4_clicked() void DrawingOptions::on_pushButton_4_clicked()
{ {
ui.paramNameEdit->setText(ui.paramNameEdit->toPlainText() + "_01"); ui.paramNameEdit->setText(ui.paramNameEdit->toPlainText() + "_01");
on_updateButton_clicked(); on_updateButton_clicked();
} }
void DrawingOptions::on_color_5_activated(int index) void DrawingOptions::on_color_5_activated(int index)
{ {
MathmodRef->ui.glWidget->colorstypeParIso(index); MathmodRef->colorstypeParIso(index);
}
void DrawingOptions::on_transparence_ParIso_clicked(bool checked)
{
MathmodRef->ui.glWidget->transparence(checked);
} }
void DrawingOptions::on_transparent_ParIso_valueChanged(int value) void DrawingOptions::on_transparent_ParIso_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->transparency(value, indexcurrentFormula); MathmodRef->transparency(value, IndexcurrentComponent);
} }
void DrawingOptions::on_comboBoxTexture_activated(int index) void DrawingOptions::on_comboBoxTexture_activated(int index)
{ {
QJsonObject tmp; QJsonObject tmp;
tmp = MathmodRef->RootObjet.CurrentJsonObject; tmp = MathmodRef->RootObjet.CurrentJsonObject;
if (index > 0) if (index > 0)
{ {
QJsonDocument document; QJsonDocument document;
skipping to change at line 4481 skipping to change at line 4333
QJsonDocument document; QJsonDocument document;
document.setObject(MathmodRef->collection.JPigments[index - 1].toObject( )); document.setObject(MathmodRef->collection.JPigments[index - 1].toObject( ));
ui.textureEdit->setText(QString(document.toJson())); ui.textureEdit->setText(QString(document.toJson()));
DrawJsonModel(tmp, 1000 + index - 1); DrawJsonModel(tmp, 1000 + index - 1);
} }
return; return;
} }
void DrawingOptions::on_actionTrianglesWavefront_obj_triggered() void DrawingOptions::on_actionTrianglesWavefront_obj_triggered()
{ {
MathmodRef->ui.glWidget->SaveSceneAsObjTrian(); MathmodRef->SaveSceneAsObjTrian();
} }
void DrawingOptions::on_actionColorTrianglesWavefront_obj_triggered() void DrawingOptions::on_actionColorTrianglesWavefront_obj_triggered()
{ {
MathmodRef->ui.glWidget->SaveSceneAsObjTrian(1); MathmodRef->SaveSceneAsObjTrian(1);
}
void DrawingOptions::on_OctavesScrollBar_valueChanged(int value)
{
int Octaves =
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[0].Octaves =
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[1].Octaves =
value;
MathmodRef->ui.glWidget->IsoObjet->masterthread->Octaves = Octaves;
MathmodRef->ui.glWidget->ParObjet->masterthread->Octaves = Octaves;
ui.OctavesLabel->setText("Octaves = " + QString::number(Octaves));
on_pushButton_5_clicked();
}
void DrawingOptions::on_LacunarityScrollBar_valueChanged(int value)
{
double Lacunarity = double(value) / 10.0;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[0].Lacunarity
=
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[1].Lacunarity
= float(Lacunarity);
MathmodRef->ui.glWidget->IsoObjet->masterthread->Lacunarity = Lacunarity;
MathmodRef->ui.glWidget->ParObjet->masterthread->Lacunarity = Lacunarity;
ui.LacunarityLabel->setText("Lacunarity = " + QString::number(Lacunarity));
on_pushButton_5_clicked();
}
void DrawingOptions::on_GainScrollBar_valueChanged(int value)
{
double Gain = double(value) / 10.0;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[0].Gain =
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[1].Gain = flo
at(Gain);
MathmodRef->ui.glWidget->IsoObjet->masterthread->Gain = Gain;
MathmodRef->ui.glWidget->ParObjet->masterthread->Gain = Gain;
ui.GainLabel->setText("Gain = " + QString::number(Gain));
on_pushButton_5_clicked();
} }
void DrawingOptions::on_ShowtextureScript_clicked() void DrawingOptions::on_ShowtextureScript_clicked()
{ {
static int show = -1; static int show = -1;
show *= -1; show *= -1;
if (show == 1) if (show == 1)
{ {
ui.textureEdit->show(); ui.textureEdit->show();
ui.ShowtextureScript->setText("Hide Script"); ui.ShowtextureScript->setText("Hide Script");
} }
else else
{ {
ui.textureEdit->hide(); ui.textureEdit->hide();
ui.ShowtextureScript->setText("Show Script"); ui.ShowtextureScript->setText("Show Script");
} }
} }
void DrawingOptions::on_TurbulenceCheckBox_clicked()
{
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[0].NoiseActiv
e *= -1;
MathmodRef->ui.glWidget->LocalScene.componentsinfos.NoiseParam[1].NoiseActiv
e *= -1;
on_pushButton_5_clicked();
}
void DrawingOptions::on_pushButton_5_clicked() void DrawingOptions::on_pushButton_5_clicked()
{ {
QJsonParseError err; QJsonParseError err;
QString sortie; QString sortie;
QString script = ui.textureEdit->toPlainText().trimmed().replace("\n", "").r eplace("\t", "").replace("DOTSYMBOL", Parameters->dotsymbol.toStdString().c_str( )); QString script = ui.textureEdit->toPlainText().trimmed().replace("\n", "").r eplace("\t", "").replace("DOTSYMBOL", Parameters->dotsymbol.toStdString().c_str( ));
QJsonDocument doc = QJsonDocument::fromJson(script.toUtf8(), &err); QJsonDocument doc = QJsonDocument::fromJson(script.toUtf8(), &err);
if (err.error) if (err.error)
{ {
ShowErrorMessage(err, script); ShowErrorMessage(err, script);
return; return;
} }
QJsonObject tmp = doc.object(); QJsonObject tmp = doc.object();
if (tmp["Texture"].isObject()) if (tmp["Texture"].isObject())
{ {
MathmodRef->collection.JTextures[ui.comboBoxTexture->currentIndex() - 1] =doc.object(); MathmodRef->collection.JTextures[ui.comboBoxTexture->currentIndex() - 1] =doc.object();
on_comboBoxTexture_activated(ui.comboBoxTexture->currentIndex()); on_comboBoxTexture_activated(ui.comboBoxTexture->currentIndex());
} }
else else
{ {
MathmodRef->collection.JPigments[ui.comboBoxPigment->currentIndex() - 1] =doc.object(); MathmodRef->collection.JPigments[ui.comboBoxPigment->currentIndex() - 1] =doc.object();
on_comboBoxPigment_activated(ui.comboBoxPigment->currentIndex()); on_comboBoxPigment_activated(ui.comboBoxPigment->currentIndex());
skipping to change at line 4672 skipping to change at line 4483
CScrollBar_valueChanged(val, 18); CScrollBar_valueChanged(val, 18);
} }
void DrawingOptions::on_C20ScrollBar_valueChanged(int val) void DrawingOptions::on_C20ScrollBar_valueChanged(int val)
{ {
CScrollBar_valueChanged(val, 19); CScrollBar_valueChanged(val, 19);
} }
void DrawingOptions::CScrollBar_valueChanged(int val, int idx) void DrawingOptions::CScrollBar_valueChanged(int val, int idx)
{ {
MathmodRef->ui.glWidget->LocalScene.slider = 1; MathmodRef->LocalScene.slider = 1;
MathmodRef->ui.glWidget->IsoObjet->masterthread->SliderValues[uint(idx)] =va MathmodRef->IsoObjet->masterthread->SliderValues[uint(idx)] =val;
l; MathmodRef->ParObjet->masterthread->SliderValues[uint(idx)] =val;
MathmodRef->ui.glWidget->ParObjet->masterthread->SliderValues[uint(idx)] =va
l;
SliderArray[idx].SliderLabel->setText(qlstnames.at(idx) + " = " +QString::nu mber(val)); SliderArray[idx].SliderLabel->setText(qlstnames.at(idx) + " = " +QString::nu mber(val));
if (CurrentFormulaType == 2) if (CurrentFormulaType == 2)
MathmodRef->ProcessNewIsoSurface(); MathmodRef->ProcessNewIsoSurface();
else else
MathmodRef->ParametricSurfaceProcess(CurrentFormulaType); MathmodRef->ParametricSurfaceProcess(CurrentFormulaType);
MathmodRef->ui.glWidget->LocalScene.slider = -1; MathmodRef->LocalScene.slider = -1;
} }
void DrawingOptions::on_PredefinedSets_activated(int index) void DrawingOptions::on_PredefinedSets_activated(int index)
{ {
indexcurrentSet = index; indexcurrentSet = index;
if (index > 0) if (index > 0)
{ {
int size = (qlstnames.size()); int size = (qlstnames.size());
MathmodRef->ui.glWidget->LocalScene.slider = 1; MathmodRef->LocalScene.slider = 1;
for (int i = 0; i < size; ++i) for (int i = 0; i < size; ++i)
{ {
MathmodRef->ui.glWidget->IsoObjet->masterthread->SliderValues[uint(i )] = MathmodRef->IsoObjet->masterthread->SliderValues[uint(i)] =
qlstPos.at(i + (index - 1) * size).toDouble(); qlstPos.at(i + (index - 1) * size).toDouble();
MathmodRef->ui.glWidget->ParObjet->masterthread->SliderValues[uint(i )] = MathmodRef->ParObjet->masterthread->SliderValues[uint(i)] =
qlstPos.at(i + (index - 1) * size).toDouble(); qlstPos.at(i + (index - 1) * size).toDouble();
} }
for (int sl = 0; sl < 20; sl++) for (int sl = 0; sl < 20; sl++)
{ {
if (size >= (sl + 1)) if (size >= (sl + 1))
{ {
(SliderArray[sl].SliderLabel) (SliderArray[sl].SliderLabel)
->setText(qlstnames.at(sl) + " = " +qlstPos.at(sl + (index - 1) * size) + "(" +qlstStep.at(sl) + ")"); ->setText(qlstnames.at(sl) + " = " +qlstPos.at(sl + (index - 1) * size) + "(" +qlstStep.at(sl) + ")");
(SliderArray[sl].SliderScrollBar)->blockSignals(true); (SliderArray[sl].SliderScrollBar)->blockSignals(true);
if (qlstmin.size() > qlstnames.size()) if (qlstmin.size() > qlstnames.size())
skipping to change at line 4722 skipping to change at line 4533
} }
(SliderArray[sl].SliderScrollBar)->setSliderPosition(qlstPos.at( sl + (index - 1) * size).toInt()); (SliderArray[sl].SliderScrollBar)->setSliderPosition(qlstPos.at( sl + (index - 1) * size).toInt());
(SliderArray[sl].SliderScrollBar)->blockSignals(false); (SliderArray[sl].SliderScrollBar)->blockSignals(false);
} }
} }
// Draw // Draw
if (CurrentFormulaType == 2) if (CurrentFormulaType == 2)
MathmodRef->ProcessNewIsoSurface(); MathmodRef->ProcessNewIsoSurface();
else else
MathmodRef->ParametricSurfaceProcess(CurrentFormulaType); MathmodRef->ParametricSurfaceProcess(CurrentFormulaType);
MathmodRef->ui.glWidget->LocalScene.slider = -1; MathmodRef->LocalScene.slider = -1;
} }
} }
void DrawingOptions::CIndextoolButton_clicked(int idx) void DrawingOptions::CIndextoolButton_clicked(int idx)
{ {
int range = (indexcurrentSet < 1)? (idx - 1) : (indexcurrentSet - 1) * qlstn ames.size() + (idx - 1); int range = (indexcurrentSet < 1)? (idx - 1) : (indexcurrentSet - 1) * qlstn ames.size() + (idx - 1);
sliderconf.currentSlider = (idx - 1); sliderconf.currentSlider = (idx - 1);
sliderconf.ui.MaxEdit->setText(qlstmax[range]); sliderconf.ui.MaxEdit->setText(qlstmax[range]);
sliderconf.ui.MinEdit->setText(qlstmin[range]); sliderconf.ui.MinEdit->setText(qlstmin[range]);
sliderconf.ui.StepEdit->setText(qlstStep[range]); sliderconf.ui.StepEdit->setText(qlstStep[range]);
sliderconf.ui.PosEdit->setText(qlstPos[range]); sliderconf.ui.PosEdit->setText(qlstPos[range]);
skipping to change at line 4861 skipping to change at line 4672
(SliderArray[sl].SliderScrollBar)->blockSignals(true); (SliderArray[sl].SliderScrollBar)->blockSignals(true);
(SliderArray[sl].SliderScrollBar)->setMaximum(qlstmax.at(sl).toInt() ); (SliderArray[sl].SliderScrollBar)->setMaximum(qlstmax.at(sl).toInt() );
(SliderArray[sl].SliderScrollBar)->setMinimum(qlstmin.at(sl).toInt() ); (SliderArray[sl].SliderScrollBar)->setMinimum(qlstmin.at(sl).toInt() );
(SliderArray[sl].SliderScrollBar)->setSingleStep(qlstStep.at(sl).toI nt()); (SliderArray[sl].SliderScrollBar)->setSingleStep(qlstStep.at(sl).toI nt());
(SliderArray[sl].SliderScrollBar)->setPageStep(qlstStep.at(sl).toInt ()); (SliderArray[sl].SliderScrollBar)->setPageStep(qlstStep.at(sl).toInt ());
(SliderArray[sl].SliderScrollBar)->setSliderPosition(qlstPos.at(sl). toInt()); (SliderArray[sl].SliderScrollBar)->setSliderPosition(qlstPos.at(sl). toInt());
(SliderArray[sl].SliderLabel)->setText(qlstnames.at(sl) + " = " + ql stPos.at(sl) + "(" +qlstStep.at(sl) + ")"); (SliderArray[sl].SliderLabel)->setText(qlstnames.at(sl) + " = " + ql stPos.at(sl) + "(" +qlstStep.at(sl) + ")");
(SliderArray[sl].SliderLabelMin)->setText(qlstmin.at(sl)); (SliderArray[sl].SliderLabelMin)->setText(qlstmin.at(sl));
(SliderArray[sl].SliderLabelMax)->setText(qlstmax.at(sl)); (SliderArray[sl].SliderLabelMax)->setText(qlstmax.at(sl));
(SliderArray[sl].SliderScrollBar)->blockSignals(false); (SliderArray[sl].SliderScrollBar)->blockSignals(false);
MathmodRef->ui.glWidget->IsoObjet->masterthread->SliderNames.push_ba MathmodRef->IsoObjet->masterthread->SliderNames.push_back(qlstnames.
ck(qlstnames.at(sl).toStdString()); at(sl).toStdString());
MathmodRef->ui.glWidget->ParObjet->masterthread->SliderNames.push_ba MathmodRef->ParObjet->masterthread->SliderNames.push_back(qlstnames.
ck(qlstnames.at(sl).toStdString()); at(sl).toStdString());
MathmodRef->ui.glWidget->IsoObjet->masterthread->SliderValues.push_b MathmodRef->IsoObjet->masterthread->SliderValues.push_back(qlstPos.a
ack(qlstPos.at(sl).toDouble()); t(sl).toDouble());
MathmodRef->ui.glWidget->ParObjet->masterthread->SliderValues.push_b MathmodRef->ParObjet->masterthread->SliderValues.push_back(qlstPos.a
ack(qlstPos.at(sl).toDouble()); t(sl).toDouble());
} }
} }
// Draw // Draw
MathmodRef->ui.glWidget->LocalScene.slider = 1; MathmodRef->LocalScene.slider = 1;
if (CurrentFormulaType == 2) if (CurrentFormulaType == 2)
MathmodRef->ProcessNewIsoSurface(); MathmodRef->ProcessNewIsoSurface();
else else
MathmodRef->ParametricSurfaceProcess(CurrentFormulaType); MathmodRef->ParametricSurfaceProcess(CurrentFormulaType);
MathmodRef->ui.glWidget->LocalScene.slider = -1; MathmodRef->LocalScene.slider = -1;
} }
void DrawingOptions::on_AddSetButton_clicked() void DrawingOptions::on_AddSetButton_clicked()
{ {
QJsonArray array1, array2, array3, array4, array5; QJsonArray array1, array2, array3, array4, array5;
QJsonObject tmp, tmp2; QJsonObject tmp, tmp2;
tmp = MathmodRef->RootObjet.CurrentJsonObject; tmp = MathmodRef->RootObjet.CurrentJsonObject;
tmp2 = tmp["Sliders"].toObject(); tmp2 = tmp["Sliders"].toObject();
array2 = tmp2["Position"].toArray(); array2 = tmp2["Position"].toArray();
array3 = tmp2["Min"].toArray(); array3 = tmp2["Min"].toArray();
skipping to change at line 5071 skipping to change at line 4882
{ {
CIndextoolButton_clicked(index); CIndextoolButton_clicked(index);
sliderconf.currentSlider = index - 1; sliderconf.currentSlider = index - 1;
} }
void DrawingOptions::on_actionFrames_triggered() void DrawingOptions::on_actionFrames_triggered()
{ {
MathmodRef->frames_clicked(); MathmodRef->frames_clicked();
} }
void DrawingOptions::SetSpecularValues(float *spec) void DrawingOptions::SetSpecularValues(int *spec)
{ {
ui.red_Specular->blockSignals(true); ui.red_Specular->blockSignals(true);
ui.red_Specular->setSliderPosition(int(spec[0] * 100)); ui.red_Specular->setSliderPosition(spec[0]);
ui.red_Specular->blockSignals(false); ui.red_Specular->blockSignals(false);
ui.green_Specular->blockSignals(true); ui.green_Specular->blockSignals(true);
ui.green_Specular->setSliderPosition(int(spec[1] * 100)); ui.green_Specular->setSliderPosition(spec[1]);
ui.green_Specular->blockSignals(false); ui.green_Specular->blockSignals(false);
ui.blue_Specular->blockSignals(true); ui.blue_Specular->blockSignals(true);
ui.blue_Specular->setSliderPosition(int(spec[2] * 100)); ui.blue_Specular->setSliderPosition(spec[2]);
ui.blue_Specular->blockSignals(false); ui.blue_Specular->blockSignals(false);
ui.transparent_Specular->blockSignals(true); ui.transparent_Specular->blockSignals(true);
ui.transparent_Specular->setSliderPosition(int(spec[3] * 100)); ui.transparent_Specular->setSliderPosition(spec[3]);
ui.transparent_Specular->blockSignals(false); ui.transparent_Specular->blockSignals(false);
MathmodRef->ui.glWidget->LocalScene.specReflection[0]= Parameters->Specular[ MathmodRef->lightSpecular[0]= Parameters->Specular[0]/100.0f;
0]; MathmodRef->lightSpecular[1]= Parameters->Specular[1]/100.0f;
MathmodRef->ui.glWidget->LocalScene.specReflection[1]= Parameters->Specular[ MathmodRef->lightSpecular[2]= Parameters->Specular[2]/100.0f;
1]; MathmodRef->lightSpecular[3]= Parameters->Specular[3]/100.0f;
MathmodRef->ui.glWidget->LocalScene.specReflection[2]= Parameters->Specular[ }
2]; void DrawingOptions::SetDiffuseValues(int *spec)
MathmodRef->ui.glWidget->LocalScene.specReflection[3]= Parameters->Specular[ {
3]; ui.red_Diffuse->blockSignals(true);
ui.red_Diffuse->setSliderPosition(spec[0]);
ui.red_Diffuse->blockSignals(false);
ui.green_Diffuse->blockSignals(true);
ui.green_Diffuse->setSliderPosition(spec[1]);
ui.green_Diffuse->blockSignals(false);
ui.blue_Diffuse->blockSignals(true);
ui.blue_Diffuse->setSliderPosition(spec[2]);
ui.blue_Diffuse->blockSignals(false);
ui.transparent_Diffuse->blockSignals(true);
ui.transparent_Diffuse->setSliderPosition(spec[3]);
ui.transparent_Diffuse->blockSignals(false);
MathmodRef->lightDiffuse[0]= Parameters->Diffuse[0]/100.0f;
MathmodRef->lightDiffuse[1]= Parameters->Diffuse[1]/100.0f;
MathmodRef->lightDiffuse[2]= Parameters->Diffuse[2]/100.0f;
MathmodRef->lightDiffuse[3]= Parameters->Diffuse[3]/100.0f;
}
void DrawingOptions::SetAmbientValues(int *spec)
{
ui.red_Ambient->blockSignals(true);
ui.red_Ambient->setSliderPosition(spec[0]);
ui.red_Ambient->blockSignals(false);
ui.green_Ambient->blockSignals(true);
ui.green_Ambient->setSliderPosition(spec[1]);
ui.green_Ambient->blockSignals(false);
ui.blue_Ambient->blockSignals(true);
ui.blue_Ambient->setSliderPosition(spec[2]);
ui.blue_Ambient->blockSignals(false);
ui.transparent_Ambient->blockSignals(true);
ui.transparent_Ambient->setSliderPosition(spec[3]);
ui.transparent_Ambient->blockSignals(false);
MathmodRef->lightAmbient[0]= Parameters->Ambient[0]/100.0f;
MathmodRef->lightAmbient[1]= Parameters->Ambient[1]/100.0f;
MathmodRef->lightAmbient[2]= Parameters->Ambient[2]/100.0f;
MathmodRef->lightAmbient[3]= Parameters->Ambient[3]/100.0f;
} }
void DrawingOptions::SetThreadValues(int *thread) void DrawingOptions::SetThreadValues(int *thread)
{ {
ui.ThreadNumberScrollBar->blockSignals(true); ui.ThreadNumberScrollBar->blockSignals(true);
ui.ThreadNumberScrollBar->setSliderPosition(thread[0]); ui.ThreadNumberScrollBar->setSliderPosition(thread[0]);
ui.ThreadNumberScrollBar->setMinimum(thread[1]); ui.ThreadNumberScrollBar->setMinimum(thread[1]);
ui.ThreadNumberScrollBar->setMaximum(thread[2]); ui.ThreadNumberScrollBar->setMaximum(thread[2]);
ui.ThreadgroupBox->setTitle( ui.ThreadgroupBox->setTitle(
"Threads: " + QString::number(ui.ThreadNumberScrollBar->minimum()) + "Threads: " + QString::number(ui.ThreadNumberScrollBar->minimum()) +
" < " + QString::number(thread[0]) + " < " + " < " + QString::number(thread[0]) + " < " +
QString::number(ui.ThreadNumberScrollBar->maximum())); QString::number(ui.ThreadNumberScrollBar->maximum()));
ui.ThreadNumberScrollBar->blockSignals(false); ui.ThreadNumberScrollBar->blockSignals(false);
} }
void DrawingOptions::SetShininessValue(int shin) void DrawingOptions::SetShininessValue(int shin)
{ {
ui.ShininessScrollBar->blockSignals(true); ui.ShininessScrollBar->blockSignals(true);
ui.ShininessScrollBar->setSliderPosition(shin); ui.ShininessScrollBar->setSliderPosition(shin);
ui.ShininessScrollBar->blockSignals(false); ui.ShininessScrollBar->blockSignals(false);
MathmodRef->ui.glWidget->LocalScene.shininess = Parameters->Shininess; MathmodRef->LocalScene.shininess = Parameters->Shininess;
} }
void DrawingOptions::on_red_Specular_valueChanged(int value) void DrawingOptions::on_red_Specular_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->redSpec(value); MathmodRef->redSpec(value);
if (ui.GcheckBox->isChecked()) if (ui.GcheckBox->isChecked())
{ {
ui.green_Specular->blockSignals(true); ui.green_Specular->blockSignals(true);
ui.green_Specular->setSliderPosition(value); ui.green_Specular->setSliderPosition(value);
ui.green_Specular->blockSignals(false); ui.green_Specular->blockSignals(false);
MathmodRef->ui.glWidget->greenSpec(value); MathmodRef->greenSpec(value);
} }
if (ui.BcheckBox->isChecked()) if (ui.BcheckBox->isChecked())
{ {
ui.blue_Specular->blockSignals(true); ui.blue_Specular->blockSignals(true);
ui.blue_Specular->setSliderPosition(value); ui.blue_Specular->setSliderPosition(value);
ui.blue_Specular->blockSignals(false); ui.blue_Specular->blockSignals(false);
MathmodRef->ui.glWidget->blueSpec(value); MathmodRef->blueSpec(value);
} }
MathmodRef->ui.glWidget->InitSpecularParameters(); //MathmodRef->InitSpecularParameters();
} }
void DrawingOptions::on_green_Specular_valueChanged(int value) void DrawingOptions::on_green_Specular_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->greenSpec(value); MathmodRef->greenSpec(value);
if (ui.RcheckBox->isChecked()) if (ui.RcheckBox->isChecked())
{ {
ui.red_Specular->blockSignals(true); ui.red_Specular->blockSignals(true);
ui.red_Specular->setSliderPosition(value); ui.red_Specular->setSliderPosition(value);
ui.red_Specular->blockSignals(false); ui.red_Specular->blockSignals(false);
MathmodRef->ui.glWidget->redSpec(value); MathmodRef->redSpec(value);
} }
if (ui.BcheckBox->isChecked()) if (ui.BcheckBox->isChecked())
{ {
ui.blue_Specular->blockSignals(true); ui.blue_Specular->blockSignals(true);
ui.blue_Specular->setSliderPosition(value); ui.blue_Specular->setSliderPosition(value);
ui.blue_Specular->blockSignals(false); ui.blue_Specular->blockSignals(false);
MathmodRef->ui.glWidget->blueSpec(value); MathmodRef->blueSpec(value);
} }
MathmodRef->ui.glWidget->InitSpecularParameters(); //MathmodRef->InitSpecularParameters();
} }
void DrawingOptions::on_blue_Specular_valueChanged(int value) void DrawingOptions::on_blue_Specular_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->blueSpec(value); MathmodRef->blueSpec(value);
if (ui.GcheckBox->isChecked()) if (ui.GcheckBox->isChecked())
{ {
ui.green_Specular->blockSignals(true); ui.green_Specular->blockSignals(true);
ui.green_Specular->setSliderPosition(value); ui.green_Specular->setSliderPosition(value);
ui.green_Specular->blockSignals(false); ui.green_Specular->blockSignals(false);
MathmodRef->ui.glWidget->greenSpec(value); MathmodRef->greenSpec(value);
} }
if (ui.RcheckBox->isChecked()) if (ui.RcheckBox->isChecked())
{ {
ui.red_Specular->blockSignals(true); ui.red_Specular->blockSignals(true);
ui.red_Specular->setSliderPosition(value); ui.red_Specular->setSliderPosition(value);
ui.red_Specular->blockSignals(false); ui.red_Specular->blockSignals(false);
MathmodRef->ui.glWidget->redSpec(value); MathmodRef->redSpec(value);
} }
MathmodRef->ui.glWidget->InitSpecularParameters(); //MathmodRef->InitSpecularParameters();
} }
void DrawingOptions::on_transparent_Specular_valueChanged(int value) void DrawingOptions::on_transparent_Specular_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->transSpec(value); MathmodRef->transSpec(value);
} }
void DrawingOptions::on_ShininessScrollBar_valueChanged(int value) void DrawingOptions::on_ShininessScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->Shininess(value); MathmodRef->Shininess(value);
} }
void DrawingOptions::on_ThreadNumberScrollBar_valueChanged(int value) void DrawingOptions::on_ThreadNumberScrollBar_valueChanged(int value)
{ {
MathmodRef->ui.glWidget->ParObjet->UpdateThredsNumber(uint(value)); MathmodRef->ParObjet->UpdateThredsNumber(uint(value));
MathmodRef->ui.glWidget->IsoObjet->UpdateThredsNumber(uint(value)); MathmodRef->IsoObjet->UpdateThredsNumber(uint(value));
ui.ThreadgroupBox->setTitle( ui.ThreadgroupBox->setTitle(
"Threads: " + QString::number(ui.ThreadNumberScrollBar->minimum()) + "Threads: " + QString::number(ui.ThreadNumberScrollBar->minimum()) +
" < " + QString::number(value) + " < " + " < " + QString::number(value) + " < " +
QString::number(ui.ThreadNumberScrollBar->maximum())); QString::number(ui.ThreadNumberScrollBar->maximum()));
} }
void DrawingOptions::on_StopCalculationsButton_clicked() void DrawingOptions::on_StopCalculationsButton_clicked()
{ {
MathmodRef->ui.glWidget->IsoObjet->stopcalculations(true); MathmodRef->IsoObjet->stopcalculations(true);
MathmodRef->ui.glWidget->ParObjet->stopcalculations(true); MathmodRef->ParObjet->stopcalculations(true);
} }
void DrawingOptions::on_stopButton_clicked() void DrawingOptions::on_stopButton_clicked()
{ {
on_StopCalculationsButton_clicked(); on_StopCalculationsButton_clicked();
} }
void DrawingOptions::on_actionScripts_selection_triggered() void DrawingOptions::on_actionScripts_selection_triggered()
{ {
select.show(); select.show();
} }
void DrawingOptions::on_actionBoundingBox_clicked() void DrawingOptions::on_actionBoundingBox_clicked()
{ {
MathmodRef->ui.glWidget->boundingboxOk(); MathmodRef->boundingboxOk();
MathmodRef->ui.glWidget->update(); MathmodRef->update();
} }
void DrawingOptions::on_actionAnimation_Rotation_triggered() void DrawingOptions::on_actionAnimation_Rotation_triggered()
{ {
MathmodRef->ui.glWidget->anim(); MathmodRef->anim();
} }
void DrawingOptions::on_actionMorph_use_t_parameter_triggered() void DrawingOptions::on_actionMorph_use_t_parameter_triggered()
{ {
MathmodRef->ui.glWidget->morph(); MathmodRef->morph();
} }
void DrawingOptions::on_TreeViewButton_clicked() void DrawingOptions::on_TreeViewButton_clicked()
{ {
ShowCurrentObjectTree = !ShowCurrentObjectTree; ShowCurrentObjectTree = !ShowCurrentObjectTree;
if (ShowCurrentObjectTree) if (ShowCurrentObjectTree)
{ {
UpdateTreeObject(); UpdateTreeObject();
ui.ObjectClasseCurrent->show(); ui.ObjectClasseCurrent->show();
} }
skipping to change at line 5349 skipping to change at line 5198
{ {
int maxpargrid = 0; int maxpargrid = 0;
if ((ui.ParMaxGridLineEdit_2->text()).replace(" ", "")!= "" && if ((ui.ParMaxGridLineEdit_2->text()).replace(" ", "")!= "" &&
(maxpargrid = (ui.ParMaxGridLineEdit_2->text()).toInt()) != Parameters-> ParMaxGrid) (maxpargrid = (ui.ParMaxGridLineEdit_2->text()).toInt()) != Parameters-> ParMaxGrid)
updateParametricGridSliders(maxpargrid); updateParametricGridSliders(maxpargrid);
} }
#include <QDesktopServices> #include <QDesktopServices>
void DrawingOptions::on_actionDocumentation_triggered() void DrawingOptions::on_actionDocumentation_triggered()
{ {
QString link = QApplication::applicationDirPath() + "/Resources/documentatio n/index.html"; QString link = QApplication::applicationDirPath() + "/documentation/index.ht ml";
QDesktopServices::openUrl(QUrl(QUrl::fromLocalFile(link))); QDesktopServices::openUrl(QUrl(QUrl::fromLocalFile(link)));
} }
void DrawingOptions::on_ScaleButton_clicked() void DrawingOptions::on_ScaleButton_clicked()
{ {
bool valx, valy, valz; bool valx, valy, valz;
double fx = ui.lineEditSx->text().toDouble(&valx); double fx = ui.lineEditSx->text().toDouble(&valx);
double fy = ui.lineEditSy->text().toDouble(&valy); double fy = ui.lineEditSy->text().toDouble(&valy);
double fz = ui.lineEditSz->text().toDouble(&valz); double fz = ui.lineEditSz->text().toDouble(&valz);
if (valx && valy && valz) if (valx && valy && valz)
{ {
MathmodRef->ui.glWidget->factx=fx; MathmodRef->factx=fx;
MathmodRef->ui.glWidget->facty=fy; MathmodRef->facty=fy;
MathmodRef->ui.glWidget->factz=fz; MathmodRef->factz=fz;
} }
else else
{ {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText("Invalid number"); msgBox.setText("Invalid number");
msgBox.exec(); msgBox.exec();
} }
} }
void DrawingOptions::on_ShowIsoComp_clicked()
{
if(!ui.ShowIsoComp->isChecked())
{
ui.ShowIsoComp->setText("Show");
if(!MathmodRef->LocalScene.componentsinfos.pariso)
MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[IndexcurrentCom
ponent]=false;
else
MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[MathmodRef->Loc
alScene.componentsinfos.NbComponentsType[0]+IndexcurrentComponent]=false;
}
else
{
ui.ShowIsoComp->setText("Hide");
if(!MathmodRef->LocalScene.componentsinfos.pariso)
MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[IndexcurrentCom
ponent]=true;
else
MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[MathmodRef->Loc
alScene.componentsinfos.NbComponentsType[0]+IndexcurrentComponent]=true;
}
MathmodRef->update();
}
void DrawingOptions::on_ShowParComp_clicked()
{
if(!ui.ShowParComp->isChecked())
{
ui.ShowParComp->setText("Show");
MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[IndexcurrentCompone
nt]=false;
}
else
{
ui.ShowParComp->setText("Hide");
MathmodRef->LocalScene.componentsinfos.ShowParIsoCmp[IndexcurrentCompone
nt]=true;
}
MathmodRef->update();
}
void DrawingOptions::on_actionAxe_triggered()
{
MathmodRef->LocalScene.axe *=-1;
MathmodRef->update();
}
void DrawingOptions::on_actionPlan_triggered()
{
MathmodRef->LocalScene.plan *=-1;
MathmodRef->update();
}
void DrawingOptions::on_actionDetach_WinInfos_triggered()
{
MathmodRef->LocalScene.attachwininfos*=-1;
MathmodRef->attachinfos();
}
void DrawingOptions::on_red_Ambient_valueChanged(int value)
{
MathmodRef->redAmb(value);
}
void DrawingOptions::on_green_Ambient_valueChanged(int value)
{
MathmodRef->greenAmb(value);
}
void DrawingOptions::on_blue_Ambient_valueChanged(int value)
{
MathmodRef->blueAmb(value);
}
void DrawingOptions::on_transparent_Ambient_valueChanged(int value)
{
MathmodRef->transAmb(value);
}
void DrawingOptions::on_red_Diffuse_valueChanged(int value)
{
MathmodRef->redDiff(value);
}
void DrawingOptions::on_green_Diffuse_valueChanged(int value)
{
MathmodRef->greenDiff(value);
}
void DrawingOptions::on_blue_Diffuse_valueChanged(int value)
{
MathmodRef->blueDiff(value);
}
void DrawingOptions::on_transparent_Diffuse_valueChanged(int value)
{
MathmodRef->transDiff(value);
}
 End of changes. 389 change blocks. 
762 lines changed or deleted 540 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)