/// <summary> /// Computes the transformation of the source geometry graph. /// </summary> /// <param name="source">The source geometry graph.</param> /// <returns>The geometry graph in the specified reference system.</returns> private IGeometryGraph Compute(IGeometryGraph source) { IGeometryGraph graph = _factory.CreateGraph(source.VertexComparer, source.EdgeComparer, _metadataPreservation ? source.Metadata : null); Dictionary <IGraphVertex, IGraphVertex> vertexMapping = new Dictionary <IGraphVertex, IGraphVertex>(); foreach (IGraphVertex vertex in source.Vertices) { vertexMapping.Add(vertex, graph.AddVertex(Compute(vertex.Coordinate), _metadataPreservation ? vertex.Metadata : null)); } foreach (IGraphVertex vertex in source.Vertices) { foreach (IGraphEdge edge in source.OutEdges(vertex)) { graph.AddEdge(vertexMapping[edge.Source], vertexMapping[edge.Target], _metadataPreservation ? edge.Metadata : null); } } return(graph); }