/** @return converted tower node */ private int handlePillarNode( int tmpNode, long osmId, PointList pointList, boolean convertToTowerNode) { tmpNode = tmpNode - 3; int intlat = pillarLats.getInt(tmpNode); int intlon = pillarLons.getInt(tmpNode); if (intlat == Integer.MAX_VALUE || intlon == Integer.MAX_VALUE) throw new AssertionError( "Conversation pillarNode to towerNode already happended!? " + "osmId:" + osmId + " pillarIndex:" + tmpNode); double tmpLat = Helper.intToDegree(intlat); double tmpLon = Helper.intToDegree(intlon); if (convertToTowerNode) { // convert pillarNode type to towerNode, make pillar values invalid pillarLons.setInt(tmpNode, Integer.MAX_VALUE); pillarLats.setInt(tmpNode, Integer.MAX_VALUE); tmpNode = addTowerNode(osmId, tmpLat, tmpLon); } else pointList.add(tmpLat, tmpLon); return tmpNode; }
@Test public void testHeader() { DataAccess da = createDataAccess(name); da.create(300); da.setHeader(7 * 4, 123); assertEquals(123, da.getHeader(7 * 4)); da.setHeader(10 * 4, Integer.MAX_VALUE / 3); assertEquals(Integer.MAX_VALUE / 3, da.getHeader(10 * 4)); da.setHeader(11 * 4, Helper.degreeToInt(123.321)); assertEquals(123.321, Helper.intToDegree(da.getHeader(11 * 4)), 1e-4); da.flush(); da.close(); da = createDataAccess(name); assertTrue(da.loadExisting()); assertEquals(123, da.getHeader(7 * 4)); da.close(); }
@Override public double getLongitude(int id) { int intVal = da.getInt((long) id * rowSizeInBytes + LON); return Helper.intToDegree(intVal); }