RHO_GLOBAL void mapview_create(rho_param *p) { mapview_close(); ourIsOldGoogleEngineUsed = false; // detect engine char* engine = "Google"; if (p && p->type == RHO_PARAM_HASH) { rho_param *eng_p = NULL; for (int i = 0, lim = p->v.hash->size; i < lim; ++i) { char *name = p->v.hash->name[i]; rho_param *value = p->v.hash->value[i]; if (strcasecmp(name, "provider") == 0) eng_p = value; } if (eng_p && eng_p->type == RHO_PARAM_STRING) { engine = eng_p->v.string; } } if (strcasecmp(engine, "Google") == 0) { ourIsOldGoogleEngineUsed = true; } if (ourIsOldGoogleEngineUsed) { google_mapview_create(p); } else { s_mapdevice = new rhomap::AndroidMapDevice(p); } }
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_mapview_MapView_click (JNIEnv *env, jobject, jlong nativeDevice, jint x, jint y) { RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_click: start"); rhomap::IMapView *mv = mapview(env, nativeDevice); if (mv) { if (mv->handleClick(x, y) ) { // close mapview_close(); } } RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_click: finish"); }
RHO_GLOBAL void mapview_create(rho_param *p) { mapview_close(); ourIsOldGoogleEngineUsed = false; // detect engine const char* engine = "Google"; if (p && p->type == RHO_PARAM_HASH) { rho_param *eng_p = NULL; for (int i = 0, lim = p->v.hash->size; i < lim; ++i) { char *name = p->v.hash->name[i]; rho_param *value = p->v.hash->value[i]; if (strcasecmp(name, "provider") == 0) eng_p = value; } if (eng_p && eng_p->type == RHO_PARAM_STRING) { if ((eng_p->v.string != NULL) && (eng_p->v.string[0] != 0)) { engine = eng_p->v.string; } } } if (strcasecmp(engine, "Google") == 0) { ourIsOldGoogleEngineUsed = true; } if (ourIsOldGoogleEngineUsed) { google_mapview_create(p); } else { if (rho_map_check_param(p)) { s_mapdevice = new rhomap::AndroidMapDevice(p); } else { RAWLOG_ERROR("MapView.create: wrong input parameters ! (parameters not validated !)"); } } }
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_mapview_MapView_destroy (JNIEnv *, jobject, jlong nativeDevice) { mapview_close(); }