strings[0]=(*env)->GetStringUTFChars(env, path, NULL);
main_real(1, strings);
(*env)->ReleaseStringUTFChars(env, path, strings[0]);
-
+
}
JNIEXPORT void JNICALL
{
dbg(1,"enter %p %d %p\n",thiz, delete, (void *)id);
callback_call_0((struct callback *)id);
- if (delete)
+ if (delete)
(*jnienv)->DeleteGlobalRef(jnienv, thiz);
}
Java_org_navitproject_navit_NavitVehicle_VehicleCallback( JNIEnv * env, jobject thiz, int id, jobject location)
{
callback_call_1((struct callback *)id, (void *)location);
-}
+}
JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitIdle_IdleCallback( JNIEnv* env, jobject thiz, int id)
}
JNIEXPORT void JNICALL
-Java_org_navitproject_navit_NavitGraphics_CallbackSearchResultList( JNIEnv* env, jobject thiz, int partial, jobject str)
+Java_org_navitproject_navit_NavitGraphics_CallbackSearchResultList( JNIEnv* env, jobject thiz, int partial, jobject country, jobject str)
{
struct attr attr;
const char *search_string =(*env)->GetStringUTFChars(env, str, NULL);
if(aMethodID != 0)
{
struct jni_object my_jni_object;
- GList *ret;
+ GList *ret = NULL;
struct mapset *ms4=navit_get_mapset(attr.u.navit);
+ struct search_list *sl = search_list_new(ms4);
+ struct attr country_attr;
+ const char *str_country=(*env)->GetStringUTFChars(env, country, NULL);
+
+ country_attr.type=attr_country_iso2;
+ country_attr.u.str=str_country;
+
+ search_list_search(sl, &country_attr, 0);
+ (*env)->ReleaseStringUTFChars(env, country, str_country);
my_jni_object.env=env;
my_jni_object.jo=thiz;
my_jni_object.jm=aMethodID;
-/* TODO (rikky#1#): does return nothing yet, also should use a generic callback instead of jni_object */\r ret=search_by_address(ms4,search_string,partial,&my_jni_object);
+ /* TODO (rikky#1#): does return nothing yet, also should use a generic callback instead of jni_object */\r ret=search_by_address(sl,search_string,partial,&my_jni_object);
+ search_list_destroy(sl);
+
dbg(0,"ret=%p\n",ret);
g_list_free(ret);
navit_zoom_out_cursor(attr.u.navit, 2);
break;
case 6:
+
// this procedure is not used at the moment!!
// hopefully use a newly downloaded map, we just hope its set in navit.xml (make nicer soon)
break;
case 4:
{
+ // navigate to display position
char *pstr;
struct point p;
struct coord c;
struct pcoord pc;
-
+
struct transformation *transform=navit_get_trans(attr.u.navit);
s=(*env)->GetStringUTFChars(env, str, NULL);
break;
case 3:
{
+ // navigate to geo position
char *name;
s=(*env)->GetStringUTFChars(env, str, NULL);
char parse_str[strlen(s) + 1];
}
}
+JNIEXPORT jstring JNICALL
+Java_org_navitproject_navit_NavitGraphics_GetDefaultCountry( JNIEnv* env, jobject thiz, int channel, jobject str)
+{
+ struct attr search_attr, country_name, country_iso2, *country_attr;
+ struct tracking *tracking;
+ struct search_list_result *res;
+ jstring return_string = NULL;
+
+ struct attr attr;
+ dbg(0,"enter %d %p\n",channel,str);
+
+ config_get_attr(config_get(), attr_navit, &attr, NULL);
+
+ country_attr=country_default();
+ tracking=navit_get_tracking(attr.u.navit);
+ if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
+ country_attr=&search_attr;
+ if (country_attr) {
+ struct country_search *cs=country_search_new(country_attr, 0);
+ struct item *item=country_search_get_item(cs);
+ if (item && item_attr_get(item, attr_country_name, &country_name)) {
+ struct mapset *ms=navit_get_mapset(attr.u.navit);
+ struct search_list *search_list = search_list_new(ms);
+ search_attr.type=attr_country_all;
+ dbg(0,"country %s\n", country_name.u.str);
+ search_attr.u.str=country_name.u.str;
+ search_list_search(search_list, &search_attr, 0);
+ while((res=search_list_get_result(search_list)))
+ {
+ dbg(0,"Get result: %s\n", res->country->iso2);
+ }
+ if (item_attr_get(item, attr_country_iso2, &country_iso2))
+ return_string = (*env)->NewStringUTF(env,country_iso2.u.str);
+ }
+ country_search_destroy(cs);
+ }
+
+ return return_string;
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_org_navitproject_navit_NavitGraphics_GetAllCountries( JNIEnv* env, jobject thiz)
+{
+ struct attr search_attr;
+ struct search_list_result *res;
+ GList* countries = NULL;
+ int country_count = 0;
+ jobjectArray all_countries;
+
+ struct attr attr;
+ dbg(0,"enter\n");
+
+ config_get_attr(config_get(), attr_navit, &attr, NULL);
+
+ struct mapset *ms=navit_get_mapset(attr.u.navit);
+ struct search_list *search_list = search_list_new(ms);
+ jobjectArray current_country;
+ search_attr.type=attr_country_all;
+ //dbg(0,"country %s\n", country_name.u.str);
+ search_attr.u.str=g_strdup("");//country_name.u.str;
+ search_list_search(search_list, &search_attr, 1);
+ while((res=search_list_get_result(search_list)))
+ {
+ dbg(0,"Get result: %s\n", res->country->iso2);
+
+ if (strlen(res->country->iso2)==2)
+ {
+ jstring j_iso2 = (*env)->NewStringUTF(env, res->country->iso2);
+ jstring j_name = (*env)->NewStringUTF(env, gettext(res->country->name));
+
+ current_country = (jobjectArray)(*env)->NewObjectArray(env, 2, (*env)->FindClass(env, "java/lang/String"), NULL);
+
+ (*env)->SetObjectArrayElement(env, current_country, 0, j_iso2);
+ (*env)->SetObjectArrayElement(env, current_country, 1, j_name);
+
+ (*env)->DeleteLocalRef(env, j_iso2);
+ (*env)->DeleteLocalRef(env, j_name);
+
+ countries = g_list_prepend(countries, current_country);
+ country_count++;
+ }
+ }
+
+ search_list_destroy(search_list);
+ all_countries = (jobjectArray)(*env)->NewObjectArray(env, country_count, (*env)->GetObjectClass(env, current_country), NULL);
+
+ while(countries)
+ {
+ (*env)->SetObjectArrayElement(env, all_countries, --country_count, countries->data);
+ countries = g_list_delete_link( countries, countries);
+ }
+ return all_countries;
+}
break;\r
case 5 :\r
// toggle the normal POI layers (to avoid double POIs)\r
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CBL_CALL_CMD.ordinal());\r
+ Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());\r
Bundle b = new Bundle();\r
b.putString("cmd", "toggle_layer(\"POI Symbols\");");\r
msg.setData(b);\r
msg.sendToTarget();\r
\r
// toggle full POI icons on/off\r
- msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CBL_CALL_CMD.ordinal());\r
+ msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());\r
b = new Bundle();\r
b.putString("cmd", "toggle_layer(\"Android-POI-Icons-full\");");\r
msg.setData(b);\r
{\r
String addr = data.getStringExtra("address_string");\r
Boolean partial_match = data.getStringExtra("partial_match").equals("1");\r
+ String country = data.getStringExtra("country");\r
\r
NavitDialogs.Navit_last_address_partial_match = partial_match;\r
NavitDialogs.Navit_last_address_search_string = addr;\r
+ NavitDialogs.Navit_last_country = country;\r
\r
// clear results\r
Navit.NavitAddressResultList_foundItems.clear();\r
package org.navitproject.navit;\r
\r
\r
+import java.lang.reflect.Field;\r
+import java.util.Locale;\r
+\r
+import android.R.color;\r
import android.app.Activity;\r
+import android.app.AlertDialog;\r
+import android.content.DialogInterface;\r
import android.content.Intent;\r
+import android.content.SharedPreferences;\r
import android.os.Bundle;\r
+import android.os.Message;\r
+import android.util.Log;\r
import android.util.TypedValue;\r
import android.view.Gravity;\r
import android.view.View;\r
import android.view.WindowManager;\r
import android.view.View.OnClickListener;\r
+import android.widget.ArrayAdapter;\r
import android.widget.Button;\r
import android.widget.CheckBox;\r
import android.widget.EditText;\r
+import android.widget.ImageButton;\r
import android.widget.LinearLayout;\r
import android.widget.RelativeLayout;\r
+import android.widget.Spinner;\r
import android.widget.TextView;\r
import android.widget.RelativeLayout.LayoutParams;\r
\r
\r
public class NavitAddressSearchActivity extends Activity\r
{\r
- private EditText address_string;\r
- private CheckBox pm_checkbox;\r
+ private EditText address_string;\r
+ private CheckBox pm_checkbox;\r
+ private String mCountry;\r
+ private ImageButton mCountryButton;\r
\r
public RelativeLayout NavitAddressSearchActivity_layout;\r
\r
+ private int getDrawableID(String resourceName)\r
+ {\r
+ int drawableId = 0;\r
+ try {\r
+ Class<?> res = R.drawable.class;\r
+ Field field = res.getField(resourceName);\r
+ drawableId = field.getInt(null);\r
+ }\r
+ catch (Exception e) {\r
+ Log.e("NavitAddressSearch", "Failure to get drawable id.", e);\r
+ }\r
+ \r
+ \r
+ return drawableId;\r
+ }\r
+ \r
+ \r
@Override\r
protected void onCreate(Bundle savedInstanceState)\r
{\r
panel.setOrientation(LinearLayout.VERTICAL);\r
\r
// address: label and text field\r
+ SharedPreferences settings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);\r
+ mCountry = settings.getString("DefaultCountry", null);\r
+ \r
+ if (mCountry == null)\r
+ {\r
+ Locale defaultLocale = Locale.getDefault();\r
+ mCountry = defaultLocale.getCountry().toLowerCase(defaultLocale);\r
+ SharedPreferences.Editor edit_settings = settings.edit();\r
+ edit_settings.putString("DefaultCountry", mCountry);\r
+ edit_settings.commit();\r
+ }\r
+ \r
+ mCountryButton = new ImageButton(this);\r
+ \r
+ mCountryButton.setImageResource(getDrawableID("country_" + mCountry + "_32_32"));\r
+ \r
+ mCountryButton.setOnClickListener(new OnClickListener()\r
+ {\r
+ public void onClick(View v)\r
+ {\r
+ requestCountryDialog();\r
+ }\r
+ });\r
+\r
+ // address: label and text field\r
TextView addr_view = new TextView(this);\r
addr_view.setText(Navit.get_text("Enter Destination")); //TRANS\r
addr_view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);\r
pm_checkbox = new CheckBox(this);\r
pm_checkbox.setText(Navit.get_text("partial match")); //TRANS\r
pm_checkbox.setChecked(false);\r
- pm_checkbox.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,\r
- LayoutParams.WRAP_CONTENT));\r
+// pm_checkbox.setLayoutParams(new LayoutParams(LayoutParams,\r
+// LayoutParams.WRAP_CONTENT));\r
pm_checkbox.setGravity(Gravity.CENTER);\r
\r
+ \r
\r
// search button\r
final Button btnSearch = new Button(this);\r
}\r
});\r
\r
-\r
- // title\r
- try\r
- {\r
- String s = getIntent().getExtras().getString("title");\r
- if (s.length() > 0)\r
- {\r
- this.setTitle(s);\r
- }\r
- }\r
- catch (Exception e)\r
- {\r
- }\r
+ Bundle extras = getIntent().getExtras();\r
\r
- // partial match\r
- try\r
+ if ( extras != null )\r
{\r
- String s = getIntent().getExtras().getString("partial_match");\r
- if (s.length() > 0)\r
- {\r
- if (s.equals("1"))\r
- {\r
- pm_checkbox.setChecked(true);\r
- }\r
- else\r
- {\r
- pm_checkbox.setChecked(false);\r
- }\r
- }\r
- }\r
- catch (Exception e)\r
- {\r
- }\r
+ String title = extras.getString("title");\r
+ String partial = extras.getString("partial_match");\r
+ String address = extras.getString("address_string");\r
+ \r
+ if ( title != null && title.length() > 0)\r
+ this.setTitle(title);\r
+ \r
+ if (partial != null && partial.length() > 0)\r
+ pm_checkbox.setChecked(partial.equals("1"));\r
\r
- // address string\r
- try\r
- {\r
address_string = new EditText(this);\r
- address_string.setText(getIntent().getExtras().getString("address_string"));\r
- }\r
- catch (Exception e)\r
- {\r
+ if (address != null)\r
+ address_string.setText(address);\r
+ \r
}\r
\r
+ LinearLayout searchSettingsLayout = new LinearLayout(this);\r
+ searchSettingsLayout.setOrientation(LinearLayout.HORIZONTAL);\r
\r
- // actually adding the views (that have layout set on them) to the panel\r
+ searchSettingsLayout.addView(mCountryButton);\r
+ searchSettingsLayout.addView(pm_checkbox);\r
panel.addView(addr_view);\r
panel.addView(address_string);\r
- panel.addView(pm_checkbox);\r
+ panel.addView(searchSettingsLayout);\r
panel.addView(btnSearch);\r
\r
setContentView(panel);\r
\r
}\r
\r
+ private void requestCountryDialog()\r
+ {\r
+ //Message msg = Message.obtain(Navit.N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_COUNTRY_CHOOSER.ordinal());\r
+ //msg.sendToTarget();\r
+ final String [][]all_countries = NavitGraphics.GetAllCountries();\r
+\r
+ AlertDialog.Builder mapModeChooser = new AlertDialog.Builder(this);\r
+ // ToDo also show icons and country code\r
+ String []country_name = new String[all_countries.length];\r
+ \r
+ for (int country_index = 0; country_index < all_countries.length; country_index++)\r
+ {\r
+ country_name[country_index] = all_countries[country_index][1];\r
+ }\r
+ \r
+ mapModeChooser.setItems(country_name, new DialogInterface.OnClickListener() {\r
+ public void onClick(DialogInterface dialog, int item) {\r
+ SharedPreferences settings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);\r
+ mCountry = all_countries[item][0];\r
+ SharedPreferences.Editor edit_settings = settings.edit();\r
+ edit_settings.putString("DefaultCountry", mCountry);\r
+ edit_settings.commit();\r
+ \r
+ mCountryButton.setImageResource(getDrawableID("country_" + mCountry + "_32_32"));\r
+ }\r
+ \r
+ });\r
+\r
+ \r
+ mapModeChooser.show();\r
+\r
+\r
+ }\r
+\r
private void executeDone()\r
{\r
Intent resultIntent = new Intent();\r
- resultIntent.putExtra("address_string", NavitAddressSearchActivity.this.address_string\r
- .getText().toString());\r
- if (NavitAddressSearchActivity.this.pm_checkbox.isChecked())\r
+ resultIntent.putExtra("address_string", address_string.getText().toString());\r
+ resultIntent.putExtra("country", mCountry);\r
+ if (pm_checkbox.isChecked())\r
{\r
resultIntent.putExtra("partial_match", "1");\r
}\r
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
public static Boolean NavitAddressSearchSpinnerActive = false;
public static String Navit_last_address_search_string = "";
public static Boolean Navit_last_address_partial_match = false;
+ public static String Navit_last_country = "";
// Dialogs
public static final int DIALOG_MAPDOWNLOAD = 1;
{
Message msg = mHandler.obtainMessage();
Bundle b = new Bundle();
- msg.what = 10;
+ msg.what = MSG_PROGRESS_BAR_SEARCH;
b.putInt("dialog_num", this.dialog_num);
b.putInt("max", Navit.ADDRESS_RESULTS_DIALOG_MAX);
b.putInt("cur", this.spinner_current_value % (Navit.ADDRESS_RESULTS_DIALOG_MAX + 1));
// initialize the dialog with sane values
Message msg = mHandler.obtainMessage();
Bundle b = new Bundle();
- msg.what = 10;
+ msg.what = MSG_PROGRESS_BAR_SEARCH;
b.putInt("dialog_num", this.my_dialog_num);
b.putInt("max", Navit.ADDRESS_RESULTS_DIALOG_MAX);
b.putInt("cur", 0);
// start the search, this could take a long time!!
Log.e("Navit", "SearchResultsThread run1");
Navit_last_address_search_string = filter_bad_chars(Navit_last_address_search_string);
- Navit.N_NavitGraphics.CallbackSearchResultList(partial_match_i, Navit_last_address_search_string);
+ Navit.N_NavitGraphics.CallbackSearchResultList(partial_match_i, Navit_last_country, Navit_last_address_search_string);
Log.e("Navit", "SearchResultsThread run2");
-
NavitAddressSearchSpinnerActive = false;
if (Navit.NavitAddressResultList_foundItems.size() > 0)
menu.setHeaderTitle("Position...");
menu.add(1, 1, NONE, Navit.get_text("drive here")).setOnMenuItemClickListener(this);
- menu.add(1, 2, NONE, Navit.get_text("Add to contacts")).setOnMenuItemClickListener(this);
+// menu.add(1, 2, NONE, Navit.get_text("Add to contacts")).setOnMenuItemClickListener(this);
}
@Override
}
static public enum msg_type {
- CLB_ZOOM_IN, CLB_ZOOM_OUT, CLB_REDRAW, CLB_MOVE, CLB_BUTTON_UP, CLB_BUTTON_DOWN, CLB_SET_DESTINATION, CLB_SET_DISPLAY_DESTINATION, CBL_CALL_CMD
+ CLB_ZOOM_IN, CLB_ZOOM_OUT, CLB_REDRAW, CLB_MOVE, CLB_BUTTON_UP, CLB_BUTTON_DOWN, CLB_SET_DESTINATION
+ , CLB_SET_DISPLAY_DESTINATION, CLB_CALL_CMD, CLB_COUNTRY_CHOOSER
};
static public msg_type[] msg_values = msg_type.values();
int y = msg.arg2;
CallbackMessageChannel(4, "" + x + "#" + y);
break;
- case CBL_CALL_CMD:
+ case CLB_CALL_CMD:
String cmd = msg.getData().getString("cmd");
CallbackMessageChannel(5, cmd);
break;
case CLB_BUTTON_DOWN:
ButtonCallback(ButtonCallbackID, 1, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); // down
break;
+ case CLB_COUNTRY_CHOOSER:
+
+ break;
}
}
};
public native int CallbackMessageChannel(int i, String s);
public native void ButtonCallback(int id, int pressed, int button, int x, int y);
public native void MotionCallback(int id, int x, int y);
+ public native String GetDefaultCountry(int id, String s);
+ public static native String[][] GetAllCountries();
private Canvas draw_canvas;
private Bitmap draw_bitmap;
private int SizeChangedCallbackID, ButtonCallbackID, MotionCallbackID, KeypressCallbackID;
, Navit.NavitAddressResultList_foundItems.size() % (Navit.ADDRESS_RESULTS_DIALOG_MAX + 1));
}
- public native void CallbackSearchResultList(int partial_match, String s);
+ public native void CallbackSearchResultList(int partial_match, String country, String s);
/**
static int
country_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{
- struct country_search *this_=priv_data;
+ struct country_search *this_=priv_data;
struct country *country=this_->country;
- attr->type=attr_type;
- switch (attr_type) {
- case attr_any:
- while (this_->attr_next != attr_none) {
- if (country_attr_get(this_, this_->attr_next, attr))
- return 1;
- }
- return 0;
- case attr_label:
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while (this_->attr_next != attr_none) {
+ if (country_attr_get(this_, this_->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_label:
attr->u.str=gettext(country->name);
this_->attr_next=attr_country_id;
return 1;
attr->u.num=country->id;
this_->attr_next=country->car ? attr_country_car : attr_country_iso2;
return 1;
- case attr_country_car:
+ case attr_country_car:
attr->u.str=country->car;
this_->attr_next=attr_country_iso2;
return attr->u.str ? 1 : 0;
- case attr_country_iso2:
+ case attr_country_iso2:
attr->u.str=country->iso2;
this_->attr_next=attr_country_iso3;
return 1;
- case attr_country_iso3:
+ case attr_country_iso3:
attr->u.str=country->iso3;
this_->attr_next=attr_country_name;
return 1;
- case attr_country_name:
+ case attr_country_name:
attr->u.str=gettext(country->name);
this_->attr_next=attr_none;
return 1;
- default:
- return 0;
- }
+ default:
+ return 0;
+ }
}
ret->count=0;
ret->item.type=type_country_label;
- ret->item.id_hi=0;
+ ret->item.id_hi=0;
ret->item.map=NULL;
ret->item.meth=&country_meth;
ret->item.priv_data=ret;
else
ret=(g_strcasecmp(this_->search.u.str, name) == 0);
return ret;
-
+
}
ret=g_new0(struct search_list, 1);
ret->ms=ms;
-
+
return ret;
}
common->postal=map_convert_string(item->map, attr.u.str);
else
common->postal=NULL;
- if (item_attr_get(item, attr_postal_mask, &attr))
+ if (item_attr_get(item, attr_postal_mask, &attr))
common->postal_mask=map_convert_string(item->map, attr.u.str);
- else
+ else
common->postal_mask=NULL;
}
#if HAVE_API_ANDROID
ret->iso2=g_malloc(strlen(attr.u.str)+1);
strtolower(ret->iso2, attr.u.str);
-#else
+#else
ret->iso2=g_strdup(attr.u.str);
-#endif
+#endif
ret->flag=g_strdup_printf("country_%s", ret->iso2);
}
if (item_attr_get(item, attr_country_iso3, &attr))
struct search_list_town *ret=g_new0(struct search_list_town, 1);
struct attr attr;
struct coord c;
-
+
ret->itemt=*item;
ret->common.item=ret->common.unique=*item;
if (item_attr_get(item, attr_town_streets_item, &attr)) {
struct search_list_street *ret=g_new0(struct search_list_street, 1);
struct attr attr;
struct coord c;
-
+
ret->common.item=ret->common.unique=*item;
if (item_attr_get(item, attr_street_name, &attr))
ret->name=map_convert_string(item->map, attr.u.str);
dbg(1,"interpolate %s-%s %s\n",inter->first,inter->last,inter->curr);
if (!inter->first || !inter->last)
return NULL;
- if (!inter->curr)
+ if (!inter->curr)
inter->curr=g_strdup(inter->first);
else {
if (strcmp(inter->curr, inter->last)) {
hn_length=2;
hn_pos=1;
}
- if (count == max)
+ if (count == max)
dbg(0,"coordinate overflow\n");
for (i = 0 ; i < count-1 ; i++) {
distances[i]=navit_sqrt(transform_distance_sq(&c[i],&c[i+1]));
struct search_list_house_number *ret=g_new0(struct search_list_house_number, 1);
struct attr attr;
char *hn;
-
+
ret->common.item=ret->common.unique=*item;
//if (item_attr_get(item, attr_street_name, &attr))
// dbg(0,"xx1 %s\n",attr.u.str);
if (mask[i] != '.' && mask[i] != new[i])
break;
i++;
-
+
}
if (mask[i]) {
ret=g_strdup(mask);
- while (mask[i])
+ while (mask[i])
ret[i++]='.';
}
- dbg(1,"merged %s with %s as %s\n", mask, new, ret);
+ dbg(1,"merged %s with %s as %s\n", mask, new, ret);
return ret;
}
if (! le->search)
{
//dbg(0,"partial=%d level=%d\n", le->partial, level);
- if (! level)
+ if (! level)
le->parent=NULL;
else
{
dbg(0,"streetname: %s\n",attr2.u.str);
has_street_name=1;
}
-
+
p=search_list_house_number_new(this_->item, &this_->inter, le->attr->u.str, le->partial);
if (!p)
{
} else {
dbg(0,"interpolation!\n");
}
-
+
if(le->parent && has_street_name) {
struct search_list_street *street=this_->levels[level-1].last->data;
char *s1,*s2;
}
GList *
-search_by_address(struct mapset *ms, const char *addr, int partial, struct jni_object *jni)
+search_by_address(struct search_list *sl, const char *addr, int partial, struct jni_object *jni)
{
char *str=search_fix_spaces(addr);
GList *tmp,*phrases=search_split_phrases(str);
GList *ret = NULL;
- struct search_list *sl;
- struct attr attr;
- struct attr *country = country_default();
dbg(0,"enter %s\n",addr);
- attr.type=attr_country_all;
- tmp=phrases;
- sl=search_list_new(ms);
- while (tmp)
- {
- attr.u.str=tmp->data;
- search_list_search(sl, &attr, partial);
- ret=search_address_town(ret, sl, phrases, tmp, partial, jni);
- tmp=g_list_next(tmp);
- }
- if (country)
- search_list_search(sl, country, partial);
ret=search_address_town(ret, sl, phrases, NULL, partial, jni);
-
+
g_free(str);
dbg(0,"leave %p\n",ret);
return ret;
struct search_list_result *search_list_get_result(struct search_list *this_);
void search_list_destroy(struct search_list *this_);
void search_init(void);
-GList * search_by_address(struct mapset *ms, const char *addr, int partial, struct jni_object *jni);
+GList * search_by_address(struct search_list *this_, const char *addr, int partial, struct jni_object *jni);
/* end of prototypes */
#ifdef __cplusplus
}