]> git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.geo/src/org/argeo/app/ol/Layer.java
Prepare next development cycle
[gpl/argeo-suite.git] / org.argeo.app.geo / src / org / argeo / app / ol / Layer.java
1 package org.argeo.app.ol;
2
3 import java.util.Objects;
4
5 public class Layer extends AbstractOlObject {
6 public final static String NAME_KEY = "name";
7
8 // cached
9 private String name;
10
11 public Layer(Object... args) {
12 super(args);
13 }
14
15 public void setOpacity(double opacity) {
16 if (opacity < 0 || opacity > 1)
17 throw new IllegalArgumentException("Opacity must be between 0 and 1");
18 // if (isNew())
19 // getNewOptions().put("opacity", opacity);
20 // else
21 // executeMethod(getMethodName(), opacity);
22 doSetValue(getMethodName(), "opacity", opacity);
23 }
24
25 public void setSource(Source source) {
26 Objects.requireNonNull(source);
27 if (isNew())
28 getNewOptions().put("source", source);
29 else
30 executeMethod(getMethodName(), source);
31 }
32
33 public Source getSource() {
34 String reference = getReference() + ".getSource()";
35 return new Source(getJsClient(), reference);
36 }
37
38 public void setMinResolution(double minResolution) {
39 if (isNew())
40 getNewOptions().put("minResolution", minResolution);
41 else
42 executeMethod(getMethodName(), minResolution);
43 }
44
45 public void setMaxResolution(double maxResolution) {
46 if (isNew())
47 getNewOptions().put("maxResolution", maxResolution);
48 else
49 executeMethod(getMethodName(), maxResolution);
50 }
51
52 public void setName(String name) {
53 set(NAME_KEY, name);
54 this.name = name;
55 }
56
57 public String getName() {
58 return name;
59 }
60 }