/** * @return the specified toGraph which is now filled with data from fromGraph */ // TODO very similar to createSortedGraph -> use a 'int map(int)' interface public static Graph copyTo(Graph fromGraph, Graph toGraph) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int adj = eIter.getAdjNode(); eIter.copyPropertiesTo(toGraph.edge(base, adj)); } NodeAccess fna = fromGraph.getNodeAccess(); NodeAccess tna = toGraph.getNodeAccess(); int nodes = fromGraph.getNodes(); for (int node = 0; node < nodes; node++) { if (tna.is3D()) tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node), fna.getElevation(node)); else tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node)); } return toGraph; }
static Graph createSortedGraph(Graph fromGraph, Graph toSortedGraph, final IntIndexedContainer oldToNewNodeList) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int newBaseIndex = oldToNewNodeList.get(base); int adj = eIter.getAdjNode(); int newAdjIndex = oldToNewNodeList.get(adj); // ignore empty entries if (newBaseIndex < 0 || newAdjIndex < 0) continue; eIter.copyPropertiesTo(toSortedGraph.edge(newBaseIndex, newAdjIndex)); } int nodes = fromGraph.getNodes(); NodeAccess na = fromGraph.getNodeAccess(); NodeAccess sna = toSortedGraph.getNodeAccess(); for (int old = 0; old < nodes; old++) { int newIndex = oldToNewNodeList.get(old); if (sna.is3D()) sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old), na.getElevation(old)); else sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old)); } return toSortedGraph; }
/** * @return the specified toGraph which is now filled with data from fromGraph */ // TODO very similar to createSortedGraph -> use a 'int map(int)' interface public static Graph copyTo(Graph fromGraph, Graph toGraph) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int adj = eIter.getAdjNode(); eIter.copyPropertiesTo(toGraph.edge(base, adj)); } NodeAccess fna = fromGraph.getNodeAccess(); NodeAccess tna = toGraph.getNodeAccess(); int nodes = fromGraph.getNodes(); for (int node = 0; node < nodes; node++) { if (tna.is3D()) tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node), fna.getElevation(node)); else tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node)); } return toGraph; }
/** * @return the specified toGraph which is now filled with data from fromGraph */ // TODO very similar to createSortedGraph -> use a 'int map(int)' interface public static Graph copyTo(Graph fromGraph, Graph toGraph) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int adj = eIter.getAdjNode(); eIter.copyPropertiesTo(toGraph.edge(base, adj)); } NodeAccess fna = fromGraph.getNodeAccess(); NodeAccess tna = toGraph.getNodeAccess(); int nodes = fromGraph.getNodes(); for (int node = 0; node < nodes; node++) { if (tna.is3D()) tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node), fna.getElevation(node)); else tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node)); } return toGraph; }
/** * @return the specified toGraph which is now filled with data from fromGraph */ // TODO very similar to createSortedGraph -> use a 'int map(int)' interface public static Graph copyTo( Graph fromGraph, Graph toGraph ) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int adj = eIter.getAdjNode(); eIter.copyPropertiesTo(toGraph.edge(base, adj)); } NodeAccess fna = fromGraph.getNodeAccess(); NodeAccess tna = toGraph.getNodeAccess(); int nodes = fromGraph.getNodes(); for (int node = 0; node < nodes; node++) { if (tna.is3D()) tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node), fna.getElevation(node)); else tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node)); } return toGraph; }
static Graph createSortedGraph(Graph fromGraph, Graph toSortedGraph, final IntIndexedContainer oldToNewNodeList) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int newBaseIndex = oldToNewNodeList.get(base); int adj = eIter.getAdjNode(); int newAdjIndex = oldToNewNodeList.get(adj); // ignore empty entries if (newBaseIndex < 0 || newAdjIndex < 0) continue; eIter.copyPropertiesTo(toSortedGraph.edge(newBaseIndex, newAdjIndex)); } int nodes = fromGraph.getNodes(); NodeAccess na = fromGraph.getNodeAccess(); NodeAccess sna = toSortedGraph.getNodeAccess(); for (int old = 0; old < nodes; old++) { int newIndex = oldToNewNodeList.get(old); if (sna.is3D()) sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old), na.getElevation(old)); else sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old)); } return toSortedGraph; }
static Graph createSortedGraph(Graph fromGraph, Graph toSortedGraph, final IntIndexedContainer oldToNewNodeList) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int newBaseIndex = oldToNewNodeList.get(base); int adj = eIter.getAdjNode(); int newAdjIndex = oldToNewNodeList.get(adj); // ignore empty entries if (newBaseIndex < 0 || newAdjIndex < 0) continue; eIter.copyPropertiesTo(toSortedGraph.edge(newBaseIndex, newAdjIndex)); } int nodes = fromGraph.getNodes(); NodeAccess na = fromGraph.getNodeAccess(); NodeAccess sna = toSortedGraph.getNodeAccess(); for (int old = 0; old < nodes; old++) { int newIndex = oldToNewNodeList.get(old); if (sna.is3D()) sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old), na.getElevation(old)); else sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old)); } return toSortedGraph; }
static Graph createSortedGraph( Graph fromGraph, Graph toSortedGraph, final TIntList oldToNewNodeList ) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int newBaseIndex = oldToNewNodeList.get(base); int adj = eIter.getAdjNode(); int newAdjIndex = oldToNewNodeList.get(adj); // ignore empty entries if (newBaseIndex < 0 || newAdjIndex < 0) continue; eIter.copyPropertiesTo(toSortedGraph.edge(newBaseIndex, newAdjIndex)); } int nodes = fromGraph.getNodes(); NodeAccess na = fromGraph.getNodeAccess(); NodeAccess sna = toSortedGraph.getNodeAccess(); for (int old = 0; old < nodes; old++) { int newIndex = oldToNewNodeList.get(old); if (sna.is3D()) sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old), na.getElevation(old)); else sna.setNode(newIndex, na.getLatitude(old), na.getLongitude(old)); } return toSortedGraph; }