1
/***************************************************************************
4
--------------------------------------------------------------------
5
Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6
Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7
Description : 3D graph widget
9
***************************************************************************/
11
/***************************************************************************
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
28
***************************************************************************/
33
#include "core/column/Column.h"
35
#include <QApplication>
36
#include <QMessageBox>
37
#include <QFileDialog>
44
#include <QImageWriter>
46
#include <qwt3d_io_gl2ps.h>
47
#include <qwt3d_coordsys.h>
49
#include <gsl/gsl_vector.h>
52
UserFunction::UserFunction(const QString& s, SurfacePlot& pw)
58
double UserFunction::operator()(double x, double y)
60
if (formula.isEmpty())
67
parser.DefineVar("x", &x);
68
parser.DefineVar("y", &y);
70
parser.SetExpr((const std::string)formula.toAscii().constData());
73
catch(mu::ParserError &e)
75
QMessageBox::critical(0,"Input function error",QString::fromStdString(e.GetMsg()));
80
UserFunction::~UserFunction()
84
Graph3D::Graph3D(const QString& label, QWidget* parent, const char* name, Qt::WFlags f)
85
: MyWidget(label,parent,name,f)
90
void Graph3D::initPlot()
94
plotAssociation = QString();
96
QDateTime dt = QDateTime::currentDateTime ();
97
setBirthDate(dt.toString(Qt::LocalDate));
99
color_map = QString::null;
100
animation_redraw_wait = 50;
101
d_timer = new QTimer(this);
102
connect(d_timer, SIGNAL(timeout()), this, SLOT(rotate()) );
105
sp = new SurfacePlot(this);
107
sp->installEventFilter(this);
108
sp->setRotation(30,0,15);
110
sp->setShift(0.15,0,0);
115
sp->setSmoothMesh(smoothMesh);
122
titleCol = QColor(Qt::black);
123
sp->setTitleColor(Qt2GL(titleCol));
125
titleFnt = QFont("Times New Roman",14);
126
titleFnt.setBold(true);
128
sp->setTitleFont(titleFnt.family(),titleFnt.pointSize(),
129
titleFnt.weight(),titleFnt.italic());
131
axesCol=QColor(Qt::black);
132
labelsCol=QColor(Qt::black);
133
numCol=QColor(Qt::black);
134
meshCol=QColor(Qt::black);
135
gridCol=QColor(Qt::black);
136
bgCol=QColor(255, 255, 255);
137
fromColor=QColor(Qt::red);
138
toColor=QColor(Qt::blue);
143
legendMajorTicks = 5;
144
sp->showColorLegend(legendOn);
145
sp->legend()->setAutoScale(true);
146
sp->legend()->setMajors (legendMajorTicks) ;
150
scaleType=QVector<int>(3);
151
for (int j=0;j<3;j++)
158
pointSize = 5; smooth = false;
159
crossHairRad = 0.03, crossHairLineWidth = 2;
160
crossHairSmooth = true, crossHairBoxed = false;
161
conesQuality = 32; conesRad = 0.5;
166
connect(sp,SIGNAL(rotationChanged(double, double, double)),this,SLOT(rotationChanged(double, double, double)));
167
connect(sp,SIGNAL(zoomChanged(double)),this,SLOT(zoomChanged(double)));
168
connect(sp,SIGNAL(scaleChanged(double, double, double)),this,SLOT(scaleChanged(double, double, double)));
169
connect(sp,SIGNAL(shiftChanged(double, double, double)),this,SLOT(shiftChanged(double, double, double)));
172
void Graph3D::initCoord()
175
for (unsigned i=0; i!=sp->coordinates()->axes.size(); ++i)
177
sp->coordinates()->axes[i].setMajors(5);
178
sp->coordinates()->axes[i].setMinors(5);
181
QString s = tr("X axis");
182
sp->coordinates()->axes[X1].setLabelString(s);
183
sp->coordinates()->axes[X2].setLabelString(s);
184
sp->coordinates()->axes[X3].setLabelString(s);
185
sp->coordinates()->axes[X4].setLabelString(s);
189
sp->coordinates()->axes[Y1].setLabelString(s);
190
sp->coordinates()->axes[Y2].setLabelString(s);
191
sp->coordinates()->axes[Y3].setLabelString(s);
192
sp->coordinates()->axes[Y4].setLabelString(s);
196
sp->coordinates()->axes[Z1].setLabelString(s);
197
sp->coordinates()->axes[Z2].setLabelString(s);
198
sp->coordinates()->axes[Z3].setLabelString(s);
199
sp->coordinates()->axes[Z4].setLabelString(s);
202
sp->setCoordinateStyle(BOX);
203
sp->coordinates()->setAutoScale(false);
206
void Graph3D::addFunction(const QString& s,double xl,double xr,double yl,
207
double yr,double zl,double zr)
210
sp->resize(this->size());
212
func= new UserFunction(s, *sp);
214
func->setMesh(41,31);
215
func->setDomain(xl,xr,yl,yr);
220
sp->legend()->setLimits(zl,zr);
222
if (sp->plotStyle() == NOPLOT)
224
sp->setPlotStyle(FILLED);
228
sp->createCoordinateSystem(Triple(xl, yl, zl), Triple(xr, yr, zr));
232
void Graph3D::insertFunction(const QString& s,double xl,double xr,double yl,
233
double yr,double zl,double zr)
235
addFunction(s,xl,xr,yl,yr,zl,zr);
239
void Graph3D::addData(Table* table, int xcol, int ycol)
242
int r=table->numRows();
243
int i, xmesh=0, ymesh=2;
244
for (i = 0; i < r; i++)
246
if (!table->column(xcol)->isInvalid(i) && !table->column(ycol)->isInvalid(i))
253
double **data = Matrix::allocateMatrixData(xmesh, ymesh);
254
gsl_vector * x = gsl_vector_alloc (xmesh);
255
gsl_vector * y = gsl_vector_alloc (xmesh);
257
for (int j = 0; j < ymesh; j++)
260
for (i = 0; i < r; i++)
262
if (!table->column(xcol)->isInvalid(i) && !table->column(ycol)->isInvalid(i))
264
gsl_vector_set (x, k, table->cell(i, xcol));
266
double yv = table->cell(i, ycol);
267
gsl_vector_set (y, k, yv);
274
double maxy=gsl_vector_max(y);
275
double maxz=0.6*maxy;
277
sp->legend()->setLimits(gsl_vector_min(y),maxy);
278
sp->loadFromData(data, xmesh, ymesh, gsl_vector_min(x),gsl_vector_max(x),0,maxz);
285
Matrix::freeMatrixData(data, xmesh);
288
void Graph3D::addData(Table* table,const QString& colName)
290
int ycol = table->colIndex(colName);
291
int xcol=table->colX(ycol);
292
plotAssociation = table->colName(xcol)+"(X)," + colName + "(Y)";
294
addData(table, xcol, ycol);
297
void Graph3D::addData(Table* table,const QString& xColName,const QString& yColName)
299
int xcol=table->colIndex(xColName);
300
plotAssociation = table->colName(xcol)+"(X)," + yColName+"(Y)";
302
addData(table, xcol, table->colIndex(yColName));
305
void Graph3D::changeMatrix(Matrix* m)
313
void Graph3D::addMatrixData(Matrix* m)
318
bool first_time = false;
323
plotAssociation = "matrix<" + QString(m->name()) + ">";
325
int cols = m->numCols();
326
int rows = m->numRows();
327
double **data_matrix = Matrix::allocateMatrixData(rows, cols);
328
for (int i = 0; i < rows; i++ )
330
for (int j = 0; j < cols; j++)
331
data_matrix[i][j] = m->cell(i,j);
335
sp->loadFromData(data_matrix, rows, cols, m->xStart(), m->xEnd(),
336
m->yStart(), m->yEnd());
339
sp->coordinates()->axes[Z1].limits (start, end);
340
sp->legend()->setLimits(start, end);
341
sp->legend()->setMajors(legendMajorTicks);
343
Matrix::freeMatrixData(data_matrix, rows);
345
if (d_autoscale || first_time)
350
void Graph3D::addMatrixData(Matrix* m, double xl, double xr,
351
double yl, double yr, double zl, double zr)
354
plotAssociation = "matrix<" + QString(m->name()) + ">";
356
updateScalesFromMatrix(xl, xr, yl, yr, zl, zr);
359
void Graph3D::addData(Table* table,const QString& xColName,const QString& yColName,
360
double xl, double xr, double yl, double yr, double zl, double zr)
363
int r=table->numRows();
364
int xcol=table->colIndex(xColName);
365
int ycol=table->colIndex(yColName);
367
QString s=table->colName(xcol)+"(X),";
371
int i, j, xmesh=0, ymesh=2;
374
for (i = 0; i < r; i++)
376
if (!table->column(xcol)->isInvalid(i) && !table->column(ycol)->isInvalid(i))
378
xv=table->cell(i, xcol);
379
if (xv>=xl && xv <= xr)
387
double **data = Matrix::allocateMatrixData(xmesh, ymesh);
388
for ( j = 0; j < ymesh; j++)
391
for ( i = 0; i < r; i++)
393
if (!table->column(xcol)->isInvalid(i) && !table->column(ycol)->isInvalid(i))
395
xv=table->cell(i,xcol);
396
if (xv>=xl && xv <= xr)
398
yv=table->cell(i,ycol);
411
sp->loadFromData(data, xmesh, ymesh, xl, xr, yl, yr);
412
sp->createCoordinateSystem(Triple(xl, yl, zl), Triple(xr, yr, zr));
413
sp->legend()->setLimits(zl, zr);
414
sp->legend()->setMajors(legendMajorTicks);
416
Matrix::freeMatrixData(data, xmesh);
419
void Graph3D::insertNewData(Table* table, const QString& colName)
421
int zCol=table->colIndex(colName);
422
int yCol=table->colY(zCol);
423
int xCol=table->colX(zCol);
425
addData(table, xCol, yCol, zCol, Trajectory);
429
void Graph3D::changeDataColumn(Table* table, const QString& colName)
431
int zCol=table->colIndex(colName);
432
int yCol=table->colY(zCol);
433
int xCol=table->colX(zCol);
435
plotAssociation = table->colName(xCol)+"(X)," + table->colName(yCol)+"(Y),";
436
plotAssociation += colName+"(Z)";
438
updateDataXYZ(table, xCol, yCol, zCol);
443
void Graph3D::addData(Table* table, int xCol,int yCol,int zCol, int type)
446
int r=table->numRows();
448
QString s=table->colName(xCol)+"(X),";
449
s+=table->colName(yCol)+"(Y),";
450
s+=table->colName(zCol)+"(Z)";
454
for ( i = 0; i < r; i++)
456
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i) && !table->column(zCol)->isInvalid(i))
463
Qwt3D::Triple **data=allocateData(columns,columns);
464
for (j = 0; j < columns; j++)
467
for ( i = 0; i < r; i++)
469
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i) && !table->column(zCol)->isInvalid(i))
471
double xv=table->cell(i,xCol);
472
double yv=table->cell(i,yCol);
473
double zv=table->cell(i,zCol);
475
data[k][j] = Triple(xv,yv,zv);
482
sp->loadFromData (data, columns, columns, false,false);
485
sp->coordinates()->axes[Z1].limits (start, end);
486
sp->legend()->setLimits(start, end);
487
sp->legend()->setMajors(legendMajorTicks);
491
Dot d(pointSize, smooth);
494
style_ = Qwt3D::USER;
496
else if (type == Trajectory)
499
sp->showColorLegend(legendOn);
503
sp->setPlotStyle(Bar(barsRad));
504
pointStyle=VerticalBars;
505
style_ = Qwt3D::USER;
510
deleteData(data,columns);
513
void Graph3D::addData(Table* table, int xCol,int yCol,int zCol,
514
double xl, double xr, double yl, double yr, double zl, double zr)
517
int r=table->numRows();
519
QString s=table->colName(xCol)+"(X),";
520
s+=table->colName(yCol)+"(Y),";
521
s+=table->colName(zCol)+"(Z)";
526
for ( i = 0; i < r; i++)
528
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i) && !table->column(zCol)->isInvalid(i))
530
xv=table->cell(i,xCol);
531
yv=table->cell(i,yCol);
532
if (xv >= xl && xv <= xr && yv >= yl && yv <= yr)
540
Qwt3D::Triple **data=allocateData(columns,columns);
541
for (j = 0; j < columns; j++)
544
for ( i = 0; i < r; i++)
546
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i) && !table->column(zCol)->isInvalid(i))
548
xv=table->cell(i,xCol);
549
yv=table->cell(i,yCol);
550
if (xv >= xl && xv <= xr && yv >= yl && yv <= yr)
552
double zv=table->cell(i,zCol);
554
data[k][j] = Triple(xv,yv,zr);
556
data[k][j] = Triple(xv,yv,zl);
558
data[k][j] = Triple(xv,yv,zv);
565
sp->loadFromData (data, columns, columns, false, false);
566
sp->createCoordinateSystem(Triple(xl, yl, zl), Triple(xr, yr, zr));
567
sp->legend()->setLimits(zl, zr);
568
sp->legend()->setMajors(legendMajorTicks);
570
deleteData(data,columns);
573
void Graph3D::updateData(Table* table)
575
if (func)// function plot
578
QString name = plotAssociation;
579
int pos=name.indexOf("_",0);
580
int posX=name.indexOf("(",pos);
581
QString xColName=name.mid(pos+1,posX-pos-1);
583
pos=name.indexOf(",",posX);
584
posX=name.indexOf("(",pos);
585
QString yColName=name.mid(pos+1,posX-pos-1);
587
int xCol=table->colIndex(xColName);
588
int yCol=table->colIndex(yColName);
590
if (name.contains("(Z)",true))
592
pos=name.indexOf(",",posX);
593
posX=name.indexOf("(",pos);
594
QString zColName=name.mid(pos+1,posX-pos-1);
595
int zCol=table->colIndex(zColName);
596
updateDataXYZ(table, xCol, yCol, zCol);
599
updateDataXY(table, xCol, yCol);
606
void Graph3D::updateDataXY(Table* table, int xCol, int yCol)
608
int r=table->numRows();
609
int i, j, xmesh=0, ymesh=2;
611
for (i = 0; i < r; i++)
613
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i))
619
sp->setPlotStyle(NOPLOT);
624
double **data = Matrix::allocateMatrixData(xmesh, ymesh);
625
gsl_vector * x = gsl_vector_alloc (xmesh);
626
gsl_vector * y = gsl_vector_alloc (xmesh);
628
for ( j = 0; j < ymesh; j++)
631
for ( i = 0; i < r; i++)
633
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i))
635
double xv=table->cell(i,xCol);
636
double yv=table->cell(i,yCol);
638
gsl_vector_set (x, k, xv);
639
gsl_vector_set (y, k, yv);
647
double minx=gsl_vector_min (x);
648
double maxx=gsl_vector_max(x);
649
double minz=gsl_vector_min (y);
650
double maxz=gsl_vector_max(y);
654
resetNonEmptyStyle();
655
sp->coordinates()->axes[Y1].limits (miny,maxy); //actual Y scale limits
656
sp->loadFromData(data, xmesh, ymesh, minx, maxx, miny, maxy);
657
sp->legend()->setLimits(minz,maxz);
658
sp->legend()->setMajors(legendMajorTicks);
660
gsl_vector_free (x);gsl_vector_free (y);
661
Matrix::freeMatrixData(data, xmesh);
664
void Graph3D::updateDataXYZ(Table* table, int xCol, int yCol, int zCol)
666
int r=table->numRows();
669
for ( i = 0; i < r; i++)
671
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i) && !table->column(zCol)->isInvalid(i))
677
sp->setPlotStyle(NOPLOT);
682
Qwt3D::Triple **data=allocateData(columns,columns);
683
gsl_vector * z = gsl_vector_alloc (columns);
685
for ( j = 0; j < columns; j++)
688
for ( i = 0; i < r; i++)
690
if (!table->column(xCol)->isInvalid(i) && !table->column(yCol)->isInvalid(i) && !table->column(zCol)->isInvalid(i))
692
double xv=table->cell(i,xCol);
693
double yv=table->cell(i,yCol);
694
double zv=table->cell(i,zCol);
696
gsl_vector_set (z, k, zv);
697
data[k][j] = Triple(xv,yv,zv);
703
double minz=gsl_vector_min(z);
704
double maxz=gsl_vector_max(z);
708
resetNonEmptyStyle();
710
sp->loadFromData (data, columns, columns, false,false);
711
sp->legend()->setLimits(minz,maxz);
712
sp->legend()->setMajors(legendMajorTicks);
714
deleteData(data,columns);
717
void Graph3D::updateMatrixData(Matrix* m)
719
int cols=m->numCols();
720
int rows=m->numRows();
722
double **data = Matrix::allocateMatrixData(rows, cols);
723
for (int i = 0; i < rows; i++ ){
724
for (int j = 0; j < cols; j++)
725
data[i][j] = m->cell(i, j);
728
sp->loadFromData(data, rows, cols, m->xStart(), m->xEnd(), m->yStart(), m->yEnd());
730
Qwt3D::Axis z_axis = sp->coordinates()->axes[Z1];
732
z_axis.limits (start, end);
733
z_axis.setMajors(z_axis.majors());
734
z_axis.setMajors(z_axis.minors());
736
sp->legend()->setLimits(start, end);
737
sp->legend()->setMajors(legendMajorTicks);
739
Matrix::freeMatrixData(data, rows);
745
void Graph3D::resetNonEmptyStyle()
747
if (sp->plotStyle() != Qwt3D::NOPLOT )
748
return; // the plot was not previousely emptied
750
if (style_== Qwt3D::USER)
751
{// reseting the right user plot style
758
sp->setPlotStyle(Dot(pointSize, smooth));
762
sp->setPlotStyle(Bar(barsRad));
766
sp->setPlotStyle(CrossHair(crossHairRad, crossHairLineWidth, crossHairSmooth, crossHairBoxed));
770
sp->setPlotStyle(Cone3D(conesRad, conesQuality));
775
sp->setPlotStyle(style_);
778
UserFunction* Graph3D::userFunction()
786
void Graph3D::update()
796
void Graph3D::adjustLabels(int val)
798
if (labelsDist != val)
801
sp->coordinates()->adjustLabels(val);
808
QFont Graph3D::numbersFont()
810
return sp->coordinates()->axes[X1].numberFont();
813
void Graph3D::setNumbersFont(const QFont& font)
815
sp->coordinates()->setNumberFont (font);
820
void Graph3D::setNumbersFont(const QStringList& lst)
822
QFont fnt=QFont(lst[1],lst[2].toInt(),lst[3].toInt(),lst[4].toInt());
823
sp->coordinates()->setNumberFont(fnt);
826
void Graph3D::setXAxisLabelFont(const QFont& fnt)
828
sp->coordinates()->axes[X1].setLabelFont(fnt);
829
sp->coordinates()->axes[X2].setLabelFont(fnt);
830
sp->coordinates()->axes[X3].setLabelFont(fnt);
831
sp->coordinates()->axes[X4].setLabelFont(fnt);
834
void Graph3D::setYAxisLabelFont(const QFont& fnt)
836
sp->coordinates()->axes[Y1].setLabelFont(fnt);
837
sp->coordinates()->axes[Y2].setLabelFont(fnt);
838
sp->coordinates()->axes[Y3].setLabelFont(fnt);
839
sp->coordinates()->axes[Y4].setLabelFont(fnt);
842
void Graph3D::setZAxisLabelFont(const QFont& fnt)
844
sp->coordinates()->axes[Z1].setLabelFont(fnt);
845
sp->coordinates()->axes[Z2].setLabelFont(fnt);
846
sp->coordinates()->axes[Z3].setLabelFont(fnt);
847
sp->coordinates()->axes[Z4].setLabelFont(fnt);
850
void Graph3D::setXAxisLabelFont(const QStringList& lst)
852
QFont fnt=QFont(lst[1],lst[2].toInt(),lst[3].toInt(),lst[4].toInt());
853
sp->coordinates()->axes[X1].setLabelFont(fnt);
854
sp->coordinates()->axes[X2].setLabelFont(fnt);
855
sp->coordinates()->axes[X3].setLabelFont(fnt);
856
sp->coordinates()->axes[X4].setLabelFont(fnt);
859
void Graph3D::setYAxisLabelFont(const QStringList& lst)
861
QFont fnt=QFont(lst[1],lst[2].toInt(),lst[3].toInt(),lst[4].toInt());
862
sp->coordinates()->axes[Y1].setLabelFont(fnt);
863
sp->coordinates()->axes[Y2].setLabelFont(fnt);
864
sp->coordinates()->axes[Y3].setLabelFont(fnt);
865
sp->coordinates()->axes[Y4].setLabelFont(fnt);
868
void Graph3D::setZAxisLabelFont(const QStringList& lst)
870
QFont fnt=QFont(lst[1],lst[2].toInt(),lst[3].toInt(),lst[4].toInt());
871
sp->coordinates()->axes[Z1].setLabelFont(fnt);
872
sp->coordinates()->axes[Z2].setLabelFont(fnt);
873
sp->coordinates()->axes[Z3].setLabelFont(fnt);
874
sp->coordinates()->axes[Z4].setLabelFont(fnt);
877
QStringList Graph3D::axisTickLengths()
880
double majorl,minorl;
882
sp->coordinates()->axes[X1].ticLength (majorl,minorl);
883
lst<<QString::number(majorl);
884
lst<<QString::number(minorl);
886
sp->coordinates()->axes[Y1].ticLength (majorl,minorl);
887
lst<<QString::number(majorl);
888
lst<<QString::number(minorl);
890
sp->coordinates()->axes[Z1].ticLength (majorl,minorl);
891
lst<<QString::number(majorl);
892
lst<<QString::number(minorl);
897
void Graph3D::setTickLengths(const QStringList& lst)
899
double majorl,minorl;
900
QStringList tick_length = lst;
901
if (int(lst.count()) > 6)
902
tick_length.remove(tick_length.first());
904
majorl=tick_length[0].toDouble();
905
minorl=tick_length[1].toDouble();
906
sp->coordinates()->axes[X1].setTicLength (majorl,minorl);
907
sp->coordinates()->axes[X2].setTicLength (majorl,minorl);
908
sp->coordinates()->axes[X3].setTicLength (majorl,minorl);
909
sp->coordinates()->axes[X4].setTicLength (majorl,minorl);
911
majorl=tick_length[2].toDouble();
912
minorl=tick_length[3].toDouble();
913
sp->coordinates()->axes[Y1].setTicLength (majorl,minorl);
914
sp->coordinates()->axes[Y2].setTicLength (majorl,minorl);
915
sp->coordinates()->axes[Y3].setTicLength (majorl,minorl);
916
sp->coordinates()->axes[Y4].setTicLength (majorl,minorl);
918
majorl=tick_length[4].toDouble();
919
minorl=tick_length[5].toDouble();
920
sp->coordinates()->axes[Z1].setTicLength (majorl,minorl);
921
sp->coordinates()->axes[Z2].setTicLength (majorl,minorl);
922
sp->coordinates()->axes[Z3].setTicLength (majorl,minorl);
923
sp->coordinates()->axes[Z4].setTicLength (majorl,minorl);
926
void Graph3D::updateTickLength(int axis,double majorLength, double minorLength)
928
double majorl,minorl;
932
sp->coordinates()->axes[X1].ticLength (majorl,minorl);
933
if (majorl != majorLength || minorl != minorLength)
935
sp->coordinates()->axes[X1].setTicLength (majorLength,minorLength);
936
sp->coordinates()->axes[X2].setTicLength (majorLength,minorLength);
937
sp->coordinates()->axes[X3].setTicLength (majorLength,minorLength);
938
sp->coordinates()->axes[X4].setTicLength (majorLength,minorLength);
943
sp->coordinates()->axes[Y1].ticLength (majorl,minorl);
944
if (majorl != majorLength || minorl != minorLength)
946
sp->coordinates()->axes[Y1].setTicLength (majorLength,minorLength);
947
sp->coordinates()->axes[Y2].setTicLength (majorLength,minorLength);
948
sp->coordinates()->axes[Y3].setTicLength (majorLength,minorLength);
949
sp->coordinates()->axes[Y4].setTicLength (majorLength,minorLength);
954
sp->coordinates()->axes[Z1].ticLength (majorl,minorl);
955
if (majorl != majorLength || minorl != minorLength)
957
sp->coordinates()->axes[Z1].setTicLength (majorLength,minorLength);
958
sp->coordinates()->axes[Z2].setTicLength (majorLength,minorLength);
959
sp->coordinates()->axes[Z3].setTicLength (majorLength,minorLength);
960
sp->coordinates()->axes[Z4].setTicLength (majorLength,minorLength);
967
void Graph3D::rotationChanged(double, double, double)
972
void Graph3D::scaleChanged(double, double, double)
977
void Graph3D::shiftChanged(double, double, double)
982
void Graph3D::zoomChanged(double)
987
void Graph3D::resetAxesLabels()
989
sp->coordinates()->axes[X1].setLabelString(labels[0]);
990
sp->coordinates()->axes[X2].setLabelString(labels[0]);
991
sp->coordinates()->axes[X3].setLabelString(labels[0]);
992
sp->coordinates()->axes[X4].setLabelString(labels[0]);
994
sp->coordinates()->axes[Y1].setLabelString(labels[1]);
995
sp->coordinates()->axes[Y2].setLabelString(labels[1]);
996
sp->coordinates()->axes[Y3].setLabelString(labels[1]);
997
sp->coordinates()->axes[Y4].setLabelString(labels[1]);
999
sp->coordinates()->axes[Z1].setLabelString(labels[2]);
1000
sp->coordinates()->axes[Z2].setLabelString(labels[2]);
1001
sp->coordinates()->axes[Z3].setLabelString(labels[2]);
1002
sp->coordinates()->axes[Z4].setLabelString(labels[2]);
1005
void Graph3D::setAxesLabels(const QStringList& l)
1007
QString label= l[0];
1008
sp->coordinates()->axes[X1].setLabelString(label);
1009
sp->coordinates()->axes[X2].setLabelString(label);
1010
sp->coordinates()->axes[X3].setLabelString(label);
1011
sp->coordinates()->axes[X4].setLabelString(label);
1014
sp->coordinates()->axes[Y1].setLabelString(label);
1015
sp->coordinates()->axes[Y2].setLabelString(label);
1016
sp->coordinates()->axes[Y3].setLabelString(label);
1017
sp->coordinates()->axes[Y4].setLabelString(label);
1020
sp->coordinates()->axes[Z1].setLabelString(label);
1021
sp->coordinates()->axes[Z2].setLabelString(label);
1022
sp->coordinates()->axes[Z3].setLabelString(label);
1023
sp->coordinates()->axes[Z4].setLabelString(label);
1028
void Graph3D::updateLabel(int axis,const QString& label, const QFont& f)
1033
if (labels[0] != label)
1035
sp->coordinates()->axes[X1].setLabelString(label);
1036
sp->coordinates()->axes[X2].setLabelString(label);
1037
sp->coordinates()->axes[X3].setLabelString(label);
1038
sp->coordinates()->axes[X4].setLabelString(label);
1041
if (sp->coordinates()->axes[X1].labelFont() != f)
1043
sp->coordinates()->axes[X1].setLabelFont (f);
1044
sp->coordinates()->axes[X2].setLabelFont (f);
1045
sp->coordinates()->axes[X3].setLabelFont (f);
1046
sp->coordinates()->axes[X4].setLabelFont (f);
1051
if (labels[1] != label)
1053
sp->coordinates()->axes[Y1].setLabelString(label);
1054
sp->coordinates()->axes[Y2].setLabelString(label);
1055
sp->coordinates()->axes[Y3].setLabelString(label);
1056
sp->coordinates()->axes[Y4].setLabelString(label);
1060
if (sp->coordinates()->axes[Y1].labelFont() != f)
1062
sp->coordinates()->axes[Y1].setLabelFont (f);
1063
sp->coordinates()->axes[Y2].setLabelFont (f);
1064
sp->coordinates()->axes[Y3].setLabelFont (f);
1065
sp->coordinates()->axes[Y4].setLabelFont (f);
1070
if (labels[2] != label)
1072
sp->coordinates()->axes[Z1].setLabelString(label);
1073
sp->coordinates()->axes[Z2].setLabelString(label);
1074
sp->coordinates()->axes[Z3].setLabelString(label);
1075
sp->coordinates()->axes[Z4].setLabelString(label);
1078
if (sp->coordinates()->axes[Z1].labelFont() != f)
1080
sp->coordinates()->axes[Z1].setLabelFont (f);
1081
sp->coordinates()->axes[Z2].setLabelFont (f);
1082
sp->coordinates()->axes[Z3].setLabelFont (f);
1083
sp->coordinates()->axes[Z4].setLabelFont (f);
1093
QFont Graph3D::xAxisLabelFont()
1095
return sp->coordinates()->axes[X1].labelFont();
1098
QFont Graph3D::yAxisLabelFont()
1100
return sp->coordinates()->axes[Y1].labelFont();
1103
QFont Graph3D::zAxisLabelFont()
1105
return sp->coordinates()->axes[Z1].labelFont();
1108
double Graph3D::xStart()
1111
sp->coordinates()->axes[X1].limits (start,stop);
1115
double Graph3D::xStop()
1118
sp->coordinates()->axes[X1].limits (start,stop);
1122
double Graph3D::yStart()
1125
sp->coordinates()->axes[Y1].limits (start,stop);
1129
double Graph3D::yStop()
1132
sp->coordinates()->axes[Y1].limits (start,stop);
1136
double Graph3D::zStart()
1139
sp->coordinates()->axes[Z1].limits (start,stop);
1143
double Graph3D::zStop()
1146
sp->coordinates()->axes[Z1].limits(start, stop);
1150
QStringList Graph3D::scaleLimits()
1156
sp->coordinates()->axes[X1].limits (start,stop);
1157
majors=sp->coordinates()->axes[X1].majors();
1158
minors=sp->coordinates()->axes[X1].minors();
1160
limits<<QString::number(start);
1161
limits<<QString::number(stop);
1162
limits<<QString::number(majors);
1163
limits<<QString::number(minors);
1164
limits<<QString::number(scaleType[0]);
1166
sp->coordinates()->axes[Y1].limits (start,stop);
1167
majors=sp->coordinates()->axes[Y1].majors();
1168
minors=sp->coordinates()->axes[Y1].minors();
1170
limits<<QString::number(start);
1171
limits<<QString::number(stop);
1172
limits<<QString::number(majors);
1173
limits<<QString::number(minors);
1174
limits<<QString::number(scaleType[1]);
1176
sp->coordinates()->axes[Z1].limits (start,stop);
1177
majors=sp->coordinates()->axes[Z1].majors();
1178
minors=sp->coordinates()->axes[Z1].minors();
1180
limits<<QString::number(start);
1181
limits<<QString::number(stop);
1182
limits<<QString::number(majors);
1183
limits<<QString::number(minors);
1184
limits<<QString::number(scaleType[2]);
1189
QStringList Graph3D::scaleTicks()
1194
majors=sp->coordinates()->axes[X1].majors();
1195
minors=sp->coordinates()->axes[X1].minors();
1196
limits<<QString::number(majors);
1197
limits<<QString::number(minors);
1199
majors=sp->coordinates()->axes[Y1].majors();
1200
minors=sp->coordinates()->axes[Y1].minors();
1201
limits<<QString::number(majors);
1202
limits<<QString::number(minors);
1204
majors=sp->coordinates()->axes[Z1].majors();
1205
minors=sp->coordinates()->axes[Z1].minors();
1206
limits<<QString::number(majors);
1207
limits<<QString::number(minors);
1212
void Graph3D::updateScale(int axis,const QStringList& options)
1214
double xMin,xMax,yMin,yMax,zMin,zMax;
1216
int majors, minors, newMaj, newMin;
1217
Qwt3D::Axis *targetAxes[4];
1223
targetAxes[0] = &sp->coordinates()->axes[X1];
1224
targetAxes[1] = &sp->coordinates()->axes[X2];
1225
targetAxes[2] = &sp->coordinates()->axes[X3];
1226
targetAxes[3] = &sp->coordinates()->axes[X4];
1227
min = &xMin; max = &xMax;
1230
targetAxes[0] = &sp->coordinates()->axes[Y1];
1231
targetAxes[1] = &sp->coordinates()->axes[Y2];
1232
targetAxes[2] = &sp->coordinates()->axes[Y3];
1233
targetAxes[3] = &sp->coordinates()->axes[Y4];
1234
min = &yMin; max = &yMax;
1237
targetAxes[0] = &sp->coordinates()->axes[Z1];
1238
targetAxes[1] = &sp->coordinates()->axes[Z2];
1239
targetAxes[2] = &sp->coordinates()->axes[Z3];
1240
targetAxes[3] = &sp->coordinates()->axes[Z4];
1241
min = &zMin; max = &zMax;
1245
majors = targetAxes[0]->majors();
1246
minors = targetAxes[0]->minors();
1248
sp->coordinates()->axes[X1].limits(xMin,xMax);
1249
sp->coordinates()->axes[Y1].limits(yMin,yMax);
1250
sp->coordinates()->axes[Z1].limits(zMin,zMax);
1252
if (*min != options[0].toDouble() || *max != options[1].toDouble()) {
1253
*min = options[0].toDouble();
1254
*max = options[1].toDouble();
1256
func->setDomain(xMin, xMax, yMin, yMax);
1257
func->setMinZ(zMin); func->setMaxZ(zMax);
1259
sp->createCoordinateSystem(Triple(xMin, yMin, zMin), Triple(xMax, yMax, zMax));
1261
updateScales(xMin, xMax, yMin, yMax, zMin, zMax);
1262
sp->legend()->setLimits(zMin, zMax);
1265
if (QString::number(scaleType[axis]) != options[4]) {
1266
if (options[4] == "0") {
1267
targetAxes[0]->setScale(LINEARSCALE);
1268
if (axis == 2) sp->legend()->setScale(LINEARSCALE);
1269
scaleType[axis] = 0;
1271
targetAxes[0]->setScale(LOG10SCALE);
1272
if (axis == 2) sp->legend()->setScale(LOG10SCALE);
1273
scaleType[axis] = 1;
1278
newMaj = options[2].toInt();
1279
if (majors != newMaj)
1280
for (int i=0; i<4; i++)
1281
targetAxes[i]->setMajors(newMaj);
1283
newMin = options[3].toInt();
1284
if (minors != newMin)
1285
for (int i=0; i<4; i++)
1286
targetAxes[i]->setMinors(newMin);
1292
void Graph3D::updateScales(double xl, double xr, double yl, double yr, double zl, double zr)
1294
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
1297
updateScalesFromMatrix(xl, xr, yl, yr, zl, zr);
1300
QString name= plotAssociation;
1302
int pos=name.indexOf("_",0);
1303
int posX=name.indexOf("(",pos);
1304
QString xColName=name.mid(pos+1,posX-pos-1);
1305
int xCol=worksheet->colIndex(xColName);
1307
pos=name.indexOf(",",posX);
1308
posX=name.indexOf("(",pos);
1309
QString yColName=name.mid(pos+1,posX-pos-1);
1310
int yCol=worksheet->colIndex(yColName);
1312
if (name.endsWith("(Z)",true))
1314
pos=name.indexOf(",",posX);
1315
posX=name.indexOf("(",pos);
1316
QString zColName=name.mid(pos+1,posX-pos-1);
1317
int zCol=worksheet->colIndex(zColName);
1319
updateScales(xl, xr, yl, yr, zl, zr, xCol, yCol, zCol);
1321
else if (name.endsWith("(Y)",true))
1322
updateScales(xl, xr, yl, yr, zl, zr, xCol, yCol);
1325
QApplication::restoreOverrideCursor();
1328
void Graph3D::updateScalesFromMatrix(double xl, double xr, double yl,
1329
double yr, double zl, double zr)
1331
double xStart = qMin(d_matrix->xStart(), d_matrix->xEnd());
1332
double xEnd = qMax(d_matrix->xStart(), d_matrix->xEnd());
1333
double yStart = qMin(d_matrix->yStart(), d_matrix->yEnd());
1334
double yEnd = qMax(d_matrix->yStart(), d_matrix->yEnd());
1336
double dx = fabs((xEnd - xStart)/double(d_matrix->numCols()-1));
1337
double dy = fabs((yEnd - yStart)/double(d_matrix->numRows()-1));
1339
int nc = int(fabs(xr - xl)/dx)+1;
1340
int nr = int(fabs(yr - yl)/dy)+1;
1342
double x_begin = qMin(xl, xr);
1343
double y_begin = qMin(yl, yr);
1345
double **data_matrix = Matrix::allocateMatrixData(nc, nr);
1346
for (int i = 0; i < nc; i++){
1347
double x = x_begin + i*dx;
1348
for (int j = 0; j < nr; j++){
1349
double y = y_begin + j*dy;
1350
if (x >= xStart && x <= xEnd && y >= yStart && y <= yEnd){
1351
int k = abs((y - yStart)/dy);
1352
int l = abs((x - xStart)/dx);
1353
double val = d_matrix->cell(k, l);
1355
data_matrix[i][j] = zr;
1357
data_matrix[i][j] = zl;
1359
data_matrix[i][j] = val;
1361
data_matrix[i][j] = 0.0;
1364
sp->loadFromData(data_matrix, nc, nr, xl, xr, yl, yr);
1365
Matrix::freeMatrixData(data_matrix, nc);
1367
sp->createCoordinateSystem(Triple(xl, yl, zl), Triple(xr, yr, zr));
1368
sp->legend()->setLimits(zl, zr);
1369
sp->legend()->setMajors(legendMajorTicks);
1373
void Graph3D::updateScales(double xl, double xr, double yl, double yr,double zl, double zr,
1376
int r=worksheet->numRows();
1377
int i, j, xmesh=0, ymesh=2;
1380
for (i = 0; i < r; i++)
1382
if (!worksheet->column(xcol)->isInvalid(i) && !worksheet->column(ycol)->isInvalid(i))
1384
xv=worksheet->cell(i,xcol);
1385
if (xv >= xl && xv <= xr)
1393
double **data = Matrix::allocateMatrixData(xmesh, ymesh);
1395
for ( j = 0; j < ymesh; j++)
1398
for ( i = 0; i < r; i++)
1400
if (!worksheet->column(xcol)->isInvalid(i) && !worksheet->column(ycol)->isInvalid(i))
1402
xv=worksheet->cell(i,xcol);
1403
if (xv >= xl && xv <= xr)
1405
yv=worksheet->cell(i,ycol);
1418
sp->loadFromData(data, xmesh, ymesh, xl, xr, yl, yr);
1419
sp->createCoordinateSystem(Triple(xl, yl, zl), Triple(xr, yr, zr));
1420
Matrix::freeMatrixData(data, xmesh);
1423
void Graph3D::updateScales(double xl, double xr, double yl, double yr, double zl, double zr,
1424
int xCol, int yCol, int zCol)
1426
int r=worksheet->numRows();
1429
for ( i = 0; i < r; i++)
1431
if (!worksheet->column(xCol)->isInvalid(i) && !worksheet->column(yCol)->isInvalid(i) && !worksheet->column(zCol)->isInvalid(i))
1433
xv=worksheet->cell(i,xCol);
1434
yv=worksheet->cell(i,yCol);
1435
if (xv >= xl && xv <= xr && yv >= yl && yv <= yr)
1443
Qwt3D::Triple **data=allocateData(columns,columns);
1444
for ( j = 0; j < columns; j++)
1447
for ( i = 0; i < r; i++)
1449
if (!worksheet->column(xCol)->isInvalid(i) && !worksheet->column(yCol)->isInvalid(i) && !worksheet->column(zCol)->isInvalid(i))
1451
xv=worksheet->cell(i,xCol);
1452
yv=worksheet->cell(i,yCol);
1453
if (xv >= xl && xv <= xr && yv >= yl && yv <= yr )
1455
zv=worksheet->cell(i,zCol);
1457
data[k][j] = Triple(xv,yv,zr);
1459
data[k][j] = Triple(xv,yv,zl);
1461
data[k][j] = Triple(xv,yv,zv);
1467
sp->loadFromData (data, columns, columns, false,false);
1468
sp->createCoordinateSystem(Triple(xl, yl, zl), Triple(xr, yr, zr));
1469
deleteData(data,columns);
1472
void Graph3D::setTicks(const QStringList& options)
1475
if (int(options.count()) == 6)
1477
maj=options[0].toInt();
1478
sp->coordinates()->axes[X1].setMajors(maj);
1479
sp->coordinates()->axes[X2].setMajors(maj);
1480
sp->coordinates()->axes[X3].setMajors(maj);
1481
sp->coordinates()->axes[X4].setMajors(maj);
1483
min=options[1].toInt();
1484
sp->coordinates()->axes[X1].setMinors(min);
1485
sp->coordinates()->axes[X2].setMinors(min);
1486
sp->coordinates()->axes[X3].setMinors(min);
1487
sp->coordinates()->axes[X4].setMinors(min);
1489
maj=options[2].toInt();
1490
sp->coordinates()->axes[Y1].setMajors(maj);
1491
sp->coordinates()->axes[Y2].setMajors(maj);
1492
sp->coordinates()->axes[Y3].setMajors(maj);
1493
sp->coordinates()->axes[Y4].setMajors(maj);
1495
min=options[3].toInt();
1496
sp->coordinates()->axes[Y1].setMinors(min);
1497
sp->coordinates()->axes[Y2].setMinors(min);
1498
sp->coordinates()->axes[Y3].setMinors(min);
1499
sp->coordinates()->axes[Y4].setMinors(min);
1501
maj=options[4].toInt();
1502
sp->coordinates()->axes[Z1].setMajors(maj);
1503
sp->coordinates()->axes[Z2].setMajors(maj);
1504
sp->coordinates()->axes[Z3].setMajors(maj);
1505
sp->coordinates()->axes[Z4].setMajors(maj);
1507
min=options[5].toInt();
1508
sp->coordinates()->axes[Z1].setMinors(min);
1509
sp->coordinates()->axes[Z2].setMinors(min);
1510
sp->coordinates()->axes[Z3].setMinors(min);
1511
sp->coordinates()->axes[Z4].setMinors(min);
1515
maj=options[1].toInt();
1516
sp->coordinates()->axes[X1].setMajors(maj);
1517
sp->coordinates()->axes[X2].setMajors(maj);
1518
sp->coordinates()->axes[X3].setMajors(maj);
1519
sp->coordinates()->axes[X4].setMajors(maj);
1521
min=options[2].toInt();
1522
sp->coordinates()->axes[X1].setMinors(min);
1523
sp->coordinates()->axes[X2].setMinors(min);
1524
sp->coordinates()->axes[X3].setMinors(min);
1525
sp->coordinates()->axes[X4].setMinors(min);
1527
maj=options[3].toInt();
1528
sp->coordinates()->axes[Y1].setMajors(maj);
1529
sp->coordinates()->axes[Y2].setMajors(maj);
1530
sp->coordinates()->axes[Y3].setMajors(maj);
1531
sp->coordinates()->axes[Y4].setMajors(maj);
1533
min=options[4].toInt();
1534
sp->coordinates()->axes[Y1].setMinors(min);
1535
sp->coordinates()->axes[Y2].setMinors(min);
1536
sp->coordinates()->axes[Y3].setMinors(min);
1537
sp->coordinates()->axes[Y4].setMinors(min);
1539
maj=options[5].toInt();
1540
sp->coordinates()->axes[Z1].setMajors(maj);
1541
sp->coordinates()->axes[Z2].setMajors(maj);
1542
sp->coordinates()->axes[Z3].setMajors(maj);
1543
sp->coordinates()->axes[Z4].setMajors(maj);
1545
min=options[6].toInt();
1546
sp->coordinates()->axes[Z1].setMinors(min);
1547
sp->coordinates()->axes[Z2].setMinors(min);
1548
sp->coordinates()->axes[Z3].setMinors(min);
1549
sp->coordinates()->axes[Z4].setMinors(min);
1553
void Graph3D::setColors(const QColor& meshColor,const QColor& axesColor,const QColor& numColor,
1554
const QColor& labelColor,const QColor& bgColor,const QColor& gridColor)
1556
if (meshCol != meshColor)
1558
sp->setMeshColor(Qt2GL(meshColor));
1562
if(axesCol != axesColor)
1564
sp->coordinates()->setAxesColor(Qt2GL(axesColor));
1568
if(numCol !=numColor)
1570
sp->coordinates()->setNumberColor(Qt2GL(numColor));
1574
if(labelsCol !=labelColor)
1576
sp->coordinates()->setLabelColor(Qt2GL(labelColor));
1577
labelsCol=labelColor;
1582
sp->setBackgroundColor(Qt2GL(bgColor));
1586
if(gridCol !=gridColor)
1588
sp->coordinates()->setGridLinesColor(Qt2GL(gridColor));
1593
void Graph3D::setColors(const QStringList& colors)
1595
meshCol=QColor(colors[1]);
1596
sp->setMeshColor(Qt2GL(meshCol));
1598
axesCol=QColor(colors[2]);
1599
sp->coordinates()->setAxesColor(Qt2GL(axesCol));
1601
numCol=QColor(colors[3]);
1602
sp->coordinates()->setNumberColor(Qt2GL(numCol));
1604
labelsCol=QColor(colors[4]);
1605
sp->coordinates()->setLabelColor(Qt2GL(labelsCol));
1607
bgCol=QColor(colors[5]);
1608
sp->setBackgroundColor(Qt2GL(bgCol));
1610
gridCol=QColor(colors[6]);
1611
sp->coordinates()->setGridLinesColor(Qt2GL(gridCol));
1613
if ((int)colors.count()>7)
1615
QColor min=QColor(colors[7]);
1616
QColor max=QColor(colors[8]);
1617
alpha = colors[9].toDouble();
1618
if ((int)colors.count() == 11)
1619
setDataColorMap(colors[10]);
1621
setDataColors(min,max);
1625
void Graph3D::updateColors(const QColor& meshColor,const QColor& axesColor,const QColor& numColor,
1626
const QColor& labelColor,const QColor& bgColor,const QColor& gridColor)
1628
if (meshCol != meshColor)
1630
sp->setMeshColor(Qt2GL(meshColor));
1634
if(axesCol != axesColor)
1636
sp->coordinates()->setAxesColor(Qt2GL(axesColor));
1640
if(numCol !=numColor)
1642
sp->coordinates()->setNumberColor(Qt2GL(numColor));
1646
if(labelsCol !=labelColor)
1648
sp->coordinates()->setLabelColor(Qt2GL(labelColor));
1649
labelsCol=labelColor;
1654
sp->setBackgroundColor(Qt2GL(bgColor));
1658
if(gridCol !=gridColor)
1660
sp->coordinates()->setGridLinesColor(Qt2GL(gridColor));
1669
void Graph3D::scaleFonts(double factor)
1671
QFont font = sp->coordinates()->axes[X1].numberFont();
1672
font.setPointSizeF(font.pointSizeF()*factor);
1673
sp->coordinates()->setNumberFont (font);
1675
titleFnt.setPointSizeF(factor*titleFnt.pointSizeF());
1676
sp->setTitleFont(titleFnt.family(),titleFnt.pointSize(),titleFnt.weight(),titleFnt.italic());
1678
font = xAxisLabelFont();
1679
font.setPointSizeF(factor*font.pointSizeF());
1680
setXAxisLabelFont(font);
1682
font = yAxisLabelFont();
1683
font.setPointSizeF(factor*font.pointSizeF());
1684
setYAxisLabelFont(font);
1686
font = zAxisLabelFont();
1687
font.setPointSizeF(factor*font.pointSizeF());
1688
setZAxisLabelFont(font);
1691
void Graph3D::resizeEvent ( QResizeEvent *e)
1693
QSize size=e->size();
1698
if (!ignoreFonts && this->isVisible())
1700
QSize oldSize=e->oldSize();
1701
double ratio=(double)size.height()/(double)oldSize.height();
1706
emit resizedWindow(this);
1710
void Graph3D::contextMenuEvent(QContextMenuEvent *e)
1712
emit showContextMenu();
1716
void Graph3D::setFramed()
1718
if (sp->coordinates()->style() == FRAME)
1722
sp->setCoordinateStyle(FRAME);
1725
void Graph3D::setBoxed()
1727
if (sp->coordinates()->style() == BOX)
1731
sp->setCoordinateStyle(BOX);
1734
void Graph3D::setNoAxes()
1736
if (sp->coordinates()->style() == NOCOORD)
1740
sp->setCoordinateStyle(NOCOORD);
1743
void Graph3D::setNoGrid()
1745
if (sp->plotStyle() == FILLED)
1749
sp->setPlotStyle(FILLED);
1757
void Graph3D::setFilledMesh()
1759
if (sp->plotStyle() == FILLEDMESH)
1763
sp->setPlotStyle(FILLEDMESH);
1771
void Graph3D::setHiddenLineGrid()
1773
if (sp->plotStyle() == HIDDENLINE)
1777
sp->setPlotStyle(HIDDENLINE);
1778
sp->showColorLegend(false);
1787
void Graph3D::setLineGrid()
1789
if (sp->plotStyle() == WIREFRAME)
1793
sp->setPlotStyle(WIREFRAME);
1794
sp->showColorLegend(false);
1803
void Graph3D::setPointsMesh()
1805
if (!sp || pointStyle == Dots)
1812
sp->setPlotStyle(Dot(pointSize, smooth));
1817
void Graph3D::setConesMesh()
1819
if (!sp || pointStyle == Cones )
1822
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
1828
sp->setPlotStyle(Cone3D(conesRad,conesQuality));
1832
QApplication::restoreOverrideCursor();
1835
void Graph3D::setCrossMesh()
1837
if (!sp || pointStyle == HairCross)
1840
pointStyle=HairCross;
1844
sp->setPlotStyle(CrossHair(crossHairRad, crossHairLineWidth,crossHairSmooth,crossHairBoxed));
1849
void Graph3D::clearData()
1860
plotAssociation = QString();
1863
sp->loadFromData (0, 0, 0, false, false);
1868
void Graph3D::setBarsPlot()
1870
if (pointStyle == VerticalBars)
1873
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
1875
pointStyle=VerticalBars;
1879
sp->setPlotStyle(Bar(barsRad));
1882
QApplication::restoreOverrideCursor();
1885
void Graph3D::setFloorData()
1887
if (sp->floorStyle() == FLOORDATA)
1891
sp->setFloorStyle(FLOORDATA);
1896
void Graph3D::setFloorIsolines()
1898
if (sp->floorStyle() == FLOORISO)
1902
sp->setFloorStyle(FLOORISO);
1907
void Graph3D::setEmptyFloor()
1909
if (sp->floorStyle() == NOFLOOR)
1913
sp->setFloorStyle(NOFLOOR);
1918
void Graph3D::setMeshLineWidth(int lw)
1920
if ((int)sp->meshLineWidth() == lw)
1924
sp->setMeshLineWidth((double)lw);
1929
int Graph3D::grids()
1931
return sp->coordinates()->grids();
1934
void Graph3D::setGrid(Qwt3D::SIDE s, bool b)
1939
int sum = sp->coordinates()->grids();
1946
sp->coordinates()->setGridLines(sum!=Qwt3D::NOSIDEGRID, false, sum);
1951
void Graph3D::setGrid(int grids)
1956
sp->coordinates()->setGridLines(true, false,grids);
1959
void Graph3D::setLeftGrid(bool b)
1961
setGrid(Qwt3D::LEFT,b);
1963
void Graph3D::setRightGrid(bool b)
1965
setGrid(Qwt3D::RIGHT,b);
1967
void Graph3D::setCeilGrid(bool b)
1969
setGrid(Qwt3D::CEIL,b);
1971
void Graph3D::setFloorGrid(bool b)
1973
setGrid(Qwt3D::FLOOR,b);
1975
void Graph3D::setFrontGrid(bool b)
1977
setGrid(Qwt3D::FRONT,b);
1979
void Graph3D::setBackGrid(bool b)
1981
setGrid(Qwt3D::BACK,b);
1984
void Graph3D::print()
1987
printer.setOrientation(QPrinter::Landscape);
1988
printer.setColorMode (QPrinter::Color);
1989
printer.setFullPage(false);
1991
if (printer.setup())
1993
if (IO::save (sp,"scidavis.png","PNG"))
1996
p.load ("scidavis.png","PNG", QPixmap::Color );
1998
QPainter paint(&printer);
1999
paint.drawPixmap(QPoint(0,0),p);
2002
QFile f("scidavis.png");
2006
QMessageBox::about(0,tr("IO Error"),
2007
tr("Could not print: <h4>" + QString(name()) + "</h4>."));
2011
void Graph3D::copyImage()
2013
QApplication::clipboard()->setPixmap(sp->renderPixmap(), QClipboard::Clipboard);
2017
void Graph3D::exportImage(const QString& fileName, int quality, bool transparent)
2021
QPixmap pic = sp->renderPixmap();
2024
QBitmap mask(pic.size());
2025
mask.fill(Qt::color1);
2028
p.setPen(Qt::color0);
2030
QColor background = QColor (Qt::white);
2031
QRgb backgroundPixel = background.rgb ();
2032
QImage image = pic.convertToImage();
2033
for (int y=0; y<image.height(); y++)
2035
for ( int x=0; x<image.width(); x++ )
2037
QRgb rgb = image.pixel(x, y);
2038
if (rgb == backgroundPixel) // we want the frame transparent
2039
p.drawPoint( x, y );
2044
pic.save(fileName, 0, quality);
2048
QImage im = sp->grabFrameBuffer(true);
2049
QImageWriter iw(fileName);
2050
iw.setQuality(quality);
2055
void Graph3D::exportPDF(const QString& fileName)
2057
exportVector(fileName);
2060
void Graph3D::exportVector(const QString& fileName, const QString& fileType)
2062
if ( fileName.isEmpty() )
2064
QMessageBox::critical(0, tr("Error"), tr("Please provide a valid file name!"));
2068
QString format = fileType;
2069
format = format.toUpper();
2071
VectorWriter * gl2ps = (VectorWriter*)IO::outputHandler(format);
2074
gl2ps->setTextMode(VectorWriter::NATIVE);
2076
IO::save(sp, fileName, format);
2079
bool Graph3D::eventFilter(QObject *object, QEvent *e)
2081
if (e->type() == QEvent::MouseButtonDblClick && object == (QObject *)this->sp)
2083
emit showOptionsDialog();
2086
return MyWidget::eventFilter(object, e);
2089
void Graph3D::setPointOptions(double size, bool s)
2091
if (pointSize == size && smooth == s)
2098
double Graph3D::barsRadius()
2100
if (sp->plotStyle() == Qwt3D::USER && sp->plotStyle() != Qwt3D::POINTS)
2106
void Graph3D::setBarsRadius(double rad)
2114
void Graph3D::updateBars(double rad)
2120
sp->setPlotStyle(Bar(barsRad));
2124
void Graph3D::updatePoints(double size, bool sm)
2126
if (pointStyle == Dots && pointSize == size && smooth == sm)
2133
Dot d(pointSize, smooth);
2134
sp->setPlotStyle(d);
2138
emit custom3DActions(this);
2141
void Graph3D::updateCones(double rad, int quality)
2143
if (pointStyle == Cones && conesRad == rad && conesQuality == quality)
2147
conesQuality = quality;
2149
sp->setPlotStyle(Cone3D(conesRad,conesQuality));
2152
emit custom3DActions(this);
2155
void Graph3D::setConesOptions(double rad, int quality)
2158
conesQuality = quality;
2161
void Graph3D::updateCross(double rad, double linewidth, bool smooth, bool boxed)
2163
if (pointStyle == HairCross && crossHairRad == rad &&
2164
crossHairSmooth == smooth && crossHairBoxed == boxed &&
2165
crossHairLineWidth == linewidth)
2169
crossHairLineWidth=linewidth;
2170
crossHairSmooth = smooth;
2171
crossHairBoxed = boxed;
2172
pointStyle = HairCross;
2174
sp->setPlotStyle(CrossHair(rad,linewidth, smooth, boxed));
2177
emit custom3DActions(this);
2180
void Graph3D::setCrossOptions(double rad, double linewidth, bool smooth, bool boxed)
2182
crossHairRad = rad ;
2183
crossHairLineWidth=linewidth;
2184
crossHairSmooth = smooth;
2185
crossHairBoxed = boxed;
2188
void Graph3D::setStyle(Qwt3D::COORDSTYLE coord,Qwt3D::FLOORSTYLE floor,
2189
Qwt3D::PLOTSTYLE plot, Graph3D::PointStyle point)
2191
sp->setCoordinateStyle(coord);
2192
sp->setFloorStyle(floor);
2195
sp->setPlotStyle(plot);
2196
else if (point == VerticalBars)
2197
sp->setPlotStyle(Bar(barsRad));
2198
else if (point == Dots)
2199
sp->setPlotStyle(Dot(pointSize, smooth));
2200
else if (point == HairCross)
2201
sp->setPlotStyle(CrossHair(crossHairRad, crossHairLineWidth, crossHairSmooth, crossHairBoxed));
2202
else if (point == Cones)
2203
sp->setPlotStyle(Cone3D(conesRad, conesQuality));
2206
style_=sp->plotStyle() ;
2209
void Graph3D::customPlotStyle(int style)
2212
if (sp->plotStyle() == style)
2219
sp->setPlotStyle(WIREFRAME );
2224
sp->showColorLegend(legendOn);
2230
sp->setPlotStyle(FILLED );
2238
sp->setPlotStyle(FILLEDMESH);
2246
sp->setPlotStyle(HIDDENLINE);
2250
sp->showColorLegend(legendOn);
2259
style_ = Qwt3D::USER;
2261
Dot d(pointSize, smooth);
2262
sp->setPlotStyle(d);
2268
pointStyle = VerticalBars;
2269
style_ = Qwt3D::USER;
2270
sp->setPlotStyle(Bar(barsRad));
2279
void Graph3D::setStyle(const QStringList& st)
2281
if (st[1] =="nocoord")
2282
sp->setCoordinateStyle(NOCOORD);
2283
else if (st[1] =="frame")
2284
sp->setCoordinateStyle(FRAME);
2285
else if (st[1] =="box")
2286
sp->setCoordinateStyle(BOX);
2288
if (st[2] =="nofloor")
2289
sp->setFloorStyle(NOFLOOR);
2290
else if (st[2] =="flooriso")
2291
sp->setFloorStyle(FLOORISO);
2292
else if (st[2] =="floordata")
2293
sp->setFloorStyle(FLOORDATA);
2295
if (st[3] =="filledmesh")
2296
sp->setPlotStyle(FILLEDMESH);
2297
else if (st[3] =="filled")
2298
sp->setPlotStyle(FILLED);
2299
else if (st[3] =="points")
2301
pointSize = st[4].toDouble();
2307
sp->setPlotStyle(Dot(pointSize, smooth));
2310
else if (st[3] =="wireframe")
2311
sp->setPlotStyle(WIREFRAME);
2312
else if (st[3] =="hiddenline")
2313
sp->setPlotStyle(HIDDENLINE);
2314
else if (st[3] =="bars")
2316
barsRad = (st[4]).toDouble();
2317
sp->setPlotStyle(Bar(barsRad));
2318
pointStyle = VerticalBars;
2320
else if (st[3] =="cones")
2322
conesRad = (st[4]).toDouble();
2323
conesQuality = (st[5]).toInt();
2325
sp->setPlotStyle(Cone3D(conesRad, conesQuality));
2328
else if (st[3] =="cross")
2330
crossHairRad = (st[4]).toDouble();
2331
crossHairLineWidth = (st[5]).toDouble();
2333
crossHairSmooth=false;
2335
crossHairSmooth=true;
2337
crossHairBoxed=false;
2339
crossHairBoxed=true;
2341
sp->setPlotStyle(CrossHair(crossHairRad, crossHairLineWidth, crossHairSmooth, crossHairBoxed));
2342
pointStyle = HairCross;
2345
style_ = sp->plotStyle() ;
2348
void Graph3D::setRotation(double xVal,double yVal,double zVal)
2350
sp->setRotation(xVal,yVal,zVal);
2353
void Graph3D::setScale(double xVal,double yVal,double zVal)
2355
sp->setScale(xVal,yVal,zVal);
2358
void Graph3D::setShift(double xVal,double yVal,double zVal)
2360
sp->setShift(xVal,yVal,zVal);
2363
void Graph3D::setZoom(double val)
2368
void Graph3D::updateZoom(double val)
2370
if (sp->zoom() == val)
2373
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2380
QApplication::restoreOverrideCursor();
2383
void Graph3D::updateScaling(double xVal,double yVal,double zVal)
2385
if (sp->xScale() == xVal && sp->yScale() == yVal && sp->zScale() == zVal)
2388
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2390
sp->setScale(xVal,yVal,zVal);
2394
QApplication::restoreOverrideCursor();
2397
Qwt3D::PLOTSTYLE Graph3D::plotStyle()
2399
return sp->plotStyle();
2402
Qwt3D::FLOORSTYLE Graph3D::floorStyle()
2404
return sp->floorStyle();
2407
Qwt3D::COORDSTYLE Graph3D::coordStyle()
2409
return sp->coordinates()->style();
2412
QString Graph3D::formula()
2415
return func->function();
2417
return plotAssociation;
2420
QString Graph3D::saveToString(const QString& geometry)
2422
QString s="<SurfacePlot>\n";
2423
s+= QString(name())+"\t";
2424
s+= birthDate() + "\n";
2426
s+= "SurfaceFunction\t";
2430
s+=func->function()+"\t";
2433
s+= plotAssociation;
2438
sp->coordinates()->axes[X1].limits(start,stop);
2439
s+=QString::number(start)+"\t";
2440
s+=QString::number(stop)+"\t";
2441
sp->coordinates()->axes[Y1].limits(start,stop);
2442
s+=QString::number(start)+"\t";
2443
s+=QString::number(stop)+"\t";
2444
sp->coordinates()->axes[Z1].limits(start,stop);
2445
s+=QString::number(start)+"\t";
2446
s+=QString::number(stop)+"\n";
2449
if (sp->coordinates()->style() == Qwt3D::NOCOORD)
2451
else if (sp->coordinates()->style() == Qwt3D::BOX)
2455
s+="Style\t"+st+"\t";
2457
switch(sp->floorStyle ())
2473
switch(sp->plotStyle())
2476
if (pointStyle == VerticalBars)
2477
st="bars\t"+QString::number(barsRad);
2478
else if (pointStyle == Dots)
2480
st="points\t"+QString::number(pointSize);
2481
st+="\t"+QString::number(smooth);
2483
else if (pointStyle == Cones)
2485
st="cones\t"+QString::number(conesRad);
2486
st+="\t"+QString::number(conesQuality);
2488
else if (pointStyle == HairCross)
2490
st="cross\t"+QString::number(crossHairRad);
2491
st+="\t"+QString::number(crossHairLineWidth);
2492
st+="\t"+QString::number(crossHairSmooth);
2493
st+="\t"+QString::number(crossHairBoxed);
2519
s+=QString::number(sp->coordinates()->grids())+"\n";
2523
s+=titleCol.name()+"\t";
2524
s+=titleFnt.family()+"\t";
2525
s+=QString::number(titleFnt.pointSize())+"\t";
2526
s+=QString::number(titleFnt.weight())+"\t";
2527
s+=QString::number(titleFnt.italic())+"\n";
2530
s+=meshCol.name()+"\t";
2531
s+=axesCol.name()+"\t";
2532
s+=numCol.name()+"\t";
2533
s+=labelsCol.name()+"\t";
2534
s+=bgCol.name()+"\t";
2535
s+=gridCol.name()+"\t";
2536
s+=fromColor.name()+"\t";
2537
s+=toColor.name()+"\t";
2538
s+=QString::number(alpha) + "\t" + color_map + "\n";
2541
s+=labels.join("\t")+"\n";
2544
QStringList tl=scaleTicks();
2545
s+=tl.join("\t")+"\n";
2548
tl=axisTickLengths();
2549
s+=tl.join("\t")+"\n";
2552
s+=QString::number(legendOn)+"\t";
2553
s+=QString::number(sp->resolution())+"\t";
2554
s+=QString::number(labelsDist)+"\n";
2557
QFont fnt=sp->coordinates()->axes[X1].numberFont();
2558
s+=fnt.family()+"\t";
2559
s+=QString::number(fnt.pointSize())+"\t";
2560
s+=QString::number(fnt.weight())+"\t";
2561
s+=QString::number(fnt.italic())+"\n";
2563
s+="xAxisLabelFont\t";
2564
fnt=sp->coordinates()->axes[X1].labelFont();
2565
s+=fnt.family()+"\t";
2566
s+=QString::number(fnt.pointSize())+"\t";
2567
s+=QString::number(fnt.weight())+"\t";
2568
s+=QString::number(fnt.italic())+"\n";
2570
s+="yAxisLabelFont\t";
2571
fnt=sp->coordinates()->axes[Y1].labelFont();
2572
s+=fnt.family()+"\t";
2573
s+=QString::number(fnt.pointSize())+"\t";
2574
s+=QString::number(fnt.weight())+"\t";
2575
s+=QString::number(fnt.italic())+"\n";
2577
s+="zAxisLabelFont\t";
2578
fnt=sp->coordinates()->axes[Z1].labelFont();
2579
s+=fnt.family()+"\t";
2580
s+=QString::number(fnt.pointSize())+"\t";
2581
s+=QString::number(fnt.weight())+"\t";
2582
s+=QString::number(fnt.italic())+"\n";
2585
s+=QString::number(sp->xRotation())+"\t";
2586
s+=QString::number(sp->yRotation())+"\t";
2587
s+=QString::number(sp->zRotation())+"\n";
2590
s+=QString::number(sp->zoom())+"\n";
2593
s+=QString::number(sp->xScale())+"\t";
2594
s+=QString::number(sp->yScale())+"\t";
2595
s+=QString::number(sp->zScale())+"\n";
2598
s+=QString::number(sp->xShift())+"\t";
2599
s+=QString::number(sp->yShift())+"\t";
2600
s+=QString::number(sp->zShift())+"\n";
2603
s+=QString::number(sp->meshLineWidth())+"\n";
2604
s+="WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
2605
s+="Orthogonal\t" + QString::number(sp->ortho())+"\n";
2606
s+="</SurfacePlot>\n";
2610
void Graph3D::showColorLegend(bool show)
2612
if (legendOn == show)
2616
sp->showColorLegend(show);
2623
void Graph3D::setResolution(int r)
2625
if (sp->resolution() == r)
2629
sp->setResolution(r);
2635
void Graph3D::setTitle(const QStringList& lst)
2638
sp->setTitle(title);
2640
titleCol=QColor(lst[2]);
2641
sp->setTitleColor(Qt2GL(titleCol));
2643
titleFnt=QFont(lst[3],lst[4].toInt(),lst[5].toInt(),lst[6].toInt());
2644
sp->setTitleFont(titleFnt.family(),titleFnt.pointSize(),titleFnt.weight(),titleFnt.italic());
2647
void Graph3D::setTitle(const QString& s,const QColor& color,const QFont& font)
2652
sp->setTitle(title);
2656
sp->setTitleColor(Qt2GL(color));
2658
if (titleFnt != font)
2661
sp->setTitleFont(font.family(),font.pointSize(),font.weight(),font.italic());
2665
void Graph3D::updateTitle(const QString& s,const QColor& color,const QFont& font)
2670
sp->setTitle(title);
2674
sp->setTitleColor(Qt2GL(color));
2676
if (titleFnt != font)
2679
sp->setTitleFont(font.family(),font.pointSize(),font.weight(),font.italic());
2687
void Graph3D::setTitleFont(const QFont& font)
2689
if (titleFnt != font)
2692
sp->setTitleFont(font.family(),font.pointSize(),font.weight(),font.italic());
2696
void Graph3D::setOptions(const QStringList& lst)
2699
if (lst[1].toInt() == 1)
2701
sp->showColorLegend(legendOn);
2702
sp->setResolution(lst[2].toInt());
2703
adjustLabels(lst[3].toInt());
2707
void Graph3D::setOptions(bool legend, int r, int dist)
2709
sp->showColorLegend(legend);
2711
sp->setResolution(r);
2715
Qwt3D::Triple** Graph3D::allocateData(int columns, int rows)
2717
Qwt3D::Triple** data = new Qwt3D::Triple* [columns];
2719
for ( int i = 0; i < columns; ++i)
2721
data[i] = new Qwt3D::Triple [rows];
2726
void Graph3D::deleteData(Qwt3D::Triple **data, int columns)
2728
for ( int i = 0; i < columns; i++)
2735
QColor Graph3D::minDataColor()
2740
QColor Graph3D::maxDataColor()
2745
void Graph3D::setDataColors(const QColor& cMin, const QColor& cMax)
2747
if (cMin == fromColor && cMax == toColor)
2753
Qwt3D::ColorVector cv;
2756
double dsize = size;
2758
double r1=cMax.red()/dsize;
2759
double r2=cMin.red()/dsize;
2761
double stepR = (r1-r2)/dsize;
2763
double g1=cMax.green()/dsize;
2764
double g2=cMin.green()/dsize;
2766
double stepG = (g1-g2)/dsize;
2768
double b1=cMax.blue()/dsize;
2769
double b2=cMin.blue()/dsize;
2771
double stepB = (b1-b2)/dsize;
2774
for (int i=0; i<size; i++)
2784
col_ = new StandardColor(sp);
2785
col_->setColorVector(cv);
2786
sp->setDataColor(col_);
2790
sp->showColorLegend(false);
2791
sp->showColorLegend(legendOn);
2795
void Graph3D::changeTransparency(double t)
2802
Qwt3D::StandardColor* color=(StandardColor*) sp->dataColor ();
2805
sp->showColorLegend(legendOn);
2811
void Graph3D::setTransparency(double t)
2818
Qwt3D::StandardColor* color=(StandardColor*) sp->dataColor ();
2822
void Graph3D::showWorksheet()
2825
worksheet->showMaximized();
2827
d_matrix->showMaximized();
2830
void Graph3D::setSmoothMesh(bool smooth)
2832
if (smoothMesh == smooth)
2835
smoothMesh = smooth;
2836
sp->setSmoothMesh(smoothMesh);
2837
sp->coordinates()->setLineSmooth(smoothMesh);
2842
QString Graph3D::saveAsTemplate(const QString& geometryInfo)
2844
QString s = saveToString(geometryInfo);
2845
QStringList lst = s.split("\n", QString::SkipEmptyParts);
2846
QStringList l = lst[3].split("\t");
2848
lst[3] = l.join("\t");
2849
return lst.join("\n");
2853
Turns 3D animation on or off
2855
void Graph3D::animate(bool on)
2858
d_timer->start( animation_redraw_wait ); // Wait this many msecs before redraw
2863
void Graph3D::rotate()
2868
sp->setRotation(int(sp->xRotation() + 1) % 360, int(sp->yRotation() + 1) % 360, int(sp->zRotation() + 1) % 360);
2871
void Graph3D::setDataColorMap(const QString& fileName)
2873
if (color_map == fileName)
2877
if (!openColorMap(cv, fileName))
2880
color_map = fileName;
2882
col_ = new StandardColor(sp);
2883
col_->setColorVector(cv);
2885
sp->setDataColor(col_);
2887
sp->showColorLegend(legendOn);
2891
bool Graph3D::openColorMap(ColorVector& cv, QString fname)
2893
if (fname.isEmpty())
2896
using std::ifstream;
2897
ifstream file(QWT3DLOCAL8BIT(fname));
2906
file >> rgb.r >> rgb.g >> rgb.b;
2907
file.ignore(10000,'\n');
2922
void Graph3D::findBestLayout()
2925
sp->coordinates()->axes[X1].limits (start, end);
2926
double xScale = 1/fabs(end-start);
2928
sp->coordinates()->axes[Y1].limits (start, end);
2929
double yScale = 1/fabs(end-start);
2931
sp->coordinates()->axes[Z1].limits (start, end);
2932
double zScale = 1/fabs(end-start);
2934
double d = (sp->hull().maxVertex-sp->hull().minVertex).length();
2935
sp->setScale(xScale, yScale, zScale);
2936
sp->setZoom(d/sqrt(3));
2938
double majl = 0.1/yScale;
2939
updateTickLength(0, majl, 0.6*majl);
2941
updateTickLength(1, majl, 0.6*majl);
2942
updateTickLength(2, majl, 0.6*majl);
2945
void Graph3D::copy(Graph3D* g)
2950
Graph3D::PointStyle pt = g->pointType();
2951
if (g->plotStyle() == Qwt3D::USER ){
2953
case Graph3D::None :
2956
case Graph3D::Dots :
2957
setPointOptions(g->pointsSize(), g->smoothPoints());
2960
case Graph3D::VerticalBars :
2961
setBarsRadius(g->barsRadius());
2964
case Graph3D::HairCross :
2965
setCrossOptions(g->crossHairRadius(), g->crossHairLinewidth(), g->smoothCrossHair(), g->boxedCrossHair());
2968
case Graph3D::Cones :
2969
setConesOptions(g->coneRadius(), g->coneQuality());
2973
setStyle(g->coordStyle(), g->floorStyle(), g->plotStyle(), pt);
2974
setGrid(g->grids());
2975
setTitle(g->plotTitle(),g->titleColor(),g->titleFont());
2976
setTransparency(g->transparency());
2977
if (!g->colorMap().isEmpty())
2978
setDataColorMap(g->colorMap());
2980
setDataColors(g->minDataColor(),g->maxDataColor());
2982
setColors(g->meshColor(),g->axesColor(),g->numColor(),
2983
g->labelColor(), g->bgColor(),g->gridColor());
2984
setAxesLabels(g->axesLabels());
2985
setTicks(g->scaleTicks());
2986
setTickLengths(g->axisTickLengths());
2987
setOptions(g->isLegendOn(), g->resolution(),g->labelsDistance());
2988
setNumbersFont(g->numbersFont());
2989
setXAxisLabelFont(g->xAxisLabelFont());
2990
setYAxisLabelFont(g->yAxisLabelFont());
2991
setZAxisLabelFont(g->zAxisLabelFont());
2992
setRotation(g->xRotation(),g->yRotation(),g->zRotation());
2994
setScale(g->xScale(),g->yScale(),g->zScale());
2995
setShift(g->xShift(),g->yShift(),g->zShift());
2996
setMeshLineWidth((int)g->meshLineWidth());
2997
setOrtho(g->isOrthogonal());
2999
animate(g->isAnimated());