Beispiel #1
0
        private void updateSize()
        {
            Size newSize = getCurrentSize();
            Size oldSize = getSize();

            if (oldSize == Size.Empty)
            {
                _size = oldSize = newSize;
            }
            if (!newSize.Equals(oldSize))
            {
                _size = newSize;

                // @@@ notify layers on resize?

                if (_baseLayer != null)
                {
                    Pixel  center = new Pixel((float)(newSize.Width / 2), (float)(newSize.Height / 2));
                    LonLat lonlat = getLonLatFromViewPortPx(center);
                    int    zoom   = getZoom().Value;
                    _zoom = null;
                    setCenter(getCenter(), zoom, null, null);
                }
            }
        }
Beispiel #2
0
        public LonLat getLonLatFromViewPortPx(Pixel viewPortPx)
        {
            LonLat lonlat = null;

            if (viewPortPx != null)
            {
                Size   size   = _map.getSize();
                LonLat center = _map.getCenter();
                if (center != null)
                {
                    float res = _map.getResolution().Value;

                    float delta_x = (float)(viewPortPx.x - (size.Width / 2));
                    float delta_y = (float)(viewPortPx.y - (size.Height / 2));

                    lonlat = new LonLat(center.lon + delta_x * res,
                                        center.lat - delta_y * res);

                    if (_wrapDateLine)
                    {
                        lonlat = lonlat.wrapDateLine(_maxExtent);
                    }
                }
            }
            return(lonlat);
        }
Beispiel #3
0
        public LonLat getLonLatFromViewPortPx(Pixel viewPortPx)
        {
            LonLat lonlat = null;
            if (viewPortPx != null)
            {
                Size size = _map.getSize();
                LonLat center = _map.getCenter();
                if (center != null)
                {
                    float res = _map.getResolution().Value;

                    float delta_x = (float)(viewPortPx.x - (size.Width / 2));
                    float delta_y = (float)(viewPortPx.y - (size.Height / 2));

                    lonlat = new LonLat(center.lon + delta_x * res,
                                                center.lat - delta_y * res);

                    if (_wrapDateLine)
                    {
                        lonlat = lonlat.wrapDateLine(_maxExtent);
                    }
                }
            }
            return lonlat;
        }
Beispiel #4
0
        private LonLat getLonLatFromViewPortPx(Pixel viewPortPx)
        {
            LonLat lonlat = null;

            if (_baseLayer != null)
            {
                lonlat = _baseLayer.getLonLatFromViewPortPx(viewPortPx);
            }

            return(lonlat);
        }
Beispiel #5
0
        public LonLat wrapDateLine(Rect maxExtent)
        {
            LonLat newLonLat = new LonLat(this);

            if (maxExtent != Rect.Empty)
            {
                while (newLonLat.lon < maxExtent.X)
                {
                    newLonLat.lon += (float)maxExtent.Width;
                }

                while (newLonLat.lon > maxExtent.Right)
                {
                    newLonLat.lon -= (float)maxExtent.Width;
                }
            }

            return newLonLat;
        }
Beispiel #6
0
        public LonLat wrapDateLine(Rect maxExtent)
        {
            LonLat newLonLat = new LonLat(this);

            if (maxExtent != Rect.Empty)
            {
                while (newLonLat.lon < maxExtent.X)
                {
                    newLonLat.lon += (float)maxExtent.Width;
                }

                while (newLonLat.lon > maxExtent.Right)
                {
                    newLonLat.lon -= (float)maxExtent.Width;
                }
            }

            return(newLonLat);
        }
Beispiel #7
0
 public LonLat(LonLat c)
 {
     this._lat = c._lat;
     this._lon = c._lon;
 }
Beispiel #8
0
 public void setCenter(LonLat lonlat, int zoom, bool?dragging, bool?forceZoomChange)
 {
     //moveTo(lonlat,
 }
Beispiel #9
0
 public LonLat(LonLat c)
 {
     this._lat = c._lat;
     this._lon = c._lon;
 }
Beispiel #10
0
 public void setCenter(LonLat lonlat, int zoom, bool? dragging, bool? forceZoomChange)
 {
     //moveTo(lonlat, 
 }