public void InitMapView(Rectangle rect, MG_MapExtent me) {// layerCount>0 => MapExtent!=Empty => MapView!=null if (!this.MapExtent.Empty()) { this.MapView = new MG_MapView(rect, me); } }
public static void RenderGeometry(Graphics g, Pen pen, Brush brush, MG_MapView mapview, MG_Geometry geometry) { switch (geometry.Type) { case MG_GeometryType.NONE: break; case MG_GeometryType.POINT: MG_MapRender.RenderPoint(g, brush, MG_Constant.PointRadius, mapview, geometry as MG_Point); break; case MG_GeometryType.MULTIPOINT: MG_MapRender.RenderMultiPoint(g, brush, MG_Constant.PointRadius, mapview, geometry as MG_MultiPoint); break; case MG_GeometryType.LINESTRING: MG_MapRender.RenderLineString(g, pen, mapview, geometry as MG_LineString); break; case MG_GeometryType.MULTILINESTRING: MG_MapRender.RenderMultiLineString(g, pen, mapview, geometry as MG_MultiLineString); break; case MG_GeometryType.POLYGON: MG_MapRender.RenderPolygon(g, brush, mapview, geometry as MG_Polygon); //MG_MapRender.RenderPolygon(g, pen, mapview, geometry as MG_Polygon); break; case MG_GeometryType.MULTIPOLYGON: MG_MapRender.RenderMultiPolygon(g, brush, mapview, geometry as MG_MultiPolygon); //MG_MapRender.RenderMultiPolygon(g, pen, mapview, geometry as MG_MultiPolygon); break; } }
public static void RenderMap(MG_Map map, MG_MapView mapview, Graphics g) { for (int i = 0; i < map.GetLayerCount(); i++) { RenderLayer(map.GetLayer(i), mapview, g); } }
public static void RenderGeometrys(Graphics g, Pen pen, Brush brush, MG_MapView mapview, List<MG_Geometry> geometrys) { for (int i = 0; i < geometrys.Count; i++) { RenderGeometry(g, pen, brush, mapview, geometrys[i]); } }
public static void RenderFeature(MG_Feature f, MG_MapView mapview, Graphics g) { //int realValue = GetRealValue(f.Symbol.LineWidth, mapview); Pen pen = new Pen(f.Symbol.OutlineColor, f.Symbol.LineWidth); SolidBrush brush = new SolidBrush(f.Symbol.FillColor); RenderGeometry(g, pen, brush, mapview, f.Geometry); }
public static void RenderLayer(MG_Layer layer, MG_MapView mapview, Graphics g) { if (layer.GetVisible()) { for (int i = 0; i < layer.GetFeatureCount(); i++) { RenderFeature(layer.GetFeature(i),mapview, g); } } }
public void AddZoomToHistory(MG_MapView mapview) {// updateMapView // zoomin/zoomout/pan/left/right/up/down if (mapview != null) { this.CurrentZoomIndex++; MG_ZoomRecord zoom = new MG_ZoomRecord(mapview.GetScale(), mapview.GetCenterX(), mapview.GetCenterY()); this.ZoomHistory.Add(zoom); } }
public MG_Map() { mapCount++; this.MapName = "Map_" + mapCount.ToString(); this.MapPath = null; this.MapExtent = new MG_MapExtent(); this.LayerSet = new MG_LayerSet(); this.ZoomHistory = new MG_ZoomHistory(); this.CurrentZoomIndex = -1; this.MapView = null; }
public void AddZoomToHistory(MG_MapView mapview) { // updateMapView // zoomin/zoomout/pan/left/right/up/down if (mapview != null) { this.CurrentZoomIndex++; MG_ZoomRecord zoom = new MG_ZoomRecord(mapview.GetScale(), mapview.GetCenterX(), mapview.GetCenterY()); this.ZoomHistory.Add(zoom); } }
public static int GetRealValue(int value, MG_MapView mapview) { int realValue = value; if (mapview != null) { realValue = (int)mapview.GetValue(value); if (realValue <= 0) { realValue = 1; } } return realValue; }
public static void RenderLineString(Graphics g, Pen pen, MG_MapView mapview, MG_LineString lineString) { int count = lineString.Count(); if (count < 2) return; Point[] points = new Point[count]; for (int i = 0; i < count; i++) { MG_Point mp = lineString.GetAt(i); points[i] = AsPoint(mp, mapview); } DrawLineString(g, pen, points); }
public MG_BaseTool(MG_ToolType type, MG_Layer layer, MG_MapView mapview) { this.ToolType = type; this.Layer = layer; this.MapView = mapview; if (layer!=null) {// pan tool: layer==null this.Feature = new MG_Feature(this.Layer.GetFieldSet()); } // empty point this.FromPoint = Point.Empty; this.ToPoint = Point.Empty; this.Point3 = Point.Empty; this.SelectRect = Rectangle.Empty; }
public MG_ToolPan(MG_Map map, MG_MapView mapview) : base(MG_ToolType.Tool_Pan, null, mapview) { this.CurrentMap = map; }
public MG_ToolDrawPolygon(MG_Layer layer, MG_MapView mapview) : base(MG_ToolType.Tool_DrawPolygon, layer, mapview) { this.LineString = new MG_LineString(); this.Polygon = new MG_Polygon(); }
public static void RenderPoint(Graphics g, Brush brush, int radius, MG_MapView mapview, MG_Point point) { //int realValue = GetRealValue(radius, mapview); //if (realValue < MG_Constant.PointRadius) //{ // realValue = MG_Constant.PointRadius; //} Point sp = AsPoint(point, mapview); FillPoint(g, brush, sp, radius); }
public static void RenderMultiPolygon(Graphics g, Pen pen, MG_MapView mapview, MG_MultiPolygon multiPolygon) { for (int i = 0; i < multiPolygon.Count(); i++) { RenderPolygon(g, pen, mapview, multiPolygon.GetAt(i)); } }
public static void RenderPolygon(Graphics g, Pen pen, MG_MapView mapview, MG_Polygon polygon) { int countLineString = polygon.Count(); for (int i = 0; i < countLineString; i++) { MG_LineString lineString = polygon.GetAt(i); int countPoint = lineString.Count(); if (countPoint < 3) return; Point[] points = new Point[countPoint]; for (int j = 0; j < countPoint; j++) { MG_Point mp = lineString.GetAt(j); points[j] = AsPoint(mp, mapview); } //FillPolygon(g, brush, points); //Pen pen = new Pen(Color.Red, 1); DrawPolygon(g, pen, points); } }
protected bool IsStart = true; // start end #endregion Fields #region Constructors public MG_ToolDrawRectangle(MG_Layer layer, MG_MapView mapview) : base(MG_ToolType.Tool_DrawRectangle, layer, mapview) { }
public static MG_Point ToPoint(Point point, MG_MapView mapview) { MG_Point mp; if (mapview != null) { mp = mapview.Screent2Map(point); } else { mp = new MG_Point(point.X, point.Y); } return mp; }
public void InitMapView(Rectangle rect, MG_MapExtent me) { // layerCount>0 => MapExtent!=Empty => MapView!=null if (!this.MapExtent.Empty()) { this.MapView = new MG_MapView(rect, me); } }
public static void RenderMultiPoint(Graphics g, Brush brush, int radius, MG_MapView mapview, MG_MultiPoint multiPoint) { for (int i = 0; i < multiPoint.Count(); i++) { RenderPoint(g, brush, radius, mapview, multiPoint.GetAt(i)); } }
private static Point AsPoint(MG_Point point, MG_MapView mapview) { Point sp; if (mapview != null) { sp = mapview.Map2Screen(point); } else { sp = new Point((int)point.x, (int)point.y); } return sp; }
public MG_ToolDrawPoint(MG_Layer layer, MG_MapView mapview) : base(MG_ToolType.Tool_DrawPoint, layer, mapview) { this.MapPoint = new MG_Point(); }
public MG_ToolDrawLineString(MG_Layer layer, MG_MapView mapview) : base(MG_ToolType.Tool_DrawLineString, layer, mapview) { this.LineString = new MG_LineString(); }
public static void RenderMultiLineString(Graphics g, Pen pen, MG_MapView mapview, MG_MultiLineString multiLineString) { for (int i = 0; i < multiLineString.Count(); i++) { RenderLineString(g, pen, mapview, multiLineString.GetAt(i)); } }