- extract App into separate project, make VectorTileMap a library project

- added minimum MapActivity example
This commit is contained in:
Hannes Janetzek 2012-10-28 17:28:24 +01:00
parent ab5962d56c
commit 5916f1be5e
120 changed files with 0 additions and 7694 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>About this software</title>
<meta http-equiv="Content-Style-Type" content="text/css" />
</head>
<body style="padding: 0.5em;">
<p style="text-align: center;"><img src="file:///android_asset/globe2.png" style="width: 72px; height: 72px;" /><br />Version 0.2.1</p>
<p>
<li><a href="https://code.google.com/p/vector-tile-map">OpenScienceMap</a> is distributed under the <a href="http://www.gnu.org/licenses/lgpl.html">LGPL3</a>.
Please report any bugs, problems or feature requests via our <a href="https://code.google.com/p/vector-tile-map/issues/list">issue tracker</a></li></p>
<p></p>
<p></p>
<p> <li> This software contains fragments of <a href="https://code.google.com/p/mapsforge">mapsforge</a> library and <a href="http://code.google.com/p/osmdroid">osmdroid</a>.</li></p>
<p> <li>Map data © <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.</li></p>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/btn_snap_pressed" />
<item android:state_checked="true" android:drawable="@drawable/btn_snap_selected" />
<item android:drawable="@drawable/btn_snap_normal" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#BB000000" />
</shape>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/delete_pressed"
android:state_pressed="true" />
<item android:drawable="@drawable/delete"
android:state_focused="true" />
<item android:drawable="@drawable/delete" />
</selector>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/moreinfo_arrow_pressed"
android:state_pressed="true" />
<item android:drawable="@drawable/moreinfo_arrow"
android:state_focused="true" />
<item android:drawable="@drawable/moreinfo_arrow" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/filePickerView"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:fadingEdge="vertical"
android:fadingEdgeLength="30dip" android:columnWidth="100dip" android:numColumns="auto_fit" />

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:windowActionBarOverlay="true" >
<org.oscim.view.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<ToggleButton
android:id="@+id/snapToLocationView"
android:layout_width="57dp"
android:layout_height="72dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dip"
android:layout_marginRight="10dip"
android:background="@drawable/snap_to_position"
android:textOff=""
android:textOn=""
android:visibility="gone" />
</RelativeLayout>

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bonuspack_bubble_black" >
<ImageView android:id="@+id/bubble_image"
android:layout_width="65dp"
android:layout_height="65dp"
android:paddingLeft="5dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView android:id="@+id/bubble_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:maxEms="17"
android:layout_gravity="left"
android:layout_weight="1"
android:text="Title" />
<Button android:id="@+id/bubble_moreinfo"
android:background="@drawable/btn_moreinfo"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="0" />
</LinearLayout>
<TextView android:id="@+id/bubble_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="12dp"
android:maxEms="17"
android:text="Description" />
<TextView android:id="@+id/bubble_subdescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="10dp"
android:maxEms="17"
android:text="Address"
android:visibility="gone"
/>
</LinearLayout>
</LinearLayout>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="20dip">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:text="@string/latitude" android:textStyle="bold" android:textColor="#FFF" />
<EditText android:id="@+id/latitude" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:maxLength="9" android:inputType="numberSigned|numberDecimal" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:text="@string/longitude" android:textStyle="bold" android:textColor="#FFF" />
<EditText android:id="@+id/longitude" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:maxLength="9" android:inputType="numberSigned|numberDecimal" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:text="@string/zoomLevel" android:textStyle="bold" android:textColor="#FFF" />
<SeekBar android:id="@+id/zoomLevel" android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView android:id="@+id/zoomlevelValue" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textStyle="bold" android:gravity="center_horizontal" />
</LinearLayout>
</ScrollView>

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="20dip">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_name"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewName" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_size"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewSize" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_version"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewVersion" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_debug"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewDebug" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_date"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewDate" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_area"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewArea" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_start_position"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewStartPosition" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_start_zoom_level"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewStartZoomLevel" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:text="@string/info_map_file_language_preference" android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewLanguagePreference" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_comment"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewComment" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/info_map_file_created_by"
android:textStyle="bold" android:textColor="#FFF" />
<TextView android:id="@+id/infoMapFileViewCreatedBy" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="10dip" />
</LinearLayout>
</ScrollView>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/thumbnail"
android:layout_width="65dp"
android:layout_height="65dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_continue" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="instructions"
android:textColor="#000000" />
<TextView
android:id="@+id/details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="distance/duration"
android:textColor="#555555" />
</LinearLayout>
</LinearLayout>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#55000000"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|clip_vertical"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:background="#FFFFFF"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/poiTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:completionThreshold="1" />
<Button
android:id="@+id/buttonSetPOITag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search" />
</LinearLayout>
<ListView
android:id="@+id/items"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</LinearLayout>

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bonuspack_bubble_black" >
<ImageView android:id="@+id/bubble_image"
android:layout_width="65dp"
android:layout_height="65dp"
android:paddingLeft="5dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView android:id="@+id/bubble_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:maxEms="17"
android:text="Title" />
</LinearLayout>
<TextView android:id="@+id/bubble_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="12dp"
android:maxEms="17"
android:text="Description" />
<TextView android:id="@+id/bubble_subdescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="10dp"
android:maxEms="17"
android:text="Address"
android:visibility="gone" />
</LinearLayout>
<Button android:id="@+id/bubble_delete"
android:background="@drawable/btn_delete"
android:visibility="visible"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="right" />
</LinearLayout>

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bonuspack_bubble" >
<ImageView android:id="@+id/bubble_image"
android:layout_width="65dp"
android:layout_height="65dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView android:id="@+id/bubble_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:maxEms="17"
android:layout_gravity="left"
android:layout_weight="1"
android:text="Title" />
<Button android:id="@+id/bubble_moreinfo"
android:background="@drawable/btn_moreinfo"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="0" />
</LinearLayout>
<TextView android:id="@+id/bubble_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="12dp"
android:maxEms="17"
android:text="Description" />
<TextView android:id="@+id/bubble_subdescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="10dp"
android:maxEms="17"
android:text="Address"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/editDestination"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="1"
android:hint="@string/destination" />
<Button
android:id="@+id/buttonSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="0"
android:text="Search" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<AutoCompleteTextView
android:id="@+id/poiTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="1"
android:completionThreshold="1"
android:hint="POI tag" />
<Button
android:id="@+id/buttonSetPOITag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="0"
android:text="Search" />
</LinearLayout>
<TextView
android:id="@+id/routeInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFBBBBBB"
android:textColor="#FF000000" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<org.osmdroid.views.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
</LinearLayout>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_departure"
android:title="Set Departure"/>
<item
android:id="@+id/menu_destination"
android:title="Set Destination"/>
<item
android:id="@+id/menu_viapoint"
android:title="Add Via-Point"/>
<item
android:id="@+id/menu_none"
android:title="Cancel"/>
</menu>

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_position"
android:icon="@drawable/ic_menu_mylocation"
android:showAsAction="always"
android:title="@string/menu_position">
<menu>
<item
android:id="@+id/menu_position_my_location_enable"
android:title="@string/menu_position_my_location_enable"/>
<item
android:id="@+id/menu_position_my_location_disable"
android:title="@string/menu_position_my_location_disable"/>
<!--
<item
android:id="@+id/menu_position_last_known"
android:title="@string/menu_position_last_known"/>
-->
<item
android:id="@+id/menu_position_enter_coordinates"
android:title="@string/menu_position_enter_coordinates"/>
<item
android:id="@+id/menu_position_map_center"
android:title="@string/menu_position_map_file_center"/>
<item
android:id="@+id/menu_rotation_enable"
android:title="@string/menu_rotation_enable"/>
<item
android:id="@+id/menu_rotation_disable"
android:title="@string/menu_rotation_disable"/>
<item
android:id="@+id/menu_compass_enable"
android:title="@string/menu_compass_enable"/>
<item
android:id="@+id/menu_compass_disable"
android:title="@string/menu_compass_disable"/>
</menu>
</item>
<!--
<item
android:id="@+id/menu_options"
android:icon="@drawable/ic_menu_options"
android:showAsAction="always"
android:title="@string/menu_options">
<menu>
-->
<!-- android:icon="@drawable/ic_menu_preferences" -->
<item
android:id="@+id/menu_preferences"
android:showAsAction="never"
android:icon="@drawable/ic_menu_options"
android:title="@string/menu_preferences"/>
<!-- android:icon="@drawable/ic_menu_mapmode" -->
<!-- android:icon="@drawable/ic_menu_archive" -->
<!--
<item
android:id="@+id/menu_mapfile"
android:showAsAction="never"
android:title="@string/menu_mapfile"/>
-->
<!--
<item
android:id="@+id/menu_info_map_file"
android:title="@string/menu_info_map_file"/>
-->
<!--
</menu>
</item>
-->
<item
android:id="@+id/menu_render_theme"
android:showAsAction="never"
android:title="@string/menu_render_theme">
<menu>
<item
android:id="@+id/menu_render_theme_osmarender"
android:title="@string/menu_render_theme_osmarender"/>
<item
android:id="@+id/menu_render_theme_tronrender"
android:title="@string/menu_render_theme_tronrender"/>
<item
android:id="@+id/menu_render_theme_select_file"
android:title="@string/menu_render_theme_select_file"/>
</menu>
</item>
<item
android:id="@+id/menu_info_about"
android:title="@string/menu_info_about"/>
<item
android:id="@+id/menu_pois"
android:title="@string/menu_pois"/>
<item
android:id="@+id/menu_poi_list"
android:title="@string/menu_poi_list"/>
</menu>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_link"
android:title="Open URL"/>
<item
android:id="@+id/menu_none"
android:title="Cancel"/>
</menu>

View File

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<!-- <string-array name="preferences_map_generator_values">
<item>Mapfile</item>
<item>PostGIS</item>
<item>OpenScienceMap</item>
</string-array> -->
<string-array name="preferences_scale_bar_unit_values">
<item>angloamerikanisch</item>
<item>metrisch</item>
</string-array>
<string-array name="preferences_text_scale_values">
<item>winzig</item>
<item>klein</item>
<item>normal</item>
<item>groß</item>
<item>riesig</item>
</string-array>
<string name="application_name">OpenScienceMap</string>
<string name="cancel">Abbrechen</string>
<string name="error">Fehler</string>
<string name="error_last_location_unknown">Die letzte Position ist unbekannt</string>
<string name="file_invalid">Die gewählte Datei ist ungültig.</string>
<string name="file_select">Bitte wählen Sie eine Datei.</string>
<string name="file_size_byte">byte</string>
<string name="file_size_bytes">bytes</string>
<string name="file_size_kb">kB</string>
<string name="file_size_mb">MB</string>
<string name="file_size_gb">GB</string>
<string name="go_to_position">Gehe zu Position</string>
<string name="info_map_file_area">Fläche</string>
<string name="info_map_file_comment">Kommentar</string>
<string name="info_map_file_created_by">Erzeugt von</string>
<string name="info_map_file_date">Datum</string>
<string name="info_map_file_debug">Debug-Informationen</string>
<string name="info_map_file_debug_no">nicht enthalten</string>
<string name="info_map_file_debug_yes">enthalten</string>
<string name="info_map_file_language_preference">Bevorzugte Sprache</string>
<string name="info_map_file_name">Datei</string>
<string name="info_map_file_size">Dateigröße</string>
<string name="info_map_file_start">Startposition</string>
<string name="info_map_file_start_position">Startposition</string>
<string name="info_map_file_start_zoom_level">Start-Zoomstufe</string>
<string name="info_map_file_version">Version</string>
<string name="latitude">Breitengrad</string>
<string name="longitude">Längengrad</string>
<string name="menu_info">Info</string>
<string name="menu_info_map_file">Kartendatei-Info</string>
<string name="menu_info_about">Über diese Software</string>
<string name="menu_mapfile">Kartendatei</string>
<string name="menu_position">Position</string>
<string name="menu_position_enter_coordinates">Koordinaten eingeben</string>
<string name="menu_position_last_known">Letzte bekannte Position</string>
<string name="menu_position_map_file_center">Zentrum der Kartendatei</string>
<string name="menu_position_my_location_enable">Meine Position anzeigen</string>
<string name="menu_position_my_location_disable">Meine Position entfernen</string>
<string name="menu_preferences">Einstellungen</string>
<string name="menu_render_theme">Render-Theme</string>
<string name="menu_render_theme_osmarender">Default Theme</string>
<string name="menu_render_theme_select_file">XML-Datei wählen …</string>
<string name="menu_screenshot">Screenshot</string>
<string name="menu_screenshot_jpeg">JPEG (verlustbehaftet)</string>
<string name="menu_screenshot_png">PNG (verlustlos)</string>
<string name="no_location_provider_available">Keine Standortquelle verfügbar</string>
<string name="ok">OK</string>
<string name="preferences_debug">Entwicklungs-Einstellungen</string>
<string name="preferences_general">Allgemeine Einstellungen</string>
<string name="preferences_cache_persistence">Cache-Persistenz</string>
<string name="preferences_cache_persistence_desc">Zwischenspeicher beim Beenden beibehalten</string>
<string name="preferences_cache_size">Externer Speicher</string>
<string name="preferences_cache_size_desc">Größe des Caches anpassen</string>
<string name="preferences_cache_size_value">%.1f MB</string>
<string name="preferences_fullscreen">Vollbildmodus</string>
<string name="preferences_fullscreen_desc">Verberge die Statusleiste</string>
<string name="preferences_map">Karteneinstellungen</string>
<string name="preferences_map_view_mode">Karten-Modus</string>
<string name="preferences_map_view_mode_desc">Arbeitsmodus der Karte auswählen</string>
<string name="preferences_move_speed">Scrollgeschwindigkeit</string>
<string name="preferences_move_speed_desc">Scrollgeschwindigkeit der Karte anpassen</string>
<string name="preferences_move_speed_value">%d %% Scrollgeschwindigkeit</string>
<string name="preferences_scale_bar_unit">Kartenmaßstabs-Einheit</string>
<string name="preferences_scale_bar_unit_desc">Einheit des Kartenmaßstabs auswählen</string>
<string name="preferences_show_fps_counter">Bildfrequenz</string>
<string name="preferences_show_fps_counter_desc">FPS-Zähler anzeigen</string>
<string name="preferences_show_scale_bar">Kartenmaßstab</string>
<string name="preferences_show_scale_bar_desc">Maßstabsbalken der Karte anzeigen</string>
<string name="preferences_show_tile_coordinates">Tile-Koordinaten</string>
<string name="preferences_show_tile_coordinates_desc">Koordinaten auf Kacheln malen</string>
<string name="preferences_show_tile_frames">Tile-Umrandungen</string>
<string name="preferences_show_tile_frames_desc">Rahmen um Tiles malen</string>
<string name="preferences_show_water_tiles">Wasser-Kacheln</string>
<string name="preferences_show_water_tiles_desc">Kacheln mit gesetztem Wasser-Bit hervorheben</string>
<string name="preferences_text_scale">Schriftgröße</string>
<string name="preferences_text_scale_desc">Basisgröße für Karten-Beschriftungen auswählen</string>
<string name="preferences_wake_lock">Aktiv bleiben</string>
<string name="preferences_wake_lock_desc">Abschaltung des Bildschirms verhindern</string>
<string name="snap_to_location_enabled">Snap to position ist aktiviert</string>
<string name="snap_to_location_disabled">Snap-to-Position ist deaktiviert</string>
<string name="unit_symbol_kilometer">&#160;km</string>
<string name="unit_symbol_meter">&#160;m</string>
<string name="zoomLevel">Zoomstufe</string>
</resources>

View File

