"Fossies" - the Fresh Open Source Software Archive  

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

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

drawingoptions.cpp  (mathmod-11.0-source):drawingoptions.cpp  (mathmod-11.1-source)
skipping to change at line 413 skipping to change at line 413
void DrawingOptions::AddObjectToMySelectionTree() void DrawingOptions::AddObjectToMySelectionTree()
{ {
if (MathmodRef->RootObjet.CurrentJsonObject["Iso3D"].isObject()) if (MathmodRef->RootObjet.CurrentJsonObject["Iso3D"].isObject())
{ {
QTreeWidgetItem *isolistItem = QTreeWidgetItem *isolistItem =
new QTreeWidgetItem(MyselectionItemReference); new QTreeWidgetItem(MyselectionItemReference);
AddIsoObjectToTree(isolistItem, MathmodRef->RootObjet.CurrentTreestruct) ; AddIsoObjectToTree(isolistItem, MathmodRef->RootObjet.CurrentTreestruct) ;
} }
else if (MathmodRef->RootObjet.CurrentJsonObject["Param3D"].isObject() || else if (MathmodRef->RootObjet.CurrentJsonObject["Param3D"].isObject() ||
MathmodRef->RootObjet.CurrentJsonObject["Param4D"].isObject()) MathmodRef->RootObjet.CurrentJsonObject["Param4D"].isObject() ||
MathmodRef->RootObjet.CurrentJsonObject["Param3D_C"].isObject() ||
MathmodRef->RootObjet.CurrentJsonObject["Param4D_C"].isObject())
{ {
QTreeWidgetItem *paramlistItem = QTreeWidgetItem *paramlistItem =
new QTreeWidgetItem(MyselectionItemReference); new QTreeWidgetItem(MyselectionItemReference);
AddParObjectToTree(paramlistItem, MathmodRef->RootObjet.CurrentTreestruc t); AddParObjectToTree(paramlistItem, MathmodRef->RootObjet.CurrentTreestruc t);
} }
} }
void DrawingOptions::UpdateTreeObject() void DrawingOptions::UpdateTreeObject()
{ {
// Update Object Tree // Update Object Tree
skipping to change at line 447 skipping to change at line 449
} }
else else
{ {
if (MathmodRef->RootObjet.CurrentJsonObject["Iso3D"].isObject()) // isoO bject if (MathmodRef->RootObjet.CurrentJsonObject["Iso3D"].isObject()) // isoO bject
{ {
ui.ObjectClasseCurrent->model()->removeRows(0, ui.ObjectClasseCurren t->model()->rowCount()); ui.ObjectClasseCurrent->model()->removeRows(0, ui.ObjectClasseCurren t->model()->rowCount());
QTreeWidgetItem *IsolistItem = new QTreeWidgetItem(ui.ObjectClasseCu rrent); QTreeWidgetItem *IsolistItem = new QTreeWidgetItem(ui.ObjectClasseCu rrent);
AddIsoObjectToTree(IsolistItem, MathmodRef->RootObjet.CurrentTreestr uct); AddIsoObjectToTree(IsolistItem, MathmodRef->RootObjet.CurrentTreestr uct);
} }
else if (MathmodRef->RootObjet.CurrentJsonObject["Param3D"].isObject() | | else if (MathmodRef->RootObjet.CurrentJsonObject["Param3D"].isObject() | |
MathmodRef->RootObjet.CurrentJsonObject["Param4D"].isObject()) MathmodRef->RootObjet.CurrentJsonObject["Param4D"].isObject() |
|
MathmodRef->RootObjet.CurrentJsonObject["Param3D_C"].isObject()
||
MathmodRef->RootObjet.CurrentJsonObject["Param4D_C"].isObject()
)
{ {
ui.ObjectClasseCurrent->model()->removeRows(0, ui.ObjectClasseCurren t->model()->rowCount()); ui.ObjectClasseCurrent->model()->removeRows(0, ui.ObjectClasseCurren t->model()->rowCount());
QTreeWidgetItem *paramlistItem =new QTreeWidgetItem(ui.ObjectClasseC urrent); QTreeWidgetItem *paramlistItem =new QTreeWidgetItem(ui.ObjectClasseC urrent);
AddParObjectToTree(paramlistItem,MathmodRef->RootObjet.CurrentTreest ruct); AddParObjectToTree(paramlistItem,MathmodRef->RootObjet.CurrentTreest ruct);
} }
} }
} }
void DrawingOptions::UpdatePar4DModelDetailsPage(TreeStruct &currentstruct) void DrawingOptions::UpdatePar4DModelDetailsPage(TreeStruct &currentstruct)
{ {
skipping to change at line 515 skipping to change at line 519
if (MathmodRef->RootObjet.CurrentParisoTreestruct[0].fxyz.size() != 0) if (MathmodRef->RootObjet.CurrentParisoTreestruct[0].fxyz.size() != 0)
UpdateIsoModelDetailsPage(MathmodRef->RootObjet.CurrentParisoTre estruct[0]); UpdateIsoModelDetailsPage(MathmodRef->RootObjet.CurrentParisoTre estruct[0]);
else if (MathmodRef->RootObjet.CurrentParisoTreestruct[0].fw.size() != 0) else if (MathmodRef->RootObjet.CurrentParisoTreestruct[0].fw.size() != 0)
UpdatePar4DModelDetailsPage(MathmodRef->RootObjet.CurrentParisoT reestruct[0]); UpdatePar4DModelDetailsPage(MathmodRef->RootObjet.CurrentParisoT reestruct[0]);
else if (MathmodRef->RootObjet.CurrentParisoTreestruct[0].fx.size() != 0) else if (MathmodRef->RootObjet.CurrentParisoTreestruct[0].fx.size() != 0)
UpdatePar3DModelDetailsPage(MathmodRef->RootObjet.CurrentParisoT reestruct[0]); UpdatePar3DModelDetailsPage(MathmodRef->RootObjet.CurrentParisoT reestruct[0]);
} }
} }
else if (MathmodRef->RootObjet.CurrentJsonObject["Iso3D"].isObject()) else if (MathmodRef->RootObjet.CurrentJsonObject["Iso3D"].isObject())
UpdateIsoModelDetailsPage(MathmodRef->RootObjet.CurrentTreestruct); UpdateIsoModelDetailsPage(MathmodRef->RootObjet.CurrentTreestruct);
else if (MathmodRef->RootObjet.CurrentJsonObject["Param3D"].isObject()) else if (MathmodRef->RootObjet.CurrentJsonObject["Param3D"].isObject() ||
MathmodRef->RootObjet.CurrentJsonObject["Param3D_C"].isObject())
UpdatePar3DModelDetailsPage(MathmodRef->RootObjet.CurrentTreestruct); UpdatePar3DModelDetailsPage(MathmodRef->RootObjet.CurrentTreestruct);
else if (MathmodRef->RootObjet.CurrentJsonObject["Param4D"].isObject()) else if (MathmodRef->RootObjet.CurrentJsonObject["Param4D"].isObject() ||
MathmodRef->RootObjet.CurrentJsonObject["Param4D_C"].isObject())
UpdatePar4DModelDetailsPage(MathmodRef->RootObjet.CurrentTreestruct); UpdatePar4DModelDetailsPage(MathmodRef->RootObjet.CurrentTreestruct);
else else
ui.stackedProperties->setCurrentIndex(0); ui.stackedProperties->setCurrentIndex(0);
} }
void DrawingOptions::HideSliders() void DrawingOptions::HideSliders()
{ {
ui.groupBox_9->hide(); ui.groupBox_9->hide();
ui.groupBox_10->hide(); ui.groupBox_10->hide();
ui.groupBox_11->hide(); ui.groupBox_11->hide();
skipping to change at line 977 skipping to change at line 983
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 = "";
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();
skipping to change at line 1002 skipping to change at line 1007
{ {
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;
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->LocalScene.componentsinfos.pariso = false; MathmodRef->LocalScene.componentsinfos.pariso = false;
MathmodRef->LocalScene.componentsinfos.ParisoNbComponents =1; MathmodRef->LocalScene.componentsinfos.ParisoNbComponents =1;
MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex = 0; MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex = 0;
} }
return (verif); return (verif);
} }
if (Jobj["Param3D"].isObject()) if (Jobj["Param3D"].isObject() || Jobj["Param3D_C"].isObject() ||
Jobj["Param4D"].isObject() || Jobj["Param4D_C"].isObject())
{ {
QObj = Jobj["Param3D"].toObject(); if(Jobj["Param3D"].isObject())
QObj = Jobj["Param3D"].toObject();
else if(Jobj["Param4D"].isObject())
QObj = Jobj["Param4D"].toObject();
else if(Jobj["Param3D_C"].isObject())
QObj = Jobj["Param3D_C"].toObject();
else if(Jobj["Param4D_C"].isObject())
QObj = Jobj["Param4D_C"].toObject();
MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = 1; MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = 1;
verif = VerifiedParJsonModel(QObj); verif = VerifiedParJsonModel(QObj);
if (verif) if (verif)
{ {
MathmodRef->LocalScene.componentsinfos.pariso = false; MathmodRef->LocalScene.componentsinfos.pariso = false;
MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = 1; MathmodRef->LocalScene.componentsinfos.ParisoNbComponents = 1;
MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex = 0; MathmodRef->LocalScene.componentsinfos.ParisoCurrentComponentIndex = 0;
} }
return (verif); return (verif);
} }
skipping to change at line 1065 skipping to change at line 1077
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->LocalScene.componentsinfos.hsv.push_back(result.contains("H= "));
MathmodRef->IsoObjet->masterthread->Rgbt = result.toStdString(); MathmodRef->IsoObjet->masterthread->Rgbt = result.toStdString();
MathmodRef->IsoObjet->masterthread->Noise = noise1.toStdString(); MathmodRef->IsoObjet->masterthread->Noise = noise1.toStdString();
MathmodRef->IsoObjet->masterthread->RgbtSize = uint(lst.size()); MathmodRef->IsoObjet->masterthread->RgbtSize = uint(lst.size());
} }
else if (opt == PAR_TYPE || opt == PAR_4D_TYPE) else if (opt == PAR_TYPE || opt == PAR_4D_TYPE)
{ {
MathmodRef->LocalScene.componentsinfos.hsv.push_back(result.contains("H= "));
MathmodRef->ParObjet->masterthread->Rgbt = result.toStdString(); MathmodRef->ParObjet->masterthread->Rgbt = result.toStdString();
MathmodRef->ParObjet->masterthread->Noise = noise1.toStdString(); MathmodRef->ParObjet->masterthread->Noise = noise1.toStdString();
MathmodRef->ParObjet->masterthread->RgbtSize = uint(lst.size()); MathmodRef->ParObjet->masterthread->RgbtSize = uint(lst.size());
} }
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)
skipping to change at line 1130 skipping to change at line 1145
MathmodRef->ParObjet->masterthread->Noise = noise.toStdString(); MathmodRef->ParObjet->masterthread->Noise = noise.toStdString();
MathmodRef->ParObjet->masterthread->VRgbtSize = uint(VRgbtSize); MathmodRef->ParObjet->masterthread->VRgbtSize = uint(VRgbtSize);
} }
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;
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();
skipping to change at line 1159 skipping to change at line 1172
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->LocalScene.componentsinfos.ParisoCondition.clear(); MathmodRef->LocalScene.componentsinfos.ParisoCondition.clear();
MathmodRef->LocalScene.componentsinfos.hsv.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 1254 skipping to change at line 1268
loadpigm = MathmodRef->IsoObjet->masterthread->vrgbtnotnull = 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");Jobjtmp.remove("Param3D_C");
Jobjtmp.remove("Param4D"); Jobjtmp.remove("Param4D");Jobjtmp.remove("Param4D_C");
document.setObject(Jobjtmp); document.setObject(Jobjtmp);
MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on()); MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on());
// Update the current parametric struct // Update the current parametric struct
MathmodRef->RootObjet.CurrentJsonObject = Jobjtmp; MathmodRef->RootObjet.CurrentJsonObject = Jobjtmp;
CurrentFormulaType = 2; CurrentFormulaType = 2;
/// process the new surface /// process the new surface
if (textureIndex == -1) if (textureIndex == -1)
{ {
if (MathmodRef->RootObjet.CurrentTreestruct.fxyz.count() > 0) if (MathmodRef->RootObjet.CurrentTreestruct.fxyz.count() > 0)
skipping to change at line 1280 skipping to change at line 1294
int result = MathmodRef->ParseIso(); int result = MathmodRef->ParseIso();
if (result == -1) if (result == -1)
return; return;
textureIndex < 1000 textureIndex < 1000
? MathmodRef->CalculateTexturePoints(1) ? MathmodRef->CalculateTexturePoints(1)
: MathmodRef->CalculatePigmentPoints(1); : MathmodRef->CalculatePigmentPoints(1);
MathmodRef->LocalScene.componentsinfos.Interleave=true; MathmodRef->LocalScene.componentsinfos.Interleave=true;
MathmodRef->update(); MathmodRef->update();
} }
} }
else if (Jobj["Param3D"].isObject()) else if (Jobj["Param3D"].isObject() || (MathmodRef->ParObjet->masterthre ad->param3d_C=Jobj["Param3D_C"].isObject()))
{ {
QObj = Jobj["Param3D"].toObject(); if(Jobj["Param3D"].isObject())
QObj = Jobj["Param3D"].toObject();
else
QObj = Jobj["Param3D_C"].toObject();
// Colors // Colors
loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull = loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull =
(Jobj["Texture"].isObject() || (Jobj["Texture"].isObject() ||
((textureIndex < 1000) && (textureIndex != -1))); ((textureIndex < 1000) && (textureIndex != -1)));
// Pigment // Pigment
loadpigm = MathmodRef->ParObjet->masterthread->vrgbtnotnull = 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..
if(Jobj["Param3D"].isObject())
Jobjtmp.remove("Param3D_C");
else
Jobjtmp.remove("Param3D");
Jobjtmp.remove("ParIso"); Jobjtmp.remove("ParIso");
Jobjtmp.remove("Iso3D"); Jobjtmp.remove("Iso3D");
Jobjtmp.remove("Param4D"); Jobjtmp.remove("Param4D");
QJsonDocument document; QJsonDocument document;
document.setObject(Jobjtmp); document.setObject(Jobjtmp);
MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on()); MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on());
MathmodRef->RootObjet.CurrentJsonObject = Jobjtmp; MathmodRef->RootObjet.CurrentJsonObject = Jobjtmp;
CurrentFormulaType = 1; CurrentFormulaType = 1;
skipping to change at line 1326 skipping to change at line 1347
if (result == -1) if (result == -1)
return; return;
textureIndex < 1000 textureIndex < 1000
? MathmodRef->CalculateTexturePoints(0) ? MathmodRef->CalculateTexturePoints(0)
: MathmodRef->CalculatePigmentPoints(0); : MathmodRef->CalculatePigmentPoints(0);
MathmodRef->LocalScene.componentsinfos.Interleave=true; MathmodRef->LocalScene.componentsinfos.Interleave=true;
MathmodRef->update(); MathmodRef->update();
} }
} }
else if (Jobj["Param4D"].isObject()) else if (Jobj["Param4D"].isObject() || (MathmodRef->ParObjet->masterthre ad->param4d_C=Jobj["Param4D_C"].isObject()))
{ {
QObj = Jobj["Param4D"].toObject(); if (Jobj["Param4D"].isObject())
QObj = Jobj["Param4D"].toObject();
else
QObj = Jobj["Param4D_C"].toObject();
// Colors // Colors
loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull = loadtext = MathmodRef->ParObjet->masterthread->rgbtnotnull =
(Jobj["Texture"].isObject() || (Jobj["Texture"].isObject() ||
((textureIndex < 1000) && (textureIndex != -1))); ((textureIndex < 1000) && (textureIndex != -1)));
// Pigment // Pigment
loadpigm = MathmodRef->ParObjet->masterthread->vrgbtnotnull = 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..
if (Jobj["Param4D"].isObject())
Jobjtmp.remove("Param4D_C");
else
Jobjtmp.remove("Param4D");
Jobjtmp.remove("Iso3D"); Jobjtmp.remove("Iso3D");
Jobjtmp.remove("Param3D"); Jobjtmp.remove("Param3D");
QJsonDocument document; QJsonDocument document;
document.setObject(Jobjtmp); document.setObject(Jobjtmp);
MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on()); MathmodRef->RootObjet.CurrentTreestruct.text = QString(document.toJs on());
MathmodRef->RootObjet.CurrentJsonObject = Jobjtmp; MathmodRef->RootObjet.CurrentJsonObject = Jobjtmp;
CurrentFormulaType = 3; CurrentFormulaType = 3;
skipping to change at line 1837 skipping to change at line 1865
{ {
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->LocalScene.componentsinfos.ParisoCondition.clear(); MathmodRef->LocalScene.componentsinfos.ParisoCondition.clear();
MathmodRef->LocalScene.componentsinfos.hsv.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 1942 skipping to change at line 1971
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];
MathmodRef->RootObjet.CurrentJsonObject = array[i].toObject(); MathmodRef->RootObjet.CurrentJsonObject = array[i].toObject();
CurrentFormulaType = 2; CurrentFormulaType = 2;
/// process the new surface /// process the new surface
MathmodRef->ProcessNewIsoSurface(); MathmodRef->ProcessNewIsoSurface();
return (2); return (2);
} }
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) ||
( (MathmodRef->ParObjet->masterthread->param3d_C = (array[
i].toObject())["Param3D_C"].isObject() ) &&
(QObj = (array[i].toObject())["Param3D_C"].toObject())["Nam
e"]
.toArray()[0]
.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->ParObjet->masterthread->rgbtnotnull = MathmodRef->ParObjet->masterthread->rgbtnotnull =
QObj1["Texture"].isObject())) QObj1["Texture"].isObject()))
QTextureObj = QObj1["Texture"].toObject(); QTextureObj = QObj1["Texture"].toObject();
// Pigment // Pigment
skipping to change at line 1973 skipping to change at line 2007
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 = 1; CurrentFormulaType = 1;
/// process the new surface /// process the new surface
MathmodRef->ParametricSurfaceProcess(1); MathmodRef->ParametricSurfaceProcess(1);
return (1); return (1);
} }
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) ||
((MathmodRef->ParObjet->masterthread->param4d_C = (array[i]
.toObject())["Param4D_C"].isObject()) &&
(QObj = (array[i].toObject())["Param4D
_C"].toObject())["Name"]
.toArray()[0]
.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->ParObjet->masterthread->rgbtnotnull = MathmodRef->ParObjet->masterthread->rgbtnotnull =
QObj1["Texture"].isObject())) QObj1["Texture"].isObject()))
QTextureObj = QObj1["Texture"].toObject(); QTextureObj = QObj1["Texture"].toObject();
// Pigment // Pigment
skipping to change at line 2101 skipping to change at line 2140
{ {
UpdateScriptEditorAndTreeObject(); UpdateScriptEditorAndTreeObject();
} }
return Result; return Result;
} }
void DrawingOptions::Run_JsonObject_activeted() void DrawingOptions::Run_JsonObject_activeted()
{ {
QJsonParseError err; QJsonParseError err;
QString sortie;
QString script = QString script =
ui.ParamEdit->toPlainText() ui.ParamEdit->toPlainText()
.trimmed() .trimmed()
.replace("\n", "") .replace("\n", "")
.replace("\t", "") .replace("\t", "")
.replace("DOTSYMBOL", Parameters->dotsymbol.toStdString().c_str()); .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);
skipping to change at line 2204 skipping to change at line 2242
} }
else if ((array[i].toObject())["Param4D"].isObject()) else if ((array[i].toObject())["Param4D"].isObject())
{ {
jpar newjpar; jpar newjpar;
jsobj = ((array[i].toObject())["Param4D"].toObject()); jsobj = ((array[i].toObject())["Param4D"].toObject());
newjpar.read(jsobj); newjpar.read(jsobj);
MathmodRef->collection.JPar.append(newjpar); MathmodRef->collection.JPar.append(newjpar);
a = (jsobj)["Name"].toArray()[0].toString(); a = (jsobj)["Name"].toArray()[0].toString();
lst.append(a); lst.append(a);
} }
else if ((array[i].toObject())["Param3D_C"].isObject())
{
jpar newjpar;
jsobj = ((array[i].toObject())["Param3D_C"].toObject());
newjpar.read(jsobj);
MathmodRef->collection.JPar.append(newjpar);
a = (jsobj)["Name"].toArray()[0].toString();
lst.append(a);
}
else if ((array[i].toObject())["Param4D_C"].isObject())
{
jpar newjpar;
jsobj = ((array[i].toObject())["Param4D_C"].toObject());
newjpar.read(jsobj);
MathmodRef->collection.JPar.append(newjpar);
a = (jsobj)["Name"].toArray()[0].toString();
lst.append(a);
}
} }
lst.insert(0, "Examples (" + QString::number(lst.count()) + ")"); lst.insert(0, "Examples (" + QString::number(lst.count()) + ")");
// Load the script containing isosurface and parametric formulas: // Load the script containing isosurface and parametric formulas:
ui.choice->clear(); ui.choice->clear();
ui.choice->insertItems(0, lst); ui.choice->insertItems(0, lst);
AddListModels(upd); AddListModels(upd);
} }
void DrawingOptions::LoadK3DSurfScript(QString filename, int type) void DrawingOptions::LoadK3DSurfScript(QString filename, int type)
{ {
skipping to change at line 2956 skipping to change at line 3012
} }
else if ((MathmodRef->RootObjet.MyJsonObjectSelection[i] .toObject()["Param4D"].isObject())) else if ((MathmodRef->RootObjet.MyJsonObjectSelection[i] .toObject()["Param4D"].isObject()))
{ {
if (s == (tst = (MathmodRef->RootObjet.MyJsonObjectS election[i].toObject()["Param4D"]).toObject()["Name"].toArray()[0].toString())) if (s == (tst = (MathmodRef->RootObjet.MyJsonObjectS election[i].toObject()["Param4D"]).toObject()["Name"].toArray()[0].toString()))
{ {
// Draw here // Draw here
DrawJsonModel(MathmodRef->RootObjet.MyJsonObject Selection.at(i).toObject()); DrawJsonModel(MathmodRef->RootObjet.MyJsonObject Selection.at(i).toObject());
return; return;
} }
} }
else if ((MathmodRef->RootObjet.MyJsonObjectSelection[i]
.toObject()["Param3D_C"].isObject()))
{
if (s == (tst = (MathmodRef->RootObjet.MyJsonObjectS
election[i].toObject()["Param3D_C"]).toObject()["Name"].toArray()[0].toString())
)
{
// Draw here
DrawJsonModel(MathmodRef->RootObjet.MyJsonObject
Selection.at(i).toObject());
return;
}
}
else if ((MathmodRef->RootObjet.MyJsonObjectSelection[i]
.toObject()["Param4D_C"].isObject()))
{
if (s == (tst = (MathmodRef->RootObjet.MyJsonObjectS
election[i].toObject()["Param4D_C"]).toObject()["Name"].toArray()[0].toString())
)
{
// Draw here
DrawJsonModel(MathmodRef->RootObjet.MyJsonObject
Selection.at(i).toObject());
return;
}
}
} }
} }
} }
return; return;
} }
} }
void DrawingOptions::slot_pushButton_2_clicked() void DrawingOptions::slot_pushButton_2_clicked()
{ {
MathmodRef->RootObjet.MyJsonObjectSelection.append(MathmodRef->RootObjet.Cur rentJsonObject); MathmodRef->RootObjet.MyJsonObjectSelection.append(MathmodRef->RootObjet.Cur rentJsonObject);
skipping to change at line 3356 skipping to change at line 3430
copyCurrentObject2.remove("Cnd"); copyCurrentObject2.remove("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);
copyCurrentObject["Iso3D"] = copyCurrentObject2; copyCurrentObject["Iso3D"] = copyCurrentObject2;
} }
} }
} }
else if (copyCurrentObject["Param3D"].isObject()) else if (copyCurrentObject["Param3D"].isObject() || copyCurrentObject["Param 3D_C"].isObject())
{ {
copyCurrentObject.remove("Iso3D"); copyCurrentObject.remove("Iso3D");
QJsonObject copyCurrentObject2 = copyCurrentObject["Param3D"].toObject() QJsonObject copyCurrentObject2 =
; copyCurrentObject["Param3D"].isObject() ? copyCurrentObject["Par
am3D"].toObject() : copyCurrentObject["Param3D_C"].toObject();
if (IndexcurrentComponent != -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(IndexcurrentComponent, copyCurrentObject2, Mandator yParmetric3DFields[ui]); removeat(IndexcurrentComponent, copyCurrentObject2, Mandator yParmetric3DFields[ui]);
removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid"); removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid"); removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
removeat2(IndexcurrentComponent, 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; if(copyCurrentObject["Param3D"].isObject())
copyCurrentObject["Param3D"] = copyCurrentObject2;
else
copyCurrentObject["Param3D_C"] = copyCurrentObject2;
} }
else if (((copyCurrentObject["Param3D"].toObject())["Component"].toA rray()).count() > 0 && else if ((((copyCurrentObject["Param3D"].toObject())["Component"].to Array()).count() > 0 &&
IndexcurrentComponent > -1 && IndexcurrentComponent < IndexcurrentComponent > -1 && IndexcurrentComponent <
((copyCurrentObject["Param3D"].toObject())["Component"].toA rray()).size() && ((copyCurrentObject["Param3D"].toObject())["Component"].toA rray()).size() &&
((copyCurrentObject["Param3D"].toObject())["Component"].toA rray())[IndexcurrentComponent].toString().replace(" ", "") == ((copyCurrentObject["Param3D"].toObject())["Component"].toA rray())[IndexcurrentComponent].toString().replace(" ", "") ==
(ui.paramNameEdit->toPlainText()).replace(" ", "")) ||
(((copyCurrentObject["Param3D_C"].toObject())["Component"].
toArray()).count() > 0 &&
IndexcurrentComponent > -1 && IndexcurrentComponent <
((copyCurrentObject["Param3D_C"].toObject())["Component"].t
oArray()).size() &&
((copyCurrentObject["Param3D_C"].toObject())["Component"].t
oArray())[IndexcurrentComponent].toString().replace(" ", "") ==
(ui.paramNameEdit->toPlainText()).replace(" ", "")) (ui.paramNameEdit->toPlainText()).replace(" ", ""))
)
{ {
replaceat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui.XE dit); replaceat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui.XE dit);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui.YE dit); replaceat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui.YE dit);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui.ZE dit); replaceat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui.ZE dit);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui. umin); replaceat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui. umin);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui. umax); replaceat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui. umax);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui. vmin); replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui. vmin);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui. vmax); replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui. 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);
skipping to change at line 3407 skipping to change at line 3492
} }
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; if(copyCurrentObject["Param3D"].isObject())
copyCurrentObject["Param3D"] = copyCurrentObject2;
else
copyCurrentObject["Param3D_C"] = copyCurrentObject2;
} }
else else
{ {
if (((copyCurrentObject["Param3D"].toObject())["Component"].toAr if ((((copyCurrentObject["Param3D"].toObject())["Component"].toA
ray())[IndexcurrentComponent].toString().replace(" ", "") != rray())[IndexcurrentComponent].toString().replace(" ", "") !=
(ui.paramNameEdit->toPlainText()).replace(" ", "")) (ui.paramNameEdit->toPlainText()).replace(" ", "")) ||
(((copyCurrentObject["Param3D_C"].toObject())["Component"].t
oArray())[IndexcurrentComponent].toString().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())
skipping to change at line 3479 skipping to change at line 3570
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; if(copyCurrentObject["Param3D"].isObject())
copyCurrentObject["Param3D"] = copyCurrentObject2;
else
copyCurrentObject["Param3D_C"] = copyCurrentObject2;
} }
} }
} }
else if (copyCurrentObject["Param4D"].isObject()) else if (copyCurrentObject["Param4D"].isObject() || copyCurrentObject["Param 4D_C"].isObject())
{ {
copyCurrentObject.remove("Iso3D"); copyCurrentObject.remove("Iso3D");
copyCurrentObject.remove("Param3D"); copyCurrentObject.remove("Param3D");
QJsonObject copyCurrentObject2 = copyCurrentObject["Param4D"].toObject() copyCurrentObject.remove("Param3D_C");
; QJsonObject copyCurrentObject2 = copyCurrentObject["Param4D"].isObject()
? copyCurrentObject["Param4D"].toObject() : copyCurrentObject["Param4D_C"].toOb
ject();
if (IndexcurrentComponent != -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(IndexcurrentComponent, copyCurrentObject2, Mandator yParmetric4DFields[ui]); removeat(IndexcurrentComponent, copyCurrentObject2, Mandator yParmetric4DFields[ui]);
removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid"); removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid"); removeat2(2*IndexcurrentComponent, copyCurrentObject2, "Grid");
copyCurrentObject["Param4D"] = copyCurrentObject2; if(copyCurrentObject["Param4D"].isObject())
copyCurrentObject["Param4D"] = copyCurrentObject2;
else
copyCurrentObject["Param4D_C"] = copyCurrentObject2;
} }
else if (((copyCurrentObject["Param4D"].toObject())["Component"].toA rray()).count() > 0 && else if ((((copyCurrentObject["Param4D"].toObject())["Component"].to Array()).count() > 0 &&
IndexcurrentComponent > -1 && IndexcurrentComponent <((copy CurrentObject["Param4D"].toObject())["Component"].toArray()).size() && IndexcurrentComponent > -1 && IndexcurrentComponent <((copy CurrentObject["Param4D"].toObject())["Component"].toArray()).size() &&
((copyCurrentObject["Param4D"].toObject())["Component"].toA rray())[IndexcurrentComponent].toString().replace(" ", "") ==(ui.paramNameEdit_2 ->toPlainText()).replace(" ", "")) ((copyCurrentObject["Param4D"].toObject())["Component"].toA rray())[IndexcurrentComponent].toString().replace(" ", "") ==(ui.paramNameEdit_2 ->toPlainText()).replace(" ", ""))
||
(((copyCurrentObject["Param4D_C"].toObject())["Component"].
toArray()).count() > 0 &&
IndexcurrentComponent > -1 && Indexcur
rentComponent <((copyCurrentObject["Param4D_C"].toObject())["Component"].toArray
()).size() &&
((copyCurrentObject["Param4D_C"].toObj
ect())["Component"].toArray())[IndexcurrentComponent].toString().replace(" ", ""
) ==(ui.paramNameEdit_2->toPlainText()).replace(" ", ""))
)
{ {
replaceat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui.XE dit_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui.XE dit_2);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui.YE dit_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui.YE dit_2);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui.ZE dit_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui.ZE dit_2);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Fw", ui.WE dit_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Fw", ui.WE dit_2);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui. umin_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui. umin_2);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui. umax_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui. umax_2);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui. vmin_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui. vmin_2);
replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui. vmax_2); replaceat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui. vmax_2);
copyCurrentObject["Param4D"] = copyCurrentObject2; if(copyCurrentObject["Param4D"].isObject())
copyCurrentObject["Param4D"] = copyCurrentObject2;
else
copyCurrentObject["Param4D_C"] = copyCurrentObject2;
} }
else else
{ {
if (((copyCurrentObject["Param4D"].toObject())["Component"].toAr if ((((copyCurrentObject["Param4D"].toObject())["Component"].toA
ray())[IndexcurrentComponent].toString().replace(" ", "") != rray())[IndexcurrentComponent].toString().replace(" ", "") !=
(ui.paramNameEdit_2->toPlainText()).replace(" ", "")) (ui.paramNameEdit_2->toPlainText()).replace(" ", "")) ||
(((copyCurrentObject["Param4D_C"].toObject())["Component
"].toArray())[IndexcurrentComponent].toString().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();
int pos=2*IndexcurrentComponent; int pos=2*IndexcurrentComponent;
array.append((array.at(pos).toString())); array.append((array.at(pos).toString()));
array.append((array.at(pos+1).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; if(copyCurrentObject["Param4D"].isObject())
copyCurrentObject["Param4D"] = copyCurrentObject2;
else
copyCurrentObject["Param4D_C"] = copyCurrentObject2;
} }
else else
{ {
insertat(IndexcurrentComponent, copyCurrentObject2, "Compone nt", ui.paramNameEdit_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Compone nt", ui.paramNameEdit_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui .XEdit_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Fx", ui .XEdit_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui .YEdit_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Fy", ui .YEdit_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui .ZEdit_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Fz", ui .ZEdit_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Fw", ui .WEdit_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Fw", ui .WEdit_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui.umin_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Umin", ui.umin_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui.umax_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Umax", ui.umax_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui.vmin_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Vmin", ui.vmin_2);
insertat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui.vmax_2); insertat(IndexcurrentComponent, copyCurrentObject2, "Vmax", ui.vmax_2);
copyCurrentObject["Param4D"] = copyCurrentObject2;
if(copyCurrentObject["Param4D"].isObject())
copyCurrentObject["Param4D"] = copyCurrentObject2;
else
copyCurrentObject["Param4D_C"] = copyCurrentObject2;
} }
} }
} }
} }
} }
void DrawingOptions::RunUpdatedJObject(QJsonObject &CurrentObject) void DrawingOptions::RunUpdatedJObject(QJsonObject &CurrentObject)
{ {
if (IndexcurrentComponent != -1) if (IndexcurrentComponent != -1)
{ {
if (CurrentObject["Iso3D"].isObject()) if (CurrentObject["Iso3D"].isObject())
{ {
CurrentObject.remove("Param3D"); CurrentObject.remove("Param3D");CurrentObject.remove("Param3D_C");
CurrentObject.remove("Param4D"); CurrentObject.remove("Param4D");CurrentObject.remove("Param4D_C");
CurrentObject.remove("ParIso"); CurrentObject.remove("ParIso");
DrawJsonModel(CurrentObject); DrawJsonModel(CurrentObject);
} }
else if (CurrentObject["Param3D"].isObject()) else if (CurrentObject["Param3D"].isObject() || CurrentObject["Param3D_C "].isObject())
{ {
CurrentObject.remove("Iso3D"); CurrentObject.remove("Iso3D");
CurrentObject.remove("Param4D"); CurrentObject.remove("Param4D");CurrentObject.remove("Param4D_C");
CurrentObject.remove("ParIso"); CurrentObject.remove("ParIso");
DrawJsonModel(CurrentObject); DrawJsonModel(CurrentObject);
} }
else if (CurrentObject["Param4D"].isObject()) else if (CurrentObject["Param4D"].isObject() || CurrentObject["Param4D_C "].isObject())
{ {
CurrentObject.remove("Iso3D"); CurrentObject.remove("Iso3D");
CurrentObject.remove("Param3D"); CurrentObject.remove("Param3D");CurrentObject.remove("Param3D_C");
CurrentObject.remove("ParIso"); CurrentObject.remove("ParIso");
DrawJsonModel(CurrentObject); DrawJsonModel(CurrentObject);
} }
else else
{ {
CurrentObject.remove("Iso3D"); CurrentObject.remove("Iso3D");
CurrentObject.remove("Param3D"); CurrentObject.remove("Param3D");
CurrentObject.remove("Param4D"); CurrentObject.remove("Param4D");
CurrentObject.remove("Param3D_C");
CurrentObject.remove("Param4D_C");
DrawJsonModel(CurrentObject); DrawJsonModel(CurrentObject);
} }
} }
} }
void DrawingOptions::on_updateButton_clicked() void DrawingOptions::on_updateButton_clicked()
{ {
QJsonObject CurrentObject = MathmodRef->RootObjet.CurrentJsonObject; QJsonObject CurrentObject = MathmodRef->RootObjet.CurrentJsonObject;
QJsonObject parisoComponent; QJsonObject parisoComponent;
if (CurrentObject["ParIso"].isArray()) if (CurrentObject["ParIso"].isArray())
skipping to change at line 3974 skipping to change at line 4092
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();
} }
void DrawingOptions::on_Norm_clicked()
{
MathmodRef->draw_norm_clicked();
}
void DrawingOptions::on_Fill_clicked() void DrawingOptions::on_Fill_clicked()
{ {
MathmodRef->fill(); MathmodRef->fill();
} }
void DrawingOptions::on_Trian_clicked() void DrawingOptions::on_Trian_clicked()
{ {
MathmodRef->slot_triangles_clicked(); MathmodRef->slot_triangles_clicked();
} }
skipping to change at line 4132 skipping to change at line 4245
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");
copyCurrentObject.remove("Param3D_C");
copyCurrentObject.remove("Param4D_C");
Multiplier(i, j, k, copyCurrentObject, IndexcurrentComponent); Multiplier(i, j, k, copyCurrentObject, IndexcurrentComponent);
// 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);
} }
skipping to change at line 4179 skipping to change at line 4294
// 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: // OpenGl diffuse:
SetDiffuseValues(Parameters->Diffuse); SetDiffuseValues(Parameters->Diffuse);
// OpenGl Ambient: // OpenGl Ambient:
SetAmbientValues(Parameters->Ambient); SetAmbientValues(Parameters->Ambient);
// Gl Front Face Suupport
if(!Parameters->glFrontFacingSupport)
SetglFrontFacingSupport();
// 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); //MathmodRef->setFixedSize(Parameters->GlwinW, Parameters->GlwinH);
// Pigment/texture // Pigment/texture
ui.textureEdit->hide(); ui.textureEdit->hide();
skipping to change at line 4961 skipping to change at line 5079
} }
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->LocalScene.shininess = Parameters->Shininess; MathmodRef->LocalScene.shininess = Parameters->Shininess;
} }
void DrawingOptions::SetglFrontFacingSupport()
{
ui.GLFrontSurfaceSupport->blockSignals(true);
ui.GLFrontSurfaceSupport->setChecked(false);
ui.GLFrontSurfaceSupport->blockSignals(false);
MathmodRef->LocalScene.glFrontFacingSupport = 0;
}
void DrawingOptions::on_red_Specular_valueChanged(int value) void DrawingOptions::on_red_Specular_valueChanged(int value)
{ {
MathmodRef->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->greenSpec(value); MathmodRef->greenSpec(value);
} }
skipping to change at line 5198 skipping to change at line 5324
{ {
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() + "/documentation/index.ht ml"; QString link = QApplication::applicationDirPath() + "/../Resources/documenta tion/index.html";
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)
skipping to change at line 5315 skipping to change at line 5441
void DrawingOptions::on_blue_Diffuse_valueChanged(int value) void DrawingOptions::on_blue_Diffuse_valueChanged(int value)
{ {
MathmodRef->blueDiff(value); MathmodRef->blueDiff(value);
} }
void DrawingOptions::on_transparent_Diffuse_valueChanged(int value) void DrawingOptions::on_transparent_Diffuse_valueChanged(int value)
{ {
MathmodRef->transDiff(value); MathmodRef->transDiff(value);
} }
void DrawingOptions::on_GLFrontSurfaceSupport_clicked()
{
if(!(ui.GLFrontSurfaceSupport->isChecked()))
MathmodRef->glfrontfacesupp(0);
else
MathmodRef->glfrontfacesupp(1);
}
 End of changes. 58 change blocks. 
54 lines changed or deleted 208 lines changed or added

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