#region Disclaimer / License
// Copyright (C) 2010, Jackie Ng
// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie@gmail.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OSGeo.MapGuide.MaestroAPI.CoordinateSystem
{
///
/// Base coordinate system catalog class
///
public abstract class CoordinateSystemCatalog : ICoordinateSystemCatalog
{
///
/// Gets an array of all coordinate systems in this catalog
///
///
public virtual CoordinateSystemDefinitionBase[] Coordsys
{
get
{
List items = new List();
foreach (CoordinateSystemCategory cat in this.Categories)
{
foreach (CoordinateSystemDefinitionBase coord in cat.Items)
{
items.Add(coord);
}
}
return items.ToArray();
}
}
///
/// Gets the coordinate system that matches the specified code
///
///
///
public virtual CoordinateSystemDefinitionBase FindCoordSys(string coordcode)
{
try
{
foreach (CoordinateSystemCategory cat in this.Categories)
{
foreach (CoordinateSystemDefinitionBase coord in cat.Items)
{
if (coord.Code == coordcode)
return coord;
}
}
}
catch
{
}
return null;
}
///
/// Gets an empty coordinate system
///
///
public abstract CoordinateSystemDefinitionBase CreateEmptyCoordinateSystem();
///
/// Gets an array of coordinate system categories
///
///
public abstract CoordinateSystemCategory[] Categories { get; }
///
/// Gets the name of the coordinate system library
///
///
public abstract string LibraryName { get; }
///
/// Convers the specified coordinate system code to WKT
///
///
///
public abstract string ConvertCoordinateSystemCodeToWkt(string coordcode);
///
/// Converts the specified epsg code to WKT
///
///
///
public abstract string ConvertEpsgCodeToWkt(string epsg);
///
/// Converts the specified WKT into a coordinate system code
///
///
///
public abstract string ConvertWktToCoordinateSystemCode(string wkt);
///
/// Converts the specified WKT into an EPSG code
///
///
///
public abstract string ConvertWktToEpsgCode(string wkt);
///
/// Gets an array of all coordinate systems in the specified category
///
///
///
public abstract CoordinateSystemDefinitionBase[] EnumerateCoordinateSystems(string category);
///
/// Checks if the specified WKT is valid
///
///
///
public abstract bool IsValid(string wkt);
///
/// Gets whether the coordinate system catalog has been loaded
///
///
public abstract bool IsLoaded { get; }
///
/// Creates a simple coordinate system transformation from the source and target WKT strings
///
///
///
///
public virtual ISimpleTransform CreateTransform(string sourceWkt, string targetWkt)
{
return new DefaultSimpleTransform(sourceWkt, targetWkt);
}
}
}