/// <summary> /// Initializes a new instance of the <see cref="SpectralTransformation" /> class. /// </summary> /// <param name="source">The source.</param> /// <param name="target">The target.</param> /// <param name="method">The method.</param> /// <param name="parameters">The parameters.</param> /// <exception cref="System.ArgumentNullException"> /// The source is null. /// or /// The method is null. /// or /// The method requires parameters which are not specified. /// </exception> /// <exception cref="System.ArgumentException"> /// The source is invalid. /// or /// The target is invalid. /// or /// The specified source and result are the same objects, but the method does not support in-place operations. /// or /// The parameters do not contain a required parameter value. /// or /// The type of a parameter does not match the type specified by the method. /// or /// A parameter value does not satisfy the conditions of the parameter. /// </exception> protected SpectralTransformation(ISpectralGeometry source, ISpectralGeometry target, SpectralOperationMethod method, IDictionary <OperationParameter, Object> parameters) : base(source, target, method, parameters) { if (source.Raster == null) { throw new ArgumentException("The source is invalid.", nameof(source), new InvalidOperationException("The geometry does not contain raster data.")); } if (!method.SupportedFormats.Contains(source.Raster.Format)) { throw new ArgumentException("The source is invalid.", nameof(source), new InvalidOperationException("The raster format is not supported by the method.")); } if (target != null && target.Raster == null) { throw new ArgumentException("The target is invalid.", nameof(source), new InvalidOperationException("The geometry does not contain raster data.")); } Factory = ResolveParameter <IGeometryFactory>(CommonOperationParameters.GeometryFactory, Source.Factory); if (Factory.GetFactory <IRasterFactory>() == null) { Factory = Source.Factory; } _resultPropertiesSet = false; }
/// <summary> /// Initializes a new instance of the <see cref="Geometry" /> class. /// </summary> /// <param name="precisionModel">The precision model.</param> /// <param name="referenceSystem">The reference system.</param> /// <param name="metadata">The metadata.</param> protected Geometry(PrecisionModel precisionModel, IReferenceSystem referenceSystem, IDictionary <String, Object> metadata) { _factory = new GeometryFactory(precisionModel, referenceSystem); _metadata = _factory.GetFactory <IMetadataFactory>().CreateCollection(metadata); _envelope = null; _boundary = null; }
/// <summary> /// Initializes a new instance of the <see cref="Geometry" /> class. /// </summary> /// <param name="factory">The factory of the geometry.</param> /// <param name="metadata">The metadata.</param> /// <exception cref="System.ArgumentNullException">The factory is null.</exception> /// <exception cref="System.ArgumentException">The specified factory is invalid.</exception> protected Geometry(IGeometryFactory factory, IDictionary <String, Object> metadata) { if (factory == null) { throw new ArgumentNullException("factory", "The factory is null."); } if (!(factory is GeometryFactory)) { throw new ArgumentException("The specified factory is invalid.", "factory"); } _factory = factory; _metadata = _factory.GetFactory <IMetadataFactory>().CreateCollection(metadata); _envelope = null; _boundary = null; }
/// <summary> /// Gets or sets the metadata value for a specified key. /// </summary> /// <param name="key">The key of the metadata.</param> /// <returns>The metadata value with the <paramref name="key" /> if it exists; otherwise, <c>null</c>.</returns> public Object this[String key] { get { Object value = null; if (_metadata != null) { _metadata.TryGetValue(key, out value); } return(value); } set { if (_metadata == null) { _metadata = _factory.GetFactory <IMetadataFactory>().CreateCollection(); } _metadata[key] = value; } }
/// <summary> /// Creates a graph. /// </summary> /// <param name="factory">The geometry factory.</param> /// <param name="coordinates">The sequence of coordinates.</param> /// <returns>A graph containing the specified coordinates as vertices.</returns> public static IGeometryGraph CreateGraph(this IGeometryFactory factory, IEnumerable <Coordinate> coordinates) { EnsureFactory(factory); return(factory.GetFactory <IGeometryGraphFactory>().CreateGraph(coordinates)); }
/// <summary> /// Creates a graph. /// </summary> /// <param name="factory">The geometry factory.</param> /// <param name="metadata">The metadata.</param> /// <returns>An empty graph with the specified metadata.</returns> public static IGeometryGraph CreateGraph(this IGeometryFactory factory, IDictionary <String, Object> metadata) { EnsureFactory(factory); return(factory.GetFactory <IGeometryGraphFactory>().CreateGraph(metadata)); }
/// <summary> /// Creates a graph. /// </summary> /// <param name="factory">The geometry factory.</param> /// <param name="vertexEqualityComparer">The vertex comparer.</param> /// <param name="edgeEqualityComparer">The edge comparer.</param> /// <param name="metadata">The metadata.</param> /// <returns>An empty graph with the specified metadata using the specified comparers.</returns> public static IGeometryGraph CreateGraph(this IGeometryFactory factory, IEqualityComparer <IGraphVertex> vertexEqualityComparer, IEqualityComparer <IGraphEdge> edgeEqualityComparer, IDictionary <String, Object> metadata) { EnsureFactory(factory); return(factory.GetFactory <IGeometryGraphFactory>().CreateGraph(vertexEqualityComparer, edgeEqualityComparer, metadata)); }
/// <summary> /// Creates a graph. /// </summary> /// <param name="factory">The geometry factory.</param> /// <param name="vertexEqualityComparer">The vertex comparer.</param> /// <param name="edgeEqualityComparer">The edge comparer.</param> /// <returns>An empty graph using the specified comparers.</returns> public static IGeometryGraph CreateGraph(this IGeometryFactory factory, IEqualityComparer <IGraphVertex> vertexEqualityComparer, IEqualityComparer <IGraphEdge> edgeEqualityComparer) { EnsureFactory(factory); return(factory.GetFactory <IGeometryGraphFactory>().CreateGraph(vertexEqualityComparer, edgeEqualityComparer)); }
/// <summary> /// Creates a graph. /// </summary> /// <param name="factory">The geometry factory.</param> /// <returns>An empty graph.</returns> public static IGeometryGraph CreateGraph(this IGeometryFactory factory) { EnsureFactory(factory); return(factory.GetFactory <IGeometryGraphFactory>().CreateGraph()); }
/// <summary> /// Creates a network. /// </summary> /// <param name="factory">The geometry factory.</param> /// <param name="coordinates">The sequence of edge sequences.</param> /// <param name="metadata">The metadata.</param> /// <returns>A network containing the specified coordinates as vertices and edges.</returns> public static IGeometryGraph CreateNetwork(this IGeometryFactory factory, IEnumerable <IEnumerable <Coordinate> > coordinates, IDictionary <String, Object> metadata) { EnsureFactory(factory); return(factory.GetFactory <IGeometryGraphFactory>().CreateNetwork(coordinates, metadata)); }
/// <summary> /// Creates a graph. /// </summary> /// <param name="factory">The geometry factory.</param> /// <param name="coordinates">The sequence of edge sequences.</param> /// <param name="vertexEqualityComparer">The vertex comparer.</param> /// <param name="edgeEqualityComparer">The edge comparer.</param> /// <returns>A graph containing the specified coordinates as vertices and edges using the specified comparers.</returns> public static IGeometryGraph CreateGraph(this IGeometryFactory factory, IEnumerable <IEnumerable <Coordinate> > coordinates, IEqualityComparer <IGraphVertex> vertexEqualityComparer, IEqualityComparer <IGraphEdge> edgeEqualityComparer) { EnsureFactory(factory); return(factory.GetFactory <IGeometryGraphFactory>().CreateGraph(coordinates, vertexEqualityComparer, edgeEqualityComparer)); }