示例#1
0
        public void RemoveLayer(int i)
        {
            if (i < 0 || i >= this.GetLayerCount())
            {
                return;
            }
            this.LayerSet.RemoveAt(i);

            // calculate extent dynamic(except i layer)
            this.MapExtent = new MG_MapExtent();// Empty extent
            for (int j = 0; j < this.GetLayerCount(); j++)
            {
                if (j != i)
                {
                    if (this.MapExtent.Empty())
                    {
                        this.MapExtent = this.LayerSet.GetAt(j).Extent;
                    }
                    else
                    {
                        this.MapExtent = calculateExtent(this.MapExtent, this.LayerSet.GetAt(j).Extent);
                    }
                }
            }
        }
示例#2
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);
     }
 }
示例#3
0
 public MG_MapView(Rectangle rect, MG_MapExtent me)
 {
     this.Scale         = 1.0;
     this.CurrentWindow = rect;
     this.CurrentExtent = me;
     this.Calculate();
 }
示例#4
0
 public MG_MapExtent(MG_MapExtent ext)
 {
     this.MinX = ext.MinX;
     this.MinY = ext.MinY;
     this.MaxX = ext.MaxX;
     this.MaxY = ext.MaxY;
 }
示例#5
0
        private MG_MapExtent calculateExtent(MG_MapExtent e1, MG_MapExtent e2)
        {
            MG_MapExtent ext = new MG_MapExtent();

            ext.MinX = min(e1.MinX, e2.MinX);
            ext.MinY = min(e1.MinY, e2.MinY);
            ext.MaxX = max(e1.MaxX, e2.MaxX);
            ext.MaxY = max(e1.MaxY, e2.MaxY);
            return(ext);
        }
示例#6
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;
 }
示例#7
0
        public MG_GeometryType Type; // default NONE

        public MG_Layer()
        {
            layerCount++;
            this.LayerName  = "Layer_" + layerCount.ToString();
            this.LayerPath  = null;
            this.IsVisible  = true;
            this.FeatureSet = new MG_FeatureSet();
            this.FieldSet   = new MG_FieldSet(this.LayerName);
            this.Extent     = new MG_MapExtent();
            this.Type       = MG_GeometryType.NONE;
        }
示例#8
0
        public void AddLayer(MG_Layer layer)
        {
            this.LayerSet.Add(layer);

            // calculate extent dynamic
            if (this.MapExtent.Empty())
            {
                this.MapExtent = layer.Extent;
            }
            else
            {
                this.MapExtent = calculateExtent(this.MapExtent, layer.Extent);
            }
        }
示例#9
0
 public void SetMapExtent(MG_MapExtent mapExtent)
 {// zoom to layer : mapextent = layerextent
     this.MapExtent = mapExtent;
 }
示例#10
0
 public void Update(Rectangle rect, MG_MapExtent me)
 {// FullExtent  ZoomToLayer
     this.CurrentWindow = rect;
     this.CurrentExtent = me;
     this.Calculate();
 }