summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjuhvu <qt-info@nokia.com>2011-06-10 15:47:12 +1000
committerjuhvu <qt-info@nokia.com>2011-06-10 15:47:12 +1000
commit416fdb11c2649f72a04cfe9c64d5fdc4cc175aa3 (patch)
tree637ab68b4ece7fed8e5c3ba6c6601505bbee1f97
parent06dd9db5b1d807b9fcd323700d3543421935a54c (diff)
downloadqtlocation-416fdb11c2649f72a04cfe9c64d5fdc4cc175aa3.tar.gz
Some maps scenegraphing drafting.
-rw-r--r--examples/declarative/map3d/Dialog.qml171
-rwxr-xr-xexamples/declarative/map3d/TitleBar.qml76
-rwxr-xr-xexamples/declarative/map3d/common/Button.qml96
-rw-r--r--examples/declarative/map3d/common/Menu.qml109
-rw-r--r--examples/declarative/map3d/common/Slider.qml109
-rwxr-xr-xexamples/declarative/map3d/common/TitleBar.qml86
-rw-r--r--examples/declarative/map3d/map3d.pro14
-rw-r--r--examples/declarative/map3d/map3d.qml377
-rw-r--r--examples/declarative/map3d/map3d.qrc23
-rw-r--r--examples/declarative/map3d/qmlmap3d.cpp103
-rwxr-xr-xexamples/declarative/map3d/quit.pngbin0 -> 2369 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/button.pngbin0 -> 2550 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/button.sci5
-rwxr-xr-xexamples/declarative/map3d/resources/button_hovered.pngbin0 -> 2572 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/button_pressed.pngbin0 -> 2969 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/menuItem.pngbin0 -> 1436 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/menuItem.sci5
-rwxr-xr-xexamples/declarative/map3d/resources/menuItem_hovered.pngbin0 -> 1380 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/menuItem_pressed.pngbin0 -> 1389 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/quit.pngbin0 -> 2369 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/quit_hovered.pngbin0 -> 2224 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/quit_pressed.pngbin0 -> 2448 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/titlebar.pngbin0 -> 1436 bytes
-rwxr-xr-xexamples/declarative/map3d/resources/titlebar.sci5
-rwxr-xr-xexamples/declarative/map3d/titlebar.pngbin0 -> 1436 bytes
-rwxr-xr-xexamples/declarative/map3d/titlebar.sci5
-rw-r--r--src/imports/location.pro116
-rw-r--r--src/imports/location/location.cpp3
-rw-r--r--src/imports/location/location.pro6
-rw-r--r--src/imports/location/qdeclarative3dgraphicsgeomap.cpp924
-rw-r--r--src/imports/location/qdeclarative3dgraphicsgeomap_p.h212
31 files changed, 2442 insertions, 3 deletions
diff --git a/examples/declarative/map3d/Dialog.qml b/examples/declarative/map3d/Dialog.qml
new file mode 100644
index 00000000..59b5b3b4
--- /dev/null
+++ b/examples/declarative/map3d/Dialog.qml
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "common" as Common
+
+Item {
+ id: dialog
+ signal goButtonClicked
+ signal cancelButtonClicked
+
+ anchors.fill: parent
+
+ property alias title: titleBar.text
+ property alias dialogModel: dialogModel
+ property alias length: dialogModel.count
+ property int gap: 20
+ property int listItemHeight: 54
+
+ function setModel(objects)
+ {
+ for (var i=0; i< objects.length; i++){
+ dialogModel.append({"label": objects[i][0], "inputText": objects[i][1]})
+ }
+ }
+
+ Rectangle {
+ id: fader
+ anchors.fill: parent
+ opacity: 0.7
+ color: "darkgrey"
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+ }
+
+ Rectangle {
+ id: dialogRectangle
+
+ color: "lightsteelblue"
+ opacity: 1
+ width: parent.width - gap;
+ height: listview.height + titleBar.height + buttonGo.height + gap*2
+
+ anchors {
+ top: parent.top
+ topMargin: 50
+ left: parent.left
+ leftMargin: gap/2
+ }
+
+ border.width: 1
+ border.color: "darkblue"
+ radius: 5
+
+ Common.TitleBar {
+ id: titleBar;
+ width: parent.width; height: 40;
+ anchors.top: parent.top; anchors.left: parent.left;
+ opacity: 0.9; text: dialog.title;
+ onClicked: { dialog.cancelButtonClicked() }
+ }
+
+ ListModel {
+ id: dialogModel
+ }
+
+ Component{
+ id: listDelegate
+ Column {
+ id: column1
+ height: listItemHeight
+ Text { id: fieldTitle; text: label; height: 24;}
+ Rectangle {
+ id: inputRectangle
+ width: dialogRectangle.width - gap; height: 30
+ color: "whitesmoke"
+ border.width: 1
+ radius: 5
+ TextInput {
+ id: inputField
+ text: inputText
+ focus: true
+ width: parent.width - anchors.leftMargin
+
+ anchors {
+ left: parent.left;
+ verticalCenter: parent.verticalCenter;
+ leftMargin: 5
+ }
+ onTextChanged:
+ {
+ dialogModel.set(index, {"inputText": text})
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: inputField.forceActiveFocus();
+ }
+ }
+ }
+ }
+
+ ListView {
+ id: listview
+ anchors {
+ top: titleBar.bottom
+ topMargin: gap
+ left: parent.left
+ leftMargin: gap/2
+ }
+ model: dialogModel
+ delegate: listDelegate
+ spacing: gap
+ interactive: false
+ Component.onCompleted: {
+ height = (listItemHeight + gap)*length
+ }
+ }
+
+ Common.Button {
+ id: buttonGo
+ text: "Go!"
+ anchors.top: listview.bottom
+ width: 80; height: 32
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ dialog.goButtonClicked ()
+ }
+ }
+ }
+}
+
diff --git a/examples/declarative/map3d/TitleBar.qml b/examples/declarative/map3d/TitleBar.qml
new file mode 100755
index 00000000..0a85802e
--- /dev/null
+++ b/examples/declarative/map3d/TitleBar.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 5.0
+
+Item {
+ id: titleBar
+ BorderImage { source: "titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
+
+ Item {
+ id: container
+ width: (parent.width * 2) - 55 ; height: parent.height
+
+ Image {
+ id: quitButton
+ anchors.left: parent.left//; anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: "quit.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+
+ Text {
+ id: categoryText
+ anchors {
+ left: quitButton.right; leftMargin: 10; rightMargin: 10
+ verticalCenter: parent.verticalCenter
+ }
+ elide: Text.ElideLeft
+ text: "Mapviewer example"
+ font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black"
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
+ }
+}
diff --git a/examples/declarative/map3d/common/Button.qml b/examples/declarative/map3d/common/Button.qml
new file mode 100755
index 00000000..a74de923
--- /dev/null
+++ b/examples/declarative/map3d/common/Button.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ signal clicked
+
+ property alias text: buttonText.text
+ property alias color: buttonText.color
+
+ function disable() {
+ container.state = "Disabled";
+ }
+
+ function enable() {
+ container.state = "";
+ }
+
+ BorderImage {
+ id: buttonImage
+ source: "../resources/button.sci"
+ width: container.width; height: container.height
+ }
+
+ MouseArea {
+ id: mouseRegion
+ anchors.fill: buttonImage
+ hoverEnabled: true
+ onClicked: { container.clicked(); }
+ }
+ Text {
+ id: buttonText
+ color: "white"
+ anchors.centerIn: buttonImage; font.bold: true
+ style: Text.Raised; styleColor: "black"
+ }
+
+ states: [
+ State {
+ name: "Pressed"
+ when: mouseRegion.pressed == true
+ PropertyChanges { target: buttonImage; source: "../resources/button_pressed.png" }
+ PropertyChanges { target: buttonText; style: Text.Sunken }
+ },
+ State {
+ name: "Hovered"
+ when: mouseRegion.containsMouse
+ PropertyChanges{ target: buttonImage; source: "../resources/button_hovered.png" }
+ },
+ State {
+ name: "Disabled"
+ PropertyChanges{ target: buttonText; color: "grey" }
+ PropertyChanges{ target: mouseRegion; enabled: false }
+ }
+ ]
+}
diff --git a/examples/declarative/map3d/common/Menu.qml b/examples/declarative/map3d/common/Menu.qml
new file mode 100644
index 00000000..89efc983
--- /dev/null
+++ b/examples/declarative/map3d/common/Menu.qml
@@ -0,0 +1,109 @@
+import QtQuick 2.0
+
+Item {
+ id: menu
+ property int gap: 0
+ property int button: 0
+ property alias orientation: menuView.orientation
+ property alias count: menuModel.count
+ property int itemHeight //to create menu just set menu item height and width, do not set menu's height and width explicitly
+ property int itemWidth
+// height: (menuView.orientation == ListView.Horizontal)? itemHeight : itemHeight * count
+ width: (menuView.orientation == ListView.Horizontal)? itemWidth * count : itemWidth
+
+ signal clicked
+
+ function setModel(objects)
+ {
+ for (var i=0; i< objects.length; i++){
+ menuModel.append({"label": objects[i], "enabledItem" : true})
+ }
+ height = (menuView.orientation == ListView.Horizontal)? itemHeight : itemHeight * count
+ }
+
+ function disableItem(index){
+ menuModel.set(index, {"enabledItem": false})
+ }
+
+ function enableItem(index){
+ menuModel.set(index, {"enabledItem": true})
+ }
+
+ ListModel {
+ id: menuModel
+ }
+
+ Component{
+ id: menuItemDelegate
+ Item {
+ height: itemHeight
+ width: itemWidth
+
+ BorderImage {
+ id: menuItemImage;
+ source: "../resources/menuItem.sci";
+ height: parent.height + 14;
+ width: parent.width
+ y: -7
+ }
+
+ Text {
+ id: menuItemText
+ text: label;
+ elide: Text.ElideLeft
+ font.bold: true;
+ color: "white"
+ style: Text.Raised;
+ styleColor: "dimgrey"
+ anchors.verticalCenter: parent.verticalCenter
+ Component.onCompleted: {
+ if (menuView.orientation == ListView.Horizontal){
+ anchors.horizontalCenter = parent.horizontalCenter
+ }
+ else {
+ anchors.left = parent.left
+ anchors.leftMargin = 10
+ }
+ }
+ }
+ MouseArea {
+ id: mouseRegion
+ anchors.fill: parent
+ hoverEnabled: true
+ enabled: enabledItem
+ onClicked: {
+ button = index
+ menu.clicked()
+ }
+ }
+
+ states: [
+ State {
+ name: "Pressed"
+ when: mouseRegion.pressed == true
+ PropertyChanges { target: menuItemImage; source: "../resources/menuItem_pressed.png"}
+ PropertyChanges { target: menuItemText; style: Text.Sunken }
+ },
+ State {
+ name: "Hovered"
+ when: mouseRegion.containsMouse == true
+ PropertyChanges { target: menuItemImage; source: "../resources/menuItem_hovered.png"}
+ },
+ State {
+ name: "Disabled"
+ when: mouseRegion.enabled == false
+ PropertyChanges { target: menuItemText; color: "grey"}
+ }
+ ]
+ }
+ }
+
+ ListView {
+ id: menuView
+ anchors.fill: parent
+ model: menuModel
+ delegate: menuItemDelegate
+ spacing: gap
+ interactive: false
+ }
+}
diff --git a/examples/declarative/map3d/common/Slider.qml b/examples/declarative/map3d/common/Slider.qml
new file mode 100644
index 00000000..ce3b37b9
--- /dev/null
+++ b/examples/declarative/map3d/common/Slider.qml
@@ -0,0 +1,109 @@
+/*/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: slider;
+ height: 40
+ // value is read/write.
+ property int value
+ property real minimum: 0
+ property real maximum: 1
+ property int xMin: 2
+ property int xMax: slider.width - handle.width-xMin
+
+ Rectangle {
+ anchors.fill: parent
+ border.width: 0;
+ radius: 8
+ color: "dimgrey"
+ opacity: 0.6
+ }
+
+ Rectangle {
+ id: handle; smooth: true
+ width: 30;
+ y: xMin;
+ x: xMin + (value - minimum) * slider.xMax / (maximum - minimum)
+
+ height: slider.height-4; radius: 6
+ gradient: normalGradient
+
+ Gradient {
+ id: normalGradient
+ GradientStop { position: 0.0; color: "lightgrey" }
+ GradientStop { position: 1.0; color: "gray" }
+ }
+
+ Gradient {
+ id: pressedGradient
+ GradientStop { position: 0.0; color: "lightgray" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ Gradient {
+ id: hoveredGradient
+ GradientStop { position: 0.0; color: "lightgrey" }
+ GradientStop { position: 1.0; color: "dimgrey" }
+ }
+
+ MouseArea {
+ id: mouseRegion
+ hoverEnabled: true
+ anchors.fill: parent; drag.target: parent
+ drag.axis: Drag.XAxis; drag.minimumX: slider.xMin; drag.maximumX: slider.xMax
+ onPositionChanged: { value = (maximum - minimum) * (handle.x-slider.xMin) / (slider.xMax - slider.xMin) + minimum; }
+ }
+ }
+
+ states: [
+ State {
+ name: "Pressed"
+ when: mouseRegion.pressed
+ PropertyChanges { target: handle; gradient: pressedGradient }
+ },
+ State {
+ name: "Hovered"
+ when: mouseRegion.containsMouse
+ PropertyChanges { target: handle; gradient: hoveredGradient }
+ }
+ ]
+}
diff --git a/examples/declarative/map3d/common/TitleBar.qml b/examples/declarative/map3d/common/TitleBar.qml
new file mode 100755
index 00000000..f0700a8d
--- /dev/null
+++ b/examples/declarative/map3d/common/TitleBar.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: titleBar
+
+ property alias text:titleText.text
+ property alias hoverEnabled: mouseRegion.hoverEnabled
+ signal clicked
+
+ BorderImage { source: "../resources/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
+
+ Image {
+ id: quitButton
+ anchors.right: parent.right; anchors.rightMargin: 10
+ anchors.verticalCenter: parent.verticalCenter
+ source: "../resources/quit.png"
+ MouseArea {
+ id: mouseRegion
+ hoverEnabled: true
+ anchors.fill: parent
+ onClicked: { titleBar.clicked(); }
+ }
+ }
+
+ Text {
+ id: titleText
+ anchors {
+ left: parent.left; leftMargin: 10; verticalCenter: parent.verticalCenter
+ }
+ elide: Text.ElideLeft
+ font.bold: true; color: "white"; style: Text.Raised; styleColor: "dimgrey"
+ }
+
+ states: [
+ State {
+ name: "Pressed"
+ when: mouseRegion.pressed
+ PropertyChanges { target: quitButton; source: "../resources/quit_pressed.png" }
+ },
+ State {
+ name: "Hover"
+ when: mouseRegion.containsMouse
+ PropertyChanges { target: quitButton; source: "../resources/quit_hovered.png" }
+ }
+ ]
+}
diff --git a/examples/declarative/map3d/map3d.pro b/examples/declarative/map3d/map3d.pro
new file mode 100644
index 00000000..1dbfbbb2
--- /dev/null
+++ b/examples/declarative/map3d/map3d.pro
@@ -0,0 +1,14 @@
+TARGET = qml_location_map3d
+TEMPLATE=app
+
+QT += declarative network
+SOURCES += qmlmap3d.cpp
+
+RESOURCES += \
+ map3d.qrc
+
+target.path = $$[QT_INSTALL_DEMOS]/qtlocation/declarative/mapviewer
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.qml *.png *.sci
+sources.path = $$[QT_INSTALL_DEMOS]/qtlocation/declarative/mapviewer
+
+INSTALLS += target sources
diff --git a/examples/declarative/map3d/map3d.qml b/examples/declarative/map3d/map3d.qml
new file mode 100644
index 00000000..116f991b
--- /dev/null
+++ b/examples/declarative/map3d/map3d.qml
@@ -0,0 +1,377 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.location 5.0
+import "common" as Common
+
+
+Rectangle {
+ //anchors.fill: parent
+ width: 360
+ height: 640
+ id: page
+ color: 'red'
+
+ //Rectangle {
+ // anchors.fill: parent
+ // color: "darkgrey"
+ // z:2
+ // }
+
+ Common.TitleBar {
+ id: titleBar; z: 4; width: parent.width; height: 40; opacity: 0.9; text: "QML mapviewer example"
+ onClicked: { Qt.quit() }
+ }
+
+ Common.Slider {
+ id: zoomSlider;
+ minimum: map.minimumZoomLevel;
+ maximum: map.maximumZoomLevel;
+ opacity: 1
+ z: 4
+ anchors {
+ bottom: mainMenu.top;
+ bottomMargin: 5; rightMargin: 5; leftMargin: 5
+ left: parent.left
+ }
+ width: parent.width - anchors.rightMargin - anchors.leftMargin
+ value: map.zoomLevel
+ onValueChanged: {
+ map.zoomLevel = value
+ }
+ }
+
+ // Menus
+ Common.Menu {
+ id: mainMenu
+ itemHeight: 40
+ itemWidth: page.width / count
+ anchors.bottom: parent.bottom
+ orientation: ListView.Horizontal
+ z: 5
+ Component.onCompleted: {
+ setModel(["Options","Settings"])
+ }
+ onClicked: {
+ switch (button) {
+ case 0: {
+ page.state = "Options"
+ break;
+ }
+ case 1: {
+ page.state = "Settings"
+ break;
+ }
+ }
+ }
+
+ }
+
+ Common.Menu {
+ id: optionsMenu
+ orientation: ListView.Vertical
+ z: mainMenu.z - 1
+ Component.onCompleted: {
+ setModel(["Reverse geocode", "Geocode","Search", "Route"])
+ disableItem(2)
+ }
+ itemHeight: 30;
+ itemWidth: mainMenu.itemWidth
+ anchors.left: mainMenu.left
+ y: page.height
+
+ onClicked: {
+ switch (button) {
+ case 0: {
+ page.state = "RevGeocode"
+ break;
+ }
+ case 1: {
+ page.state = "Geocode"
+ break;
+ }
+ case 2: {
+ page.state = "Search"
+ break;
+ }
+ case 3: {
+ page.state = "Route"
+ break;
+ }
+ }
+ }
+ }
+
+ Common.Menu {
+ id: settingsMenu
+ orientation: ListView.Vertical
+ z: mainMenu.z - 1
+ Component.onCompleted: {
+ setModel(["Map type", "Provider"])
+ disableItem(0)
+ disableItem(1)
+ }
+
+ itemHeight: 30;
+ itemWidth: mainMenu.itemWidth
+ y: page.height
+ anchors.right: mainMenu.right
+
+ onClicked: {
+ switch (button) {
+ case 0: {
+ console.log("Map type");
+ break;
+ }
+ case 1: {
+ console.log("Provider")
+ break;
+ }
+ }
+ }
+ }
+
+ // Dialogs
+ Dialog {
+ id: routeDialog
+ title: "Routing from map center to"
+ z: 5
+ opacity: 0
+
+ Component.onCompleted: {
+ var obj = [["latitude:", "51.2207"],["and longitude:", "0.1"]]
+ setModel(obj)
+ }
+ Coordinate {
+ id: endCoordinate
+ }
+ onGoButtonClicked: {
+ page.state = ""
+ endCoordinate.latitude = dialogModel.get(0).inputText
+ endCoordinate.longitude = dialogModel.get(1).inputText
+ routeQuery.clearWaypoints();
+ routeQuery.addWaypoint(map.center) // Starting coordinate
+ routeQuery.addWaypoint(endCoordinate) // Ending coordinate
+ routeModel.update();
+ }
+ onCancelButtonClicked: {
+ page.state = ""
+ }
+ }
+
+ Dialog {
+ id: searchDialog
+ title: "Search"
+ z: 5
+ opacity: 0
+
+ onGoButtonClicked: {
+ page.state = ""
+// searchModel.searchString = dialogModel.get(0).inputText
+// searchModel.update();
+ }
+ Component.onCompleted: {
+ var obj = [["Please enter thing to search:","53 Brandl St, Eight Mile Plains, Australia"]]
+ setModel(obj)
+ }
+ onCancelButtonClicked: {
+ page.state = ""
+ }
+ }
+
+ Dialog {
+ id: geocodeDialog
+ title: "Geocode"
+ z: 5
+ opacity: 0
+
+ Component.onCompleted: {
+ var obj = [["Country:","Australia"],["Street:", "Brandl St 53"],["District:","Eight Mile Plains"]]
+ setModel(obj)
+ }
+ onGoButtonClicked: {
+ page.state = ""
+ geocodeAddress.country = dialogModel.get(0).inputText
+ geocodeAddress.street = dialogModel.get(1).inputText
+ geocodeAddress.district = dialogModel.get(2).inputText
+ geocodeModel.query = geocodeAddress
+ geocodeModel.update();
+ }
+ onCancelButtonClicked: {
+ page.state = ""
+ }
+ }
+
+ Dialog {
+ id: reverseGeocodeDialog
+ title: "Reverse Geocode"
+ z: 5
+ opacity: 0
+
+ Component.onCompleted: {
+ var obj = [["Latitude:","51"],["Longitude:", "0"]]
+ setModel(obj)
+ }
+ onGoButtonClicked: {
+ page.state = ""
+ reverseGeocodeCoordinate.latitude = dialogModel.get(0).inputText
+ reverseGeocodeCoordinate.longitude = dialogModel.get(1).inputText
+ geocodeModel.query = reverseGeocodeCoordinate
+ geocodeModel.update();
+ }
+ onCancelButtonClicked: {
+ page.state = ""
+ }
+ }
+
+ RouteModel {
+ id : routeModel
+ plugin : Plugin { name : "nokia"}
+ query: RouteQuery {
+ id: routeQuery
+ }
+ onCountChanged: {
+ console.log('map count changed');
+ if (routeModel.count > 0) {
+
+ for (var ind = 0; ind < routeModel.get(0).path.length; ind++) {
+ polyline.addCoordinate(routeModel.get(0).path[ind]);
+ }
+ map.addMapObject(polyline);
+ }
+ }
+ }
+
+ Address {
+ id: geocodeAddress
+ }
+ Coordinate {
+ id: reverseGeocodeCoordinate
+ }
+ GeocodeModel {
+ id: geocodeModel
+ plugin : Plugin { name : "nokia"}
+ onPlacesChanged: {
+ if (geocodeModel.count > 0) {
+ console.log('setting the coordinate as places changed in model.')
+ map.center = geocodeModel.get(0).coordinate
+ }
+ }
+ }
+
+ Map3D {
+ Component.onCompleted: console.log('width is: ' + width + 'parent.width is: ' + parent.width + 'page.width is: ' + page.width)
+ id: map
+ z : 3
+ plugin : Plugin {name : "nokia"}
+ size.width: parent.width
+ size.height: parent.height
+ zoomLevel: 9
+ focus : true
+ center: Coordinate {
+ latitude: 51.5
+ longitude: -0.11
+ }
+
+ } // Map
+
+ Keys.onPressed: {
+ if ((event.key == Qt.Key_Plus) || (event.key == Qt.Key_VolumeUp)) {
+ map.zoomLevel += 1
+ } else if ((event.key == Qt.Key_Minus) || (event.key == Qt.Key_VolumeDown)){
+ map.zoomLevel -= 1
+ } else if (event.key == Qt.Key_T) {
+ if (map.mapType == Map.StreetMap) {
+ map.mapType = Map.SatelliteMapDay
+ } else if (map.mapType == Map.SatelliteMapDay) {
+ map.mapType = Map.StreetMap
+ }
+ }
+ }
+
+ // states of page
+ states: [
+ State {
+ name: "RevGeocode"
+ PropertyChanges { target: reverseGeocodeDialog; opacity: 1 }
+ PropertyChanges { target: titleBar; hoverEnabled: false }
+ },
+ State {
+ name: "Route"
+ PropertyChanges { target: routeDialog; opacity: 1 }
+ PropertyChanges { target: titleBar; hoverEnabled: false }
+ },
+ State {
+ name: "Search"
+ PropertyChanges { target: searchDialog; opacity: 1 }
+ PropertyChanges { target: titleBar; hoverEnabled: false }
+ },
+ State {
+ name: "Geocode"
+ PropertyChanges { target: geocodeDialog; opacity: 1 }
+ PropertyChanges { target: titleBar; hoverEnabled: false }
+ },
+ State {
+ name : "Options"
+ PropertyChanges { target: optionsMenu; y: page.height - optionsMenu.height - mainMenu.height }
+ },
+ State {
+ name : "Settings"
+ PropertyChanges { target: settingsMenu; y: page.height - settingsMenu.height - mainMenu.height }
+ }
+ ]
+
+ // state-transition animations for page
+ transitions: [
+ Transition {
+ NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear }
+ },
+ Transition {
+ to: "Settings"
+ NumberAnimation { properties: "y" ; duration: 300; easing.type: Easing.Linear }
+ },
+ Transition {
+ to: "Options"
+ NumberAnimation { properties: "y" ; duration: 300; easing.type: Easing.Linear }
+ }
+ ]
+}
+
diff --git a/examples/declarative/map3d/map3d.qrc b/examples/declarative/map3d/map3d.qrc
new file mode 100644
index 00000000..2d7deba9
--- /dev/null
+++ b/examples/declarative/map3d/map3d.qrc
@@ -0,0 +1,23 @@
+<RCC>
+ <qresource prefix="/">
+ <file>map3d.qml</file>
+ <file>Dialog.qml</file>
+ <file>common/TitleBar.qml</file>
+ <file>common/Button.qml</file>
+ <file>common/Slider.qml</file>
+ <file>common/Menu.qml</file>
+ <file>resources/button.png</file>
+ <file>resources/button.sci</file>
+ <file>resources/quit.png</file>
+ <file>resources/titlebar.png</file>
+ <file>resources/titlebar.sci</file>
+ <file>resources/quit_pressed.png</file>
+ <file>resources/menuItem.png</file>
+ <file>resources/menuItem.sci</file>
+ <file>resources/menuItem_pressed.png</file>
+ <file>resources/quit_hovered.png</file>
+ <file>resources/menuItem_hovered.png</file>
+ <file>resources/button_pressed.png</file>
+ <file>resources/button_hovered.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/declarative/map3d/qmlmap3d.cpp b/examples/declarative/map3d/qmlmap3d.cpp
new file mode 100644
index 00000000..08b7541c
--- /dev/null
+++ b/examples/declarative/map3d/qmlmap3d.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include <QtDeclarative/QDeclarativeEngine>
+#include <QNetworkProxy>
+#include <QtDeclarative/qsgview.h>
+
+// QML2 app
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QGLFormat f = QGLFormat::defaultFormat();
+ f.setSampleBuffers(true);
+ QSGView view(f);
+
+ const QString mainQmlApp = QLatin1String("qrc:///map3d.qml");
+ view.setSource(QUrl(mainQmlApp));
+ // Temporary development-time proxy setting. TODO improve later.
+ QNetworkProxy proxy;
+ proxy.setType(QNetworkProxy::HttpProxy);
+ proxy.setHostName("nokes.nokia.com");
+ proxy.setPort(8080);
+ QNetworkProxy::setApplicationProxy(proxy);
+ // Qt.quit() called in embedded .qml by default only emits
+ // quit() signal, so do this (optionally use Qt.exit()).
+ QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
+ if (QApplication::arguments().contains(QLatin1String("-maximize"))) {
+ view.showMaximized();
+ } else if (QApplication::arguments().contains(QLatin1String("-fullscreen"))) {
+ view.showFullScreen();
+ } else {
+ view.setGeometry(QRect(100, 100, 360, 640));
+ //view.showMaximized();
+ view.show();
+ }
+ return app.exec();
+}
+
+
+
+/*
+int main(int argc, char *argv[])
+{
+ QApplication application(argc, argv);
+ const QString mainQmlApp = QLatin1String("qrc:///map3d.qml");
+ QDeclarativeView view;
+ view.setSource(QUrl(mainQmlApp));
+ view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
+
+ // Temporary development-time proxy setting
+ // TODO improve later.
+ QNetworkProxy proxy;
+ proxy.setType(QNetworkProxy::HttpProxy);
+ proxy.setHostName("nokes.nokia.com");
+ proxy.setPort(8080);
+ QNetworkProxy::setApplicationProxy(proxy);
+ // Qt.quit() called in embedded .qml by default only emits
+ // quit() signal, so do this (optionally use Qt.exit()).
+ QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
+ view.setGeometry(QRect(100, 100, 360, 640));
+ view.show();
+ return application.exec();
+}
+*/
diff --git a/examples/declarative/map3d/quit.png b/examples/declarative/map3d/quit.png
new file mode 100755
index 00000000..5bda1b6e
--- /dev/null
+++ b/examples/declarative/map3d/quit.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/button.png b/examples/declarative/map3d/resources/button.png
new file mode 100755
index 00000000..11310013
--- /dev/null
+++ b/examples/declarative/map3d/resources/button.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/button.sci b/examples/declarative/map3d/resources/button.sci
new file mode 100755
index 00000000..a34a58b6
--- /dev/null
+++ b/examples/declarative/map3d/resources/button.sci
@@ -0,0 +1,5 @@
+border.left: 15
+border.top: 4
+border.bottom: 4
+border.right: 15
+source: button.png
diff --git a/examples/declarative/map3d/resources/button_hovered.png b/examples/declarative/map3d/resources/button_hovered.png
new file mode 100755
index 00000000..7c9b9b63
--- /dev/null
+++ b/examples/declarative/map3d/resources/button_hovered.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/button_pressed.png b/examples/declarative/map3d/resources/button_pressed.png
new file mode 100755
index 00000000..b290b6b9
--- /dev/null
+++ b/examples/declarative/map3d/resources/button_pressed.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/menuItem.png b/examples/declarative/map3d/resources/menuItem.png
new file mode 100755
index 00000000..51c90082
--- /dev/null
+++ b/examples/declarative/map3d/resources/menuItem.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/menuItem.sci b/examples/declarative/map3d/resources/menuItem.sci
new file mode 100755
index 00000000..0418d94c
--- /dev/null
+++ b/examples/declarative/map3d/resources/menuItem.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 12
+border.bottom: 12
+border.right: 10
+source: titlebar.png
diff --git a/examples/declarative/map3d/resources/menuItem_hovered.png b/examples/declarative/map3d/resources/menuItem_hovered.png
new file mode 100755
index 00000000..16c1a94e
--- /dev/null
+++ b/examples/declarative/map3d/resources/menuItem_hovered.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/menuItem_pressed.png b/examples/declarative/map3d/resources/menuItem_pressed.png
new file mode 100755
index 00000000..3ab14f1f
--- /dev/null
+++ b/examples/declarative/map3d/resources/menuItem_pressed.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/quit.png b/examples/declarative/map3d/resources/quit.png
new file mode 100755
index 00000000..5bda1b6e
--- /dev/null
+++ b/examples/declarative/map3d/resources/quit.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/quit_hovered.png b/examples/declarative/map3d/resources/quit_hovered.png
new file mode 100755
index 00000000..d4b900cf
--- /dev/null
+++ b/examples/declarative/map3d/resources/quit_hovered.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/quit_pressed.png b/examples/declarative/map3d/resources/quit_pressed.png
new file mode 100755
index 00000000..05c4ef83
--- /dev/null
+++ b/examples/declarative/map3d/resources/quit_pressed.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/titlebar.png b/examples/declarative/map3d/resources/titlebar.png
new file mode 100755
index 00000000..51c90082
--- /dev/null
+++ b/examples/declarative/map3d/resources/titlebar.png
Binary files differ
diff --git a/examples/declarative/map3d/resources/titlebar.sci b/examples/declarative/map3d/resources/titlebar.sci
new file mode 100755
index 00000000..0418d94c
--- /dev/null
+++ b/examples/declarative/map3d/resources/titlebar.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 12
+border.bottom: 12
+border.right: 10
+source: titlebar.png
diff --git a/examples/declarative/map3d/titlebar.png b/examples/declarative/map3d/titlebar.png
new file mode 100755
index 00000000..51c90082
--- /dev/null
+++ b/examples/declarative/map3d/titlebar.png
Binary files differ
diff --git a/examples/declarative/map3d/titlebar.sci b/examples/declarative/map3d/titlebar.sci
new file mode 100755
index 00000000..0418d94c
--- /dev/null
+++ b/examples/declarative/map3d/titlebar.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 12
+border.bottom: 12
+border.right: 10
+source: titlebar.png
diff --git a/src/imports/location.pro b/src/imports/location.pro
new file mode 100644
index 00000000..cbbf10d6
--- /dev/null
+++ b/src/imports/location.pro
@@ -0,0 +1,116 @@
+TARGET = declarative_location
+TARGETPATH = Qt/location
+
+# Compatibility demands old path too.
+#TARGETPATH = QtMobility/location
+
+include(../qimportbase.pri)
+
+QT += declarative network location
+
+DESTDIR = $$QT.location.imports/$$TARGETPATH
+target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+
+# On some platforms, build both versions because debug and release
+# versions are incompatible
+#win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
+
+# Where to search for the #include'd files
+#INCLUDEPATH += ../../../src/global
+#INCLUDEPATH += ../../../src/location
+#INCLUDEPATH += ../../../src/location/landmarks
+#INCLUDEPATH += ../../../src/location/maps
+#INCLUDEPATH += .
+
+# The header and source files of this project. Note that qmake generates dependency information
+# and automatically adds necessary 'moc' files as it sees Q_OBJECT macros' in header files
+HEADERS += qdeclarativeposition_p.h \
+ qdeclarativepositionsource_p.h \
+ qdeclarativelandmark_p.h \
+ qdeclarativelandmarkmodel_p.h \
+ qdeclarativelandmarkcategorymodel_p.h \
+ qdeclarativelandmarkcategory_p.h \
+ qdeclarativelandmarkfilters_p.h \
+ qdeclarativecoordinate_p.h \
+ qdeclarativegeomapobjectborder_p.h \
+ qdeclarativegeomapcircleobject_p.h \
+ qdeclarativegeomapgroupobject_p.h \
+ qdeclarativegeomapobject_p.h \
+ qdeclarativegeomappixmapobject_p.h \
+ qdeclarativegeomappolygonobject_p.h \
+ qdeclarativegeomappolylineobject_p.h \
+ qdeclarativegeomaprectangleobject_p.h \
+ qdeclarativegeomaptextobject_p.h \
+ qdeclarativegeomapmouseevent_p.h \
+ qdeclarativegeomapmousearea_p.h \
+ qdeclarativegeoserviceprovider_p.h \
+ qdeclarativegraphicsgeomap_p.h \
+ qdeclarativegeoplace_p.h \
+ qdeclarativegeoaddress_p.h \
+ qdeclarativegeoboundingbox_p.h
+# qdeclarativegeosearchmodel_p.h \
+# qdeclarativegeocodemodel_p.h \
+# qdeclarativereversegeocodemodel_p.h \
+# qdeclarativegeoroutingmodel_p.h \
+# qdeclarativegeoroute_p.h \
+# qdeclarativegeoroutesegment_p.h \
+# qdeclarativegeomaneuver_p.h
+
+SOURCES += qdeclarativeposition.cpp \
+ location.cpp \
+ qdeclarativepositionsource.cpp \
+ qdeclarativelandmark.cpp \
+ qdeclarativelandmarkmodel.cpp \
+ qdeclarativelandmarkcategorymodel.cpp \
+ qdeclarativelandmarkcategory.cpp \
+ qdeclarativelandmarkfilters.cpp \
+ qdeclarativecoordinate.cpp \
+ qdeclarativegeomapobjectborder.cpp \
+ qdeclarativegeomapcircleobject.cpp \
+ qdeclarativegeomapgroupobject.cpp \
+ qdeclarativegeomapobject.cpp \
+ qdeclarativegeomappixmapobject.cpp \
+ qdeclarativegeomappolygonobject.cpp \
+ qdeclarativegeomappolylineobject.cpp \
+ qdeclarativegeomaprectangleobject.cpp \
+ qdeclarativegeomaptextobject.cpp \
+ qdeclarativegeomapmouseevent.cpp \
+ qdeclarativegeomapmousearea.cpp \
+ qdeclarativegeoserviceprovider.cpp \
+ qdeclarativegraphicsgeomap.cpp \
+ qdeclarativegeoplace.cpp \
+ qdeclarativegeoaddress.cpp \
+ qdeclarativegeoboundingbox.cpp
+# qdeclarativegeosearchmodel.cpp \
+# qdeclarativegeocodemodel.cpp \
+# qdeclarativereversegeocodemodel.cpp \
+# qdeclarativegeoroutingmodel.cpp \
+# qdeclarativegeoroute.cpp \
+# qdeclarativegeoroutesegment.cpp \
+# qdeclarativegeomaneuver.cpp
+
+# Tell qmake to create such makefile that qmldir and target (i.e. declarative_location)
+# are both copied to qt/imports/QtMobility/location -directory,
+# as the "/imports" is the default place where qmlviewer looks for plugins
+# (otherwise qmlviewer -I <path> -option is needed)
+
+qmldir.files += $$PWD/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+INSTALLS += target qmldir
+
+symbian {
+ # In Symbian, a library should enjoy _largest_ possible capability set.
+ # However, really needs only Location capability so feel free to reduce
+ # depending on your signing capabilities.
+ TARGET.CAPABILITY = ALL -TCB
+ # Allow writable DLL data
+ TARGET.EPOCALLOWDLLDATA = 1
+ # Target UID, makes every Symbian app unique
+ TARGET.UID3 = 0x20033007
+ # Specifies what files shall be deployed: the plugin itself and the qmldir file.
+ importFiles.sources = $$DESTDIR/declarative_location$${QT_LIBINFIX}.dll qmldir
+ importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
+ DEPLOYMENT = importFiles
+ }
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index 8751e5df..39b5712f 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -55,6 +55,7 @@
#include "qdeclarativegeoserviceprovider_p.h"
#include "qdeclarativegraphicsgeomap_p.h"
+#include "qdeclarative3dgraphicsgeomap_p.h"
#include "qdeclarativegeomapgroupobject_p.h"
#include "qdeclarativegeomapobjectborder_p.h"
#include "qdeclarativegeomapcircleobject_p.h"
@@ -148,7 +149,7 @@ public:
qmlRegisterType<QDeclarativeGeoServiceProvider>(uri, 5, 0, "Plugin");
qmlRegisterType<QDeclarativeGeoServiceProviderParameter>(uri, 5, 0, "PluginParameter");
- qmlRegisterType<QDeclarativeGraphicsGeoMap>(uri, 5, 0, "Map");
+ qmlRegisterType<QDeclarative3DGraphicsGeoMap>(uri, 5, 0, "Map3D");
qmlRegisterType<QDeclarativeGeoMapObjectBorder>(); // used as grouped property
qmlRegisterType<QGeoMapObject>(uri, 5, 0, "QGeoMapObject");
qmlRegisterType<QDeclarativeGeoMapObject>(uri, 5, 0, "MapObject");
diff --git a/src/imports/location/location.pro b/src/imports/location/location.pro
index 48c999b7..aa875d13 100644
--- a/src/imports/location/location.pro
+++ b/src/imports/location/location.pro
@@ -53,7 +53,8 @@ HEADERS += qdeclarativeposition_p.h \
qdeclarativegeoroutesegment_p.h \
qdeclarativegeomaneuver_p.h \
qdeclarativegeomaprouteobject_p.h \
- qdeclarativegeoboundingcircle_p.h
+ qdeclarativegeoboundingcircle_p.h \
+ qdeclarative3dgraphicsgeomap_p.h
SOURCES += qdeclarativeposition.cpp \
location.cpp \
@@ -86,7 +87,8 @@ SOURCES += qdeclarativeposition.cpp \
qdeclarativegeoroutesegment.cpp \
qdeclarativegeomaneuver.cpp \
qdeclarativegeomaprouteobject.cpp \
- qdeclarativegeoboundingcircle.cpp
+ qdeclarativegeoboundingcircle.cpp \
+ qdeclarative3dgraphicsgeomap.cpp
# Tell qmake to create such makefile that qmldir and target (i.e. declarative_location)
diff --git a/src/imports/location/qdeclarative3dgraphicsgeomap.cpp b/src/imports/location/qdeclarative3dgraphicsgeomap.cpp
new file mode 100644
index 00000000..b3cf0202
--- /dev/null
+++ b/src/imports/location/qdeclarative3dgraphicsgeomap.cpp
@@ -0,0 +1,924 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeclarative3dgraphicsgeomap_p.h"
+#include "qdeclarativegeomapmousearea_p.h"
+
+#include "qdeclarativecoordinate_p.h"
+#include "qdeclarativegeoserviceprovider_p.h"
+#include "qdeclarativelandmark_p.h"
+
+#include <qgeoserviceprovider.h>
+#include <qgeomappingmanager.h>
+#include <qgeomapdata.h>
+#include <qgeomapobject.h>
+
+#include <QGraphicsSceneMouseEvent>
+#include <QDeclarativeContext>
+#include <QtDeclarative/qdeclarativeinfo.h>
+#include <QModelIndex>
+
+#include <QDebug>
+
+QTM_BEGIN_NAMESPACE
+
+/*!
+ \qmlclass Map3D
+
+ \brief The Map element displays a map.
+ \inherits QDeclarativeItem
+
+ \ingroup qml-location-maps
+
+ The Map element can be used be used to display a map of the world. The
+ bulk of the functionality is provided by a mapping plugin described
+ by the Plugin element associated with the Map.
+
+ Various map objects can be added to the map. These map objects are
+ specified in terms of coordinates and metres.
+
+ MapObjects can be directly added to the Map element and it will display them
+ automatically. The various objects that can be added include:
+
+ \list
+ \endlist
+
+ Of the above list, MapObjectView is a special case and not a MapObject as such.
+ Here is a small example to illustrate this:
+
+ \snippet doc/src/snippets/declarative/declarative-map.qml Basic MapObjects and View on Map
+
+ Mouse handling is done by adding MapMouseArea items as children of either
+ MapObjects or the Map item itself.
+
+ The Map element is part of the \bold{QtMobility.location 1.2} module.
+*/
+QDeclarative3DGraphicsGeoMap::QDeclarative3DGraphicsGeoMap(QSGPaintedItem *parent)
+ : QSGPaintedItem(parent),
+ plugin_(0),
+ serviceProvider_(0),
+ mappingManager_(0),
+ mapData_(0),
+ center_(0),
+ initialCoordinate(0),
+ mapType_(NoMap),
+ connectivityMode_(NoConnectivity),
+ componentCompleted_(false)
+{
+ initialCoordinate = new QGeoCoordinate(-27.0, 153.0);
+ zoomLevel_ = 8;
+ size_ = QSizeF(100.0, 100.0);
+ // setAcceptsHoverEvents(true);
+ // setAcceptHoverEvents(true);
+ //setAcceptedMouseButtons(Qt::LeftButton | Qt::MidButton | Qt::RightButton);
+ //setFlag(QGraphicsItem::ItemHasNoContents, false);
+ //setFlag(QGraphicsItem::ItemAcceptsInputMethod);
+}
+
+QDeclarative3DGraphicsGeoMap::~QDeclarative3DGraphicsGeoMap()
+{
+ if (mapData_) {
+ qDeleteAll(mapViews_);
+ // Remove map objects, we can't allow mapObject
+ // to delete the objects because they are owned
+ // by the declarative elements.
+ //QList<QGeoMapObject*> objects = objectMap_.keys();
+ QList<QDeclarativeGeoMapObject*> objects = mapObjects_;
+ for (int i = 0; i < objects.size(); ++i) {
+ mapData_->removeMapObject(objects.at(i)->mapObject());
+ }
+ delete mapData_;
+ }
+ if (serviceProvider_)
+ delete serviceProvider_;
+
+ if (initialCoordinate) {
+ delete initialCoordinate;
+ }
+}
+
+void QDeclarative3DGraphicsGeoMap::componentComplete()
+{
+ componentCompleted_ = true;
+ QSGPaintedItem::componentComplete();
+ populateMap();
+}
+
+void QDeclarative3DGraphicsGeoMap::populateMap()
+{
+ if (!mapData_ || !componentCompleted_)
+ return;
+ QObjectList kids = children();
+ for (int i = 0; i < kids.size(); ++i) {
+ // dispatch items appropriately
+ QDeclarativeGeoMapObjectView* mapView = qobject_cast<QDeclarativeGeoMapObjectView*>(kids.at(i));
+ if (mapView) {
+ mapViews_.append(mapView);
+ setupMapView(mapView);
+ continue;
+ }
+ QDeclarativeGeoMapObject *mapObject = qobject_cast<QDeclarativeGeoMapObject*>(kids.at(i));
+ if (mapObject) {
+ mapObjects_.append(mapObject);
+ objectMap_.insert(mapObject->mapObject(), mapObject);
+ mapData_->addMapObject(mapObject->mapObject());
+ // to solve when we have map object support
+ //mapObject->setMap(this);
+ continue;
+ }
+ QDeclarativeGeoMapMouseArea *mouseArea
+ = qobject_cast<QDeclarativeGeoMapMouseArea*>(kids.at(i));
+ if (mouseArea) {
+ //mouseArea->setMap(this);
+ //mouseAreas_.append(mouseArea);
+ }
+ }
+}
+
+void QDeclarative3DGraphicsGeoMap::setupMapView(QDeclarativeGeoMapObjectView *view)
+{
+ Q_UNUSED(view) // TODO
+ //view->setMapData(this);
+ //view->repopulate();
+}
+
+
+//void QDeclarative3DGraphicsGeoMap::paint(QPainter *painter,
+// const QStyleOptionGraphicsItem *option,
+// QWidget * /*widget*/)
+//{
+// qDebug("-----------original paint called");
+// if (mapData_) {
+// mapData_->paint(painter, option);
+// }
+//}
+
+void QDeclarative3DGraphicsGeoMap::paint(QPainter *painter)
+{
+ qDebug() << __FUNCTION__ << "----------- Map3d, mapData_:" << mapData_;
+ if (mapData_)
+ mapData_->paint(painter, 0);
+}
+
+void QDeclarative3DGraphicsGeoMap::geometryChanged(const QRectF &newGeometry,
+ const QRectF & /*oldGeometry*/)
+{
+ setSize(newGeometry.size());
+}
+
+/*!
+ \qmlproperty Plugin Map::plugin
+
+ This property holds the plugin which provides the mapping functionality.
+
+ This is write-once property. Once the map has a plugin associated with
+ it any attempted modifications of the plugin will be ignored.
+*/
+
+void QDeclarative3DGraphicsGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin)
+{
+ qDebug("setPlugin called for Map");
+ if (plugin_) {
+ qmlInfo(this) << tr("Plugin is a write-once property, and cannot be set again.");
+ return;
+ }
+ plugin_ = plugin;
+ emit pluginChanged(plugin_);
+ serviceProvider_ = new QGeoServiceProvider(plugin_->name(),
+ plugin_->parameterMap());
+
+ if (serviceProvider_->error() != QGeoServiceProvider::NoError) {
+ qWarning() << serviceProvider_->errorString();
+ delete serviceProvider_;
+ serviceProvider_ = 0;
+ return;
+ }
+ mappingManager_ = serviceProvider_->mappingManager();
+ if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) {
+ qWarning() << serviceProvider_->errorString();
+ delete serviceProvider_;
+ serviceProvider_ = 0;
+ delete mappingManager_;
+ mappingManager_ = 0;
+ return;
+ }
+ mapData_ = mappingManager_->createMapData();
+ mapData_->init();
+ //mapData_->setParentItem(this);
+
+ // setters
+ mapData_->setWindowSize(size_);
+ mapData_->setZoomLevel(zoomLevel_);
+
+ if (center_)
+ mapData_->setCenter(center_->coordinate());
+ else
+ mapData_->setCenter(*initialCoordinate);
+
+ mapData_->setMapType(QGraphicsGeoMap::MapType(mapType_));
+ mapData_->setConnectivityMode(QGraphicsGeoMap::ConnectivityMode(connectivityMode_));
+
+ // Populate the map objects.
+ populateMap();
+ // setup signals
+ connect(mapData_,
+ SIGNAL(updateMapDisplay(QRectF)),
+ this,
+ SLOT(updateMapDisplay(QRectF)));
+
+ connect(mapData_,
+ SIGNAL(centerChanged(QGeoCoordinate)),
+ this,
+ SLOT(internalCenterChanged(QGeoCoordinate)));
+
+ connect(mapData_,
+ SIGNAL(mapTypeChanged(QGraphicsGeoMap::MapType)),
+ this,
+ SLOT(internalMapTypeChanged(QGraphicsGeoMap::MapType)));
+
+ connect(mapData_,
+ SIGNAL(connectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)),
+ this,
+ SLOT(internalConnectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)));
+
+ connect(mapData_,
+ SIGNAL(windowSizeChanged(QSizeF)),
+ this,
+ SIGNAL(sizeChanged(QSizeF)));
+
+ connect(mapData_,
+ SIGNAL(zoomLevelChanged(qreal)),
+ this,
+ SIGNAL(zoomLevelChanged(qreal)));
+}
+
+void QDeclarative3DGraphicsGeoMap::updateMapDisplay(const QRectF &target)
+{
+ QSGPaintedItem::update(target.toRect());
+}
+
+QDeclarativeGeoServiceProvider* QDeclarative3DGraphicsGeoMap::plugin() const
+{
+ return plugin_;
+}
+
+/*!
+ \qmlproperty qreal Map::minimumZoomLevel
+
+ This property holds the minimum valid zoom level for the map.
+*/
+qreal QDeclarative3DGraphicsGeoMap::minimumZoomLevel() const
+{
+ if (mappingManager_)
+ return mappingManager_->minimumZoomLevel();
+ else
+ return -1.0;
+}
+
+/*!
+ \qmlproperty qreal Map::maximumZoomLevel
+
+ This property holds the maximum valid zoom level for the map.
+*/
+qreal QDeclarative3DGraphicsGeoMap::maximumZoomLevel() const
+{
+ if (mappingManager_)
+ return mappingManager_->maximumZoomLevel();
+ else
+ return -1.0;
+}
+
+// TODO make these more QML like
+//QList<MapType> QDeclarative3DGraphicsGeoMap::supportedMapTypes() const;
+//QList<ConnectivityMode> QDeclarative3DGraphicsGeoMap::supportedConnectivityModes() const;
+
+/*!
+ \qmlproperty QSizeF Map::size
+
+ This property holds the size of the map viewport.
+*/
+void QDeclarative3DGraphicsGeoMap::setSize(const QSizeF &size)
+{
+ if (mapData_) {
+ setWidth(size.width());
+ setHeight(size.height());
+ mapData_->setWindowSize(size);
+ } else {
+ if (size_ == size)
+ return;
+
+ size_ = size;
+
+ emit sizeChanged(size_);
+ }
+
+}
+
+QSizeF QDeclarative3DGraphicsGeoMap::size() const
+{
+ if (mapData_)
+ return mapData_->windowSize();
+ else
+ return size_;
+}
+
+/*!
+ \qmlproperty qreal Map::zoomLevel
+
+ This property holds the zoom level for the map.
+
+ Larger values for the zoom level provide more detail.
+
+ The default value is 8.0.
+*/
+void QDeclarative3DGraphicsGeoMap::setZoomLevel(qreal zoomLevel)
+{
+ if (mapData_) {
+ mapData_->setZoomLevel(zoomLevel);
+ } else {
+ if (zoomLevel_ == zoomLevel)
+ return;
+
+ zoomLevel_ = zoomLevel;
+
+ emit zoomLevelChanged(zoomLevel_);
+ }
+}
+
+qreal QDeclarative3DGraphicsGeoMap::zoomLevel() const
+{
+ if (mapData_) {
+ return mapData_->zoomLevel();
+ } else {
+ return zoomLevel_;
+ }
+}
+
+/*!
+ \qmlproperty Coordinate Map::center
+
+ This property holds the coordinate which occupies the center of the
+ mapping viewport.
+
+ The default value is an arbitrary valid coordinate.
+*/
+void QDeclarative3DGraphicsGeoMap::setCenter(QDeclarativeCoordinate *center)
+{
+ if (center_) {
+ center_->disconnect(this);
+ }
+ center_ = center;
+ if (center_) {
+ connect(center_,
+ SIGNAL(latitudeChanged(double)),
+ this,
+ SLOT(centerLatitudeChanged(double)));
+ connect(center_,
+ SIGNAL(longitudeChanged(double)),
+ this,
+ SLOT(centerLongitudeChanged(double)));
+ connect(center_,
+ SIGNAL(altitudeChanged(double)),
+ this,
+ SLOT(centerAltitudeChanged(double)));
+
+ if (mapData_) {
+ mapData_->setCenter(center_->coordinate());
+ }
+ }
+ emit declarativeCenterChanged(center_);
+}
+
+QDeclarativeCoordinate* QDeclarative3DGraphicsGeoMap::center()
+{
+ if (mapData_ && center_)
+ center_->setCoordinate(mapData_->center());
+ return center_;
+}
+
+void QDeclarative3DGraphicsGeoMap::centerLatitudeChanged(double /*latitude*/)
+{
+ if (mapData_ && center_)
+ mapData_->setCenter(center_->coordinate());
+}
+
+void QDeclarative3DGraphicsGeoMap::centerLongitudeChanged(double /*longitude*/)
+{
+ if (mapData_ && center_)
+ mapData_->setCenter(center_->coordinate());
+}
+
+void QDeclarative3DGraphicsGeoMap::centerAltitudeChanged(double /*altitude*/)
+{
+ if (mapData_ && center_)
+ mapData_->setCenter(center_->coordinate());
+}
+
+/*!
+ \qmlproperty enumeration Map::mapType
+
+ This property holds the type of map to display.
+
+ The type can be one of:
+ \list
+ \o Map.StreetMap
+ \o Map.SatelliteMapDay
+ \o Map.SatelliteMapNight
+ \o Map.TerrainMap
+ \endlist
+
+ The default value is determined by the plugin.
+*/
+void QDeclarative3DGraphicsGeoMap::setMapType(QDeclarative3DGraphicsGeoMap::MapType mapType)
+{
+ if (mapData_) {
+ mapData_->setMapType(QGraphicsGeoMap::MapType(mapType));
+ } else {
+ if (mapType_ == mapType)
+ return;
+
+ mapType_ = mapType;
+
+ emit mapTypeChanged(mapType_);
+ }
+}
+
+QDeclarative3DGraphicsGeoMap::MapType QDeclarative3DGraphicsGeoMap::mapType() const
+{
+ if (mapData_) {
+ return QDeclarative3DGraphicsGeoMap::MapType(mapData_->mapType());
+ } else {
+ return mapType_;
+ }
+}
+
+/*!
+ \qmlproperty enumeration Map::connectivityMode
+
+ This property holds the connectivity mode used to fetch the map data.
+
+ The mode can be one of:
+ \list
+ \o Map.OfflineMode
+ \o Map.OnlineMode
+ \o Map.HybridMode
+ \endlist
+
+ The default value is determined by the plugin.
+*/
+void QDeclarative3DGraphicsGeoMap::setConnectivityMode(QDeclarative3DGraphicsGeoMap::ConnectivityMode connectivityMode)
+{
+ if (mapData_) {
+ mapData_->setConnectivityMode(QGraphicsGeoMap::ConnectivityMode(connectivityMode));
+ } else {
+ if (connectivityMode_ == connectivityMode)
+ return;
+
+ connectivityMode_ = connectivityMode;
+
+ emit connectivityModeChanged(connectivityMode_);
+ }
+}
+
+QDeclarative3DGraphicsGeoMap::ConnectivityMode QDeclarative3DGraphicsGeoMap::connectivityMode() const
+{
+ if (mapData_)
+ return QDeclarative3DGraphicsGeoMap::ConnectivityMode(mapData_->connectivityMode());
+ else
+ return connectivityMode_;
+}
+
+/*!
+ \qmlproperty list<QGeoMapObject> Map::objects
+ \default
+
+ This property holds the list of objects associated with this map.
+
+ The various objects that can be added include:
+ \list
+ \o MapRectangle
+ \o MapCircle
+ \o MapText
+ \o MapImage
+ \o MapPolygon
+ \o MapPolyline
+ \o MapGroup
+ \endlist
+*/
+
+/*!
+ \qmlmethod Map::toCoordinate(QPointF screenPosition)
+
+ Returns the coordinate which corresponds to the screen position
+ \a screenPosition.
+
+ Returns an invalid coordinate if \a screenPosition is not within
+ the current viewport.
+
+ An example to constraint landmarks of a model to just those
+ currently on Map:
+ \snippet examples/declarative-location/landmarkmap/landmarkmap.qml Map toCoordinate
+
+*/
+
+QDeclarativeCoordinate* QDeclarative3DGraphicsGeoMap::toCoordinate(QPointF screenPosition) const
+{
+ QGeoCoordinate coordinate;
+
+ if (mapData_)
+ coordinate = mapData_->screenPositionToCoordinate(screenPosition);
+
+ return new QDeclarativeCoordinate(coordinate,
+ const_cast<QDeclarative3DGraphicsGeoMap *>(this));
+}
+
+/*!
+ \qmlmethod Map::toScreenPosition(Coordinate coordinate)
+
+ Returns the screen position which corresponds to the coordinate
+ \a coordinate.
+
+ Returns an invalid QPointF if \a coordinate is not within the
+ current viewport.
+*/
+QPointF QDeclarative3DGraphicsGeoMap::toScreenPosition(QDeclarativeCoordinate* coordinate) const
+{
+ QPointF point;
+
+ if (mapData_)
+ point = mapData_->coordinateToScreenPosition(coordinate->coordinate());
+
+ return point;
+}
+
+void QDeclarative3DGraphicsGeoMap::pan(int dx, int dy)
+{
+ if (mapData_) {
+ mapData_->pan(dx, dy);
+ update();
+ } else {
+ qmlInfo(this) << tr("Map plugin is not set, cannot pan.");
+ }
+}
+
+QDeclarativeGeoMapMouseEvent* QDeclarative3DGraphicsGeoMap::createMapMouseEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (!event || !mapData_)
+ return 0;
+
+ QDeclarativeGeoMapMouseEvent *mouseEvent = new QDeclarativeGeoMapMouseEvent(this);
+
+ mouseEvent->setButton(event->button());
+ mouseEvent->setModifiers(event->modifiers());
+
+ QGeoCoordinate coordinate = mapData_->screenPositionToCoordinate(event->pos());
+ mouseEvent->setCoordinate(new QDeclarativeCoordinate(coordinate, this));
+ mouseEvent->setX(event->pos().x());
+ mouseEvent->setY(event->pos().y());
+
+ return mouseEvent;
+}
+
+QDeclarativeGeoMapMouseEvent* QDeclarative3DGraphicsGeoMap::createMapMouseEvent(QGraphicsSceneHoverEvent *event)
+{
+ if (!event || !mapData_)
+ return 0;
+
+ QDeclarativeGeoMapMouseEvent *mouseEvent = new QDeclarativeGeoMapMouseEvent(this);
+
+ mouseEvent->setModifiers(event->modifiers());
+
+ QGeoCoordinate coordinate = mapData_->screenPositionToCoordinate(event->pos());
+ mouseEvent->setCoordinate(new QDeclarativeCoordinate(coordinate, this));
+ mouseEvent->setX(event->pos().x());
+ mouseEvent->setY(event->pos().y());
+
+ return mouseEvent;
+}
+
+void QDeclarative3DGraphicsGeoMap::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (!mapData_) {
+ qmlInfo(this) << tr("Map plugin is not set, mouse event cannot be processed.");
+ return;
+ }
+
+ // First deliver the mouse event to possible map objects (they will accept it if
+ // they have their own mouse area). If no accepting objects, check if the map
+ // object itself has any mouse areas. This way the map objects have higher priority
+ // in mouse event handling.
+ QList<QGeoMapObject*> objects = mapData_->mapObjectsAtScreenPosition(event->pos());
+
+ QDeclarativeGeoMapMouseEvent *mouseEvent = createMapMouseEvent(event);
+
+ for (int i = objects.size() - 1; i >= 0; --i) {
+ QDeclarativeGeoMapObject* mapObject = objectMap_.value(objects.at(i), 0);
+ if (mapObject) {
+ mapObject->pressEvent(mouseEvent);
+ if (mouseEvent->accepted()) {
+ event->setAccepted(true);
+ delete mouseEvent;
+ return;
+ }
+ }
+ }
+
+ for (int i = 0; i < mouseAreas_.size(); ++i) {
+ mouseAreas_.at(i)->pressEvent(mouseEvent);
+ if (mouseEvent->accepted()) {
+ event->setAccepted(true);
+ delete mouseEvent;
+ return;
+ }
+ }
+
+ delete mouseEvent;
+
+ //QDeclarativeItem::mousePressEvent(event);
+ QSGPaintedItem::mousePressEvent(event);
+}
+
+void QDeclarative3DGraphicsGeoMap::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ QDeclarativeGeoMapMouseEvent *mouseEvent = createMapMouseEvent(event);
+
+ if (activeMouseArea_)
+ activeMouseArea_->releaseEvent(mouseEvent);
+ activeMouseArea_ = 0;
+
+ bool accepted = (mouseEvent->accepted());
+
+ delete mouseEvent;
+
+ if (accepted)
+ return;
+
+ //QDeclarativeItem::mouseReleaseEvent(event);
+ QSGPaintedItem::mouseReleaseEvent(event);
+}
+
+void QDeclarative3DGraphicsGeoMap::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (!mapData_) {
+ qmlInfo(this) << tr("Map plugin is not set, mouse event cannot be processed.");
+ return;
+ }
+
+ activeMouseArea_ = 0;
+
+ QList<QGeoMapObject*> objects = mapData_->mapObjectsAtScreenPosition(event->pos());
+
+ QDeclarativeGeoMapMouseEvent *mouseEvent = createMapMouseEvent(event);
+
+ for (int i = objects.size() - 1; i >= 0; --i) {
+ QDeclarativeGeoMapObject* mapObject = objectMap_.value(objects.at(i), 0);
+ if (mapObject) {
+ mapObject->doubleClickEvent(mouseEvent);
+ if (mouseEvent->accepted()) {
+ event->setAccepted(true);
+ delete mouseEvent;
+ return;
+ }
+ }
+ }
+
+ for (int i = 0; i < mouseAreas_.size(); ++i) {
+ mouseAreas_.at(i)->doubleClickEvent(mouseEvent);
+ if (mouseEvent->accepted()) {
+ event->setAccepted(true);
+ delete mouseEvent;
+ return;
+ }
+ }
+
+ bool accepted = (mouseEvent->accepted());
+
+ delete mouseEvent;
+
+ if (accepted)
+ return;
+
+ //QDeclarativeItem::mouseDoubleClickEvent(event);
+ QSGPaintedItem::mouseDoubleClickEvent(event);
+}
+
+void QDeclarative3DGraphicsGeoMap::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ QDeclarativeGeoMapMouseEvent *mouseEvent = createMapMouseEvent(event);
+
+ if (activeMouseArea_)
+ activeMouseArea_->moveEvent(mouseEvent);
+
+ bool accepted = (mouseEvent->accepted());
+
+ delete mouseEvent;
+
+ if (accepted)
+ return;
+
+ //QDeclarativeItem::mouseMoveEvent(event);
+ QSGPaintedItem::mouseMoveEvent(event);
+}
+
+void QDeclarative3DGraphicsGeoMap::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event);
+// qWarning() << "hover enter";
+}
+
+void QDeclarative3DGraphicsGeoMap::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
+{
+ if (!mapData_)
+ return;
+
+ QList<QGeoMapObject*> objectsThen = mapData_->mapObjectsAtScreenPosition(event->lastPos());
+ QList<QGeoMapObject*> objectsNow = mapData_->mapObjectsAtScreenPosition(event->pos());
+
+ QSet<QGeoMapObject*> enter = objectsNow.toSet();
+ enter -= objectsThen.toSet();
+
+ for (int i = 0; i < objectsNow.size(); ++i) {
+ if (!enter.contains(objectsNow.at(i)))
+ continue;
+
+ QDeclarativeGeoMapObject* mapObject = objectMap_.value(objectsNow.at(i), 0);
+ if (mapObject)
+ mapObject->enterEvent();
+ }
+
+ QSet<QGeoMapObject*> exit = objectsThen.toSet();
+ exit -= objectsNow.toSet();
+
+ for (int i = 0; i < objectsThen.size(); ++i) {
+ if (!exit.contains(objectsThen.at(i)))
+ continue;
+
+ QDeclarativeGeoMapObject* mapObject = objectMap_.value(objectsThen.at(i), 0);
+ if (mapObject)
+ mapObject->exitEvent();
+ }
+
+ QSet<QGeoMapObject*> move = objectsNow.toSet();
+ move += objectsThen.toSet();
+
+ QList<QGeoMapObject*> objects = mapData_->mapObjectsInViewport();
+
+ QDeclarativeGeoMapMouseEvent *mouseEvent = createMapMouseEvent(event);
+
+ for (int i = 0; i < objects.size(); ++i) {
+ if (!move.contains(objects.at(i)))
+ continue;
+
+ QDeclarativeGeoMapObject* mapObject = objectMap_.value(objects.at(i), 0);
+ if (mapObject)
+ mapObject->moveEvent(mouseEvent);
+ }
+
+ /*
+ QList<QGeoMapObject*> objects = mapData_->mapObjectsAtScreenPosition(event->pos());
+
+ for (int i = objects.size() - 1; i >= 0; --i) {
+ QDeclarativeGeoMapObject* mapObject = objectMap_.value(objects.at(i), 0);
+ if (mapObject)
+ mapObject->moveEvent(mouseEvent);
+ }
+ */
+
+ for (int i = 0; i < mouseAreas_.size(); ++i)
+ mouseAreas_.at(i)->moveEvent(mouseEvent);
+
+ delete mouseEvent;
+}
+
+void QDeclarative3DGraphicsGeoMap::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event);
+// qWarning() << "hover leave";
+}
+
+void QDeclarative3DGraphicsGeoMap::internalCenterChanged(const QGeoCoordinate &coordinate)
+{
+ emit declarativeCenterChanged(new QDeclarativeCoordinate(coordinate, this));
+}
+
+void QDeclarative3DGraphicsGeoMap::internalMapTypeChanged(QGraphicsGeoMap::MapType mapType)
+{
+ emit mapTypeChanged(QDeclarative3DGraphicsGeoMap::MapType(mapType));
+}
+
+void QDeclarative3DGraphicsGeoMap::internalConnectivityModeChanged(QGraphicsGeoMap::ConnectivityMode connectivityMode)
+{
+ emit connectivityModeChanged(QDeclarative3DGraphicsGeoMap::ConnectivityMode(connectivityMode));
+}
+
+/*!
+ \qmlmethod Map::addMapObject(MapObject)
+
+ Adds the given MapOject to the Map. If the object already
+ is on the Map, it will not be added again.
+
+ As an example, consider you have a MapCircle presenting your current position:
+
+ \snippet doc/src/snippets/declarative/testpolymapobjects.qml Basic map position marker definition
+ You can add it to Map (alterntively it can be defined as a child element of the Map):
+
+ \snippet doc/src/snippets/declarative/testpolymapobjects.qml Basic add MapObject
+ Note: MapObjectViews can not be added with this method.
+*/
+
+void QDeclarative3DGraphicsGeoMap::addMapObject(QDeclarativeGeoMapObject *object)
+{
+ if (!mapData_)
+ qmlInfo(this) << tr("Map plugin is not set, map object cannot be added.");
+ if (!mapData_ || !object || objectMap_.contains(object->mapObject()))
+ return;
+ mapObjects_.append(object);
+ objectMap_.insert(object->mapObject(), object);
+ mapData_->addMapObject(object->mapObject());
+ // TODO
+ // object->setMap(this);
+}
+
+/*!
+ \qmlmethod Map::removeMapObject(MapObject)
+
+ Removes the given MapObject from the Map. If the MapObject does not
+ exist, function does nothing.
+
+ As an example, consider you have a MapCircle presenting your current position:
+ \snippet doc/src/snippets/declarative/testpolymapobjects.qml Basic map position marker definition
+
+ You can remove it from the Map element:
+ \snippet doc/src/snippets/declarative/testpolymapobjects.qml Basic remove MapObject
+
+
+*/
+
+void QDeclarative3DGraphicsGeoMap::removeMapObject(QDeclarativeGeoMapObject *object)
+{
+ if (!mapData_)
+ qmlInfo(this) << tr("Map plugin is not set, map object cannot be removed.");
+ if (!mapData_ || !object || !objectMap_.contains(object->mapObject()))
+ return;
+ objectMap_.remove(object->mapObject());
+ mapObjects_.removeOne(object);
+ mapData_->removeMapObject(object->mapObject());
+}
+
+void QDeclarative3DGraphicsGeoMap::setActiveMouseArea(QDeclarativeGeoMapMouseArea *area)
+{
+ activeMouseArea_ = area;
+}
+
+QDeclarativeGeoMapMouseArea* QDeclarative3DGraphicsGeoMap::activeMouseArea() const
+{
+ return activeMouseArea_;
+}
+
+// This function is strictly for testing purposes
+int QDeclarative3DGraphicsGeoMap::testGetDeclarativeMapObjectCount()
+{
+ return objectMap_.values().count();
+}
+
+#include "moc_qdeclarative3dgraphicsgeomap_p.cpp"
+
+QTM_END_NAMESPACE
diff --git a/src/imports/location/qdeclarative3dgraphicsgeomap_p.h b/src/imports/location/qdeclarative3dgraphicsgeomap_p.h
new file mode 100644
index 00000000..9ea2183e
--- /dev/null
+++ b/src/imports/location/qdeclarative3dgraphicsgeomap_p.h
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDECLARATIVE3DGRAPHICSGEOMAP_H
+#define QDECLARATIVE3DGRAPHICSGEOMAP_H
+
+#include <qgraphicsgeomap.h>
+#include <QPointer>
+#include <QtDeclarative/qsgpainteditem.h>
+#include <QGeoMapData>
+#include "qdeclarativegeomapobject_p.h"
+
+QTM_BEGIN_NAMESPACE
+
+class QGeoCoordinate;
+class QGeoMapObject;
+class QGeoMapData;
+class QGeoServiceProvider;
+class QDeclarativeCoordinate;
+class QDeclarativeGeoServiceProvider;
+
+class QDeclarative3DGraphicsGeoMap : public QSGPaintedItem
+{
+ Q_OBJECT
+
+ Q_ENUMS(MapType)
+ Q_ENUMS(ConnectivityMode)
+
+ Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
+ Q_PROPERTY(QSizeF size READ size WRITE setSize NOTIFY sizeChanged)
+ Q_PROPERTY(qreal minimumZoomLevel READ minimumZoomLevel CONSTANT)
+ Q_PROPERTY(qreal maximumZoomLevel READ maximumZoomLevel CONSTANT)
+ Q_PROPERTY(qreal zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged)
+ Q_PROPERTY(MapType mapType READ mapType WRITE setMapType NOTIFY mapTypeChanged)
+ Q_PROPERTY(QDeclarativeCoordinate* center READ center WRITE setCenter NOTIFY declarativeCenterChanged)
+ Q_PROPERTY(ConnectivityMode connectivityMode READ connectivityMode WRITE setConnectivityMode NOTIFY connectivityModeChanged)
+ Q_INTERFACES(QDeclarativeParserStatus)
+
+public:
+ enum MapType {
+ NoMap = QGraphicsGeoMap::NoMap,
+ StreetMap = QGraphicsGeoMap::StreetMap,
+ SatelliteMapDay = QGraphicsGeoMap::SatelliteMapDay,
+ SatelliteMapNight = QGraphicsGeoMap::SatelliteMapNight,
+ TerrainMap = QGraphicsGeoMap::TerrainMap
+ };
+
+ enum ConnectivityMode {
+ NoConnectivity = QGraphicsGeoMap::NoConnectivity,
+ OfflineMode = QGraphicsGeoMap::OfflineMode,
+ OnlineMode = QGraphicsGeoMap::OnlineMode,
+ HybridMode = QGraphicsGeoMap::HybridMode
+ };
+
+public:
+ QDeclarative3DGraphicsGeoMap(QSGPaintedItem *parent = 0);
+ ~QDeclarative3DGraphicsGeoMap();
+
+ // From QDeclarativeParserStatus
+ virtual void componentComplete();
+
+ // From QGraphicsItem
+ //void paint(QPainter *painter,
+ // const QStyleOptionGraphicsItem *option,
+ // QWidget *widget);
+ // From QSGPaintedItem
+ virtual void paint (QPainter *painter);
+
+ void setPlugin(QDeclarativeGeoServiceProvider *plugin);
+ QDeclarativeGeoServiceProvider* plugin() const;
+
+ qreal minimumZoomLevel() const;
+ qreal maximumZoomLevel() const;
+
+ void setSize(const QSizeF &size);
+ QSizeF size() const;
+
+ void setZoomLevel(qreal zoomLevel);
+ qreal zoomLevel() const;
+
+ void setCenter(QDeclarativeCoordinate *center);
+ QDeclarativeCoordinate* center();
+
+ void setMapType(MapType mapType);
+ MapType mapType() const;
+
+ void setConnectivityMode(ConnectivityMode connectivityMode);
+ ConnectivityMode connectivityMode() const;
+
+ QDeclarativeListProperty<QDeclarativeGeoMapObject> objects();
+
+ Q_INVOKABLE void addMapObject(QDeclarativeGeoMapObject* object);
+ Q_INVOKABLE void removeMapObject(QDeclarativeGeoMapObject* object);
+
+ Q_INVOKABLE QDeclarativeCoordinate* toCoordinate(QPointF screenPosition) const;
+ Q_INVOKABLE QPointF toScreenPosition(QDeclarativeCoordinate* coordinate) const;
+
+ // This function is strictly for testing purposes and may be removed at
+ // any time without any notice (hence also the obscure naming to avoid
+ // accidental usage):
+ Q_INVOKABLE int testGetDeclarativeMapObjectCount();
+
+ void setActiveMouseArea(QDeclarativeGeoMapMouseArea *area);
+ QDeclarativeGeoMapMouseArea* activeMouseArea() const;
+
+public Q_SLOTS:
+ void pan(int dx, int dy);
+
+protected:
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+
+Q_SIGNALS:
+ void pluginChanged(QDeclarativeGeoServiceProvider *plugin);
+ void sizeChanged(const QSizeF &size);
+ void zoomLevelChanged(qreal zoomLevel);
+ void declarativeCenterChanged(const QDeclarativeCoordinate *coordinate);
+ void mapTypeChanged(QDeclarative3DGraphicsGeoMap::MapType mapType);
+ void connectivityModeChanged(QDeclarative3DGraphicsGeoMap::ConnectivityMode connectivityMode);
+
+private Q_SLOTS:
+ void updateMapDisplay(const QRectF& target);
+ void internalCenterChanged(const QGeoCoordinate &coordinate);
+ void internalMapTypeChanged(QGraphicsGeoMap::MapType mapType);
+ void internalConnectivityModeChanged(QGraphicsGeoMap::ConnectivityMode connectivityMode);
+ void centerLatitudeChanged(double latitude);
+ void centerLongitudeChanged(double longitude);
+ void centerAltitudeChanged(double altitude);
+
+private:
+ void setupMapView(QDeclarativeGeoMapObjectView *view);
+ void populateMap();
+
+ QDeclarativeGeoMapObject* createItem(int modelIndex);
+ QDeclarativeGeoMapMouseEvent* createMapMouseEvent(QGraphicsSceneMouseEvent *event);
+ QDeclarativeGeoMapMouseEvent* createMapMouseEvent(QGraphicsSceneHoverEvent *event);
+
+ QDeclarativeGeoServiceProvider* plugin_;
+ QGeoServiceProvider* serviceProvider_;
+ QGeoMappingManager* mappingManager_;
+ QGeoMapData* mapData_;
+
+ qreal zoomLevel_;
+ QPointer<QDeclarativeCoordinate> center_;
+
+ QGeoCoordinate* initialCoordinate;
+ QDeclarative3DGraphicsGeoMap::MapType mapType_;
+ QDeclarative3DGraphicsGeoMap::ConnectivityMode connectivityMode_;
+ QSizeF size_;
+
+ QList<QDeclarativeGeoMapObject*> mapObjects_;
+ QHash<QGeoMapObject*, QDeclarativeGeoMapObject*> objectMap_;
+
+ bool componentCompleted_;
+ QList<QDeclarativeGeoMapObjectView*> mapViews_;
+ QDeclarativeGeoMapMouseArea* activeMouseArea_;
+ QList<QDeclarativeGeoMapMouseArea*> mouseAreas_;
+
+ friend class QDeclarativeGeoMapObjectView;
+ Q_DISABLE_COPY(QDeclarative3DGraphicsGeoMap)
+};
+
+QTM_END_NAMESPACE
+
+QML_DECLARE_TYPE(QTM_PREPEND_NAMESPACE(QDeclarative3DGraphicsGeoMap));
+
+#endif