本文整理汇总了Java中org.gwtopenmaps.openlayers.client.control.MousePosition类的典型用法代码示例。如果您正苦于以下问题:Java MousePosition类的具体用法?Java MousePosition怎么用?Java MousePosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MousePosition类属于org.gwtopenmaps.openlayers.client.control包,在下文中一共展示了MousePosition类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMapControls
import org.gwtopenmaps.openlayers.client.control.MousePosition; //导入依赖的package包/类
@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));
}
示例2: init
import org.gwtopenmaps.openlayers.client.control.MousePosition; //导入依赖的package包/类
protected void init(FixedLayerDetails[] additionalLayers) {
this.setStylePrimaryName("mapStyle");
map = this.getMap();
addBaseLayers(additionalLayers);
currentProjection = map.getProjection();
map.addControl(new LayerSwitcher());
map.addControl(new MousePosition());
map.addControl(new PanZoom());
addDrawingLayer();
map.setMaxExtent(new Bounds(-180, -90, 180, 90));
map.setCenter(new LonLat(0.0, 0.0), 2);
map.setFractionalZoom(true);
}
示例3: initializeMap
import org.gwtopenmaps.openlayers.client.control.MousePosition; //导入依赖的package包/类
/**
* <p>initializeMap</p>
*/
private void initializeMap() {
final MapOptions mo = new MapOptions();
mo.setProjection(PROJECTION_SPHERICAL_MERCATOR.getProjectionCode());
mo.setDisplayProjection(PROJECTION_LAT_LON);
mo.setMaxExtent(new Bounds(-180, -90, 180, 90).transform(PROJECTION_LAT_LON,PROJECTION_SPHERICAL_MERCATOR));
m_mapWidget = new MapWidget("100%", "100%", mo);
m_mapHolder.add(m_mapWidget);
m_map = m_mapWidget.getMap();
m_map.addControl(new PanZoomBar());
m_map.addControl(new MousePosition());
m_map.zoomTo(2);
initializeImageError();
XYZOptions xyzOptions = new XYZOptions();
xyzOptions.setSphericalMercator(true);
xyzOptions.setAttribution("Default tiles courtesy of <a href=\"http://open.mapquest.co.uk/\">MapQuest</a>");
XYZ x = new XYZ("OpenStreetMap", getLayerUrl(), xyzOptions);
x.setIsBaseLayer(true);
x.setIsVisible(true);
m_map.addLayer(x);
m_markersLayer = new Markers("Remote Pollers");
m_markersLayer.setIsVisible(true);
m_markersLayer.setIsBaseLayer(false);
m_map.addLayer(m_markersLayer);
/*
final LayerSwitcher switcher = new LayerSwitcher();
m_map.addControl(switcher);
*/
m_map.zoomToMaxExtent();
Window.addResizeHandler(new ResizeHandler() {
public void onResize(ResizeEvent event) {
syncMapSizeWithParent();
}
});
}