fixed show/hide feature on zoom level. stylized the coordinates on Map

This commit is contained in:
Francesco Mangiacrapa 2020-11-17 10:27:44 +01:00
parent 2fb8f459b4
commit cb132e93d5
5 changed files with 31 additions and 20 deletions

View File

@ -21,7 +21,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
// TODO: Auto-generated Javadoc
/**
* Entry point classes define <code>onModuleLoad()</code>.
*
@ -30,12 +29,6 @@ import com.google.gwt.user.client.ui.RootPanel;
* Oct 27, 2020
*/
public class GeoportalDataViewer implements EntryPoint {
/**
* The message displayed to the user when the server cannot be reached or
* returns an error.
*/
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network " + "connection and try again.";
/** The Constant APP_DIV. */
public final static String APP_DIV = "geoportal-data-viewer";
@ -75,7 +68,7 @@ public class GeoportalDataViewer implements EntryPoint {
*/
public void onModuleLoad() {
mainPanel = new GeonaDataViewMainPanel(eventBus);
mainPanel = new GeonaDataViewMainPanel(eventBus, 600);
RootPanel.get(APP_DIV).add(mainPanel);

View File

@ -24,7 +24,7 @@ public class OLMapManager {
private Double zoomStart = null;
private Double zoomEnd = null;
private ol.Extent dragEndExtent = null;
private static final int QUERY_MIN_ZOOM_LEVEL = 10;
private static final int QUERY_MIN_ZOOM_LEVEL = 13;
public OLMapManager(String targetId, HandlerManager eventBus) {
this.targetId = targetId;
@ -169,10 +169,11 @@ public class OLMapManager {
eventBus.fireEvent(new QueryDataEvent(select, endExt.getCenter()));
}
}
else if(zoomStart!=null && zoomEnd!=null && zoomEnd<zoomStart) {
else if(zoomStart!=null && zoomEnd!=null) {
// if(zoomEnd<QUERY_MIN_ZOOM_LEVEL)
// olMap.hidePopup();
if(zoomEnd<QUERY_MIN_ZOOM_LEVEL & !olMap.isQueryPointActive()) {
olMap.hidePopup();
}
}
}

View File

@ -64,8 +64,6 @@ public abstract class OpenLayerOSM {
public abstract void mapZoomEndListener(MapEvent event);
private static final int QUERY_MIN_ZOOM_LEVEL = 10;
/** The map. */
private Map map;
@ -215,9 +213,9 @@ public abstract class OpenLayerOSM {
public void showPopup(String html, Coordinate coordinate) {
GWT.log("Showing popup on: "+coordinate);
Element elPopup = DOM.getElementById("popup");
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
if(popupOverlay==null) {
Element elPopup = DOM.getElementById("popup");
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
popupOverlay = addOverlay(elPopup);
addPopupCloserHandelr(popupOverlay);
}

View File

@ -58,10 +58,10 @@ public class GeonaDataViewMainPanel extends Composite {
private Map<Long, Tab> mapProducts = new HashMap<Long, Tab>();
public GeonaDataViewMainPanel(HandlerManager eventBus) {
public GeonaDataViewMainPanel(HandlerManager eventBus, int mapHeight) {
initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus;
mapPanel = new MapPanel("600px");
mapPanel = new MapPanel(mapHeight+"px");
mapTabPanel.add(mapPanel);
bindHandlers();
dataPointSelection.setIcon(IconType.SCREENSHOT);

View File

@ -43,7 +43,6 @@
width: 0;
position: absolute;
pointer-events: none;
visibility: visible;
}
.ol-popup:after {
@ -109,4 +108,24 @@
color: gray;
font-weight: bold;
width: 200px;
}
}
.ol-mouse-position {
top: 8px !important;
right: 60px !important;
position: absolute !important;
border: 2px solid #eee;
color: #eee;
font-size: 12px;
text-align: center;
margin: 1px;
will-change: contents, width;
transition: all .25s;
background: rgba(0,60,136,.5);
border-radius: 2px;
padding-left: 2px;
padding-right: 2px;
padding-bottom: 1px;
padding-top: 1px;
}