List of usage examples for com.google.gwt.maps.client.layers KmlLayer newInstance
public final static KmlLayer newInstance(String url)
From source file:com.google.gwt.maps.testing.client.maps.KmlMapWidget.java
License:Apache License
private void drawKml2() { // String url = // "http://api.flickr.com/services/feeds/geo/?g=322338@N20&lang=en-us&format=feed-georss"; // TODO this won't work in devmode but works in production, can't point to // localhost. String base = GWT.getHostPageBaseURL(); String url = base + "/kmlgenerator?id=120234&pass=1345&msg=hi"; KmlLayer o = KmlLayer.newInstance(url); o.setMap(mapWidget);// www . ja v a2s . com o.addClickHandler(new KmlMouseMapHandler() { public void onEvent(KmlMouseMapEvent event) { KmlFeatureData featureData = event.getFeatureData(); @SuppressWarnings("unused") LatLng latlng = event.getLatLng(); @SuppressWarnings("unused") Size size = event.getPixelOffset(); GWT.log("clicked featureData=" + featureData.getToString()); } }); // TODO I need a better link with more meta data @SuppressWarnings("unused") KmlLayerMetadata metaData = o.getMetadata(); // KmlAuthor author = metaData.getAuthor(); // String authName = author.getName(); // String authEmail = author.getEmail(); // String authUri = author.getUri(); // // String desc = metaData.getDescription(); // String name = metaData.getName(); // String snippet = metaData.getSnippet(); // GWT.log("work? authName=" + authName); }
From source file:org.rebioma.client.MapView.java
License:Apache License
public void loadKmlLayer(List<ShapeFileInfo> shapeFileInfos, boolean search) { //chargement des occurrences /* ------------------------ chargement des layers ------------------------------- */ //en mode local on doit copier le fichier kml gnr par notre servlet dans http://41.74.23.114/kmlfiles/ pour voir le layer sur le map // Scheduler.get().scheduleDeferred(new ScheduledCommand() { // @Override // public void execute() { // KmlLayer layer = KmlLayer.newInstance("http://41.74.23.114/kmlfiles/lim_region_aout0681891013141617.kmz"); // layer.setMap(map); // }// ww w. ja va 2 s. c o m // }); Map<String, List<Integer>> tableGidsMap = this.getTableGidsMap(shapeFileInfos); //en mode production on peut utiliser directement le servlet puisque l'url est public final Set<String> urls = KmlUtil.getKmlFileUrl(tableGidsMap); //suppression des layers existants for (KmlLayer layer : kmlLayers) { if (layer != null) { layer.setMap(null); } } //Chargement des layers kml Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { for (String url : urls) { KmlLayer layer = KmlLayer.newInstance(url // "http://192.168.123.252/kmlfiles/lim_region_aout0681891013141617.kmz" ); layer.setMap(map); kmlLayers.add(layer); } } }); if (!search) return; Mask.mask((XElement) map.getElement(), "Loading"); mapGisService.findOccurrenceIdsByShapeFiles(tableGidsMap, new AsyncCallback<List<Integer>>() { @Override public void onFailure(Throwable caught) { Mask.unmask((XElement) map.getElement()); Window.alert("Failure =>" + caught.getMessage()); } @Override public void onSuccess(List<Integer> result) { reloadPageWithOccurrenceIds(result); Mask.unmask((XElement) map.getElement()); } }); }