Comments (11)
maybe I misspelled something. hmmmm. I'll check. Thanks for the report.
from gwt-maps-v3-api.
Maybe I should add a setTypes(List<String>) :)
from gwt-maps-v3-api.
Wow, your right about the strings... I see there are hundreds of types. So I'm overloading it.
public final void setTypes(JsArrayString types) {...}
from gwt-maps-v3-api.
I haved added an overloaded method for this. Thanks for the issue report. I also added example map, but haven't deployed it to the live demos yet. If you like to get the latest method sync to the source. Will get an updated jar available shortly.
private void searchRequest(LatLng clickLocation) {
String[] searchTypes = new String[1];
searchTypes[0] = "establishment";
JsArrayString searchJstypes = ArrayHelper.toJsArrayString(searchTypes);
PlaceSearchRequest request = PlaceSearchRequest.newInstance();
request.setLocation(clickLocation);
request.setRaidus(500);
// TODO add more AutocompleteTypes...
//request.setTypes(AutocompleteType.ESTABLISHMENT);
request.setTypes(searchJstypes);
PlacesService placeService = PlacesService.newInstance(mapWidget.getElement(), mapWidget);
placeService.search(request, new PlaceSearchHandler() {
@Override
public void onCallback(JsArray<PlaceResult> results, PlacesServiceStatus status) {
// TODO add some popup to display the results
Window.alert("I found this many places " + results.length());
}
});
}
from gwt-maps-v3-api.
in mine jsni projects I use a method for fransforming a java array to a js array:
public class JsUtil {
public static JsArrayString toJsArrayString(String[] a) {
if(a==null)
return null;
JsArrayString jsa = JsArrayNumber.createArray().<JsArrayString>cast();
for (int i = 0; i < a.length; i++) {
jsa.push(a[i]);
}
return jsa;
}
}
then you can
public final native void setTypes(String... types)/*-{
@org.sgx.madrenecesidad.client.util.JsUtil::toJsArrayString([Ljava/lang/String;)(types);
}-*/;
and that becomes much more java friendly:
req.setTypes("store", "bus_station");
or
req.setTypes(PlacesService.TYPE_STORE, PlacesService.TYPE_BUSSTATION});
If I were you I would remove class AutocompleteTypes. Regards
from gwt-maps-v3-api.
thanks for adding the method!
PlacesService placeService = PlacesService.newInstance(mapWidget.getElement(), mapWidget);
this is wrong (my code). the map will be erased when clicked. I'm not understanding how to build a PlacesServices with your Java API. In the documentation (https://developers.google.com/maps/documentation/javascript/places#place_searches) says:
service = new google.maps.places.PlacesService(map);
but your constructor requires 2 arguments, and in fact you are calling :
private static final native PlacesService createJso(Element attrContainer, MapImpl map) /*-{
return new $wnd.google.maps.places.PlacesService(attrContainer, map);
}-*/;
What is this attrContainer param ?
Regards, I will try to get the sources and make a pull request to you with my changes.
from gwt-maps-v3-api.
Good point, that crossed my mind to do it that way.
from gwt-maps-v3-api.
That second issue... Would you mind filing that under a new issue? :)
from gwt-maps-v3-api.
Good idea. I'm overloading the types. :)
public final void setTypes(List<String> types) {
setTypes((String[]) types.toArray());
}
public final void setTypes(String... types) {
setTypes(ArrayHelper.toJsArrayString(types));
}
public final void setTypes(JsArrayString types) {
setTypesImpl(types);
}
from gwt-maps-v3-api.
I pulled then merged the code with master. :)
from gwt-maps-v3-api.
thanks! and done a second issue at #43
from gwt-maps-v3-api.
Related Issues (20)
- problems using set and get key-value pair of MVCObject HOT 1
- Error when hitting enter in Textbox in form which uses Autocomplete HOT 1
- Navigation controls broken in IE
- MapTypeStyler does not support color and weight options
- AutoComplete component restrictions
- place result with pagination search retuns only 60 results
- Invisible maps on Chrome HOT 7
- DirectionSevice
- Google Fusion Table Styling in GWT
- Google maps API access from China HOT 7
- Remove the sensor parameter HOT 8
- PlaceChangeMapEvent: All fields are undefined
- ```yaml HOT 1
- Loading Map without loadMapApi() HOT 5
- Google Map works on local host but doesn't work on web server HOT 2
- No API Keys HOT 3
- Error in AutoComplete
- Only suggestions , no autocomplete
- sdf.spatial.plot colors keep changing
- LatLng no more supported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwt-maps-v3-api.