public TileProvider(TileConsumer consumer, Rectangle worldExtents) { if (consumer == TileConsumer.None) { throw new ArgumentException("'None' is not a valid consumer.", "consumer"); } this.consumer = consumer; if (consumer == TileConsumer.GoogleMaps || consumer == TileConsumer.VirtualEarth) { if (worldExtents != null) { throw new ArgumentException("World extents for this tile consumer is fixed and cannot be set (must be null)", "worldExtents"); } if (consumer == TileConsumer.VirtualEarth) { minZoomLevel = 1; maxZoomLevel = 23; } // get projection to grab circumference SphericalMercatorProjector prj = new SphericalMercatorProjector(); // set mercator origin (center of the map (0,0)) double origin = prj.Circumference/2; this.worldExtents = new Rectangle(-origin, -origin, origin, origin); } else if (consumer == TileConsumer.TileMapService) { this.worldExtents = worldExtents; } }
public TileProvider(TileConsumer consumer) : this(consumer, (consumer == TileConsumer.TileMapService ? Rectangle.GeographicWorldExtents : null)) { }