@ -1,91 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string-array name="preferences_text_scale_values">
<item>hyvin pieni</item>
<item>pieni</item>
<item>normaali</item>
<item>suuri</item>
<item>hyvin suuri</item>
</string-array>
<string name="application_name">OpenScienceMap</string>
<string name="cancel">Peruuta</string>
<string name="error">Virhe</string>
<string name="error_last_location_unknown">Viimeinen sijainti ei ole tiedossa</string>
<string name="file_invalid">Valittu tiedosto ei ole kelvollinen karttatiedosto.</string>
<string name="file_select">Valitse karttatiedosto.</string>
<string name="file_size_byte">tavu</string>
<string name="file_size_bytes">tavua</string>
<string name="file_size_kb">kB</string>
<string name="file_size_mb">MB</string>
<string name="file_size_gb">GB</string>
<string name="go_to_position">Mene sijaintiin</string>
<string name="info_map_file_area">Alue</string>
<string name="info_map_file_comment">Kommentti</string>
<string name="info_map_file_date">Päivämäärä</string>
<string name="info_map_file_debug">Debuggaustietoja</string>
<string name="info_map_file_debug_no">ei sisälletty</string>
<string name="info_map_file_debug_yes">sisälletty</string>
<string name="info_map_file_language_preference">Suosittu kieli</string>
<string name="info_map_file_name">Tiedosto</string>
<string name="info_map_file_size">Tiedoston koko</string>
<string name="info_map_file_start">Aloitussijainti</string>
<string name="info_map_file_start_position">Aloitussijainti</string>
<string name="info_map_file_start_zoom_level">Aloituszoomaustaso</string>
<string name="info_map_file_version">Versio</string>
<string name="latitude">Leveyspiiri</string>
<string name="longitude">Pituuspiiri</string>
<string name="menu_info">Info</string>
<string name="menu_info_map_file">Karttatiedoston ominaisuudet</string>
<string name="menu_info_about">Tästä ohjelmasta</string>
<string name="menu_mapfile">Karttatiedosto</string>
<string name="menu_position">Sijainti</string>
<string name="menu_position_enter_coordinates">Anna koordinaatit</string>
<string name="menu_position_last_known">Viimeinen tunnettu sijainti</string>
<string name="menu_position_map_file_center">Karttatiedoston keskipiste</string>
<string name="menu_position_my_location_enable">Näytä sijaintini</string>
<string name="menu_position_my_location_disable">Poista sijaintini</string>
<string name="menu_preferences">Suositukset</string>
<string name="menu_render_theme">Render theme</string>
<string name="menu_render_theme_osmarender">Default Theme</string>
<string name="menu_render_theme_select_file">Valitse XML tiedosto …</string>
<string name="menu_screenshot">Screenshot</string>
<string name="menu_screenshot_jpeg">JPEG (häviöllinen)</string>
<string name="menu_screenshot_png">PNG (häviötön)</string>
<string name="no_location_provider_available">Sijaintilähde ei ole käytettävissä</string>
<string name="ok">OK</string>
<string name="preferences_debug">Debuggausasetukset</string>
<string name="preferences_general">Yleiset asetukset</string>
<string name="preferences_cache_persistence">Välimuistin pysyvyys</string>
<string name="preferences_cache_persistence_desc">Pitää välimuistin lopettaessa</string>
<string name="preferences_cache_size">Ulkopuolinen muisti</string>
<string name="preferences_cache_size_desc">Säädä välimuistin kokoa</string>
<string name="preferences_cache_size_value">%.1f MB</string>
<string name="preferences_fullscreen">Kokoruututila</string>
<string name="preferences_fullscreen_desc">Piilota tilapalkki</string>
<string name="preferences_map">Kartta-asetukset</string>
<string name="preferences_map_view_mode">Kartta-asetus</string>
<string name="preferences_map_view_mode_desc">Valitse toiminta-asetus</string>
<string name="preferences_move_speed">Liikkumisnopeus</string>
<string name="preferences_move_speed_desc">Säädä kartan liikkumisnopeutta</string>
<string name="preferences_move_speed_value">%d %% liikkumisnopeus</string>
<string name="preferences_show_fps_counter">Kehysnopeus</string>
<string name="preferences_show_fps_counter_desc">Salli kehyksen sekunttilaskin</string>
<string name="preferences_show_scale_bar">Kartan mittakaava</string>
<string name="preferences_show_scale_bar_desc">Näytä kartan mittakaava</string>
<string name="preferences_show_tile_coordinates">Laattakoordinaatit</string>
<string name="preferences_show_tile_coordinates_desc">Näytä koordinaatit laatalla</string>
<string name="preferences_show_tile_frames">Laattarajat</string>
<string name="preferences_show_tile_frames_desc">Piirrä laattarajat</string>
<string name="preferences_show_water_tiles">Vesilaatat</string>
<string name="preferences_show_water_tiles_desc">Korostaa vettä sisältävät laatat</string>
<string name="preferences_text_scale">Fonttikoko</string>
<string name="preferences_text_scale_desc">Valitse karttamerkintöjen tekstikoko</string>
<string name="preferences_wake_lock">Pysyy aktiivisena</string>
<string name="preferences_wake_lock_desc">Estää kuvaruudun himmenemisen</string>
<string name="snap_to_location_enabled">Kohdista sijainti on aktivoitu</string>
<string name="snap_to_location_disabled">Kohdista sijainti on deaktivoitu</string>
<string name="unit_symbol_kilometer">&#160;km</string>
<string name="unit_symbol_meter">&#160;m</string>
<string name="zoomLevel">Zoomaustaso</string>
</resources>

View File

@ -1,96 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<!-- <string-array name="preferences_map_generator_values">
<item>Mapfile</item>
<item>PostGIS</item>
<item>OpenScienceMap</item>
</string-array> -->
<string-array name="preferences_text_scale_values">
<item>minuscola</item>
<item>piccola</item>
<item>normale</item>
<item>grande</item>
<item>enorme</item>
</string-array>
<string name="application_name">OpenScienceMap</string>
<string name="cancel">Annulla</string>
<string name="error">Errore</string>
<string name="error_last_location_unknown">L\'ultima posizione è sconosciuta</string>
<string name="file_invalid">Il file selezionato non è valido.</string>
<string name="file_select">Si prega di selezionare un file.</string>
<string name="file_size_byte">byte</string>
<string name="file_size_bytes">bytes</string>
<string name="file_size_kb">kB</string>
<string name="file_size_mb">MB</string>
<string name="file_size_gb">GB</string>
<string name="go_to_position">Vai alla posizione</string>
<string name="info_map_file_area">Area</string>
<string name="info_map_file_comment">Commento</string>
<string name="info_map_file_date">Data</string>
<string name="info_map_file_debug">Informazioni di debug</string>
<string name="info_map_file_debug_no">non incluso</string>
<string name="info_map_file_debug_yes">incluso</string>
<string name="info_map_file_language_preference">Preferenza di lingua</string>
<string name="info_map_file_name">File</string>
<string name="info_map_file_size">Grandezza del file</string>
<string name="info_map_file_start_position">Punto di partenza</string>
<string name="info_map_file_start_zoom_level">Inizio zoom</string>
<string name="info_map_file_version">Versione</string>
<string name="latitude">Grado di latitudine</string>
<string name="longitude">Meridiano</string>
<string name="menu_info">Info</string>
<string name="menu_info_map_file">Informazioni sul file mappa</string>
<string name="menu_info_about">A proposito di questo software</string>
<string name="menu_mapfile">Mappa</string>
<string name="menu_position">Posizione</string>
<string name="menu_position_enter_coordinates">Inserisci le coordinate</string>
<string name="menu_position_last_known">Ultima posizione nota</string>
<string name="menu_position_map_file_center">Centro della mappa</string>
<string name="menu_position_my_location_enable">Mostra la mia posizione</string>
<string name="menu_position_my_location_disable">Rimuovere la mia posizione</string>
<string name="menu_preferences">Impostazioni</string>
<string name="menu_render_theme">Render modi</string>
<string name="menu_render_theme_osmarender">Default Theme</string>
<string name="menu_render_theme_select_file">Selezionare un file XML …</string>
<string name="menu_screenshot">Screenshot</string>
<string name="menu_screenshot_jpeg">JPEG (con perdita di dati)</string>
<string name="menu_screenshot_png">PNG (senza perdita di dati)</string>
<string name="no_location_provider_available">Nessuna operatore per posizione disponibile</string>
<string name="ok">OK</string>
<string name="preferences_debug">Impostazioni sviluppo</string>
<string name="preferences_general">Impostazioni generali</string>
<string name="preferences_cache_persistence">Persistenza cache</string>
<string name="preferences_cache_persistence_desc">Mantenere il cache in uscita</string>
<string name="preferences_cache_size">Memoria esterna</string>
<string name="preferences_cache_size_desc">Impostare la dimensione della cache</string>
<string name="preferences_cache_size_value">%.1f MB</string>
<string name="preferences_fullscreen">A schermo intero</string>
<string name="preferences_fullscreen_desc">Nascondere la barra di stato</string>
<string name="preferences_map">Impostazioni mappa</string>
<string name="preferences_map_view_mode">Modalitá della mappa</string>
<string name="preferences_map_view_mode_desc">Selezionare la modalità della mappa</string>
<string name="preferences_move_speed">Velocità di scorrimento</string>
<string name="preferences_move_speed_desc">Impostare velocità di scorrimento della mappa</string>
<string name="preferences_move_speed_value">%d %% velocità di scorrimento</string>
<string name="preferences_show_fps_counter">Frame rate</string>
<string name="preferences_show_fps_counter_desc">Visualizzare contatore di frame rate</string>
<string name="preferences_show_scale_bar">Scala della mappa</string>
<string name="preferences_show_scale_bar_desc">Visualizzare barra della scala della mappa</string>
<string name="preferences_show_tile_coordinates">Coordinate del Tile</string>
<string name="preferences_show_tile_coordinates_desc">Dipingere le coordinate sul Tile</string>
<string name="preferences_show_tile_frames">Bordare del Tile</string>
<string name="preferences_show_tile_frames_desc">Dipingere bordare attorno Tile</string>
<string name="preferences_show_water_tiles">Tiles di acqua</string>
<string name="preferences_show_water_tiles_desc">Accentare i Tiles con acqua-bit</string>
<string name="preferences_text_scale">Grandezza del carattere</string>
<string name="preferences_text_scale_desc">Scegli la grandezza standard per le diciture della mappa</string>
<string name="preferences_wake_lock">Rimanere attivo</string>
<string name="preferences_wake_lock_desc">Impedisce la chiusura dello schermo</string>
<string name="snap_to_location_enabled">Scatto alla posizione è attivato</string>
<string name="snap_to_location_disabled">Scatto alla posizione è disattivato</string>
<string name="unit_symbol_kilometer">&#160;km</string>
<string name="unit_symbol_meter">&#160;m</string>
<string name="zoomLevel">Livello di zoom</string>
</resources>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string-array name="preferences_map_database_keys">
<!-- <item>MAP_READER</item> -->
<!-- <item>POSTGIS_READER</item> -->
<item>PBMAP_READER</item>
<item>OSCIMAP_READER</item>
<item>TEST_READER</item>
</string-array>
<string name="preferences_map_database_default">PBMAP_READER</string>
<string-array name="preferences_scale_bar_unit_keys">
<item>imperial</item>
<item>metric</item>
</string-array>
<string name="preferences_scale_bar_unit_default">metric</string>
<string-array name="preferences_text_scale_keys">
<item>0.7</item>
<item>0.85</item>
<item>1.0</item>
<item>1.3</item>
<item>1.6</item>
</string-array>
<string name="preferences_text_scale_default">1.0</string>
<string-array name="view_sections">
<item>Map</item>
<item>Routes</item>
<item>Overlays</item>
<item>etc</item>
</string-array>
</resources>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<!-- OSM tags relevant for a Nominatim search by feature -->
<!-- See http://wiki.openstreetmap.org/wiki/Map_Features -->
<!-- in comment, those with 0 match for Paris area on 16/07/2012 -->
<string-array name="poi_tags">
<!-- Aeroway -->
<!-- <item>aerodrome</item> -->
<!-- Amenity -->
<item>bar</item>
<item>cafe</item>
<!-- <item>fast_food</item> -->
<item>pub</item>
<item>restaurant</item>
<item>library</item>
<item>school</item>
<item>university</item>
<!-- <item>bicycle_parking</item> -->
<item>bus_station</item>
<!-- <item>car_rental</item> -->
<item>car_sharing</item>
<item>car_wash</item>
<!-- <item>ev_charging</item> -->
<item>fuel</item>
<item>parking</item>
<item>taxi</item>
<item>atm</item>
<item>bank</item>
<item>dentist</item>
<item>hospital</item>
<item>pharmacy</item>
<!-- <item>veterinary</item> -->
<item>cinema</item>
<!-- <item>nightclub</item> -->
<item>theatre</item>
<!-- <item>fire_station</item> -->
<item>marketplace</item>
<item>police</item>
<!-- <item>post_box</item> -->
<!-- <item>post_office</item> -->
<!-- <item>recycling</item> -->
<!-- <item>sauna</item> -->
<item>telephone</item>
<item>toilets</item>
<!-- Building -->
<item>hotel</item>
<item>church</item>
<!-- <item>train_station</item> => station prefered -->
<!-- Craft -->
<!-- Emergency -->
<!-- <item>ambulance_station</item> -->
<!-- <item>phone</item> -->
<!-- Highway -->
<!-- <item>speed_camera</item> -->
<!-- Historic -->
<item>castle</item>
<item>monument</item>
<!-- Land use -->
<item>cemetery</item>
<!-- Leisure -->
<!-- <item>dance</item> -->
<!-- <item>golf_course</item> -->
<item>park</item>
<item>stadium</item>
<!-- <item>swimming_pool</item> -->
<!-- Natural -->
<item>beach</item>
<!-- Public Transport -->
<item>station</item>
<!-- Shop -->
<item>bakery</item>
<item>butcher</item>
<!-- <item>car_repair</item> -->
<!-- <item>clothes</item> -->
<!-- <item>convenience</item> -->
<item>florist</item>
<item>hairdresser</item>
<!-- <item>jewelry</item> -->
<item>kiosk</item>
<item>laundry</item>
<item>mall</item>
<item>optician</item>
<!-- <item>shoes</item> -->
<item>supermarket</item>
<!-- Sport -->
<!-- <item>golf</item> -->
<!-- <item>horse_racing</item> -->
<!-- <item>judo</item> -->
<!-- <item>karting</item> -->
<!-- <item>tennis</item> -->
<!-- Tourism -->
<item>information</item>
<item>museum</item>
<item>viewpoint</item>
<item>zoo</item>
<!-- Non-Nominatim tags, for other services: -->
<item>wikipedia</item>
<item>flickr</item>
<item>picasa</item>
</string-array>
</resources>

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string-array name="preferences_map_generator_values">
<!-- <item>Mapfile</item> -->
<!-- <item>PostGIS</item> -->
<item>OpenScienceMap</item>
<item>OpenScienceMap2</item>
<item>Test</item>
</string-array>
<string-array name="preferences_scale_bar_unit_values">
<item>Imperial</item>
<item>Metric</item>
</string-array>
<string-array name="preferences_text_scale_values">
<item>tiny</item>
<item>small</item>
<item>normal</item>
<item>large</item>
<item>huge</item>
</string-array>
<string name="application_name">OpenScienceMap</string>
<string name="cancel">Cancel</string>
<string name="error">Error</string>
<string name="error_last_location_unknown">The last location is unknown</string>
<string name="file_invalid">The selected file is invalid.</string>
<string name="file_select">Please select a file.</string>
<string name="file_size_byte">byte</string>
<string name="file_size_bytes">bytes</string>
<string name="file_size_kb">kB</string>
<string name="file_size_mb">MB</string>
<string name="file_size_gb">GB</string>
<string name="go_to_position">Go to position</string>
<string name="info_map_file_area">Area</string>
<string name="info_map_file_comment">Comment</string>
<string name="info_map_file_created_by">Created by</string>
<string name="info_map_file_date">Date</string>
<string name="info_map_file_debug">Debug information</string>
<string name="info_map_file_debug_no">not included</string>
<string name="info_map_file_debug_yes">included</string>
<string name="info_map_file_language_preference">Language preference</string>
<string name="info_map_file_name">File</string>
<string name="info_map_file_size">File size</string>
<string name="info_map_file_start_position">Start position</string>
<string name="info_map_file_start_zoom_level">Start zoom level</string>
<string name="info_map_file_version">Version</string>
<string name="latitude">Latitude</string>
<string name="longitude">Longitude</string>
<string name="menu_info">Info</string>
<string name="menu_info_map_file">Map file properties</string>
<string name="menu_info_about">About</string>
<string name="menu_mapfile">Map file</string>
<string name="menu_position">Position</string>
<string name="menu_rotation_enable">Enable rotation</string>
<string name="menu_compass_enable">Enable compass</string>
<string name="menu_rotation_disable">Disable rotation</string>
<string name="menu_compass_disable">Disable compass</string>
<string name="menu_position_enter_coordinates">Enter coordinates</string>
<string name="menu_position_last_known">Last known location</string>
<string name="menu_position_map_file_center">Map file center</string>
<string name="menu_position_my_location_enable">Show my location</string>
<string name="menu_position_my_location_disable">Remove my location</string>
<string name="menu_preferences">Preferences</string>
<string name="menu_render_theme">Theme</string>
<string name="menu_render_theme_osmarender">Default Theme</string>
<string name="menu_render_theme_tronrender">Tube Theme</string>
<string name="menu_render_theme_select_file">Select XML file …</string>
<string name="menu_screenshot">Screenshot</string>
<string name="menu_screenshot_jpeg">JPEG (lossy)</string>
<string name="menu_screenshot_png">PNG (lossless)</string>
<string name="no_location_provider_available">No location source available</string>
<string name="ok">OK</string>
<string name="preferences_debug">Debug settings</string>
<string name="preferences_general">General settings</string>
<string name="preferences_cache_persistence">Cache persistence</string>
<string name="preferences_cache_persistence_desc">Keep cached images on exit</string>
<string name="preferences_cache_size">External storage</string>
<string name="preferences_cache_size_desc">Adjust the size of the cache</string>
<string name="preferences_cache_size_value">%.1f MB</string>
<string name="preferences_fullscreen">Full screen mode</string>
<string name="preferences_fullscreen_desc">Hide the status bar</string>
<string name="preferences_fix_orientation">Fix screen orientation</string>
<string name="preferences_fix_orientation_desc">Fix screen orientation</string>
<string name="preferences_map">Map settings</string>
<string name="preferences_map_view_mode">Map mode</string>
<string name="preferences_map_view_mode_desc">Select the operating mode</string>
<string name="preferences_move_speed">Move speed</string>
<string name="preferences_move_speed_desc">Adjust the move speed of the map</string>
<string name="preferences_move_speed_value">%d %% move speed</string>
<string name="preferences_scale_bar_unit">Scale bar unit</string>
<string name="preferences_scale_bar_unit_desc">Select the unit for the map scale bar</string>
<string name="preferences_show_fps_counter">Frame rate</string>
<string name="preferences_show_fps_counter_desc">Enable frames per second counter</string>
<string name="preferences_show_scale_bar">Map scale bar</string>
<string name="preferences_show_scale_bar_desc">Show the scale of the map</string>
<string name="preferences_show_tile_coordinates">Tile coordinates</string>
<string name="preferences_show_tile_coordinates_desc">Show coordinates on tiles</string>
<string name="preferences_show_unmatched_ways">Draw unmatched ways</string>
<string name="preferences_show_tile_frames">Tile boundaries</string>
<string name="preferences_show_tile_frames_desc">Draw tile boundaries</string>
<string name="preferences_disable_polygons">Disable Polygon rendering</string>
<string name="preferences_show_water_tiles_desc">Highlight tiles which have the water flag set</string>
<string name="preferences_text_scale">Font size</string>
<string name="preferences_text_scale_desc">Select the text size of map labels</string>
<string name="preferences_wake_lock">Stay awake</string>
<string name="preferences_wake_lock_desc">Stop the screen from dimming</string>
<string name="snap_to_location_enabled">Snap to position is activated</string>
<string name="snap_to_location_disabled">Snap to position is disabled</string>
<string name="unit_symbol_kilometer">&#160;km</string>
<string name="unit_symbol_meter">&#160;m</string>
<string name="zoomLevel">Zoom level</string>
<string name="menu_options">Options</string>
<string name="menu_pois">Bars nearby</string>
<string name="menu_poi_list">List POIs</string>
<string name="departure">Departure</string>
<string name="destination">Destination</string>
<string name="viapoint">Via-Point</string>
</resources>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/action_bar</item>
</style>
<style name="Theme.TileMap" parent="android:style/Theme.Holo">
<!-- <item name="android:windowNoTitle">true</item> -->
<item name="android:displayOptions"></item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowActionBarOverlay">true</item>
<!-- <item name="android:selectableItemBackgroun">@drawable/ad_selectable_background</item> -->
<item name="android:actionBarStyle">@style/MyActionBar</item>
<!--
<item name="android:dropDownListViewStyle">@style/MyDropDownListView</item>
<item name="android:actionBarTabStyle">@style/MyActionBarTabStyle</item>
<item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/ad_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">@drawable/ad_btn_radio_holo_light</item>
-->
</style>
</resources>

