3d plot code update

.. to reflect current code requirements

NOTE: there is a 'phantom' widget with the 3d window that
      covers the left side of the chart bar and makes it
      impossible to click on the summary button.
This commit is contained in:
Mark Liversedge
2014-06-21 22:58:20 +01:00
parent 68bb257b77
commit 8669ce641a
5 changed files with 38 additions and 147 deletions

View File

@@ -145,7 +145,7 @@ class ModelDataProvider : public Function
public:
ModelDataProvider (BasicModelPlot &plot, ModelSettings *settings);
ModelDataProvider (ModelPlot &plot, ModelSettings *settings);
void setData(RideFile *ride, int x, int y, int z, int col); // set the maps and return mesh dimension
// return z value for x,y - std qwt3plot method
@@ -179,7 +179,7 @@ class ModelDataProvider : public Function
double maxz, minz;
double cranklength; // used for CPV/AEPF calculation
bool useMetricUnits;
BasicModelPlot &plot;
ModelPlot &plot;
};
double
@@ -314,7 +314,7 @@ ModelDataProvider::describeType(int type, bool longer)
* Edit it with caution, there be dragons here.
*
*----------------------------------------------------------------------*/
ModelDataProvider::ModelDataProvider (BasicModelPlot &plot, ModelSettings *settings) : Function(plot), plot(plot)
ModelDataProvider::ModelDataProvider (ModelPlot &plot, ModelSettings *settings) : Function(plot), plot(plot)
{
// get application settings
cranklength = appsettings->value(NULL, GC_CRANKLENGTH, 0.0).toDouble() / 1000.0;
@@ -813,7 +813,13 @@ ModelDataProvider::ModelDataProvider (BasicModelPlot &plot, ModelSettings *setti
*
*----------------------------------------------------------------------*/
BasicModelPlot::BasicModelPlot(Context *context, ModelSettings *settings) : context(context)
ModelPlot::ModelPlot(Context *context, QWidget *parent, ModelSettings *settings) :
#if QWT3D_MINOR_VERSION > 2
GridPlot(parent),
#else
SurfacePlot(parent),
#endif
context(context)
{
diag_=0;
currentStyle = STYLE_BAR;
@@ -873,7 +879,7 @@ BasicModelPlot::BasicModelPlot(Context *context, ModelSettings *settings) : cont
}
void
BasicModelPlot::configChanged()
ModelPlot::configChanged()
{
// setColors bg
QColor rgba = GColor(CPLOTBACKGROUND);
@@ -894,7 +900,7 @@ BasicModelPlot::configChanged()
}
void
BasicModelPlot::setStyle(int index)
ModelPlot::setStyle(int index)
{
if (currentStyle == STYLE_BAR) degrade(bar);
else degrade(water);
@@ -934,7 +940,7 @@ BasicModelPlot::setStyle(int index)
}
void
BasicModelPlot::setData(ModelSettings *settings)
ModelPlot::setData(ModelSettings *settings)
{
delete modelDataProvider;
settings->colorProvider = modelDataColor;
@@ -954,7 +960,7 @@ BasicModelPlot::setData(ModelSettings *settings)
}
void
BasicModelPlot::setFrame(bool frame)
ModelPlot::setFrame(bool frame)
{
if (intervals_ && frame == true) {
intervals_ |= SHOW_FRAME;
@@ -966,7 +972,7 @@ BasicModelPlot::setFrame(bool frame)
}
void
BasicModelPlot::setLegend(bool legend, int coltype)
ModelPlot::setLegend(bool legend, int coltype)
{
if (legend == true && coltype != MODEL_NONE) {
showColorLegend(true);
@@ -976,7 +982,7 @@ BasicModelPlot::setLegend(bool legend, int coltype)
}
void
BasicModelPlot::setGrid(bool grid)
ModelPlot::setGrid(bool grid)
{
if (grid == true)
coordinates()->setGridLines(true, true, Qwt3D::BACK | Qwt3D::LEFT | Qwt3D::FLOOR);
@@ -987,7 +993,7 @@ BasicModelPlot::setGrid(bool grid)
}
void
BasicModelPlot::setZPane(int z)
ModelPlot::setZPane(int z)
{
//zpane = (modelDataProvider->maxz-modelDataProvider->minz) / 100 * z;
zpane = (modelDataProvider->getMaxz()-modelDataProvider->getMinz()) / 100 * z;
@@ -996,7 +1002,7 @@ BasicModelPlot::setZPane(int z)
}
void
BasicModelPlot::resetViewPoint()
ModelPlot::resetViewPoint()
{
setRotation(45, 0, 30); // seems most pleasing
setShift(0,0,0); // centre so movement feels natural
@@ -1005,76 +1011,6 @@ BasicModelPlot::resetViewPoint()
}
/*----------------------------------------------------------------------
* MODEL PLOT
* Nothing special - just a framed BasicModelPlot
*----------------------------------------------------------------------*/
ModelPlot::ModelPlot(Context *context, ModelSettings *settings) : QFrame(context->mainWindow), context(context)
{
// the distinction between a model plot and a basic model plot
// is only to provide a frame for the qwt3d plot (it looks odd
// when compared to the other plots without one)
layout = new QVBoxLayout;
setLineWidth(1);
setFrameStyle(QFrame::NoFrame);
setContentsMargins(0,0,0,0);
basicModelPlot = new BasicModelPlot(context, settings);
layout->addWidget(basicModelPlot);
layout->setContentsMargins(2,2,2,2);
setLayout(layout);
connect(context, SIGNAL(configChanged()), basicModelPlot, SLOT(configChanged()));
}
void
ModelPlot::setStyle(int index)
{
basicModelPlot->setStyle(index);
}
void
ModelPlot::setResolution(int val)
{
basicModelPlot->setResolution(val);
}
void
ModelPlot::setData(ModelSettings *settings)
{
basicModelPlot->setData(settings);
}
void
ModelPlot::resetViewPoint()
{
basicModelPlot->resetViewPoint();
}
void
ModelPlot::setGrid(bool grid)
{
basicModelPlot->setGrid(grid);
}
void
ModelPlot::setLegend(bool legend, int coltype)
{
basicModelPlot->setLegend(legend, coltype);
}
void
ModelPlot::setFrame(bool frame)
{
basicModelPlot->setFrame(frame);
}
void
ModelPlot::setZPane(int z)
{
basicModelPlot->setZPane(z);
}
/*----------------------------------------------------------------------
* WATER VERTEX ENRICHMENT
*
@@ -1090,7 +1026,7 @@ Water::Water()
{
}
Water::Water(BasicModelPlot *model) : model(model) {}
Water::Water(ModelPlot *model) : model(model) {}
void Water::drawBegin()
{
@@ -1207,7 +1143,7 @@ Bar::Bar()
{
}
Bar::Bar(BasicModelPlot *model) : model(model) {}
Bar::Bar(ModelPlot *model) : model(model) {}
void Bar::drawBegin()
{