Class MapComponent

All Implemented Interfaces:
Animation, Editable, StyleListener, Iterable<Component>

@Deprecated public class MapComponent extends Container
Deprecated.
All communication with the map and layers should be done in WGS84, it takes care of coordinates transformation.
  • Constructor Details

    • MapComponent

      public MapComponent()
      Deprecated.
      Empty constructor creates a map with OpenStreetMapProvider on the Last known Location of the LocationManager
    • MapComponent

      public MapComponent(MapProvider provider)
      Deprecated.

      Constructor with a given provider

      Parameters
      • provider: map provider
    • MapComponent

      public MapComponent(MapProvider provider, Location centerPosition, int zoomLevel)
      Deprecated.

      Constructor

      Parameters
      • provider: map provider

      • centerPosition: center position

      • zoomLevel: zoom level

    • MapComponent

      public MapComponent(MapProvider provider, Location centerPosition, int zoomLevel, boolean cacheEnabled)
      Deprecated.

      Constructor

      Parameters
      • provider: map provider

      • centerPosition: center position

      • zoomLevel: zoom level

      • cacheEnabled: is cache enabled

    • MapComponent

      public MapComponent(MapProvider provider, Coord centerPosition, int zoomLevel)
      Deprecated.

      Constructor

      Parameters
      • provider: map provider

      • centerPosition: center position

      • zoomLevel: zoom level

    • MapComponent

      public MapComponent(MapProvider provider, Coord centerPosition, int zoomLevel, boolean cacheEnabled)
      Deprecated.

      Constructor

      Parameters
      • provider: map provider

      • centerPosition: center position

      • zoomLevel: zoom level

      • cacheEnabled: is cache enabled

  • Method Details

    • distance

      public static long distance(double latitude1, double longitude1, double latitude2, double longitude2)
      Deprecated.

      Returns the distance between 2 points in meters

      Parameters
      • latitude1

      • longitude1

      • latitude2

      • longitude2

      Returns

      distance in meters

    • paintBackground

      public void paintBackground(Graphics g)
      Deprecated.

      This method paints the Component background, it should be overriden by subclasses to perform custom background drawing.

      Parameters
      • g: the component graphics
      Overrides:
      paintBackground in class Component
    • laidOut

      protected void laidOut()
      Deprecated.
      This is a callback method to inform the Component when it's been laidout on the parent Container
      Overrides:
      laidOut in class Component
    • shouldBlockSideSwipe

      protected boolean shouldBlockSideSwipe()
      Deprecated.
      A component that might need side swipe such as the slider could block it from being used for some other purpose when on top of said component.
      Overrides:
      shouldBlockSideSwipe in class Component
    • calcPreferredSize

      protected Dimension calcPreferredSize()
      Deprecated.

      Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

      Returns

      the calculated preferred size based on component content

      Overrides:
      calcPreferredSize in class Container
    • focusGained

      protected void focusGained()
      Deprecated.
      Callback allowing a developer to track when the component gains focus
      Overrides:
      focusGained in class Component
    • pointerDragged

      public void pointerDragged(int x, int y)
      Deprecated.

      If this Component is focused, the pointer dragged event will call this method

      Parameters
      • x: the pointer x coordinate

      • y: the pointer y coordinate

      Overrides:
      pointerDragged in class Component
    • pointerPressed

      public void pointerPressed(int x, int y)
      Deprecated.

      If this Component is focused, the pointer pressed event will call this method

      Parameters
      • x: the pointer x coordinate

      • y: the pointer y coordinate

      Overrides:
      pointerPressed in class Container
    • pointerDragged

      public void pointerDragged(int[] x, int[] y)
      Deprecated.

      If this Component is focused, the pointer dragged event will call this method

      Parameters
      • x: the pointer x coordinate

      • y: the pointer y coordinate

      Overrides:
      pointerDragged in class Component
    • pointerTapped

      protected void pointerTapped(int x, int y, int tapCount)
      Deprecated.
    • pointerReleased

      public void pointerReleased(int x, int y)
      Deprecated.

      If this Component is focused, the pointer released event will call this method

      Parameters
      • x: the pointer x coordinate

      • y: the pointer y coordinate

      Overrides:
      pointerReleased in class Component
    • getCoordFromPosition

      public Coord getCoordFromPosition(int x, int y)
      Deprecated.

      Gets the Coord location on the map from a x, y position.

      Parameters
      • x: X-coordinate

      • y: Y-coordinate

      Returns

      a Coord Object.

    • getPointFromCoord

      public Point getPointFromCoord(Coord coord)
      Deprecated.

      Gets the screen coordinates of a specific Coord

      Parameters
      • coord: a lat,lon location
      Returns

      the Point of the coordinate on the Map

    • keyPressed

      public void keyPressed(int keyCode)
      Deprecated.

      If this Component is focused, the key pressed event will call this method

      Parameters
      • keyCode: the key code value to indicate a physical key.
      Overrides:
      keyPressed in class Container
    • addLayer

      public void addLayer(Layer layer)
      Deprecated.

      Adds a layer to the map

      Parameters
      • layer: to add
    • addLayer

      public void addLayer(Layer layer, int minZoomLevel, int maxZoomLevel)
      Deprecated.

      Adds a layer to the map

      Parameters
      • layer: to add

      • minZoomLevel: min zoom level of this Layer

      • maxZoomLevel: max zoom level of this Layer

    • removeLayer

      public void removeLayer(Layer layer)
      Deprecated.

      Removes a Layer from the map

      Parameters
      • layer: to remove
    • removeAllLayers

      public void removeAllLayers()
      Deprecated.
      Removes all layers from the map
    • getLayersConut

      public int getLayersConut()
      Deprecated.

      Returns layers count

      Returns

      The number of layers.

    • getLayerAt

      public Layer getLayerAt(int index)
      Deprecated.

      Returns Layer at index

      Parameters
      • index: the index of the layer
      Returns

      The layer at the given index.

      Throws
      • ArrayIndexOutOfBoundsException: @throws ArrayIndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
    • getProvider

      public MapProvider getProvider()
      Deprecated.

      Gets the map provider

      Returns

      the map provider

    • repaint

      public void repaint()
      Deprecated.
      Description copied from class: Component

      Repaint this Component, the repaint call causes a callback of the paint method on the event dispatch thread.

      See also
      • Display
      Overrides:
      repaint in class Component
    • moveLeft

      public void moveLeft()
      Deprecated.
      move the map 25% left
    • moveRight

      public void moveRight()
      Deprecated.
      move the map 25% right
    • moveUp

      public void moveUp()
      Deprecated.
      move the map 25% up
    • moveDown

      public void moveDown()
      Deprecated.
      move the map 25% down
    • zoomIn

      public void zoomIn()
      Deprecated.
      zoom in the map one level if possible
    • zoomOut

      public void zoomOut()
      Deprecated.
      zoom out the map one level if possible
    • zoomTo

      public void zoomTo(BoundingBox boundingBox)
      Deprecated.

      Zoom the map the the giving bounding box

      Parameters
      • boundingBox: to zoom to
      Throws
      • IllegalArgumentException: if the boundingBox is not wg84 format
    • zoomTo

      public void zoomTo(Coord coord, int zoomLevel)
      Deprecated.

      Zoom map to the center of the given coordinate with the given zoom level

      Parameters
      • coord: @param coord center map to this coordinate, coord should be in wg84 format

      • zoomLevel: zoom map to this level;

      Throws
      • IllegalArgumentException: if the coord is not wg84 format
    • zoomToLayers

      public void zoomToLayers()
      Deprecated.
      zoom map to largest zoom while all Layers are contained
    • getCenter

      public Coord getCenter()
      Deprecated.

      Gets the center location of the map in WGS84 format.

      Returns

      Coordinate of center location of map.

    • getZoomLevel

      public int getZoomLevel()
      Deprecated.

      Returns the current zoom level of the map.

      Returns

      zoom level

    • setZoomLevel

      public void setZoomLevel(int zoom)
      Deprecated.

      Sets the current zoom level of the map.

      Parameters
      • zoom: Zoom level
    • getMaxZoomLevel

      public int getMaxZoomLevel()
      Deprecated.

      Returns the max zoom level of the map

      Returns

      max zoom level

    • getMinZoomLevel

      public int getMinZoomLevel()
      Deprecated.

      Returns the min zoom level of the map

      Returns

      min zoom level

    • center

      public Coord center()
      Deprecated.

      Gets the center of the map.

      Returns

      Coord in WGS84

    • isLeftKey

      protected boolean isLeftKey(int keyCode)
      Deprecated.

      Checks if key code is left keycode.

      Parameters
      • keyCode: The key-code to check.
      Returns

      true if this is a left keycode

    • isRightKey

      protected boolean isRightKey(int keyCode)
      Deprecated.

      Returns true if this is a right keycode

      Parameters
      • keyCode: The key code to check
      Returns

      true if this is a right keycode.

    • isDownKey

      protected boolean isDownKey(int keyCode)
      Deprecated.

      Returns true if this is a down keycode

      Parameters
      • keyCode: The key code to check.
      Returns

      True if key code is down key.

    • isUpKey

      protected boolean isUpKey(int keyCode)
      Deprecated.

      Returns true if this is a up keycode

      Parameters
      • keyCode: The key code to check.
      Returns

      true if key code is up key.

    • isZoomInKey

      protected boolean isZoomInKey(int keyCode)
      Deprecated.

      Returns true if this is a zoom in keycode

      Parameters
      • keyCode: The key code to check
      Returns

      true if key code is zoom-in key.

    • isZoomOutKey

      protected boolean isZoomOutKey(int keyCode)
      Deprecated.

      Returns true if this is a zoom out keycode

      Parameters
      • keyCode: The key code to check.
      Returns

      true if the key code for the zoom-out key.

    • isZoomToLayersKey

      protected boolean isZoomToLayersKey(int keyCode)
      Deprecated.

      Returns true if this is a zoom to layers keycode

      Parameters
      • keyCode: The key-code to check.
      Returns

      true if the key code is for the zoom to layers key.

    • addMapListener

      public void addMapListener(MapListener listener)
      Deprecated.

      Adds a listener to map panning/zooming

      Parameters
      • listener: the listener callback
    • removeMapListener

      public void removeMapListener(MapListener listener)
      Deprecated.

      Removes the map listener callback

      Parameters
      • listener: the listener
    • getPropertyNames

      public String[] getPropertyNames()
      Deprecated.

      A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code

      Returns

      the property names allowing mutation

      Overrides:
      getPropertyNames in class Component
    • getPropertyTypes

      public Class[] getPropertyTypes()
      Deprecated.

      Matches the property names method (see that method for further details).

      Returns

      the types of the properties

      Overrides:
      getPropertyTypes in class Component
    • getPropertyValue

      public Object getPropertyValue(String name)
      Deprecated.

      Returns the current value of the property name, this method is used by the GUI builder

      Parameters
      • name: the name of the property
      Returns

      the value of said property

      Overrides:
      getPropertyValue in class Component
    • setPropertyValue

      public String setPropertyValue(String name, Object value)
      Deprecated.

      Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.

      Parameters
      • name: the name of the property

      • value: new value for the property

      Returns

      error message or null

      Overrides:
      setPropertyValue in class Component