예제 #1
0
        public SubFileParameter(SubFileParameterBuilder subFileParameterBuilder, RepresentationConverter projection)
        {
            this.StartAddress      = subFileParameterBuilder.startAddress;
            this.IndexStartAddress = subFileParameterBuilder.indexStartAddress;
            this.SubFileSize       = subFileParameterBuilder.subFileSize;
            this.BaseZoomLevel     = subFileParameterBuilder.baseZoomLevel;
            this.ZoomLevelMin      = subFileParameterBuilder.zoomLevelMin;
            this.ZoomLevelMax      = subFileParameterBuilder.zoomLevelMax;

            // calculate the XY numbers of the boundary tiles in this sub-file
            var tile1 = projection.GeoPointToTile(subFileParameterBuilder.boundingBox.point1, this.BaseZoomLevel);
            var tile2 = projection.GeoPointToTile(subFileParameterBuilder.boundingBox.point2, this.BaseZoomLevel);

            this.BoundaryTileLeft   = tile1.TileX;
            this.BoundaryTileBottom = tile1.TileY;
            this.BoundaryTileRight  = tile2.TileX;
            this.BoundaryTileTop    = tile2.TileY;

            // calculate the horizontal and vertical amount of blocks in this sub-file
            this.BlocksWidth  = this.BoundaryTileRight - this.BoundaryTileLeft + 1;
            this.BlocksHeight = this.BoundaryTileBottom - this.BoundaryTileTop + 1;

            // calculate the total amount of blocks in this sub-file
            this.NumberOfBlocks = this.BlocksWidth * this.BlocksHeight;

            this.IndexEndAddress = this.IndexStartAddress + this.NumberOfBlocks * BytesPerIndexEntry;
        }
예제 #2
0
        static void Main(string[] args)
        {
            var projection = new RepresentationConverter(Projections.Mercator);

            var GeoPoint1 = new GeoPoint(45, 5);
            var mappoint1 = projection.GeoPointToMappoint(GeoPoint1, 10);
            var GeoPoint2 = projection.MappointToGeoPoint(mappoint1);
            var tile1     = projection.MappointToTile(mappoint1);
            var tile2     = projection.GeoPointToTile(GeoPoint1, 10);

            Console.WriteLine("GeoPoint1 = {0}", GeoPoint1);
            Console.WriteLine("GeoPoint2 = {0}", GeoPoint2);
            Console.WriteLine("Mappoint1 = {0}", mappoint1);
            Console.WriteLine("Tile1 = {0} {{\n\tpoint1 : {1}  \n\tpoint2 : {2}\n}}", tile1, tile1.MapPoint1, tile1.MapPoint2);
            Console.WriteLine("Tile2 = {0}", tile2);
            Console.WriteLine("Tile1 contains Mappoint1 = {0}", tile1.Contains(mappoint1));
        }