View File

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/menu_preferences" >
<PreferenceCategory android:title="@string/preferences_map" >
<!--
<CheckBoxPreference android:title="@string/preferences_show_scale_bar" android:summary="@string/preferences_show_scale_bar_desc"
android:key="showScaleBar" />
-->
<!--
<ListPreference android:title="@string/preferences_scale_bar_unit" android:summary="@string/preferences_scale_bar_unit_desc"
android:entryValues="@array/preferences_scale_bar_unit_keys" android:entries="@array/preferences_scale_bar_unit_values"
android:key="scaleBarUnit" android:defaultValue="@string/preferences_scale_bar_unit_default" android:dependency="showScaleBar" />
-->
<ListPreference
android:defaultValue="@string/preferences_map_database_default"
android:entries="@array/preferences_map_generator_values"
android:entryValues="@array/preferences_map_database_keys"
android:key="mapDatabase"
android:summary="@string/preferences_map_view_mode_desc"
android:title="@string/preferences_map_view_mode" />
<!--
<ListPreference android:title="@string/preferences_text_scale" android:summary="@string/preferences_text_scale_desc"
android:entryValues="@array/preferences_text_scale_keys" android:entries="@array/preferences_text_scale_values"
android:key="textScale" android:defaultValue="@string/preferences_text_scale_default" />
-->
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_general" >
<CheckBoxPreference
android:key="fullscreen"
android:summary="@string/preferences_fullscreen_desc"
android:title="@string/preferences_fullscreen" />
<CheckBoxPreference
android:key="fixOrientation"
android:summary="@string/preferences_fix_orientation"
android:title="@string/preferences_fix_orientation_desc" />
<CheckBoxPreference
android:key="wakeLock"
android:summary="@string/preferences_wake_lock_desc"
android:title="@string/preferences_wake_lock" />
<!--
<CheckBoxPreference android:title="@string/preferences_cache_persistence" android:summary="@string/preferences_cache_persistence_desc"
android:key="cachePersistence" />
<de.sfb.pampa.preferences.CacheSizePreference
android:title="@string/preferences_cache_size" android:summary="@string/preferences_cache_size_desc" android:key="cacheSize" />
<de.sfb.pampa.preferences.MoveSpeedPreference
android:title="@string/preferences_move_speed" android:summary="@string/preferences_move_speed_desc" android:key="moveSpeed" />
-->
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_debug" >
<!--
<CheckBoxPreference android:title="@string/preferences_show_fps_counter" android:summary="@string/preferences_show_fps_counter_desc"
android:key="showFpsCounter" />
-->
<CheckBoxPreference
android:key="drawTileFrames"
android:summary="@string/preferences_show_tile_frames_desc"
android:title="@string/preferences_show_tile_frames" />
<CheckBoxPreference
android:key="drawUnmatchedWays"
android:summary="@string/preferences_show_unmatched_ways"
android:title="@string/preferences_show_unmatched_ways" />
<CheckBoxPreference
android:key="disablePolygons"
android:summary="@string/preferences_disable_polygons"
android:title="@string/preferences_disable_polygons" />
</PreferenceCategory>
</PreferenceScreen>

View File

@ -1,38 +0,0 @@
/*
* Copyright 2012 Hannes Janetzek
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import org.oscim.view.MapView;
import android.app.Application;
import android.content.res.Resources;
// see http://androidcookbook.com : Android's Application Object as a "Singleton"
public class App extends Application {
public static final String TAG = "TileMap";
static MapView map;
static POISearch poiSearch;
static Resources res;
@Override
public void onCreate() {
super.onCreate();
res = getResources();
// Log.d("...", ">>>>>>>> INIT <<<<<<<");
// sInstance = this;
// sInstance.initializeInstance();
}
}

View File

@ -1,65 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import java.text.DecimalFormat;
import android.content.res.Resources;
final class FileUtils {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.00 ");
private static final double ONE_GIGABYTE = 1000000000;
private static final double ONE_KILOBYTE = 1000;
private static final double ONE_MEGABYTE = 1000000;
/**
* Formats the given file size as a human readable string, using SI prefixes.
*
* @param fileSize
* the file size to be formatted.
* @param resources
* a reference to the application resources.
* @return a human readable file size.
* @throws IllegalArgumentException
* if the given file size is negative.
*/
static String formatFileSize(long fileSize, Resources resources) {
if (fileSize < 0) {
throw new IllegalArgumentException("invalid file size: " + fileSize);
} else if (fileSize < 1000) {
if (fileSize == 1) {
// singular
return "1 " + resources.getString(R.string.file_size_byte);
}
// plural, including zero
return fileSize + " " + resources.getString(R.string.file_size_bytes);
} else {
if (fileSize < ONE_MEGABYTE) {
return DECIMAL_FORMAT.format(fileSize / ONE_KILOBYTE)
+ resources.getString(R.string.file_size_kb);
} else if (fileSize < ONE_GIGABYTE) {
return DECIMAL_FORMAT.format(fileSize / ONE_MEGABYTE)
+ resources.getString(R.string.file_size_mb);
}
return DECIMAL_FORMAT.format(fileSize / ONE_GIGABYTE)
+ resources.getString(R.string.file_size_gb);
}
}
private FileUtils() {
throw new IllegalStateException();
}
}

View File

@ -1,47 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.WindowManager;
import android.webkit.WebView;
/**
* Simple activity to display the info web page from the assets folder.
*/
public class InfoView extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
webView.loadUrl("file:///android_asset/info.xml");
setContentView(webView);
}
@Override
protected void onResume() {
super.onResume();
// check if the full screen mode should be activated
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("fullscreen", false)) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
}
}

View File

@ -1,113 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2012 Hannes Janetzek
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import org.oscim.core.GeoPoint;
import org.oscim.core.MapPosition;
import org.oscim.view.MapView;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.TextView;
public class LocationDialog {
void prepareDialog(MapView mapView, final Dialog dialog) {
EditText editText = (EditText) dialog.findViewById(R.id.latitude);
GeoPoint mapCenter = mapView.getMapPosition().getMapCenter();
editText.setText(Double.toString(mapCenter.getLatitude()));
editText = (EditText) dialog.findViewById(R.id.longitude);
editText.setText(Double.toString(mapCenter.getLongitude()));
SeekBar zoomlevel = (SeekBar) dialog.findViewById(R.id.zoomLevel);
zoomlevel.setMax(20); // FIXME
// map.getMapGenerator().getZoomLevelMax());
zoomlevel.setProgress(mapView.getMapPosition().getZoomLevel());
final TextView textView = (TextView) dialog.findViewById(R.id.zoomlevelValue);
textView.setText(String.valueOf(zoomlevel.getProgress()));
zoomlevel.setOnSeekBarChangeListener(new SeekBarChangeListener(textView));
}
Dialog createDialog(final TileMap map) {
AlertDialog.Builder builder = new AlertDialog.Builder(map);
builder.setIcon(android.R.drawable.ic_menu_mylocation);
builder.setTitle(R.string.menu_position_enter_coordinates);
LayoutInflater factory = LayoutInflater.from(map);
final View view = factory.inflate(R.layout.dialog_enter_coordinates, null);
builder.setView(view);
builder.setPositiveButton(R.string.go_to_position,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// disable GPS follow mode if it is enabled
map.mLocation.disableSnapToLocation(true);
// set the map center and zoom level
EditText latitudeView = (EditText) view
.findViewById(R.id.latitude);
EditText longitudeView = (EditText) view
.findViewById(R.id.longitude);
double latitude = Double.parseDouble(latitudeView.getText()
.toString());
double longitude = Double.parseDouble(longitudeView.getText()
.toString());
SeekBar zoomLevelView = (SeekBar) view
.findViewById(R.id.zoomLevel);
byte zoom = (byte) (zoomLevelView.getProgress());
MapPosition mapPosition = new MapPosition(latitude,
longitude, zoom, 1, 0);
map.map.setMapCenter(mapPosition);
}
});
builder.setNegativeButton(R.string.cancel, null);
return builder.create();
}
class SeekBarChangeListener implements SeekBar.OnSeekBarChangeListener {
private final TextView textView;
SeekBarChangeListener(TextView textView) {
this.textView = textView;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
this.textView.setText(String.valueOf(progress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// do nothing
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// do nothing
}
}
}

View File

@ -1,258 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import org.oscim.core.GeoPoint;
import org.oscim.core.MapPosition;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ToggleButton;
public class LocationHandler {
private static final int DIALOG_LOCATION_PROVIDER_DISABLED = 2;
private MyLocationListener mLocationListener;
private LocationManager mLocationManager;
private boolean mShowMyLocation;
private ToggleButton mSnapToLocationView;
private boolean mSnapToLocation;
/* package */final TileMap mTileMap;
LocationHandler(TileMap tileMap) {
mTileMap = tileMap;
mLocationManager = (LocationManager) tileMap
.getSystemService(Context.LOCATION_SERVICE);
mLocationListener = new MyLocationListener();
mSnapToLocationView = (ToggleButton) tileMap
.findViewById(R.id.snapToLocationView);
mSnapToLocationView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (isSnapToLocationEnabled()) {
disableSnapToLocation(true);
} else {
enableSnapToLocation(true);
}
}
});
}
boolean enableShowMyLocation(boolean centerAtFirstFix) {
Log.d("TileMap", "enableShowMyLocation " + mShowMyLocation);
gotoLastKnownPosition();
if (!mShowMyLocation) {
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
String bestProvider = mLocationManager.getBestProvider(criteria, true);
if (bestProvider == null) {
mTileMap.showDialog(DIALOG_LOCATION_PROVIDER_DISABLED);
return false;
}
mShowMyLocation = true;
Log.d("TileMap", "enableShowMyLocation " + mShowMyLocation);
mLocationListener.setFirstCenter(centerAtFirstFix);
mLocationManager.requestLocationUpdates(bestProvider, 1000, 0,
mLocationListener);
mSnapToLocationView.setVisibility(View.VISIBLE);
return true;
}
return false;
}
void gotoLastKnownPosition() {
Location currentLocation;
Location bestLocation = null;
for (String provider : mLocationManager.getProviders(true)) {
currentLocation = mLocationManager.getLastKnownLocation(provider);
if (currentLocation == null)
continue;
if (bestLocation == null
|| currentLocation.getAccuracy() < bestLocation.getAccuracy()) {
bestLocation = currentLocation;
}
}
if (bestLocation != null) {
byte zoom = mTileMap.map.getMapPosition().getZoomLevel();
if (zoom < 12)
zoom = (byte) 12;
MapPosition mapPosition = new MapPosition(bestLocation.getLatitude(),
bestLocation.getLongitude(), zoom, 1, 0);
mTileMap.map.setMapCenter(mapPosition);
} else {
mTileMap.showToastOnUiThread(mTileMap
.getString(R.string.error_last_location_unknown));
}
}
/**
* Disables the "show my location" mode.
*
* @return ...
*/
boolean disableShowMyLocation() {
if (mShowMyLocation) {
mShowMyLocation = false;
disableSnapToLocation(false);
mLocationManager.removeUpdates(mLocationListener);
// if (circleOverlay != null) {
// mapView.getOverlays().remove(circleOverlay);
// mapView.getOverlays().remove(itemizedOverlay);
// circleOverlay = null;
// itemizedOverlay = null;
// }
mSnapToLocationView.setVisibility(View.GONE);
return true;
}
return false;
}
/**
* Returns the status of the "show my location" mode.
*
* @return true if the "show my location" mode is enabled, false otherwise.
*/
boolean isShowMyLocationEnabled() {
return mShowMyLocation;
}
/**
* Disables the "snap to location" mode.
*
* @param showToast
* defines whether a toast message is displayed or not.
*/
void disableSnapToLocation(boolean showToast) {
if (mSnapToLocation) {
mSnapToLocation = false;
mSnapToLocationView.setChecked(false);
mTileMap.map.setClickable(true);
if (showToast) {
mTileMap.showToastOnUiThread(mTileMap
.getString(R.string.snap_to_location_disabled));
}
}
}
/**
* Enables the "snap to location" mode.
*
* @param showToast
* defines whether a toast message is displayed or not.
*/
void enableSnapToLocation(boolean showToast) {
if (!mSnapToLocation) {
mSnapToLocation = true;
mTileMap.map.setClickable(false);
if (showToast) {
mTileMap.showToastOnUiThread(mTileMap
.getString(R.string.snap_to_location_enabled));
}
}
}
/**
* Returns the status of the "snap to location" mode.
*
* @return true if the "snap to location" mode is enabled, false otherwise.
*/
boolean isSnapToLocationEnabled() {
return mSnapToLocation;
}
class MyLocationListener implements LocationListener {
private boolean mSetCenter;
@Override
public void onLocationChanged(Location location) {
Log.d("LocationListener", "onLocationChanged, "
+ " lon:" + location.getLongitude()
+ " lat:" + location.getLatitude());
if (!isShowMyLocationEnabled()) {
return;
}
GeoPoint point = new GeoPoint(location.getLatitude(), location.getLongitude());
// this.advancedMapViewer.overlayCircle.setCircleData(point, location.getAccuracy());
// this.advancedMapViewer.overlayItem.setPoint(point);
// this.advancedMapViewer.circleOverlay.requestRedraw();
// this.advancedMapViewer.itemizedOverlay.requestRedraw();
if (mSetCenter || isSnapToLocationEnabled()) {
mSetCenter = false;
mTileMap.map.setCenter(point);
}
}
@Override
public void onProviderDisabled(String provider) {
// do nothing
}
@Override
public void onProviderEnabled(String provider) {
// do nothing
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// do nothing
}
boolean isFirstCenter() {
return mSetCenter;
}
void setFirstCenter(boolean center) {
mSetCenter = center;
}
}
}

View File

