bool Plot3DDialog::updatePlot() { int axis=-1; if (generalDialog->currentWidget()==(QWidget*)bars) { emit updateBars(boxBarsRad->text().toDouble()); } if (generalDialog->currentWidget()==(QWidget*)points) { if (boxPointStyle->currentItem() == 0) emit updatePoints(boxSize->text().toDouble(), boxSmooth->isChecked()); else if (boxPointStyle->currentItem() == 1) emit updateCross(boxCrossRad->text().toDouble(), boxCrossLinewidth->text().toDouble(), boxCrossSmooth->isChecked(), boxBoxed->isChecked()); else if (boxPointStyle->currentItem() == 2) emit updateCones(boxConesRad->text().toDouble(), boxQuality->value()); } if (generalDialog->currentWidget()==(QWidget*)title) { emit updateTitle(boxTitle->text(),titleColor,titleFont); } if (generalDialog->currentWidget()==(QWidget*)colors) { emit updateTransparency(boxTransparency->value()*0.01); emit updateDataColors(fromColor,toColor); emit updateColors(meshColor,axesColor,numColor,labelColor,bgColor,gridColor); } if (generalDialog->currentWidget()==(QWidget*)general) { emit showColorLegend(boxLegend->isChecked()); emit updateMeshLineWidth(boxMeshLineWidth->value()); emit adjustLabels(boxDistance->value()); emit updateResolution (boxResolution->value()); emit showColorLegend(boxLegend->isChecked()); emit setNumbersFont(numbersFont); emit updateZoom(boxZoom->value()*0.01); emit updateScaling(boxXScale->value()*0.01,boxYScale->value()*0.01, boxZScale->value()*0.01); } if (generalDialog->currentWidget()==(QWidget*)scale) { axis=axesList->currentRow(); QString from=boxFrom->text().toLower(); QString to=boxTo->text().toLower(); double start,end; bool error=false; try { MyParser parser; parser.SetExpr(from.toAscii().constData()); start=parser.Eval(); } catch(mu::ParserError &e) { QMessageBox::critical(0,tr("Start limit error"), QString::fromStdString(e.GetMsg())); boxFrom->setFocus(); error=true; return false; } try { MyParser parser; parser.SetExpr(to.toAscii().constData()); end=parser.Eval(); } catch(mu::ParserError &e) { QMessageBox::critical(0,tr("End limit error"), QString::fromStdString(e.GetMsg())); boxTo->setFocus(); error=true; return false; } if (start>=end) { QMessageBox::critical(0,tr("Input error"), tr("Please enter scale limits that satisfy: from < to!")); boxTo->setFocus(); return false; } if (! error) emit updateScale(axis,scaleOptions(axis, start, end, boxMajors->text(), boxMinors->text())); } if (generalDialog->currentWidget()==(QWidget*)axes) { axis=axesList2->currentRow(); labels[axis] = boxLabel->text(); emit updateLabel(axis, boxLabel->text(),axisFont(axis)); emit updateTickLength(axis,boxMajorLength->text().toDouble(), boxMinorLength->text().toDouble()); } return true; }
bool Plot3DDialog::updatePlot() { if (!d_plot) return false; ApplicationWindow *app = (ApplicationWindow *)this->parent(); if (!app) return false; if (generalDialog->currentPage()==(QWidget*)bars){ d_plot->setBarRadius(boxBarsRad->text().toDouble()); d_plot->setBarStyle(); } else if (generalDialog->currentPage() == (QWidget*)points){ if (boxPointStyle->currentIndex() == 0) { d_plot->setDotOptions(boxSize->text().toDouble(), boxSmooth->isChecked()); d_plot->setDotStyle(); } else if (boxPointStyle->currentIndex() == 1){ d_plot->setCrossOptions(boxCrossRad->text().toDouble(), boxCrossLinewidth->text().toDouble(), boxCrossSmooth->isChecked(), boxBoxed->isChecked()); d_plot->setCrossStyle(); } else if (boxPointStyle->currentIndex() == 2) { d_plot->setConeOptions(boxConesRad->text().toDouble(), boxQuality->value()); d_plot->setConeStyle(); } app->custom3DActions(d_plot); } else if (generalDialog->currentPage()==(QWidget*)title){ d_plot->setTitle(boxTitle->text().remove("\n"), btnTitleColor->color(), titleFont); } else if (generalDialog->currentPage()==(QWidget*)colors){ d_plot->changeTransparency(boxTransparency->value()*0.01); d_plot->setDataColors(btnFromColor->color(), btnToColor->color()); d_plot->setMeshColor(btnMesh->color()); d_plot->setAxesColor(btnAxes->color()); d_plot->setNumbersColor(btnNumbers->color()); d_plot->setLabelsColor(btnLabels->color()); d_plot->setBackgroundColor(btnBackground->color()); d_plot->setGridColor(btnGrid->color()); } else if (generalDialog->currentPage()==(QWidget*)general){ d_plot->showColorLegend(boxLegend->isChecked()); d_plot->setResolution(boxResolution->value()); d_plot->setMeshLineWidth(boxMeshLineWidth->value()); d_plot->setLabelsDistance(boxDistance->value()); d_plot->setNumbersFont(numbersFont); d_plot->setZoom(boxZoom->value()*0.01); d_plot->setScale(boxXScale->value()*0.01, boxYScale->value()*0.01, boxZScale->value()*0.01); } else if (generalDialog->currentPage()==(QWidget*)scale){ int axis = axesList->currentRow(); QString from=boxFrom->text().lower(); QString to=boxTo->text().lower(); double start, end; try { MyParser parser; parser.SetExpr(from.ascii()); start = parser.Eval(); } catch(mu::ParserError &e){ QMessageBox::critical(0,tr("QtiPlot - Start limit error"), QString::fromStdString(e.GetMsg())); boxFrom->setFocus(); return false; } try { MyParser parser; parser.SetExpr(to.ascii()); end = parser.Eval(); } catch(mu::ParserError &e){ QMessageBox::critical(0,tr("QtiPlot - End limit error"), QString::fromStdString(e.GetMsg())); boxTo->setFocus(); return false; } d_plot->updateScale(axis, scaleOptions(axis, start, end, boxMajors->text(), boxMinors->text())); } else if (generalDialog->currentPage()==(QWidget*)axes){ int axis = axesList2->currentRow(); labels[axis] = boxLabel->text(); switch(axis) { case 0: d_plot->setXAxisLabel(boxLabel->text().remove("\n")); d_plot->setXAxisLabelFont(axisFont(axis)); d_plot->setXAxisTickLength(boxMajorLength->text().toDouble(), boxMinorLength->text().toDouble()); break; case 1: d_plot->setYAxisLabel(boxLabel->text().remove("\n")); d_plot->setYAxisLabelFont(axisFont(axis)); d_plot->setYAxisTickLength(boxMajorLength->text().toDouble(), boxMinorLength->text().toDouble()); break; case 2: d_plot->setZAxisLabel(boxLabel->text().remove("\n")); d_plot->setZAxisLabelFont(axisFont(axis)); d_plot->setZAxisTickLength(boxMajorLength->text().toDouble(), boxMinorLength->text().toDouble()); break; } } d_plot->update(); app->modifiedProject(d_plot); return true; }