Example #1
0
 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);
     }
 }
Example #2
0
 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;
     }
 }
Example #3
0
 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);
     }
 }
Example #4
0
 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]);
     }
 }
Example #5
0
 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);
 }
Example #6
0
 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);
         }
     }
 }
Example #7
0
 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);
     }
 }
Example #8
0
 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;
 }
Example #9
0
 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);
     }
 }
Example #10
0
 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;
 }
Example #11
0
 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;
 }
Example #12
0
 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);
 }
Example #13
0
        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;
        }
Example #14
0
 public MG_ToolPan(MG_Map map, MG_MapView mapview)
     : base(MG_ToolType.Tool_Pan, null, mapview)
 {
     this.CurrentMap = map;
 }
Example #15
0
 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();
 }
Example #16
0
 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);
 }
Example #17
0
 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));
     }
 }
Example #18
0
 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);
     }
 }
Example #19
0
        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)
        {
        }
Example #20
0
 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;
 }
Example #21
0
 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);
     }
 }
Example #22
0
 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));
     }
 }
Example #23
0
 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;
 }
Example #24
0
 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();
 }
Example #26
0
 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));
     }
 }