Skip to content

Commit

Permalink
AER-2688 Enable to set attribution on map/layer (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilbrand authored Feb 8, 2024
1 parent b48dcae commit 4eeb6d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ public IsLayer<Layer> prepareLayer(final LayerProps c) {
layer.getInfo().setTitle(c.getTitle());
layer.getInfo().setName(c.getName());
layer.getInfo().setBundle(c.getBundleName());

final String attribution = c.getAttribution();
if (attribution != null) {
layer.asLayer().getSource().setAttributions(attribution);
}
final Projection projection = layer.asLayer().getSource().getProjection();
if (c.getMinScale() != null && projection != null) {
layer.asLayer().setMinResolution(OL3GeometryUtil.scaleToResolution(c.getMinScale(), projection));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import ol.OLFactory;
import ol.View;
import ol.ViewOptions;
import ol.control.Attribution;
import ol.control.AttributionOptions;
import ol.control.Control;
import ol.control.MousePosition;
import ol.control.ScaleLine;
Expand Down Expand Up @@ -82,6 +84,10 @@ private static void prepareControls(final Map map, final MapProperties mapProps)
map.addControl(new Zoom());
map.addControl(new ZoomSlider());
map.addControl(new ScaleLine());
final AttributionOptions attributionOptions = new AttributionOptions();
attributionOptions.setCollapsible(false);
attributionOptions.setCollapsed(false);
map.addControl(new Attribution(attributionOptions));

final MousePosition mousePosition = new MousePosition();

Expand Down

0 comments on commit 4eeb6d2

Please sign in to comment.