@ -1,96 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
public class MapInfoDialog {
//onCreate
// else if (id == DIALOG_INFO_MAP_FILE) {
// builder.setIcon(android.R.drawable.ic_menu_info_details);
// builder.setTitle(R.string.menu_info_map_file);
// LayoutInflater factory = LayoutInflater.from(this);
// builder.setView(factory.inflate(R.layout.dialog_info_map_file, null));
// builder.setPositiveButton(R.string.ok, null);
// return builder.create();
//onPrepare
// } else if (id == DIALOG_INFO_MAP_FILE) {
// MapInfo mapInfo = map.getMapDatabase().getMapInfo();
//
// TextView textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewName);
// textView.setText(map.getMapFile());
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewSize);
// textView.setText(FileUtils.formatFileSize(mapInfo.fileSize,
// getResources()));
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewVersion);
// textView.setText(String.valueOf(mapInfo.fileVersion));
//
// // textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewDebug);
// // if (mapFileInfo.debugFile) {
// // textView.setText(R.string.info_map_file_debug_yes);
// // } else {
// // textView.setText(R.string.info_map_file_debug_no);
// // }
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewDate);
// Date date = new Date(mapInfo.mapDate);
// textView.setText(DateFormat.getDateTimeInstance().format(date));
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewArea);
// BoundingBox boundingBox = mapInfo.boundingBox;
// textView.setText(boundingBox.getMinLatitude() + ", "
// + boundingBox.getMinLongitude() + " - \n"
// + boundingBox.getMaxLatitude() + ", " +
// boundingBox.getMaxLongitude());
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewStartPosition);
// GeoPoint startPosition = mapInfo.startPosition;
// if (startPosition == null) {
// textView.setText(null);
// } else {
// textView.setText(startPosition.getLatitude() + ", "
// + startPosition.getLongitude());
// }
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewStartZoomLevel);
// Byte startZoomLevel = mapInfo.startZoomLevel;
// if (startZoomLevel == null) {
// textView.setText(null);
// } else {
// textView.setText(startZoomLevel.toString());
// }
//
// textView = (TextView) dialog
// .findViewById(R.id.infoMapFileViewLanguagePreference);
// textView.setText(mapInfo.languagePreference);
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewComment);
// textView.setText(mapInfo.comment);
//
// textView = (TextView)
// dialog.findViewById(R.id.infoMapFileViewCreatedBy);
// textView.setText(mapInfo.createdBy);
}

View File

@ -1,261 +0,0 @@
/*
* Copyright 2012 osmdroidbonuspack: M.Kergall
* Copyright 2012 Hannes Janetzek
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import java.util.ArrayList;
import org.osmdroid.location.POI;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
/**
* Activity showing POIs as a list.
* @author M.Kergall
*/
public class POIActivity extends Activity {
AutoCompleteTextView poiTagText;
POIAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.items_list);
// TextView title = (TextView) findViewById(R.id.title);
// title.setText("Points of Interest");
ListView list = (ListView) findViewById(R.id.items);
Intent myIntent = getIntent();
final ArrayList<POI> pois = myIntent.getParcelableArrayListExtra("POI");
final int currentNodeId = myIntent.getIntExtra("ID", -1);
POIAdapter adapter = new POIAdapter(this, pois);
mAdapter = adapter;
// Log.d(App.TAG, "got POIs:" + (pois == null ? pois : pois.size()));
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position, long index) {
Intent intent = new Intent();
intent.putExtra("ID", position);
setResult(RESULT_OK, intent);
finish();
}
});
list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
Log.d(App.TAG, "context menu created 2");
}
});
list.setAdapter(adapter);
list.setSelection(currentNodeId);
// POI search interface:
String[] poiTags = getResources().getStringArray(R.array.poi_tags);
poiTagText = (AutoCompleteTextView) findViewById(R.id.poiTag);
ArrayAdapter<String> textadapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, poiTags);
poiTagText.setAdapter(textadapter);
Button setPOITagButton = (Button) findViewById(R.id.buttonSetPOITag);
setPOITagButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Hide the soft keyboard:
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(poiTagText.getWindowToken(), 0);
//Start search:
App.poiSearch.getPOIAsync(poiTagText.getText().toString());
}
});
registerForContextMenu(list);
// only show keyboard when nothing in the list yet
if (pois == null || pois.size() == 0) {
poiTagText.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager keyboard = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.showSoftInput(poiTagText, 0);
}
}, 200);
}
}
@Override
protected void onNewIntent(Intent intent) {
Log.d(App.TAG, "NEW INTENT!!!!");
// from SearchableDictionary Example:
// Because this activity has set launchMode="singleTop", the system calls this method
// to deliver the intent if this activity is currently the foreground activity when
// invoked again (when the user executes a search from this activity, we don't create
// a new instance of this activity, so the system delivers the search intent here)
// handleIntent(intent);
final ArrayList<POI> pois = intent.getParcelableArrayListExtra("POI");
// final int currentNodeId = intent.getIntExtra("ID", -1);
// POIAdapter adapter = new POIAdapter(this, pois);
mAdapter.setPOI(pois);
mAdapter.notifyDataSetChanged();
}
// http://www.mikeplate.com/2010/01/21/show-a-context-menu-for-long-clicks-in-an-android-listview/
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
if (v.getId() == R.id.items) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
Log.d(App.TAG, "list context menu created " + info.position);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.poi_menu, menu);
}
super.onCreateContextMenu(menu, v, menuInfo);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
Log.d(App.TAG, "context menu item selected " + item.getItemId());
if (item.getItemId() == R.id.menu_link) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item
.getMenuInfo();
POI poi = (POI) mAdapter.getItem(info.position);
if (poi != null && poi.url != null) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(poi.url));
startActivity(i);
}
return true;
}
return super.onContextItemSelected(item);
}
}
class POIAdapter extends BaseAdapter implements OnClickListener {
private Context mContext;
private ArrayList<POI> mPois;
public POIAdapter(Context context, ArrayList<POI> pois) {
mContext = context;
mPois = pois;
}
public void setPOI(ArrayList<POI> pois) {
mPois = pois;
}
@Override
public int getCount() {
if (mPois == null)
return 0;
return mPois.size();
}
@Override
public Object getItem(int position) {
if (mPois == null)
return null;
return mPois.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup viewGroup) {
POI entry = (POI) getItem(position);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.item_layout, null);
} else {
}
TextView tvTitle = (TextView) convertView.findViewById(R.id.title);
tvTitle.setText((entry.url == null ? "" : "[link] ") + entry.type);
TextView tvDetails = (TextView) convertView.findViewById(R.id.details);
tvDetails.setText(entry.description);
ImageView iv = (ImageView) convertView.findViewById(R.id.thumbnail);
//ivManeuver.setImageBitmap(entry.mThumbnail);
// iv.getT
// entry.fetchThumbnailOnThread(iv);
entry.fetchThumbnail(iv);
return convertView;
}
@Override
public void onClick(View arg0) {
Log.d(App.TAG, "click" + arg0.getId());
//nothing to do.
}
}

View File

@ -1,197 +0,0 @@
/*
* Copyright 2012 osmdroid: M.Kergall
* Copyright 2012 Hannes Janetzek
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import java.util.ArrayList;
import org.oscim.core.BoundingBox;
import org.oscim.overlay.OverlayItem;
import org.osmdroid.location.FlickrPOIProvider;
import org.osmdroid.location.GeoNamesPOIProvider;
import org.osmdroid.location.NominatimPOIProvider;
import org.osmdroid.location.POI;
import org.osmdroid.location.PicasaPOIProvider;
import org.osmdroid.overlays.ExtendedOverlayItem;
import org.osmdroid.overlays.ItemizedOverlayWithBubble;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.AutoCompleteTextView;
import android.widget.Toast;
public class POISearch {
ArrayList<POI> mPOIs;
ItemizedOverlayWithBubble<ExtendedOverlayItem> poiMarkers;
AutoCompleteTextView poiTagText;
final TileMap tileMap;
POISearch(TileMap tileMap) {
this.tileMap = tileMap;
//POI markers:
final ArrayList<ExtendedOverlayItem> poiItems = new ArrayList<ExtendedOverlayItem>();
poiMarkers = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(tileMap.map, tileMap,
poiItems, null); //new POIInfoWindow(map));
tileMap.map.getOverlays().add(poiMarkers);
// if (savedInstanceState != null) {
// mPOIs = savedInstanceState.getParcelableArrayList("poi");
// updateUIWithPOI(mPOIs);
// }
}
// void init() {
//
// }
class POITask extends AsyncTask<Object, Void, ArrayList<POI>> {
String mTag;
@Override
protected ArrayList<POI> doInBackground(Object... params) {
mTag = (String) params[0];
if (mTag == null || mTag.equals("")) {
return null;
} else if (mTag.equals("wikipedia")) {
GeoNamesPOIProvider poiProvider = new GeoNamesPOIProvider("mkergall");
//ArrayList<POI> pois = poiProvider.getPOICloseTo(point, 30, 20.0);
//Get POI inside the bounding box of the current map view:
BoundingBox bb = App.map.getBoundingBox();
ArrayList<POI> pois = poiProvider.getPOIInside(bb, 30);
return pois;
} else if (mTag.equals("flickr")) {
FlickrPOIProvider poiProvider = new FlickrPOIProvider(
"c39be46304a6c6efda8bc066c185cd7e");
BoundingBox bb = App.map.getBoundingBox();
ArrayList<POI> pois = poiProvider.getPOIInside(bb, 20);
return pois;
} else if (mTag.startsWith("picasa")) {
PicasaPOIProvider poiProvider = new PicasaPOIProvider(null);
BoundingBox bb = App.map.getBoundingBox();
String q = mTag.substring("picasa".length());
ArrayList<POI> pois = poiProvider.getPOIInside(bb, 20, q);
return pois;
}
else {
NominatimPOIProvider poiProvider = new NominatimPOIProvider();
// poiProvider.setService(NominatimPOIProvider.MAPQUEST_POI_SERVICE);
poiProvider.setService(NominatimPOIProvider.NOMINATIM_POI_SERVICE);
ArrayList<POI> pois;
// if (destinationPoint == null) {
BoundingBox bb = App.map.getBoundingBox();
pois = poiProvider.getPOIInside(bb, mTag, 100);
// } else {
// pois = poiProvider.getPOIAlong(mRoad.getRouteLow(), mTag, 100, 2.0);
// }
return pois;
}
}
@Override
protected void onPostExecute(ArrayList<POI> pois) {
mPOIs = pois;
if (mTag.equals("")) {
//no search, no message
} else if (mPOIs == null) {
Toast.makeText(tileMap.getApplicationContext(),
"Technical issue when getting " + mTag + " POI.", Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(tileMap.getApplicationContext(),
"" + mPOIs.size() + " " + mTag + " entries found",
Toast.LENGTH_LONG).show();
// if (mTag.equals("flickr") || mTag.startsWith("picasa") || mTag.equals("wikipedia"))
// startAsyncThumbnailsLoading(mPOIs);
}
updateUIWithPOI(mPOIs);
}
}
void updateUIWithPOI(ArrayList<POI> pois) {
if (pois != null) {
for (POI poi : pois) {
int end = 0, first = 0;
String desc = null;
String name = poi.description;
if (poi.serviceId == POI.POI_SERVICE_NOMINATIM) {
if (name != null) {
// FIXME or nominatim...
// String name = "";
for (int i = 0; i < 3; i++) {
int pos = poi.description.indexOf(',', end);
if (pos > 0) {
if (i == 0) {
name = poi.description.substring(0, pos);
first = pos + 2;
}
end = pos + 1;
}
}
if (end > 0)
desc = poi.description.substring(first, end - 1);
else
desc = poi.description;
}
}
ExtendedOverlayItem poiMarker = new ExtendedOverlayItem(
poi.type + (name == null ? "" : ": " + name), desc, poi.location);
Drawable marker = null;
if (poi.serviceId == POI.POI_SERVICE_NOMINATIM) {
marker = App.res.getDrawable(R.drawable.marker_poi_default);
} else if (poi.serviceId == POI.POI_SERVICE_GEONAMES_WIKIPEDIA) {
if (poi.rank < 90)
marker = App.res.getDrawable(R.drawable.marker_poi_wikipedia_16);
else
marker = App.res.getDrawable(R.drawable.marker_poi_wikipedia_32);
} else if (poi.serviceId == POI.POI_SERVICE_FLICKR) {
marker = App.res.getDrawable(R.drawable.marker_poi_flickr);
} else if (poi.serviceId == POI.POI_SERVICE_PICASA) {
marker = App.res.getDrawable(R.drawable.marker_poi_picasa_24);
poiMarker.setSubDescription(poi.category);
}
poiMarker.setMarker(marker);
poiMarker.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
//thumbnail loading moved in POIInfoWindow.onOpen for better performances.
poiMarker.setRelatedObject(poi);
poiMarkers.addItem(poiMarker);
}
Log.d(App.TAG, "SEND INTENT");
Intent intent = new Intent(tileMap.getApplicationContext(), POIActivity.class);
intent.putParcelableArrayListExtra("POI", mPOIs);
intent.putExtra("ID", poiMarkers.getBubbledItemId());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
tileMap.startActivityForResult(intent, TileMap.POIS_REQUEST);
}
App.map.redrawMap();
}
void getPOIAsync(String tag) {
poiMarkers.removeAllItems();
new POITask().execute(tag);
}
}

View File

@ -1,403 +0,0 @@
/*
* Copyright 2012 osmdroid: M.Kergall
* Copyright 2012 Hannes Janetzek
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.oscim.core.GeoPoint;
import org.oscim.overlay.Overlay;
import org.oscim.overlay.OverlayItem;
import org.oscim.overlay.PathOverlay;
import org.oscim.view.MapView;
import org.osmdroid.location.GeocoderNominatim;
import org.osmdroid.overlays.DefaultInfoWindow;
import org.osmdroid.overlays.ExtendedOverlayItem;
import org.osmdroid.overlays.ItemizedOverlayWithBubble;
import org.osmdroid.overlays.MapEventsOverlay;
import org.osmdroid.overlays.MapEventsReceiver;
import org.osmdroid.routing.OSRMRoadManager;
import org.osmdroid.routing.Road;
import org.osmdroid.routing.RoadManager;
import org.osmdroid.routing.RoadNode;
import android.graphics.drawable.Drawable;
import android.location.Address;
import android.os.AsyncTask;
import android.util.Log;
import android.view.MenuItem;
import android.widget.Toast;
public class RouteSearch implements MapEventsReceiver {
protected Road mRoad;
protected PathOverlay mRoadOverlay;
protected ItemizedOverlayWithBubble<ExtendedOverlayItem> mRoadNodeMarkers;
protected GeoPoint startPoint, destinationPoint;
protected ArrayList<GeoPoint> viaPoints;
protected static int START_INDEX = -2, DEST_INDEX = -1;
protected ExtendedOverlayItem markerStart, markerDestination;
protected ItemizedOverlayWithBubble<ExtendedOverlayItem> itineraryMarkers;
private final TileMap tileMap;
RouteSearch(TileMap tileMap) {
// keep context and mapview reference
this.tileMap = tileMap;
//To use MapEventsReceiver methods, we add a MapEventsOverlay:
MapEventsOverlay overlay = new MapEventsOverlay(tileMap, this);
tileMap.map.getOverlays().add(overlay);
// if (savedInstanceState == null) {
// Location l = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
// if (l != null) {
// startPoint = new GeoPoint(l.getLatitude(), l.getLongitude());
// } else {
// //we put a hard-coded start
startPoint = new GeoPoint(53.067221, 8.78767);
// }
destinationPoint = null;
viaPoints = new ArrayList<GeoPoint>();
// mapController.setZoom(9);
// mapController.setCenter(startPoint);
// }
// Itinerary markers:
final ArrayList<ExtendedOverlayItem> waypointsItems = new ArrayList<ExtendedOverlayItem>();
itineraryMarkers = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(tileMap.map, tileMap,
waypointsItems, new ViaPointInfoWindow(R.layout.itinerary_bubble, tileMap.map));
tileMap.map.getOverlays().add(itineraryMarkers);
updateUIWithItineraryMarkers();
//Route and Directions
final ArrayList<ExtendedOverlayItem> roadItems = new ArrayList<ExtendedOverlayItem>();
mRoadNodeMarkers = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(tileMap, roadItems,
tileMap.map);
tileMap.map.getOverlays().add(mRoadNodeMarkers);
// if (savedInstanceState != null) {
// mRoad = savedInstanceState.getParcelable("road");
// updateUIWithRoad(mRoad);
// }
}
//------------- Geocoding and Reverse Geocoding
/**
* Reverse Geocoding
* @param p
* ...
* @return ...
*/
public String getAddress(GeoPoint p) {
GeocoderNominatim geocoder = new GeocoderNominatim(tileMap);
String theAddress;
try {
double dLatitude = p.getLatitude();
double dLongitude = p.getLongitude();
List<Address> addresses = geocoder.getFromLocation(dLatitude, dLongitude, 1);
StringBuilder sb = new StringBuilder();
if (addresses.size() > 0) {
Address address = addresses.get(0);
int n = address.getMaxAddressLineIndex();
for (int i = 0; i <= n; i++) {
if (i != 0)
sb.append(", ");
sb.append(address.getAddressLine(i));
}
theAddress = new String(sb.toString());
} else {
theAddress = null;
}
} catch (IOException e) {
theAddress = null;
}
if (theAddress != null) {
return theAddress;
}
return "";
}
//Async task to reverse-geocode the marker position in a separate thread:
class GeocodingTask extends AsyncTask<Object, Void, String> {
ExtendedOverlayItem marker;
@Override
protected String doInBackground(Object... params) {
marker = (ExtendedOverlayItem) params[0];
return getAddress(marker.getPoint());
}
@Override
protected void onPostExecute(String result) {
marker.setDescription(result);
//itineraryMarkers.showBubbleOnItem(???, map); //open bubble on the item
}
}
//------------ Itinerary markers
/* add (or replace) an item in markerOverlays. p position. */
public ExtendedOverlayItem putMarkerItem(ExtendedOverlayItem item, GeoPoint p, int index,
int titleResId, int markerResId, int iconResId) {
if (item != null) {
itineraryMarkers.removeItem(item);
}
Drawable marker = App.res.getDrawable(markerResId);
String title = App.res.getString(titleResId);
ExtendedOverlayItem overlayItem = new ExtendedOverlayItem(title, "", p);
overlayItem.setMarkerHotspot(OverlayItem.HotspotPlace.BOTTOM_CENTER);
overlayItem.setMarker(marker);
if (iconResId != -1)
overlayItem.setImage(App.res.getDrawable(iconResId));
overlayItem.setRelatedObject(Integer.valueOf(index));
itineraryMarkers.addItem(overlayItem);
tileMap.map.redrawMap();
//map.invalidate();
//Start geocoding task to update the description of the marker with its address:
new GeocodingTask().execute(overlayItem);
return overlayItem;
}
public void addViaPoint(GeoPoint p) {
viaPoints.add(p);
putMarkerItem(null, p, viaPoints.size() - 1,
R.string.viapoint, R.drawable.marker_via, -1);
}
public void removePoint(int index) {
if (index == START_INDEX)
startPoint = null;
else if (index == DEST_INDEX)
destinationPoint = null;
else
viaPoints.remove(index);
getRoadAsync();
updateUIWithItineraryMarkers();
}
public void updateUIWithItineraryMarkers() {
itineraryMarkers.removeAllItems();
//Start marker:
if (startPoint != null) {
markerStart = putMarkerItem(null, startPoint, START_INDEX,
R.string.departure, R.drawable.marker_departure, -1);
}
//Via-points markers if any:
for (int index = 0; index < viaPoints.size(); index++) {
putMarkerItem(null, viaPoints.get(index), index,
R.string.viapoint, R.drawable.marker_via, -1);
}
//Destination marker if any:
if (destinationPoint != null) {
markerDestination = putMarkerItem(null, destinationPoint, DEST_INDEX,
R.string.destination,
R.drawable.marker_destination, -1);
}
}
//------------ Route and Directions
private void putRoadNodes(Road road) {
mRoadNodeMarkers.removeAllItems();
Drawable marker = App.res.getDrawable(R.drawable.marker_node);
int n = road.nodes.size();
// TypedArray iconIds = App.res.obtainTypedArray(R.array.direction_icons);
for (int i = 0; i < n; i++) {
RoadNode node = road.nodes.get(i);
String instructions = (node.instructions == null ? "" : node.instructions);
ExtendedOverlayItem nodeMarker = new ExtendedOverlayItem(
"Step " + (i + 1), instructions, node.location);
nodeMarker.setSubDescription(road.getLengthDurationText(node.length, node.duration));
nodeMarker.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
nodeMarker.setMarker(marker);
// int iconId = iconIds.getResourceId(node.mManeuverType, R.drawable.ic_empty);
// if (iconId != R.drawable.ic_empty) {
// Drawable icon = App.res.getDrawable(iconId);
// nodeMarker.setImage(icon);
// }
mRoadNodeMarkers.addItem(nodeMarker);
}
}
void updateUIWithRoad(Road road) {
mRoadNodeMarkers.removeAllItems();
List<Overlay> mapOverlays = tileMap.map.getOverlays();
if (mRoadOverlay != null) {
mapOverlays.remove(mRoadOverlay);
}
if (road == null)
return;
if (road.status == Road.STATUS_DEFAULT)
Toast.makeText(tileMap, "We have a problem to get the route",
Toast.LENGTH_SHORT).show();
mRoadOverlay = RoadManager.buildRoadOverlay(tileMap.map, road, tileMap);
Overlay removedOverlay = mapOverlays.set(1, mRoadOverlay);
//we set the road overlay at the "bottom", just above the MapEventsOverlay,
//to avoid covering the other overlays.
mapOverlays.add(removedOverlay);
putRoadNodes(road);
tileMap.map.redrawMap();
// map.invalidate();
//Set route info in the text view:
// ((TextView) findViewById(R.id.routeInfo)).setText(road.getLengthDurationText(-1));
}
/**
* Async task to get the road in a separate thread.
*/
class UpdateRoadTask extends AsyncTask<WayPoints, Void, Road> {
@Override
protected Road doInBackground(WayPoints... wp) {
ArrayList<GeoPoint> waypoints = wp[0].waypoints;
//RoadManager roadManager = new GoogleRoadManager();
RoadManager roadManager = new OSRMRoadManager();
roadManager.addRequestOption("");
/* RoadManager roadManager = new MapQuestRoadManager(); Locale
* locale = Locale.getDefault();
* roadManager.addRequestOption("locale="+locale.getLanguage
* ()+"_"+locale.getCountry()); */
return roadManager.getRoad(waypoints);
}
@Override
protected void onPostExecute(Road result) {
mRoad = result;
updateUIWithRoad(result);
/// ??? getPOIAsync(poiTagText.getText().toString());
}
}
// Just to make JAVA shut up!
class WayPoints {
public ArrayList<GeoPoint> waypoints;
}
public void getRoadAsync() {
mRoad = null;
if (startPoint == null || destinationPoint == null) {
updateUIWithRoad(mRoad);
return;
}
ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>(2);
waypoints.add(startPoint);
//add intermediate via points:
for (GeoPoint p : viaPoints) {
waypoints.add(p);
}
waypoints.add(destinationPoint);
WayPoints wp = new WayPoints();
wp.waypoints = waypoints;
new UpdateRoadTask().execute(wp);
}
//------------ MapEventsReceiver implementation
GeoPoint tempClickedGeoPoint; //any other way to pass the position to the menu ???
@Override
public boolean longPressHelper(GeoPoint p) {
Log.d(TileMap.TAG, ">>> got long press event " + p);
tempClickedGeoPoint = p;
//new GeoPoint((GeoPoint) p);
//menu is hooked on the "Search" button
// Button searchButton = (Button) findViewById(R.id.buttonSearch);
// tileMap.openContextMenu(searchButton);
tileMap.openContextMenu(tileMap.map);
return true;
}
@Override
public boolean singleTapUpHelper(GeoPoint p) {
Log.d(App.TAG, "single tap up");
mRoadNodeMarkers.hideBubble();
itineraryMarkers.hideBubble();
return false;
}
// ----------- context menu
boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_departure:
startPoint = tempClickedGeoPoint;
//new GeoPoint((GeoPoint) tempClickedGeoPoint);
markerStart = putMarkerItem(markerStart, startPoint, START_INDEX,
R.string.departure, R.drawable.marker_departure, -1);
getRoadAsync();
return true;
case R.id.menu_destination:
destinationPoint = tempClickedGeoPoint;
//new GeoPoint((GeoPoint) tempClickedGeoPoint);
markerDestination = putMarkerItem(markerDestination, destinationPoint, DEST_INDEX,
R.string.destination,
R.drawable.marker_destination, -1);
getRoadAsync();
return true;
case R.id.menu_viapoint:
GeoPoint viaPoint = tempClickedGeoPoint; //new GeoPoint((GeoPoint) tempClickedGeoPoint);
addViaPoint(viaPoint);
getRoadAsync();
return true;
default:
}
return false;
}
class ViaPointInfoWindow extends DefaultInfoWindow {
int mSelectedPoint;
public ViaPointInfoWindow(int layoutResId, MapView mapView) {
super(layoutResId, mapView);
// Button btnDelete = (Button)(mView.findViewById(R.id.bubble_delete));
// btnDelete.setOnClickListener(new View.OnClickListener() {
// public void onClick(View view) {
// //Call the removePoint method on MapActivity.
// //TODO: find a cleaner way to do that!
// MapActivity mapActivity = (MapActivity)view.getContext();
// mapActivity.removePoint(mSelectedPoint);
// close();
// }
// });
}
@Override
public void onOpen(ExtendedOverlayItem item) {
mSelectedPoint = ((Integer) item.getRelatedObject()).intValue();
super.onOpen(item);
}
}
}

