/// <summary> /// Creates a network. /// </summary> /// <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 and the specified metadata.</returns> public IGeometryGraph CreateNetwork(IEnumerable <IEnumerable <Coordinate> > coordinates, IDictionary <String, Object> metadata) { IGeometryGraph graph = new GeometryNetwork(GetFactory <IGeometryFactory>(), metadata); if (coordinates != null) { foreach (IEnumerable <Coordinate> coordinateCollection in coordinates) { if (coordinateCollection == null) { continue; } IGraphVertex first, second; IEnumerator <Coordinate> enumerator = coordinateCollection.GetEnumerator(); if (enumerator.MoveNext()) { first = graph.AddVertex(enumerator.Current); while (enumerator.MoveNext()) { second = graph.AddVertex(enumerator.Current); graph.AddEdge(first, second); first = second; } } } } return(graph); }
/// <summary> /// Creates a clone of the <see cref="GeometryNetwork" /> instance. /// </summary> /// <returns>The deep copy of the <see cref="GeometryNetwork" /> instance.</returns> public override Object Clone() { GeometryNetwork result = new GeometryNetwork(Factory, Metadata); CloneToGraph(this, result); return(result); }
/// <summary> /// Creates a network. /// </summary> /// <param name="coordinates">The sequence of coordinates.</param> /// <param name="metadata">The metadata.</param> /// <returns>A network containing the specified coordinates as vertices and the specified metadata.</returns> public IGeometryGraph CreateNetwork(IEnumerable <Coordinate> coordinates, IDictionary <String, Object> metadata) { IGeometryGraph graph = new GeometryNetwork(GetFactory <IGeometryFactory>(), metadata); if (coordinates != null) { foreach (Coordinate coordinate in coordinates) { graph.AddVertex(coordinate); } } return(graph); }