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); } } }
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); }
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; }
private LonLat getLonLatFromViewPortPx(Pixel viewPortPx) { LonLat lonlat = null; if (_baseLayer != null) { lonlat = _baseLayer.getLonLatFromViewPortPx(viewPortPx); } return(lonlat); }
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; }
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); }
public LonLat(LonLat c) { this._lat = c._lat; this._lon = c._lon; }
public void setCenter(LonLat lonlat, int zoom, bool?dragging, bool?forceZoomChange) { //moveTo(lonlat, }
public void setCenter(LonLat lonlat, int zoom, bool? dragging, bool? forceZoomChange) { //moveTo(lonlat, }