org.gwtopenmaps.openlayers.client.LonLat Java Examples
The following examples show how to use
org.gwtopenmaps.openlayers.client.LonLat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CurrentExtentTool.java From geowe-core with GNU General Public License v3.0 | 6 votes |
@Override protected void onRelease() { Bounds bounds = geoMap.getMap().getExtent(); LonLat center = bounds.getCenterLonLat(); LonLat lower = new LonLat(bounds.getLowerLeftX(), bounds.getLowerLeftY()); LonLat upper = new LonLat(bounds.getUpperRightX(), bounds.getUpperRightY()); lower = transformToWGS84(lower); upper = transformToWGS84(upper); CurrentExtentInfo model = new CurrentExtentInfo(); model.setCenter(center.lat() + ", " + center.lon()); model.setLowerLeftX(lower.lon()); model.setLowerLeftY(lower.lat()); model.setUpperRightX(upper.lon()); model.setUpperRightY(upper.lat()); model.setBounds(bounds); model.setWkt(getWKT(bounds)); model.setWktWGS84(getWKTToWGS84(bounds)); currentExtentDialog.setModel(model); currentExtentDialog.setModal(true); currentExtentDialog.show(); }
Example #2
Source File: StationSelectorMap.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
@Override protected void addMapControls(MapOptions mapOptions) { super.addMapControls(mapOptions); MousePositionOptions options = new MousePositionOptions(); options.setFormatOutput(new MousePositionOutput() { @Override public String format(LonLat lonLat, Map map) { lonLat.transform(getMapProjection(), EPSG_4326); StringBuilder sb = new StringBuilder(); sb.append("Lon: ").append(lonLat.lon()).append(", "); sb.append("Lat: ").append(lonLat.lat()); sb.append(" (").append(map.getProjection()).append(")"); return sb.toString(); } }); map.addControl(new MousePosition(options)); }
Example #3
Source File: GeoMapInitializer.java From geowe-core with GNU General Public License v3.0 | 6 votes |
private EventHandler getMouseClickEventHandler() { return new EventHandler() { @Override public void onHandle(final EventObject eventObject) { final LonLat lonlat = getLonLat(eventObject); if (!GeoMap.INTERNAL_EPSG.equals(geoMap.getDisplayProjection() .getProjectionCode())) { lonlat.transform(GeoMap.INTERNAL_EPSG, geoMap .getDisplayProjection().getProjectionCode()); } statusPanelWidget.setClickedCoordinates(lonlat.lon(), lonlat.lat()); if (w3wTool.isActive()) { showW3WPosition(eventObject); } } }; }
Example #4
Source File: GeoMapInitializer.java From geowe-core with GNU General Public License v3.0 | 6 votes |
private EventHandler getMouseMoverEventHandler() { return new EventHandler() { @Override public void onHandle(final EventObject eventObject) { final LonLat lonlat = getLonLat(eventObject); if (!GeoMap.INTERNAL_EPSG.equals(geoMap.getDisplayProjection() .getProjectionCode())) { lonlat.transform(GeoMap.INTERNAL_EPSG, geoMap .getDisplayProjection().getProjectionCode()); } final Double scale = Double.valueOf((geoMap.getMap().getScale())); statusPanelWidget.setScale("1:" + scale.intValue()); statusPanelWidget.setCurrentCoordinate(lonlat); } }; }
Example #5
Source File: W3wTool.java From geowe-core with GNU General Public License v3.0 | 5 votes |
private VectorFeature createVectorFeature(final LonLat lonlat, final String words) { final Point point = new Point(lonlat.lon(), lonlat.lat()); final VectorFeature pointFeature = new VectorFeature(point); final Attributes attributes = new Attributes(); attributes.setAttribute("X", String.valueOf(lonlat.lon())); attributes.setAttribute("Y", String.valueOf(lonlat.lat())); attributes.setAttribute("w3w", words); pointFeature.setAttributes(attributes); return pointFeature; }
Example #6
Source File: GeocodingPanelWidget.java From geowe-core with GNU General Public License v3.0 | 5 votes |
public void updateMap(final double lat, final double lon, final int zoom, String epsg) { finishProgressBar(); final LonLat lonLat = new LonLat(lon, lat); transformToInternalProjection(lonLat, epsg); geoMap.getMap().panTo(lonLat); geoMap.getMap().setCenter(lonLat, zoom); }
Example #7
Source File: StatusPanelWidget.java From geowe-core with GNU General Public License v3.0 | 5 votes |
public void setCurrentCoordinate(LonLat currentCoordinate) { StatusItem lonItem = getStatusItem(LON_LABEL); lonItem.setValue(Double.toString(currentCoordinate.lon())); StatusItem latItem = getStatusItem(LAT_LABEL); latItem.setValue(Double.toString(currentCoordinate.lat())); statusStore.update(lonItem); statusStore.update(latItem); }
Example #8
Source File: GeocodingPanelWidget.java From geowe-core with GNU General Public License v3.0 | 4 votes |
private void transformToInternalProjection(final LonLat lonLat, String epsg) { if (!epsg.equals(geoMap.getMap().getProjection())) { lonLat.transform(epsg, geoMap.getMap().getProjection()); } }
Example #9
Source File: GeocodingPanelWidget.java From geowe-core with GNU General Public License v3.0 | 4 votes |
private void getW3WPosition(final String words) { startProgressBar(); w3wServiceAsync.getPosition(words, w3wTool.getLocale(), new AsyncCallback<String>() { public void onFailure(final Throwable caught) { finishProgressBar(); final AlertMessageBox messageBox = new AlertMessageBox(UIMessages.INSTANCE.warning(), UIMessages.INSTANCE.w3wErrorText()); messageBox.show(); } public void onSuccess(final String response) { finishProgressBar(); if (response.isEmpty()) { showException(UIMessages.INSTANCE.w3wErrorText()); return; } final JSONValue jsonValue = JSONParser.parseLenient(response); final JSONObject jsonObject = jsonValue.isObject(); if (jsonObject.containsKey("geometry")) { final JSONObject jsonCoords = jsonObject.get("geometry").isObject(); final double latitud = jsonCoords.get("lat").isNumber().doubleValue(); final double longitud = jsonCoords.get("lng").isNumber().doubleValue(); updateMap(latitud, longitud, 20, "EPSG:4326"); final LonLat lonLat = new LonLat(longitud, latitud); transformToInternalProjection(lonLat, "EPSG:4326"); w3wTool.addElementToW3wLayer(lonLat, words); } else if (jsonObject.containsKey("error")) { showException(UIMessages.INSTANCE.fail() + jsonObject.get("message").toString()); } else { showException(UIMessages.INSTANCE.w3wErrorText()); } } }); }
Example #10
Source File: W3wTool.java From geowe-core with GNU General Public License v3.0 | 4 votes |
public void addElementToW3wLayer(final LonLat lonlat, final String words) { createW3wLayer(); getW3wLayer().addFeature(createVectorFeature(lonlat, words)); }
Example #11
Source File: CurrentExtentTool.java From geowe-core with GNU General Public License v3.0 | 4 votes |
private LonLat transformToWGS84(final LonLat lonLat) { lonLat.transform(geoMap.getMap().getProjection(), "EPSG:4326"); return lonLat; }
Example #12
Source File: GeoMapInitializer.java From geowe-core with GNU General Public License v3.0 | 4 votes |
private LonLat getLonLat(final EventObject eventObject) { final JSObject xy = eventObject.getJSObject().getProperty("xy"); final Pixel px = Pixel.narrowToPixel(xy); return geoMap.getMap().getLonLatFromPixel(px); }
Example #13
Source File: MapView.java From geofence with GNU General Public License v2.0 | 4 votes |
/** * On zoom to center. */ private void onZoomToCenter() { LonLat center = this.mapLayout.getMap().getCenter(); this.mapLayout.getMap().setCenter(center, 3); }
Example #14
Source File: GeoMap.java From geowe-core with GNU General Public License v3.0 | 4 votes |
public void centerMap(final double lon, final double lat, final String sourceProjection, final String targetProjection){ final LonLat lonLat = new LonLat(lon, lat); lonLat.transform(sourceProjection, targetProjection); getMap().setCenter(lonLat, 5); }
Example #15
Source File: StationSelectorMap.java From SensorWebClient with GNU General Public License v2.0 | 4 votes |
public boolean containsMarker(LonLat coords) { return (this.markersPositions.containsKey(coords.lon()) && this.markersPositions.containsValue(coords.lat())); }
Example #16
Source File: OpenLayersMapWrapper.java From SensorWebClient with GNU General Public License v2.0 | 4 votes |
public LonLat getCenter() { return map.getCenter(); }
Example #17
Source File: OpenLayersMapWrapper.java From SensorWebClient with GNU General Public License v2.0 | 4 votes |
public void setCenter(LonLat center) { map.setCenter(center); }
Example #18
Source File: OpenLayersMapWrapper.java From SensorWebClient with GNU General Public License v2.0 | 4 votes |
public void setCenter(LonLat coords, int zoom) { map.setCenter(coords, zoom); }