private static void DrawPolygons() { MapEvent(null, new MapEventArgs(0, 100, "Calling polygons...")); var polygons = d.getObjects(day, 3); var overlayLayer = new VectorLayer(dataSourcePolygons); overlayLayer.VisibleZoomRange = new MapRange(16, 24); mapView.Layers.Add(overlayLayer); VectorElementVector v = new VectorElementVector(); VectorElementVector vText = new VectorElementVector(); int i = 0; foreach (var obj in polygons) { //Define coordinates of outer ring MapPosVector polygonPoses = new MapPosVector(); foreach (var pnt in obj.polygonList.coordinates[0]) { polygonPoses.Add(projection.FromWgs84(new MapPos(pnt[0], pnt[1]))); } Polygon polygon = new Polygon(polygonPoses, Styles.GetDefaultPolygonStyle().BuildStyle()); v.Add(polygon); if (i == 0) { mapView.FocusPos = projection.FromWgs84(new MapPos(obj.polygonList.coordinates[0][0][0], obj.polygonList.coordinates[0][0][1])); } MapEvent(null, new MapEventArgs(i, polygons.Count, "Drawing polygons...")); i++; } dataSourcePolygons.RemoveAll(dataSourcePolygons.GetAll()); dataSourcePolygons.AddAll(v); }
private static void DrawTrunks() { MapEvent(null, new MapEventArgs(0, 100, "Calling type trunk...")); var trunks = d.getObjects(day, 2, 557); var overlayLayer = new VectorLayer(dataSourceTrunks); overlayLayer.VisibleZoomRange = new MapRange(6, 24); mapView.Layers.Add(overlayLayer); var overlayLayer2 = new VectorLayer(dataSourceTrunks2); overlayLayer2.VisibleZoomRange = new MapRange(9, 24); mapView.Layers.Add(overlayLayer2); var overlayLayerText = new VectorLayer(dataSourceTrunksText); overlayLayerText.VisibleZoomRange = new MapRange(17, 24); mapView.Layers.Add(overlayLayerText); VectorElementVector v = new VectorElementVector(); VectorElementVector v2 = new VectorElementVector(); VectorElementVector vText = new VectorElementVector(); mapView.FocusPos = projection.FromWgs84(new MapPos(trunks[0].lineList.coordinates[0][0], trunks[0].lineList.coordinates[0][1])); int i = 0; foreach (var obj in trunks) { var linePoses = new MapPosVector(); foreach (var pnt in obj.lineList.coordinates) { linePoses.Add(projection.FromWgs84(new MapPos(pnt[0], pnt[1]))); } var line = new Line(linePoses, Styles.GetTrunkStyle1().BuildStyle()); v.Add(line); var line2 = new Line(linePoses, Styles.GetTrunkStyle2().BuildStyle()); v2.Add(line2); var textpopup1 = new Text(projection.FromWgs84(new MapPos(obj.lineList.coordinates[0][0], obj.lineList.coordinates[0][1])), Styles.GetDefaultTextStyle().BuildStyle(), obj.name); vText.Add(textpopup1); MapEvent(null, new MapEventArgs(i, trunks.Count, "Drawing type trunk...")); i++; } dataSourceTrunks.RemoveAll(dataSourceTrunks.GetAll()); dataSourceTrunks.AddAll(v); dataSourceTrunks2.RemoveAll(dataSourceTrunks2.GetAll()); dataSourceTrunks2.AddAll(v2); dataSourceTrunksText.RemoveAll(dataSourceTrunksText.GetAll()); dataSourceTrunksText.AddAll(vText); }
private static void DrawPoints() { //MessageBox content to be rendered MapEvent(null, new MapEventArgs(0, 100, "Calling points")); //Objects are pulled from SQLite database var points = d.getObjects(day, 1); //Layers and the ZoomLevels where they should be visible are created (Zoomlevels range from 0 to 24) var overlayLayer = new VectorLayer(dataSourcePoints); overlayLayer.VisibleZoomRange = new MapRange(17, 24); mapView.Layers.Add(overlayLayer); var overlayLayerText = new VectorLayer(dataSourcePointsText); overlayLayerText.VisibleZoomRange = new MapRange(17, 24); mapView.Layers.Add(overlayLayerText); VectorElementVector v = new VectorElementVector(); VectorElementVector vText = new VectorElementVector(); mapView.FocusPos = projection.FromWgs84(new MapPos(points[0].pointList.coordinates[0], points[0].pointList.coordinates[1])); int i = 0; //Objects are drawn on layer foreach (var obj in points) { if (i > 500) { continue; } var pt = new Point( projection.FromWgs84(new MapPos(obj.pointList.coordinates[0], obj.pointList.coordinates[1])), Styles.GetDefaultPointStyle().BuildStyle()); v.Add(pt); var textpopup1 = new Text( projection.FromWgs84(new MapPos(obj.pointList.coordinates[0], obj.pointList.coordinates[1])), Styles.GetDefaultTextStyle().BuildStyle(), obj.name); vText.Add(textpopup1); MapEvent(null, new MapEventArgs(i, points.Count, "Drawing points")); i++; } //Layers are cleared of old data and written with new data dataSourcePoints.RemoveAll(dataSourcePoints.GetAll()); dataSourcePoints.AddAll(v); dataSourcePointsText.RemoveAll(dataSourcePointsText.GetAll()); dataSourcePointsText.AddAll(vText); }
private static void DrawForests() { MapEvent(null, new MapEventArgs(0, 100, "Calling type landuse forest ...")); var forests = d.getObjects(day, 3, 472); var overlayLayer = new VectorLayer(dataSourceForests); overlayLayer.VisibleZoomRange = new MapRange(6, 24); mapView.Layers.Add(overlayLayer); var overlayLayerText = new VectorLayer(dataSourceForestsText); overlayLayerText.VisibleZoomRange = new MapRange(17, 24); mapView.Layers.Add(overlayLayerText); VectorElementVector v = new VectorElementVector(); VectorElementVector vText = new VectorElementVector(); int i = 0; foreach (var obj in forests) { //Define coordinates of outer ring MapPosVector polygonPoses = new MapPosVector(); foreach (var pnt in obj.polygonList.coordinates[0]) { polygonPoses.Add(projection.FromWgs84(new MapPos(pnt[0], pnt[1]))); } Polygon polygon = new Polygon(polygonPoses, Styles.GetDefaultForestStyle().BuildStyle()); //polygon.SetMetaDataElement("ClickText", obj.name); v.Add(polygon); if (i == 0) { mapView.FocusPos = projection.FromWgs84(new MapPos(obj.polygonList.coordinates[0][0][0], obj.polygonList.coordinates[0][0][1])); } var textpopup1 = new Text(projection.FromWgs84(new MapPos(obj.polygonList.coordinates[0][0][0], obj.polygonList.coordinates[0][0][1])), Styles.GetDefaultTextStyle().BuildStyle(), obj.name); vText.Add(textpopup1); MapEvent(null, new MapEventArgs(i, forests.Count, "Drawing Type landuse forest...")); i++; } dataSourceForests.RemoveAll(dataSourceForests.GetAll()); dataSourceForests.AddAll(v); dataSourceForestsText.RemoveAll(dataSourceForestsText.GetAll()); dataSourceForestsText.AddAll(vText); }
private static void DrawRivers() { MapEvent(null, new MapEventArgs(0, 100, "Calling type waterway river...")); var rivers = d.getObjects(day, 2, 744); var overlayLayer = new VectorLayer(dataSourceRivers); overlayLayer.VisibleZoomRange = new MapRange(9, 24); mapView.Layers.Add(overlayLayer); var overlayLayerText = new VectorLayer(dataSourceRiversText); overlayLayerText.VisibleZoomRange = new MapRange(17, 24); mapView.Layers.Add(overlayLayerText); VectorElementVector v = new VectorElementVector(); VectorElementVector vText = new VectorElementVector(); int i = 0; foreach (var obj in rivers) { var linePoses = new MapPosVector(); foreach (var pnt in obj.lineList.coordinates) { linePoses.Add(projection.FromWgs84(new MapPos(pnt[0], pnt[1]))); } var line = new Line(linePoses, Styles.GetRiverStyle().BuildStyle()); v.Add(line); if (i == 0) { mapView.FocusPos = projection.FromWgs84(new MapPos(obj.lineList.coordinates[0][0], obj.lineList.coordinates[0][1])); } var textpopup1 = new Text(projection.FromWgs84(new MapPos(obj.lineList.coordinates[0][0], obj.lineList.coordinates[0][1])), Styles.GetDefaultTextStyle().BuildStyle(), obj.name); vText.Add(textpopup1); MapEvent(null, new MapEventArgs(i, rivers.Count, "Drawing type waterway river...")); i++; } dataSourceRivers.RemoveAll(dataSourceRivers.GetAll()); dataSourceRivers.AddAll(v); dataSourceRiversText.RemoveAll(dataSourceRiversText.GetAll()); dataSourceRiversText.AddAll(vText); }