/*
* 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 .
*/
package org.oscim.app;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import org.oscim.android.canvas.AndroidGraphics;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint;
import org.oscim.layers.marker.MarkerInterface;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
import org.oscim.map.Map;
import org.osmdroid.location.*;
import org.osmdroid.overlays.DefaultInfoWindow;
import org.osmdroid.overlays.ExtendedMarkerItem;
import org.osmdroid.overlays.ItemizedOverlayWithBubble;
import java.util.ArrayList;
import java.util.List;
public class POISearch {
private final ArrayList mPOIs;
ItemizedOverlayWithBubble poiMarkers;
MarkerSymbol[] mMarkers;
private static final int MDEFAULT = 0;
private static final int MFLICKR = 1;
private static final int MPICASA = 2;
private static final int MWIKI16 = 3;
private static final int MWIKI32 = 4;
POISearch() {
mPOIs = new ArrayList();
//POI markers:
final ArrayList poiItems = new ArrayList<>();
poiMarkers = new ItemizedOverlayWithBubble(App.map,
App.activity,
null,
poiItems,
new POIInfoWindow(App.map));
App.map.layers().add(poiMarkers);
mMarkers = new MarkerSymbol[5];
mMarkers[MDEFAULT] = AndroidGraphics
.makeMarker(App.res.getDrawable(R.drawable.pin), HotspotPlace.BOTTOM_CENTER);
mMarkers[MFLICKR] = AndroidGraphics
.makeMarker(App.res.getDrawable(R.drawable.marker_poi_flickr), null);
mMarkers[MPICASA] = AndroidGraphics
.makeMarker(App.res.getDrawable(R.drawable.marker_poi_picasa_24), null);
mMarkers[MWIKI16] = AndroidGraphics
.makeMarker(App.res.getDrawable(R.drawable.marker_poi_wikipedia_16), null);
mMarkers[MWIKI32] = AndroidGraphics
.makeMarker(App.res.getDrawable(R.drawable.marker_poi_wikipedia_32), null);
}
public List getPOIs() {
return mPOIs;
}
static final String TAG_WIKIPEDIA = "wikipedia";
static final String TAG_FLICKR = "flickr";
static final String TAG_PICASA = "picasa";
static final String TAG_FOURSQUARE = "foursquare";
//private static final String TAG_NOMINATIM = "nominatim";
class POITask extends AsyncTask