public void Load(IPersistStream stream) { PersistablePoint ppoint = stream.Load("Point", null, new PersistablePoint(new Point())) as PersistablePoint; if (ppoint != null && ppoint.Point != null) { _geometry = ppoint.Point; return; } PersistablePointCollection pmultipoint = stream.Load("Multipoint", null, new PersistablePointCollection(new MultiPoint())) as PersistablePointCollection; if (pmultipoint != null && pmultipoint.PointCollection is IMultiPoint) { _geometry = pmultipoint.PointCollection as IMultiPoint; return; } PersistablePolyline ppolyline = stream.Load("Polyline", null, new PersistablePolyline(new Polyline())) as PersistablePolyline; if (ppolyline != null && ppolyline.Polyline != null) { _geometry = ppolyline.Polyline; return; } PersistablePolygon ppolygon = stream.Load("Polygon", null, new PersistablePolygon(new Polygon())) as PersistablePolygon; if (ppolygon != null && ppolygon.Polygon != null) { _geometry = ppolygon.Polygon; return; } PersistableEnvelope penvelope = stream.Load("Envelope", null, new PersistableEnvelope(new Envelope())) as PersistableEnvelope; if (penvelope != null && penvelope.Envelope != null) { _geometry = penvelope.Envelope; return; } PersistableAggregateGeometry pageometry = stream.Load("AggregateGeometry", null, new PersistableAggregateGeometry(new AggregateGeometry())) as PersistableAggregateGeometry; if (pageometry != null && pageometry.AggregateGeometry != null) { _geometry = pageometry.AggregateGeometry; return; } }
public void Load(IPersistStream stream) { if (stream == null || _envelope == null) { return; } PersistablePoint lowerleft = (PersistablePoint)stream.Load("lowerleft", new PersistablePoint(new Point()), new PersistablePoint(new Point())); PersistablePoint upperright = (PersistablePoint)stream.Load("upperright", new PersistablePoint(new Point()), new PersistablePoint(new Point())); _envelope.minx = Math.Min(lowerleft.Point.X, upperright.Point.X); _envelope.miny = Math.Min(lowerleft.Point.Y, upperright.Point.Y); _envelope.maxx = Math.Max(lowerleft.Point.X, upperright.Point.X); _envelope.maxy = Math.Max(lowerleft.Point.Y, upperright.Point.Y); }