Esempio n. 1
0
 /**
  * @param layer
  * @param attributeName
  * @param id
  * @param attributeValue
  * @param marker
  * @param f
  */
 private void setMarkerProperties(
     String layer,
     String attributeName,
     String id,
     String attributeValue,
     DescribedMarker marker,
     Feature f) {
   GeoPoint p = SpatialDbUtils.getGeopointFromLayer(layer, attributeName, attributeValue);
   // get Only the first
   if (p != null) {
     // TODO ask if you want to change
     // if yes move and center map
     marker.setGeoPoint(p);
     marker.setFeatureId(id);
     marker.setFeature(f);
     mapView.redraw();
     canConfirm = true;
   } else {
     Toast.makeText(this, R.string.error_getting_data_from_database, Toast.LENGTH_LONG).show();
   }
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    // center on the marker, preferably the updated
    if (item.getItemId() == R.id.center) {

      GeoPoint geoPoint = null;

      if (mUpdatedMarker != null) {
        geoPoint = mUpdatedMarker.getGeoPoint();
      } else if (mOriginMarker != null) {
        geoPoint = mOriginMarker.getGeoPoint();
      }

      if (geoPoint != null) {
        // center map on markers position
        mapView.getMapViewPosition().setCenter(geoPoint);
      }
    }

    return super.onOptionsItemSelected(item);
  }