]> git.argeo.org Git - gpl/argeo-suite.git/blob - ol/Layer.java
Prepare next development cycle
[gpl/argeo-suite.git] / 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 void setMinResolution(long minResolution) {
34 if (isNew())
35 getNewOptions().put("minResolution", minResolution);
36 else
37 executeMethod(getMethodName(), minResolution);
38 }
39
40 public void setMaxResolution(long maxResolution) {
41 if (isNew())
42 getNewOptions().put("maxResolution", maxResolution);
43 else
44 executeMethod(getMethodName(), maxResolution);
45 }
46
47 public void setName(String name) {
48 set(NAME_KEY, name);
49 this.name = name;
50 }
51
52 public String getName() {
53 return name;
54 }
55 }