Skip to content

Commit

Permalink
Getting SharpMap.SimpleGeometries to build.
Browse files Browse the repository at this point in the history
Project file reorganization to use Common.msbuild during solution for using project references or binary references.
Updating to use WktEncoder and WkbEncoder
  • Loading branch information
codekaizen committed Jan 18, 2008
1 parent 6a60376 commit 5f999ce
Show file tree
Hide file tree
Showing 32 changed files with 1,073 additions and 729 deletions.
15 changes: 15 additions & 0 deletions Common.msbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Net20|AnyCPU' ">
<UseProjectReference>false</UseProjectReference>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Net20|AnyCPU' ">
<UseProjectReference>false</UseProjectReference>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Net35|AnyCPU' ">
<UseProjectReference>false</UseProjectReference>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Net35|AnyCPU' ">
<UseProjectReference>false</UseProjectReference>
</PropertyGroup>
</Project>
132 changes: 129 additions & 3 deletions Proj.Net/ProjNet/CoordinateSystems/CoordinateSystemFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public ICoordinateSystem<TCoordinate> CreateFromXml(String xml)
/// </returns>
public ICoordinateSystem<TCoordinate> CreateFromWkt(String Wkt)
{
return CoordinateSystemWktReader.Parse(Wkt, this) as ICoordinateSystem<TCoordinate>;
return WktEncoder.ToCoordinateSystemInfo(Wkt, this) as ICoordinateSystem<TCoordinate>;
}

/// <summary>
Expand Down Expand Up @@ -704,9 +704,135 @@ public IVerticalDatum CreateVerticalDatum(DatumType datumType, String name, Stri
throw new NotImplementedException();
}

IGeocentricCoordinateSystem ICoordinateSystemFactory.CreateWgs84CoordinateSystem()
#endregion

#region ICoordinateSystemFactory Members


public IAngularUnit CreateAngularUnit(CommonAngularUnits angularUnitType)
{
throw new NotImplementedException();
switch (angularUnitType)
{
case CommonAngularUnits.Radian:
return AngularUnit.Radian;
case CommonAngularUnits.Degree:
return AngularUnit.Degrees;
case CommonAngularUnits.Grad:
return AngularUnit.Grad;
case CommonAngularUnits.Gon:
return AngularUnit.Gon;
default:
throw new ArgumentException("Unknown angular unit: " + angularUnitType);
}
}

public IEllipsoid CreateEllipsoid(CommonEllipsoids ellipsoidType)
{
switch (ellipsoidType)
{
case CommonEllipsoids.Wgs84:
return Ellipsoid.Wgs84;
case CommonEllipsoids.Wgs72:
return Ellipsoid.Wgs72;
case CommonEllipsoids.Grs80:
return Ellipsoid.Grs80;
case CommonEllipsoids.International1924:
return Ellipsoid.International1924;
case CommonEllipsoids.Clarke1880:
return Ellipsoid.Clarke1880;
case CommonEllipsoids.Clarke1866:
return Ellipsoid.Clarke1866;
case CommonEllipsoids.Grs80AuthalicSphere:
return Ellipsoid.Sphere;
default:
throw new ArgumentException("Unknown ellipsoid: " + ellipsoidType);
}
}

public IGeographicCoordinateSystem CreateGeographicCoordinateSystem(CommonGeographicCoordinateSystems coordSystemType)
{
switch (coordSystemType)
{
case CommonGeographicCoordinateSystems.Wgs84:
return GeographicCoordinateSystem<TCoordinate>.Wgs84;
default:
throw new ArgumentException(
"Unknown geographic coordinate system: " + coordSystemType);
}
}

public IHorizontalDatum CreateHorizontalDatum(CommonHorizontalDatums datumType)
{
switch (datumType)
{
case CommonHorizontalDatums.Wgs84:
return HorizontalDatum.Wgs84;
case CommonHorizontalDatums.Wgs72:
return HorizontalDatum.Wgs72;
case CommonHorizontalDatums.Etrf89:
return HorizontalDatum.Etrf89;
case CommonHorizontalDatums.ED50:
return HorizontalDatum.ED50;
case CommonHorizontalDatums.Nad27:
case CommonHorizontalDatums.Nad83:
case CommonHorizontalDatums.Harn:
default:
throw new ArgumentException("Unknown datum: " + datumType);
}
}

public ILinearUnit CreateLinearUnit(CommonLinearUnits linearUnitType)
{
switch (linearUnitType)
{
case CommonLinearUnits.Meter:
return LinearUnit.Meter;
case CommonLinearUnits.USSurveyFoot:
return LinearUnit.USSurveyFoot;
case CommonLinearUnits.NauticalMile:
return LinearUnit.NauticalMile;
case CommonLinearUnits.ClarkesFoot:
return LinearUnit.ClarkesFoot;
case CommonLinearUnits.InternationalFoot:
default:
throw new ArgumentException("Unknown linear unit: " + linearUnitType);
}
}

