Skip to content

Commit

Permalink
Merge branch 'release/1.7.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Oct 17, 2016
2 parents 354fec5 + a9a223f commit 8e62b60
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 20 deletions.
10 changes: 1 addition & 9 deletions Terradue.GeoJson.Tests/out/georssfromgml32.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<georss:where xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss">
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:posList count="5">68.28772 171.204941 66.438118 170.470917 65.602242 179.436798 67.412254 -179.155029 68.28772 171.204941</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</georss:where>
<georss:polygon xmlns:georss="http://www.georss.org/georss">68.28772 171.204941 66.438118 170.470917 65.602242 179.436798 67.412254 -179.155029 68.28772 171.204941</georss:polygon>
6 changes: 3 additions & 3 deletions Terradue.GeoJson/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@{
Terradue .NET GeoJson Library. Initially developed to provide an easy way to manage Geometry objects with serialization and deserialization functions and transformation functions from/to GeoJson, it also supports GML, georss and Well Known Text (WKT)
\xrefitem sw_version "Versions" "Software Package Version" 1.7.10
\xrefitem sw_version "Versions" "Software Package Version" 1.7.11
\xrefitem sw_link "Links" "Software Package List" [DotNetGeoJson](https://github.com/Terradue/DotNetGeoJson)
Expand Down Expand Up @@ -50,6 +50,6 @@
[assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetGeoJson")]
[assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetGeoJson/blob/master/LICENSE")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyVersion("1.7.10.*")]
[assembly: AssemblyInformationalVersion("1.7.10")]
[assembly: AssemblyVersion("1.7.11.*")]
[assembly: AssemblyInformationalVersion("1.7.11")]

14 changes: 11 additions & 3 deletions Terradue.GeoJson/Terradue.GeoJson.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
<ConsolePause>False</ConsolePause>
<CustomCommands>
<CustomCommands>
<Command type="BeforeBuild" command="nuget restore ${ProjectDir}/.." workingdir="" />
<Command>
<type>BeforeBuild</type>
<command>nuget restore ${ProjectDir}/..</command>
<workingdir></workingdir>
</Command>
</CustomCommands>
</CustomCommands>
</PropertyGroup>
Expand All @@ -38,7 +42,11 @@
<ConsolePause>False</ConsolePause>
<CustomCommands>
<CustomCommands>
<Command type="BeforeBuild" command="nuget restore ${ProjectDir}/.." workingdir="" />
<Command>
<type>BeforeBuild</type>
<command>nuget restore ${ProjectDir}/..</command>
<workingdir></workingdir>
</Command>
</CustomCommands>
</CustomCommands>
</PropertyGroup>
Expand Down Expand Up @@ -77,7 +85,7 @@
<HintPath>..\packages\NuGet4Mono.Extensions.0.3.0\lib\net40\NuGet4Mono.Extensions.dll</HintPath>
</Reference>
<Reference Include="Terradue.ServiceModel.Ogc">
<HintPath>..\packages\Terradue.ServiceModel.Ogc.1.1.5\lib\net40\Terradue.ServiceModel.Ogc.dll</HintPath>
<HintPath>..\packages\Terradue.ServiceModel.Ogc.1.1.6\lib\net40\Terradue.ServiceModel.Ogc.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 2 additions & 0 deletions Terradue.GeoJson/Terradue/GeoJson/GeoRss/GeoRss.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public partial class GeoRssWhere : abstractFeaturePropertyType, IGeoRSS {
[System.Xml.Serialization.XmlElementAttribute("MultiSurface", typeof(MultiSurfaceType), Namespace = "http://www.opengis.net/gml")]
[System.Xml.Serialization.XmlElementAttribute("MultiCurve", typeof(MultiCurveType), Namespace = "http://www.opengis.net/gml")]
[System.Xml.Serialization.XmlElementAttribute("MultiPolygon", typeof(MultiPolygonType), Namespace = "http://www.opengis.net/gml")]
[System.Xml.Serialization.XmlElementAttribute("MultiPoint", typeof(MultiPointType), Namespace = "http://www.opengis.net/gml")]
[System.Xml.Serialization.XmlElementAttribute("MultiLineString", typeof(MultiLineStringType), Namespace = "http://www.opengis.net/gml")]
public object[] Item {
get {
return this.itemField;
Expand Down
41 changes: 39 additions & 2 deletions Terradue.GeoJson/Terradue/GeoJson/GeoRss/GeoRssExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ public static GeometryObject ToGeometry(this Terradue.GeoJson.GeoRss.GeoRssWhere
return ((MultiSurfaceType)where.Item[0]).ToGeometry();
}

if (where.Item != null && where.Item.Count() > 0 && where.Item[0] is MultiPointType)
{
return ((MultiPointType)where.Item[0]).ToGeometry();
}

if (where.Item != null && where.Item.Count() > 0 && where.Item[0] is MultiLineStringType)
{
return ((MultiLineStringType)where.Item[0]).ToGeometry();
}

return null;

}
Expand Down Expand Up @@ -191,12 +201,23 @@ public static Terradue.GeoJson.GeoRss.IGeoRSS ToGeoRss(this GeometryObject geom)
if (geom is Polygon && ((Polygon)geom).LineStrings.Count > 1)
return ((Polygon)geom).ToGeoRssWhere();

if (geom is MultiPolygon)
if (geom is MultiPolygon && ((MultiPolygon)geom).Polygons.Count == 1)
return ((MultiPolygon)geom).Polygons.First().ToGeoRss();

if (geom is MultiPolygon && ((MultiPolygon)geom).Polygons.Count > 1)
return ((MultiPolygon)geom).ToGeoRssWhere();

if (geom is MultiPoint && ((MultiPoint)geom).Points.Count == 1)
return ((MultiPoint)geom).Points.First().ToGeoRss();

if (geom is MultiPoint)
return ((MultiPoint)geom).ToGeoRssWhere();

if (geom is MultiLineString && ((MultiLineString)geom).LineStrings.Count == 1)
return ((MultiLineString)geom).LineStrings.First().ToGeoRss();

if (geom is MultiLineString)
return ((MultiLineString)geom).ToGeoRssWhere();

throw new NotImplementedException();
}
Expand All @@ -218,6 +239,9 @@ public static Terradue.GeoJson.GeoRss.GeoRssWhere ToGeoRssWhere(this GeometryObj
if (geom is MultiPoint)
return ((MultiPoint)geom).ToGeoRssWhere();

if (geom is MultiLineString)
return ((MultiLineString)geom).ToGeoRssWhere();


throw new NotImplementedException();
}
Expand Down Expand Up @@ -256,7 +280,6 @@ public static Terradue.GeoJson.GeoRss.GeoRssWhere ToGeoRssWhere(this MultiPolygo

if (mpolygon.Polygons.Count() > 1)
{

return new Terradue.GeoJson.GeoRss.GeoRssWhere() { Item = new MultiPolygonType[] { mpolygon.ToGmlMultiPolygon() }, Type = "multipolygon" };
}
else {
Expand All @@ -276,6 +299,20 @@ public static Terradue.GeoJson.GeoRss.GeoRssWhere ToGeoRssWhere(this MultiPoint
}

}

public static Terradue.GeoJson.GeoRss.GeoRssWhere ToGeoRssWhere(this MultiLineString mlinestring)
{

if (mlinestring.LineStrings.Count() > 1)
{

return new Terradue.GeoJson.GeoRss.GeoRssWhere() { Item = new MultiLineStringType[] { mlinestring.ToGmlMultiLineString() }, Type = "multilinestring" };
}
else {
return new Terradue.GeoJson.GeoRss.GeoRssWhere() { Item = new LineStringType[] { mlinestring.LineStrings.First().ToGmlLineString() } };
}

}
}
}

34 changes: 33 additions & 1 deletion Terradue.GeoJson/Terradue/GeoJson/Gml/Gml311Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ public static GeometryObject ToGeometry(this AbstractGeometryType gmlObject) {
return ((LinearRingType)gmlObject).ToGeometry();
}

if (gmlObject is MultiPointType)
{
return ((MultiPointType)gmlObject).ToGeometry();
}

throw new NotImplementedException();

}
Expand Down Expand Up @@ -362,10 +367,37 @@ public static MultiPolygon ToGeometry(this MultiPolygonType gmlMultiPolygon) {
}
}

MultiPolygon mp;
return new MultiPolygon(polygons);
}

public static MultiPoint ToGeometry(this MultiPointType gmlMultipoint)
{
List<IPosition> points = new List<IPosition>();

if (gmlMultipoint.pointMember != null)
{

foreach (var member in gmlMultipoint.pointMember)
{

points.Add(member.Point.ToGeometry().Position);

}
}

if (gmlMultipoint.pointMembers != null)
{

foreach (var member in gmlMultipoint.pointMembers)
{

points.Add(member.ToGeometry().Position);
}
}

return new MultiPoint(points);
}

public static Polygon ToGeometry(this PolygonType gmlPolygon) {
List<LineString> polygon = new List<LineString>();
LineString ls = null;
Expand Down
2 changes: 1 addition & 1 deletion Terradue.GeoJson/Terradue/GeoJson/Gml/Gml321Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public static List<IPosition> ToGeometry(this CoordinatesType coordinates) {
throw new InvalidFormatException("invalid GML representation: gml:coordinates ambiguity in separators");

/* We retrieve gml:coord string */
gmlcoord = coordinates.Value.Trim().Replace(" ", " ");
gmlcoord = coordinates.Value.Trim().Replace(" ", " ").Replace(" ,",",").Replace(", ",",");
if (string.IsNullOrEmpty(gmlcoord))
throw new InvalidFormatException("invalid GML representation: gml:coordinates is empty");

Expand Down
2 changes: 1 addition & 1 deletion Terradue.GeoJson/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<package id="NetTopologySuite.IO" version="1.13.3.2" targetFramework="net40" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net40" />
<package id="NuGet4Mono.Extensions" version="0.3.0" targetFramework="net40" />
<package id="Terradue.ServiceModel.Ogc" version="1.1.5" targetFramework="net40" />
<package id="Terradue.ServiceModel.Ogc" version="1.1.6" targetFramework="net40" />
</packages>

0 comments on commit 8e62b60

Please sign in to comment.