@Override public void ensureNode(int nodeId) { that.ensureNodeIndex(nodeId); }
@Override public final void setAdditionalNodeField(int index, int additionalValue) { if (that.extStorage.isRequireNodeField() && that.N_ADDITIONAL >= 0) { that.ensureNodeIndex(index); long tmp = (long) index * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_ADDITIONAL, additionalValue); } else { throw new AssertionError("This graph does not provide an additional node field"); } }
@Override public CHEdgeIteratorState edge(int a, int b) { // increase edge array not for shortcuts baseGraph.ensureNodeIndex(Math.max(a, b)); int edgeId = baseGraph.edgeAccess.internalEdgeAdd(baseGraph.nextEdgeId(), a, b); CHEdgeIteratorImpl iter = new CHEdgeIteratorImpl(baseGraph, baseGraph.edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, b); assert ret; return iter; }
/** * Create edge between nodes a and b * <p> * * @return EdgeIteratorState of newly created edge */ @Override public EdgeIteratorState edge(int nodeA, int nodeB) { if (isFrozen()) throw new IllegalStateException("Cannot create edge if graph is already frozen"); ensureNodeIndex(Math.max(nodeA, nodeB)); int edgeId = edgeAccess.internalEdgeAdd(nextEdgeId(), nodeA, nodeB); EdgeIterable iter = new EdgeIterable(this, edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, nodeB); assert ret; if (extStorage.isRequireEdgeField()) iter.setAdditionalField(extStorage.getDefaultEdgeFieldValue()); return iter; }
@Test public void testNoCreateCalled() throws IOException { GraphHopperStorage gs = new GraphBuilder(encodingManager).build(); try { ((BaseGraph) gs.getGraph(Graph.class)).ensureNodeIndex(123); assertFalse("AssertionError should be raised", true); } catch (AssertionError err) { assertTrue(true); } catch (Exception ex) { assertFalse("AssertionError should be raised, but was " + ex.toString(), true); } finally { gs.close(); } }
@Override public final void setNode(int nodeId, double lat, double lon, double ele) { that.ensureNodeIndex(nodeId); long tmp = (long) nodeId * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_LAT, Helper.degreeToInt(lat)); that.nodes.setInt(tmp + that.N_LON, Helper.degreeToInt(lon)); if (is3D()) { // meter precision is sufficient for now that.nodes.setInt(tmp + that.N_ELE, Helper.eleToInt(ele)); that.bounds.update(lat, lon, ele); } else { that.bounds.update(lat, lon); } // set the default value for the additional field of this node if (that.extStorage.isRequireNodeField()) that.nodes.setInt(tmp + that.N_ADDITIONAL, that.extStorage.getDefaultNodeFieldValue()); }
@Override public void ensureNode( int nodeId ) { that.ensureNodeIndex(nodeId); }
@Override public void ensureNode(int nodeId) { that.ensureNodeIndex(nodeId); }
@Override public void ensureNode(int nodeId) { that.ensureNodeIndex(nodeId); }
@Override public final void setAdditionalNodeField( int index, int additionalValue ) { if (that.extStorage.isRequireNodeField() && that.N_ADDITIONAL >= 0) { that.ensureNodeIndex(index); long tmp = (long) index * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_ADDITIONAL, additionalValue); } else { throw new AssertionError("This graph does not provide an additional node field"); } }
@Override public final void setAdditionalNodeField(int index, int additionalValue) { if (that.extStorage.isRequireNodeField() && that.N_ADDITIONAL >= 0) { that.ensureNodeIndex(index); long tmp = (long) index * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_ADDITIONAL, additionalValue); } else { throw new AssertionError("This graph does not provide an additional node field"); } }
@Override public final void setAdditionalNodeField(int index, int additionalValue) { if (that.extStorage.isRequireNodeField() && that.N_ADDITIONAL >= 0) { that.ensureNodeIndex(index); long tmp = (long) index * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_ADDITIONAL, additionalValue); } else { throw new AssertionError("This graph does not provide an additional node field"); } }
@Override public CHEdgeIteratorState edge(int a, int b) { // increase edge array not for shortcuts baseGraph.ensureNodeIndex(Math.max(a, b)); int edgeId = baseGraph.edgeAccess.internalEdgeAdd(baseGraph.nextEdgeId(), a, b); CHEdgeIteratorImpl iter = new CHEdgeIteratorImpl(baseGraph, baseGraph.edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, b); assert ret; return iter; }
@Override public CHEdgeIteratorState edge( int a, int b ) { // increase edge array not for shortcuts baseGraph.ensureNodeIndex(Math.max(a, b)); int edgeId = baseGraph.edgeAccess.internalEdgeAdd(baseGraph.nextEdgeId(), a, b); CHEdgeIteratorImpl iter = new CHEdgeIteratorImpl(baseGraph, baseGraph.edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, b); assert ret; return iter; }
@Override public CHEdgeIteratorState edge(int a, int b) { // increase edge array not for shortcuts baseGraph.ensureNodeIndex(Math.max(a, b)); int edgeId = baseGraph.edgeAccess.internalEdgeAdd(baseGraph.nextEdgeId(), a, b); CHEdgeIteratorImpl iter = new CHEdgeIteratorImpl(baseGraph, baseGraph.edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, b); assert ret; return iter; }
/** * Create edge between nodes a and b * <p> * @return EdgeIteratorState of newly created edge */ @Override public EdgeIteratorState edge( int nodeA, int nodeB ) { if (isFrozen()) throw new IllegalStateException("Cannot create edge if graph is already frozen"); ensureNodeIndex(Math.max(nodeA, nodeB)); int edgeId = edgeAccess.internalEdgeAdd(nextEdgeId(), nodeA, nodeB); EdgeIterable iter = new EdgeIterable(this, edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, nodeB); assert ret; if (extStorage.isRequireEdgeField()) iter.setAdditionalField(extStorage.getDefaultEdgeFieldValue()); return iter; }
/** * Create edge between nodes a and b * <p> * * @return EdgeIteratorState of newly created edge */ @Override public EdgeIteratorState edge(int nodeA, int nodeB) { if (isFrozen()) throw new IllegalStateException("Cannot create edge if graph is already frozen"); ensureNodeIndex(Math.max(nodeA, nodeB)); int edgeId = edgeAccess.internalEdgeAdd(nextEdgeId(), nodeA, nodeB); EdgeIterable iter = new EdgeIterable(this, edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, nodeB); assert ret; if (extStorage.isRequireEdgeField()) iter.setAdditionalField(extStorage.getDefaultEdgeFieldValue()); return iter; }
/** * Create edge between nodes a and b * <p> * * @return EdgeIteratorState of newly created edge */ @Override public EdgeIteratorState edge(int nodeA, int nodeB) { if (isFrozen()) throw new IllegalStateException("Cannot create edge if graph is already frozen"); ensureNodeIndex(Math.max(nodeA, nodeB)); int edgeId = edgeAccess.internalEdgeAdd(nextEdgeId(), nodeA, nodeB); EdgeIterable iter = new EdgeIterable(this, edgeAccess, EdgeFilter.ALL_EDGES); boolean ret = iter.init(edgeId, nodeB); assert ret; if (extStorage.isRequireEdgeField()) iter.setAdditionalField(extStorage.getDefaultEdgeFieldValue()); return iter; }
@Override public final void setNode(int nodeId, double lat, double lon, double ele) { that.ensureNodeIndex(nodeId); long tmp = (long) nodeId * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_LAT, Helper.degreeToInt(lat)); that.nodes.setInt(tmp + that.N_LON, Helper.degreeToInt(lon)); if (is3D()) { // meter precision is sufficient for now that.nodes.setInt(tmp + that.N_ELE, Helper.eleToInt(ele)); that.bounds.update(lat, lon, ele); } else { that.bounds.update(lat, lon); } // set the default value for the additional field of this node if (that.extStorage.isRequireNodeField()) that.nodes.setInt(tmp + that.N_ADDITIONAL, that.extStorage.getDefaultNodeFieldValue()); }
@Override public final void setNode(int nodeId, double lat, double lon, double ele) { that.ensureNodeIndex(nodeId); long tmp = (long) nodeId * that.nodeEntryBytes; that.nodes.setInt(tmp + that.N_LAT, Helper.degreeToInt(lat)); that.nodes.setInt(tmp + that.N_LON, Helper.degreeToInt(lon)); if (is3D()) { // meter precision is sufficient for now that.nodes.setInt(tmp + that.N_ELE, Helper.eleToInt(ele)); that.bounds.update(lat, lon, ele); } else { that.bounds.update(lat, lon); } // set the default value for the additional field of this node if (that.extStorage.isRequireNodeField()) that.nodes.setInt(tmp + that.N_ADDITIONAL, that.extStorage.getDefaultNodeFieldValue()); }