Package nl.tudelft.simulation.dsol.animation.gis.D2

## Class GisRenderable2D

- java.lang.Object
- - nl.tudelft.simulation.dsol.animation.gis.D2.GisRenderable2D

All Implemented Interfaces:
  `Serializable`, `Renderable2DInterface<GisRenderable2D>`, `Locatable`

    public class GisRenderable2D
    extends Object
    implements Renderable2DInterface<GisRenderable2D>, Locatable

This renderable draws CAD/GIS objects.

Copyright (c) 2020-2021 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.

Author:
  Alexander Verbraeck
See Also:
  Serialized Form

### Field Summary

Fields
`protected Bounds3d` `bounds` the bounds of the map.
`protected Bounds2d` `cachedExtent` the cached extent.
`protected BufferedImage` `cachedImage` the image cached image.
`protected Dimension` `cachedScreenSize` the cached screenSize.
`protected OrientedPoint3d` `location` the location of the map.
`protected GisMapInterface` `map` the map to display.

### Constructor Summary

Constructors
`GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator, URL mapFile)` constructs a new GisRenderable2D.
`GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator, URL mapFile, CoordinateTransform coordinateTransform)` constructs a new GisRenderable2D.
`GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator, URL mapFile, CoordinateTransform coordinateTransform, double z)` constructs a new GisRenderable2D.
`GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator, GisMapInterface map, CoordinateTransform coordinateTransform, double z)` constructs a new GisRenderable2D based on an existing Map.

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `bind2Context​(SimulatorInterface<?,​?,​?> simulator)` binds a renderable2D to the context.
`boolean` `contains​(Point2d pointWorldCoordinates, Bounds2d extent)`
`void` `destroy​(SimulatorInterface<?,​?,​?> simulator)` destroys an RenderableObject by unsubscribing it from the context.
`Bounds3d` `getBounds()`
`long` `getId()`
`OrientedPoint3d` `getLocation()`
`GisMapInterface` `getMap()`
`GisRenderable2D` `getSource()`
`void` `paintComponent​(Graphics2D graphics, Bounds2d extent, Dimension screen, RenderableScale renderableScale, ImageObserver observer)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable

`getDirZ, getZ`

### Field Detail

#### map

    protected GisMapInterface map

the map to display.

#### cachedImage

    protected BufferedImage cachedImage

the image cached image.

#### cachedExtent

    protected Bounds2d cachedExtent

the cached extent.

#### cachedScreenSize

    protected Dimension cachedScreenSize

the cached screenSize.

#### location

    protected OrientedPoint3d location

the location of the map.

#### bounds

    protected Bounds3d bounds

the bounds of the map.

### Constructor Detail

#### GisRenderable2D

    public GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator,
                           URL mapFile)

constructs a new GisRenderable2D.

Parameters:
  `simulator` - SimulatorInterface<?,?,?>; the simulator.
  `mapFile` - URL; the mapfile to use.

#### GisRenderable2D

    public GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator,
                           URL mapFile,
                           CoordinateTransform coordinateTransform)

constructs a new GisRenderable2D.

Parameters:
  `simulator` - SimulatorInterface<?,?,?>; the simulator.
  `mapFile` - URL; the mapfile to use.
  `coordinateTransform` - CoordinateTransform; the transformation of (x, y) coordinates to (x', y') coordinates.

#### GisRenderable2D

    public GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator,
                           URL mapFile,
                           CoordinateTransform coordinateTransform,
                           double z)

constructs a new GisRenderable2D.

Parameters:
  `simulator` - SimulatorInterface<?,?,?>; the simulator.
  `mapFile` - URL; the mapfile to use.
  `coordinateTransform` - CoordinateTransform; the transformation of (x, y) coordinates to (x', y') coordinates.
  `z` - double; the z-value to use

#### GisRenderable2D

    public GisRenderable2D​(SimulatorInterface<?,​?,​?> simulator,
                           GisMapInterface map,
                           CoordinateTransform coordinateTransform,
                           double z)

constructs a new GisRenderable2D based on an existing Map.

Parameters:
  `simulator` - SimulatorInterface<?,?,?>; the simulator.
  `map` - MapInterface; the map to use.
  `coordinateTransform` - CoordinateTransform; the transformation of (x, y) coordinates to (x', y') coordinates.
  `z` - double; the z-value to use

### Method Detail

#### bind2Context

    protected void bind2Context​(SimulatorInterface<?,​?,​?> simulator)

binds a renderable2D to the context. The reason for specifying this in an independent method instead of adding the code in the constructor is related to the RFE submitted by van Houten that in specific distributed context, such binding must be overwritten.

Parameters:
  `simulator` - SimulatorInterface<?,?,?>; the simulator used for binding the object.

#### paintComponent

    public void paintComponent​(Graphics2D graphics,
                               Bounds2d extent,
                               Dimension screen,
                               RenderableScale renderableScale,
                               ImageObserver observer)

Specified by:
  `paintComponent` in interface `Renderable2DInterface<GisRenderable2D>`

#### getSource

    public GisRenderable2D getSource()

Specified by:
  `getSource` in interface `Renderable2DInterface<GisRenderable2D>`

#### getBounds

    public Bounds3d getBounds()

Specified by:
  `getBounds` in interface `Locatable`

#### getLocation

    public OrientedPoint3d getLocation()

Specified by:
  `getLocation` in interface `Locatable`

#### getMap

    public final GisMapInterface getMap()

Returns:
  map the Shapefile map

#### destroy

    public void destroy​(SimulatorInterface<?,​?,​?> simulator)

destroys an RenderableObject by unsubscribing it from the context.

Specified by:
  `destroy` in interface `Renderable2DInterface<GisRenderable2D>`

#### contains

    public boolean contains​(Point2d pointWorldCoordinates,
                            Bounds2d extent)

Specified by:
  `contains` in interface `Renderable2DInterface<GisRenderable2D>`

#### getId

    public long getId()

Specified by:
  `getId` in interface `Renderable2DInterface<GisRenderable2D>`