View File

@ -1,564 +0,0 @@
/* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2012 Hannes Janetzek
* Copyright 2012 osmdroidbonuspack: M.Kergall
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app;
import java.io.FileFilter;
import java.io.FileNotFoundException;
import org.oscim.app.filefilter.FilterByFileExtension;
import org.oscim.app.filefilter.ValidRenderTheme;
import org.oscim.app.filepicker.FilePicker;
import org.oscim.app.preferences.EditPreferences;
import org.oscim.database.MapDatabases;
import org.oscim.theme.InternalRenderTheme;
import org.oscim.utils.AndroidUtils;
import org.oscim.view.DebugSettings;
import org.oscim.view.MapActivity;
import org.oscim.view.MapView;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
public class TileMap extends MapActivity {
static final String TAG = TileMap.class.getSimpleName();
MapView map;
// private static final String BUNDLE_CENTER_AT_FIRST_FIX =
// "centerAtFirstFix";
private static final String BUNDLE_SHOW_MY_LOCATION = "showMyLocation";
private static final String BUNDLE_SNAP_TO_LOCATION = "snapToLocation";
private static final int DIALOG_ENTER_COORDINATES = 0;
// private static final int DIALOG_INFO_MAP_FILE = 1;
private static final int DIALOG_LOCATION_PROVIDER_DISABLED = 2;
// private static final FileFilter FILE_FILTER_EXTENSION_MAP =
// new FilterByFileExtension(".map");
private static final FileFilter FILE_FILTER_EXTENSION_XML =
new FilterByFileExtension(".xml");
// private static final int SELECT_MAP_FILE = 0;
// Intents
private static final int SELECT_RENDER_THEME_FILE = 1;
protected static final int POIS_REQUEST = 2;
LocationHandler mLocation;
private MapDatabases mMapDatabase;
private WakeLock mWakeLock;
private Menu mMenu = null;
POISearch mPoiSearch;
RouteSearch mRouteSearch;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set up the layout views
setContentView(R.layout.activity_tilemap);
map = (MapView) findViewById(R.id.mapView);
App.map = map;
// configure the MapView and activate the zoomLevel buttons
map.setClickable(true);
// map.setBuiltInZoomControls(true);
map.setFocusable(true);
mLocation = new LocationHandler(this);
// get the pointers to different system services
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager
.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "AMV");
if (savedInstanceState != null) {
if (savedInstanceState.getBoolean(BUNDLE_SHOW_MY_LOCATION)) {
// enableShowMyLocation(savedInstanceState
// .getBoolean(BUNDLE_CENTER_AT_FIRST_FIX));
if (savedInstanceState.getBoolean(BUNDLE_SNAP_TO_LOCATION)) {
mLocation.enableSnapToLocation(false);
}
}
}
App.poiSearch = mPoiSearch = new POISearch(this);
registerForContextMenu(map);
mRouteSearch = new RouteSearch(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.options_menu, menu);
mMenu = menu;
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_info_about:
startActivity(new Intent(this, InfoView.class));
return true;
case R.id.menu_position:
return true;
case R.id.menu_rotation_enable:
map.enableRotation(true);
toggleMenuRotation();
return true;
case R.id.menu_rotation_disable:
map.enableRotation(false);
toggleMenuRotation();
return true;
case R.id.menu_compass_enable:
map.enableCompass(true);
toggleMenuRotation();
return true;
case R.id.menu_compass_disable:
map.enableCompass(false);
toggleMenuRotation();
return true;
case R.id.menu_position_my_location_enable:
toggleMenuItem(mMenu,
R.id.menu_position_my_location_enable,
R.id.menu_position_my_location_disable,
!mLocation.enableShowMyLocation(true));
return true;
case R.id.menu_position_my_location_disable:
toggleMenuItem(mMenu,
R.id.menu_position_my_location_enable,
R.id.menu_position_my_location_disable,
mLocation.disableShowMyLocation());
return true;
case R.id.menu_position_enter_coordinates:
showDialog(DIALOG_ENTER_COORDINATES);
return true;
case R.id.menu_preferences:
startActivity(new Intent(this, EditPreferences.class));
return true;
case R.id.menu_render_theme:
return true;
case R.id.menu_render_theme_osmarender:
map.setRenderTheme(InternalRenderTheme.OSMARENDER);
return true;
case R.id.menu_render_theme_tronrender:
map.setRenderTheme(InternalRenderTheme.TRONRENDER);
return true;
case R.id.menu_render_theme_select_file:
startRenderThemePicker();
return true;
// case R.id.menu_position_map_center:
// // disable GPS follow mode if it is enabled
// location.disableSnapToLocation(true);
//
// map.setCenter(map.getMapDatabase()
// .getMapInfo().mapCenter);
// return true;
// case R.id.menu_mapfile:
// startMapFilePicker();
// return true;
case R.id.menu_pois:
mPoiSearch.getPOIAsync("bar");
// Intent myIntent = new Intent(this, POIActivity.class);
// myIntent.putParcelableArrayListExtra("POI", mPOIs);
// // myIntent.putExtra("ID", poiMarkers.getBubbledItemId());
// startActivityForResult(myIntent, POIS_REQUEST);
return true;
case R.id.menu_poi_list:
Intent myIntent = new Intent(this, POIActivity.class);
myIntent.putParcelableArrayListExtra("POI", mPoiSearch.mPOIs);
myIntent.putExtra("ID", mPoiSearch.poiMarkers.getBubbledItemId());
startActivityForResult(myIntent, POIS_REQUEST);
return true;
default:
return false;
}
}
private void toggleMenuRotation() {
toggleMenuItem(mMenu,
R.id.menu_rotation_enable,
R.id.menu_rotation_disable,
!map.enableRotation);
toggleMenuItem(mMenu,
R.id.menu_compass_enable,
R.id.menu_compass_disable,
!map.enableCompass);
}
private static void toggleMenuItem(Menu menu, int id, int id2, boolean enable) {
menu.findItem(id).setVisible(enable);
menu.findItem(id).setEnabled(enable);
menu.findItem(id2).setVisible(!enable);
menu.findItem(id2).setEnabled(!enable);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (!isPreHoneyComb()) {
menu.clear();
onCreateOptionsMenu(menu);
}
toggleMenuItem(menu,
R.id.menu_position_my_location_enable,
R.id.menu_position_my_location_disable,
!mLocation.isShowMyLocationEnabled());
if (mMapDatabase == MapDatabases.MAP_READER) {
//menu.findItem(R.id.menu_mapfile).setVisible(true);
menu.findItem(R.id.menu_position_map_center).setVisible(true);
}
// else {
// menu.findItem(R.id.menu_mapfile).setVisible(false);
// menu.findItem(R.id.menu_position_map_center).setVisible(false);
// }
toggleMenuRotation();
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onTrackballEvent(MotionEvent event) {
// forward the event to the MapView
return map.onTrackballEvent(event);
}
// private void startMapFilePicker() {
// FilePicker.setFileDisplayFilter(FILE_FILTER_EXTENSION_MAP);
// FilePicker.setFileSelectFilter(new ValidMapFile());
// startActivityForResult(new Intent(this, FilePicker.class),
// SELECT_MAP_FILE);
// }
private void startRenderThemePicker() {
FilePicker.setFileDisplayFilter(FILE_FILTER_EXTENSION_XML);
FilePicker.setFileSelectFilter(new ValidRenderTheme());
startActivityForResult(new Intent(this, FilePicker.class),
SELECT_RENDER_THEME_FILE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode) {
case POIS_REQUEST:
Log.d(TAG, "result: POIS_REQUEST");
if (resultCode == RESULT_OK) {
int id = intent.getIntExtra("ID", 0);
Log.d(TAG, "result: POIS_REQUEST: " + id);
// map.getController().setCenter(mPOIs.get(id).mLocation);
mPoiSearch.poiMarkers.showBubbleOnItem(id, map);
map.getMapViewPosition().animateTo(mPoiSearch.mPOIs.get(id).location);
}
break;
case SELECT_RENDER_THEME_FILE:
if (resultCode == RESULT_OK && intent != null
&& intent.getStringExtra(FilePicker.SELECTED_FILE) != null) {
try {
map.setRenderTheme(intent
.getStringExtra(FilePicker.SELECTED_FILE));
} catch (FileNotFoundException e) {
showToastOnUiThread(e.getLocalizedMessage());
}
}
break;
default:
break;
}
// if (requestCode == SELECT_MAP_FILE) {
// if (resultCode == RESULT_OK) {
//
// location.disableSnapToLocation(true);
//
// if (intent != null) {
// if (intent.getStringExtra(FilePicker.SELECTED_FILE) != null) {
// map.setMapFile(intent
// .getStringExtra(FilePicker.SELECTED_FILE));
// }
// }
// } else if (resultCode == RESULT_CANCELED) {
// startActivity(new Intent(this, EditPreferences.class));
// }
// } else
// if (requestCode == SELECT_RENDER_THEME_FILE && resultCode == RESULT_OK
// && intent != null
// && intent.getStringExtra(FilePicker.SELECTED_FILE) != null) {
// try {
// map.setRenderTheme(intent
// .getStringExtra(FilePicker.SELECTED_FILE));
// } catch (FileNotFoundException e) {
// showToastOnUiThread(e.getLocalizedMessage());
// }
// }
}
static boolean isPreHoneyComb() {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB;
}
@Override
protected Dialog onCreateDialog(int id) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
if (id == DIALOG_ENTER_COORDINATES) {
if (mLocationDialog == null)
mLocationDialog = new LocationDialog();
return mLocationDialog.createDialog(this);
} else if (id == DIALOG_LOCATION_PROVIDER_DISABLED) {
builder.setIcon(android.R.drawable.ic_menu_info_details);
builder.setTitle(R.string.error);
builder.setMessage(R.string.no_location_provider_available);
builder.setPositiveButton(R.string.ok, null);
return builder.create();
} else {
// no dialog will be created
return null;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mLocation.disableShowMyLocation();
}
@Override
protected void onPause() {
Log.d(TAG, "onPause");
super.onPause();
// release the wake lock if necessary
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
}
LocationDialog mLocationDialog;
@Override
protected void onPrepareDialog(int id, final Dialog dialog) {
if (id == DIALOG_ENTER_COORDINATES) {
mLocationDialog.prepareDialog(map, dialog);
} else {
super.onPrepareDialog(id, dialog);
}
}
@Override
protected void onResume() {
super.onResume();
SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(this);
// MapScaleBar mapScaleBar = mapView.getMapScaleBar();
// mapScaleBar.setShowMapScaleBar(preferences.getBoolean("showScaleBar",
// false));
// String scaleBarUnitDefault =
// getString(R.string.preferences_scale_bar_unit_default);
// String scaleBarUnit = preferences.getString("scaleBarUnit",
// scaleBarUnitDefault);
// mapScaleBar.setImperialUnits(scaleBarUnit.equals("imperial"));
if (preferences.contains("mapDatabase")) {
String name = preferences.getString("mapDatabase",
MapDatabases.PBMAP_READER.name());
MapDatabases mapDatabaseNew;
try {
mapDatabaseNew = MapDatabases.valueOf(name);
} catch (IllegalArgumentException e) {
mapDatabaseNew = MapDatabases.PBMAP_READER;
}
if (mapDatabaseNew != mMapDatabase) {
Log.d(TAG, "set map database " + mapDatabaseNew);
map.setMapDatabase(mapDatabaseNew);
mMapDatabase = mapDatabaseNew;
}
}
// try {
// String textScaleDefault =
// getString(R.string.preferences_text_scale_default);
// map.setTextScale(Float.parseFloat(preferences.getString("textScale",
// textScaleDefault)));
// } catch (NumberFormatException e) {
// map.setTextScale(1);
// }
if (preferences.getBoolean("fullscreen", false)) {
Log.i("mapviewer", "FULLSCREEN");
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
} else {
Log.i("mapviewer", "NO FULLSCREEN");
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
if (preferences.getBoolean("fixOrientation", true)) {
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
// this all returns the orientation which is not currently active?!
// getWindow().getWindowManager().getDefaultDisplay().getRotation());
// getWindow().getWindowManager().getDefaultDisplay().getOrientation());
}
if (preferences.getBoolean("wakeLock", false) && !mWakeLock.isHeld()) {
mWakeLock.acquire();
}
boolean drawTileFrames =
preferences.getBoolean("drawTileFrames", false);
boolean drawTileCoordinates =
preferences.getBoolean("drawTileCoordinates", false);
boolean disablePolygons =
preferences.getBoolean("disablePolygons", false);
boolean drawUnmatchedWays =
preferences.getBoolean("drawUnmatchedWays", false);
DebugSettings cur = map.getDebugSettings();
if (cur.mDisablePolygons != disablePolygons
|| cur.mDrawTileCoordinates != drawTileCoordinates
|| cur.mDrawTileFrames != drawTileFrames
|| cur.mDrawUnmatchted != drawUnmatchedWays) {
Log.d(TAG, "set map debug settings");
DebugSettings debugSettings = new DebugSettings(drawTileCoordinates,
drawTileFrames, disablePolygons, drawUnmatchedWays);
map.setDebugSettings(debugSettings);
}
// if (mMapDatabase == MapDatabases.MAP_READER) {
// if (map.getMapFile() == null)
// startMapFilePicker();
// } else {
// map.setMapFile(map.getMapFile());
// }
map.redrawMap();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(BUNDLE_SHOW_MY_LOCATION, mLocation.isShowMyLocationEnabled());
// outState.putBoolean(BUNDLE_CENTER_AT_FIRST_FIX,
// mMyLocationListener.isCenterAtFirstFix());
// outState.putBoolean(BUNDLE_SNAP_TO_LOCATION, mSnapToLocation);
}
/**
* Uses the UI thread to display the given text message as toast
* notification.
* @param text
* the text message to display
*/
void showToastOnUiThread(final String text) {
if (AndroidUtils.currentThreadIsUiThread()) {
Toast toast = Toast.makeText(this, text, Toast.LENGTH_LONG);
toast.show();
} else {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast toast = Toast.makeText(TileMap.this, text, Toast.LENGTH_LONG);
toast.show();
}
});
}
}
//----------- Context Menu when clicking on the map
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
Log.d(TAG, "create context menu");
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.map_menu, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
Log.d(TAG, "context menu item selected " + item.getItemId());
if (mRouteSearch.onContextItemSelected(item))
return true;
return super.onContextItemSelected(item);
}
}

