internal virtual void addPolygon() { int pointCount = 25; MapGeoPoint[] outerRing = new MapGeoPoint[pointCount]; MapGeoPoint[] innerRing = new MapGeoPoint[pointCount]; float rOuter = 20, rInner = 10; float cx = 30, cy = 30; // let's display circle for (int i = 0; i < pointCount; i++) { outerRing[i] = new MapGeoPoint(cx + System.Math.Sin(2 * System.Math.PI / pointCount * i) * rOuter, cy + System.Math.Cos(2 * System.Math.PI / pointCount * i) * rOuter); innerRing[i] = new MapGeoPoint(cx + System.Math.Sin(2 * System.Math.PI / pointCount * i) * rInner, cy + System.Math.Cos(2 * System.Math.PI / pointCount * i) * rInner); } MapGeoPoint[][] outerRings = new MapGeoPoint[][] { outerRing }; MapGeoPoint[][] innerRings = new MapGeoPoint[][] { innerRing }; GLMapVectorObject obj = GLMapVectorObject.CreatePolygonGeo(outerRings, innerRings); mapView.AddVectorObjectWithStyle(obj, GLMapVectorCascadeStyle.CreateStyle("area{fill-color:#10106050; fill-color:#10106050; width:4pt; color:green;}"), null); // #RRGGBBAA format }
internal virtual void addMarkersWithMapcss() { GLMapMarkerStyleCollection styleCollection = new GLMapMarkerStyleCollection(); for (int i = 0; i < unionColours.Length; i++) { float scale = (float)(0.2 + 0.1 * i); int index = styleCollection.AddStyle(new GLMapMarkerImage("marker" + scale, mapView.ImageManager.Open("cluster.svgpb", scale, unionColours[i]))); styleCollection.SetStyleName(i, "uni" + index); } GLMapVectorCascadeStyle style = GLMapVectorCascadeStyle.CreateStyle("node{icon-image:\"uni0\"; text:eval(tag(\"name\")); text-color:#2E2D2B; font-size:12; font-stroke-width:1pt; font-stroke-color:#FFFFFFEE;}" + "node[count>=2]{icon-image:\"uni1\"; text:eval(tag(\"count\"));}" + "node[count>=4]{icon-image:\"uni2\";}" + "node[count>=8]{icon-image:\"uni3\";}" + "node[count>=16]{icon-image:\"uni4\";}" + "node[count>=32]{icon-image:\"uni5\";}" + "node[count>=64]{icon-image:\"uni6\";}" + "node[count>=128]{icon-image:\"uni7\";}"); new AsyncTaskAnonymousInnerClassHelper(this, styleCollection, style).Execute(); }
private void loadGeoJSON() { GLMapVectorObjectList objects = GLMapVectorObject.CreateFromGeoJSON( "[{\"type\": \"Feature\", \"geometry\": {\"type\": \"Point\", \"coordinates\": [30.5186, 50.4339]}, \"properties\": {\"id\": \"1\", \"text\": \"test1\"}}," + "{\"type\": \"Feature\", \"geometry\": {\"type\": \"Point\", \"coordinates\": [27.7151, 53.8869]}, \"properties\": {\"id\": \"2\", \"text\": \"test2\"}}," + "{\"type\":\"LineString\",\"coordinates\": [ [27.7151, 53.8869], [30.5186, 50.4339], [21.0103, 52.2251], [13.4102, 52.5037], [2.3343, 48.8505]]}," + "{\"type\":\"Polygon\",\"coordinates\":[[ [0.0, 10.0], [10.0, 10.0], [10.0, 20.0], [0.0, 20.0] ],[ [2.0, 12.0], [ 8.0, 12.0], [ 8.0, 18.0], [2.0, 18.0] ]]}]"); GLMapVectorCascadeStyle style = GLMapVectorCascadeStyle.CreateStyle( "node[id=1]{icon-image:\"bus.svgpb\";icon-scale:0.5;icon-tint:green;text:eval(tag('text'));text-color:red;font-size:12;text-priority:100;}" + "node|z-9[id=2]{icon-image:\"bus.svgpb\";icon-scale:0.7;icon-tint:blue;text:eval(tag('text'));text-color:red;font-size:12;text-priority:100;}" + "line{linecap: round; width: 5pt; color:blue;}" + "area{fill-color:green; width:1pt; color:red;}"); mapView.AddVectorObjectsWithStyle(objects.ToArray(), style); }
internal virtual void addMultiline() { MapPoint[] line1 = new MapPoint[5]; line1[0] = MapPoint.CreateFromGeoCoordinates(53.8869, 27.7151); // Minsk line1[1] = MapPoint.CreateFromGeoCoordinates(50.4339, 30.5186); // Kiev line1[2] = MapPoint.CreateFromGeoCoordinates(52.2251, 21.0103); // Warsaw line1[3] = MapPoint.CreateFromGeoCoordinates(52.5037, 13.4102); // Berlin line1[4] = MapPoint.CreateFromGeoCoordinates(48.8505, 2.3343); // Paris MapPoint[] line2 = new MapPoint[3]; line2[0] = MapPoint.CreateFromGeoCoordinates(52.3690, 4.9021); // Amsterdam line2[1] = MapPoint.CreateFromGeoCoordinates(50.8263, 4.3458); // Brussel line2[2] = MapPoint.CreateFromGeoCoordinates(49.6072, 6.1296); // Luxembourg MapPoint[][] multiline = new MapPoint[][] { line1, line2 }; GLMapVectorObject obj = GLMapVectorObject.CreateMultiline(multiline); // style applied to all lines added. Style is string with mapcss rules. Read more in manual. mapView.AddVectorObjectWithStyle(obj, GLMapVectorCascadeStyle.CreateStyle("line{width: 2pt;color:green;layer:100;}"), null); }
public AsyncTaskAnonymousInnerClassHelper(MapViewActivity outerInstance, GLMapMarkerStyleCollection styleCollection, GLMapVectorCascadeStyle style) { this.outerInstance = outerInstance; this.styleCollection = styleCollection; this.style = style; }