main.qml Example File
webmapview/assets/main.qml
import bb.cascades 1.0
import com.example.webmapview 1.0
Page {
actions: [
ActionItem {
title: _webMaps.viewModeTitle
imageSource: "asset:///images/map.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
_webMaps.nextViewMode()
map.setMapType(_webMaps.viewMode);
}
},
ActionItem {
title: qsTr("Waterloo")
imageSource: "asset:///images/pin.png"
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
map.setCenter(43.468245, -80.519603);
}
},
ActionItem {
title: qsTr("Manhattan")
imageSource: "asset:///images/pin.png"
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
map.setCenter(40.790907, -73.965334);
}
},
ActionItem {
title: qsTr("Drop Pin")
imageSource: "asset:///images/pin.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
map.createPushPin(map.center[0], map.center[1], qsTr("I am a Pin"));
}
},
ActionItem {
title: qsTr("Clear Pins")
imageSource: "asset:///images/clearpin.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
map.removeAllPins();
}
}
]
Container {
layout: DockLayout {
}
Map {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
id: map
}
DropDown {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Top
title: qsTr("Map Provider")
Option {
text: qsTr("Google Maps")
imageSource: "asset:///images/googlemaps.png"
value: WebMaps.GoogleMaps
selected: true
}
Option {
text: qsTr("Open Layers")
imageSource: "asset:///images/openlayers.png"
value: WebMaps.OpenLayers
}
Option {
text: qsTr("Bing Maps")
imageSource: "asset:///images/bingmaps.png"
value: WebMaps.BingMaps
}
onSelectedValueChanged: _webMaps.currentProvider = selectedValue
}
}
onCreationCompleted: {
map.setCenter(43.468245, -80.519603);
}
}