View Javadoc
1   package nl.tudelft.simulation.dsol.web.animation;
2   
3   import java.awt.GraphicsConfiguration;
4   import java.awt.GraphicsDevice;
5   
6   import org.djutils.logger.CategoryLogger;
7   
8   import nl.tudelft.simulation.dsol.logger.Cat;
9   
10  /**
11   * HTMLDevice.java.
12   * <p>
13   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
15   * </p>
16   * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
17   */
18  public class HtmlDevice extends GraphicsDevice
19  {
20      /** the GraphicsConfigurations for this HTMLDevice. */
21      private GraphicsConfiguration[] htmlGraphicsConfigurations;
22  
23      /**
24       * @param htmlGraphicsConfiguration GraphicsConfiguration; the GraphicsConfiguration to add to the HTMLDevice
25       */
26      public HtmlDevice(GraphicsConfiguration htmlGraphicsConfiguration)
27      {
28          CategoryLogger.filter(Cat.WEB).trace("HTMLDevice.<init>");
29          this.htmlGraphicsConfigurations = new GraphicsConfiguration[] {htmlGraphicsConfiguration};
30      }
31  
32      /** {@inheritDoc} */
33      @Override
34      public int getType()
35      {
36          CategoryLogger.filter(Cat.WEB).trace("HTMLDevice.getType()");
37          return GraphicsDevice.TYPE_RASTER_SCREEN;
38      }
39  
40      /** {@inheritDoc} */
41      @Override
42      public String getIDstring()
43      {
44          CategoryLogger.filter(Cat.WEB).trace("HTMLDevice.getIDString()");
45          return "HTMLDevice";
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      public GraphicsConfiguration[] getConfigurations()
51      {
52          CategoryLogger.filter(Cat.WEB).trace("HTMLDevice.getConfiguration()");
53          return this.htmlGraphicsConfigurations;
54      }
55  
56      /** {@inheritDoc} */
57      @Override
58      public GraphicsConfiguration getDefaultConfiguration()
59      {
60          CategoryLogger.filter(Cat.WEB).trace("HTMLDevice.getDefaultConfiguration()");
61          return this.htmlGraphicsConfigurations[0];
62      }
63  
64  }