Example #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);
                    }
                }
            }
        }
Example #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);
     }
 }
Example #3
0
 public MG_MapView(Rectangle rect, MG_MapExtent me)
 {
     this.Scale         = 1.0;
     this.CurrentWindow = rect;
     this.CurrentExtent = me;
     this.Calculate();
 }
Example #4
0
 public MG_MapExtent(MG_MapExtent ext)
 {
     this.MinX = ext.MinX;
     this.MinY = ext.MinY;
     this.MaxX = ext.MaxX;
     this.MaxY = ext.MaxY;
 }
Example #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);
        }
Example #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;
 }
Example #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;
        }
Example #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);
            }
        }
Example #9
0
 public void SetMapExtent(MG_MapExtent mapExtent)
 {// zoom to layer : mapextent = layerextent
     this.MapExtent = mapExtent;
 }
Example #10
0
 public void Update(Rectangle rect, MG_MapExtent me)
 {// FullExtent  ZoomToLayer
     this.CurrentWindow = rect;
     this.CurrentExtent = me;
     this.Calculate();
 }