How to move marker

65 vues
Accéder directement au premier message non lu

babar...@gmail.com

non lue,
7 avr. 2014, 01:51:3907/04/2014
à nutit...@googlegroups.com
Hello i have added marker to the map with the help of MarkerLayer. Can any body please tell how to move marker when location changes i.e how can i get the Marker object back that i have added to the markerlayer so i can set the new position.

Regards
Muhammad Babar

Marco Pleines

non lue,
7 avr. 2014, 07:38:4407/04/2014
à nutit...@googlegroups.com,babar...@gmail.com
This is a snippet that I used to draw a marker to the gps location.

Implement the Interface OrientationManager.OnChangedListener
Aetup the marker in the onCreate function and then update it on OnLocationChanged.

The variable currPosition is the Marker that I initialized within onCreate.


@Override
    public void onLocationChanged(OrientationManager orientationManager) {
        Location location = orientationManager.getLocation();
        MapPos mapPos = mapView.getLayers().getBaseProjection().fromWgs84(location.getLongitude(), location.getLatitude());
        // update the mapView focus
        mapView.setFocusPoint(mapPos);
       
        // update the position of the user's location marker
        currPosition.setMapPos(mapPos);

Jaak Laineste (Nutiteq)

non lue,
7 avr. 2014, 08:43:4007/04/2014
à nutit...@googlegroups.com
Hello,

with current API you cannot query from Layer. You have to remember the Marker object reference in application, and use it. So use class member instead of local variable. Then you can later call setMapPos() of it and it will be moved around.

Jaak


--
You received this message because you are subscribed to the Google Groups "Nutiteq-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nutiteq-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message