1 package org.opentrafficsim.web.animation.d2;
2
3 import nl.tudelft.simulation.dsol.animation.Locatable;
4
5 /**
6 * ToggleButtonInfo.java.
7 * <p>
8 * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
9 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
10 * </p>
11 * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
12 */
13 public class ToggleButtonInfo
14 {
15 /** the name of the button. */
16 private final String name;
17
18 /** whether the class is shown or not. */
19 private boolean visible;
20
21 /**
22 * Constructor.
23 * @param name the name of the button
24 * @param visible whether the class is initially shown or not
25 */
26 protected ToggleButtonInfo(final String name, final boolean visible)
27 {
28 this.name = name;
29 this.visible = visible;
30 }
31
32 /**
33 * Return visible.
34 * @return visible
35 */
36 public final boolean isVisible()
37 {
38 return this.visible;
39 }
40
41 /**
42 * Set visible.
43 * @param visible set visible
44 */
45 public final void setVisible(final boolean visible)
46 {
47 this.visible = visible;
48 }
49
50 /**
51 * Return name.
52 * @return name
53 */
54 public final String getName()
55 {
56 return this.name;
57 }
58
59 /**
60 * ToggleButtonInfo.LocatableClass. <br>
61 * <br>
62 * Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved.
63 * See for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>.
64 * The source code and binary code of this software is proprietary information of Delft University of Technology.
65 * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
66 */
67 public static class LocatableClass extends ToggleButtonInfo
68 {
69 /** the class for which the button holds (e.g., GTU.class). */
70 private final Class<? extends Locatable> locatableClass;
71
72 /** the tool tip text to show when hovering over the button. */
73 private final String toolTipText;
74
75 /**
76 * Constructor.
77 * @param name the name of the button
78 * @param locatableClass the class for which the button holds (e.g., GTU.class)
79 * @param toolTipText the tool tip text to show when hovering over the button
80 * @param visible whether the class is initially shown or not
81 */
82 public LocatableClass(final String name, final Class<? extends Locatable> locatableClass, final String toolTipText,
83 final boolean visible)
84 {
85 super(name, visible);
86 this.locatableClass = locatableClass;
87 this.toolTipText = toolTipText;
88 }
89
90 /**
91 * Return locatable class.
92 * @return locatableClass
93 */
94 public final Class<? extends Locatable> getLocatableClass()
95 {
96 return this.locatableClass;
97 }
98
99 /**
100 * Return tooltip.
101 * @return toolTipText
102 */
103 public final String getToolTipText()
104 {
105 return this.toolTipText;
106 }
107 }
108
109 /**
110 * ToggleButtonInfo.Text. <br>
111 * <br>
112 * Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved.
113 * See for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>.
114 * The source code and binary code of this software is proprietary information of Delft University of Technology.
115 * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
116 */
117 public static class Text extends ToggleButtonInfo
118 {
119 /**
120 * Constructor.
121 * @param name the name of the button
122 * @param visible whether the class is initially shown or not
123 */
124 public Text(final String name, final boolean visible)
125 {
126 super(name, visible);
127 }
128 }
129
130 /**
131 * ToggleButtonInfo.Gis. <br>
132 * <br>
133 * Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved.
134 * See for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>.
135 * The source code and binary code of this software is proprietary information of Delft University of Technology.
136 * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
137 */
138 public static class Gis extends ToggleButtonInfo
139 {
140 /** the GIS layer name. */
141 private final String layerName;
142
143 /** the tool tip text to show when hovering over the button. */
144 private final String toolTipText;
145
146 /**
147 * Constructor.
148 * @param name the name of the button
149 * @param layerName the GIS layer name
150 * @param toolTipText the tool tip text to show when hovering over the button
151 * @param visible whether the class is initially shown or not
152 */
153 public Gis(final String name, final String layerName, final String toolTipText, final boolean visible)
154 {
155 super(name, visible);
156 this.layerName = layerName;
157 this.toolTipText = toolTipText;
158 }
159
160 /**
161 * Get layer name.
162 * @return layerName
163 */
164 public final String getLayerName()
165 {
166 return this.layerName;
167 }
168
169 /**
170 * Get tooltip.
171 * @return toolTipText
172 */
173 public final String getToolTipText()
174 {
175 return this.toolTipText;
176 }
177 }
178
179 }