fix issue 222
git-svn-id: https://osmand.googlecode.com/svn/trunk@724 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
255a5c3bed
commit
940c542da6
3 changed files with 19 additions and 9 deletions
Binary file not shown.
|
@ -364,7 +364,7 @@ public class DataIndexWriter {
|
|||
public static void insertBinaryMapRenderObjectIndex(Map<PreparedStatement, Integer> statements,
|
||||
PreparedStatement mapBinaryStat, RTree mapTree, Entity e, String name,
|
||||
long id, int type, List<Integer> typeUse, int highwayAttributes, List<Long> restrictions,
|
||||
boolean inversePath, boolean writeAsPoint, int batchSize) throws SQLException {
|
||||
boolean inversePath, boolean writeAsPoint, boolean commit) throws SQLException {
|
||||
if(e instanceof Relation){
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ public class DataIndexWriter {
|
|||
mapBinaryStat.setBytes(5, bnodes.toByteArray());
|
||||
mapBinaryStat.setInt(6, highwayAttributes);
|
||||
|
||||
addBatch(statements, mapBinaryStat);
|
||||
addBatch(statements, mapBinaryStat, commit);
|
||||
try {
|
||||
mapTree.insert(new LeafElement(new Rect(minX, minY, maxX, maxY), id));
|
||||
} catch (RTreeInsertException e1) {
|
||||
|
@ -438,15 +438,25 @@ public class DataIndexWriter {
|
|||
}
|
||||
}
|
||||
}
|
||||
private static void addBatch(Map<PreparedStatement, Integer> count, PreparedStatement p) throws SQLException{
|
||||
addBatch(count, p, BATCH_SIZE);
|
||||
private static void addBatch(Map<PreparedStatement, Integer> count, PreparedStatement p) throws SQLException {
|
||||
addBatch(count, p, BATCH_SIZE, true);
|
||||
}
|
||||
|
||||
public static void addBatch(Map<PreparedStatement, Integer> count, PreparedStatement p, boolean commit) throws SQLException{
|
||||
addBatch(count, p, BATCH_SIZE, commit);
|
||||
}
|
||||
|
||||
public static void addBatch(Map<PreparedStatement, Integer> count, PreparedStatement p, int batchSize) throws SQLException{
|
||||
addBatch(count, p, batchSize, true);
|
||||
}
|
||||
|
||||
public static void addBatch(Map<PreparedStatement, Integer> count, PreparedStatement p, int batchSize, boolean commit) throws SQLException{
|
||||
p.addBatch();
|
||||
if(count.get(p) >= batchSize){
|
||||
p.executeBatch();
|
||||
p.getConnection().commit();
|
||||
if(commit){
|
||||
p.getConnection().commit();
|
||||
}
|
||||
count.put(p, 0);
|
||||
} else {
|
||||
count.put(p, count.get(p) + 1);
|
||||
|
|
|
@ -1567,7 +1567,7 @@ public class IndexCreator {
|
|||
}
|
||||
if (!skip) {
|
||||
DataIndexWriter.insertBinaryMapRenderObjectIndex(pStatements, mapBinaryStat, rtree, e, eName, id, type, typeUse,
|
||||
highwayAttributes, restrictionsUse, inverse, point, BATCH_SIZE);
|
||||
highwayAttributes, restrictionsUse, inverse, point, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1768,7 +1768,7 @@ public class IndexCreator {
|
|||
|
||||
int type = decodeTypesFromOneLong(ltype);
|
||||
DataIndexWriter.insertBinaryMapRenderObjectIndex(pStatements, mapBinaryStat, mapTree[level], newWs, name,
|
||||
id, type, typeUse, 0, restrictionsUse, false, false, BATCH_SIZE);
|
||||
id, type, typeUse, 0, restrictionsUse, false, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2780,8 +2780,8 @@ public class IndexCreator {
|
|||
creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/minsk.osm"), new ConsoleProgressImplementation(3), null);
|
||||
|
||||
|
||||
// creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/belarus_nodes.tmp.odb"));
|
||||
// creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/belarus.osm.pbf"), new ConsoleProgressImplementation(3), null);
|
||||
// creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/belarus_nodes.tmp.odb")); //$NON-NLS-1$
|
||||
// creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/belarus.osm.pbf"), new ConsoleProgressImplementation(3), null); //$NON-NLS-1$
|
||||
|
||||
// creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/ams.tmp.odb"));
|
||||
// creator.generateIndexes(new File("e:/Information/OSM maps/osm_map/ams_part_map.osm"), new ConsoleProgressImplementation(3), null);
|
||||
|
|
Loading…
Reference in a new issue