Transferred from: 78984533#commentbox
ArcGIS for JS inside, drawing a circle is not difficult. Small can be used SimpleMarkerSymbol
, "style": "esriSMSCircle"
;
Big words, directly to anew Circle
But what if it is similar to Typhoon cone?
Like a circle, how to draw?
The answer is to draw polygons. Cone, it is 3 polygons. In fact, the so-called circle, is not the result of infinite approximation of the polygon? Like in calculus, that's what it says?
The principle of drawing Typhoon cone is as follows: Take the center as the origin point, the north direction is 0 degrees, draw the point clockwise, 1 degrees is 1 points, and connect to the line, and eventually return to the north direction, forming a closed polygon, and then filled. As the radius of the typhoon is divided into northeast, southeast, southwest, northwest Four directions, each direction distance from the center may be different length, so the formation of four serrated cone.
The code is as follows:
functionGetairring (c, center, index) {//cone; level wind series, center Origin varArcolor; Switch(c.level) { Case7:arcolor = [83, 168, 113]; Break;//Level 7 Cone Case10:arcolor = [175, 192, 130]; Break; Case12:arcolor = [185, 121, 96]; Break; default: Arcolor = [83, 168, 113]; Break; } //figure out all the points varPoints =NewArray (); Getpoints (center, C.en,0);//Northeast DirectionGetpoints (center, c.es, 90); Getpoints (center, c.ws,180); Getpoints (center, C.WN,270); Points[points.length]= Points[0];//End-to-end connection //Set Fill Symbol varBcolor = Arcolor; Bcolor.push (0.5);//Transparency varSFL =NewEsri.symbol.SimpleFillSymbol (Esri.symbol.SimpleFillSymbol.STYLE_SOLID,NewEsri.symbol.SimpleLineSymbol (Esri.symbol.SimpleLineSymbol.STYLE_SOLID,NewDojo. Color (Arcolor),2 ), NewDojo. Color (Bcolor)); //to connect a point to a polygon varPolygon =NewEsri.geometry.Polygon (points); //and filled with various cone data. varGR =NewESRI. Graphic (Polygon, SFL, {"Level": C.level, "WN": c.wn, "en": c.en, "es": c.es, "WS": c.ws,"Attrtype": "Airring", "index": Index,},NewEsri.infotemplate ("Cone: ${level}", tplairring)); returnGR; //This method is copied, 1 degrees a point functiongetpoints (center, Cradius, startangle) {varRadius = cradius/100; varPointnum = 90; varEndangle = StartAngle + 90; varsin; varCos; varx; vary; varangle; for(vari = 0; I <= pointnum; i++) {Angle= StartAngle + (endangle-startangle) *I/Pointnum; Sin= Math.sin (Angle * math.pi/180); Cos= Math.Cos (Angle * math.pi/180); X= Center[0] + radius *sin; Y= center[1] + radius *Cos; Points.push ([x, y]); } }}
How ArcGIS for JS draws Typhoon Cone