private bool CoordEnvelopeEquals(DF.CoordEnvelope a, DF.CoordEnvelope b) { if (a == null || b == null) { return(false); } return(Math.Abs(a.MinX - b.MinX) < double.Epsilon && Math.Abs(a.MinY - b.MinY) < double.Epsilon && Math.Abs(a.MaxX - b.MaxX) < double.Epsilon && Math.Abs(a.MaxY - b.MaxY) < double.Epsilon); }
private bool EnvelopeIsNaN(DF.CoordEnvelope evp) { return(double.IsNaN(evp.MinX) || double.IsNaN(evp.MaxX) || double.IsNaN(evp.MinY) || double.IsNaN(evp.MaxY) || // double.IsInfinity(evp.MinX) || double.IsInfinity(evp.MaxX) || double.IsInfinity(evp.MinY) || double.IsInfinity(evp.MaxY) || // double.IsNegativeInfinity(evp.MinX) || double.IsNegativeInfinity(evp.MaxX) || double.IsNegativeInfinity(evp.MinY) || double.IsNegativeInfinity(evp.MaxY)); }
private void SetEnvelope() { GeoDo.RSS.Core.DF.CoordEnvelope evp = _dataProvider.CoordEnvelope; switch (_dataProvider.CoordType) { case enumCoordType.Raster: case enumCoordType.PrjCoord: if (evp == null) { evp = new DF.CoordEnvelope(new DF.CoordPoint(0, 0), _dataProvider.Width, _dataProvider.Height); } _envelope = new DrawEngine.CoordEnvelope(evp.MinX, evp.MaxX, evp.MinY, evp.MaxY); if (_dataProvider.SpatialRef != null) { _projectionTransform = ProjectionTransformFactory.GetProjectionTransform(SpatialReference.GetDefault(), _dataProvider.SpatialRef); } _canvas.CoordTransform.DataCoordType = enumDataCoordType.Prj; break; case enumCoordType.GeoCoord: //这里未处理其他坐标系统//??? _projectionTransform = ProjectionTransformFactory.GetDefault(); double[] xs = new double[] { evp.MinX, evp.MaxX }; double[] ys = new double[] { evp.MinY, evp.MaxY }; _projectionTransform.Transform(xs, ys); _envelope = new DrawEngine.CoordEnvelope(xs[0], xs[1], ys[0], ys[1]); _canvas.CoordTransform.DataCoordType = enumDataCoordType.Geo; break; } _originalEnvelope = _envelope.Clone(); _originalResolutionX = (float)(_originalEnvelope.Width / _dataProvider.Width); _originalResolutionY = (float)(_originalEnvelope.Height / _dataProvider.Height); // if (_dataProvider.SpatialRef == null) { _canvas.CoordTransform.SpatialRefOfViewer = new SpatialReference(new GeographicCoordSystem()); } else { _canvas.CoordTransform.SpatialRefOfViewer = _dataProvider.SpatialRef.Clone(); } }
void IGeoPanAdjust.ApplyAdjust(double offsetGeoX, double offsetGeoY) { GeoDo.RSS.Core.DF.CoordEnvelope evp = new DF.CoordEnvelope( _dataProvider.CoordEnvelope.MinX + offsetGeoX, _dataProvider.CoordEnvelope.MaxX + offsetGeoX, _dataProvider.CoordEnvelope.MinY + offsetGeoY, _dataProvider.CoordEnvelope.MaxY + offsetGeoY); IUpdateCoordEnvelope update = _dataProvider as IUpdateCoordEnvelope; if (update != null) { update.Update(evp); SetEnvelope(); } if (_dataProviderCopy != null) { update = _dataProviderCopy as IUpdateCoordEnvelope; if (update != null) { update.Update(evp); } } _isHasUnsavedGeoAdjusted = true; }