From 922fa3bdb46d27c7ae725a32319ae27dcecf8fbf Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 2 Jul 2010 13:30:30 +0000 Subject: [PATCH] fix indexing options git-svn-id: https://osmand.googlecode.com/svn/trunk@277 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/ToDoConstants.java | 2 ++ .../src/com/osmand/data/TransportRoute.java | 15 +++++++++++++++ .../com/osmand/data/index/DataIndexWriter.java | 2 +- .../src/com/osmand/data/index/IndexConstants.java | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index 443a1d2677..e4bc947d48 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -44,6 +44,8 @@ public class ToDoConstants { // BUGS Android // FIXME !!!! Check agains ID is not unique ! (for relation/node/way - it could be the same) - checked for data extraction & index creator + // REFACTOR Settings activity ( for check box properties!) + // Download index show current index information // TODO swing // 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index ! diff --git a/DataExtractionOSM/src/com/osmand/data/TransportRoute.java b/DataExtractionOSM/src/com/osmand/data/TransportRoute.java index a84b28f962..81c16570ef 100644 --- a/DataExtractionOSM/src/com/osmand/data/TransportRoute.java +++ b/DataExtractionOSM/src/com/osmand/data/TransportRoute.java @@ -15,12 +15,16 @@ public class TransportRoute extends MapObject { private String ref; private String operator; private String type; + private Integer dist = null; public TransportRoute(Relation r, String ref){ super(r); this.ref = ref; } + public TransportRoute(){ + } + public List getForwardStops() { return forwardStops; } @@ -67,6 +71,17 @@ public class TransportRoute extends MapObject { this.type = type; } + public int getDistance(){ + if(dist == null){ + dist = getAvgBothDistance(); + } + return dist; + } + + public void setDistance(Integer dist) { + this.dist = dist; + } + public int getAvgBothDistance(){ int d = 0; for(int i=1; i< backwardStops.size(); i++){ diff --git a/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java b/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java index 56a63b8bae..1bd541243d 100644 --- a/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java +++ b/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java @@ -340,7 +340,7 @@ public class DataIndexWriter { assert IndexTransportRouteStop.values().length == 3; prepRouteStops.setLong(IndexTransportRouteStop.ROUTE.ordinal() + 1, r.getId()); prepRouteStops.setLong(IndexTransportRouteStop.STOP.ordinal() + 1, s.getId()); - prepRouteStops.setBoolean(IndexTransportRouteStop.DIRECTION.ordinal() + 1, direction); + prepRouteStops.setInt(IndexTransportRouteStop.DIRECTION.ordinal() + 1, direction ? 1 : 0); addBatch(count, prepRouteStops); } } diff --git a/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java b/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java index bbf5a95a17..2a4f1aca57 100644 --- a/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java +++ b/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java @@ -327,7 +327,7 @@ public class IndexConstants { public enum IndexTransportRouteStop implements IndexColumn { - STOP("long", true), ROUTE("long", true), DIRECTION("boolean"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + STOP("long", true), ROUTE("long", true), DIRECTION("short"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ boolean index = false; String type = null;