示例#1
0
        /// <summary>
        /// Generates reference image tiles.
        /// </summary>
        /// <param name="shapeFilePath">Shape file path.</param>
        /// <param name="regionHvMapPath">Region HV map file path.</param>
        /// <param name="shapeKey">Shape key used.</param>
        /// <param name="outputDir">Output directory where the reference image tiles have to be stored.</param>
        /// <param name="maxLevel">Maximum level of the pyramid.</param>
        private static void GenerateReferenceImageTiles(string shapeFilePath, string regionHvMapPath, string shapeKey, string outputDir, int maxLevel)
        {
            // Create output folder.
            if (!Directory.Exists(outputDir))
            {
                Directory.CreateDirectory(outputDir);
            }

            // Define Color map.
            var shapeGrid = new ShapeValueMap(shapeFilePath, regionHvMapPath, shapeKey);
            var colorMap  = new ShapeColorMap(shapeGrid);

            // Define serializer.
            var tileSerializer = new ImageTileSerializer(TileHelper.GetDefaultImageTilePathTemplate(outputDir), ImageFormat.Png);

            // Create and configure the tile creator.
            var tileCreator = new ShapeTileCreator(tileSerializer, colorMap, ProjectionTypes.Toast, maxLevel);

            // Generate shape file tiles.
            Trace.TraceInformation("{0}: Creating the reference image tiles..", DateTime.Now.TimeOfDay.ToString(@"hh\:mm\:ss"));
            var tileGenerator = new TileGenerator(tileCreator);

            tileGenerator.Generate(maxLevel);
            Trace.TraceInformation("{0}: Reference Image generation completed.", DateTime.Now.TimeOfDay.ToString(@"hh\:mm\:ss"));
        }
示例#2
0
        /// <summary>
        /// Generates reference image tiles.
        /// </summary>
        /// <param name="shapeFilePath">Shape file path.</param>
        /// <param name="regionHvMapPath">Region HV map file path.</param>
        /// <param name="shapeKey">Shape key used.</param>
        /// <param name="outputDir">Output directory where the reference image tiles have to be stored.</param>
        /// <param name="maxLevel">Maximum level of the pyramid.</param>
        private static void GenerateReferenceImageTiles(string shapeFilePath, string regionHvMapPath, string shapeKey, string outputDir, int maxLevel)
        {
            // Create output folder.
            if (!Directory.Exists(outputDir))
            {
                Directory.CreateDirectory(outputDir);
            }

            // Define Color map.
            var shapeGrid = new ShapeValueMap(shapeFilePath, regionHvMapPath, shapeKey);
            var colorMap = new ShapeColorMap(shapeGrid);

            // Define serializer.
            var tileSerializer = new ImageTileSerializer(TileHelper.GetDefaultImageTilePathTemplate(outputDir), ImageFormat.Png);

            // Create and configure the tile creator.
            var tileCreator = new ShapeTileCreator(tileSerializer, colorMap, ProjectionTypes.Toast, maxLevel);

            // Generate shape file tiles.
            Trace.TraceInformation("{0}: Creating the reference image tiles..", DateTime.Now.TimeOfDay.ToString(@"hh\:mm\:ss"));
            var tileGenerator = new TileGenerator(tileCreator);
            tileGenerator.Generate(maxLevel);
            Trace.TraceInformation("{0}: Reference Image generation completed.", DateTime.Now.TimeOfDay.ToString(@"hh\:mm\:ss"));
        }