View Javadoc
1   package nl.tudelft.simulation.dsol.animation.gis.map;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import nl.tudelft.simulation.dsol.animation.gis.FeatureInterface;
7   import nl.tudelft.simulation.dsol.animation.gis.LayerInterface;
8   
9   /**
10   * This is an implementation of the LayerInterface that just stores the basic metadata for each layer. The elements to draw are
11   * defined by a set of key - value pairs in the Feature. The Map implementation is a LinkedHashMap to enforce a reproducible
12   * order. The actual information of the objects in the layer (points, shapes) is contained in the DataSource.
13   * <p>
14   * Copyright (c) 2020-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
15   * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
16   * project is distributed under a three-clause BSD-style license, which can be found at
17   * <a href="https://https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
18   * </p>
19   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
20   */
21  public class Layer implements LayerInterface
22  {
23      /** */
24      private static final long serialVersionUID = 20201015L;
25  
26      /** the name of the layer. */
27      private String name;
28  
29      /** whether to display the layer. */
30      private boolean display = true;
31  
32      /** whether to transform the layer. */
33      private boolean transform = false;
34  
35      /** the feature map, implemented by a LinkedHashMap to guarantee a reproducible order. */
36      private List<FeatureInterface> features = new ArrayList<>();
37  
38      /** {@inheritDoc} */
39      @Override
40      public List<FeatureInterface> getFeatures()
41      {
42          return this.features;
43      }
44  
45      /** {@inheritDoc} */
46      @Override
47      public void setFeatures(final List<FeatureInterface> features)
48      {
49          this.features = features;
50      }
51  
52      /** {@inheritDoc} */
53      @Override
54      public void addFeature(final FeatureInterface feature)
55      {
56          this.features.add(feature);
57      }
58  
59      /** {@inheritDoc} */
60      @Override
61      public String getName()
62      {
63          return this.name;
64      }
65  
66      /** {@inheritDoc} */
67      @Override
68      public void setName(final String name)
69      {
70          this.name = name;
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public boolean isDisplay()
76      {
77          return this.display;
78      }
79  
80      /** {@inheritDoc} */
81      @Override
82      public void setDisplay(final boolean status)
83      {
84          this.display = status;
85      }
86  
87      /** {@inheritDoc} */
88      @Override
89      public boolean isTransform()
90      {
91          return this.transform;
92      }
93  
94      /** {@inheritDoc} */
95      @Override
96      public void setTransform(final boolean transform)
97      {
98          this.transform = transform;
99      }
100 
101 }