none
Microsoft.Maps.GeometryType is undefined RRS feed

  • Question

  • Hi, 

    Previously there is an enum of the GeometryType but now it is gone?

    Is there a where to check for the GeometryType?

    I'm trying to check what has been created by user through the drawing manager drawingEnded event, like below:

    Microsoft.Maps.Events.addHandler(ctrl.draw.manager, 'drawingEnded', function(e){
                            switch(e.geometryType){

    case Microsoft.Maps.GeometryType.point:

                            }

     Now that Microsoft.Maps.GeometryType is gone, what can I use as a replacement?

    Cheers, 

    dulubi

    Wednesday, February 8, 2017 1:45 PM

Answers

  • The geometryType information is internal to the map control and not a documented part of the API. Anything that isn't documented can change at anytime without warning.

    To determine what type of shape a shape is you can use a simple if statement and check the instance of the shape. For example:

    if (shape instanceof Microsoft.Maps.Pushpin) {
    	
    } else if (shape instanceof Microsoft.Maps.Polyline) {
    
    } else if (shape instanceof Microsoft.Maps.Polygon) {
    
    }
    Note that using a switch statement on such a small number of comparisons wouldn't make a noticeable difference in terms of speed.

    [Blog] [twitter] [LinkedIn]

    Wednesday, February 8, 2017 7:20 PM