15
1 Qt Location API

Qt Location API

Embed Size (px)

DESCRIPTION

Introdução à API de Location do QtMobility

Citation preview

1

Qt Location API

Sumário

2

• Mapas

• Projeção de Mercator

• QML Plugin

Mapas

3

• Como funciona?• Casos de uso• APIs

Mapas

4

• Podemos baixar imagens diretamente.http://maptile.maps.svc.ovi.com/maptiler/maptile/newest/normal.day/[z]/[x]/[y]/256/png8

• Onde• Z – representa o nível de zoom• X – Longitude• Y – Latitude

Exemplo

5

• Zoom = 0, X = 0, Y = 0

http://maptile.maps.svc.ovi.com/maptiler/maptile/newest/normal.day/0/0/0/256/png8

Projeção de Mercator• Níveis de zoom

0 1 tile o mundo inteiro 1 tile

1 2 x 2 tiles 4 tiles

2 4 x 4 tiles 16 tiles

... ... ...

12 4096 x 4096 tiles 16.777.216 tiles

... ... ...

n 2 x 2 tilesⁿ ⁿ 2² tilesⁿ

• Tile namesX = longitudeY = log(tan(latitude)+sec(latitude))X = (1+ (x/∏))/2Y = (1 – (y/∏))/2

n = 2 ^ zoom

Xtile = ((lon_deg + 180) / 360) * n

Ytile = (1 - (log(tan(lat_rad) + sec(lat_rad)) / π)) / 2 * n

7

Localizando Manaus• Latitude = -3, Longitude = -60, Zoom = 11, n = 2^11 = 2048• Xtile = (-60 + 180) / 360 * 2048 = 682,666• Ytile = (1 – (ln(tan(-3∏/180) + sec(-3∏/180))/∏)) /2 * 2048 = 1041,420

http://maptile.maps.svc.ovi.com/maptiler/maptile/newest/normal.day/11/682/1041/256/png8

8

QML Plugin• Mapas• Posicionamento• Marcadores

9

Mapas

• plugin• zoomLevel

• Elemento Map

10

Posicionamento• Elemento PositionSource

Marcadores• Landmark• LandmarkModel

|

11

12

Marcadores

12

• MapObjectView

13

Elementos de Mapas

13

• MapCircle• MapImage• MapMouseArea• MapPolygon• Plugin

DEMO14

$ git clone git://github.com/INdT/location-example.git

blog.qtlabs.org.br/2012/03/23/qml-location-api

Dúvidas?

15

André Loureiro – [email protected]

Jefferson Delfes – [email protected]