Exemple #1
0
        public void Setup()
        {
            this.tilingProfile = new PanoJsTilingProfile();

            this.outputDirectory = PathHelper.GetTempDir();

            this.tiler = new Tiler(
                this.outputDirectory,
                this.tilingProfile,
                new SortedSet <double>()
            {
                60.0, 24, 12, 6, 2, 1
            },
                60.0,
                1440,
                new SortedSet <double>()
            {
                1, 1, 1, 1, 1, 1
            },
                1.0,
                300);
        }
        private static (TilingProfile Profile, TimeSpan padding) GetTilingProfile(
            ZoomParameters common,
            SpectrogramZoomingConfig zoomConfig,
            IndexGenerationData indexGeneration,
            double maxScale)
        {
            TilingProfile namingPattern;
            TimeSpan      padding;

            switch (zoomConfig.TilingProfile)
            {
            case nameof(PanoJsTilingProfile):
                namingPattern = new PanoJsTilingProfile();
                padding       = TimeSpan.Zero;

                if (zoomConfig.TileWidth != namingPattern.TileWidth)
                {
                    throw new ConfigFileException(
                              "TileWidth must match the default PanoJS TileWidth of " + namingPattern.TileWidth);
                }

                break;

            case nameof(AbsoluteDateTilingProfile):
                // Zooming spectrograms use multiple color profiles at different levels
                // therefore unable to set a useful tag (like ACI-ENT-EVN).
                if (indexGeneration.RecordingStartDate != null)
                {
                    var recordingStartDate = (DateTimeOffset)indexGeneration.RecordingStartDate;
                    var tilingStartDate    = GetPreviousTileBoundary(
                        zoomConfig.TileWidth,
                        maxScale,
                        recordingStartDate);
                    padding = recordingStartDate - tilingStartDate;

                    // if we're not writing tiles to disk, omit the basename because whatever the container format is
                    // it will have the base name attached
                    namingPattern = new AbsoluteDateTilingProfile(
                        common.OmitBasename ? string.Empty : common.OriginalBasename,
                        "BLENDED.Tile",
                        tilingStartDate,
                        indexGeneration.FrameLength / 2,
                        zoomConfig.TileWidth);
                }
                else
                {
                    throw new ArgumentNullException(
                              nameof(zoomConfig.TilingProfile),
                              "`RecordingStateDate` from the `IndexGenerationData.json` cannot be null when `AbsoluteDateTilingProfile` specified");
                }

                break;

            default:
                throw new ConfigFileException(
                          $"The {nameof(zoomConfig.TilingProfile)} configuration property was set to an unsupported value - no profile known by that name");
            }

            Log.Info($"Tiling had a left padding duration of {padding} to align tiles");
            Log.Info(
                $"Tiling using {namingPattern.GetType().Name}, Tile Width: {namingPattern.TileWidth}, Height: {namingPattern.TileHeight}");
            return(namingPattern, padding);
        }