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

## Class GisMap

- java.lang.Object
- - nl.tudelft.simulation.dsol.animation.gis.map.GisMap

All Implemented Interfaces:
  `Serializable`, `GisMapInterface`

    public class GisMap
    extends Object
    implements GisMapInterface

Provides the implementation of a Map.

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.

The dsol-animation-gis project is based on the gisbeans project that has been part of DSOL since 2002, originally by Peter Jacobs and Paul Jacobs.

Author:
  Alexander Verbraeck
See Also:
  Serialized Form

### Field Summary

### Fields inherited from interface nl.tudelft.simulation.dsol.animation.gis.map.GisMapInterface

`AIRPHOTO, ANGLEDEG, ANGLERAD, CENTIMETER_PER_INCH, DD_TO_METER, FEET_TO_METER, IMAGE, INCH_TO_METER, KILOMETER_TO_METER, LINE, MILES_TO_METER, POINT, POLYGON, TEXT`

### Constructor Summary

Constructors
`GisMap()` constructs a new Map.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addLayer​(LayerInterface layer)` Setter for property layers.
`Graphics2D` `drawMap​(Graphics2D graphics)` draws the map on a graphics object.
`ImmutableList<LayerInterface>` `getAllLayers()` Getter for all the property layers.
`Bounds2d` `getExtent()` Getter for property extent.
`MapImageInterface` `getImage()` Getter for property image.
`ImmutableMap<String,​LayerInterface>` `getLayerMap()` Getter for the map of layer names to property layers.
`String` `getName()` Getter for property name.
`double` `getScale()` returns the scale of the map.
`double` `getUnitImageRatio()` returns the scale of the Image.
`MapUnits` `getUnits()` Getter for property units.
`ImmutableList<LayerInterface>` `getVisibleLayers()` Getter for all the visible property layers.
`void` `hideLayer​(String layerName)` Hide a layer.
`void` `hideLayer​(LayerInterface layer)` Hide a layer.
`boolean` `isDrawBackground()` return whether background is drawn or not.
`boolean` `isSame()` Return whether the map has not been changed, and reset the same parameter to true.
`void` `setDrawBackground​(boolean drawBackground)` set whether background is drawn or not.
`void` `setExtent​(Bounds2d extent)` Setter for property extent.
`void` `setImage​(MapImageInterface image)` Setter for property image.
`void` `setLayer​(int index, LayerInterface layer)` Setter for property layers.
`void` `setLayers​(List<LayerInterface> layers)` Setter for property layers.
`void` `setName​(String name)` Setter for property name.
`void` `setUnits​(MapUnits units)` Setter for property units.
`void` `showLayer​(String layerName)` Show a layer.
`void` `showLayer​(LayerInterface layer)` Show a layer.
`void` `zoom​(double zoomFactor)` zooms the map with a particular factor.
`void` `zoomPoint​(Point2D pixelPosition, double zoomFactor)` zooms the map based on a given position in the image.
`void` `zoomRectangle​(SerializableRectangle2D rectangle)` zooms the map based on a given rectangle.

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

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

### Constructor Detail

#### GisMap

    public GisMap()

constructs a new Map.

### Method Detail

#### addLayer

    public void addLayer​(LayerInterface layer)

Setter for property layers.

Specified by:
  `addLayer` in interface `GisMapInterface`
Parameters:
  `layer` - LayerInterface; New value of property layers.

#### setLayers

    public void setLayers​(List<LayerInterface> layers)

Setter for property layers.

Specified by:
  `setLayers` in interface `GisMapInterface`
Parameters:
  `layers` - List<LayerInterface>; New value of property layers.

#### setLayer

    public void setLayer​(int index,
                         LayerInterface layer)

Setter for property layers.

Specified by:
  `setLayer` in interface `GisMapInterface`
Parameters:
  `index` - int; Index value of layer
  `layer` - LayerInterface; New value of property layers.

#### hideLayer

    public void hideLayer​(LayerInterface layer)

Hide a layer.

Specified by:
  `hideLayer` in interface `GisMapInterface`
Parameters:
  `layer` - LayerInterface; the layer to hide

#### hideLayer

    public void hideLayer​(String layerName)
                   throws RemoteException

Hide a layer.

Specified by:
  `hideLayer` in interface `GisMapInterface`
Parameters:
  `layerName` - String; the name of the layer to hide
Throws:
  `RemoteException` - on network exception

#### showLayer

    public void showLayer​(LayerInterface layer)

Show a layer.

Specified by:
  `showLayer` in interface `GisMapInterface`
Parameters:
  `layer` - LayerInterface; the layer to show

#### showLayer

    public void showLayer​(String layerName)
                   throws RemoteException

Show a layer.

Specified by:
  `showLayer` in interface `GisMapInterface`
Parameters:
  `layerName` - String; the name of the layer to show
Throws:
  `RemoteException` - on network exception

#### isSame

    public boolean isSame()
                   throws RemoteException

Return whether the map has not been changed, and reset the same parameter to true.

Specified by:
  `isSame` in interface `GisMapInterface`
Returns:
  whether the map has not been changed, and reset the same parameter to true
Throws:
  `RemoteException` - on network exception

#### drawMap

    public Graphics2D drawMap​(Graphics2D graphics)
                       throws GraphicsException

draws the map on a graphics object.

Specified by:
  `drawMap` in interface `GisMapInterface`
Parameters:
  `graphics` - Graphics2D; the graphics object
Returns:
  Graphics2D
Throws:
  `GraphicsException` - on drawing failure

#### getExtent

    public Bounds2d getExtent()

Getter for property extent.

Specified by:
  `getExtent` in interface `GisMapInterface`
Returns:
  Bounds2d; the extent of the map

#### getImage

    public MapImageInterface getImage()

Getter for property image.

Specified by:
  `getImage` in interface `GisMapInterface`
Returns:
  ImageInterface; the value of property image.

#### getAllLayers

    public ImmutableList<LayerInterface> getAllLayers()

Getter for all the property layers.

Specified by:
  `getAllLayers` in interface `GisMapInterface`
Returns:
  List the value of property layers.

#### getVisibleLayers

    public ImmutableList<LayerInterface> getVisibleLayers()

Getter for all the visible property layers.

Specified by:
  `getVisibleLayers` in interface `GisMapInterface`
Returns:
  List the value of property layers.

#### getLayerMap

    public ImmutableMap<String,​LayerInterface> getLayerMap()
                                                          throws RemoteException

Getter for the map of layer names to property layers.

Specified by:
  `getLayerMap` in interface `GisMapInterface`
Returns:
  Bounds2d; the value of property layers.
Throws:
  `RemoteException` - on network exception

#### getName

    public String getName()

Getter for property name.

Specified by:
  `getName` in interface `GisMapInterface`
Returns:
  String the value of property extent.

#### getScale

    public double getScale()

returns the scale of the map.

Specified by:
  `getScale` in interface `GisMapInterface`
Returns:
  double the scale of the map in its units

#### getUnitImageRatio

    public double getUnitImageRatio()

returns the scale of the Image.

Specified by:
  `getUnitImageRatio` in interface `GisMapInterface`
Returns:
  double the unitPerPixel

#### getUnits

    public MapUnits getUnits()

Getter for property units.

Specified by:
  `getUnits` in interface `GisMapInterface`
Returns:
  MapUnits the value of property units.

#### setExtent

    public void setExtent​(Bounds2d extent)

Setter for property extent.

Specified by:
  `setExtent` in interface `GisMapInterface`
Parameters:
  `extent` - Bounds2d; New value of the map extent.

#### setImage

    public void setImage​(MapImageInterface image)

Setter for property image.

Specified by:
  `setImage` in interface `GisMapInterface`
Parameters:
  `image` - ImageInterface; New value of property image.

#### setName

    public void setName​(String name)

Setter for property name.

Specified by:
  `setName` in interface `GisMapInterface`
Parameters:
  `name` - String; new value of property name.

#### setUnits

    public void setUnits​(MapUnits units)

Setter for property units.

Specified by:
  `setUnits` in interface `GisMapInterface`
Parameters:
  `units` - MapUnits; new value of property units.

#### zoom

    public void zoom​(double zoomFactor)

zooms the map with a particular factor.

Specified by:
  `zoom` in interface `GisMapInterface`
Parameters:
  `zoomFactor` - double; (0=1)

#### zoomPoint

    public void zoomPoint​(Point2D pixelPosition,
                          double zoomFactor)

zooms the map based on a given position in the image.

Specified by:
  `zoomPoint` in interface `GisMapInterface`
Parameters:
  `pixelPosition` - Point2D; the position in the image
  `zoomFactor` - double; the zoomFactor (0=1)

#### zoomRectangle

    public void zoomRectangle​(SerializableRectangle2D rectangle)

zooms the map based on a given rectangle.

Specified by:
  `zoomRectangle` in interface `GisMapInterface`
Parameters:
  `rectangle` - SerializableRectangle2D; a rectangle in the map (image units)

#### isDrawBackground

    public final boolean isDrawBackground()

return whether background is drawn or not.

Specified by:
  `isDrawBackground` in interface `GisMapInterface`
Returns:
  drawBackground

#### setDrawBackground

    public final void setDrawBackground​(boolean drawBackground)

set whether background is drawn or not.

Specified by:
  `setDrawBackground` in interface `GisMapInterface`
Parameters:
  `drawBackground` - boolean; set drawBackground