Re: multiple markers from database
Works like a charm :) Thank you Regards Peter Eric Ayers wrote: > On Mon, Jul 6, 2009 at 8:44 PM, Piotr > Kirklewski wrote: > >> Hi there >> It's about maps and markers. >> So I have a table with some location (restaurants) and their coordinates. >> I'm adding marker to the map like this: >> >> MarkerOptions mo = MarkerOptions.newInstance(); >> mo.setClickable(true); >> mo.setTitle(result[j][1] + ", " + >> result[j][0]); >> Float lt = new >> Float(result[j][2].toString()); >> Float ln = new >> Float(result[j][3].toString()); >> > > Make these 'double' not 'Float'. The former are primitive types, the > latter are objects. > > >> Marker newmarker = new >> Marker(LatLng.newInstance(lt, ln), mo); >> mapWidget.addOverlay(newmarker); >> newmarker.addMarkerClickHandler(new >> MarkerClickHandler() { >> >> >> So I have a click handler on all of those guys but when clicked I need >> somehow distinguish between them. >> I think that getting the coordinates of clicked marker would be a good >> Idea as it's unique so I can query database an produce report for that >> particular location. >> But I have no idea how to start. >> >> When I try this: >> newmarker.getLatLng(); >> >> I get following error: >> Cannot refer to a non-final variable newmarker inside an inner class >> defined in a different method >> >> Anyone knows how to do that ? >> > > Add 'final' in front of the parameter named 'newmarker' in your > method. I hope that's enough to get you started. > > -Eric. > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: multiple markers from database
On Mon, Jul 6, 2009 at 8:44 PM, Piotr Kirklewski wrote: > > Hi there > It's about maps and markers. > So I have a table with some location (restaurants) and their coordinates. > I'm adding marker to the map like this: > > MarkerOptions mo = MarkerOptions.newInstance(); > mo.setClickable(true); > mo.setTitle(result[j][1] + ", " + > result[j][0]); > Float lt = new > Float(result[j][2].toString()); > Float ln = new > Float(result[j][3].toString()); Make these 'double' not 'Float'. The former are primitive types, the latter are objects. > Marker newmarker = new > Marker(LatLng.newInstance(lt, ln), mo); > mapWidget.addOverlay(newmarker); > newmarker.addMarkerClickHandler(new > MarkerClickHandler() { > > > So I have a click handler on all of those guys but when clicked I need > somehow distinguish between them. > I think that getting the coordinates of clicked marker would be a good > Idea as it's unique so I can query database an produce report for that > particular location. > But I have no idea how to start. > > When I try this: > newmarker.getLatLng(); > > I get following error: > Cannot refer to a non-final variable newmarker inside an inner class > defined in a different method > > Anyone knows how to do that ? Add 'final' in front of the parameter named 'newmarker' in your method. I hope that's enough to get you started. -Eric. -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
multiple markers from database
Hi there It's about maps and markers. So I have a table with some location (restaurants) and their coordinates. I'm adding marker to the map like this: MarkerOptions mo = MarkerOptions.newInstance(); mo.setClickable(true); mo.setTitle(result[j][1] + ", " + result[j][0]); Float lt = new Float(result[j][2].toString()); Float ln = new Float(result[j][3].toString()); Marker newmarker = new Marker(LatLng.newInstance(lt, ln), mo); mapWidget.addOverlay(newmarker); newmarker.addMarkerClickHandler(new MarkerClickHandler() { So I have a click handler on all of those guys but when clicked I need somehow distinguish between them. I think that getting the coordinates of clicked marker would be a good Idea as it's unique so I can query database an produce report for that particular location. But I have no idea how to start. When I try this: newmarker.getLatLng(); I get following error: Cannot refer to a non-final variable newmarker inside an inner class defined in a different method Anyone knows how to do that ? Regards Peter > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---