• CommentAuthorprotherj
    • CommentTimeJul 30th 2012
     
    Is there a way to turn off all the balloons or all the icons/markers independently of each other?

    Thanks,
    Jason
  1.  
    Hi Jason,

    I take it you're talking about our JavaScript API? If you want to disable all balloons or all icons in one step, then you could hide the layer they're drawn on.

    To do this, create a separate ObjectLayer for the Pins and the Balloons - for example:

    var pinLayer = new ObjectLayer({map: map, zIndex:70});
    var balloonLayer = new ObjectLayer({map:map, zIndex:71});

    Here I've used the zIndex argument to indicate that the balloonLayer should appear in front of the pinLayer.

    We can then specify the layer the pin and balloon should appear on - you can do this by passing each layer as the "layer" argument to the ImageObject's config object, and to the balloonConfig object.

    var pin = new ImageObject ({
    balloonConfig: {
    behavior: Balloon.MANUAL_TOGGLE,
    content: 'Telogis HQ',
    show: true,
    layer: balloonLayer
    },
    location: new LatLon (33.648315,-117.734234),
    layer: pinLayer,
    size: new Size (16),
    src: 'images/building-01.gif'
    });

    Finally, we can simply call the show() and hide() events on each ObjectLayer to simultaneously show/hide all the pins or balloons on that layer. For example:

    map.RightClick.append(function (e) {
    if (balloonLayer.isVisible())
    {balloonLayer.hide()}
    else
    {balloonLayer.show()}
    });

    Let me know if this approach works for you. If you need a sample script, or more in depth advice, feel free to e-mail us on gbsupport@telogis.com.

    Thanks,

    Alex
    • CommentAuthorprotherj
    • CommentTimeJul 30th 2012
     
    Yes I'm using the Javascript API.

    I didn't realize the Balloon config could take a layer element. Thanks for the tip on the z-order for layers as well.

    I'll connect via the support email if I have further questions.

    Thanks,
    Jason
    • CommentAuthorprotherj
    • CommentTimeNov 5th 2012
     
    Alex,

    This solution worked well, however I'm now seeing another issue. I'm refreshing the pin locations on the map (actually, I'm clearing the layer and re-drawing them) and the old balloons are not getting destroyed properly. They are still there at the old location.

    Is this an issue where I should make sure I'm on the latest version? Any ideas?


    Thanks,
    Jason
  2.  
    Hi Jason,

    We have replied directly to your email regarding this support query.

    Thanks.

    April