/** * Adds the data of an original edge to this graph. * * @param originalEdge The database' original edge, which has to be added. * @param boundingBox The data collector for the bounding box data, which will be updated. */ private void addOriginalEdge( final DatabaseReader.OriginalEdge originalEdge, final Integer[] boundingBox) { namePerOriginalEdge[originalEdge.id] = originalEdge.name; refPerOriginalEdge[originalEdge.id] = originalEdge.ref; roundaboutPerOriginalEdge[originalEdge.id] = originalEdge.roundabout; streetTypePerOriginalEdge[originalEdge.id] = originalEdge.osmStreetType; longitudesPerOriginalEdge[originalEdge.id] = new int[originalEdge.longitudes.length]; for (int i = 0; i < originalEdge.longitudes.length; i++) { final int longitudeE6 = GeoCoordinate.doubleToInt(originalEdge.longitudes[i]); longitudesPerOriginalEdge[originalEdge.id][i] = longitudeE6; // find the min/max for longitude if (boundingBox[0] > longitudeE6) { boundingBox[0] = longitudeE6; } if (boundingBox[1] < longitudeE6) { boundingBox[1] = longitudeE6; } } latitudesPerOriginalEdge[originalEdge.id] = new int[originalEdge.latitudes.length]; for (int i = 0; i < originalEdge.latitudes.length; i++) { final int latitudeE6 = GeoCoordinate.doubleToInt(originalEdge.latitudes[i]); latitudesPerOriginalEdge[originalEdge.id][i] = latitudeE6; // find the min/max for latitude if (boundingBox[2] > latitudeE6) { boundingBox[2] = latitudeE6; } if (boundingBox[3] < latitudeE6) { boundingBox[3] = latitudeE6; } } }
/** * Adds a vertex to this graph. * * @param vertex The database' vertex, which has to be added. * @param boundingBox The data collector for the bounding box data, which will be updated. * @param outgoingEdgesLists The lists of outgoing edges per vertex. * @param edgesLists The lists of edges per vertex. */ private void addVertex( final DatabaseReader.Vertex vertex, final Integer[] boundingBox, final TIntArrayList[] outgoingEdgesLists, final TIntSet[] edgesLists) { final int longitudeE6 = GeoCoordinate.doubleToInt(vertex.longitude); final int latitudeE6 = GeoCoordinate.doubleToInt(vertex.latitude); longitudesE6[vertex.id] = longitudeE6; latitudesE6[vertex.id] = latitudeE6; vertexLevels[vertex.id] = vertex.level; // find the min/max for longitude/latitude if (boundingBox[0] == null || boundingBox[0] > longitudeE6) { boundingBox[0] = longitudeE6; } if (boundingBox[1] == null || boundingBox[1] < longitudeE6) { boundingBox[1] = longitudeE6; } if (boundingBox[2] == null || boundingBox[2] > latitudeE6) { boundingBox[2] = latitudeE6; } if (boundingBox[3] == null || boundingBox[3] < latitudeE6) { boundingBox[3] = latitudeE6; } outgoingEdgesLists[vertex.id] = new TIntArrayList(12); edgesLists[vertex.id] = new TIntHashSet(24); }