View File

@ -1,47 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.filefilter;
import java.io.File;
import java.io.FileFilter;
/**
* Accepts all readable directories and all readable files with a given extension.
*/
public class FilterByFileExtension implements FileFilter {
private final String extension;
/**
* @param extension
* the allowed file name extension.
*/
public FilterByFileExtension(String extension) {
this.extension = extension;
}
@Override
public boolean accept(File file) {
// accept only readable files
if (file.canRead()) {
if (file.isDirectory()) {
// accept all directories
return true;
} else if (file.isFile() && file.getName().endsWith(this.extension)) {
return true;
}
}
return false;
}
}

View File

@ -1,29 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.filefilter;
import java.io.FileFilter;
import org.oscim.database.OpenResult;
/**
* An extension of the {@link FileFilter} interface.
*/
public interface ValidFileFilter extends FileFilter {
/**
* @return the result of the last {@link #accept} call (might be null).
*/
OpenResult getFileOpenResult();
}

View File

@ -1,46 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.filefilter;
import java.io.File;
import java.util.HashMap;
import org.oscim.database.IMapDatabase;
import org.oscim.database.OpenResult;
import org.oscim.database.mapfile.MapDatabase;
/**
* Accepts all valid map files.
*/
public final class ValidMapFile implements ValidFileFilter {
private OpenResult openResult;
@Override
public boolean accept(File file) {
IMapDatabase mapDatabase = new MapDatabase();
HashMap<String, String> options = new HashMap<String, String>();
options.put("mapfile", file.getAbsolutePath());
this.openResult = mapDatabase.open(options);
mapDatabase.close();
return this.openResult.isSuccess();
}
@Override
public OpenResult getFileOpenResult() {
return this.openResult;
}
}

View File

@ -1,71 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.filefilter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.oscim.database.OpenResult;
import org.oscim.theme.RenderThemeHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
/**
* Accepts all valid render theme XML files.
*/
public final class ValidRenderTheme implements ValidFileFilter {
private OpenResult openResult;
@Override
public boolean accept(File file) {
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
RenderThemeHandler renderThemeHandler = new RenderThemeHandler();
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
xmlReader.setContentHandler(renderThemeHandler);
xmlReader.parse(new InputSource(inputStream));
this.openResult = OpenResult.SUCCESS;
} catch (ParserConfigurationException e) {
this.openResult = new OpenResult(e.getMessage());
} catch (SAXException e) {
this.openResult = new OpenResult(e.getMessage());
} catch (IOException e) {
this.openResult = new OpenResult(e.getMessage());
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
this.openResult = new OpenResult(e.getMessage());
}
}
return this.openResult.isSuccess();
}
@Override
public OpenResult getFileOpenResult() {
return this.openResult;
}
}

View File

@ -1,255 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.filepicker;
import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;
import java.util.Comparator;
import org.oscim.app.R;
import org.oscim.app.filefilter.ValidFileFilter;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
/**
* A FilePicker displays the contents of directories. The user can navigate within the file system and select a single
* file whose path is then returned to the calling activity. The ordering of directory contents can be specified via
* {@link #setFileComparator(Comparator)}. By default subfolders and files are grouped and each group is ordered
* alphabetically.
* <p>
* A {@link FileFilter} can be activated via {@link #setFileDisplayFilter(FileFilter)} to restrict the displayed files
* and folders. By default all files and folders are visible.
* <p>
* Another <code>FileFilter</code> can be applied via {@link #setFileSelectFilter(ValidFileFilter)} to check if a
* selected file is valid before its path is returned. By default all files are considered as valid and can be selected.
*/
public class FilePicker extends Activity implements AdapterView.OnItemClickListener {
/**
* The name of the extra data in the result {@link Intent}.
*/
public static final String SELECTED_FILE = "selectedFile";
private static final String CURRENT_DIRECTORY = "currentDirectory";
private static final String DEFAULT_DIRECTORY = "/";
private static final int DIALOG_FILE_INVALID = 0;
// private static final int DIALOG_FILE_SELECT = 1;
private static Comparator<File> fileComparator = getDefaultFileComparator();
private static FileFilter fileDisplayFilter;
private static ValidFileFilter fileSelectFilter;
private static final String PREFERENCES_FILE = "FilePicker";
/**
* Sets the file comparator which is used to order the contents of all directories before displaying them. If set to
* null, subfolders and files will not be ordered.
*
* @param fileComparator
* the file comparator (may be null).
*/
public static void setFileComparator(Comparator<File> fileComparator) {
FilePicker.fileComparator = fileComparator;
}
/**
* Sets the file display filter. This filter is used to determine which files and subfolders of directories will be
* displayed. If set to null, all files and subfolders are shown.
*
* @param fileDisplayFilter
* the file display filter (may be null).
*/
public static void setFileDisplayFilter(FileFilter fileDisplayFilter) {
FilePicker.fileDisplayFilter = fileDisplayFilter;
}
/**
* Sets the file select filter. This filter is used when the user selects a file to determine if it is valid. If set
* to null, all files are considered as valid.
*
* @param fileSelectFilter
* the file selection filter (may be null).
*/
public static void setFileSelectFilter(ValidFileFilter fileSelectFilter) {
FilePicker.fileSelectFilter = fileSelectFilter;
}
/**
* Creates the default file comparator.
*
* @return the default file comparator.
*/
private static Comparator<File> getDefaultFileComparator() {
// order all files by type and alphabetically by name
return new Comparator<File>() {
@Override
public int compare(File file1, File file2) {
if (file1.isDirectory() && !file2.isDirectory()) {
return -1;
} else if (!file1.isDirectory() && file2.isDirectory()) {
return 1;
} else {
return file1.getName().compareToIgnoreCase(file2.getName());
}
}
};
}
private File currentDirectory;
private FilePickerIconAdapter filePickerIconAdapter;
private File[] files;
private File[] filesWithParentFolder;
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
File selectedFile = this.files[(int) id];
if (selectedFile.isDirectory()) {
this.currentDirectory = selectedFile;
browseToCurrentDirectory();
} else if (fileSelectFilter == null || fileSelectFilter.accept(selectedFile)) {
setResult(RESULT_OK,
new Intent().putExtra(SELECTED_FILE, selectedFile.getAbsolutePath()));
finish();
} else {
showDialog(DIALOG_FILE_INVALID);
}
}
/**
* Browses to the current directory.
*/
private void browseToCurrentDirectory() {
setTitle(this.currentDirectory.getAbsolutePath());
// read the subfolders and files from the current directory
if (fileDisplayFilter == null) {
this.files = this.currentDirectory.listFiles();
} else {
this.files = this.currentDirectory.listFiles(fileDisplayFilter);
}
if (this.files == null) {
this.files = new File[0];
} else {
// order the subfolders and files
Arrays.sort(this.files, fileComparator);
}
// if a parent directory exists, add it at the first position
if (this.currentDirectory.getParentFile() != null) {
this.filesWithParentFolder = new File[this.files.length + 1];
this.filesWithParentFolder[0] = this.currentDirectory.getParentFile();
System.arraycopy(this.files, 0, this.filesWithParentFolder, 1,
this.files.length);
this.files = this.filesWithParentFolder;
this.filePickerIconAdapter.setFiles(this.files, true);
} else {
this.filePickerIconAdapter.setFiles(this.files, false);
}
this.filePickerIconAdapter.notifyDataSetChanged();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_picker);
this.filePickerIconAdapter = new FilePickerIconAdapter(this);
GridView gridView = (GridView) findViewById(R.id.filePickerView);
gridView.setOnItemClickListener(this);
gridView.setAdapter(this.filePickerIconAdapter);
// if (savedInstanceState == null) {
// // first start of this instance
// showDialog(DIALOG_FILE_SELECT);
// }
}
@Override
protected Dialog onCreateDialog(int id) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
switch (id) {
case DIALOG_FILE_INVALID:
builder.setIcon(android.R.drawable.ic_menu_info_details);
builder.setTitle(R.string.error);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(getString(R.string.file_invalid));
stringBuilder.append("\n\n");
stringBuilder.append(FilePicker.fileSelectFilter.getFileOpenResult()
.getErrorMessage());
builder.setMessage(stringBuilder.toString());
builder.setPositiveButton(R.string.ok, null);
return builder.create();
// case DIALOG_FILE_SELECT:
// builder.setMessage(R.string.file_select);
// builder.setPositiveButton(R.string.ok, null);
// return builder.create();
default:
// do dialog will be created
return null;
}
}
@Override
protected void onPause() {
super.onPause();
// save the current directory
Editor editor = getSharedPreferences(PREFERENCES_FILE, MODE_PRIVATE).edit();
editor.clear();
if (this.currentDirectory != null) {
editor.putString(CURRENT_DIRECTORY, this.currentDirectory.getAbsolutePath());
}
editor.commit();
}
@TargetApi(11)
@Override
protected void onResume() {
super.onResume();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
getActionBar().hide();
// check if the full screen mode should be activated
// if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("fullscreen",
// false)) {
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
// } else {
// getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
// }
// restore the current directory
SharedPreferences preferences = getSharedPreferences(PREFERENCES_FILE,
MODE_PRIVATE);
this.currentDirectory = new File(preferences.getString(CURRENT_DIRECTORY,
DEFAULT_DIRECTORY));
if (!this.currentDirectory.exists() || !this.currentDirectory.canRead()) {
this.currentDirectory = new File(DEFAULT_DIRECTORY);
}
browseToCurrentDirectory();
}
}

View File

