Created
August 18, 2015 19:20
-
-
Save BrunoCaimar/82b8c9b9938de820d266 to your computer and use it in GitHub Desktop.
Obter polígono usando um extent como origem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obter_poligono: function(graphic, commontype) | |
{ | |
var geometry = graphic.geometry; | |
var polygon = geometry; | |
if(geometry.type === "extent") | |
{ | |
var a = geometry; | |
polygon = new Polygon(a.spatialReference); | |
var r=[[a.xmin,a.ymin], | |
[a.xmin,a.ymax], | |
[a.xmax,a.ymax], | |
[a.xmax,a.ymin], | |
[a.xmin,a.ymin]]; | |
polygon.addRing(r); | |
geometry = polygon; | |
commontype = "polygon"; | |
} | |
return polygon; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment