11 import com.nokia.meego 1.0
12 import org.kde.edu.marble 0.11
19 id: searchActivityPage
22 property bool horizontal: width / height > 1.20
24 tools: ToolBarLayout {
26 iconSource:
main.
icon(
"actions/go-home", 48 );
36 iconSource:
main.
icon(
"actions/go-up", 48 );
45 property bool minimized: !minimizeButton.checked
48 anchors.bottom: searchActivityPage.bottom
49 anchors.left: searchActivityPage.left
50 width: searchActivityPage.horizontal ? (minimized ? 0 : searchActivityPage.width / 2) : searchActivityPage.width
51 height: searchActivityPage.horizontal ? searchActivityPage.height : (minimized ? 0 : searchActivityPage.height / 2)
54 enabled: !searchActivityPage.horizontal;
56 easing.type: Easing.InOutQuad;
64 border.color:
"darkgray"
67 property string searchTerm:
""
71 anchors.top: parent.top
72 anchors.left: parent.left
73 anchors.right: parent.right
76 searchResultView.searchTerm = term
77 searchField.
busy =
true
78 marbleWidget.find( term )
79 searchResultListView.model = marbleWidget.search.searchResultModel()
82 Component.onCompleted: {
83 marbleWidget.search.searchFinished.connect( searchFinished )
86 function searchFinished() {
87 searchField.busy =
false
92 id: searchResultDescription
93 wrapMode: Text.WrapAtWordBoundaryOrAnywhere
94 anchors.top: searchField.bottom
95 anchors.left: parent.left
96 anchors.right: parent.right
99 text:
"<p>Example search terms<ul><li>London</li><li>Baker Street, London</li><li>Baker Street 221b, London</li><li>Restaurant, London</li></ul></p>"
100 visible: searchResultView.searchTerm ===
"" && searchResultListView.count === 0
104 id: searchResultListView
105 property int count: model === undefined ? 0 : model.count
107 anchors.top: searchField.bottom
108 anchors.left: parent.left
109 anchors.right: parent.right
110 anchors.bottom: parent.bottom
112 model: marbleWidget.search.searchResultModel()
113 delegate: searchResultDelegate
120 flickableItem: searchResultListView
129 anchors.left: searchActivityPage.horizontal ? searchResultView.right : searchActivityPage.left
130 anchors.bottom: searchActivityPage.horizontal ? searchActivityPage.bottom : searchResultView.top
131 anchors.right: searchActivityPage.right
132 anchors.top: searchActivityPage.top
134 function embedMarbleWidget() {
135 marbleWidget.parent = mapContainer
136 settings.projection =
"Mercator"
137 var plugins = settings.defaultRenderPlugins
138 settings.removeElementsFromArray(plugins, [
"coordinate-grid",
"sun",
"stars",
"compass"])
139 settings.activeRenderPlugins = plugins
140 settings.mapTheme = settings.streetMapTheme
141 settings.gpsTracking =
false
142 settings.showPositionIndicator =
true
144 settings.showTrack =
false
145 marbleWidget.visible =
true
148 Component.onDestruction: {
149 if ( marbleWidget.parent === mapContainer ) {
150 marbleWidget.parent = null
151 marbleWidget.visible =
false
157 id: searchResultDelegate
161 width: parent.width - 20
162 height: column.height + 10
165 property bool detailed: ListView.isCurrentItem
175 anchors.verticalCenter: parent.verticalCenter
176 text:
"<font size=\"-1\">" + (index+1) +
". " + display +
"</font>"
177 width: searchResultItem.width - bookmarkButton.width - parent.spacing - 10
178 wrapMode: searchResultItem.detailed ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap
184 searchResultListView.currentIndex = index
185 marbleWidget.centerOn( longitude, latitude )
192 anchors.verticalCenter: parent.verticalCenter
196 property bool isBookmark: marbleWidget.bookmarks.isBookmark(longitude,latitude)
197 iconSource: isBookmark ?
"qrc:/icons/bookmark.png" :
"qrc:/icons/bookmark-disabled.png"
198 visible: searchResultItem.detailed
201 marbleWidget.bookmarks.removeBookmark(longitude,latitude)
203 marbleWidget.bookmarks.addBookmark(longitude,latitude, display,
"Default")
205 isBookmark = marbleWidget.bookmarks.isBookmark(longitude,latitude)
212 visible: searchResultItem.detailed
217 iconSource:
"qrc:/icons/routing-motorcar.svg"
219 marbleWidget.routing.routingProfile =
"Motorcar"
220 searchActivityPage.startRouting(longitude, latitude)
227 iconSource:
"qrc:/icons/routing-bike.svg"
229 marbleWidget.routing.routingProfile =
"Bicycle"
230 searchActivityPage.startRouting(longitude, latitude)
237 iconSource:
"qrc:/icons/routing-pedestrian.svg"
239 marbleWidget.routing.routingProfile =
"Pedestrian"
240 searchActivityPage.startRouting(longitude, latitude)
249 if ( status === PageStatus.Activating ) {
250 mapContainer.embedMarbleWidget()
254 function startRouting(longitude, latitude)
256 settings.gpsTracking =
true
257 marbleWidget.routing.clearRoute()
258 marbleWidget.routing.setVia( 0, marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude )
259 marbleWidget.routing.setVia( 1, longitude, latitude )
260 openActivity(
"Routing" )
static qreal radius(qreal zoom)