├── .travis.yml ├── geoapi.snk ├── .nuget ├── NuGet.exe ├── NuGet.Config └── NuGet.targets ├── GeoAPI ├── CoordinateSystems │ ├── IInfo.cs │ ├── WGS84ConversionInfo.cs │ ├── Transformations │ │ ├── ICoordinateTransformation.cs │ │ ├── TransformType.cs │ │ ├── ICoordinateTransformationFactory.cs │ │ ├── DomainFlags.cs │ │ └── IMathTransformFactory.cs │ ├── IVerticalDatum.cs │ ├── IUnit.cs │ ├── IGeodeticSpatialReference.cs │ ├── IAngularUnit.cs │ ├── ILinearUnit.cs │ ├── IHorizontalCoordinateSystem.cs │ ├── ILocalDatum.cs │ ├── IVerticalCoordinateSystem.cs │ ├── IHorizontalDatum.cs │ ├── IPrimeMeridian.cs │ ├── ICompoundCoordinateSystem.cs │ ├── IGeocentricCoordinateSystem.cs │ ├── IGeographicCoordinateSystem.cs │ ├── Parameter.cs │ ├── IFittedCoordinateSystem.cs │ ├── ILocalCoordinateSystem.cs │ ├── IDatum.cs │ ├── IEllipsoid.cs │ ├── IParameterInfo.cs │ ├── IProjectedCoordinateSystem.cs │ ├── AxisOrientationEnum.cs │ ├── IProjection.cs │ ├── IGeographicTransform.cs │ ├── AxisInfo.cs │ ├── ICoordinateSystem.cs │ ├── ProjectionParameter.cs │ ├── DatumType.cs │ └── ICoordinateSystemAuthorityFactory.cs ├── Geometries │ ├── IMultiSurface.cs │ ├── IMultiPolygon.cs │ ├── IMultiPoint.cs │ ├── ISurface.cs │ ├── IMultiCurve.cs │ ├── ILineString.cs │ ├── IMultiLineString.cs │ ├── ILinearRing.cs │ ├── IPoint.cs │ ├── IGeometryCollection.cs │ ├── IPuntal.cs │ ├── IPolygonal.cs │ ├── ILineal.cs │ ├── IPolygon.cs │ ├── IIntersectable.cs │ ├── IGeometryFilter.cs │ ├── IExpandable.cs │ ├── IBoundable.cs │ ├── ICurve.cs │ ├── ICoordinateFilter.cs │ ├── IGeometryComponentFilter.cs │ ├── Location.cs │ ├── ICoordinate.cs │ ├── OridinatesUtility.cs │ ├── IPrecisionModel.cs │ ├── ICoordinateSequenceFactory.cs │ ├── ICoordinateBuffer.cs │ ├── ICoordinateSequenceFilter.cs │ ├── Ordinate.cs │ ├── Dimension.cs │ ├── OgcGeometryType.cs │ ├── Ordinates.cs │ ├── Prepared │ │ └── IPreparedGeometry.cs │ └── ICoordinateSequence.cs ├── IO │ ├── ByteOrder.cs │ ├── ParseException.cs │ ├── IGeometryReader.cs │ ├── IGeometryWriter.cs │ └── GeometryType.cs ├── Operation │ └── Buffer │ │ ├── JoinStyle.cs │ │ ├── EndCapStyle.cs │ │ ├── BufferStyle.cs │ │ └── IBufferParameters.cs ├── Properties │ └── AssemblyInfo.cs ├── License.txt ├── GeometryServiceProvider.cs ├── ICoordinateSystemServices.cs ├── IGeometryServices.cs └── GeoAPI.csproj ├── README.md ├── GeoAPI.Pcl ├── Properties │ └── AssemblyInfo.cs └── BitConverterEx.cs ├── GeoAPI.sln ├── .gitignore └── TeamCity.targets /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: GeoAPI.sln 3 | -------------------------------------------------------------------------------- /geoapi.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DotSpatial/GeoAPI/HEAD/geoapi.snk -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DotSpatial/GeoAPI/HEAD/.nuget/NuGet.exe -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DotSpatial/GeoAPI/HEAD/GeoAPI/CoordinateSystems/IInfo.cs -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/WGS84ConversionInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DotSpatial/GeoAPI/HEAD/GeoAPI/CoordinateSystems/WGS84ConversionInfo.cs -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/Transformations/ICoordinateTransformation.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DotSpatial/GeoAPI/HEAD/GeoAPI/CoordinateSystems/Transformations/ICoordinateTransformation.cs -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IMultiSurface.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | namespace GeoAPI.Geometries 3 | { 4 | public interface IMultiSurface : IGeometryCollection 5 | { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IMultiPolygon.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | namespace GeoAPI.Geometries 3 | { 4 | public interface IMultiPolygon : IMultiSurface, IPolygonal 5 | { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IMultiPoint.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | public interface IMultiPoint : IGeometryCollection, IPuntal 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Travis](https://travis-ci.org/DotSpatial/GeoAPI.svg?branch=master)](https://travis-ci.org/DotSpatial/GeoAPI) 2 | 3 | # DotSpatial GeoAPI 4 | This is custom build of GeoAPI.NET for DotSpatial project. 5 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/ISurface.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Interface for surfaces 5 | /// 6 | public interface ISurface : IGeometry 7 | { } 8 | } 9 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IMultiCurve.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | namespace GeoAPI.Geometries 3 | { 4 | public interface IMultiCurve : IGeometryCollection 5 | { 6 | bool IsClosed { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/ILineString.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | public interface ILineString : ICurve, ILineal 6 | { 7 | IPoint GetPointN(int n); 8 | 9 | Coordinate GetCoordinateN(int n); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IMultiLineString.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | using System; 3 | 4 | namespace GeoAPI.Geometries 5 | { 6 | public interface IMultiLineString : IMultiCurve, ILineal 7 | { 8 | [Obsolete("Use IGeometry.Reverse()")] 9 | new IMultiLineString Reverse(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/ILinearRing.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | namespace GeoAPI.Geometries 3 | { 4 | public interface ILinearRing : ILineString 5 | { 6 | /// 7 | /// Gets a value indicating whether this ring is oriented counter-clockwise. 8 | /// 9 | bool IsCCW { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /GeoAPI/IO/ByteOrder.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.IO 2 | { 3 | /// 4 | /// Byte order 5 | /// 6 | public enum ByteOrder : byte 7 | { 8 | /// 9 | /// BigEndian 10 | /// 11 | BigEndian = 0x00, 12 | 13 | /// 14 | /// LittleEndian 15 | /// 16 | LittleEndian = 0x01, 17 | } 18 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/IPoint.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | namespace GeoAPI.Geometries 3 | { 4 | public interface IPoint : IGeometry, IPuntal 5 | { 6 | double X { get; set; } 7 | 8 | double Y { get; set; } 9 | 10 | double Z { get; set; } 11 | 12 | double M { get; set; } 13 | 14 | ICoordinateSequence CoordinateSequence { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IGeometryCollection.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | using System.Collections.Generic; 3 | 4 | namespace GeoAPI.Geometries 5 | { 6 | public interface IGeometryCollection : IGeometry, IEnumerable 7 | { 8 | int Count { get; } 9 | 10 | IGeometry[] Geometries { get; } 11 | 12 | IGeometry this[int i] { get; } 13 | 14 | bool IsHomogeneous { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IPuntal.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Interface to identify all IGeometry subclasses that have a Dimension of 5 | /// and have components that ar s. 6 | /// 7 | /// Martin Davis 8 | /// 9 | /// 10 | public interface IPuntal 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/IPolygonal.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Interface to identify all IGeometry subclasses that have a Dimension of 5 | /// and have components that are s. 6 | /// 7 | /// Martin Davis 8 | /// 9 | /// 10 | public interface IPolygonal 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/ILineal.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Interface to identify all IGeometry subclasses that have a Dimension of 5 | /// and have components which are s. 6 | /// 7 | /// Martin Davis 8 | /// 9 | /// 10 | public interface ILineal 11 | { 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/IPolygon.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | public interface IPolygon : ISurface, IPolygonal 6 | { 7 | ILineString ExteriorRing { get; } 8 | 9 | ILinearRing Shell { get; } 10 | 11 | int NumInteriorRings { get; } 12 | 13 | ILineString[] InteriorRings { get; } 14 | 15 | ILineString GetInteriorRingN(int n); 16 | 17 | ILinearRing[] Holes { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /GeoAPI/Operation/Buffer/JoinStyle.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Operation.Buffer 2 | { 3 | /// 4 | /// Join style constants 5 | /// 6 | public enum JoinStyle 7 | { 8 | /// 9 | /// Specifies a round join style. 10 | /// 11 | Round = 1, 12 | 13 | /// 14 | /// Specifies a mitre join style. 15 | /// 16 | Mitre = 2, 17 | 18 | /// 19 | /// Specifies a bevel join style. 20 | /// 21 | Bevel = 3 22 | } 23 | } -------------------------------------------------------------------------------- /GeoAPI/Operation/Buffer/EndCapStyle.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Operation.Buffer 2 | { 3 | /// 4 | /// End cap style constants 5 | /// 6 | public enum EndCapStyle 7 | { 8 | /// 9 | /// Specifies a round line buffer end cap style. 10 | /// 11 | Round = 1, 12 | 13 | /// 14 | /// Specifies a flat line buffer end cap style. 15 | /// 16 | Flat = 2, 17 | 18 | /// 19 | /// Specifies a square line buffer end cap style. 20 | /// 21 | Square = 3 22 | } 23 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/IIntersectable.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Interface describing objects that can perform an intersects predicate with objects. 5 | /// 6 | /// The type of the component that can intersect 7 | public interface IIntersectable 8 | { 9 | /// 10 | /// Predicate function to test if intersects with this object. 11 | /// 12 | /// The object to test 13 | /// true if this objects intersects with 14 | bool Intersects(T other); 15 | } 16 | } -------------------------------------------------------------------------------- /GeoAPI/Operation/Buffer/BufferStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI.Operation.Buffer 4 | { 5 | /// 6 | /// Buffer style. 7 | /// 8 | [Obsolete("Use EndCapStyle instead.")] 9 | public enum BufferStyle 10 | { 11 | /// 12 | /// Specifies a round line buffer end cap endCapStyle (Default). 13 | /// / 14 | CapRound = 1, 15 | 16 | /// 17 | /// Specifies a butt (or flat) line buffer end cap endCapStyle. 18 | /// 19 | CapButt = 2, 20 | 21 | /// 22 | /// Specifies a square line buffer end cap endCapStyle. 23 | /// 24 | CapSquare = 3, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GeoAPI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("GeoAPI")] 6 | [assembly: AssemblyDescription("GeoAPI Version that matches NTS v.1.14")] 7 | #if DEBUG 8 | [assembly: AssemblyConfiguration("Debug")] 9 | #else 10 | [assembly: AssemblyConfiguration("Stable")] 11 | #endif 12 | [assembly: AssemblyCompany("NetTopologySuite - Team")] 13 | [assembly: AssemblyProduct("GeoAPI")] 14 | [assembly: AssemblyCopyright("Copyright © 2007-2015")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | #if !PCL 18 | [assembly: ComVisible(false)] 19 | [assembly: Guid("b6726fc4-0319-4a6d-84f5-aafc6ba530e3")] 20 | #endif 21 | [assembly: AssemblyVersion("1.7.4")] 22 | //[assembly: AssemblyFileVersion"1.5.0.0")] 23 | [assembly: CLSCompliant(true)] -------------------------------------------------------------------------------- /GeoAPI/Geometries/IGeometryFilter.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// GeometryCollection classes support the concept of 5 | /// applying a IGeometryFilter to the Geometry. 6 | /// The filter is applied to every element Geometry. 7 | /// A IGeometryFilter can either record information about the Geometry 8 | /// or change the Geometry in some way. 9 | /// IGeometryFilter is an example of the Gang-of-Four Visitor pattern. 10 | /// 11 | public interface IGeometryFilter 12 | { 13 | /// 14 | /// Performs an operation with or on geom. 15 | /// 16 | /// A Geometry to which the filter is applied. 17 | void Filter(IGeometry geom); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IExpandable.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Interface describing objects that can expand themselves by objects of type . 5 | /// 6 | /// The type of objects that can expand clients 7 | public interface IExpandable 8 | { 9 | /// 10 | /// Method to expand this object by 11 | /// 12 | /// The object to expand with 13 | void ExpandToInclude(T other); 14 | 15 | /// 16 | /// Function to expand compute a new object that is this object by expanded by . 17 | /// 18 | /// The object to expand with 19 | /// The expanded object 20 | T ExpandedBy(T other); 21 | } 22 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/IBoundable.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// A spatial object in an AbstractSTRtree. 5 | /// 6 | public interface IBoundable //: IIntersectable, IExpandable 7 | where T: IIntersectable, IExpandable 8 | { 9 | /// 10 | /// Returns a representation of space that encloses this Boundable, preferably 11 | /// not much bigger than this Boundable's boundary yet fast to test for intersection 12 | /// with the bounds of other Boundables. The class of object returned depends 13 | /// on the subclass of AbstractSTRtree. 14 | /// 15 | /// 16 | /// An Envelope (for STRtrees), an Interval (for SIRtrees), or other object 17 | /// (for other subclasses of AbstractSTRtree). 18 | /// 19 | T Bounds { get; } 20 | 21 | /// 22 | /// Gets the item that is bounded 23 | /// 24 | TItem Item { get; } 25 | } 26 | } -------------------------------------------------------------------------------- /GeoAPI/License.txt: -------------------------------------------------------------------------------- 1 | GeoAPI is a set of .NET contracts and classes written in C# that 2 | define the fundamental operations required to validate a given 3 | geo-spatial data set to a known topological specification. 4 | 5 | Copyright (C) 2005-2014 NetTopologySuite team 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this library; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | 21 | For more information, please visit: https://github.com/NetTopologySuite/GeoAPI -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IVerticalDatum.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// Procedure used to measure vertical distances. 22 | /// 23 | public interface IVerticalDatum : IDatum { } 24 | } 25 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IUnit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IUnit interface abstracts different kinds of units, it has no methods. 22 | /// 23 | public interface IUnit : IInfo { } 24 | } 25 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/ICurve.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Interface for a curve 5 | /// 6 | public interface ICurve : IGeometry 7 | { 8 | /// 9 | /// Gets a value indicating the sequence of coordinates that make up curve 10 | /// 11 | ICoordinateSequence CoordinateSequence { get; } 12 | 13 | /// 14 | /// Gets a value indicating the start point of the curve 15 | /// 16 | IPoint StartPoint { get; } 17 | 18 | /// 19 | /// Gets a value indicating the end point of the curve 20 | /// 21 | IPoint EndPoint { get; } 22 | 23 | /// 24 | /// Gets a value indicating that the curve is closed. 25 | /// In this case an are equal. 26 | /// 27 | bool IsClosed { get; } 28 | 29 | /// 30 | /// Gets a value indicating that the curve is a ring. 31 | /// 32 | bool IsRing { get; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /GeoAPI.Pcl/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // Allgemeine Informationen über eine Assembly werden über folgende 7 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 8 | // die einer Assembly zugeordnet sind. 9 | [assembly: AssemblyTitle("GeoAPI.Pcl")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("GeoAPI.Pcl")] 14 | [assembly: AssemblyCopyright("Copyright © 2013")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: NeutralResourcesLanguage("de")] 18 | 19 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 20 | // 21 | // Hauptversion 22 | // Nebenversion 23 | // Buildnummer 24 | // Revision 25 | // 26 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 27 | // durch Einsatz von '*', wie in nachfolgendem Beispiel: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IGeodeticSpatialReference.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IGeodeticSpatialReference interface defines a root interface for all types of geodetic 22 | /// spatial references, it is a subclass of ICoordinateSystem. 23 | /// 24 | public interface IGeodeticSpatialReference : ICoordinateSystem { } 25 | } 26 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IAngularUnit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IAngularUnit interface defines methods on angular units. 22 | /// 23 | public interface IAngularUnit : IUnit 24 | { 25 | /// 26 | /// Gets or sets the number of radians per angular unit. 27 | /// 28 | double RadiansPerUnit { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/ILinearUnit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The ILinearUnit interface defines methods on linear units. 22 | /// 23 | public interface ILinearUnit : IUnit 24 | { 25 | /// 26 | /// Gets or sets the number of meters per . 27 | /// 28 | double MetersPerUnit { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IHorizontalCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// A 2D coordinate system suitable for positions on the Earth's surface. 22 | /// 23 | public interface IHorizontalCoordinateSystem : ICoordinateSystem 24 | { 25 | /// 26 | /// Returns the HorizontalDatum. 27 | /// 28 | IHorizontalDatum HorizontalDatum { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/ILocalDatum.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// Local datum. If two local datum objects have the same datum type and name, 22 | /// then they can be considered equal. This means that coordinates can be 23 | /// transformed between two different local coordinate systems, as long as 24 | /// they are based on the same local datum. 25 | /// 26 | public interface ILocalDatum : IDatum { } 27 | } 28 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/ICoordinateFilter.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// An interface for classes which use the values of the coordinates in a . 5 | /// Coordinate filters can be used to implement centroid and 6 | /// envelope computation, and many other functions. 7 | /// ICoordinateFilter is 8 | /// an example of the Gang-of-Four Visitor pattern. 9 | /// 10 | /// Note: it is not recommended to use these filters to mutate the coordinates. 11 | /// There is no guarantee that the coordinate is the actual object stored in the geometry. 12 | /// In particular, modified values may not be preserved if the target Geometry uses a non-default . 13 | /// If in-place mutation is required, use . 14 | /// 15 | /// 16 | /// 17 | public interface ICoordinateFilter 18 | { 19 | /// 20 | /// Performs an operation with or on coord. 21 | /// 22 | /// Coordinate to which the filter is applied. 23 | void Filter(Coordinate coord); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/IGeometryComponentFilter.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Geometry classes support the concept of applying 5 | /// an IGeometryComponentFilter filter to the Geometry. 6 | /// 7 | /// 8 | /// The filter is applied to every component of the Geometry 9 | /// which is itself a Geometry 10 | /// and which does not itself contain any components. 11 | /// (For instance, all the LinearRings in Polygons are visited, 12 | /// but in a MultiPolygon the Polygons themselves are not visited.) 13 | /// Thus the only classes of Geometry which must be 14 | /// handled as arguments to 15 | /// are s, s and s. 16 | /// An IGeometryComponentFilter filter can either 17 | /// record information about the Geometry 18 | /// or change the Geometry in some way. 19 | /// IGeometryComponentFilter is an example of the Gang-of-Four Visitor pattern. 20 | /// > 21 | public interface IGeometryComponentFilter 22 | { 23 | /// 24 | /// Performs an operation with or on geom. 25 | /// 26 | /// A Geometry to which the filter is applied. 27 | void Filter(IGeometry geom); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GeoAPI/IO/ParseException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if PCL 3 | using ApplicationException = System.Exception; 4 | #endif 5 | 6 | namespace GeoAPI.IO 7 | { 8 | /// 9 | /// Thrown by a WKTReader when a parsing problem occurs. 10 | /// 11 | public class ParseException : ApplicationException 12 | { 13 | /// 14 | /// Creates a ParseException with the given detail message. 15 | /// 16 | /// A description of this ParseException. 17 | public ParseException(String message) : base(message) { } 18 | 19 | /// 20 | /// Creates a ParseException with es detail message. 21 | /// 22 | /// An exception that occurred while a WKTReader was 23 | /// parsing a Well-known Text string. 24 | public ParseException(Exception e) : this(e.ToString(), e) { } 25 | 26 | /// 27 | /// Creates a ParseException with s detail message 28 | /// 29 | /// 30 | /// The inner exception 31 | public ParseException(String message, Exception innerException) 32 | : base(message, innerException) 33 | { 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IVerticalCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// A one-dimensional coordinate system suitable for vertical measurements. 22 | /// 23 | public interface IVerticalCoordinateSystem : ICoordinateSystem 24 | { 25 | /// 26 | /// Gets the vertical datum, which indicates the measurement method 27 | /// 28 | IVerticalDatum VerticalDatum { get; set; } 29 | 30 | /// 31 | /// Gets the units used along the vertical axis. 32 | /// 33 | ILinearUnit VerticalUnit { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IHorizontalDatum.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// Procedure used to measure positions on the surface of the Earth. 22 | /// 23 | public interface IHorizontalDatum : IDatum 24 | { 25 | /// 26 | /// Gets or sets the ellipsoid of the datum. 27 | /// 28 | IEllipsoid Ellipsoid { get; set; } 29 | 30 | /// 31 | /// Gets preferred parameters for a Bursa Wolf transformation into WGS84. The 7 returned values 32 | /// correspond to (dx,dy,dz) in meters, (ex,ey,ez) in arc-seconds, and scaling in parts-per-million. 33 | /// 34 | Wgs84ConversionInfo Wgs84Parameters { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IPrimeMeridian.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IPrimeMeridian interface defines the standard information stored with prime 22 | /// meridian objects. Any prime meridian object must implement this interface as 23 | /// well as the ISpatialReferenceInfo interface. 24 | /// 25 | public interface IPrimeMeridian : IInfo 26 | { 27 | /// 28 | /// Gets or sets the longitude of the prime meridian (relative to the Greenwich prime meridian). 29 | /// 30 | double Longitude { get; set; } 31 | 32 | /// 33 | /// Gets or sets the AngularUnits. 34 | /// 35 | IAngularUnit AngularUnit { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /GeoAPI.Pcl/BitConverterEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI 4 | { 5 | /// 6 | /// A framework replacement for the System.BitConverter class 7 | /// 8 | /// Only partial functionality is provided! 9 | internal static class BitConverterEx 10 | { 11 | /// 12 | /// Function to convert the bits of a double to a the bits of a long 13 | /// 14 | /// The double value 15 | /// The long value 16 | public static Int64 DoubleToInt64Bits(double self) 17 | { 18 | var tmp = BitConverter.GetBytes(self); 19 | return BitConverter.ToInt64(tmp, 0); 20 | } 21 | 22 | /// 23 | /// Function to convert the bits of a long to a the bits of a double 24 | /// 25 | /// The long value 26 | /// The double value 27 | public static Double Int64BitsToDouble(Int64 self) 28 | { 29 | var tmp = BitConverter.GetBytes(self); 30 | return BitConverter.ToDouble(tmp, 0); 31 | } 32 | } 33 | 34 | /// 35 | /// A framework replacement for the System.ICloneable interface. 36 | /// 37 | public interface ICloneable 38 | { 39 | /// 40 | /// Function to create a new object that is a (deep) copy of the current instance. 41 | /// 42 | /// A new object that is a copy of this instance. 43 | object Clone(); 44 | } 45 | } -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/ICompoundCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// An aggregate of two coordinate systems (CRS). One of these is usually a 22 | /// CRS based on a two dimensional coordinate system such as a geographic or 23 | /// a projected coordinate system with a horizontal datum. The other is a 24 | /// vertical CRS which is a one-dimensional coordinate system with a vertical 25 | /// datum. 26 | /// 27 | public interface ICompoundCoordinateSystem : ICoordinateSystem 28 | { 29 | /// 30 | /// Gets first sub-coordinate system. 31 | /// 32 | ICoordinateSystem HeadCS { get; } 33 | 34 | /// 35 | /// Gets second sub-coordinate system. 36 | /// 37 | ICoordinateSystem TailCS { get; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/Transformations/TransformType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems.Transformations 19 | { 20 | /// 21 | /// Semantic type of transform used in coordinate transformation. 22 | /// 23 | public enum TransformType : int 24 | { 25 | /// 26 | /// Unknown or unspecified type of transform. 27 | /// 28 | Other = 0, 29 | 30 | /// 31 | /// Transform depends only on defined parameters. For example, a cartographic projection. 32 | /// 33 | Conversion = 1, 34 | 35 | /// 36 | /// Transform depends only on empirically derived parameters. For example a datum transformation. 37 | /// 38 | Transformation = 2, 39 | 40 | /// 41 | /// Transform depends on both defined and empirical parameters. 42 | /// 43 | ConversionAndTransformation = 3 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GeoAPI.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoAPI", "GeoAPI\GeoAPI.csproj", "{FFB69466-79DE-466A-ADA7-5C47C5C5CA3A}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoAPI.Pcl", "GeoAPI.Pcl\GeoAPI.Pcl.csproj", "{92B3B84B-50F1-4147-8B97-D93B90FA5514}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{D0DCE6F6-83C2-4214-8E8A-847D02A4461A}" 9 | ProjectSection(SolutionItems) = preProject 10 | GeoAPI.nuspec = GeoAPI.nuspec 11 | TeamCity.targets = TeamCity.targets 12 | EndProjectSection 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {FFB69466-79DE-466A-ADA7-5C47C5C5CA3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {FFB69466-79DE-466A-ADA7-5C47C5C5CA3A}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {FFB69466-79DE-466A-ADA7-5C47C5C5CA3A}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {FFB69466-79DE-466A-ADA7-5C47C5C5CA3A}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {92B3B84B-50F1-4147-8B97-D93B90FA5514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {92B3B84B-50F1-4147-8B97-D93B90FA5514}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {92B3B84B-50F1-4147-8B97-D93B90FA5514}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {92B3B84B-50F1-4147-8B97-D93B90FA5514}.Release|Any CPU.Build.0 = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IGeocentricCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// A 3D coordinate system, with its origin at the center of the Earth. 22 | /// 23 | public interface IGeocentricCoordinateSystem : ICoordinateSystem 24 | { 25 | /// 26 | /// Returns the HorizontalDatum. The horizontal datum is used to determine where 27 | /// the centre of the Earth is considered to be. All coordinate points will be 28 | /// measured from the centre of the Earth, and not the surface. 29 | /// 30 | IHorizontalDatum HorizontalDatum { get; set; } 31 | 32 | /// 33 | /// Gets the units used along all the axes. 34 | /// 35 | ILinearUnit LinearUnit { get; set; } 36 | 37 | /// 38 | /// Returns the PrimeMeridian. 39 | /// 40 | IPrimeMeridian PrimeMeridian { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/Transformations/ICoordinateTransformationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems.Transformations 19 | { 20 | /// 21 | /// Creates coordinate transformations. 22 | /// 23 | public interface ICoordinateTransformationFactory 24 | { 25 | /// 26 | /// Creates a transformation between two coordinate systems. 27 | /// 28 | /// 29 | /// This method will examine the coordinate systems in order to construct 30 | /// a transformation between them. This method may fail if no path between 31 | /// the coordinate systems is found, using the normal failing behavior of 32 | /// the DCP (e.g. throwing an exception). 33 | /// Source coordinate system 34 | /// Target coordinate system 35 | /// 36 | ICoordinateTransformation CreateFromCoordinateSystems(ICoordinateSystem sourceCS, ICoordinateSystem targetCS); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IGeographicCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IGeographicCoordinateSystem interface is a subclass of IGeodeticSpatialReference and 22 | /// defines the standard information stored with geographic coordinate system objects. 23 | /// 24 | public interface IGeographicCoordinateSystem : IHorizontalCoordinateSystem 25 | { 26 | /// 27 | /// Gets or sets the angular units of the geographic coordinate system. 28 | /// 29 | IAngularUnit AngularUnit { get; set; } 30 | 31 | /// 32 | /// Gets or sets the prime meridian of the geographic coordinate system. 33 | /// 34 | IPrimeMeridian PrimeMeridian { get; set; } 35 | 36 | /// 37 | /// Gets the number of available conversions to WGS84 coordinates. 38 | /// 39 | int NumConversionToWGS84 { get; } 40 | 41 | /// 42 | /// Gets details on a conversion to WGS84. 43 | /// 44 | Wgs84ConversionInfo GetWgs84ConversionInfo(int index); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/Parameter.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | using System; 19 | 20 | namespace GeoAPI.CoordinateSystems 21 | { 22 | /// 23 | /// A named parameter value. 24 | /// 25 | #if !PCL 26 | [Serializable] 27 | #endif 28 | public class Parameter 29 | { 30 | /// 31 | /// Creates an instance of a parameter 32 | /// 33 | /// Units are always either meters or degrees. 34 | /// Name of parameter 35 | /// Value 36 | public Parameter(string name, double value) 37 | { 38 | _Name = name; 39 | _Value = value; 40 | } 41 | 42 | private string _Name; 43 | 44 | /// 45 | /// Parameter name 46 | /// 47 | public string Name 48 | { 49 | get { return _Name; } 50 | set { _Name = value; } 51 | } 52 | 53 | private double _Value; 54 | 55 | /// 56 | /// Parameter value 57 | /// 58 | public double Value 59 | { 60 | get { return _Value; } 61 | set { _Value = value; } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IFittedCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// A coordinate system which sits inside another coordinate system. The fitted 22 | /// coordinate system can be rotated and shifted, or use any other math transform 23 | /// to inject itself into the base coordinate system. 24 | /// 25 | public interface IFittedCoordinateSystem : ICoordinateSystem 26 | { 27 | /// 28 | /// Gets underlying coordinate system. 29 | /// 30 | ICoordinateSystem BaseCoordinateSystem { get; } 31 | 32 | /// 33 | /// Gets Well-Known Text of a math transform to the base coordinate system. 34 | /// The dimension of this fitted coordinate system is determined by the source 35 | /// dimension of the math transform. The transform should be one-to-one within 36 | /// this coordinate system's domain, and the base coordinate system dimension 37 | /// must be at least as big as the dimension of this coordinate system. 38 | /// 39 | /// 40 | string ToBase(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/ILocalCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// A local coordinate system, with uncertain relationship to the world. 22 | /// 23 | /// In general, a local coordinate system cannot be related to other coordinate 24 | /// systems. However, if two objects supporting this interface have the same dimension, 25 | /// axes, units and datum then client code is permitted to assume that the two coordinate 26 | /// systems are identical. This allows several datasets from a common source (e.g. a CAD 27 | /// system) to be overlaid. In addition, some implementations of the Coordinate 28 | /// Transformation (CT) package may have a mechanism for correlating local datums. (E.g. 29 | /// from a database of transformations, which is created and maintained from real-world 30 | /// measurements.) 31 | /// 32 | public interface ILocalCoordinateSystem : ICoordinateSystem 33 | { 34 | /// 35 | /// Gets or sets the local datum 36 | /// 37 | ILocalDatum LocalDatum { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IDatum.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// A set of quantities from which other quantities are calculated. 22 | /// 23 | /// 24 | /// For the OGC abstract model, it can be defined as a set of real points on the earth 25 | /// that have coordinates. EG. A datum can be thought of as a set of parameters 26 | /// defining completely the origin and orientation of a coordinate system with respect 27 | /// to the earth. A textual description and/or a set of parameters describing the 28 | /// relationship of a coordinate system to some predefined physical locations (such 29 | /// as center of mass) and physical directions (such as axis of spin). The definition 30 | /// of the datum may also include the temporal behavior (such as the rate of change of 31 | /// the orientation of the coordinate axes). 32 | /// 33 | public interface IDatum : IInfo 34 | { 35 | /// 36 | /// Gets or sets the type of the datum as an enumerated code. 37 | /// 38 | DatumType DatumType { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IEllipsoid.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IEllipsoid interface defines the standard information stored with ellipsoid objects. 22 | /// 23 | public interface IEllipsoid : IInfo 24 | { 25 | /// 26 | /// Gets or sets the value of the semi-major axis. 27 | /// 28 | double SemiMajorAxis { get; set; } 29 | 30 | /// 31 | /// Gets or sets the value of the semi-minor axis. 32 | /// 33 | double SemiMinorAxis { get; set; } 34 | 35 | /// 36 | /// Gets or sets the value of the inverse of the flattening constant of the ellipsoid. 37 | /// 38 | double InverseFlattening { get; set; } 39 | 40 | /// 41 | /// Gets or sets the value of the axis unit. 42 | /// 43 | ILinearUnit AxisUnit { get; set; } 44 | 45 | /// 46 | /// Is the Inverse Flattening definitive for this ellipsoid? Some ellipsoids use the 47 | /// IVF as the defining value, and calculate the polar radius whenever asked. Other 48 | /// ellipsoids use the polar radius to calculate the IVF whenever asked. This 49 | /// distinction can be important to avoid floating-point rounding errors. 50 | /// 51 | bool IsIvfDefinitive { get; set; } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IParameterInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | using System.Collections.Generic; 19 | 20 | namespace GeoAPI.CoordinateSystems 21 | { 22 | /// 23 | /// The IParameterInfo interface provides an interface through which clients of a 24 | /// Projected Coordinate System or of a Projection can set the parameters of the 25 | /// projection. It provides a generic interface for discovering the names and default 26 | /// values of parameters, and for setting and getting parameter values. Subclasses of 27 | /// this interface may provide projection specific parameter access methods. 28 | /// 29 | public interface IParameterInfo 30 | { 31 | /// 32 | /// Gets the number of parameters expected. 33 | /// 34 | int NumParameters { get; } 35 | 36 | /// 37 | /// Returns the default parameters for this projection. 38 | /// 39 | /// 40 | Parameter[] DefaultParameters(); 41 | 42 | /// 43 | /// Gets or sets the parameters set for this projection. 44 | /// 45 | List Parameters { get; set; } 46 | 47 | /// 48 | /// Gets the parameter by its name 49 | /// 50 | /// 51 | /// 52 | Parameter GetParameterByName(string name); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/Transformations/DomainFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems.Transformations 19 | { 20 | /// 21 | /// Flags indicating parts of domain covered by a convex hull. 22 | /// 23 | /// 24 | /// These flags can be combined. For example, the value 3 25 | /// corresponds to a combination of and , 26 | /// which means that some parts of the convex hull are inside the 27 | /// domain, and some parts of the convex hull are outside the domain. 28 | /// 29 | public enum DomainFlags : int 30 | { 31 | /// 32 | /// At least one point in a convex hull is inside the transform's domain. 33 | /// 34 | Inside = 1, 35 | 36 | /// 37 | /// At least one point in a convex hull is outside the transform's domain. 38 | /// 39 | Outside = 2, 40 | 41 | /// 42 | /// At least one point in a convex hull is not transformed continuously. 43 | /// 44 | /// 45 | /// As an example, consider a "Longitude_Rotation" transform which adjusts 46 | /// longitude coordinates to take account of a change in Prime Meridian. If 47 | /// the rotation is 5 degrees east, then the point (Lat=175,Lon=0) is not 48 | /// transformed continuously, since it is on the meridian line which will 49 | /// be split at +180/-180 degrees. 50 | /// 51 | Discontinuous = 4 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IProjectedCoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IProjectedCoordinateSystem interface defines the standard information stored with 22 | /// projected coordinate system objects. A projected coordinate system is defined using a 23 | /// geographic coordinate system object and a projection object that defines the 24 | /// coordinate transformation from the geographic coordinate system to the projected 25 | /// coordinate systems. The instances of a single ProjectedCoordinateSystem COM class can 26 | /// be used to model different projected coordinate systems (e.g., UTM Zone 10, Albers) 27 | /// by associating the ProjectedCoordinateSystem instances with Projection instances 28 | /// belonging to different Projection COM classes (Transverse Mercator and Albers, 29 | /// respectively). 30 | /// 31 | public interface IProjectedCoordinateSystem : IHorizontalCoordinateSystem 32 | { 33 | /// 34 | /// Gets or sets the geographic coordinate system associated with the projected 35 | /// coordinate system. 36 | /// 37 | IGeographicCoordinateSystem GeographicCoordinateSystem { get; set; } 38 | 39 | /// 40 | /// Gets or sets the linear (projected) units of the projected coordinate system. 41 | /// 42 | ILinearUnit LinearUnit { get; set; } 43 | 44 | /// 45 | /// Gets or sets the projection for the projected coordinate system. 46 | /// 47 | IProjection Projection { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/AxisOrientationEnum.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// Orientation of axis. Some coordinate systems use non-standard orientations. 22 | /// For example, the first axis in South African grids usually points West, 23 | /// instead of East. This information is obviously relevant for algorithms 24 | /// converting South African grid coordinates into Lat/Long. 25 | /// 26 | public enum AxisOrientationEnum : short 27 | { 28 | /// 29 | /// Unknown or unspecified axis orientation. This can be used for local or fitted coordinate systems. 30 | /// 31 | Other = 0, 32 | 33 | /// 34 | /// Increasing ordinates values go North. This is usually used for Grid Y coordinates and Latitude. 35 | /// 36 | North = 1, 37 | 38 | /// 39 | /// Increasing ordinates values go South. This is rarely used. 40 | /// 41 | South = 2, 42 | 43 | /// 44 | /// Increasing ordinates values go East. This is rarely used. 45 | /// 46 | East = 3, 47 | 48 | /// 49 | /// Increasing ordinates values go West. This is usually used for Grid X coordinates and Longitude. 50 | /// 51 | West = 4, 52 | 53 | /// 54 | /// Increasing ordinates values go up. This is used for vertical coordinate systems. 55 | /// 56 | Up = 5, 57 | 58 | /// 59 | /// Increasing ordinates values go down. This is used for vertical coordinate systems. 60 | /// 61 | Down = 6 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IProjection.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// The IProjection interface defines the standard information stored with projection 22 | /// objects. A projection object implements a coordinate transformation from a geographic 23 | /// coordinate system to a projected coordinate system, given the ellipsoid for the 24 | /// geographic coordinate system. It is expected that each coordinate transformation of 25 | /// interest, e.g., Transverse Mercator, Lambert, will be implemented as a COM class of 26 | /// coType Projection, supporting the IProjection interface. 27 | /// 28 | public interface IProjection : IInfo 29 | { 30 | /// 31 | /// Gets number of parameters of the projection. 32 | /// 33 | int NumParameters { get; } 34 | 35 | /// 36 | /// Gets the projection classification name (e.g. 'Transverse_Mercator'). 37 | /// 38 | string ClassName { get; } 39 | 40 | /// 41 | /// Gets an indexed parameter of the projection. 42 | /// 43 | /// Index of parameter 44 | /// n'th parameter 45 | ProjectionParameter GetParameter(int index); 46 | 47 | /// 48 | /// Gets an named parameter of the projection. 49 | /// 50 | /// The parameter name is case insensitive 51 | /// Name of parameter 52 | /// parameter or null if not found 53 | ProjectionParameter GetParameter(string name); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/Location.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// The location of a relative to a 7 | /// 8 | public enum Location 9 | { 10 | /// 11 | /// DE-9IM row index of the interior of the first point and column index of 12 | /// the interior of the second point. Location value for the interior of a 13 | /// point. 14 | /// 15 | /// int value = 0; 16 | Interior = 0, 17 | 18 | /// 19 | /// DE-9IM row index of the boundary of the first point and column index of 20 | /// the boundary of the second point. Location value for the boundary of a 21 | /// point. 22 | /// 23 | /// int value = 1; 24 | Boundary = 1, 25 | 26 | /// 27 | /// DE-9IM row index of the exterior of the first point and column index of 28 | /// the exterior of the second point. Location value for the exterior of a 29 | /// point. 30 | /// 31 | /// int value = 2; 32 | Exterior = 2, 33 | 34 | /// 35 | /// Used for uninitialized location values. 36 | /// 37 | /// int value = 1; 38 | Null = -1, 39 | } 40 | 41 | /// 42 | /// Utility class for enumeration 43 | /// 44 | public class LocationUtility 45 | { 46 | /// 47 | /// Converts the location value to a location symbol, for example, EXTERIOR => 'e'. 48 | /// 49 | /// 50 | /// Either 'e', 'b', 'i' or '-'. 51 | public static char ToLocationSymbol(Location locationValue) 52 | { 53 | switch (locationValue) 54 | { 55 | case Location.Exterior: 56 | return 'e'; 57 | case Location.Boundary: 58 | return 'b'; 59 | case Location.Interior: 60 | return 'i'; 61 | case Location.Null: 62 | return '-'; 63 | } 64 | throw new ArgumentException("Unknown location value: " + locationValue); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /GeoAPI/IO/IGeometryReader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using GeoAPI.Geometries; 3 | 4 | namespace GeoAPI.IO 5 | { 6 | /// 7 | /// Interface for input/parsing of instances. 8 | /// 9 | /// The type of the source to read from. 10 | public interface IGeometryReader : IGeometryIOSettings 11 | { 12 | ///// 13 | ///// Gets or sets the geometry factory used to create the parsed geometries 14 | ///// 15 | //[Obsolete] 16 | //IGeometryFactory Factory { get; set; } 17 | 18 | /* 19 | /// 20 | /// Gets the coordinate sequence factory 21 | /// 22 | ICoordinateSequenceFactory CoordinateSequenceFactory { get; } 23 | 24 | /// 25 | /// Gets the precision model 26 | /// 27 | IPrecisionModel PrecisionModel { get; } 28 | */ 29 | 30 | /// 31 | /// Reads a geometry representation from a to a Geometry. 32 | /// 33 | /// 34 | /// The source to read the geometry from 35 | /// For WKT is string, 36 | /// for WKB is byte[], 37 | /// 38 | /// 39 | /// A Geometry 40 | /// 41 | IGeometry Read(TSource source); 42 | 43 | /// 44 | /// Reads a geometry representation from a to a Geometry. 45 | /// 46 | /// The stream to read from. 47 | /// A Geometry 48 | IGeometry Read(Stream stream); 49 | 50 | /// 51 | /// Gets or sets whether invalid linear rings should be fixed 52 | /// 53 | bool RepairRings { get; set; } 54 | 55 | } 56 | 57 | /// 58 | /// Interface for textual input of instances. 59 | /// 60 | public interface ITextGeometryReader : IGeometryReader 61 | { 62 | } 63 | 64 | /// 65 | /// Interface for binary input of instances. 66 | /// 67 | public interface IBinaryGeometryReader : IGeometryReader 68 | { 69 | } 70 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/ICoordinate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if PCL 3 | using ICloneable = GeoAPI.ICloneable; 4 | #endif 5 | 6 | namespace GeoAPI.Geometries 7 | { 8 | /// 9 | /// Interface for lightweight classes used to store coordinates on the 2-dimensional Cartesian plane. 10 | /// 11 | [Obsolete("Use Coordinate class instead")] 12 | public interface ICoordinate : 13 | ICloneable, 14 | IComparable, IComparable, IEquatable 15 | { 16 | /// 17 | /// The x-ordinate value 18 | /// 19 | double X { get; set; } 20 | 21 | /// 22 | /// The y-ordinate value 23 | /// 24 | double Y { get; set; } 25 | 26 | /// 27 | /// The z-ordinate value 28 | /// 29 | double Z { get; set; } 30 | 31 | /// 32 | /// The measure value 33 | /// 34 | double M { get; set; } 35 | 36 | /// 37 | /// Gets or sets all ordinate values 38 | /// 39 | ICoordinate CoordinateValue { get; set; } 40 | 41 | /// 42 | /// Gets or sets the value of this 43 | /// 44 | /// The index 45 | double this[Ordinate index] { get; set; } 46 | 47 | /// 48 | /// Computes the 2-dimensional distance to the coordiante. 49 | /// 50 | /// The other coordinate 51 | /// The 2-dimensional distance to other 52 | double Distance(ICoordinate other); 53 | 54 | /// 55 | /// Compares equality for x- and y-ordinates 56 | /// 57 | /// The other coordinate 58 | /// true if x- and y-ordinates of coordinate and coordiante are equal. 59 | bool Equals2D(ICoordinate other); 60 | 61 | /// 62 | /// Compares equality for x-, y- and z-ordinates 63 | /// 64 | /// The other coordinate 65 | /// true if x-, y- and z-ordinates of coordinate and coordiante are equal. 66 | bool Equals3D(ICoordinate other); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/IGeographicTransform.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | using System.Collections.Generic; 19 | 20 | namespace GeoAPI.CoordinateSystems 21 | { 22 | /// 23 | /// The IGeographicTransform interface is implemented on geographic transformation 24 | /// objects and implements datum transformations between geographic coordinate systems. 25 | /// 26 | public interface IGeographicTransform : IInfo 27 | { 28 | /// 29 | /// Gets or sets source geographic coordinate system for the transformation. 30 | /// 31 | IGeographicCoordinateSystem SourceGCS { get; set; } 32 | 33 | /// 34 | /// Gets or sets the target geographic coordinate system for the transformation. 35 | /// 36 | IGeographicCoordinateSystem TargetGCS { get; set; } 37 | 38 | /// 39 | /// Returns an accessor interface to the parameters for this geographic transformation. 40 | /// 41 | IParameterInfo ParameterInfo { get; } 42 | 43 | /// 44 | /// Transforms an array of points from the source geographic coordinate system 45 | /// to the target geographic coordinate system. 46 | /// 47 | /// Points in the source geographic coordinate system 48 | /// Points in the target geographic coordinate system 49 | List Forward(List points); 50 | 51 | /// 52 | /// Transforms an array of points from the target geographic coordinate system 53 | /// to the source geographic coordinate system. 54 | /// 55 | /// Points in the target geographic coordinate system 56 | /// Points in the source geographic coordinate system 57 | List Inverse(List points); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /GeoAPI/IO/IGeometryWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using GeoAPI.Geometries; 3 | 4 | namespace GeoAPI.IO 5 | { 6 | /// 7 | /// Base interface for geometry reader or writer interfaces. 8 | /// 9 | public interface IGeometryIOSettings 10 | { 11 | /// 12 | /// Gets or sets whether the SpatialReference ID must be handled. 13 | /// 14 | bool HandleSRID { get; set; } 15 | 16 | /// 17 | /// Gets and flag that indicate which ordinates can be handled. 18 | /// 19 | /// 20 | /// This flag must always return at least . 21 | /// 22 | Ordinates AllowedOrdinates { get; } 23 | 24 | /// 25 | /// Gets and sets flag that indicate which ordinates shall be handled. 26 | /// 27 | /// 28 | /// No matter which flag you supply, are always processed, 29 | /// the rest is binary and 'ed with . 30 | /// 31 | Ordinates HandleOrdinates { get; set; } 32 | } 33 | 34 | /// 35 | /// Interface for binary output of instances. 36 | /// 37 | /// The type of the output to produce. 38 | public interface IGeometryWriter : IGeometryIOSettings 39 | { 40 | /// 41 | /// Writes a binary representation of a given geometry. 42 | /// 43 | /// The geometry 44 | /// The binary representation of 45 | TSink Write(IGeometry geometry); 46 | 47 | /// 48 | /// Writes a binary representation of a given geometry. 49 | /// 50 | /// 51 | /// 52 | void Write(IGeometry geometry, Stream stream); 53 | } 54 | 55 | /// 56 | /// Interface for binary output of instances. 57 | /// 58 | public interface IBinaryGeometryWriter : IGeometryWriter 59 | { 60 | /// 61 | /// Gets or sets the desired 62 | /// 63 | ByteOrder ByteOrder { get; set; } 64 | } 65 | 66 | /// 67 | /// Interface for textual output of instances. 68 | /// 69 | public interface ITextGeometryWriter : IGeometryWriter 70 | { 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/OridinatesUtility.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// Static utility functions for dealing with and dimension 7 | /// 8 | public static class OrdinatesUtility 9 | { 10 | /// 11 | /// Translates the -flag to a number of dimensions. 12 | /// 13 | /// The ordinates flag 14 | /// The number of dimensions 15 | public static int OrdinatesToDimension(Ordinates ordinates) 16 | { 17 | var ret = 2; 18 | if ((ordinates & Ordinates.Z) != 0) ret++; 19 | if ((ordinates & Ordinates.M) != 0) ret++; 20 | 21 | return ret; 22 | } 23 | 24 | /// 25 | /// Translates a dimension value to an -flag. 26 | /// 27 | /// The flag for is set first. 28 | /// The dimension. 29 | /// The ordinates-flag 30 | public static Ordinates DimensionToOrdinates(int dimension) 31 | { 32 | if (dimension == 3) 33 | return Ordinates.XYZ; 34 | if (dimension == 4) 35 | return Ordinates.XYZM; 36 | return Ordinates.XY; 37 | } 38 | 39 | /// 40 | /// Converts an encoded flag to an array of indices. 41 | /// 42 | /// The ordinate flags 43 | /// The maximum oridinate flag that is to be checked 44 | /// The ordinate indices 45 | public static Ordinate[] ToOrdinateArray(Ordinates ordinates, int maxEval = 4) 46 | { 47 | if (maxEval > 32) maxEval = 32; 48 | var intOrdinates = (int) ordinates; 49 | var ordinateList = new List(maxEval); 50 | for (var i = 0; i < maxEval; i++) 51 | { 52 | if ((intOrdinates & (1< 58 | /// Converts an array of values to an flag. 59 | /// 60 | /// An array of values 61 | /// An flag. 62 | public static Ordinates ToOrdinatesFlag(params Ordinate[] ordinates) 63 | { 64 | var result = Ordinates.None; 65 | foreach (var ordinate in ordinates) 66 | { 67 | result |= (Ordinates) (1 << ((int) ordinate)); 68 | } 69 | return result; 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/IPrecisionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// 7 | /// 8 | public enum PrecisionModels 9 | { 10 | /// 11 | /// Floating precision corresponds to the standard 12 | /// double-precision floating-point representation, which is 13 | /// based on the IEEE-754 standard 14 | /// 15 | Floating = 0, 16 | 17 | /// 18 | /// Floating single precision corresponds to the standard 19 | /// single-precision floating-point representation, which is 20 | /// based on the IEEE-754 standard 21 | /// 22 | FloatingSingle = 1, 23 | 24 | /// 25 | /// Fixed Precision indicates that coordinates have a fixed number of decimal places. 26 | /// The number of decimal places is determined by the log10 of the scale factor. 27 | /// 28 | Fixed = 2, 29 | } 30 | 31 | /// 32 | /// Interface for classes specifying the precision model of the Coordinates in a IGeometry. 33 | /// In other words, specifies the grid of allowable points for all IGeometrys. 34 | /// 35 | public interface IPrecisionModel : IComparable, IComparable, IEquatable 36 | { 37 | /// 38 | /// Gets a value indicating the precision model type 39 | /// 40 | PrecisionModels PrecisionModelType { get; } 41 | 42 | /// 43 | /// Gets a value indicating if this precision model has floating precision 44 | /// 45 | bool IsFloating { get; } 46 | 47 | /// 48 | /// Gets a value indicating the maximum precision digits 49 | /// 50 | int MaximumSignificantDigits { get; } 51 | 52 | /// 53 | /// Gets a value indicating the scale factor of a fixed precision model 54 | /// 55 | /// 56 | /// The number of decimal places of precision is 57 | /// equal to the base-10 logarithm of the scale factor. 58 | /// Non-integral and negative scale factors are supported. 59 | /// Negative scale factors indicate that the places 60 | /// of precision is to the left of the decimal point. 61 | /// 62 | double Scale { get; } 63 | 64 | /// 65 | /// Function to compute a precised value of 66 | /// 67 | /// The value to precise 68 | /// The precised value 69 | double MakePrecise(double val); 70 | 71 | /// 72 | /// Method to precise . 73 | /// 74 | /// The coordinate to precise 75 | void MakePrecise(Coordinate coord); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/AxisInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | using System; 19 | using System.Globalization; 20 | 21 | namespace GeoAPI.CoordinateSystems 22 | { 23 | /// 24 | /// Details of axis. This is used to label axes, and indicate the orientation. 25 | /// 26 | #if !PCL 27 | [Serializable] 28 | #endif 29 | public class AxisInfo 30 | { 31 | /// 32 | /// Initializes a new instance of an AxisInfo. 33 | /// 34 | /// Name of axis 35 | /// Axis orientation 36 | public AxisInfo(string name, AxisOrientationEnum orientation) 37 | { 38 | _Name = name; 39 | _Orientation = orientation; 40 | } 41 | 42 | private string _Name; 43 | 44 | /// 45 | /// Human readable name for axis. Possible values are X, Y, Long, Lat or any other short string. 46 | /// 47 | public string Name 48 | { 49 | get { return _Name; } 50 | set { _Name = value; } 51 | } 52 | 53 | private AxisOrientationEnum _Orientation; 54 | 55 | /// 56 | /// Gets enumerated value for orientation. 57 | /// 58 | public AxisOrientationEnum Orientation 59 | { 60 | get { return _Orientation; } 61 | set { _Orientation = value; } 62 | } 63 | 64 | /// 65 | /// Returns the Well-known text for this object 66 | /// as defined in the simple features specification. 67 | /// 68 | public string WKT 69 | { 70 | get 71 | { 72 | #if PCL 73 | return String.Format("AXIS[\"{0}\", {1}]", Name, Orientation.ToString().ToUpper()); 74 | #else 75 | return String.Format("AXIS[\"{0}\", {1}]", Name, Orientation.ToString().ToUpper(CultureInfo.InvariantCulture)); 76 | #endif 77 | } 78 | } 79 | 80 | /// 81 | /// Gets an XML representation of this object 82 | /// 83 | public string XML 84 | { 85 | get 86 | { 87 | return String.Format(CultureInfo.InvariantCulture.NumberFormat, 88 | "", Name, Orientation.ToString() 89 | #if !PCL 90 | .ToUpper(CultureInfo.InvariantCulture)); 91 | #else 92 | .ToUpper()); 93 | #endif 94 | } 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/ICoordinateSequenceFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// An object that knows how to build a particular implementation of 7 | /// ICoordinateSequence from an array of Coordinates. 8 | /// 9 | /// 10 | public interface ICoordinateSequenceFactory 11 | { 12 | /// 13 | /// Returns a based on the given array; 14 | /// whether or not the array is copied is implementation-dependent. 15 | /// 16 | /// A coordinates array, which may not be null nor contain null elements 17 | /// A coordinate sequence. 18 | ICoordinateSequence Create(Coordinate[] coordinates); 19 | 20 | /// 21 | /// Creates a which is a copy 22 | /// of the given . 23 | /// This method must handle null arguments by creating an empty sequence. 24 | /// 25 | /// 26 | /// A coordinate sequence 27 | ICoordinateSequence Create(ICoordinateSequence coordSeq); 28 | 29 | /// 30 | /// Creates a of the specified size and dimension. 31 | /// For this to be useful, the implementation must be mutable. 32 | /// 33 | /// 34 | /// If the requested dimension is larger than the CoordinateSequence implementation 35 | /// can provide, then a sequence of maximum possible dimension should be created. 36 | /// An error should not be thrown. 37 | /// 38 | /// 39 | /// the dimension of the coordinates in the sequence 40 | /// (if user-specifiable, otherwise ignored) 41 | /// A coordinate sequence 42 | ICoordinateSequence Create(int size, int dimension); 43 | 44 | /// 45 | /// Creates a of the specified size and ordinates. 46 | /// For this to be useful, the implementation must be mutable. 47 | /// 48 | /// The number of coordinates. 49 | /// 50 | /// The ordinates each coordinate has. is fix, and can be set. 51 | /// 52 | /// A coordinate sequence. 53 | ICoordinateSequence Create(int size, Ordinates ordinates); 54 | 55 | /// 56 | /// Gets the Ordinate flags that sequences created by this factory can maximal cope with. 57 | /// 58 | Ordinates Ordinates { get; } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/ICoordinateBuffer.cs: -------------------------------------------------------------------------------- 1 | using GeoAPI.Geometries; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// Interface for a coordinate buffer 7 | /// 8 | public interface ICoordinateBuffer 9 | { 10 | /// 11 | /// Gets the (current) capacity of the buffer 12 | /// 13 | int Capacity { get; } 14 | 15 | /// 16 | /// Gets the (current) number of coordinates in the buffer 17 | /// 18 | int Count { get; } 19 | 20 | /// 21 | /// Adds a coordinate made up of the ordinates (x, y, z, m) to the buffer. 22 | /// 23 | /// The x-Ordinate 24 | /// The y-Ordinate 25 | /// The (optional) z-Ordinate 26 | /// The (optional) m-Ordinate 27 | /// Allows repated coordinates to be added 28 | /// true if the coordinate was successfully added. 29 | bool AddCoordinate(double x, double y, double? z = null, double? m = null, bool allowRepeated = true); 30 | 31 | /// 32 | /// Inserts a coordinate made up of the ordinates (, , , ) at index to the buffer. 33 | /// 34 | /// The index at which to insert the ordinate. 35 | /// The x-Ordinate 36 | /// The y-Ordinate 37 | /// The (optional) z-Ordinate 38 | /// The (optional) m-Ordinate 39 | /// Allows repated coordinates to be added 40 | /// true if the coordinate was successfully inserted. 41 | bool InsertCoordinate(int index, double x, double y, double? z = null, double? m = null, bool allowRepeated = true); 42 | 43 | /// 44 | /// Sets a m-value at the provided 45 | /// 46 | /// The index 47 | /// The value 48 | void SetM(int index, double m); 49 | 50 | /// 51 | /// Sets a z-value at the provided 52 | /// 53 | /// The index 54 | /// The value 55 | void SetZ(int index, double z); 56 | 57 | /// 58 | /// Converts the contents of this to a . 59 | ///
Optionally you may assign a factory to create the sequence 60 | ///
61 | /// The factory to use in order to create the sequence. 62 | /// A coordinate sequence 63 | ICoordinateSequence ToSequence(ICoordinateSequenceFactory factory = null); 64 | } 65 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/ICoordinateSequenceFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// An interface for classes which process the coordinates in a . 7 | /// A filter can either record information about each coordinate, 8 | /// or change the value of the coordinate. 9 | /// Filters can be 10 | /// used to implement operations such as coordinate transformations, centroid and 11 | /// envelope computation, and many other functions. 12 | /// classes support the concept of applying a 13 | /// CoordinateSequenceFilter to each 14 | /// s they contain. 15 | /// 16 | /// For maximum efficiency, the execution of filters can be short-circuited by using the property. 17 | /// 18 | /// 19 | /// 20 | /// CoordinateSequenceFilter is an example of the Gang-of-Four Visitor pattern. 21 | /// Note: In general, it is preferable to treat Geometrys as immutable. 22 | /// Mutation should be performed by creating a new Geometry object (see 23 | /// and for convenient ways to do this). 24 | /// An exception to this rule is when a new Geometry has been created via . 25 | /// In this case mutating the Geometry will not cause aliasing issues, 26 | /// and a filter is a convenient way to implement coordinate transformation. 27 | /// 28 | /// 29 | /// Martin Davis 30 | /// 31 | /// 32 | /// 33 | public interface ICoordinateSequenceFilter 34 | { 35 | /// 36 | /// Performs an operation on a coordinate in a . 37 | /// 38 | /// the CoordinateSequence to which the filter is applied 39 | /// i the index of the coordinate to apply the filter to 40 | void Filter(ICoordinateSequence seq, int i); 41 | 42 | /// 43 | /// Reports whether the application of this filter can be terminated. 44 | /// 45 | /// 46 | /// Once this method returns false, it should 47 | /// continue to return false on every subsequent call. 48 | /// 49 | Boolean Done { get; } 50 | 51 | /// 52 | /// Reports whether the execution of this filter has modified the coordinates of the geometry. 53 | /// If so, will be executed 54 | /// after this filter has finished being executed. 55 | /// 56 | /// Most filters can simply return a constant value reflecting whether they are able to change the coordinates. 57 | Boolean GeometryChanged { get; } 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/ICoordinateSystem.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// Base interface for all coordinate systems 22 | /// 23 | /// 24 | /// A coordinate system is a mathematical space, where the elements of the space are called 25 | /// positions. Each position is described by a list of numbers. The length of the list corresponds 26 | /// to the dimension of the coordinate system. So in a 2D coordinate system each position is 27 | /// described by a list containing 2 numbers. 28 | /// 29 | /// However, in a coordinate system, not all lists of numbers correspond to a position - 30 | /// some lists may be outside the domain of the coordinate system. For example, in a 2D Lat/Lon 31 | /// coordinate system, the list (91,91) does not correspond to a position. 32 | /// 33 | /// Some coordinate systems also have a mapping from the mathematical space into locations 34 | /// in the real world. So in a Lat/Lon coordinate system, the mathematical position (lat, long) 35 | /// corresponds to a location on the surface of the Earth. This mapping from the mathematical 36 | /// space into real-world locations is called a Datum. 37 | /// 38 | public interface ICoordinateSystem : IInfo 39 | { 40 | 41 | /// 42 | /// Dimension of the coordinate system. 43 | /// 44 | int Dimension { get; } 45 | 46 | /// 47 | /// Gets axis details for dimension within coordinate system. 48 | /// 49 | /// Dimension 50 | /// Axis info 51 | AxisInfo GetAxis(int dimension); 52 | 53 | /// 54 | /// Gets units for dimension within coordinate system. 55 | /// 56 | IUnit GetUnits(int dimension); 57 | 58 | /// 59 | /// Gets default envelope of coordinate system. 60 | /// 61 | /// 62 | /// Gets default envelope of coordinate system. Coordinate systems 63 | /// which are bounded should return the minimum bounding box of their 64 | /// domain. Unbounded coordinate systems should return a box which is 65 | /// as large as is likely to be used. For example, a (lon,lat) 66 | /// geographic coordinate system in degrees should return a box from 67 | /// (-180,-90) to (180,90), and a geocentric coordinate system could 68 | /// return a box from (-r,-r,-r) to (+r,+r,+r) where r is the 69 | /// approximate radius of the Earth. 70 | /// 71 | double[] DefaultEnvelope { get; } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /GeoAPI/GeometryServiceProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace GeoAPI 6 | { 7 | /// 8 | /// Static class that provides access to a class. 9 | /// 10 | public static class GeometryServiceProvider 11 | { 12 | private static IGeometryServices _instance; 13 | private static readonly object LockObject = new object(); 14 | 15 | /// 16 | /// Gets or sets the instance. 17 | /// 18 | public static IGeometryServices Instance 19 | { 20 | get 21 | { 22 | lock (LockObject) 23 | { 24 | return _instance ?? (_instance = ReflectInstance()); 25 | } 26 | } 27 | 28 | set 29 | { 30 | if (value == null) 31 | throw new ArgumentNullException("value", "You must not assign null to Instance!"); 32 | 33 | lock (LockObject) 34 | { 35 | _instance = value; 36 | } 37 | } 38 | } 39 | 40 | private static IEnumerable GetLoadableTypes(Assembly assembly) 41 | { 42 | if (assembly == null) 43 | return new Type[0]; 44 | 45 | try 46 | { 47 | return assembly.GetExportedTypes(); 48 | } 49 | catch (ReflectionTypeLoadException ex) 50 | { 51 | var types = ex.Types; 52 | IList list = new List(types.Length); 53 | foreach (var t in types) 54 | if (t != null && t.IsPublic) 55 | list.Add(t); 56 | return list; 57 | } 58 | catch 59 | { 60 | return new Type[0]; 61 | } 62 | } 63 | 64 | private static IGeometryServices ReflectInstance() 65 | { 66 | #if !PCL 67 | var a = AppDomain.CurrentDomain.GetAssemblies(); 68 | foreach (var assembly in a) 69 | { 70 | // Take a look at issue 114: http://code.google.com/p/nettopologysuite/issues/detail?id=114 71 | if (assembly is System.Reflection.Emit.AssemblyBuilder) continue; 72 | if (assembly.GetType().FullName == "System.Reflection.Emit.InternalAssemblyBuilder") continue; 73 | if (assembly.GlobalAssemblyCache && assembly.CodeBase == Assembly.GetExecutingAssembly().CodeBase) continue; 74 | 75 | foreach (var t in GetLoadableTypes(assembly)) 76 | { 77 | if (t.IsInterface) continue; 78 | if (t.IsAbstract) continue; 79 | if (t.IsNotPublic) continue; 80 | if (!typeof(IGeometryServices).IsAssignableFrom(t)) continue; 81 | 82 | var constuctors = t.GetConstructors(); 83 | foreach (var constructorInfo in constuctors) 84 | { 85 | if (constructorInfo.IsPublic && constructorInfo.GetParameters().Length == 0) 86 | return (IGeometryServices)Activator.CreateInstance(t); 87 | } 88 | } 89 | } 90 | #endif 91 | throw new InvalidOperationException("Cannot use GeometryServiceProvider without an assigned IGeometryServices class"); 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://www.gitignore.io 2 | 3 | ### VisualStudio ### 4 | ## Ignore Visual Studio temporary files, build results, and 5 | ## files generated by popular Visual Studio add-ons. 6 | 7 | # User-specific files 8 | *.suo 9 | *.user 10 | *.sln.docstates 11 | 12 | # Build results 13 | [Dd]ebug/ 14 | [Dd]ebugPublic/ 15 | [Rr]elease/ 16 | [Rr]eleases/ 17 | x64/ 18 | x86/ 19 | build/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | 24 | # Roslyn cache directories 25 | *.ide/ 26 | 27 | # MSTest test Results 28 | [Tt]est[Rr]esult*/ 29 | [Bb]uild[Ll]og.* 30 | 31 | #NUNIT 32 | *.VisualState.xml 33 | TestResult.xml 34 | 35 | # Build Results of an ATL Project 36 | [Dd]ebugPS/ 37 | [Rr]eleasePS/ 38 | dlldata.c 39 | 40 | *_i.c 41 | *_p.c 42 | *_i.h 43 | *.ilk 44 | *.meta 45 | *.obj 46 | *.pch 47 | *.pdb 48 | *.pgc 49 | *.pgd 50 | *.rsp 51 | *.sbr 52 | *.tlb 53 | *.tli 54 | *.tlh 55 | *.tmp 56 | *.tmp_proj 57 | *.log 58 | *.vspscc 59 | *.vssscc 60 | .builds 61 | *.pidb 62 | *.svclog 63 | *.scc 64 | 65 | # Chutzpah Test files 66 | _Chutzpah* 67 | 68 | # Visual C++ cache files 69 | ipch/ 70 | *.aps 71 | *.ncb 72 | *.opensdf 73 | *.sdf 74 | *.cachefile 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | *.vspx 80 | 81 | # TFS 2012 Local Workspace 82 | $tf/ 83 | 84 | # Guidance Automation Toolkit 85 | *.gpState 86 | 87 | # ReSharper is a .NET coding add-in 88 | _ReSharper*/ 89 | *.[Rr]e[Ss]harper 90 | *.DotSettings.user 91 | 92 | # JustCode is a .NET coding addin-in 93 | .JustCode 94 | 95 | # TeamCity is a build add-in 96 | _TeamCity* 97 | 98 | # DotCover is a Code Coverage Tool 99 | *.dotCover 100 | 101 | # NCrunch 102 | _NCrunch_* 103 | .*crunch*.local.xml 104 | 105 | # MightyMoose 106 | *.mm.* 107 | AutoTest.Net/ 108 | 109 | # Web workbench (sass) 110 | .sass-cache/ 111 | 112 | # Installshield output folder 113 | [Ee]xpress/ 114 | 115 | # DocProject is a documentation generator add-in 116 | DocProject/buildhelp/ 117 | DocProject/Help/*.HxT 118 | DocProject/Help/*.HxC 119 | DocProject/Help/*.hhc 120 | DocProject/Help/*.hhk 121 | DocProject/Help/*.hhp 122 | DocProject/Help/Html2 123 | DocProject/Help/html 124 | 125 | # Click-Once directory 126 | publish/ 127 | 128 | # Publish Web Output 129 | *.[Pp]ublish.xml 130 | *.azurePubxml 131 | # TODO: Comment the next line if you want to checkin your web deploy settings 132 | # but database connection strings (with potential passwords) will be unencrypted 133 | *.pubxml 134 | *.publishproj 135 | 136 | # NuGet Packages 137 | *.nupkg 138 | # The packages folder can be ignored because of Package Restore 139 | **/packages/* 140 | # except build/, which is used as an MSBuild target. 141 | !**/packages/build/ 142 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 143 | #!**/packages/repositories.config 144 | 145 | # Windows Azure Build Output 146 | csx/ 147 | *.build.csdef 148 | 149 | # Windows Store app package directory 150 | AppPackages/ 151 | 152 | # Others 153 | sql/ 154 | *.Cache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | 165 | # RIA/Silverlight projects 166 | Generated_Code/ 167 | 168 | # Backup & report files from converting an old project file 169 | # to a newer Visual Studio version. Backup files are not needed, 170 | # because we have git ;-) 171 | _UpgradeReport_Files/ 172 | Backup*/ 173 | UpgradeLog*.XML 174 | UpgradeLog*.htm 175 | 176 | # SQL Server files 177 | *.mdf 178 | *.ldf 179 | 180 | # Business Intelligence projects 181 | *.rdl.data 182 | *.bim.layout 183 | *.bim_*.settings 184 | 185 | # Microsoft Fakes 186 | FakesAssemblies/ 187 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/ProjectionParameter.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | using System; 19 | using System.Globalization; 20 | 21 | namespace GeoAPI.CoordinateSystems 22 | { 23 | /// 24 | /// A named projection parameter value. 25 | /// 26 | /// 27 | /// The linear units of parameters' values match the linear units of the containing 28 | /// projected coordinate system. The angular units of parameter values match the 29 | /// angular units of the geographic coordinate system that the projected coordinate 30 | /// system is based on. (Notice that this is different from , 31 | /// where the units are always meters and degrees.) 32 | /// 33 | #if !PCL 34 | [Serializable] 35 | #endif 36 | public class ProjectionParameter 37 | { 38 | /// 39 | /// Initializes an instance of a ProjectionParameter 40 | /// 41 | /// Name of parameter 42 | /// Parameter value 43 | public ProjectionParameter(string name, double value) 44 | { 45 | _Name = name; 46 | _Value = value; 47 | } 48 | 49 | 50 | private string _Name; 51 | 52 | /// 53 | /// Parameter name. 54 | /// 55 | public string Name 56 | { 57 | get { return _Name; } 58 | set { _Name = value; } 59 | } 60 | 61 | private double _Value; 62 | 63 | /// 64 | /// Parameter value. 65 | /// The linear units of a parameters' values match the linear units of the containing 66 | /// projected coordinate system. The angular units of parameter values match the 67 | /// angular units of the geographic coordinate system that the projected coordinate 68 | /// system is based on. 69 | /// 70 | public double Value 71 | { 72 | get { return _Value; } 73 | set { _Value = value; } 74 | } 75 | 76 | /// 77 | /// Returns the Well-known text for this object 78 | /// as defined in the simple features specification. 79 | /// 80 | public string WKT 81 | { 82 | get 83 | { 84 | return String.Format(CultureInfo.InvariantCulture.NumberFormat, "PARAMETER[\"{0}\", {1}]", Name, Value); 85 | } 86 | } 87 | 88 | /// 89 | /// Gets an XML representation of this object 90 | /// 91 | public string XML 92 | { 93 | get 94 | { 95 | return string.Format(CultureInfo.InvariantCulture.NumberFormat, "", Name, Value); 96 | } 97 | } 98 | 99 | /// 100 | /// Function to get a textual representation of this envelope 101 | /// 102 | /// A textual representation of this envelope 103 | public override string ToString() 104 | { 105 | return string.Format("ProjectionParameter '{0}': {1}", Name, Value); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /GeoAPI/ICoordinateSystemServices.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | // Copyright 2013-2015 - Felix Obermaier (www.ivv-aachen.de) 3 | // Copyright 2015 - Spartaco Giubbolini 4 | // 5 | // This file is part of GeoAPI. 6 | // GeoAPI is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU Lesser General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // GeoAPI is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public License 17 | // along with SharpMap; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | 20 | using GeoAPI.CoordinateSystems; 21 | using GeoAPI.CoordinateSystems.Transformations; 22 | 23 | namespace GeoAPI 24 | { 25 | /// 26 | /// Interface for classes that provide access to coordinate system and tranformation facilities. 27 | /// 28 | public interface ICoordinateSystemServices 29 | { 30 | /// 31 | /// Returns the coordinate system by identifier 32 | /// 33 | /// The initialization for the coordinate system 34 | /// The coordinate system. 35 | ICoordinateSystem GetCoordinateSystem(int srid); 36 | 37 | /// 38 | /// Returns the coordinate system by and . 39 | /// 40 | /// The authority for the coordinate system 41 | /// The code assigned to the coordinate system by . 42 | /// The coordinate system. 43 | ICoordinateSystem GetCoordinateSystem(string authority, long code); 44 | 45 | /// 46 | /// Method to get the identifier, by which this coordinate system can be accessed. 47 | /// 48 | /// The authority name 49 | /// The code assigned by 50 | /// The identifier or null 51 | int? GetSRID(string authority, long authorityCode); 52 | 53 | /// 54 | /// Method to create a coordinate tranformation between two spatial reference systems, defined by their identifiers 55 | /// 56 | /// This is a convenience function for . 57 | /// The identifier for the source spatial reference system. 58 | /// The identifier for the target spatial reference system. 59 | /// A coordinate transformation, null if no transformation could be created. 60 | ICoordinateTransformation CreateTransformation(int sourceSrid, int targetSrid); 61 | 62 | /// 63 | /// Method to create a coordinate tranformation between two spatial reference systems 64 | /// 65 | /// The source spatial reference system. 66 | /// The target spatial reference system. 67 | /// A coordinate transformation, null if no transformation could be created. 68 | ICoordinateTransformation CreateTransformation(ICoordinateSystem source, ICoordinateSystem target); 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/Ordinate.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Standard ordinate index values. 5 | /// 6 | public enum Ordinate 7 | { 8 | /// 9 | /// X Ordinate = 0. 10 | /// 11 | X = 0, 12 | 13 | /// 14 | /// Y Ordinate = 1. 15 | /// 16 | Y = 1, 17 | 18 | /// 19 | /// Z Ordinate = 2. 20 | /// 21 | Z = 2, 22 | 23 | /// 24 | /// M Ordinate = 3 25 | /// 26 | M = 3, 27 | 28 | /// 29 | /// Ordinate at index 2 30 | /// 31 | Ordinate2 = 2, 32 | 33 | /// 34 | /// Ordinate at index 3 35 | /// 36 | Ordinate3 = 3, 37 | 38 | /// 39 | /// Ordinate at index 4 40 | /// 41 | Ordinate4 = 4, 42 | 43 | /// 44 | /// Ordinate at index 5 45 | /// 46 | Ordinate5 = 5, 47 | 48 | /// 49 | /// Ordinate at index 6 50 | /// 51 | Ordinate6 = 6, 52 | 53 | /// 54 | /// Ordinate at index 7 55 | /// 56 | Ordinate7 = 7, 57 | 58 | /// 59 | /// Ordinate at index 8 60 | /// 61 | Ordinate8 = 8, 62 | 63 | /// 64 | /// Ordinate at index 9 65 | /// 66 | Ordinate9 = 9, 67 | 68 | /// 69 | /// Ordinate at index 10 70 | /// 71 | Ordinate10 = 10, 72 | 73 | /// 74 | /// Ordinate at index 11 75 | /// 76 | Ordinate11 = 11, 77 | 78 | /// 79 | /// Ordinate at index 12 80 | /// 81 | Ordinate12 = 12, 82 | 83 | /// 84 | /// Ordinate at index 13 85 | /// 86 | Ordinate13 = 13, 87 | 88 | /// 89 | /// Ordinate at index 14 90 | /// 91 | Ordinate14 = 14, 92 | 93 | /// 94 | /// Ordinate at index 15 95 | /// 96 | Ordinate15 = 15, 97 | 98 | /// 99 | /// Ordinate at index 16 100 | /// 101 | Ordinate16 = 16, 102 | 103 | /// 104 | /// Ordinate at index 17 105 | /// 106 | Ordinate17 = 17, 107 | 108 | /// 109 | /// Ordinate at index 18 110 | /// 111 | Ordinate18 = 18, 112 | 113 | /// 114 | /// Ordinate at index 19 115 | /// 116 | Ordinate19 = 19, 117 | 118 | /// 119 | /// Ordinate at index 20 120 | /// 121 | Ordinate20 = 20, 122 | 123 | /// 124 | /// Ordinate at index 21 125 | /// 126 | Ordinate21 = 21, 127 | 128 | /// 129 | /// Ordinate at index 22 130 | /// 131 | Ordinate22 = 22, 132 | 133 | /// 134 | /// Ordinate at index 23 135 | /// 136 | Ordinate23 = 23, 137 | 138 | /// 139 | /// Ordinate at index 24 140 | /// 141 | Ordinate24 = 24, 142 | 143 | /// 144 | /// Ordinate at index 25 145 | /// 146 | Ordinate25 = 25, 147 | 148 | /// 149 | /// Ordinate at index 26 150 | /// 151 | Ordinate26 = 26, 152 | 153 | /// 154 | /// Ordinate at index 27 155 | /// 156 | Ordinate27 = 27, 157 | 158 | /// 159 | /// Ordinate at index 28 160 | /// 161 | Ordinate28 = 28, 162 | 163 | /// 164 | /// Ordinate at index 29 165 | /// 166 | Ordinate29 = 29, 167 | 168 | /// 169 | /// Ordinate at index 30 170 | /// 171 | Ordinate30 = 30, 172 | 173 | /// 174 | /// Ordinate at index 31 175 | /// 176 | Ordinate31 = 31, 177 | 178 | /// 179 | /// Ordinate at index 32 180 | /// 181 | Ordinate32 = 32, 182 | } 183 | } -------------------------------------------------------------------------------- /GeoAPI/Operation/Buffer/IBufferParameters.cs: -------------------------------------------------------------------------------- 1 | using GeoAPI.Operation.Buffer; 2 | 3 | namespace GeoAPI.Operation.Buffer 4 | { 5 | /// 6 | /// An interface for classes that control the parameters for the buffer building process 7 | /// 8 | /// The parameters allow control over: 9 | /// 10 | /// Quadrant segments (accuracy of approximation for circular arcs) 11 | /// End Cap style 12 | /// Join style 13 | /// Mitre limit 14 | /// whether the buffer is single-sided 15 | /// 16 | /// 17 | /// 18 | public interface IBufferParameters 19 | { 20 | /// 21 | /// Gets/Sets the number of quadrant segments which will be used 22 | /// 23 | /// 24 | /// QuadrantSegments is the number of line segments used to approximate an angle fillet. 25 | /// 26 | /// qs >>= 1joins are round, and qs indicates the number of segments to use to approximate a quarter-circle. 27 | /// qs = 0joins are beveled 28 | /// qs < 0joins are mitred, and the value of qs indicates the mitre ration limit as mitreLimit = |qs| 29 | /// 30 | /// 31 | int QuadrantSegments { get; set; } 32 | 33 | /// 34 | /// Gets/Sets the end cap style of the generated buffer. 35 | /// 36 | /// 37 | /// 38 | /// The styles supported are , , and . 39 | /// 40 | /// The default is . 41 | /// 42 | EndCapStyle EndCapStyle { get; set; } 43 | 44 | /// 45 | /// Gets/Sets the join style for outside (reflex) corners between line segments. 46 | /// 47 | /// 48 | /// Allowable values are (which is the default), and 49 | /// 50 | JoinStyle JoinStyle { get; set; } 51 | 52 | /// 53 | /// Sets the limit on the mitre ratio used for very sharp corners. 54 | /// 55 | /// 56 | /// 57 | /// The mitre ratio is the ratio of the distance from the corner 58 | /// to the end of the mitred offset corner. 59 | /// When two line segments meet at a sharp angle, 60 | /// a miter join will extend far beyond the original geometry. 61 | /// (and in the extreme case will be infinitely far.) 62 | /// To prevent unreasonable geometry, the mitre limit 63 | /// allows controlling the maximum length of the join corner. 64 | /// Corners with a ratio which exceed the limit will be beveled. 65 | /// 66 | /// 67 | double MitreLimit { get; set; } 68 | 69 | /// 70 | /// Gets or sets whether the computed buffer should be single-sided. 71 | /// A single-sided buffer is constructed on only one side of each input line. 72 | /// 73 | /// The side used is determined by the sign of the buffer distance: 74 | /// 75 | /// a positive distance indicates the left-hand side 76 | /// a negative distance indicates the right-hand side 77 | /// 78 | /// The single-sided buffer of point geometries is the same as the regular buffer. 79 | /// 80 | /// The End Cap Style for single-sided buffers is always ignored, 81 | /// and forced to the equivalent of . 82 | /// 83 | /// 84 | bool IsSingleSided { get; set; } 85 | 86 | /// 87 | /// Gets or sets the factor used to determine the simplify distance tolerance 88 | /// for input simplification. 89 | /// Simplifying can increase the performance of computing buffers. 90 | /// Generally the simplify factor should be greater than 0. 91 | /// Values between 0.01 and .1 produce relatively good accuracy for the generate buffer. 92 | /// Larger values sacrifice accuracy in return for performance. 93 | /// 94 | double SimplifyFactor { get; set; } 95 | } 96 | } -------------------------------------------------------------------------------- /TeamCity.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Release 5 | Any CPU 6 | tmp 7 | 8 | 9 | $(MSBuildThisFileDirectory)GeoAPI.sln 10 | $(MSBuildThisFileDirectory) 11 | 1.7.4.3 12 | $(GeoAPIVersion) 13 | "$(MSBuildProjectDirectory)\Release" 14 | $(AsmFileVersion) 15 | "$(MSBuildThisFileDirectory).nuget\NuGet.exe" 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 48 | 49 | 50 | 51 | 57 | 58 | 59 | 60 | 66 | 67 | 68 | 69 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/DatumType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// A vertical datum of geoid model derived heights, also called GPS-derived heights. 22 | /// These heights are approximations of orthometric heights (H), constructed from the 23 | /// ellipsoidal heights (h) by the use of the given geoid undulation model (N) through 24 | /// the equation: H=h-N. 25 | /// 26 | public enum DatumType : int 27 | { 28 | /// 29 | /// Lowest possible value for horizontal datum types 30 | /// 31 | HD_Min = 1000, 32 | 33 | /// 34 | /// Unspecified horizontal datum type. Horizontal datums with this type should never 35 | /// supply a conversion to WGS84 using Bursa Wolf parameters. 36 | /// 37 | HD_Other = 1000, 38 | 39 | /// 40 | /// These datums, such as ED50, NAD27 and NAD83, have been designed to support 41 | /// horizontal positions on the ellipsoid as opposed to positions in 3-D space. These datums were designed mainly to support a horizontal component of a position in a domain of limited extent, such as a country, a region or a continent. 42 | /// 43 | HD_Classic = 1001, 44 | 45 | /// 46 | /// A geocentric datum is a "satellite age" modern geodetic datum mainly of global 47 | /// extent, such as WGS84 (used in GPS), PZ90 (used in GLONASS) and ITRF. These 48 | /// datums were designed to support both a horizontal component of position and 49 | /// a vertical component of position (through ellipsoidal heights). The regional 50 | /// realizations of ITRF, such as ETRF, are also included in this category. 51 | /// 52 | HD_Geocentric = 1002, 53 | 54 | /// 55 | /// Highest possible value for horizontal datum types. 56 | /// 57 | HD_Max = 1999, 58 | 59 | /// 60 | /// Lowest possible value for vertical datum types. 61 | /// 62 | VD_Min = 2000, 63 | 64 | /// 65 | /// Unspecified vertical datum type. 66 | /// 67 | VD_Other = 2000, 68 | 69 | /// 70 | /// A vertical datum for orthometric heights that are measured along the plumb line. 71 | /// 72 | VD_Orthometric = 2001, 73 | 74 | /// 75 | /// A vertical datum for ellipsoidal heights that are measured along the normal to 76 | /// the ellipsoid used in the definition of horizontal datum. 77 | /// 78 | VD_Ellipsoidal = 2002, 79 | 80 | /// 81 | /// The vertical datum of altitudes or heights in the atmosphere. These are 82 | /// approximations of orthometric heights obtained with the help of a barometer or 83 | /// a barometric altimeter. These values are usually expressed in one of the 84 | /// following units: meters, feet, millibars (used to measure pressure levels), or 85 | /// theta value (units used to measure geopotential height). 86 | /// 87 | VD_AltitudeBarometric = 2003, 88 | 89 | /// 90 | /// A normal height system. 91 | /// 92 | VD_Normal = 2004, 93 | 94 | /// 95 | /// A vertical datum of geoid model derived heights, also called GPS-derived heights. 96 | /// These heights are approximations of orthometric heights (H), constructed from the 97 | /// ellipsoidal heights (h) by the use of the given geoid undulation model (N) 98 | /// through the equation: H=h-N. 99 | /// 100 | VD_GeoidModelDerived = 2005, 101 | 102 | /// 103 | /// This attribute is used to support the set of datums generated for hydrographic 104 | /// engineering projects where depth measurements below sea level are needed. It is 105 | /// often called a hydrographic or a marine datum. Depths are measured in the 106 | /// direction perpendicular (approximately) to the actual equipotential surfaces of 107 | /// the earth's gravity field, using such procedures as echo-sounding. 108 | /// 109 | VD_Depth = 2006, 110 | 111 | /// 112 | /// Highest possible value for vertical datum types. 113 | /// 114 | VD_Max = 2999, 115 | 116 | /// 117 | /// Lowest possible value for local datum types. 118 | /// 119 | LD_Min = 10000, 120 | 121 | /// 122 | /// Highest possible value for local datum types. 123 | /// 124 | LD_Max = 32767 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/Dimension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// Provides constants representing the dimensions of a point, a curve and a surface. 7 | /// 8 | /// 9 | /// Also provides constants representing the dimensions of the empty geometry and 10 | /// non-empty geometries, and the wildcard constant meaning "any dimension". 11 | /// These constants are used as the entries in s. 12 | /// 13 | public enum Dimension 14 | { 15 | /// 16 | /// Dimension value of a point (0). 17 | /// 18 | Point = 0, 19 | 20 | /// 21 | /// Dimension value of a curve (1). 22 | /// 23 | Curve = 1, 24 | 25 | /// 26 | /// Dimension value of a surface (2). 27 | /// 28 | Surface = 2, 29 | 30 | /// 31 | /// Dimension value of a empty point (-1). 32 | /// 33 | False = -1, 34 | 35 | /// 36 | /// Dimension value of non-empty geometries (= {Point,Curve,A}). 37 | /// 38 | True = -2, 39 | 40 | /// 41 | /// Dimension value for any dimension (= {False, True}). 42 | /// 43 | Dontcare = -3 44 | } 45 | 46 | /// 47 | /// Class containing static methods for conversions 48 | /// between dimension values and characters. 49 | /// 50 | public class DimensionUtility 51 | { 52 | /// 53 | /// Symbol for the FALSE pattern matrix entry 54 | /// 55 | public const char SymFalse = 'F'; 56 | 57 | /// 58 | /// Symbol for the TRUE pattern matrix entry 59 | /// 60 | public const char SymTrue = 'T'; 61 | 62 | /// 63 | /// Symbol for the DONTCARE pattern matrix entry 64 | /// 65 | public const char SymDontcare = '*'; 66 | 67 | /// 68 | /// Symbol for the P (dimension 0) pattern matrix entry 69 | /// 70 | public const char SymP = '0'; 71 | 72 | /// 73 | /// Symbol for the L (dimension 1) pattern matrix entry 74 | /// 75 | public const char SymL = '1'; 76 | 77 | /// 78 | /// Symbol for the A (dimension 2) pattern matrix entry 79 | /// 80 | public const char SymA = '2'; 81 | 82 | 83 | 84 | /// 85 | /// Converts the dimension value to a dimension symbol, 86 | /// for example, True => 'T' 87 | /// 88 | /// Number that can be stored in the IntersectionMatrix. 89 | /// Possible values are True, False, Dontcare, 0, 1, 2. 90 | /// Character for use in the string representation of an IntersectionMatrix. 91 | /// Possible values are T, F, * , 0, 1, 2. 92 | public static char ToDimensionSymbol(Dimension dimensionValue) 93 | { 94 | switch (dimensionValue) 95 | { 96 | case Dimension.False: 97 | return SymFalse; 98 | case Dimension.True: 99 | return SymTrue; 100 | case Dimension.Dontcare: 101 | return SymDontcare; 102 | case Dimension.Point: 103 | return SymP; 104 | case Dimension.Curve: 105 | return SymL; 106 | case Dimension.Surface: 107 | return SymA; 108 | default: 109 | throw new ArgumentOutOfRangeException 110 | ("Unknown dimension value: " + dimensionValue); 111 | } 112 | } 113 | 114 | /// 115 | /// Converts the dimension symbol to a dimension value, 116 | /// for example, '*' => Dontcare 117 | /// 118 | /// Character for use in the string representation of an IntersectionMatrix. 119 | /// Possible values are T, F, * , 0, 1, 2. 120 | /// Number that can be stored in the IntersectionMatrix. 121 | /// Possible values are True, False, Dontcare, 0, 1, 2. 122 | public static Dimension ToDimensionValue(char dimensionSymbol) 123 | { 124 | switch (Char.ToUpper(dimensionSymbol)) 125 | { 126 | case SymFalse: 127 | return Dimension.False; 128 | case SymTrue: 129 | return Dimension.True; 130 | case SymDontcare: 131 | return Dimension.Dontcare; 132 | case SymP: 133 | return Dimension.Point; 134 | case SymL: 135 | return Dimension.Curve; 136 | case SymA: 137 | return Dimension.Surface; 138 | default: 139 | throw new ArgumentOutOfRangeException 140 | ("Unknown dimension symbol: " + dimensionSymbol); 141 | } 142 | } 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/OgcGeometryType.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries 2 | { 3 | /// 4 | /// Enumeration of OGC Geometry Types 5 | /// 6 | public enum OgcGeometryType 7 | { 8 | /// 9 | /// Point. 10 | /// 11 | Point = 1, 12 | 13 | /// 14 | /// LineString. 15 | /// 16 | LineString = 2, 17 | 18 | /// 19 | /// Polygon. 20 | /// 21 | Polygon = 3, 22 | 23 | /// 24 | /// MultiPoint. 25 | /// 26 | MultiPoint = 4, 27 | 28 | /// 29 | /// MultiLineString. 30 | /// 31 | MultiLineString = 5, 32 | 33 | /// 34 | /// MultiPolygon. 35 | /// 36 | MultiPolygon = 6, 37 | 38 | /// 39 | /// GeometryCollection. 40 | /// 41 | GeometryCollection = 7, 42 | 43 | /// 44 | /// CircularString 45 | /// 46 | CircularString = 8, 47 | 48 | /// 49 | /// CompoundCurve 50 | /// 51 | CompoundCurve = 9, 52 | 53 | /// 54 | /// CurvePolygon 55 | /// 56 | CurvePolygon = 10, 57 | 58 | /// 59 | /// MultiCurve 60 | /// 61 | MultiCurve = 11, 62 | 63 | /// 64 | /// MultiSurface 65 | /// 66 | MultiSurface = 12, 67 | 68 | /// 69 | /// Curve 70 | /// 71 | Curve = 13, 72 | 73 | /// 74 | /// Surface 75 | /// 76 | Surface = 14, 77 | 78 | /// 79 | /// PolyhedralSurface 80 | /// 81 | PolyhedralSurface = 15, 82 | 83 | /// 84 | /// TIN 85 | /// 86 | // ReSharper disable InconsistentNaming 87 | TIN = 16, 88 | // ReSharper restore InconsistentNaming 89 | 90 | 91 | 92 | 93 | /* 94 | /// 95 | /// Point with Z coordinate. 96 | /// 97 | WKBPointZ = 1001, 98 | 99 | /// 100 | /// LineString with Z coordinate. 101 | /// 102 | WKBLineStringZ = 1002, 103 | 104 | /// 105 | /// Polygon with Z coordinate. 106 | /// 107 | WKBPolygonZ = 1003, 108 | 109 | /// 110 | /// MultiPoint with Z coordinate. 111 | /// 112 | WKBMultiPointZ = 1004, 113 | 114 | /// 115 | /// MultiLineString with Z coordinate. 116 | /// 117 | WKBMultiLineStringZ = 1005, 118 | 119 | /// 120 | /// MultiPolygon with Z coordinate. 121 | /// 122 | WKBMultiPolygonZ = 1006, 123 | 124 | /// 125 | /// GeometryCollection with Z coordinate. 126 | /// 127 | WKBGeometryCollectionZ = 1007, 128 | 129 | /// 130 | /// Point with M ordinate value. 131 | /// 132 | WKBPointM = 2001, 133 | 134 | /// 135 | /// LineString with M ordinate value. 136 | /// 137 | WKBLineStringM = 2002, 138 | 139 | /// 140 | /// Polygon with M ordinate value. 141 | /// 142 | WKBPolygonM = 2003, 143 | 144 | /// 145 | /// MultiPoint with M ordinate value. 146 | /// 147 | WKBMultiPointM = 2004, 148 | 149 | /// 150 | /// MultiLineString with M ordinate value. 151 | /// 152 | WKBMultiLineStringM = 2005, 153 | 154 | /// 155 | /// MultiPolygon with M ordinate value. 156 | /// 157 | WKBMultiPolygonM = 2006, 158 | 159 | /// 160 | /// GeometryCollection with M ordinate value. 161 | /// 162 | WKBGeometryCollectionM = 2007, 163 | 164 | /// 165 | /// Point with Z coordinate and M ordinate value. 166 | /// 167 | WKBPointZM = 3001, 168 | 169 | /// 170 | /// LineString with Z coordinate and M ordinate value. 171 | /// 172 | WKBLineStringZM = 3002, 173 | 174 | /// 175 | /// Polygon with Z coordinate and M ordinate value. 176 | /// 177 | WKBPolygonZM = 3003, 178 | 179 | /// 180 | /// MultiPoint with Z coordinate and M ordinate value. 181 | /// 182 | WKBMultiPointZM = 3004, 183 | 184 | /// 185 | /// MultiLineString with Z coordinate and M ordinate value. 186 | /// 187 | WKBMultiLineStringZM = 3005, 188 | 189 | /// 190 | /// MultiPolygon with Z coordinate and M ordinate value. 191 | /// 192 | WKBMultiPolygonZM = 3006, 193 | 194 | /// 195 | /// GeometryCollection with Z coordinate and M ordinate value. 196 | /// 197 | WKBGeometryCollectionZM = 3007 198 | */ 199 | }; 200 | } -------------------------------------------------------------------------------- /GeoAPI/IGeometryServices.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using GeoAPI.Geometries; 5 | 6 | namespace GeoAPI 7 | { 8 | /// 9 | /// Delegate function to get a coordinate system from a given initialization string 10 | /// 11 | /// The initialization string 12 | /// The type of the coordinate sytem. 13 | [Obsolete("Not used", true)] 14 | public delegate TCoordinateSystem GetCoordinateSystemDelegate(string init); 15 | 16 | /// 17 | /// An interface for classes that offer access to geometry creating facillities. 18 | /// 19 | public interface IGeometryServices 20 | { 21 | /// 22 | /// Gets the default spatial reference id 23 | /// 24 | int DefaultSRID { get; } 25 | 26 | /// 27 | /// Gets or sets the coordiate sequence factory to use 28 | /// 29 | ICoordinateSequenceFactory DefaultCoordinateSequenceFactory { get; } 30 | 31 | /// 32 | /// Gets or sets the default precision model 33 | /// 34 | IPrecisionModel DefaultPrecisionModel { get; } 35 | 36 | /// 37 | /// Creates a precision model based on given precision model type 38 | /// 39 | /// The precision model type 40 | IPrecisionModel CreatePrecisionModel(PrecisionModels modelType); 41 | 42 | /// 43 | /// Creates a precision model based on given precision model. 44 | /// 45 | /// The precision model 46 | IPrecisionModel CreatePrecisionModel(IPrecisionModel modelType); 47 | 48 | /// 49 | /// Creates a precision model based on the given scale factor. 50 | /// 51 | /// The scale factor 52 | /// The precision model. 53 | IPrecisionModel CreatePrecisionModel(double scale); 54 | 55 | /// 56 | /// Creates a new geometry factory, using , and . 57 | /// 58 | /// The geometry factory 59 | IGeometryFactory CreateGeometryFactory(); 60 | 61 | /// 62 | /// Creates a geometry fractory using and . 63 | /// 64 | /// 65 | /// The geometry factory 66 | IGeometryFactory CreateGeometryFactory(int srid); 67 | 68 | /// 69 | /// Creates a geometry factory using the given along with and . 70 | /// 71 | /// The coordinate sequence factory to use. 72 | /// The geometry factory. 73 | IGeometryFactory CreateGeometryFactory(ICoordinateSequenceFactory coordinateSequenceFactory); 74 | 75 | /// 76 | /// Creates a geometry factory using the given along with and . 77 | /// 78 | /// The coordinate sequence factory to use. 79 | /// The geometry factory. 80 | IGeometryFactory CreateGeometryFactory(IPrecisionModel precisionModel); 81 | 82 | /// 83 | /// Creates a geometry factory using the given along with and . 84 | /// 85 | /// The coordinate sequence factory to use. 86 | /// The spatial reference id. 87 | /// The geometry factory. 88 | IGeometryFactory CreateGeometryFactory(IPrecisionModel precisionModel, int srid); 89 | 90 | /// 91 | /// Creates a geometry factory using the given , 92 | /// and . 93 | /// 94 | /// The coordinate sequence factory to use. 95 | /// The spatial reference id. 96 | /// The coordinate sequence factory. 97 | /// The geometry factory. 98 | IGeometryFactory CreateGeometryFactory(IPrecisionModel precisionModel, int srid, 99 | ICoordinateSequenceFactory coordinateSequenceFactory); 100 | 101 | /// 102 | /// Reads the configuration from the configuration 103 | /// 104 | void ReadConfiguration(); 105 | 106 | /// 107 | /// Writes the current configuration to the configuration 108 | /// 109 | void WriteConfiguration(); 110 | } 111 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/Ordinates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GeoAPI.Geometries 4 | { 5 | /// 6 | /// Flags for Ordinate values 7 | /// 8 | [Flags] 9 | public enum Ordinates 10 | { 11 | /// 12 | /// No ordinates 13 | /// 14 | None = 0, 15 | 16 | /// 17 | /// Flag for the x-ordinate 18 | /// 19 | X = 1, 20 | 21 | /// 22 | /// Flag for the y-ordinate 23 | /// 24 | Y = 2, 25 | 26 | /// 27 | /// Flag for both x- and y-ordinate 28 | /// 29 | XY = X | Y, 30 | 31 | /// 32 | /// Flag for the z-ordinate 33 | /// 34 | Z = 4, 35 | 36 | /// 37 | /// Flag for x-, y- and z-ordinate 38 | /// 39 | XYZ = XY | Z, 40 | 41 | /// 42 | /// Flag for the m-ordinate 43 | /// 44 | M = 8, 45 | 46 | /// 47 | /// Flag for x-, y- and m-ordinate 48 | /// 49 | XYM = XY | M, 50 | 51 | /// 52 | /// Flag for x-, y-, z- and m-ordinate 53 | /// 54 | XYZM = XYZ | M, 55 | 56 | /// 57 | /// Flag for ordinate at index 2 58 | /// 59 | Ordinate2 = 1 << Ordinate.Ordinate2, 60 | /// 61 | /// Flag for ordinate at index 2 62 | /// 63 | Ordinate3 = 1 << Ordinate.Ordinate3, 64 | /// 65 | /// Flag for ordinate at index 2 66 | /// 67 | Ordinate4 = 1 << Ordinate.Ordinate4, 68 | /// 69 | /// Flag for ordinate at index 2 70 | /// 71 | Ordinate5 = 1 << Ordinate.Ordinate5, 72 | /// 73 | /// Flag for ordinate at index 2 74 | /// 75 | Ordinate6 = 1 << Ordinate.Ordinate6, 76 | /// 77 | /// Flag for ordinate at index 2 78 | /// 79 | Ordinate7 = 1 << Ordinate.Ordinate7, 80 | /// 81 | /// Flag for ordinate at index 2 82 | /// 83 | Ordinate8 = 1 << Ordinate.Ordinate8, 84 | /// 85 | /// Flag for ordinate at index 2 86 | /// 87 | Ordinate9 = 1 << Ordinate.Ordinate9, 88 | /// 89 | /// Flag for ordinate at index 10 90 | /// 91 | Ordinate10 = 1 << Ordinate.Ordinate10, 92 | /// 93 | /// Flag for ordinate at index 11 94 | /// 95 | Ordinate11 = 1 << Ordinate.Ordinate11, 96 | /// 97 | /// Flag for ordinate at index 12 98 | /// 99 | Ordinate12 = 1 << Ordinate.Ordinate12, 100 | /// 101 | /// Flag for ordinate at index 13 102 | /// 103 | Ordinate13 = 1 << Ordinate.Ordinate13, 104 | /// 105 | /// Flag for ordinate at index 14 106 | /// 107 | Ordinate14 = 1 << Ordinate.Ordinate14, 108 | /// 109 | /// Flag for ordinate at index 15 110 | /// 111 | Ordinate15 = 1 << Ordinate.Ordinate15, 112 | /// 113 | /// Flag for ordinate at index 16 114 | /// 115 | Ordinate16 = 1 << Ordinate.Ordinate16, 116 | /// 117 | /// Flag for ordinate at index 17 118 | /// 119 | Ordinate17 = 1 << Ordinate.Ordinate17, 120 | /// 121 | /// Flag for ordinate at index 18 122 | /// 123 | Ordinate18 = 1 << Ordinate.Ordinate18, 124 | /// 125 | /// Flag for ordinate at index 19 126 | /// 127 | Ordinate19 = 1 << Ordinate.Ordinate19, 128 | /// 129 | /// Flag for ordinate at index 20 130 | /// 131 | Ordinate20 = 1 << Ordinate.Ordinate20, 132 | /// 133 | /// Flag for ordinate at index 21 134 | /// 135 | Ordinate21 = 1 << Ordinate.Ordinate21, 136 | /// 137 | /// Flag for ordinate at index 22 138 | /// 139 | Ordinate22 = 1 << Ordinate.Ordinate22, 140 | /// 141 | /// Flag for ordinate at index 23 142 | /// 143 | Ordinate23 = 1 << Ordinate.Ordinate23, 144 | /// 145 | /// Flag for ordinate at index 24 146 | /// 147 | Ordinate24 = 1 << Ordinate.Ordinate24, 148 | /// 149 | /// Flag for ordinate at index 25 150 | /// 151 | Ordinate25 = 1 << Ordinate.Ordinate25, 152 | /// 153 | /// Flag for ordinate at index 26 154 | /// 155 | Ordinate26 = 1 << Ordinate.Ordinate26, 156 | /// 157 | /// Flag for ordinate at index 27 158 | /// 159 | Ordinate27 = 1 << Ordinate.Ordinate27, 160 | /// 161 | /// Flag for ordinate at index 28 162 | /// 163 | Ordinate28 = 1 << Ordinate.Ordinate28, 164 | /// 165 | /// Flag for ordinate at index 29 166 | /// 167 | Ordinate29 = 1 << Ordinate.Ordinate29, 168 | /// 169 | /// Flag for ordinate at index 30 170 | /// 171 | Ordinate30 = 1 << Ordinate.Ordinate30, 172 | /// 173 | /// Flag for ordinate at index 31 174 | /// 175 | Ordinate31 = 1 << Ordinate.Ordinate31, 176 | /// 177 | /// Flag for ordinate at index 32 178 | /// 179 | Ordinate32 = 1 << Ordinate.Ordinate32, 180 | } 181 | } -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/ICoordinateSystemAuthorityFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace GeoAPI.CoordinateSystems 19 | { 20 | /// 21 | /// Creates spatial reference objects using codes. 22 | /// 23 | /// 24 | /// The codes are maintained by an external authority. A commonly used authority is EPSG, which is also used in the GeoTIFF standard and in SharpMap. 25 | /// 26 | public interface ICoordinateSystemAuthorityFactory 27 | { 28 | /// 29 | /// Returns the authority name for this factory (e.g., "EPSG" or "POSC"). 30 | /// 31 | string Authority { get; } 32 | 33 | /// 34 | /// Returns a projected coordinate system object corresponding to the given code. 35 | /// 36 | /// The identification code. 37 | /// The projected coordinate system object with the given code. 38 | IProjectedCoordinateSystem CreateProjectedCoordinateSystem(long code); 39 | 40 | /// 41 | /// Returns a geographic coordinate system object corresponding to the given code. 42 | /// 43 | /// The identification code. 44 | /// The geographic coordinate system object with the given code. 45 | IGeographicCoordinateSystem CreateGeographicCoordinateSystem(long code); 46 | 47 | /// 48 | /// Returns a horizontal datum object corresponding to the given code. 49 | /// 50 | /// The identification code. 51 | /// The horizontal datum object with the given code. 52 | IHorizontalDatum CreateHorizontalDatum(long code); 53 | 54 | /// 55 | /// Returns an ellipsoid object corresponding to the given code. 56 | /// 57 | /// The identification code. 58 | /// The ellipsoid object with the given code. 59 | IEllipsoid CreateEllipsoid(long code); 60 | 61 | /// 62 | /// Returns a prime meridian object corresponding to the given code. 63 | /// 64 | /// The identification code. 65 | /// The prime meridian object with the given code. 66 | IPrimeMeridian CreatePrimeMeridian(long code); 67 | 68 | /// 69 | /// Returns a linear unit object corresponding to the given code. 70 | /// 71 | /// The identification code. 72 | /// The linear unit object with the given code. 73 | ILinearUnit CreateLinearUnit(long code); 74 | 75 | /// 76 | /// Returns an angular unit object corresponding to the given code. 77 | /// 78 | /// The identification code. 79 | /// The angular unit object for the given code. 80 | IAngularUnit CreateAngularUnit(long code); 81 | 82 | /// 83 | /// Creates a from a code. 84 | /// 85 | /// Authority code 86 | /// Vertical datum for the given code 87 | IVerticalDatum CreateVerticalDatum(long code); 88 | 89 | /// 90 | /// Create a vertical coordinate system from a code. 91 | /// 92 | /// Authority code 93 | /// 94 | IVerticalCoordinateSystem CreateVerticalCoordinateSystem(long code); 95 | 96 | /// 97 | /// Creates a 3D coordinate system from a code. 98 | /// 99 | /// Authority code 100 | /// Compound coordinate system for the given code 101 | ICompoundCoordinateSystem CreateCompoundCoordinateSystem(long code); 102 | 103 | /// 104 | /// Creates a horizontal co-ordinate system from a code. 105 | /// The horizontal coordinate system could be geographic or projected. 106 | /// 107 | /// Authority code 108 | /// Horizontal coordinate system for the given code 109 | IHorizontalCoordinateSystem CreateHorizontalCoordinateSystem(long code); 110 | 111 | /// 112 | /// Gets a description of the object corresponding to a code. 113 | /// 114 | string DescriptionText { get; } 115 | 116 | /// 117 | /// Gets the Geoid code from a WKT name. 118 | /// 119 | /// 120 | /// In the OGC definition of WKT horizontal datums, the geoid is referenced 121 | /// by a quoted string, which is used as a key value. This method converts 122 | /// the key value string into a code recognized by this authority. 123 | /// 124 | /// 125 | /// 126 | string GeoidFromWktName(string wkt); 127 | 128 | /// 129 | /// Gets the WKT name of a Geoid. 130 | /// 131 | /// 132 | /// In the OGC definition of WKT horizontal datums, the geoid is referenced by 133 | /// a quoted string, which is used as a key value. This method gets the OGC WKT 134 | /// key value from a geoid code. 135 | /// 136 | /// 137 | /// 138 | string WktGeoidName(string geoid); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /GeoAPI/Geometries/Prepared/IPreparedGeometry.cs: -------------------------------------------------------------------------------- 1 | namespace GeoAPI.Geometries.Prepared 2 | { 3 | 4 | /// 5 | /// An interface for classes which prepare s 6 | /// in order to optimize the performance of repeated calls to specific geometric operations. 7 | /// 8 | /// 9 | /// 10 | /// A given implementation may provide optimized implementations 11 | /// for only some of the specified methods, and delegate the remaining 12 | /// methods to the original operations. 13 | /// 14 | /// 15 | /// An implementation may also only optimize certain situations, and delegate others. 16 | /// See the implementing classes for documentation about which methods and situations 17 | /// they optimize. 18 | /// 19 | /// Subclasses are intended to be thread-safe, to allow IPreparedGeometry 20 | /// to be used in a multi-threaded context 21 | /// (which allows extracting maximum benefit from the prepared state). 22 | /// 23 | /// 24 | /// Martin Davis 25 | public interface IPreparedGeometry 26 | { 27 | /// 28 | /// Gets the original which has been prepared. 29 | /// 30 | IGeometry Geometry { get; } 31 | 32 | /// 33 | /// Tests whether the base contains a given geometry. 34 | /// 35 | /// The Geometry to test 36 | /// true if this Geometry contains the given Geometry 37 | /// 38 | bool Contains(IGeometry geom); 39 | 40 | /// 41 | /// Tests whether the base contains a given geometry. 42 | /// 43 | /// 44 | /// 45 | /// The ContainsProperly predicate has the following equivalent definitions: 46 | /// 47 | /// Every point of the other geometry is a point of this geometry's interior. 48 | /// The DE-9IM Intersection Matrix for the two geometries matches >[T**FF*FF*] 49 | /// 50 | /// The advantage to using this predicate is that it can be computed 51 | /// efficiently, with no need to compute topology at individual points. 52 | /// 53 | /// 54 | /// An example use case for this predicate is computing the intersections 55 | /// of a set of geometries with a large polygonal geometry. 56 | /// Since intersection is a fairly slow operation, it can be more efficient 57 | /// to use containsProperly to filter out test geometries which lie 58 | /// wholly inside the area. In these cases the intersection 59 | /// known a priori to be simply the original test geometry. 60 | /// 61 | /// 62 | /// The geometry to test 63 | /// true if this geometry properly contains the given geometry 64 | //// 65 | bool ContainsProperly(IGeometry geom); 66 | 67 | /// 68 | /// Tests whether the base is covered by a given geometry. 69 | /// 70 | /// The geometry to test 71 | /// true if this geometry is covered by the given geometry 72 | /// 73 | bool CoveredBy(IGeometry geom); 74 | 75 | /// 76 | /// Tests whether the base covers a given geometry. 77 | /// 78 | /// The geometry to test 79 | /// true if this geometry covers the given geometry 80 | /// 81 | bool Covers(IGeometry geom); 82 | 83 | /// 84 | /// Tests whether the base crosses a given geometry. 85 | /// 86 | /// The geometry to test 87 | /// true if this geometry crosses the given geometry 88 | /// 89 | bool Crosses(IGeometry geom); 90 | 91 | /// 92 | /// Tests whether the base is disjoint from given geometry. 93 | /// 94 | /// 95 | /// This method supports s as input 96 | /// 97 | /// The geometry to test 98 | /// true if this geometry is disjoint from the given geometry 99 | /// 100 | bool Disjoint(IGeometry geom); 101 | 102 | /// 103 | /// Tests whether the base intersects a given geometry. 104 | /// 105 | /// 106 | /// This method supports s as input 107 | /// 108 | /// The geometry to test 109 | /// true if this geometry intersects the given geometry 110 | /// 111 | bool Intersects(IGeometry geom); 112 | 113 | /// 114 | /// Tests whether the base overlaps a given geometry. 115 | /// 116 | /// The geometry to test 117 | /// true if this geometry overlaps the given geometry 118 | /// 119 | bool Overlaps(IGeometry geom); 120 | 121 | /// 122 | /// Tests whether the base touches a given geometry. 123 | /// 124 | /// The geometry to test 125 | /// true if this geometry touches the given geometry 126 | /// 127 | bool Touches(IGeometry geom); 128 | 129 | /// 130 | /// Tests whether the base is within a given geometry. 131 | /// 132 | /// The geometry to test 133 | /// true if this geometry is within the given geometry 134 | /// 135 | bool Within(IGeometry geom); 136 | 137 | } 138 | } -------------------------------------------------------------------------------- /.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) 32 | 33 | 34 | 35 | 36 | $(SolutionDir).nuget 37 | packages.config 38 | 39 | 40 | 41 | 42 | $(NuGetToolsPath)\NuGet.exe 43 | @(PackageSource) 44 | 45 | "$(NuGetExePath)" 46 | mono --runtime=v4.0.30319 $(NuGetExePath) 47 | 48 | $(TargetDir.Trim('\\')) 49 | 50 | -RequireConsent 51 | -NonInteractive 52 | 53 | 54 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir "$(SolutionDir) " 55 | $(NuGetCommand) pack "$(ProjectPath)" -Properties Configuration=$(Configuration) $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 56 | 57 | 58 | 59 | RestorePackages; 60 | $(BuildDependsOn); 61 | 62 | 63 | 64 | 65 | $(BuildDependsOn); 66 | BuildPackage; 67 | 68 | 69 | 70 | 71 | 72 | 73 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | 95 | 97 | 98 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /GeoAPI/CoordinateSystems/Transformations/IMathTransformFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2005, 2006 - Morten Nielsen (www.iter.dk) 2 | // 3 | // This file is part of SharpMap. 4 | // SharpMap is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // SharpMap is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with SharpMap; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | using System.Collections.Generic; 19 | 20 | namespace GeoAPI.CoordinateSystems.Transformations 21 | { 22 | /// 23 | /// Creates math transforms. 24 | /// 25 | /// 26 | /// CT_MathTransformFactory is a low level factory that is used to create CT_MathTransform objects. Many high level GIS applications will never need to use a CT_MathTransformFactory directly; they can use a CT_CoordinateTransformationFactory instead. However, the CT_MathTransformFactory interface is specified here, since it can be used directly by applications that wish to transform other types of coordinates (e.g. color coordinates, or image pixel coordinates). 27 | /// The following comments assume that the same vendor implements the math transform factory interfaces and math transform interfaces. 28 | /// A math transform is an object that actually does the work of applying formulae to coordinate values. The math transform does not know or care how the coordinates relate to positions in the real world. This lack of semantics makes implementing CT_MathTransformFactory significantly easier than it would be otherwise. 29 | /// For example CT_MathTransformFactory can create affine math transforms. The affine transform applies a matrix to the coordinates without knowing how what it is doing relates to the real world. So if the matrix scales Z values by a factor of 1000, then it could be converting meters into millimeters, or it could be converting kilometers into meters. 30 | /// Because math transforms have low semantic value (but high mathematical value), programmers who do not have much knowledge of how GIS applications use coordinate systems, or how those coordinate systems relate to the real world can implement CT_MathTransformFactory. 31 | /// The low semantic content of math transforms also means that they will be useful in applications that have nothing to do with GIS coordinates. For example, a math transform could be used to map color coordinates between different color spaces, such as converting (red, green, blue) colors into (hue, light, saturation) colors. 32 | /// Since a math transform does not know what its source and target coordinate systems mean, it is not necessary or desirable for a math transform object to keep information on its source and target coordinate systems. 33 | /// 34 | public interface IMathTransformFactory 35 | { 36 | /// 37 | /// Creates an affine transform from a matrix. 38 | /// 39 | /// If the transform's input dimension is M, and output dimension is N, then the matrix will have size [N+1][M+1]. The +1 in the matrix dimensions allows the matrix to do a shift, as well as a rotation. The [M][j] element of the matrix will be the j'th ordinate of the moved origin. The [i][N] element of the matrix will be 0 for i less than M, and 1 for i equals M. 40 | /// 41 | /// 42 | IMathTransform CreateAffineTransform(double[,] matrix); 43 | 44 | /// 45 | /// Creates a transform by concatenating two existing transforms. A concatenated transform acts in the same way as applying two transforms, one after the other. 46 | /// 47 | /// The dimension of the output space of the first transform must match the dimension of the input space in the second transform. If you wish to concatenate more than two transforms, then you can repeatedly use this method. 48 | /// 49 | /// 50 | /// 51 | IMathTransform CreateConcatenatedTransform(IMathTransform transform1, IMathTransform transform2); 52 | 53 | /// 54 | /// Creates a math transform from a Well-Known Text string. 55 | /// 56 | /// 57 | /// 58 | IMathTransform CreateFromWKT(string wkt); 59 | 60 | /// 61 | /// Creates a math transform from XML. 62 | /// 63 | /// 64 | /// 65 | IMathTransform CreateFromXML(string xml); 66 | 67 | /// 68 | /// Creates a transform from a classification name and parameters. 69 | /// 70 | /// 71 | /// The client must ensure that all the linear parameters are expressed in meters, and all the angular parameters are expressed in degrees. Also, they must supply "semi_major" and "semi_minor" parameters for cartographic projection transforms. 72 | /// 73 | /// 74 | /// 75 | /// 76 | IMathTransform CreateParameterizedTransform(string classification, List parameters); 77 | 78 | /// 79 | /// Creates a transform which passes through a subset of ordinates to another transform. 80 | /// 81 | /// 82 | /// This allows transforms to operate on a subset of ordinates. For example, if you have (Lat,Lon,Height) coordinates, then you may wish to convert the height values from meters to feet without affecting the (Lat,Lon) values. If you wanted to affect the (Lat,Lon) values and leave the Height values alone, then you would have to swap the ordinates around to (Height,Lat,Lon). You can do this with an affine map. 83 | /// 84 | /// 85 | /// 86 | /// 87 | IMathTransform CreatePassThroughTransform(int firstAffectedOrdinate, IMathTransform subTransform); 88 | 89 | /// 90 | /// Tests whether parameter is angular. Clients must ensure that all angular parameter values are in degrees. 91 | /// 92 | /// 93 | /// 94 | bool IsParameterAngular(string parameterName); 95 | 96 | /// 97 | /// Tests whether parameter is linear. Clients must ensure that all linear parameter values are in meters. 98 | /// 99 | /// 100 | /// 101 | bool IsParameterLinear(string parameterName); 102 | } 103 | } -------------------------------------------------------------------------------- /GeoAPI/Geometries/ICoordinateSequence.cs: -------------------------------------------------------------------------------- 1 | #if PCL 2 | using ICloneable = GeoAPI.ICloneable; 3 | #else 4 | using System; 5 | #endif 6 | 7 | namespace GeoAPI.Geometries 8 | { 9 | /// 10 | /// The internal representation of a list of coordinates inside a Geometry. 11 | /// 12 | /// This allows Geometries to store their 13 | /// points using something other than the NTS class. 14 | /// For example, a storage-efficient implementation 15 | /// might store coordinate sequences as an array of x's 16 | /// and an array of y's. 17 | /// Or a custom coordinate class might support extra attributes like M-values. 18 | /// 19 | /// 20 | /// Implementing a custom coordinate storage structure 21 | /// requires implementing the and 22 | /// interfaces. 23 | /// To use the custom CoordinateSequence, create a 24 | /// new parameterized by the CoordinateSequenceFactory 25 | /// The can then be used to create new s. 26 | /// The new Geometries will use the custom CoordinateSequence implementation. 27 | /// 28 | /// 29 | ///// 30 | ///// For an example see 31 | ///// 32 | ///// 33 | ///// 34 | ///// 35 | public interface ICoordinateSequence 36 | : ICloneable 37 | { 38 | /// 39 | /// Returns the dimension (number of ordinates in each coordinate) for this sequence. 40 | /// 41 | int Dimension { get; } 42 | 43 | /// 44 | /// Returns the kind of ordinates this sequence supplys. . 45 | /// 46 | Ordinates Ordinates { get; } 47 | 48 | /// 49 | /// Returns the number of coordinates in this sequence. 50 | /// 51 | int Count { get;} 52 | 53 | /// 54 | /// Returns (possibly a copy of) the ith Coordinate in this collection. 55 | /// Whether or not the Coordinate returned is the actual underlying 56 | /// Coordinate or merely a copy depends on the implementation. 57 | /// Note that in the future the semantics of this method may change 58 | /// to guarantee that the Coordinate returned is always a copy. Callers are 59 | /// advised not to assume that they can modify a CoordinateSequence by 60 | /// modifying the Coordinate returned by this method. 61 | /// 62 | /// 63 | /// 64 | Coordinate GetCoordinate(int i); 65 | 66 | /// 67 | /// Returns a copy of the i'th coordinate in this sequence. 68 | /// This method optimizes the situation where the caller is 69 | /// going to make a copy anyway - if the implementation 70 | /// has already created a new Coordinate object, no further copy is needed. 71 | /// 72 | /// The index of the coordinate to retrieve. 73 | /// A copy of the i'th coordinate in the sequence 74 | Coordinate GetCoordinateCopy(int i); 75 | 76 | /// 77 | /// Copies the i'th coordinate in the sequence to the supplied Coordinate. 78 | /// At least the first two dimensions must be copied. 79 | /// 80 | /// The index of the coordinate to copy. 81 | /// A Coordinate to receive the value. 82 | void GetCoordinate(int index, Coordinate coord); 83 | 84 | /// 85 | /// Returns ordinate X (0) of the specified coordinate. 86 | /// 87 | /// 88 | /// The value of the X ordinate in the index'th coordinate. 89 | double GetX(int index); 90 | 91 | /// 92 | /// Returns ordinate Y (1) of the specified coordinate. 93 | /// 94 | /// 95 | /// The value of the Y ordinate in the index'th coordinate. 96 | double GetY(int index); 97 | 98 | /// 99 | /// Returns the ordinate of a coordinate in this sequence. 100 | /// Ordinate indices 0 and 1 are assumed to be X and Y. 101 | /// Ordinate indices greater than 1 have user-defined semantics 102 | /// (for instance, they may contain other dimensions or measure values). 103 | /// 104 | /// 105 | /// If the sequence does not provide value for the required ordinate, the implementation must not throw an exception, it should return . 106 | /// 107 | /// The coordinate index in the sequence. 108 | /// The ordinate index in the coordinate (in range [0, dimension-1]). 109 | /// The ordinate value, or if the sequence does not provide values for "/> 110 | double GetOrdinate(int index, Ordinate ordinate); 111 | 112 | /// 113 | /// Sets the value for a given ordinate of a coordinate in this sequence. 114 | /// 115 | /// 116 | /// If the sequence can't store the ordinate value, the implementation must not throw an exception, it should simply ignore the call. 117 | /// 118 | /// The coordinate index in the sequence. 119 | /// The ordinate index in the coordinate (in range [0, dimension-1]). 120 | /// The new ordinate value. 121 | void SetOrdinate(int index, Ordinate ordinate, double value); 122 | 123 | /// 124 | /// Returns (possibly copies of) the Coordinates in this collection. 125 | /// Whether or not the Coordinates returned are the actual underlying 126 | /// Coordinates or merely copies depends on the implementation. Note that 127 | /// if this implementation does not store its data as an array of Coordinates, 128 | /// this method will incur a performance penalty because the array needs to 129 | /// be built from scratch. 130 | /// 131 | /// 132 | Coordinate[] ToCoordinateArray(); 133 | 134 | /// 135 | /// Expands the given Envelope to include the coordinates in the sequence. 136 | /// Allows implementing classes to optimize access to coordinate values. 137 | /// 138 | /// The envelope to expand. 139 | /// A reference to the expanded envelope. 140 | Envelope ExpandEnvelope(Envelope env); 141 | 142 | /// 143 | /// Creates a reversed version of this coordinate sequence with cloned s 144 | /// 145 | /// A reversed version of this sequence 146 | ICoordinateSequence Reversed(); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /GeoAPI/IO/GeometryType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GeoAPI.Geometries; 3 | 4 | namespace GeoAPI.IO 5 | { 6 | /// 7 | /// Lightweight class that handles OGC Geometry type declaration 8 | /// 9 | [CLSCompliant(false)] 10 | public struct GeometryType 11 | { 12 | /// 13 | /// Initializes this instance 14 | /// 15 | /// The value describing the 16 | public GeometryType(uint geometryType) 17 | { 18 | _geometrytype = geometryType; 19 | } 20 | 21 | /// 22 | /// Inititalizes this instance based on a geometry and an Ordinates flag. 23 | /// 24 | /// The geometry. 25 | /// The ordinates flag. 26 | public GeometryType(IGeometry geometry, Ordinates ordinates) 27 | : this(geometry.OgcGeometryType, ordinates, geometry.SRID >= 0) 28 | { 29 | } 30 | 31 | /// 32 | /// Inititalizes this instance based on an 33 | /// 34 | /// The OGC geometry type 35 | public GeometryType(OgcGeometryType ogcGeometryType) 36 | : this(ogcGeometryType, Ordinates.XY, false) 37 | { 38 | 39 | } 40 | 41 | /// 42 | /// Inititalizes this instance based on an and an SRID indicator 43 | /// 44 | /// The OGC geometry type 45 | /// Indicator if a SRID is supplied. 46 | public GeometryType(OgcGeometryType ogcGeometryType, bool hasSrid) 47 | :this(ogcGeometryType, Ordinates.XY, hasSrid) 48 | { 49 | } 50 | 51 | /// 52 | /// Inititalizes this instance based on an and an SRID indicator 53 | /// 54 | /// The OGC geometry type 55 | /// The ordinates flag. 56 | /// Indicator if a SRID is supplied. 57 | public GeometryType(OgcGeometryType ogcGeometryType, Ordinates ordinates, bool hasSrid) 58 | { 59 | _geometrytype = (uint) ogcGeometryType; 60 | 61 | if ((ordinates & Ordinates.Z) != 0) 62 | { 63 | HasWkbZ = true; 64 | HasEwkbM = true; 65 | } 66 | 67 | if ((ordinates & Ordinates.M) != 0) 68 | { 69 | HasWkbZ = true; 70 | HasEwkbM = true; 71 | } 72 | 73 | HasEwkbSrid = hasSrid; 74 | } 75 | 76 | private uint _geometrytype; 77 | 78 | /// 79 | /// Gets or sets the base geometry type 80 | /// 81 | public OgcGeometryType BaseGeometryType 82 | { 83 | get 84 | { 85 | //Leave out Ewkb flags 86 | var val = _geometrytype & 0xffffff; 87 | if (val > 2000) val -= 2000; 88 | if (val > 1000) val -= 1000; 89 | return (OgcGeometryType) val; 90 | } 91 | set 92 | { 93 | var ewkbFlags = _geometrytype & EwkbFlags; 94 | var newGeometryType = (uint) value; 95 | if (HasWkbZ) newGeometryType += 1000; 96 | if (HasWkbM) newGeometryType += 2000; 97 | _geometrytype = ewkbFlags | newGeometryType; 98 | } 99 | } 100 | 101 | /// 102 | /// Gets the OGC Well-Known-Binary type code 103 | /// 104 | public int WkbGeometryType 105 | { 106 | get { return (int) (_geometrytype & 0x1ffffff); } 107 | } 108 | 109 | /// 110 | /// Gets the PostGIS Enhanced Well-Known-Binary type code 111 | /// 112 | public int EwkbWkbGeometryType 113 | { 114 | get 115 | { 116 | return (int) ((uint) BaseGeometryType | (_geometrytype & 0xfe000000)); 117 | } 118 | } 119 | 120 | /// 121 | /// Gets or sets whether z-ordinate values are stored along with the geometry. 122 | /// 123 | public bool HasZ { get { return HasWkbZ | HasEwkbZ; } } 124 | 125 | /// 126 | /// Gets or sets whether m-ordinate values are stored along with the geometry. 127 | /// 128 | public bool HasM { get { return HasWkbM | HasEwkbM; } } 129 | 130 | /// 131 | /// Gets whether SRID value is stored along with the geometry. 132 | /// 133 | public bool HasSrid { get { return HasEwkbSrid; } } 134 | 135 | /// 136 | /// Gets or sets whether z-ordinate values are stored along with the geometry. 137 | /// 138 | public bool HasWkbZ 139 | { 140 | get { return (_geometrytype/1000) == 1; } 141 | set 142 | { 143 | if (value == HasWkbZ) 144 | return; 145 | if (HasWkbZ) 146 | _geometrytype -= 1000; 147 | else 148 | _geometrytype += 1000; 149 | 150 | } 151 | } 152 | 153 | /// 154 | /// Gets or sets whether m-ordinate values are stored along with the geometry. 155 | /// 156 | public bool HasWkbM 157 | { 158 | get { return (_geometrytype/2000) == 2; } 159 | set 160 | { 161 | if (value == HasWkbM) 162 | return; 163 | if (HasWkbM) 164 | _geometrytype -= 2000; 165 | else 166 | _geometrytype += 2000; 167 | 168 | } 169 | } 170 | 171 | #region PostGis EWKB/EWKT 172 | 173 | private const uint EwkbZFlag = 0x8000000; 174 | private const uint EwkbMFlag = 0x4000000; 175 | private const uint EwkbSridFlag = 0x2000000; 176 | 177 | private const uint EwkbFlags = EwkbZFlag | EwkbMFlag | EwkbSridFlag; 178 | 179 | /// 180 | /// Gets or sets whether z-ordinates are stored along with the geometry. 181 | /// PostGis EWKB format. 182 | /// 183 | public bool HasEwkbZ 184 | { 185 | get { return (_geometrytype & EwkbZFlag) == EwkbZFlag; } 186 | set 187 | { 188 | var gt = _geometrytype & (~EwkbZFlag); 189 | if (value) 190 | gt = _geometrytype | EwkbZFlag; 191 | _geometrytype = gt; 192 | } 193 | } 194 | 195 | /// 196 | /// Gets or sets whether z-ordinates are stored along with the geometry. 197 | /// PostGis EWKB format. 198 | /// 199 | public bool HasEwkbM 200 | { 201 | get { return (_geometrytype & EwkbMFlag) == EwkbMFlag; } 202 | set 203 | { 204 | var gt = _geometrytype & (~EwkbMFlag); 205 | if (value) 206 | gt = _geometrytype | EwkbMFlag; 207 | _geometrytype = gt; 208 | } 209 | } 210 | 211 | /// 212 | /// Gets or sets whether z-ordinates are stored along with the geometry. 213 | /// PostGis EWKB format. 214 | /// 215 | public bool HasEwkbSrid 216 | { 217 | get { return (_geometrytype & EwkbSridFlag) == EwkbSridFlag; } 218 | set { 219 | var gt = _geometrytype & (~EwkbSridFlag); 220 | if (value) 221 | gt = _geometrytype | EwkbSridFlag; 222 | _geometrytype = gt; 223 | } 224 | } 225 | 226 | #endregion 227 | } 228 | } -------------------------------------------------------------------------------- /GeoAPI/GeoAPI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildThisFileDirectory)\.. 6 | Debug 7 | Any CPU 8 | 8.0.50727 9 | 2.0 10 | {FFB69466-79DE-466A-ADA7-5C47C5C5CA3A} 11 | Library 12 | Properties 13 | GeoAPI 14 | DotSpatial.GeoAPI 15 | true 16 | ..\geoapi.snk 17 | v4.0 18 | Client 19 | 20 | 21 | true 22 | full 23 | false 24 | $(SolutionDir)$(Configuration)\$(TargetFrameworkIdentifier)$(TargetFrameworkVersion)\$(Platform)\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | 1591 31 | 32 | 33 | pdbonly 34 | true 35 | $(SolutionDir)$(Configuration)\$(TargetFrameworkVersion)\$(Platform)\ 36 | TRACE 37 | prompt 38 | 4 39 | ..\Release\v4.0\AnyCPU\DotSpatial.GeoAPI.xml 40 | 1591 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | geoapi.snk 142 | 143 | 144 | 145 | 146 | 147 | 148 | 150 | 151 | 152 | 153 | 160 | --------------------------------------------------------------------------------