@ -1,111 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.filepicker;
import java.io.File;
import org.oscim.app.R;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
/**
* An adapter for the FilePicker GridView.
*/
class FilePickerIconAdapter extends BaseAdapter {
private final Context context;
private File currentFile;
private File[] files;
private boolean hasParentFolder;
private TextView textView;
/**
* Creates a new FilePickerIconAdapter with the given context.
*
* @param context
* the context of this adapter, through which new Views are created.
*/
FilePickerIconAdapter(Context context) {
super();
this.context = context;
}
@Override
public int getCount() {
if (this.files == null) {
return 0;
}
return this.files.length;
}
@Override
public Object getItem(int index) {
return this.files[index];
}
@Override
public long getItemId(int index) {
return index;
}
@Override
public View getView(int index, View convertView, ViewGroup parent) {
if (convertView instanceof TextView) {
// recycle the old view
this.textView = (TextView) convertView;
} else {
// create a new view object
this.textView = new TextView(this.context);
this.textView.setLines(2);
this.textView.setGravity(Gravity.CENTER_HORIZONTAL);
this.textView.setPadding(5, 10, 5, 10);
}
if (index == 0 && this.hasParentFolder) {
// the parent directory of the current folder
this.textView.setCompoundDrawablesWithIntrinsicBounds(0,
R.drawable.file_picker_back, 0, 0);
this.textView.setText("..");
} else {
this.currentFile = this.files[index];
if (this.currentFile.isDirectory()) {
this.textView.setCompoundDrawablesWithIntrinsicBounds(0,
R.drawable.file_picker_folder, 0, 0);
} else {
this.textView.setCompoundDrawablesWithIntrinsicBounds(0,
R.drawable.file_picker_file, 0, 0);
}
this.textView.setText(this.currentFile.getName());
}
return this.textView;
}
/**
* Sets the data of this adapter.
*
* @param files
* the new files for this adapter.
* @param newHasParentFolder
* true if the file array has a parent folder at index 0, false otherwise.
*/
void setFiles(File[] files, boolean newHasParentFolder) {
this.files = files.clone();
this.hasParentFolder = newHasParentFolder;
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.preferences;
import org.oscim.app.R;
import android.os.Bundle;
import android.preference.PreferenceActivity;
/**
* Activity to edit the application preferences.
*/
public class EditPreferences extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
// @TargetApi(11)
@Override
protected void onResume() {
super.onResume();
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
// getActionBar().hide();
// check if the full screen mode should be activated
// if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("fullscreen",
// false)) {
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
// } else {
// getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
// }
}
}

View File

@ -1,154 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.app.preferences;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.DialogPreference;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
/**
* This abstract class provides all code for a seek bar preference. Deriving
* classes only need to set the current and
* maximum value of the seek bar. An optional text message above the seek bar is
* also supported as well as an optional
* current value message below the seek bar.
*/
abstract class SeekBarPreference extends DialogPreference implements OnSeekBarChangeListener {
private TextView mCurrentValueTextView;
private Editor mEditor;
private SeekBar mPreferenceSeekBar;
/**
* How much the value should increase when the seek bar is moved.
*/
int increment = 1;
/**
* The maximum value of the seek bar.
*/
int max;
/**
* Optional text message to display on top of the seek bar.
*/
String messageText;
/**
* The SharedPreferences instance that is used.
*/
final SharedPreferences preferencesDefault;
/**
* The current value of the seek bar.
*/
int seekBarCurrentValue;
/**
* Create a new seek bar preference.
* @param context
* the context of the seek bar preferences activity.
* @param attrs
* A set of attributes (currently ignored).
*/
SeekBarPreference(Context context, AttributeSet attrs) {
super(context, attrs);
preferencesDefault = PreferenceManager.getDefaultSharedPreferences(context);
}
@Override
public void onClick(DialogInterface dialog, int which) {
// check if the "OK" button was pressed and the seek bar value has changed
if (which == DialogInterface.BUTTON_POSITIVE
&& seekBarCurrentValue != mPreferenceSeekBar.getProgress()) {
// get the value of the seek bar and save it in the preferences
seekBarCurrentValue = mPreferenceSeekBar.getProgress();
mEditor = preferencesDefault.edit();
mEditor.putInt(getKey(), seekBarCurrentValue);
mEditor.commit();
}
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (mCurrentValueTextView != null) {
mCurrentValueTextView.setText(getCurrentValueText(progress));
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// do nothing
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// do nothing
}
@Override
protected View onCreateDialogView() {
// create a layout for the optional text messageText and the seek bar
LinearLayout linearLayout = new LinearLayout(getContext());
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setPadding(20, 10, 20, 10);
// check if a text message should appear above the seek bar
if (messageText != null) {
// create a text view for the text messageText
TextView messageTextView = new TextView(getContext());
messageTextView.setText(messageText);
messageTextView.setPadding(0, 0, 0, 20);
// add the text message view to the layout
linearLayout.addView(messageTextView);
}
// create the seek bar and set the maximum and current value
mPreferenceSeekBar = new SeekBar(getContext());
mPreferenceSeekBar.setOnSeekBarChangeListener(this);
mPreferenceSeekBar.setMax(max);
mPreferenceSeekBar.setProgress(Math.min(seekBarCurrentValue, max));
mPreferenceSeekBar.setKeyProgressIncrement(increment);
mPreferenceSeekBar.setPadding(0, 0, 0, 10);
// add the seek bar to the layout
linearLayout.addView(mPreferenceSeekBar);
// create the text view for the current value below the seek bar
mCurrentValueTextView = new TextView(getContext());
mCurrentValueTextView.setText(getCurrentValueText(mPreferenceSeekBar.getProgress()));
mCurrentValueTextView.setGravity(Gravity.CENTER_HORIZONTAL);
// add the current value text view to the layout
linearLayout.addView(mCurrentValueTextView);
return linearLayout;
}
/**
* Get the current value text.
* @param progress
* the current progress level of the seek bar.
* @return the new current value text
*/
abstract String getCurrentValueText(int progress);
}

View File

@ -1,135 +0,0 @@
package org.osmdroid.location;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint;
import org.osmdroid.utils.BonusPackHelper;
import android.util.Log;
/**
* POI Provider using Flickr service to get geolocalized photos.
* @see "http://www.flickr.com/services/api/flickr.photos.search.html"
* @author M.Kergall
*/
public class FlickrPOIProvider {
protected String mApiKey;
/**
* @param apiKey
* the registered API key to give to Flickr service.
* @see "http://www.flickr.com/help/api/"
*/
public FlickrPOIProvider(String apiKey) {
mApiKey = apiKey;
}
private String getUrlInside(BoundingBox boundingBox, int maxResults) {
StringBuffer url = new StringBuffer(
"http://api.flickr.com/services/rest/?method=flickr.photos.search");
url.append("&api_key=" + mApiKey);
url.append("&bbox=" + boundingBox.getMinLongitude());
url.append("," + boundingBox.getMinLatitude());
url.append("," + boundingBox.getMaxLongitude());
url.append("," + boundingBox.getMaxLatitude());
url.append("&has_geo=1");
// url.append("&geo_context=2");
// url.append("&is_commons=true");
url.append("&format=json&nojsoncallback=1");
url.append("&per_page=" + maxResults);
// From Flickr doc:
// "Geo queries require some sort of limiting agent in order to prevent the database from crying."
// And min_date_upload is considered as a limiting agent. So:
url.append("&min_upload_date=2005/01/01");
// Ask to provide some additional attributes we will need:
url.append("&extras=geo,url_sq");
url.append("&sort=interestingness-desc");
return url.toString();
}
/* public POI getPhoto(String photoId){ String url =
* "http://api.flickr.com/services/rest/?method=flickr.photos.getInfo" +
* "&api_key=" + mApiKey + "&photo_id=" + photo Id +
* "&format=json&nojsoncallback=1"; Log.d(BonusPackHelper.LOG_TAG,
* "getPhoto:"+url); String jString =
* BonusPackHelper.requestStringFromUrl(url); if (jString == null) {
* Log.e(BonusPackHelper.LOG_TAG, "FlickrPOIProvider: request failed.");
* return null; } try { POI poi = new POI(POI.POI_SERVICE_FLICKR);
* JSONObject jRoot = new JSONObject(jString); JSONObject jPhoto =
* jRoot.getJSONObject("photo"); JSONObject jLocation =
* jPhoto.getJSONObject("location"); poi.mLocation = new GeoPoint(
* jLocation.getDouble("latitude"), jLocation.getDouble("longitude"));
* poi.mId = Long.parseLong(photoId); JSONObject jTitle =
* jPhoto.getJSONObject("title"); poi.mType = jTitle.getString("_content");
* JSONObject jDescription = jPhoto.getJSONObject("description");
* poi.mDescription = jDescription.getString("_content"); //truncate
* description if too long: if (poi.mDescription.length() > 300){
* poi.mDescription = poi.mDescription.substring(0, 300) + " (...)"; }
* String farm = jPhoto.getString("farm"); String server =
* jPhoto.getString("server"); String secret = jPhoto.getString("secret");
* JSONObject jOwner = jPhoto.getJSONObject("owner"); String nsid =
* jOwner.getString("nsid"); poi.mThumbnailPath =
* "http://farm"+farm+".staticflickr.com/"
* +server+"/"+photoId+"_"+secret+"_s.jpg"; poi.mUrl =
* "http://www.flickr.com/photos/"+nsid+"/"+photoId; return poi; }catch
* (JSONException e) { e.printStackTrace(); return null; } } */
/**
* @param fullUrl ...
* @return the list of POI
*/
public ArrayList<POI> getThem(String fullUrl) {
// for local debug: fullUrl = "http://10.0.2.2/flickr_mockup.json";
Log.d(BonusPackHelper.LOG_TAG, "FlickrPOIProvider:get:" + fullUrl);
String jString = BonusPackHelper.requestStringFromUrl(fullUrl);
if (jString == null) {
Log.e(BonusPackHelper.LOG_TAG, "FlickrPOIProvider: request failed.");
return null;
}
try {
JSONObject jRoot = new JSONObject(jString);
JSONObject jPhotos = jRoot.getJSONObject("photos");
JSONArray jPhotoArray = jPhotos.getJSONArray("photo");
int n = jPhotoArray.length();
ArrayList<POI> pois = new ArrayList<POI>(n);
for (int i = 0; i < n; i++) {
JSONObject jPhoto = jPhotoArray.getJSONObject(i);
String photoId = jPhoto.getString("id");
POI poi = new POI(POI.POI_SERVICE_FLICKR);
poi.location = new GeoPoint(
jPhoto.getDouble("latitude"),
jPhoto.getDouble("longitude"));
poi.id = Long.parseLong(photoId);
poi.type = jPhoto.getString("title");
poi.thumbnailPath = jPhoto.getString("url_sq");
String owner = jPhoto.getString("owner");
poi.url = "http://www.flickr.com/photos/" + owner + "/" + photoId;
pois.add(poi);
}
int total = jPhotos.getInt("total");
Log.d(BonusPackHelper.LOG_TAG, "done:" + n + " got, on a total of:" + total);
return pois;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
/**
* @param boundingBox ...
* @param maxResults ...
* @return list of POI, Flickr photos inside the bounding box. Null if
* technical issue.
*/
public ArrayList<POI> getPOIInside(BoundingBox boundingBox, int maxResults) {
String url = getUrlInside(boundingBox, maxResults);
return getThem(url);
}
}

View File

@ -1,219 +0,0 @@
package org.osmdroid.location;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Locale;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint;
import org.osmdroid.utils.BonusPackHelper;
import org.osmdroid.utils.HttpConnection;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import android.util.Log;
/**
* POI Provider using GeoNames services. Currently, "find Nearby Wikipedia" and
* "Wikipedia Articles in Bounding Box" services.
* @see "http://www.geonames.org"
* @author M.Kergall
*/
public class GeoNamesPOIProvider {
protected String mUserName;
/**
* @param account
* the registered "username" to give to GeoNames service.
* @see "http://www.geonames.org/login"
*/
public GeoNamesPOIProvider(String account) {
mUserName = account;
}
private String getUrlCloseTo(GeoPoint p, int maxResults, double maxDistance) {
StringBuffer url = new StringBuffer("http://api.geonames.org/findNearbyWikipediaJSON?");
url.append("lat=" + p.getLatitude());
url.append("&lng=" + p.getLongitude());
url.append("&maxRows=" + maxResults);
url.append("&radius=" + maxDistance); //km
url.append("&lang=" + Locale.getDefault().getLanguage());
url.append("&username=" + mUserName);
return url.toString();
}
private String getUrlInside(BoundingBox boundingBox, int maxResults) {
StringBuffer url = new StringBuffer("http://api.geonames.org/wikipediaBoundingBoxJSON?");
url.append("south=" + boundingBox.getMinLatitude());
url.append("&north=" + boundingBox.getMaxLatitude());
url.append("&west=" + boundingBox.getMinLongitude());
url.append("&east=" + boundingBox.getMaxLongitude());
url.append("&maxRows=" + maxResults);
url.append("&lang=" + Locale.getDefault().getLanguage());
url.append("&username=" + mUserName);
return url.toString();
}
/**
* @param fullUrl
* ...
* @return the list of POI
*/
public ArrayList<POI> getThem(String fullUrl) {
Log.d(BonusPackHelper.LOG_TAG, "GeoNamesPOIProvider:get:" + fullUrl);
String jString = BonusPackHelper.requestStringFromUrl(fullUrl);
if (jString == null) {
Log.e(BonusPackHelper.LOG_TAG, "GeoNamesPOIProvider: request failed.");
return null;
}
try {
JSONObject jRoot = new JSONObject(jString);
JSONArray jPlaceIds = jRoot.getJSONArray("geonames");
int n = jPlaceIds.length();
ArrayList<POI> pois = new ArrayList<POI>(n);
for (int i = 0; i < n; i++) {
JSONObject jPlace = jPlaceIds.getJSONObject(i);
POI poi = new POI(POI.POI_SERVICE_GEONAMES_WIKIPEDIA);
poi.location = new GeoPoint(jPlace.getDouble("lat"),
jPlace.getDouble("lng"));
poi.category = jPlace.optString("feature");
poi.type = jPlace.getString("title");
poi.description = jPlace.optString("summary");
poi.thumbnailPath = jPlace.optString("thumbnailImg", null);
/* This makes loading too long. Thumbnail loading will be done
* only when needed, with POI.getThumbnail() if
* (poi.mThumbnailPath != null){ poi.mThumbnail =
* BonusPackHelper.loadBitmap(poi.mThumbnailPath); } */
poi.url = jPlace.optString("wikipediaUrl", null);
if (poi.url != null)
poi.url = "http://" + poi.url;
poi.rank = jPlace.optInt("rank", 0);
//other attributes: distance?
pois.add(poi);
}
Log.d(BonusPackHelper.LOG_TAG, "done");
return pois;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
//XML parsing seems 2 times slower than JSON parsing
public ArrayList<POI> getThemXML(String fullUrl) {
Log.d(BonusPackHelper.LOG_TAG, "GeoNamesPOIProvider:get:" + fullUrl);
HttpConnection connection = new HttpConnection();
connection.doGet(fullUrl);
InputStream stream = connection.getStream();
if (stream == null) {
return null;
}
GeoNamesXMLHandler handler = new GeoNamesXMLHandler();
try {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(stream, handler);
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
connection.close();
Log.d(BonusPackHelper.LOG_TAG, "done");
return handler.mPOIs;
}
/**
* @param position
* ...
* @param maxResults
* ...
* @param maxDistance
* ... in km. 20 km max for the free service.
* @return list of POI, Wikipedia entries close to the position. Null if
* technical issue.
*/
public ArrayList<POI> getPOICloseTo(GeoPoint position,
int maxResults, double maxDistance) {
String url = getUrlCloseTo(position, maxResults, maxDistance);
return getThem(url);
}
/**
* @param boundingBox
* ...
* @param maxResults
* ...
* @return list of POI, Wikipedia entries inside the bounding box. Null if
* technical issue.
*/
public ArrayList<POI> getPOIInside(BoundingBox boundingBox, int maxResults) {
String url = getUrlInside(boundingBox, maxResults);
return getThem(url);
}
}
class GeoNamesXMLHandler extends DefaultHandler {
private String mString;
double mLat, mLng;
POI mPOI;
ArrayList<POI> mPOIs;
public GeoNamesXMLHandler() {
mPOIs = new ArrayList<POI>();
}
@Override
public void startElement(String uri, String localName, String name,
Attributes attributes) {
if (localName.equals("entry")) {
mPOI = new POI(POI.POI_SERVICE_GEONAMES_WIKIPEDIA);
}
mString = new String();
}
@Override
public void characters(char[] ch, int start, int length) {
String chars = new String(ch, start, length);
mString = mString.concat(chars);
}
@Override
public void endElement(String uri, String localName, String name) {
if (localName.equals("lat")) {
mLat = Double.parseDouble(mString);
} else if (localName.equals("lng")) {
mLng = Double.parseDouble(mString);
} else if (localName.equals("feature")) {
mPOI.category = mString;
} else if (localName.equals("title")) {
mPOI.type = mString;
} else if (localName.equals("summary")) {
mPOI.description = mString;
} else if (localName.equals("thumbnailImg")) {
if (mString != null && !mString.equals(""))
mPOI.thumbnailPath = mString;
} else if (localName.equals("wikipediaUrl")) {
if (mString != null && !mString.equals(""))
mPOI.url = "http://" + mString;
} else if (localName.equals("rank")) {
mPOI.rank = Integer.parseInt(mString);
} else if (localName.equals("entry")) {
mPOI.location = new GeoPoint(mLat, mLng);
mPOIs.add(mPOI);
}
}
}

View File

@ -1,215 +0,0 @@
package org.osmdroid.location;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.osmdroid.utils.BonusPackHelper;
import android.content.Context;
import android.location.Address;
import android.util.Log;
/**
* Implements an equivalent to Android Geocoder class, based on OpenStreetMap
* data and Nominatim API. <br>
* See http://wiki.openstreetmap.org/wiki/Nominatim or
* http://open.mapquestapi.com/nominatim/
*
* @author M.Kergall
*/
public class GeocoderNominatim {
public static final String NOMINATIM_SERVICE_URL = "http://nominatim.openstreetmap.org/";
public static final String MAPQUEST_SERVICE_URL = "http://open.mapquestapi.com/nominatim/v1/";
protected Locale mLocale;
protected String mServiceUrl;
/**
* @param context
* ...
* @param locale
* ...
*/
protected void init(Context context, Locale locale) {
mLocale = locale;
setService(NOMINATIM_SERVICE_URL); //default service
}
public GeocoderNominatim(Context context, Locale locale) {
init(context, locale);
}
public GeocoderNominatim(Context context) {
init(context, Locale.getDefault());
}
static public boolean isPresent() {
return true;
}
/**
* Specify the url of the Nominatim service provider to use. Can be one of
* the predefined (NOMINATIM_SERVICE_URL or MAPQUEST_SERVICE_URL), or
* another one, your local instance of Nominatim for instance.
*
* @param serviceUrl
* ...
*/
public void setService(String serviceUrl) {
mServiceUrl = serviceUrl;
}
/**
* Build an Android Address object from the Nominatim address in JSON
* format. Current implementation is mainly targeting french addresses, and
* will be quite basic on other countries.
*
* @param jResult
* ...
* @return ...
* @throws JSONException
* ...
*/
protected Address buildAndroidAddress(JSONObject jResult) throws JSONException {
Address gAddress = new Address(mLocale);
gAddress.setLatitude(jResult.getDouble("lat"));
gAddress.setLongitude(jResult.getDouble("lon"));
JSONObject jAddress = jResult.getJSONObject("address");
int addressIndex = 0;
if (jAddress.has("road")) {
gAddress.setAddressLine(addressIndex++, jAddress.getString("road"));
gAddress.setThoroughfare(jAddress.getString("road"));
}
if (jAddress.has("suburb")) {
//gAddress.setAddressLine(addressIndex++, jAddress.getString("suburb"));
//not kept => often introduce "noise" in the address.
gAddress.setSubLocality(jAddress.getString("suburb"));
}
if (jAddress.has("postcode")) {
gAddress.setAddressLine(addressIndex++, jAddress.getString("postcode"));
gAddress.setPostalCode(jAddress.getString("postcode"));
}
if (jAddress.has("city")) {
gAddress.setAddressLine(addressIndex++, jAddress.getString("city"));
gAddress.setLocality(jAddress.getString("city"));
} else if (jAddress.has("town")) {
gAddress.setAddressLine(addressIndex++, jAddress.getString("town"));
gAddress.setLocality(jAddress.getString("town"));
} else if (jAddress.has("village")) {
gAddress.setAddressLine(addressIndex++, jAddress.getString("village"));
gAddress.setLocality(jAddress.getString("village"));
}
if (jAddress.has("county")) { //France: departement
gAddress.setSubAdminArea(jAddress.getString("county"));
}
if (jAddress.has("state")) { //France: region
gAddress.setAdminArea(jAddress.getString("state"));
}
if (jAddress.has("country")) {
gAddress.setAddressLine(addressIndex++, jAddress.getString("country"));
gAddress.setCountryName(jAddress.getString("country"));
}
if (jAddress.has("country_code"))
gAddress.setCountryCode(jAddress.getString("country_code"));
/*
* Other possible OSM tags in Nominatim results not handled yet: subway,
* golf_course, bus_stop, parking,... house, house_number, building
* city_district (13e Arrondissement) road => or highway, ... sub-city
* (like suburb) => locality, isolated_dwelling, hamlet ...
* state_district
*/
return gAddress;
}
/**
* @param latitude
* ...
* @param longitude
* ...
* @param maxResults
* ...
* @return ...
* @throws IOException
* ...
*/
public List<Address> getFromLocation(double latitude, double longitude, int maxResults)
throws IOException {
String url = mServiceUrl
+ "reverse?"
+ "format=json"
+ "&accept-language=" + mLocale.getLanguage()
//+ "&addressdetails=1"
+ "&lat=" + latitude
+ "&lon=" + longitude;
Log.d(BonusPackHelper.LOG_TAG, "GeocoderNominatim::getFromLocation:" + url);
String result = BonusPackHelper.requestStringFromUrl(url);
//Log.d("NOMINATIM", result);
if (result == null)
throw new IOException();
try {
JSONObject jResult = new JSONObject(result);
Address gAddress = buildAndroidAddress(jResult);
List<Address> list = new ArrayList<Address>();
list.add(gAddress);
return list;
} catch (JSONException e) {
throw new IOException();
}
}
public List<Address> getFromLocationName(String locationName, int maxResults,
double lowerLeftLatitude, double lowerLeftLongitude,
double upperRightLatitude, double upperRightLongitude)
throws IOException {
String url = mServiceUrl
+ "search?"
+ "format=json"
+ "&accept-language=" + mLocale.getLanguage()
+ "&addressdetails=1"
+ "&limit=" + maxResults
+ "&q=" + URLEncoder.encode(locationName);
if (lowerLeftLatitude != 0.0 && lowerLeftLongitude != 0.0) {
//viewbox = left, top, right, bottom:
url += "&viewbox=" + lowerLeftLongitude
+ "," + upperRightLatitude
+ "," + upperRightLongitude
+ "," + lowerLeftLatitude
+ "&bounded=1";
}
Log.d(BonusPackHelper.LOG_TAG, "GeocoderNominatim::getFromLocationName:" + url);
String result = BonusPackHelper.requestStringFromUrl(url);
//Log.d(BonusPackHelper.LOG_TAG, result);
if (result == null)
throw new IOException();
try {
JSONArray jResults = new JSONArray(result);
List<Address> list = new ArrayList<Address>();
for (int i = 0; i < jResults.length(); i++) {
JSONObject jResult = jResults.getJSONObject(i);
Address gAddress = buildAndroidAddress(jResult);
list.add(gAddress);
}
return list;
} catch (JSONException e) {
throw new IOException();
}
}
public List<Address> getFromLocationName(String locationName, int maxResults)
throws IOException {
return getFromLocationName(locationName, maxResults, 0.0, 0.0, 0.0, 0.0);
}
}

View File

@ -1,184 +0,0 @@
package org.osmdroid.location;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint;
import org.osmdroid.utils.BonusPackHelper;
import android.graphics.Bitmap;
import android.util.Log;
/**
* POI Provider using Nominatim service. <br>
* See https://wiki.openstreetmap.org/wiki/Nominatim<br>
* and http://open.mapquestapi.com/nominatim/<br>
*
* @author M.Kergall
*/
public class NominatimPOIProvider {
/*
* As the doc lacks a lot of features, source code may help:
* https://trac.openstreetmap
* .org/browser/applications/utils/nominatim/website/search.php featuretype=
* to select on feature type (country, city, state, settlement)<br>
* format=jsonv2 to get a place_rank<br> offset= to offset the result ?...
* <br> polygon=1 to get the border of the poi as a polygon<br> nearlat &
* nearlon = ???<br> routewidth/69 and routewidth/30 ???<br>
*/
public static final String MAPQUEST_POI_SERVICE = "http://open.mapquestapi.com/nominatim/v1/";
public static final String NOMINATIM_POI_SERVICE = "http://nominatim.openstreetmap.org/";
protected String mService;
public NominatimPOIProvider() {
mService = NOMINATIM_POI_SERVICE;
}
public void setService(String serviceUrl) {
mService = serviceUrl;
}
private StringBuffer getCommonUrl(String type, int maxResults) {
StringBuffer urlString = new StringBuffer(mService);
urlString.append("search?");
urlString.append("format=json");
urlString.append("&q=[" + URLEncoder.encode(type) + "]");
urlString.append("&limit=" + maxResults);
urlString.append("&bounded=1");
// urlString.append("&addressdetails=0");
return urlString;
}
private String getUrlInside(BoundingBox bb, String type, int maxResults) {
StringBuffer urlString = getCommonUrl(type, maxResults);
urlString.append("&viewbox=" + bb.getMaxLongitude() + ","
+ bb.getMaxLatitude() + ","
+ bb.getMinLongitude() + ","
+ bb.getMinLatitude());
return urlString.toString();
}
private String getUrlCloseTo(GeoPoint p, String type,
int maxResults, double maxDistance) {
int maxD = (int) (maxDistance * 1E6);
BoundingBox bb = new BoundingBox(p.latitudeE6 + maxD,
p.longitudeE6 + maxD,
p.latitudeE6 - maxD,
p.longitudeE6 - maxD);
return getUrlInside(bb, type, maxResults);
}
/**
* @param url
* full URL request
* @return the list of POI, of null if technical issue.
*/
public ArrayList<POI> getThem(String url) {
Log.d(BonusPackHelper.LOG_TAG, "NominatimPOIProvider:get:" + url);
String jString = BonusPackHelper.requestStringFromUrl(url);
if (jString == null) {
Log.e(BonusPackHelper.LOG_TAG, "NominatimPOIProvider: request failed.");
return null;
}
try {
JSONArray jPlaceIds = new JSONArray(jString);
int n = jPlaceIds.length();
ArrayList<POI> pois = new ArrayList<POI>(n);
Bitmap thumbnail = null;
for (int i = 0; i < n; i++) {
JSONObject jPlace = jPlaceIds.getJSONObject(i);
POI poi = new POI(POI.POI_SERVICE_NOMINATIM);
poi.id = jPlace.optLong("osm_id");
poi.location = new GeoPoint(jPlace.getDouble("lat"), jPlace.getDouble("lon"));
poi.category = jPlace.optString("class");
poi.type = jPlace.getString("type");
poi.description = jPlace.optString("display_name");
poi.thumbnailPath = jPlace.optString("icon", null);
if (i == 0 && poi.thumbnailPath != null) {
//first POI, and we have a thumbnail: load it
thumbnail = BonusPackHelper.loadBitmap(poi.thumbnailPath);
}
poi.thumbnail = thumbnail;
pois.add(poi);
}
return pois;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
/**
* @param position
* ...
* @param type
* an OpenStreetMap feature. See
* http://wiki.openstreetmap.org/wiki/Map_Features or
* http://code.google.com/p/osmbonuspack/source/browse/trunk/
* OSMBonusPackDemo/res/values/poi_tags.xml
* @param maxResults
* the maximum number of POI returned. Note that in any case,
* Nominatim will have an absolute maximum of 100.
* @param maxDistance
* to the position, in degrees. Note that it is used to build a
* bounding box around the position, not a circle.
* @return the list of POI, null if technical issue.
*/
public ArrayList<POI> getPOICloseTo(GeoPoint position, String type,
int maxResults, double maxDistance) {
String url = getUrlCloseTo(position, type, maxResults, maxDistance);
return getThem(url);
}
/**
* @param boundingBox
* ...
* @param type
* OpenStreetMap feature
* @param maxResults
* ...
* @return list of POIs, null if technical issue.
*/
public ArrayList<POI> getPOIInside(BoundingBox boundingBox, String type, int maxResults) {
String url = getUrlInside(boundingBox, type, maxResults);
return getThem(url);
}
/**
* @param path
* Warning: a long path may cause a failure due to the url to be
* too long. Using a simplified route may help (see
* Road.getRouteLow()).
* @param type
* OpenStreetMap feature
* @param maxResults
* ...
* @param maxWidth
* to the path. Certainly not in degrees. Probably in km.
* @return list of POIs, null if technical issue.
*/
public ArrayList<POI> getPOIAlong(ArrayList<GeoPoint> path, String type,
int maxResults, double maxWidth) {
StringBuffer urlString = getCommonUrl(type, maxResults);
urlString.append("&routewidth=" + maxWidth);
urlString.append("&route=");
boolean isFirst = true;
for (GeoPoint p : path) {
if (isFirst)
isFirst = false;
else
urlString.append(",");
String lat = Double.toString(p.getLatitude());
lat = lat.substring(0, Math.min(lat.length(), 7));
String lon = Double.toString(p.getLongitude());
lon = lon.substring(0, Math.min(lon.length(), 7));
urlString.append(lat + "," + lon);
//limit the size of url as much as possible, as post method is not supported.
}
return getThem(urlString.toString());
}
}

View File

@ -1,177 +0,0 @@
package org.osmdroid.location;
import org.oscim.app.R;
import org.oscim.core.GeoPoint;
import org.osmdroid.utils.BonusPackHelper;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
/**
* Point of Interest. Exact content may depend of the POI provider used.
* @see NominatimPOIProvider
* @see GeoNamesPOIProvider
* @author M.Kergall
*/
public class POI implements Parcelable {
/** IDs of POI services */
public static int POI_SERVICE_NOMINATIM = 100;
public static int POI_SERVICE_GEONAMES_WIKIPEDIA = 200;
public static int POI_SERVICE_FLICKR = 300;
public static int POI_SERVICE_PICASA = 400;
/** Identifies the service provider of this POI. */
public int serviceId;
/** Nominatim: OSM ID. GeoNames: 0 */
public long id;
/** location of the POI */
public GeoPoint location;
/** Nominatim "class", GeoNames "feature" */
public String category;
/** type or title */
public String type;
/** can be the name, the address, a short description */
public String description;
/** url of the thumbnail. Null if none */
public String thumbnailPath;
/** the thumbnail itself. Null if none */
public Bitmap thumbnail;
/** url to a more detailed information page about this POI. Null if none */
public String url;
/**
* popularity of this POI, from 1 (lowest) to 100 (highest). 0 if not
* defined.
*/
public int rank;
/** number of attempts to load the thumbnail that have failed */
protected int mThumbnailLoadingFailures;
public POI(int serviceId) {
this.serviceId = serviceId;
// lets all other fields empty or null. That's fine.
}
protected static int MAX_LOADING_ATTEMPTS = 2;
/**
* @return the POI thumbnail as a Bitmap, if any. If not done yet, it will
* load the POI thumbnail from its url (in thumbnailPath field).
*/
public Bitmap getThumbnail() {
if (thumbnail == null && thumbnailPath != null) {
Log.d(BonusPackHelper.LOG_TAG, "POI:load thumbnail:" + thumbnailPath);
thumbnail = BonusPackHelper.loadBitmap(thumbnailPath);
if (thumbnail == null) {
mThumbnailLoadingFailures++;
if (mThumbnailLoadingFailures >= MAX_LOADING_ATTEMPTS) {
// this path really doesn't work, "kill" it for next calls:
thumbnailPath = null;
}
}
}
return thumbnail;
}
// http://stackoverflow.com/questions/7729133/using-asynctask-to-load-images-in-listview
// TODO see link, there might be a better solution
/**
* Fetch the thumbnail from its url on a thread.
* @param imageView
* to update once the thumbnail is retrieved, or to hide if no
* thumbnail.
*/
public void fetchThumbnail(final ImageView imageView) {
if (thumbnail != null) {
imageView.setImageBitmap(thumbnail);
imageView.setVisibility(View.VISIBLE);
} else if (thumbnailPath != null) {
imageView.setImageResource(R.drawable.ic_empty);
new ThumbnailTask(imageView).execute(imageView);
} else {
imageView.setVisibility(View.GONE);
}
}
class ThumbnailTask extends AsyncTask<ImageView, Void, ImageView> {
public ThumbnailTask(ImageView iv) {
iv.setTag(thumbnailPath);
}
@Override
protected ImageView doInBackground(ImageView... params) {
getThumbnail();
return params[0];
}
@Override
protected void onPostExecute(ImageView iv) {
if (thumbnailPath.equals(iv.getTag().toString()))
iv.setImageBitmap(thumbnail);
}
}
// --- Parcelable implementation
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(serviceId);
out.writeLong(id);
out.writeParcelable(location, 0);
out.writeString(category);
out.writeString(type);
out.writeString(description);
out.writeString(thumbnailPath);
out.writeParcelable(thumbnail, 0);
out.writeString(url);
out.writeInt(rank);
out.writeInt(mThumbnailLoadingFailures);
}
public static final Parcelable.Creator<POI> CREATOR = new Parcelable.Creator<POI>() {
@Override
public POI createFromParcel(Parcel in) {
POI poi = new POI(in.readInt());
poi.id = in.readLong();
poi.location = in.readParcelable(GeoPoint.class.getClassLoader());
poi.category = in.readString();
poi.type = in.readString();
poi.description = in.readString();
poi.thumbnailPath = in.readString();
poi.thumbnail = in.readParcelable(Bitmap.class.getClassLoader());
poi.url = in.readString();
poi.rank = in.readInt();
poi.mThumbnailLoadingFailures = in.readInt();
return poi;
}
@Override
public POI[] newArray(int size) {
return new POI[size];
}
};
// private POI(Parcel in) {
// serviceId = in.readInt();
// id = in.readLong();
// location = in.readParcelable(GeoPoint.class.getClassLoader());
// category = in.readString();
// type = in.readString();
// description = in.readString();
// thumbnailPath = in.readString();
// thumbnail = in.readParcelable(Bitmap.class.getClassLoader());
// url = in.readString();
// rank = in.readInt();
// mThumbnailLoadingFailures = in.readInt();
// }
}

Some files were not shown because too many files have changed in this diff Show More