summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/qmlmaps/floorplan.jpgbin0 -> 108298 bytes
-rw-r--r--examples/qmlmaps/image.jpgbin287172 -> 0 bytes
-rw-r--r--examples/qmlmaps/qml/qmlmaps/main.qml44
-rw-r--r--examples/qmlmaps/qmlmaps.qrc2
-rw-r--r--src/datavis3d/engine/maps3dcontroller.cpp97
-rw-r--r--src/datavis3d/engine/maps3dcontroller_p.h2
-rw-r--r--src/datavis3d/engine/qdataitem.cpp7
-rw-r--r--src/datavis3dqml2/declarativemaps.cpp135
-rw-r--r--src/datavis3dqml2/declarativemaps_p.h32
9 files changed, 226 insertions, 93 deletions
diff --git a/examples/qmlmaps/floorplan.jpg b/examples/qmlmaps/floorplan.jpg
new file mode 100644
index 00000000..578d8252
--- /dev/null
+++ b/examples/qmlmaps/floorplan.jpg
Binary files differ
diff --git a/examples/qmlmaps/image.jpg b/examples/qmlmaps/image.jpg
deleted file mode 100644
index b6c48e76..00000000
--- a/examples/qmlmaps/image.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/qmlmaps/qml/qmlmaps/main.qml b/examples/qmlmaps/qml/qmlmaps/main.qml
index 0f8d618c..40f05e80 100644
--- a/examples/qmlmaps/qml/qmlmaps/main.qml
+++ b/examples/qmlmaps/qml/qmlmaps/main.qml
@@ -27,59 +27,63 @@ Item {
width: 800
height: 500
visible: true
+ //title: "Noise levels from construction site"
Item {
id: dataView
- width: parent.width - shadowToggle.width
- height: parent.height
- anchors.right: parent.right;
+ width: parent.width
+ height: parent.height - shadowToggle.height
+ anchors.bottom: parent.bottom
Image {
id: testimage
- source: "qrc:/images/image.jpg"
+ source: "qrc:/images/floorplan.jpg"
+ visible: false
}
DataItem {
id: testitem1
- label: "Test"
- value: 200
- position: "100.0, 200.0"
+ label: "dB"
+ value: 76
+ position: "95.0, 490.0"
}
DataItem {
id: testitem2
- label: "Test2"
- value: 300
- position: "200.0, 200.0"
+ label: "dB"
+ value: 88
+ position: "185.0, 105.0"
}
DataItem {
id: testitem3
- label: "Test3"
- value: 400
- position: "100.0, 100.0"
+ label: "dB"
+ value: 85
+ position: "700.0, 465.0"
}
DataItem {
id: testitem4
- label: "Test4"
- value: 600
- position: "200.0, 100.0"
+ label: "dB"
+ value: 92
+ position: "505.0, 225.0"
}
Maps3D {
id: testmap
width: dataView.width
height: dataView.height
+ fontSize: 300.0
Component.onCompleted: {
console.log("testmap complete");
console.log(testimage);
console.log(testimage.sourceSize);
+ setBarSpecs(Qt.vector3d(10.0, 10.0, 10.0));
setAreaSpecs(Qt.rect(0, 0, testimage.sourceSize.width, testimage.sourceSize.height),
testimage);
//setImage(testimage);
- setImage(":/images/image.jpg");
+ setImage(":/images/floorplan.jpg");
shadowQuality = Maps3D.ShadowNone
selectionMode = Maps3D.ModeBar
- labelTransparency = Maps3D.TransparencyFromTheme
+ labelTransparency = Maps3D.TransparencyNoBackground//.TransparencyFromTheme
addDataItem(testitem1);
addDataItem(testitem2);
addDataItem(testitem3);
@@ -97,8 +101,8 @@ Item {
color: "#FFFFFF"
x: 0
y: 0
- width: 160
- height: 80
+ width: parent.width
+ height: 60
TextArea {
id: buttonText
diff --git a/examples/qmlmaps/qmlmaps.qrc b/examples/qmlmaps/qmlmaps.qrc
index fe17bae3..8eda36f6 100644
--- a/examples/qmlmaps/qmlmaps.qrc
+++ b/examples/qmlmaps/qmlmaps.qrc
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/images">
- <file>image.jpg</file>
+ <file>floorplan.jpg</file>
</qresource>
</RCC>
diff --git a/src/datavis3d/engine/maps3dcontroller.cpp b/src/datavis3d/engine/maps3dcontroller.cpp
index 99b25121..325f2515 100644
--- a/src/datavis3d/engine/maps3dcontroller.cpp
+++ b/src/datavis3d/engine/maps3dcontroller.cpp
@@ -95,10 +95,10 @@ Maps3DController::Maps3DController(const QRect &rect)
m_mousePressed(MouseNone),
m_mousePos(QPoint(0, 0)),
m_zoomLevel(100),
- m_zoomAdjustment(1.0f),
+ m_autoScaleAdjustment(1.0f),
m_horizontalRotation(0.0f),
m_verticalRotation(45.0f),
- m_barThickness(QVector3D(1.0f, 0.0f, 1.0f)),
+ m_barThickness(QVector3D(1.0f, 1.0f, 1.0f)),
m_heightNormalizer(0.0f),
m_yAdjustment(0.0f),
m_scaleFactor(1.0f),
@@ -125,6 +125,7 @@ Maps3DController::Maps3DController(const QRect &rect)
m_selectionFrameBuffer(0),
m_selectionDepthBuffer(0),
m_updateLabels(true),
+ m_adjustDirection(Q3DMaps::AdjustHeight),
m_shadowQuality(ShadowLow),
m_shadowQualityToShader(33.3f),
m_bgrHasAlpha(false),
@@ -178,8 +179,6 @@ void Maps3DController::initializeOpenGL()
}
initBackgroundShaders(QStringLiteral(":/shaders/vertexShadow"),
QStringLiteral(":/shaders/fragmentShadow"));
- // Init the depth buffer (for shadows)
- initDepthBuffer();
} else {
if (!m_theme->m_uniformColor) {
initShaders(QStringLiteral(":/shaders/vertex"),
@@ -213,9 +212,6 @@ void Maps3DController::initializeOpenGL()
// Init selection shader
initSelectionShader();
- // Init the selection buffer
- initSelectionBuffer();
-
// Load default mesh
loadBarMesh();
@@ -292,6 +288,14 @@ void Maps3DController::render(const GLuint defaultFboHandle)
}
#endif
+ if (defaultFboHandle) {
+ glDepthMask(true);
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ }
+
// Draw scene
drawScene(defaultFboHandle);
}
@@ -320,8 +324,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
// Calculate view matrix
QMatrix4x4 viewMatrix = m_camera->calculateViewMatrix(m_mousePos,
- m_zoomLevel
- * m_zoomAdjustment,
+ m_zoomLevel * m_autoScaleAdjustment,
m_sceneViewPort.width(),
m_sceneViewPort.height());
@@ -462,8 +465,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
QMatrix4x4 MVPMatrix;
modelMatrix.translate(item->d_ptr->translation().x(),
- heightMultiplier * barHeight + heightScaler
- - m_yAdjustment,
+ heightMultiplier * barHeight + heightScaler - m_yAdjustment,
item->d_ptr->translation().z());
modelMatrix.scale(QVector3D(widthMultiplier * barHeight + widthScaler,
heightMultiplier * barHeight + heightScaler,
@@ -550,8 +552,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
QMatrix4x4 MVPMatrix;
modelMatrix.translate(item->d_ptr->translation().x(),
- heightMultiplier * barHeight + heightScaler
- - m_yAdjustment,
+ heightMultiplier * barHeight + heightScaler - m_yAdjustment,
item->d_ptr->translation().z());
modelMatrix.scale(QVector3D(widthMultiplier * barHeight + widthScaler,
heightMultiplier * barHeight + heightScaler,
@@ -574,23 +575,19 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
(GLfloat)barIdxGreen / 255.0f,
(GLfloat)barIdxBlue / 255.0f);
- m_selectionShader->setUniformValue(m_selectionShader->MVP(),
- MVPMatrix);
- m_selectionShader->setUniformValue(m_selectionShader->color(),
- barColor);
+ m_selectionShader->setUniformValue(m_selectionShader->MVP(), MVPMatrix);
+ m_selectionShader->setUniformValue(m_selectionShader->color(), barColor);
// 1st attribute buffer : vertices
glEnableVertexAttribArray(m_selectionShader->posAtt());
glBindBuffer(GL_ARRAY_BUFFER, m_barObj->vertexBuf());
- glVertexAttribPointer(m_selectionShader->posAtt(),
- 3, GL_FLOAT, GL_FALSE, 0, (void *)0);
+ glVertexAttribPointer(m_selectionShader->posAtt(), 3, GL_FLOAT, GL_FALSE, 0, (void *)0);
// Index buffer
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_barObj->elementBuf());
// Draw the triangles
- glDrawElements(GL_TRIANGLES, m_barObj->indexCount(), GL_UNSIGNED_SHORT,
- (void *)0);
+ glDrawElements(GL_TRIANGLES, m_barObj->indexCount(), GL_UNSIGNED_SHORT, (void *)0);
// Free buffers
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
@@ -669,8 +666,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
depthMVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
QVector3D baseColor = Utils::vectorFromColor(m_theme->m_baseColor);
- QVector3D heightColor = Utils::vectorFromColor(m_theme->m_heightColor)
- * barHeight;
+ QVector3D heightColor = Utils::vectorFromColor(m_theme->m_heightColor) * barHeight;
QVector3D barColor = baseColor + heightColor;
@@ -710,22 +706,17 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
itModelMatrix.inverted().transposed());
m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix);
m_barShader->setUniformValue(m_barShader->color(), barColor);
- m_barShader->setUniformValue(m_barShader->ambientS(),
- m_theme->m_ambientStrength);
+ m_barShader->setUniformValue(m_barShader->ambientS(), m_theme->m_ambientStrength);
#if !defined(QT_OPENGL_ES_2)
if (m_shadowQuality > ShadowNone) {
// Set shadow shader bindings
- m_barShader->setUniformValue(m_barShader->shadowQ(),
- m_shadowQualityToShader);
- m_barShader->setUniformValue(m_barShader->depth(),
- depthMVPMatrix);
- m_barShader->setUniformValue(m_barShader->lightS(),
- lightStrength / 10.0f);
+ m_barShader->setUniformValue(m_barShader->shadowQ(), m_shadowQualityToShader);
+ m_barShader->setUniformValue(m_barShader->depth(), depthMVPMatrix);
+ m_barShader->setUniformValue(m_barShader->lightS(), lightStrength / 10.0f);
// Draw the object
- m_drawer->drawObject(m_barShader, m_barObj,
- 0, m_depthTexture);
+ m_drawer->drawObject(m_barShader, m_barObj, 0, m_depthTexture);
} else
#endif
{
@@ -792,8 +783,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
m_theme->m_lightStrength / 25.0f);
// Draw the object
- m_drawer->drawObject(m_backgroundShader, m_backgroundObj,
- m_bgrTexture, m_depthTexture);
+ m_drawer->drawObject(m_backgroundShader, m_backgroundObj, m_bgrTexture, m_depthTexture);
} else
#endif
{
@@ -802,8 +792,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
m_theme->m_lightStrength);
// Draw the object
- m_drawer->drawObject(m_backgroundShader, m_backgroundObj,
- m_bgrTexture);
+ m_drawer->drawObject(m_backgroundShader, m_backgroundObj, m_bgrTexture);
}
}
@@ -928,8 +917,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
}
QVector3D labelPos = QVector3D((m_rowWidth - barPos) / m_scaleFactor,
-m_yAdjustment + 0.005f, // raise a bit over background to avoid depth "glimmering"
- (m_columnDepth - rowPos) / m_scaleFactor
- + zComp);
+ (m_columnDepth - rowPos) / m_scaleFactor + zComp);
// TODO: Try it; draw the label here
@@ -937,8 +925,8 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
QDataItem *label = new QDataItem();
label->setTranslation(labelPos);
if (m_data->d_ptr->rowLabelItems().size() > row) {
- label->setLabel(m_data->d_ptr->rowLabelItems().at(
- m_data->d_ptr->rowLabelItems().size() - row - 1));
+ label->setLabel(m_data->d_ptr->rowLabelItems().at(m_data->d_ptr->rowLabelItems().size()
+ - row - 1));
}
//qDebug() << "labelPos, row" << row + 1 << ":" << labelPos << m_dataSet->rowLabels().at(row);
@@ -967,8 +955,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
}
QVector3D labelPos = QVector3D((m_rowWidth - barPos) / m_scaleFactor,
-m_yAdjustment + 0.005f, // raise a bit over background to avoid depth "glimmering"
- (m_columnDepth - rowPos) / m_scaleFactor
- + zComp);
+ (m_columnDepth - rowPos) / m_scaleFactor + zComp);
// TODO: Try it; draw the label here
@@ -977,8 +964,7 @@ void Maps3DController::drawScene(const GLuint defaultFboHandle)
label->setTranslation(labelPos);
if (m_data->d_ptr->columnLabelItems().size() > bar) {
label->setLabel(m_data->d_ptr->columnLabelItems().at(
- m_data->d_ptr->columnLabelItems().size()
- - bar - 1));
+ m_data->d_ptr->columnLabelItems().size() - bar - 1));
}
//qDebug() << "labelPos, col" << bar + 1 << ":" << labelPos << m_dataSet->columnLabels().at(bar);
@@ -1123,8 +1109,8 @@ void Maps3DController::mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos
GLfloat focalPoint = tan(45.0f / 2.0f);
// TODO: Testi - laske viewmatriisin kerroin
- QVector3D worldRay = QVector3D(0.0f, 0.0f, 0.0f)
- - QVector3D(mouse3D.x(), mouse3D.y(), -focalPoint);
+ QVector3D worldRay = QVector3D(0.0f, 0.0f, 0.0f) - QVector3D(mouse3D.x(), mouse3D.y(),
+ -focalPoint);
//qDebug() << "worldRay" << worldRay;
// multiply viewmatrix with this to get something?
#endif
@@ -1168,7 +1154,7 @@ void Maps3DController::resizeNotify()
div = qMin(width(), height());
zoomAdjustment = defaultRatio * ((width() / div) / (height() / div));
//qDebug() << "zoom adjustment" << zoomAdjustment;
- m_zoomAdjustment = qMin(zoomAdjustment, 1.0f); // clamp to 1.0f
+ m_autoScaleAdjustment = qMin(zoomAdjustment, 1.0f); // clamp to 1.0f
// Re-init selection buffer
initSelectionBuffer();
@@ -1239,8 +1225,7 @@ void Maps3DController::setCameraPosition(GLfloat horizontal, GLfloat vertical, G
m_horizontalRotation = qBound(-180.0f, horizontal, 180.0f);
m_verticalRotation = qBound(0.0f, vertical, 90.0f);
m_zoomLevel = qBound(10, distance, 500);
- m_camera->setCameraRotation(QPointF(m_horizontalRotation,
- m_verticalRotation));
+ m_camera->setCameraRotation(QPointF(m_horizontalRotation, m_verticalRotation));
//qDebug() << "camera rotation set to" << m_horizontalRotation << m_verticalRotation;
}
@@ -1404,8 +1389,6 @@ void Maps3DController::setShadowQuality(ShadowQuality quality)
if (m_isInitialized) {
#if !defined(QT_OPENGL_ES_2)
if (m_shadowQuality > ShadowNone) {
- // Re-init depth buffer
- initDepthBuffer();
// Re-init shaders
if (!m_theme->m_uniformColor) {
initShaders(QStringLiteral(":/shaders/vertexShadow"),
@@ -1428,6 +1411,8 @@ void Maps3DController::setShadowQuality(ShadowQuality quality)
initBackgroundShaders(QStringLiteral(":/shaders/vertexTexture"),
QStringLiteral(":/shaders/fragmentTexture"));
}
+ // Re-init depth buffer
+ initDepthBuffer();
#else
if (!m_theme->m_uniformColor) {
initShaders(QStringLiteral(":/shaders/vertexES2"),
@@ -1683,8 +1668,10 @@ void Maps3DController::initDepthBuffer()
if (m_depthTexture)
m_textureHelper->deleteTexture(&m_depthTexture);
- m_depthTexture = m_textureHelper->createDepthTexture(this->size(), m_depthFrameBuffer,
- m_shadowQuality);
+ if (m_shadowQuality > ShadowNone) {
+ m_depthTexture = m_textureHelper->createDepthTexture(this->size(), m_depthFrameBuffer,
+ m_shadowQuality);
+ }
}
#endif
@@ -1702,8 +1689,6 @@ void Maps3DController::initLabelShaders(const QString &vertexShader, const QStri
if (m_labelShader)
delete m_labelShader;
m_labelShader = new ShaderHelper(this, vertexShader, fragmentShader);
- // m_labelShader = new ShaderHelper(q_ptr, QStringLiteral(":/shaders/testDepthVert"),
- // QStringLiteral(":/shaders/testDepthFrag"));
m_labelShader->initialize();
}
diff --git a/src/datavis3d/engine/maps3dcontroller_p.h b/src/datavis3d/engine/maps3dcontroller_p.h
index 40fe659f..b1933128 100644
--- a/src/datavis3d/engine/maps3dcontroller_p.h
+++ b/src/datavis3d/engine/maps3dcontroller_p.h
@@ -233,7 +233,7 @@ private:
MousePressType m_mousePressed;
QPoint m_mousePos;
GLint m_zoomLevel;
- GLfloat m_zoomAdjustment;
+ GLfloat m_autoScaleAdjustment;
GLfloat m_horizontalRotation;
GLfloat m_verticalRotation;
QVector3D m_barThickness;
diff --git a/src/datavis3d/engine/qdataitem.cpp b/src/datavis3d/engine/qdataitem.cpp
index 7776fad2..27255429 100644
--- a/src/datavis3d/engine/qdataitem.cpp
+++ b/src/datavis3d/engine/qdataitem.cpp
@@ -80,6 +80,13 @@ QDataItem::QDataItem(float value, const QString &label)
QDataItem::QDataItem(QDataItem &item)
: d_ptr(new QDataItemPrivate(&item))
{
+ d_ptr->m_label = item.d_ptr->m_label;
+ d_ptr->m_labelString = item.d_ptr->m_labelString;
+ d_ptr->m_position = item.d_ptr->m_position;
+ d_ptr->m_prependLabel = item.d_ptr->m_prependLabel;
+ d_ptr->m_selectionLabel = item.d_ptr->m_selectionLabel;
+ d_ptr->m_translation = item.d_ptr->m_translation;
+ d_ptr->m_value = item.d_ptr->m_value;
}
/*!
diff --git a/src/datavis3dqml2/declarativemaps.cpp b/src/datavis3dqml2/declarativemaps.cpp
index 1e93a3bd..7fc94482 100644
--- a/src/datavis3dqml2/declarativemaps.cpp
+++ b/src/datavis3dqml2/declarativemaps.cpp
@@ -101,6 +101,11 @@ QSGNode *DeclarativeMaps::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
m_cachedState->m_isImageSet = false;
}
+ if (m_cachedState->m_isBarSpecsSet) {
+ m_shared->setBarSpecs(m_cachedState->m_thickness, m_cachedState->m_direction);
+ m_cachedState->m_isBarSpecsSet = false;
+ }
+
if (m_cachedState->m_isSelectionModeSet) {
m_shared->setSelectionMode(m_cachedState->m_selectionMode);
m_cachedState->m_isSelectionModeSet = false;
@@ -116,6 +121,55 @@ QSGNode *DeclarativeMaps::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
m_cachedState->m_isShadowQualitySet = false;
}
+ if (m_cachedState->m_fontsize) {
+ m_shared->setFontSize(m_cachedState->m_fontsize);
+ m_cachedState->m_fontsize = 0.0;
+ }
+
+ if (m_cachedState->m_isBarStyleSet) {
+ m_shared->setBarType(m_cachedState->m_barstyle, m_cachedState->m_barsmooth);
+ m_cachedState->m_isBarStyleSet = false;
+ }
+
+ if (m_cachedState->m_isMeshSet) {
+ m_shared->setMeshFileName(m_cachedState->m_meshfilename);
+ m_cachedState->m_isMeshSet = false;
+ }
+
+ if (m_cachedState->m_isCameraPresetSet) {
+ m_shared->setCameraPreset(m_cachedState->m_camerapreset);
+ m_cachedState->m_isCameraPresetSet = false;
+ }
+
+ if (m_cachedState->m_camdistance) {
+ m_shared->setCameraPosition(m_cachedState->m_camhorizontal,
+ m_cachedState->m_camvertical,
+ m_cachedState->m_camdistance);
+ m_cachedState->m_camdistance = 0.0f;
+ }
+
+ if (m_cachedState->m_isThemeSet) {
+ m_shared->setTheme(m_cachedState->m_theme);
+ m_cachedState->m_isThemeSet = false;
+ }
+
+ if (m_cachedState->m_isColorSet) {
+ m_shared->setBarColor(m_cachedState->m_basecolor,
+ m_cachedState->m_heightcolor,
+ m_cachedState->m_coloruniform);
+ m_cachedState->m_isColorSet = false;
+ }
+
+ if (m_cachedState->m_isFontSet) {
+ m_shared->setFont(m_cachedState->m_font);
+ m_cachedState->m_isFontSet = false;
+ }
+
+ if (m_cachedState->m_isLabelTransparencySet) {
+ m_shared->setLabelTransparency(m_cachedState->m_labelTransparency);
+ m_cachedState->m_isLabelTransparencySet = false;
+ }
+
if (m_cachedState->m_data) {
if (m_cachedState->m_replaceData)
m_shared->setData(m_cachedState->m_data);
@@ -148,37 +202,56 @@ QSGNode *DeclarativeMaps::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
void DeclarativeMaps::setBarSpecs(const QVector3D &thickness,
Q3DMaps::AdjustmentDirection direction)
{
- m_shared->setBarSpecs(thickness, direction);
+ m_cachedState->m_thickness = thickness;
+ m_cachedState->m_direction = direction;
+ m_cachedState->m_isBarSpecsSet = true;
+ update();
}
void DeclarativeMaps::setBarType(BarStyle style, bool smooth)
{
- m_shared->setBarType(style, smooth);
+ m_cachedState->m_barstyle = style;
+ m_cachedState->m_barsmooth = smooth;
+ m_cachedState->m_isBarStyleSet = true;
+ update();
}
void DeclarativeMaps::setMeshFileName(const QString &objFileName)
{
- m_shared->setMeshFileName(objFileName);
+ m_cachedState->m_meshfilename = objFileName;
+ m_cachedState->m_isMeshSet = true;
+ update();
}
void DeclarativeMaps::setCameraPreset(CameraPreset preset)
{
- m_shared->setCameraPreset(preset);
+ m_cachedState->m_camerapreset = preset;
+ m_cachedState->m_isCameraPresetSet = true;
+ update();
}
void DeclarativeMaps::setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance)
{
- m_shared->setCameraPosition(horizontal, vertical, distance);
+ m_cachedState->m_camhorizontal = horizontal;
+ m_cachedState->m_camvertical = vertical;
+ m_cachedState->m_camdistance = distance;
+ update();
}
void DeclarativeMaps::setTheme(ColorTheme theme)
{
- m_shared->setTheme(theme);
+ m_cachedState->m_theme = theme;
+ m_cachedState->m_isThemeSet = true;
+ update();
}
void DeclarativeMaps::setBarColor(QColor baseColor, QColor heightColor, bool uniform)
{
- m_shared->setBarColor(baseColor, heightColor, uniform);
+ m_cachedState->m_basecolor = baseColor;
+ m_cachedState->m_heightcolor = heightColor;
+ m_cachedState->m_coloruniform = uniform;
+ m_cachedState->m_isColorSet = true;
+ update();
}
void DeclarativeMaps::setAreaSpecs(const QRect &areaRect, const QImage &image)
@@ -212,27 +285,38 @@ void DeclarativeMaps::setSelectionMode(DeclarativeMaps::SelectionMode mode)
DeclarativeMaps::SelectionMode DeclarativeMaps::selectionMode()
{
- return DeclarativeMaps::SelectionMode(m_shared->selectionMode());
+ if (m_shared)
+ return DeclarativeMaps::SelectionMode(m_shared->selectionMode());
+ else
+ return DeclarativeMaps::ModeBar;
}
void DeclarativeMaps::setFontSize(float fontsize)
{
- m_shared->setFontSize(fontsize);
+ m_cachedState->m_fontsize = fontsize;
}
float DeclarativeMaps::fontSize()
{
- return m_shared->fontSize();
+ if (m_shared)
+ return m_shared->fontSize();
+ else
+ return QFont(QStringLiteral("Arial")).pointSizeF();
}
void DeclarativeMaps::setFont(const QFont &font)
{
- m_shared->setFont(font);
+ m_cachedState->m_font = font;
+ m_cachedState->m_isFontSet = true;
+ update();
}
QFont DeclarativeMaps::font()
{
- return m_shared->font();
+ if (m_shared)
+ return m_shared->font();
+ else
+ return QFont(QStringLiteral("Arial"));
}
void DeclarativeMaps::setLabelTransparency(DeclarativeMaps::LabelTransparency transparency)
@@ -244,7 +328,10 @@ void DeclarativeMaps::setLabelTransparency(DeclarativeMaps::LabelTransparency tr
DeclarativeMaps::LabelTransparency DeclarativeMaps::labelTransparency()
{
- return DeclarativeMaps::LabelTransparency(m_shared->labelTransparency());
+ if (m_shared)
+ return DeclarativeMaps::LabelTransparency(m_shared->labelTransparency());
+ else
+ return DeclarativeMaps::TransparencyFromTheme;
}
void DeclarativeMaps::setShadowQuality(DeclarativeMaps::ShadowQuality quality)
@@ -256,7 +343,10 @@ void DeclarativeMaps::setShadowQuality(DeclarativeMaps::ShadowQuality quality)
DeclarativeMaps::ShadowQuality DeclarativeMaps::shadowQuality()
{
- return DeclarativeMaps::ShadowQuality(m_shared->shadowQuality());
+ if (m_shared)
+ return DeclarativeMaps::ShadowQuality(m_shared->shadowQuality());
+ else
+ return DeclarativeMaps::ShadowLow;
}
void DeclarativeMaps::addDataItem(QDataItem *dataItem)
@@ -398,7 +488,22 @@ void DeclarativeMapsRenderer::render()
DeclarativeMapsCachedStatePrivate::DeclarativeMapsCachedStatePrivate()
- : m_data(0)
+ : m_data(0),
+ m_replaceData(false),
+ m_isImageSet(false),
+ m_isBarSpecsSet(false),
+ m_isAreaRectSet(false),
+ m_isSelectionModeSet(false),
+ m_isLabelTransparencySet(false),
+ m_isShadowQualitySet(false),
+ m_fontsize(0.0f),
+ m_isBarStyleSet(false),
+ m_isMeshSet(false),
+ m_isCameraPresetSet(false),
+ m_camdistance(0.0f),
+ m_isThemeSet(false),
+ m_isColorSet(false),
+ m_isFontSet(false)
{
}
diff --git a/src/datavis3dqml2/declarativemaps_p.h b/src/datavis3dqml2/declarativemaps_p.h
index afbc5cf9..2d3ef6eb 100644
--- a/src/datavis3dqml2/declarativemaps_p.h
+++ b/src/datavis3dqml2/declarativemaps_p.h
@@ -53,6 +53,7 @@
#define DECLARATIVEMAPS_P_H
#include "datavis3dglobal_p.h"
+#include "maps3dcontroller_p.h"
#include <QString>
QT_DATAVIS3D_BEGIN_NAMESPACE
@@ -76,6 +77,10 @@ public:
bool m_isImageSet;
QImage m_image;
+ bool m_isBarSpecsSet;
+ QVector3D m_thickness;
+ Q3DMaps::AdjustmentDirection m_direction;
+
bool m_isAreaRectSet;
QRect m_arearect;
@@ -87,6 +92,33 @@ public:
bool m_isShadowQualitySet;
ShadowQuality m_shadowQuality;
+
+ float m_fontsize;
+
+ bool m_isBarStyleSet;
+ BarStyle m_barstyle;
+ bool m_barsmooth;
+
+ bool m_isMeshSet;
+ QString m_meshfilename;
+
+ bool m_isCameraPresetSet;
+ CameraPreset m_camerapreset;
+
+ float m_camhorizontal;
+ float m_camvertical;
+ float m_camdistance;
+
+ bool m_isThemeSet;
+ ColorTheme m_theme;
+
+ bool m_isColorSet;
+ QColor m_basecolor;
+ QColor m_heightcolor;
+ bool m_coloruniform;
+
+ bool m_isFontSet;
+ QFont m_font;
};
QT_DATAVIS3D_END_NAMESPACE