public IPrimeMeridian CreatePrimeMeridian(CommonPrimeMeridians primeMeridian)
{
switch (primeMeridian)
{
case CommonPrimeMeridians.Greenwich:
return PrimeMeridian.Greenwich;
case CommonPrimeMeridians.Lisbon:
return PrimeMeridian.Lisbon;
case CommonPrimeMeridians.Paris:
return PrimeMeridian.Paris;
case CommonPrimeMeridians.Bogota:
return PrimeMeridian.Bogota;
case CommonPrimeMeridians.Madrid:
return PrimeMeridian.Madrid;
case CommonPrimeMeridians.Rome:
return PrimeMeridian.Rome;
case CommonPrimeMeridians.Bern:
return PrimeMeridian.Bern;
case CommonPrimeMeridians.Jakarta:
return PrimeMeridian.Jakarta;
case CommonPrimeMeridians.Ferro:
return PrimeMeridian.Ferro;
case CommonPrimeMeridians.Brussels:
return PrimeMeridian.Brussels;
case CommonPrimeMeridians.Stockholm:
return PrimeMeridian.Stockholm;
case CommonPrimeMeridians.Athens:
return PrimeMeridian.Athens;
case CommonPrimeMeridians.Oslo:
return PrimeMeridian.Oslo;
case CommonPrimeMeridians.Antwerp:
default:
throw new ArgumentException("Unknown prime meridian: " + primeMeridian);
}
}

#endregion
Expand Down
71 changes: 46 additions & 25 deletions Proj.Net/ProjNet/ProjNet.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<Import Condition="Exists('..\..\Common.msbuild')" Project="..\..\Common.msbuild" />
<PropertyGroup Condition="!Exists('..\..\Common.msbuild')">
<UseProjectReference>false</UseProjectReference>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -11,18 +15,6 @@
<AssemblyName>ProjNet</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>projnetkey.snk</AssemblyOriginatorKeyFile>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Net20|AnyCPU' ">
Expand Down Expand Up @@ -107,19 +99,48 @@
<ItemGroup>
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
</ItemGroup>
<ItemGroup>
<Reference Include="NPack, Version=0.7.13341.0, Culture=neutral, PublicKeyToken=56f174b1685ddc6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ExternalReferences\$(Configuration)\NPack.dll</HintPath>
</Reference>
<Reference Include="GeoAPI, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a1a0da7def465678, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ExternalReferences\$(Configuration)\GeoAPI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core"
Condition="'$(Configuration)' == 'Release_Net35' Or '$(Configuration)' == 'Debug_Net35'" />
</ItemGroup>
<Choose>
<When Condition="'$(UseProjectReference)' == 'false'">
<ItemGroup>
<Reference Include="NPack, Version=0.7.13341.0, Culture=neutral, PublicKeyToken=56f174b1685ddc6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExternalReferences\$(Configuration)\NPack.dll</HintPath>
</Reference>
<Reference Include="GeoAPI, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a1a0da7def465678, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExternalReferences\$(Configuration)\GeoAPI.dll</HintPath>
</Reference>
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="NPack, Version=0.7.13341.0, Culture=neutral, PublicKeyToken=56f174b1685ddc6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExternalReferences\$(Configuration)\NPack.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\GeoAPI\src\GeoAPI\GeoAPINoTFS.csproj">
<Project>{FFB69466-79DE-466A-ADA7-5C47C5C5CA3A}</Project>
<Name>GeoAPINoTFS</Name>
</ProjectReference>
</ItemGroup>
</Otherwise>
</Choose>
<Choose>
<When Condition="'$(Configuration)' == 'Release_Net35' Or '$(Configuration)' == 'Debug_Net35'">
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
</Otherwise>
</Choose>

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2006, 2007 - Rory Plaire ([email protected])
// Portions copyright 2005, 2006 - Morten Nielsen (www.iter.dk)
// Portions copyright 2006, 2007 - Rory Plaire ([email protected])
//
// This file is part of SharpMap.
// SharpMap is free software; you can redistribute it and/or modify
Expand All @@ -17,10 +18,11 @@

using System;
using System.Collections.Generic;
using GeoAPI.Geometries;

namespace SharpMap.SimpleGeometries
{
internal static class BoundingBoxOperations
internal static class BoundingBoxSpatialOperations
{
internal static Geometry Difference(Extents lhs, Extents rhs)
{
Expand Down Expand Up @@ -52,9 +54,10 @@ internal static Geometry Difference(Extents lhs, Extents rhs)
}
}

internal static Geometry Intersection(Extents lhs, Extents rhs)
internal static Geometry Union(Extents lhs, Extents rhs)
{
return Extents.Intersection(lhs, rhs).ToGeometry();
Extents union = new Extents(lhs, rhs);
return union.ToGeometry();
}

internal static Geometry Union(Geometry lhs, Geometry rhs)
Expand Down Expand Up @@ -85,9 +88,28 @@ internal static Geometry Union(Geometry lhs, Geometry rhs)
return new Extents(lhs.Extents, rhs.Extents).ToGeometry();
}

internal static IGeometry Union(IGeometry lhs, IGeometry rhs)
{
return Union(
((Geometry)lhs).ExtentsInternal,
((Geometry)rhs).ExtentsInternal);
}

internal static Geometry Intersection(Extents lhs, Extents rhs)
{
return Extents.Intersection(lhs, rhs).ToGeometry();
}

internal static Geometry Intersection(Geometry lhs, Geometry rhs)
{
return BoundingBoxOperations.Intersection(lhs.ExtentsInternal, rhs.ExtentsInternal);
return Intersection(lhs.ExtentsInternal, rhs.ExtentsInternal);
}

internal static IGeometry Intersection(IGeometry lhs, IGeometry rhs)
{
return Intersection(
((Geometry)lhs).ExtentsInternal,
((Geometry)rhs).ExtentsInternal);
}
}
}
Loading

0 comments on commit 5f999ce

Please sign in to comment.