BUGFIX 40

git-svn-id: https://osmand.googlecode.com/svn/trunk@463 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-08-17 22:32:22 +00:00
parent 47b249bb82
commit 64487887c3
6 changed files with 42 additions and 14 deletions

View file

@ -1,5 +1,10 @@
package net.osmand; package net.osmand;
import java.io.File;
import java.sql.SQLException;
import net.osmand.data.preparation.IndexCreator;
/** /**
* This class is designed to put all to do's and link them with code. * This class is designed to put all to do's and link them with code.
@ -11,12 +16,17 @@ public class ToDoConstants {
// Current result : for big file (1 - task 60-80% time, 90% memory) (?) (+) // Current result : for big file (1 - task 60-80% time, 90% memory) (?) (+)
// 11. Index buildings using interpolations (from nodes) (+) // 11. Index buildings using interpolations (from nodes) (+)
// ! 12. Reinvent UI of swing app (remove Region object and clear other MapObject) use indexes to show results // ! 12. Reinvent UI of swing app (remove Region object and clear other MapObject) use indexes to show results
// 13. Automative to index way nodes or not.
// TODO max 86 // TODO max 86
// ! 81. Add some objects to POI category (1) to add them into OSM 2) to help navigation) // ! 81. Add some objects to POI category (1) to add them into OSM 2) to help navigation)
// highway (?), traffic_calming (?), barrier(?), military(?-), landuse (?), office(?), man_made(?), power(?), // highway (?), traffic_calming (?), barrier(?), military(?-), landuse (?), office(?), man_made(?), power(?),
// railway( station, subway?) - issue 17 // railway( station, subway?) - issue 17
// TODO check network availability
// TODO in IndexCreator and other files!
// TODO BUGS: // TODO BUGS:
// USA indexes // USA indexes
// ! VELCOM - competition (ppt) // ! VELCOM - competition (ppt)
@ -28,9 +38,7 @@ public class ToDoConstants {
// - menu order (41) // - menu order (41)
// - landscape view not reachable (39) // - landscape view not reachable (39)
// - 81. (17) // - 81. (17)
// - scroll ball (42)
// -- house tagging (31) // -- house tagging (31)
// -- crash (40)
// --- go back to osmand (23) // --- go back to osmand (23)
// --- keyboard (43) // --- keyboard (43)
// --- add poi tags (44) // --- add poi tags (44)
@ -65,4 +73,14 @@ public class ToDoConstants {
// 10. Improve address indexing (use relations). (+) // 10. Improve address indexing (use relations). (+)
// use relation "a6" (to accumulate streets!), "a3" to read all cities & define boundaries for city (& define that street in city). // use relation "a6" (to accumulate streets!), "a3" to read all cities & define boundaries for city (& define that street in city).
public static void main(String[] args) throws SQLException, ClassNotFoundException {
File dir = new File("e:\\Information\\OSM maps\\osm_batch_ind\\");
Class.forName("org.sqlite.JDBC");
for(File f : dir.listFiles()){
if(f.getName().endsWith(".odb")){
IndexCreator.removeWayNodes(f);
}
}
}
} }

View file

@ -353,6 +353,7 @@ public class IndexBatchCreator {
indexCreator.setIndexAddress(indexAddress); indexCreator.setIndexAddress(indexAddress);
indexCreator.setIndexPOI(indexPOI); indexCreator.setIndexPOI(indexPOI);
indexCreator.setIndexTransport(indexTransport); indexCreator.setIndexTransport(indexTransport);
indexCreator.setLastModifiedDate(f.lastModified());
indexCreator.setNormalizeStreets(true); indexCreator.setNormalizeStreets(true);
indexCreator.setSaveAddressWays(writeWayNodes); indexCreator.setSaveAddressWays(writeWayNodes);

View file

@ -1307,6 +1307,20 @@ public class IndexCreator {
} }
} }
public static void removeWayNodes(File sqlitedb) throws SQLException{
Connection dbConn = DriverManager.getConnection("jdbc:sqlite:" + sqlitedb.getAbsolutePath());
dbConn.setAutoCommit(false);
Statement st = dbConn.createStatement();
st.execute("DELETE FROM " + IndexStreetNodeTable.getTable() + " WHERE 1=1");
st.close();
dbConn.commit();
dbConn.setAutoCommit(true);
st = dbConn.createStatement();
st.execute("VACUUM");
st.close();
dbConn.close();
}
public static void main(String[] args) throws IOException, SAXException, SQLException { public static void main(String[] args) throws IOException, SAXException, SQLException {
File workDir = new File("C:/"); File workDir = new File("C:/");

View file

@ -7,7 +7,6 @@
<TextView android:textSize="16sp" android:id="@+id/TextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:text="@string/navigate_point_top_text"></TextView> <TextView android:textSize="16sp" android:id="@+id/TextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:text="@string/navigate_point_top_text"></TextView>
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"> <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1">
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1"> <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1">
<TableRow android:layout_width="fill_parent" > <TableRow android:layout_width="fill_parent" >
@ -18,17 +17,15 @@
<TextView android:textSize="20sp" android:id="@+id/TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="@string/navigate_point_longitude"></TextView> <TextView android:textSize="20sp" android:id="@+id/TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="@string/navigate_point_longitude"></TextView>
<EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/LongitudeEdit" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:inputType="number|time"></EditText> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/LongitudeEdit" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:inputType="number|time"></EditText>
</TableRow> </TableRow>
</TableLayout>
<RadioGroup android:id="@+id/RadioGroup" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RadioGroup android:id="@+id/RadioGroup" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" >
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format1" android:text="@string/navigate_point_format_D"></RadioButton> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format1" android:text="@string/navigate_point_format_D"></RadioButton>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format2" android:text="@string/navigate_point_format_DM"></RadioButton> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format2" android:text="@string/navigate_point_format_DM"></RadioButton>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format3" android:text="@string/navigate_point_format_DMS"></RadioButton> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format3" android:text="@string/navigate_point_format_DMS"></RadioButton>
</RadioGroup> </RadioGroup>
<TextView android:id="@+id/ValidateTextView" android:textSize="16sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="center" android:textColor="@color/color_red"></TextView> <TextView android:id="@+id/ValidateTextView" android:textSize="16sp" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="center" android:textColor="@color/color_red"></TextView>
</LinearLayout> </TableLayout>
</ScrollView> </ScrollView>
<LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" <LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"
android:gravity="center"> android:gravity="center">

View file

@ -7,7 +7,7 @@
<TextView android:id="@+id/TextView" android:textSize="16sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" android:text="@string/navigate_point_top_text"></TextView> <TextView android:id="@+id/TextView" android:textSize="16sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" android:text="@string/navigate_point_top_text"></TextView>
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"> <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1">
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1"> <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1">
<TableRow android:layout_width="fill_parent" > <TableRow android:layout_width="fill_parent" >
<TextView android:textSize="20sp" android:id="@+id/TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="@string/navigate_point_latitude"></TextView> <TextView android:textSize="20sp" android:id="@+id/TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="@string/navigate_point_latitude"></TextView>
@ -17,17 +17,13 @@
<TextView android:textSize="20sp" android:id="@+id/TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="@string/navigate_point_longitude"></TextView> <TextView android:textSize="20sp" android:id="@+id/TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="@string/navigate_point_longitude"></TextView>
<EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/LongitudeEdit" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:inputType="number|time"></EditText> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/LongitudeEdit" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:inputType="number|time"></EditText>
</TableRow> </TableRow>
</TableLayout>
<RadioGroup android:id="@+id/RadioGroup" android:layout_marginLeft="70dp" android:layout_marginTop="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RadioGroup android:id="@+id/RadioGroup" android:layout_marginLeft="70dp" android:layout_marginTop="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format1" android:text="@string/navigate_point_format_D"></RadioButton> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format1" android:text="@string/navigate_point_format_D"></RadioButton>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format2" android:text="@string/navigate_point_format_DM"></RadioButton> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format2" android:text="@string/navigate_point_format_DM"></RadioButton>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format3" android:text="@string/navigate_point_format_DMS"></RadioButton> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Format3" android:text="@string/navigate_point_format_DMS"></RadioButton>
</RadioGroup> </RadioGroup>
<TextView android:id="@+id/ValidateTextView" android:textSize="16sp" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="center" android:textColor="@color/color_red"></TextView>
</TableLayout>
<TextView android:id="@+id/ValidateTextView" android:textSize="16sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="center" android:textColor="@color/color_red"></TextView>
</LinearLayout>
</ScrollView> </ScrollView>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center">

View file

@ -93,6 +93,7 @@ public class NavigatePointActivity extends Activity {
((TextView)findViewById(R.id.LatitudeEdit)).setText(convert(lat, newFormat)); ((TextView)findViewById(R.id.LatitudeEdit)).setText(convert(lat, newFormat));
((TextView)findViewById(R.id.LongitudeEdit)).setText(convert(lon, newFormat)); ((TextView)findViewById(R.id.LongitudeEdit)).setText(convert(lon, newFormat));
} catch (RuntimeException e) { } catch (RuntimeException e) {
((TextView) findViewById(R.id.ValidateTextView)).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.ValidateTextView)).setText(R.string.invalid_locations); ((TextView) findViewById(R.id.ValidateTextView)).setText(R.string.invalid_locations);
Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$ Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$
} }
@ -137,6 +138,7 @@ public class NavigatePointActivity extends Activity {
} }
close(); close();
} catch (RuntimeException e) { } catch (RuntimeException e) {
((TextView) findViewById(R.id.ValidateTextView)).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.ValidateTextView)).setText(R.string.invalid_locations); ((TextView) findViewById(R.id.ValidateTextView)).setText(R.string.invalid_locations);
Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$ Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$
} }