// Copyright (C) Stichting Deltares 2016. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System;
using Core.Components.Gis.Data;
namespace Ringtoets.Integration.Forms.Views
{
///
/// Class representing a capability coming from a Web Map Tile Service (WMTS).
///
public class WmtsCapability
{
///
/// Creates a new instance of .
///
/// The id of the WMTS capability.
/// The type of image format of the WMTS capability.
/// The title of the WMTS capability.
/// The coordinate system of the WMTS capability.
/// Thrown when any of the input parameters is null.
/// Thrown when is not stated as a MIME-type.
public WmtsCapability(string id, string format, string title, string coordinateSystem)
{
if (id == null)
{
throw new ArgumentNullException(nameof(id));
}
if (format == null)
{
throw new ArgumentNullException(nameof(format));
}
if (title == null)
{
throw new ArgumentNullException(nameof(title));
}
if (coordinateSystem == null)
{
throw new ArgumentNullException(nameof(coordinateSystem));
}
if (!format.StartsWith("image/"))
{
throw new ArgumentException(@"Specified image format is not a MIME type.", nameof(format));
}
Id = id;
Format = format;
Title = title;
CoordinateSystem = coordinateSystem;
}
///
/// Gets the id of the WMTS capability.
///
public string Id { get;}
///
/// Gets the image format of the WMTS capability.
///
public string Format { get; }
///
/// Gets the title of the WMTS capability.
///
public string Title { get; }
///
/// Gets the coordinate system of the WMTS capability.
///
public string CoordinateSystem { get; }
///
/// Creates a new instance of based upon the local properties.
///
/// The name of the source (for visualization purposes only).
/// The URL to the capabilities of the WMTS.
/// The newly created .
/// Thrown when
/// or is null.
public WmtsMapData ToWmtsMapdata(string displayName, string sourceCapabilitiesUrl)
{
return new WmtsMapData(displayName, sourceCapabilitiesUrl, Id, Format);
}
}
}