예제 #1
0
void Plot3DDialog::setPlot(Graph3D *g)
{
	if (!g)
		return;

	d_plot = g;

	btnFromColor->setColor(g->minDataColor());
	btnToColor->setColor(g->maxDataColor());
	btnTitleColor->setColor(g->titleColor());
	btnMesh->setColor(g->meshColor());
	btnAxes->setColor(g->axesColor());
	btnNumbers->setColor(g->numColor());
	btnLabels->setColor(g->labelColor());
	btnBackground->setColor(g->bgColor());
	btnGrid->setColor(g->gridColor());

	boxMeshLineWidth->setValue(g->meshLineWidth());
	boxTransparency->setValue(int(100*g->transparency()));

	boxTitle->setText(g->plotTitle());
	titleFont = g->titleFont();

	boxZoom->setValue(int(g->zoom()*100));
	boxXScale->setValue(int(g->xScale()*100));
	boxYScale->setValue(int(g->yScale()*100));
	boxZScale->setValue(int(g->zScale()*100));
	boxResolution->setValue(g->resolution());
	boxLegend->setChecked(g->isLegendOn());
	boxOrthogonal->setChecked(g->isOrthogonal());

	labels = g->axesLabels();
	boxLabel->setText(labels[0]);

	tickLengths = g->axisTickLengths();
	boxMajorLength->setText(tickLengths[0]);
	boxMinorLength->setText(tickLengths[1]);

	xAxisFont = g->xAxisLabelFont();
	yAxisFont = g->yAxisLabelFont();
	zAxisFont = g->zAxisLabelFont();

	scales = g->scaleLimits();
	boxFrom->setText(scales[0]);
	boxTo->setText(scales[1]);
	boxMajors->setValue(scales[2].toInt());
	boxMinors->setValue(scales[3].toInt());
	boxType->setCurrentIndex(scales[4].toInt());

	boxDistance->setValue(g->labelsDistance());
	numbersFont = g->numbersFont();

	if (g->coordStyle() == Qwt3D::NOCOORD){
		TicksGroupBox->setDisabled(true);
		generalDialog->setTabEnabled(axes,false);
		AxesColorGroupBox->setDisabled(true);
		boxDistance->setDisabled(true);
		btnNumbersFont->setDisabled(true);
	}

	Qwt3D::PLOTSTYLE style = g->plotStyle();
	Graph3D::PointStyle pt = g->pointType();

	if ( style == Qwt3D::USER ){
			switch (pt)
			{
				case Graph3D::None :
					break;

				case Graph3D::Dots :
					disableMeshOptions();
					initPointsOptionsStack();
					showPointsTab (g->pointsSize(), g->smoothPoints());
					break;

				case Graph3D::VerticalBars :
					showBarsTab(g->barsRadius());
					break;

				case Graph3D::HairCross :
					disableMeshOptions();
					initPointsOptionsStack();
					showCrossHairTab (g->crossHairRadius(), g->crossHairLinewidth(),
							g->smoothCrossHair(), g->boxedCrossHair());
					break;

				case Graph3D::Cones :
					disableMeshOptions();
					initPointsOptionsStack();
					showConesTab(g->coneRadius(), g->coneQuality());
					break;
			}
		}
		else if ( style == Qwt3D::FILLED )
			disableMeshOptions();
		else if (style == Qwt3D::HIDDENLINE || style == Qwt3D::WIREFRAME)
			boxLegend->setDisabled(true);

		if (g->grids() == 0)
			btnGrid->setDisabled(true);

		if (g->userFunction() || g->parametricSurface())
			btnTable->hide();
		else if (g->table())
            btnTable->setText(tr("&Worksheet"));
		else if (g->matrix())
			btnTable->setText(tr("&Matrix"));

	connect( boxMeshLineWidth, SIGNAL(valueChanged(double)), d_plot, SLOT(setMeshLineWidth(double)));
	connect( boxOrthogonal, SIGNAL(toggled(bool)), d_plot, SLOT(setOrthogonal(bool)));
	connect( boxLegend, SIGNAL(toggled(bool)), d_plot, SLOT(showColorLegend(bool)));
    connect( boxResolution, SIGNAL(valueChanged(int)), d_plot, SLOT(setResolution(int)));
	connect( boxDistance, SIGNAL(valueChanged(int)), d_plot, SLOT(setLabelsDistance(int)));
};
예제 #2
0
void Plot3DDialog::setPlot(Graph3D *g)
{
    if (!g)
        return;

    d_plot = g;

    LinearColorMap colors = g->colorMap();
    d_color_map_editor->setRange(colors.intensityRange());
    d_color_map_editor->setColorMap(colors);

    btnTitleColor->setColor(g->titleColor());
    btnMesh->setColor(g->meshColor());
    btnAxes->setColor(g->axesColor());
    btnNumbers->setColor(g->numColor());
    btnLabels->setColor(g->labelColor());
    btnBackground->setColor(g->bgColor());

    //Set major grid properties
    Qwt3D::GridLine majorGridLine = g->surface()->coordinates()->majorGridLine(Qwt3D::X1);
    boxMajorGrids->setChecked(majorGridLine.visible_);
    RGBA color = majorGridLine.color_;
    btnGrid->setColor(GL2Qt(color.r, color.g, color.b));
    boxMajorGridWidth->setValue(majorGridLine.width_);
    boxMajorGridStyle->setCurrentIndex(majorGridLine.style_);

    //Set minor grid properties
    Qwt3D::GridLine minorGridLine = g->surface()->coordinates()->minorGridLine(Qwt3D::X1);
    boxMinorGrids->setChecked(minorGridLine.visible_);
    color = minorGridLine.color_;
    btnGridMinor->setColor(GL2Qt(color.r, color.g, color.b));
    boxMinorGridWidth->setValue(minorGridLine.width_);
    boxMinorGridStyle->setCurrentIndex(minorGridLine.style_);

    d_color_map_file = g->colorMapFile();
    setColorMapPreview(d_color_map_file);
    linearColorMapGroupBox->setChecked(d_color_map_file.isEmpty());
    colorMapFileGroupBox->setChecked(!d_color_map_file.isEmpty());

    boxMeshLineWidth->setValue(g->meshLineWidth());

    boxTransparency->blockSignals(true);
    boxTransparency->setValue(int(100*g->transparency()));
    boxTransparency->blockSignals(false);
    transparencySlider->blockSignals(true);
    transparencySlider->setValue(boxTransparency->value());
    transparencySlider->blockSignals(false);

    boxTitle->setText(g->plotTitle());
    titleFont = g->titleFont();

    xScale = d_plot->xScale();
    yScale = d_plot->yScale();
    zScale = d_plot->zScale();
    zoom = d_plot->zoom();

    boxZoom->setValue(100);
    boxXScale->setValue(100);
    boxYScale->setValue(100);
    boxZScale->setValue(100);

    boxXRotation->blockSignals(true);
    boxXRotation->setValue(g->xRotation());
    boxXRotation->blockSignals(false);
    boxYRotation->blockSignals(true);
    boxYRotation->setValue(g->yRotation());
    boxYRotation->blockSignals(false);
    boxZRotation->blockSignals(true);
    boxZRotation->setValue(g->zRotation());
    boxZRotation->blockSignals(false);

    boxResolution->setValue(g->resolution());
    boxLegend->setChecked(g->isLegendOn());
    boxOrthogonal->setChecked(g->isOrthogonal());

    labels = g->axesLabels();
    boxLabel->setText(labels[0]);

    QStringList tickLengths = g->axisTickLengths();
    boxMajorLength->setValue(tickLengths[0].toDouble());
    boxMinorLength->setValue(tickLengths[1].toDouble());

    xAxisFont = g->xAxisLabelFont();
    yAxisFont = g->yAxisLabelFont();
    zAxisFont = g->zAxisLabelFont();

    viewScaleLimits(0);
    viewAxisOptions(0);

    boxDistance->setValue(g->labelsDistance());
    numbersFont = g->numbersFont();

    if (g->coordStyle() == Qwt3D::NOCOORD) {
        TicksGroupBox->setDisabled(true);
        generalDialog->setTabEnabled(axes,false);
        AxesColorGroupBox->setDisabled(true);
        boxDistance->setDisabled(true);
        btnNumbersFont->setDisabled(true);
    }

    Qwt3D::PLOTSTYLE style = g->plotStyle();
    Graph3D::PointStyle pt = g->pointType();

    if ( style == Qwt3D::USER ) {
        switch (pt)
        {
        case Graph3D::None :
            break;

        case Graph3D::Dots :
            disableMeshOptions();
            initPointsOptionsStack();
            showPointsTab (g->pointsSize(), g->smoothPoints());
            break;

        case Graph3D::VerticalBars :
            showBarsTab();
            break;

        case Graph3D::HairCross :
            disableMeshOptions();
            initPointsOptionsStack();
            showCrossHairTab (g->crossHairRadius(), g->crossHairLinewidth(),
                              g->smoothCrossHair(), g->boxedCrossHair());
            break;

        case Graph3D::Cones :
            disableMeshOptions();
            initPointsOptionsStack();
            showConesTab(g->coneRadius(), g->coneQuality());
            break;
        }
    }
    else if ( style == Qwt3D::FILLED )
        disableMeshOptions();
    else if (style == Qwt3D::HIDDENLINE || style == Qwt3D::WIREFRAME)
        boxLegend->setDisabled(true);

    if (g->grids() == 0)
        gridPage->setDisabled(true);

    if (g->parametricSurface())
        btnTable->hide();
    else if (g->table())
        btnTable->setText(tr("&Worksheet"));
    else if (g->matrix() || g->userFunction())
        btnTable->setText(tr("&Matrix"));

    boxPrintCropmarks->setChecked(g->printCropmarksEnabled());
    boxScaleOnPrint->setChecked(g->scaleOnPrint());

    initConnections();
}