Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/AEGIS.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0FA79630-580C-4AFF-A3E5-04DFE27ED91C}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -31,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Numerics", "Tests.Num
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Storage.Hadoop", "Tests.Storage.Hadoop\Tests.Storage.Hadoop.csproj", "{23452575-F4C0-45F6-A857-23F5320DBBDF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO", "IO\IO.csproj", "{275B88F0-DA62-49C3-B586-47F5A6C22D2F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -81,6 +83,10 @@ Global
{23452575-F4C0-45F6-A857-23F5320DBBDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23452575-F4C0-45F6-A857-23F5320DBBDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23452575-F4C0-45F6-A857-23F5320DBBDF}.Release|Any CPU.Build.0 = Release|Any CPU
{275B88F0-DA62-49C3-B586-47F5A6C22D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{275B88F0-DA62-49C3-B586-47F5A6C22D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{275B88F0-DA62-49C3-B586-47F5A6C22D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{275B88F0-DA62-49C3-B586-47F5A6C22D2F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 14 additions & 0 deletions src/AEGIS.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">&lt;copyright file="$FILENAME$" company="Eötvös Loránd University (ELTE)"&gt;&#xD;
Copyright 2016-$CURRENT_YEAR$ Roberto Giachetta. Licensed under the&#xD;
Educational Community License, Version 2.0 (the "License"); you may&#xD;
not use this file except in compliance with the License. You may&#xD;
obtain a copy of the License at&#xD;
http://opensource.org/licenses/ECL-2.0&#xD;
&#xD;
Unless required by applicable law or agreed to in writing,&#xD;
software distributed under the License is distributed on an "AS IS"&#xD;
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express&#xD;
or implied. See the License for the specific language governing&#xD;
permissions and limitations under the License.&#xD;
&lt;/copyright&gt;</s:String></wpf:ResourceDictionary>
198 changes: 198 additions & 0 deletions src/Core/Conditions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
// <copyright file="Conditions.cs" company="Eötvös Loránd University (ELTE)">
// Copyright (c) 2011-2019 Roberto Giachetta. Licensed under the
// Educational Community License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may
// obtain a copy of the License at
// http://opensource.org/licenses/ECL-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an "AS IS"
// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing
// permissions and limitations under the License.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;

namespace AEGIS
{
/// <summary>
/// Defines a collection of conditions that can be applied to any value.
/// </summary>
/// <remarks>
/// This type provides easy to use methods for declaring requirements for any value.
/// The predicates return <c>true</c> if the value satisfies the requirements; otherwise, <c>false</c>.
/// The predicates never throw exception.
/// </remarks>
public static class Conditions
{
/// <summary>
/// The value has no requirements.
/// </summary>
/// <returns>A <see cref="Predicate{Object}" /> that is always true.</returns>
public static Predicate<Object> None()
{
return (value => true);
}

/// <summary>
/// Requires that the value is positive.
/// </summary>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is positive.</returns>
public static Predicate<Object> IsPositive()
{
return (value => (value is IConvertible) && Convert.ToDouble(value) > 0);
}

/// <summary>
/// Requires that the value is negative.
/// </summary>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is negative.</returns>
public static Predicate<Object> IsNegative()
{
return (value => (value is IConvertible) && Convert.ToDouble(value) < 0);
}

/// <summary>
/// Requires that the value is not positive.
/// </summary>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is not positive.</returns>
public static Predicate<Object> IsNotPositive()
{
return (value => (value is IConvertible) && Convert.ToDouble(value) <= 0);
}

/// <summary>
/// Requires that the value is not negative.
/// </summary>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is not negative.</returns>
public static Predicate<Object> IsNotNegative()
{
return (value => (value is IConvertible) && Convert.ToDouble(value) >= 0);
}

/// <summary>
/// Requires that the value is even.
/// </summary>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is even.</returns>
public static Predicate<Object> IsEven()
{
return (value => (value is IConvertible) && Convert.ToInt32(value) % 2 == 1);
}

/// <summary>
/// Requires that the value is odd.
/// </summary>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is odd.</returns>
public static Predicate<Object> IsOdd()
{
return (value => (value is IConvertible) && Convert.ToInt32(value) % 2 == 1);
}

/// <summary>
/// Requires that the value is greater than or equal to the specified boundary.
/// </summary>
/// <param name="boundary">The boundary.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is greater than or equal to the specified boundary.</returns>
public static Predicate<Object> IsGreaterThanOrEqualTo(Double boundary)
{
return (value => (value is IConvertible) && boundary <= Convert.ToDouble(value));
}

/// <summary>
/// Requires that the value is greater than the specified boundary.
/// </summary>
/// <param name="boundary">The boundary.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is greater than the specified boundary.</returns>
public static Predicate<Object> IsGreaterThan(Double boundary)
{
return (value => (value is IConvertible) && boundary < Convert.ToDouble(value));
}

/// <summary>
/// Requires that the value is less than or equal to the specified boundary.
/// </summary>
/// <param name="boundary">The boundary.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is less than or equal to the specified boundary.</returns>
public static Predicate<Object> IsLessThanOrEqualTo(Double boundary)
{
return (value => (value is IConvertible) && boundary >= Convert.ToDouble(value));
}

/// <summary>
/// Requires that the value is less than the specified boundary.
/// </summary>
/// <param name="boundary">The boundary.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is less than the specified boundary.</returns>
public static Predicate<Object> IsLessThan(Double boundary)
{
return (value => (value is IConvertible) && boundary > Convert.ToDouble(value));
}

/// <summary>
/// Requires that the value is between the specified lower and upper boundaries.
/// </summary>
/// <param name="lowerBoundary">The lower boundary.</param>
/// <param name="upperBoundary">The upper boundary.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is between the specified lower and upper boundaries.</returns>
public static Predicate<Object> IsBetween(Double lowerBoundary, Double upperBoundary)
{
return (value => (value is IConvertible) && lowerBoundary <= Convert.ToDouble(value) && Convert.ToDouble(value) <= upperBoundary);
}

/// <summary>
/// Requires that the value is strictly between the specified lower and upper boundaries.
/// </summary>
/// <param name="lowerBoundary">The lower boundary.</param>
/// <param name="upperBoundary">The upper boundary.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is strictly between the specified lower and upper boundaries.</returns>
public static Predicate<Object> IsStricklyBetween(Double lowerBoundary, Double upperBoundary)
{
return (value => (value is IConvertible) && lowerBoundary < Convert.ToDouble(value) && Convert.ToDouble(value) < upperBoundary);
}

/// <summary>
/// Requires that the is one of the specified objects.
/// </summary>
/// <param name="objects">The objects.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is one of the specified objects.</returns>
public static Predicate<Object> IsOneOf(params Object[] objects)
{
return (value => objects.Contains(value));
}

/// <summary>
/// Requires that the is one of the specified objects.
/// </summary>
/// <param name="objects">The objects.</param>
/// <returns>A <see cref="Predicate{Object}" /> that validates whether the value is one of the specified objects.</returns>
public static Predicate<Object> IsOneOf(IEnumerable<Object> objects)
{
return (value => objects.Contains(value));
}

/// <summary>
/// Requires that the object (or type) implements the specified interface.
/// </summary>
/// <typeparam name="InterfaceType">The interface type.</typeparam>
/// <returns>A <see cref="Predicate{Object}" /> that validates that the object (or type) implements the specified interface.</returns>
public static Predicate<Object> Implements<InterfaceType>()
{
return value => (value is Type) && ((value as Type).Equals(typeof(InterfaceType)) || (value as Type).GetInterfaces().Contains(typeof(InterfaceType)))
|| (value is InterfaceType);
}

/// <summary>
/// Requires that the object (or type) inherits the specified superclass type.
/// </summary>
/// <typeparam name="ClassType">The superclass type.</typeparam>
/// <returns>A <see cref="Predicate{Object}" /> that validates that the object (or type) inherits the specified superclass type.</returns>
public static Predicate<Object> Inherits<ClassType>()
{
return value => (value is Type) && ((value as Type).Equals(typeof(ClassType)) || (value as Type).IsSubclassOf(typeof(ClassType)) || (value as Type).GetInterfaces().Contains(typeof(ClassType)))
|| (value is ClassType);
}
}
}
70 changes: 70 additions & 0 deletions src/Core/GeometryModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// <copyright file="GeometryModel.cs" company="Eötvös Loránd University (ELTE)">
// Copyright 2016-2021 Roberto Giachetta. Licensed under the
// Educational Community License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may
// obtain a copy of the License at
// http://opensource.org/licenses/ECL-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an "AS IS"
// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing
// permissions and limitations under the License.
// </copyright>

using System;

namespace AEGIS
{
/// <summary>
/// Defines the supported models for geometry representation.
/// </summary>
[Flags]
public enum GeometryModel
{
/// <summary>
/// No spatial or temporal support is specified.
/// </summary>
None = 1,

/// <summary>
/// Spatial with 2 dimensional coordinate system.
/// </summary>
Spatial2D = 2,

/// <summary>
/// Spatial with 3 dimensional coordinate system.
/// </summary>
Spatial3D = 4,

/// <summary>
/// Spatial with 2 or 3 dimensional coordinate system.
/// </summary>
Spatial = 6,

/// <summary>
/// Spatio-temporal with 2 dimensional spatial coordinate system and one dimensional temporal coordinate system.
/// </summary>
SpatioTemporal2D = 8,

/// <summary>
/// Spatio-temporal with 3 dimensional spatial coordinate system and one dimensional temporal coordinate system.
/// </summary>
SpatioTemporal3D = 16,

/// <summary>
/// Spatio-temporal with 2 or 3 dimensional spatial coordinate system and one dimensional temporal coordinate system.
/// </summary>
SpatioTemporal = 24,

/// <summary>
/// Spatial or spatio-temporal with 2 or 3 dimensional spatial coordinate system and optionally one dimensional temporal coordinate system.
/// </summary>
SpatialOrSpatioTemporal = 30,

/// <summary>
/// Support for all models.
/// </summary>
Any = 31
}
}
8 changes: 8 additions & 0 deletions src/Core/IPolygon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,13 @@ public interface IPolygon : ISurface, IBasicPolygon
/// The index is equal to or greater than the number of coordinates.
/// </exception>
new ILinearRing GetHole(Int32 index);

/// <summary>
/// Add a hole to the polygon.
/// </summary>
/// <param name="hole">The hole.</param>
/// <exception cref="System.ArgumentNullException">The hole is null.</exception>
/// <exception cref="System.ArgumentException">The reference system of the hole does not match the reference system of the polygon.</exception>
void AddHole(ILinearRing hole);
}
}
59 changes: 59 additions & 0 deletions src/Core/IdentifiedObjectCollectionAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// <copyright file="IdentifiedObjectCollectionAttribute.cs" company="Eötvös Loránd University (ELTE)">
// Copyright (c) 2011-2019 Roberto Giachetta. Licensed under the
// Educational Community License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may
// obtain a copy of the License at
// http://opensource.org/licenses/ECL-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an "AS IS"
// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing
// permissions and limitations under the License.
// </copyright>

namespace AEGIS
{
using System;

/// <summary>
/// Indicates that the type is a collection of known identified object instances.
/// </summary>
/// <remarks>
/// The supported type is a static class with properties representing the <see cref="IdentifiedObject" /> instances of a specified subclass.
/// The class must also support a query property for all known instances and methods for identifier and name queries.
/// </remarks>
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
public class IdentifiedObjectCollectionAttribute : Attribute
{
#region Public properties

/// <summary>
/// Gets the type of the instances.
/// </summary>
/// <value>The base type for all instances in the collection.</value>
public Type Type { get; private set; }

#endregion

#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="IdentifiedObjectCollectionAttribute" /> class.
/// </summary>
/// <param name="type">The base type for all instances in the collection.</param>
/// <exception cref="System.ArgumentNullException">The types is null.</exception>
/// <exception cref="System.ArgumentException">The type is not a subclass of <see cref="IdentifiedObject"/>.</exception>
public IdentifiedObjectCollectionAttribute(Type type)
{
if (type == null)
throw new ArgumentNullException("type", "The types is null.");
if (!type.IsSubclassOf(typeof(IdentifiedObject)))
throw new ArgumentException("The type is not a subclass of IdentifiedObject.", "type");

Type = type;
}

#endregion
}
}
Loading