Ejemplo n.º 1
0
        private List<TileInfo> GetTile()
        {
            var schema = _tileSource.Schema;
            IEnvelope pEnvelope = new EnvelopeClass();
            ISpatialReferenceFactory pSpatRefFact = new SpatialReferenceEnvironmentClass();
            pEnvelope.SpatialReference = pSpatRefFact.CreateGeographicCoordinateSystem(4326);
            pEnvelope.XMin = extent[0];
            pEnvelope.XMax = extent[2];
            pEnvelope.YMin = extent[1];
            pEnvelope.YMax = extent[3];

            var env = Projector.ProjectEnvelope(pEnvelope, schema.Srs);

            var mapWidth = 256 * num;
            var mapHeight = 256 * num;
            float resolution = (float)level;

            var centerPoint = env.GetCenterPoint();

            var transform = new Transform(centerPoint, resolution, mapWidth, mapHeight);
            Extent exte = new Extent(pEnvelope.XMin, pEnvelope.YMin, pEnvelope.XMax, pEnvelope.YMax);
            var level1 = Utilities.GetNearestLevel(schema.Resolutions, transform.Resolution);

            var tempExtent = new Extent(12597408.0986328, 2623556.09863281, 12629205.9013672, 2655353.90136719);
            var tiles = schema.GetTilesInView(tempExtent, 10);

            return tiles.ToList();
        }
Ejemplo n.º 2
0
        private List<TileInfo> GetTiles(IActiveView activeView)
        {
            var schema = _tileSource.Schema;
            var env = Projector.ProjectEnvelope(activeView.Extent, schema.Srs);
            Logger.Debug("Tilesource schema srs: " + schema.Srs);
            Logger.Debug("Projected envelope: xmin:" + env.XMin +
                        ", ymin:" + env.YMin +
                        ", xmax:" + env.YMin +
                        ", ymax:" + env.YMin
                        );

            var mapWidth = activeView.ExportFrame.right;
            var mapHeight = activeView.ExportFrame.bottom;
            var resolution = env.GetMapResolution(mapWidth);
            Logger.Debug("Map resolution: " + resolution);

            var centerPoint = env.GetCenterPoint();

            var transform = new Transform(centerPoint, resolution, mapWidth, mapHeight);
            var level = Utilities.GetNearestLevel(schema.Resolutions, transform.Resolution);
            Logger.Debug("Current level: " + level);

            _currentLevel = level;

            var tiles = schema.GetTilesInView(transform.Extent, level);

            return tiles.ToList();
        }