MapContainer code or functionality required

30 views
Skip to first unread message

romanca...@gmail.com

unread,
Mar 26, 2017, 6:31:39 PM3/26/17
to CodenameOne Discussions
Hi! im tryng do make a zoom to some area in a Map (native)  like the MapComponent's   zoomTo(BoundingBox) use to do.

i was tryng to implemented by myself coding -but without- good results and i cant do it on the native way that i think tha its the best.

considering that that functionality was originally in the mapComponent, its possible to the team plans to implement it in the MapContainer?

also, if somebody have solve that problem , please share the code.

My CN1 code is:

        Coord centro = getCenterCoord(parBoundingBox);
        mapa.setCameraPosition(centro);
        int currentZoom = 1;
        mapa.zoom(centro, currentZoom);
        while (mapa.getBoundingBox().contains(parBoundingBox.getNorthEast()) == true && mapa.getBoundingBox().contains(parBoundingBox.getSouthWest()) == true)
        {
       currentZoom++;    
            mapa.zoom(centro, currentZoom);
        }
        currentZoom--;    
        mapa.zoom(centro, currentZoom);


If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device

Steve Hannah

unread,
Mar 27, 2017, 1:45:42 AM3/27/17
to codenameone...@googlegroups.com
That strategy looks like it should work.  What results are you getting?

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/007061fd-20f3-451e-8237-37e3a2b600e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

roman canoniero

unread,
Mar 27, 2017, 8:52:19 AM3/27/17
to codenameone...@googlegroups.com
Steve: actually, didnt work on android. I was reading that the right way is to use the panToBounds() procedure in maps api.

Saldy, i have not the advanced knowledge to do it in native interface.

Can you help me? 

ThNks roman

To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.



--
Steve Hannah
Software Developer
Codename One

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/xNisJiv7nCU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.

Steve Hannah

unread,
Mar 27, 2017, 1:08:21 PM3/27/17
to codenameone...@googlegroups.com
You can file an RFE for this feature, but I don't know when I'd get around to implementing it.

The problem with your code is zoomTo() is asynchronous. After a zoomTo call, you need to wait for the map to finish zooming before you check the bounds again.  Here is a code snippet I pulled from some scratch code of mine that does roughly what you want.


It probably isn't as smooth as using the native methods directly, but it works.

Steve

To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.



--
Steve Hannah
Software Developer
Codename One

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/xNisJiv7nCU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discussions+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages