moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

Marker Area #116

Closed gorbin closed 10 years ago

gorbin commented 10 years ago

Is there any way to make callback to some area? I've got map of park where there are some areas in which I need to make popup as in marker click but for area, make marker as all area is not an option, by the way on this area threre other markers.

Is there any way to do it?

sorry for my English...

cjbraden commented 10 years ago

Hi gorbin,

It sounds like what you are looking for is in this API called HotSpot...

https://github.com/moagrius/TileView/wiki/Hot-Spots

Check it out here in the wiki and I've included a code snippet because I just happened to be writing it as I saw your question. I have an overview map with two hot areas that opens other maps and I use tags to pass the map ids.

    HotSpot map1Hotspot = new HotSpot(0, 52, 640, 460);
    map1Hotspot.setTag(0);
    HotSpot map2Hotspot = new HotSpot(0, 510, 640, 908);
    map2Hotspot.setTag(1);

    tileView.addHotSpot(map1Hotspot);
    tileView.addHotSpot(map2Hotspot);

    tileView.addHotSpotEventListener( new HotSpotEventListener() {

        @Override
        public void onHotSpotTap(HotSpot hotspot, int arg1, int arg2) {
            // Toast.makeText(getBaseContext(), "Hotspot clicked " + hotspot.getTag().toString(), Toast.LENGTH_SHORT).show();
            Object itemId = hotspot.getTag();
            if (itemId.equals(0)) {
                model.setSelectedMap(model.getMaps().get(0));
                Intent mapIntent = new Intent(HomeScreen.this, MapActivity.class);
                HomeScreen.this.startActivity(mapIntent);
                return;
            } else if (itemId.equals(1)) {
                model.setSelectedMap(model.getMaps().get(1));
                Intent mapIntent = new Intent(HomeScreen.this, MapActivity.class);
                HomeScreen.this.startActivity(mapIntent);
                return;
            } else {
                return;
            }

        }
    });
moagrius commented 10 years ago

@gorbin i agree with the information @cjbraden posted - did this answer your question? you can close the issue if it's resolved, or post back if you need more help.

gorbin commented 10 years ago

Sorry, yes, I should close issue, I didn't check it, but it is what i need