CIQ 3 MapView and MapTrackView Observations

I have been doing some playing around with MapView and MapTrackView in the CIQ 3 beta.

I have a view configured with delegate and all working. I have noticed two things which are not working quite how I would expect.

First, when calling the new map view, I have been successful using the following code to display the map.
WatchUi.pushView(new TestMapView(), new TestMapViewDelegate(), WatchUi.SLIDE_IMMEDIATE);

If I try to use switchToView, the map simulator will not render the map view. For example the following change will not draw the mapview
WatchUi.switchToView(new TestMapView(), new TestMapViewDelegate(), WatchUi.SLIDE_IMMEDIATE);

I thought I was doing something wrong with the command, but was able to use both options with a normal view class and delegate. Has anyone been able to use the switchToView with the new MapView or MapTrackView?

Second observation, if I add text over the top of the map with the background color set to transparent, it will put a box around the text and not show the map underneath. See the attached picture. So it appears that item drawn on top of the map don't really have a transparent background. Am I missing something?

  • Which version of beta? I've never tried "switchToView", as pushView fit better in my apps.

    In the sim (beta2), I've had good luck with overlaying text, but I don't use transparent, as I didn't want to expect the background to work with the text color for the message. Forcing the BG for transparent might be a good thing..
  • I am working with beta2. I did not play around with the maps in beta1. So I don't know if there were any changes in behavior.

    I brought up the transparent background on the text mostly to see if that is by design. I am considering to mask the map view as a way to give me a cleaner look for the text.
  • I agree with you about the transparency. Me too would prefer to draw transparent text on top of the map.

    But looking at the MapSample in the samples folder I assume the inability to draw the text in a transparent way with the color of the map/map features is a technical limitation: you'll see that although the "hello world" text is drawn with a transparent background it has a boxed white background of the layer beneath it...
  • Former Member
    Former Member over 6 years ago
    The restriction on switchToView is one that has always been present for native views. This restriction is one we may lift in the future, but it requires some significant rework to enable.

    The transparency issue with text isn't something I would call "by design", but it is a limitation of the overlay capability we currently have in our devices. It is also something that may be targeted for improvement in the future, but not for the 3.0 release. (Edit: This only affects the simulator, and might get fixed for the 3.0 release)
  • Brian

    Thanks for confirming my sanity has not left the building. It may be worth a note in the SDK documentation that swotchToView does not work with MapViews. Knowing the limitations will help others save some time.
  • Former Member
    Former Member over 6 years ago
    Hey, just an update. I found out that the text issue is not a limitation on devices, and I think I can fix it on the Connect IQ simulator. We may be able to get it resolved before the official 3.0 release goes out.
  • Brian,

    That would be great. Thanks for the update.
  • Hello, 

    Ok, I had to learn about that non working switchToView hard way - I wish this was more clearly documented.

    Few questions to anyone who knows!

    1) I have few activity screens between which I usually move by arrows via switchToView. If I start using pushView, how should I handle loosing memory as the views are kept in the stack? Is there some optimal approach to this? Calling manually popView and then pushView again isn't usable as user get on screen for partial time previous view from the stack + it is not safe to do it like this in all occasions + I can't use transitions like this. 

    2) With MapTrackView I see, it can at least keep its zoom selected by user via BROWSE mode in the simulator, but when I test it with real device (D2 Charlie), it is not the case. Is there way to get the zoom info so I will be able to keep it after user will go back to map screen (either when doing initialise again or just going back to PREVIEW mode)? 

    3) Unlike on my real device, simulator reposition map to current location for MapTrackView even in BROWSE mode during movement of the map by the user. How behaves Fenix 5 Plus in this? Can I rely that old D2 Charlie is good representative of map CIQ3 mapping behaviour? I unfortunately doesn't have Fenix 5 Plus with me. 

    4) On real device, when I call pushView on top of the MapTrackView, which provides WatchUi.MenuInputDelegate, watch buttons don't work correctly, so I lose control over the app. MenuInputDelegate is initialised but onMenuItem isn't called. Everything is allright in simulator or if I open the same view with same delegate from different view.  Did somebody have similar issue? I am lost here. :( 

    On following video you can see topics no. 2, 1, 4 (in this order). 

    https://youtu.be/HmmIkvj5Gjw

    So my another try with mapping features didn't end up well.. Thanks for the help!

  • Ok, I've been working with MapView and MapTrackView for about a year now, and rule number one, is if the sim and device differ, trust the device!  On the device you have a number of things like the map settings, and true local maps.  In the sim, it has got to fetch the tiles from the net, may not be at the same res, etc, and for settings, there's no way to see/change those in the sim Also, on the real device, there is a scale for the map you don't see in the sim, so you want to avoid coving that up.

    1) if you push the mapview, pop it when you're leaving.  I take a very simplistic approach in Hike2.  All screens except the map are the same view, and I just use page numbers for the different screens.  When needed I push the map, and for things like up/down, in the delegate for the map view, I pop the map, and move to the appropriate screen.  Seeus you might be able to do something similar..  pop the map, and the view will be whatever you came from, I guess.

    2) this is one I can see both ways.  With browese, you can pan zoom, etc but on the device, it will go back to what it was before you left preview.  The way MapTrackView works, is it always centers on your current location, so panning would be lost.  retaining a zoom level would be nice, but it too is lost.  I have a menu setting for maps in my apps, (1 to 5 for example), that I use to size the area when I'm doing the setMapVisibleArea, (which i only do in initialize() for the MapTrackView)

    3) Go by the d2charle and not the sim

    4) Yes, I ran into this too (again trust the device).  What I actually do is pop the map before I push the menu, and when the menu selection is made, I re-push the map.

    MapView/MapTrackView are kind of odd even for native views, as there's a lot going on with the screen updates (onUpdate will be called a lot) so you want to minimize what you do there, like not redrawing the markers and polyline all the time.

  • Thank you Jim for detailed response. 

    1) That might work in the case, where you have pages implemented to single view which you switching with map. But in my case, I am using several view classes as pages and doing pop and push together even with immediate transition shows for part of the second previously loaded view - so the user experience greatly suffer. 

    2) Zoom: wow, this is nasty, I can't believe this was not fixed for whole year. Creating separate menu for it will only drag down whole user experience.. 

    4) uf

    Don't let anyone try to tell me again, that this mapping features are ready. They are still even after year more like the showcase and use them in the app means that user-experience will go down.  I don't understand why it didn't receive some "love" in the meantime after such promoting last year. Thermometer face

    BTW I see, that you added support for maps for D2 Charlie to your Hike 2 yesterday. Did you have changes to test it on this device? Is it behaving as other CIQ3 device with maps? I am still unsure if I must buy Fenix 5 Plus or can rely on this model with testing of this features..