61 lines
1.5 KiB
Java
61 lines
1.5 KiB
Java
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
|
|
|
import ol.Collection;
|
|
import ol.Coordinate;
|
|
import ol.control.Control;
|
|
import ol.control.FullScreen;
|
|
import ol.control.MousePosition;
|
|
import ol.control.ZoomSlider;
|
|
import ol.proj.Projection;
|
|
|
|
|
|
/**
|
|
* The Class MapUtils.
|
|
*
|
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
|
*
|
|
* Nov 12, 2020
|
|
*/
|
|
public final class MapUtils {
|
|
|
|
|
|
/**
|
|
* Creates some default controls and adds it to the collection.
|
|
*
|
|
* @param controls collection with controls
|
|
*/
|
|
public static void addDefaultControls(final Collection<Control> controls) {
|
|
|
|
controls.push(new FullScreen());
|
|
controls.push(new ZoomSlider());
|
|
MousePosition mousePosition = new MousePosition();
|
|
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
|
|
controls.push(mousePosition);
|
|
//controls.push(new ZoomToExtent());
|
|
|
|
}
|
|
|
|
/**
|
|
* Transform coordiante.
|
|
*
|
|
* @param centerCoordinate the center coordinate
|
|
* @param source the source
|
|
* @param target the target
|
|
* @return the coordinate
|
|
*/
|
|
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
|
|
return Projection.transform(centerCoordinate, source, target);
|
|
}
|
|
|
|
|
|
/**
|
|
* Reverse coordinate.
|
|
*
|
|
* @param coord the coord
|
|
* @return the coordinate
|
|
*/
|
|
public static Coordinate reverseCoordinate(Coordinate coord){
|
|
return new Coordinate(coord.getY(), coord.getX());
|
|
}
|
|
}
|