Valerio Giampà Sistema Grillo Geolocalizzazione E Rilevamento Per Dei Trasporti Più Sicuri Mb
Lo Sviluppo di Applicazione Geolocalizzazione
-
Upload
microsoft-mobile-developer -
Category
Documents
-
view
475 -
download
3
description
Transcript of Lo Sviluppo di Applicazione Geolocalizzazione
COSTRUIRE APPLICAZIONI GEOLOCALIZZATE
Marco Dal Pino
Nokia Developer Champion
Microsoft MVP – Client Development
Senior Mobile Dev @ DPCons
ITALIAN WEBINAR #5
Nokia Internal Use Only
AGENDA
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
• Visualizziamo una mappa • Aggiungiamo le Proprietà • Aggiungere Grafica sulla mappa • Iniziamo a divertirci • Usiamo i Launcher • I launcher di Here e gli URI scheme
Nokia Internal Use Only
VISUALIZZIAMO UNA MAPPA
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
Bing Maps Control sono supportati per compatibilità ma DEPRECATI
Non esiste più la proprietà ZoomBarVisibility e la classe PushPin.
Sostituite da altre proprietà e modalità di fare «overlay» di grafica
VECCHIO E NUOVO
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
• Aggiungere la capability ID_CAP_MAP al WMAppManifest
• Aggiungere la reference all’assembly: Microsoft.Phone.Maps.Controls
• Aggiungere la dichiarazione allo XAML: xmlns:maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps“
• Per aggiungerla via XAML:
CREIAMO LA PRIMA MAPPA
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
<phone:PhoneApplicationPage
...
xmlns:maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
...>
...
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1">
<maps:Map x:Name="MyMap"/>
...
</Grid>
...
</phone:PhoneApplicationPage>
VIA XAML
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
using Microsoft.Phone.Maps.Controls;
...
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
Map MyMap = new Map();
ContentPanel.Children.Add(MyMap);
}
...
}
VIA CODICE
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
COSTRUIAMO UNA MAPPA Demo
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
AGGIUNGIAMO LE PROPRIETÀ
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
ZoomLevel: 1..20 livello dello zoom
Heading: direzione (angolare) dove far puntare la parte alta della mappa
Pitch: Inclinazione della mappa
CartographicMode: tipo della mappa (stradale, foto aerea, foto e aerea, mappa «fisica»
ColorMode: Tema light e dark (solo per tipo stradale)
LandmarksEnabled: Mostra oggetti 3D, edifici sopra la mappa
PedestrianFeatureEnabled: mostra dettagli utili ai pedoni (scale passaggi ecc)
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
AGGIUNGIAMO LE PROPRIETÀ Principali proprietà di Map
Nokia Internal Use Only
<phone:PhoneApplicationPage
...
xmlns:maps = "clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
...>
...
<!--ContentPanel - place additional content here-->
<Grid x:Name = "ContentPanel" Grid.Row = "1“ >
<maps:Map x:Name = "MyMap" ZoomLevel = "10" Pitch = "30" CartographicMode = "Hybrid“ />
...
</Grid>
...
</phone:PhoneApplicationPage>
VIA XAML
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
public partial class MainPage : PhoneApplicationPage
{
...
private void PitchValueChanged(object sender, EventArgs e)
{
if (PitchSlider != null)
{
MyMap.Pitch = PitchSlider.Value;
}
}
}
VIA CODICE
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
AGGIUNGIAMO LE PROPRIETÀ Demo
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
AGGIUNGERE GRAFICA SULLA MAPPA
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
• aggiungere dei marcatori come UIElement (Immagini, poligoni, o anche griglie contenenti altri UIElement all’interno
AGGIUNGIAMO GRAFICA
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
AGGIUNGERE GRAFICA SULLA MAPPA Demo
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
INIZIAMO A DIVERTIRCI
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
Aggiungere ID_CAP_LOCATION al WMAppManifest
Referenziare System.Devices.Location e Windows.Device.Geolocation (Location Platform)
Occhio a Geocoordinate VS Lat, Long
geolocator.GetGeopositionAsync
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
INIZIAMO A DIVERTIRCI Posizione corrente
Nokia Internal Use Only
GeocodeQuery
Dato un testo (nome città o indirizzo) ritorna una List<MapLocation>
MapLocation contiene GeoCoordinate e LocationInformation con nome, descrizione e MapAddress della località
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
INIZIAMO A DIVERTIRCI Ricerca di un indirizzo
Nokia Internal Use Only
USIAMO I LAUNCHER
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
I launcher (dell’SDK standard) sono:
MapDownloaderTask
MapUpdaterTask
MapsDirectionTask
MapsTask
Dipendenza da Microsoft.Phone.Task
E System.Device.Location (solo MapsDirectionTask e MapsTask)
Si istanziano, si assegnano le proprietà e si visualizzano con .Show()
USIAMO I LAUNCHER
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
USIAMO I LAUNCHER Demo
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
USIAMO HERE LAUNCHER E URI SCHEME
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
Lanciano Here Maps per:
Mostrare itinerario da posizione corrente a posizione selez o destinaz
Ricerca testuale di un posto
Esplorare posti per categoria
Mostrare mappe delle località ad un livello desiderato di zoom
Mostrare località er ID o posizione sulla mappa
Lanciano Here Drive per:
Mostrare itinerario da posizione corrente a posizione selez o destinaz
Lanciano Here Transit per:
Mostrare itinerario da posizione corrente a posizione selez o destinaz con gestione orario
HERE LAUNCHER
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
E’ possibile lanciare direttamente le applicazioni tramite URI, passando anche dei parametri
Directions
Explore maps
Drive guidance
Walk guidance
Places
Public transit
Esempio di lancio di Drive “guidance-drive://v2.0/navigate/destination/?latlon=52.53,13.41&title=Museum“
public-transit://v2.0/search/stops/?appid=<ApplicationIdString>
directions://v2.0/route/destination/?latlon=60.1847853697836,24.5837861392647&origin.latlon=60.3022110555321,25.0254416931421&appid=<ApplicationIdString>
USARE GLI URI SCHEME DI HERE
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Nokia Internal Use Only
10/16/2013 © 2012 Nokia. All rights reserved. © 2012 Microsoft. All rights reserved.
Altri Riferimenti: HERE Launchers Project
https://github.com/nokia-developer/here-launchers
HERE Launchers Project http://developer.nokia.com/Resources/Library/Lumia/
#!maps-and-navigation/here-launchers.html
Progetto di esempio http://bit.ly/16fFMDd