public class MapComponent extends Container
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
MapComponent()
Deprecated.
Empty constructor creates a map with OpenStreetMapProvider on the Last
known Location of the LocationManager
|
MapComponent(MapProvider provider)
Deprecated.
Constructor with a given provider
|
MapComponent(MapProvider provider,
Coord centerPosition,
int zoomLevel)
Deprecated.
Constructor
|
MapComponent(MapProvider provider,
Coord centerPosition,
int zoomLevel,
boolean cacheEnabled)
Deprecated.
Constructor
|
MapComponent(MapProvider provider,
Location centerPosition,
int zoomLevel)
Deprecated.
Constructor
|
MapComponent(MapProvider provider,
Location centerPosition,
int zoomLevel,
boolean cacheEnabled)
Deprecated.
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLayer(Layer layer)
Deprecated.
Adds a layer to the map
|
void |
addLayer(Layer layer,
int minZoomLevel,
int maxZoomLevel)
Deprecated.
Adds a layer to the map
|
void |
addMapListener(MapListener listener)
Deprecated.
Adds a listener to map panning/zooming
|
protected Dimension |
calcPreferredSize()
Deprecated.
Calculates the preferred size based on component content.
|
Coord |
center()
Deprecated.
Gets the center of the map.
|
static long |
distance(double latitude1,
double longitude1,
double latitude2,
double longitude2)
Deprecated.
Returns the distance between 2 points in meters
|
protected void |
focusGained()
Deprecated.
Callback allowing a developer to track wheh the component gains focus
|
Coord |
getCenter()
Deprecated.
Gets the center location of the map in WGS84 format.
|
Coord |
getCoordFromPosition(int x,
int y)
Deprecated.
Gets the Coord location on the map from a x, y position.
|
Layer |
getLayerAt(int index)
Deprecated.
Returns Layer at index
|
int |
getLayersConut()
Deprecated.
Returns layers count
|
int |
getMaxZoomLevel()
Deprecated.
Returns the max zoom level of the map
|
int |
getMinZoomLevel()
Deprecated.
Returns the min zoom level of the map
|
Point |
getPointFromCoord(Coord coord)
Deprecated.
Gets the screen coordinates of a specific Coord
|
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
|
Class[] |
getPropertyTypes()
Deprecated.
Matches the property names method (see that method for further details).
|
Object |
getPropertyValue(String name)
Deprecated.
Returns the current value of the property name, this method is used by the GUI builder
|
MapProvider |
getProvider()
Deprecated.
Gets the map provider
|
int |
getZoomLevel()
Deprecated.
Returns the current zoom level of the map.
|
protected boolean |
isDownKey(int keyCode)
Deprecated.
Returns true if this is a down keycode
|
protected boolean |
isLeftKey(int keyCode)
Deprecated.
Checks if key code is left keycode.
|
protected boolean |
isRightKey(int keyCode)
Deprecated.
Returns true if this is a right keycode
|
protected boolean |
isUpKey(int keyCode)
Deprecated.
Returns true if this is a up keycode
|
protected boolean |
isZoomInKey(int keyCode)
Deprecated.
Returns true if this is a zoom in keycode
|
protected boolean |
isZoomOutKey(int keyCode)
Deprecated.
Returns true if this is a zoom out keycode
|
protected boolean |
isZoomToLayersKey(int keyCode)
Deprecated.
Returns true if this is a zoom to layers keycode
|
void |
keyPressed(int keyCode)
Deprecated.
If this Component is focused, the key pressed event
will call this method
|
protected void |
laidOut()
Deprecated.
This is a callback method to inform the Component when it's been laidout
on the parent Container
|
void |
moveDown()
Deprecated.
move the map 25% down
|
void |
moveLeft()
Deprecated.
move the map 25% left
|
void |
moveRight()
Deprecated.
move the map 25% right
|
void |
moveUp()
Deprecated.
move the map 25% up
|
void |
paintBackground(Graphics g)
Deprecated.
This method paints the Component background, it should be overriden
by subclasses to perform custom background drawing.
|
void |
pointerDragged(int[] x,
int[] y)
Deprecated.
If this Component is focused, the pointer dragged event
will call this method
|
void |
pointerDragged(int x,
int y)
Deprecated.
If this Component is focused, the pointer dragged event
will call this method
|
void |
pointerPressed(int x,
int y)
Deprecated.
If this Component is focused, the pointer pressed event
will call this method
|
void |
pointerReleased(int x,
int y)
Deprecated.
If this Component is focused, the pointer released event
will call this method
|
protected void |
pointerTapped(int x,
int y,
int tapCount)
Deprecated.
|
void |
removeAllLayers()
Deprecated.
Removes all layers from the map
|
void |
removeLayer(Layer layer)
Deprecated.
Removes a Layer from the map
|
void |
removeMapListener(MapListener listener)
Deprecated.
Removes the map listener callback
|
void |
repaint()
Deprecated.
Repaint this Component, the repaint call causes a callback of the paint
method on the event dispatch thread.
|
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.
|
void |
setZoomLevel(int zoom)
Deprecated.
Sets the current zoom level of the map.
|
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.
|
void |
zoomIn()
Deprecated.
zoom in the map one level if possible
|
void |
zoomOut()
Deprecated.
zoom out the map one level if possible
|
void |
zoomTo(BoundingBox boundingBox)
Deprecated.
Zoom the map the the giving bounding box
|
void |
zoomTo(Coord coord,
int zoomLevel)
Deprecated.
Zoom map to the center of the given coordinate with the given zoom level
|
void |
zoomToLayers()
Deprecated.
zoom map to largest zoom while all Layers are contained
|
add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyReleased, layoutContainer, morph, morphAndWait, paint, paintBorderBackground, paintComponentBackground, paintGlass, paramString, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, animate, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyTypeNames, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
public MapComponent()
public MapComponent(MapProvider provider)
provider
- map providerpublic MapComponent(MapProvider provider, Location centerPosition, int zoomLevel)
provider
- map providercenterPosition
- center positionzoomLevel
- zoom levelpublic MapComponent(MapProvider provider, Location centerPosition, int zoomLevel, boolean cacheEnabled)
provider
- map providercenterPosition
- center positionzoomLevel
- zoom levelcacheEnabled
- is cache enabledpublic MapComponent(MapProvider provider, Coord centerPosition, int zoomLevel)
provider
- map providercenterPosition
- center positionzoomLevel
- zoom levelpublic MapComponent(MapProvider provider, Coord centerPosition, int zoomLevel, boolean cacheEnabled)
provider
- map providercenterPosition
- center positionzoomLevel
- zoom levelcacheEnabled
- is cache enabledpublic void paintBackground(Graphics g)
paintBackground
in class Container
g
- the component graphicsprotected void laidOut()
protected boolean shouldBlockSideSwipe()
shouldBlockSideSwipe
in class Component
protected Dimension calcPreferredSize()
calcPreferredSize
in class Container
protected void focusGained()
focusGained
in class Component
public void pointerDragged(int x, int y)
pointerDragged
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerPressed(int x, int y)
pointerPressed
in class Container
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerDragged(int[] x, int[] y)
pointerDragged
in class Component
x
- the pointer x coordinatey
- the pointer y coordinateprotected void pointerTapped(int x, int y, int tapCount)
public void pointerReleased(int x, int y)
pointerReleased
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic Coord getCoordFromPosition(int x, int y)
x
- X-coordinatey
- Y-coordinatepublic Point getPointFromCoord(Coord coord)
coord
- a lat,lon locationpublic void keyPressed(int keyCode)
keyPressed
in class Container
keyCode
- the key code value to indicate a physical key.public void addLayer(Layer layer)
layer
- to addpublic void addLayer(Layer layer, int minZoomLevel, int maxZoomLevel)
layer
- to addminZoomLevel
- min zoom level of this LayermaxZoomLevel
- max zoom level of this Layerpublic void removeLayer(Layer layer)
layer
- to removepublic void removeAllLayers()
public int getLayersConut()
public Layer getLayerAt(int index)
index
- the index of the layerArrayIndexOutOfBoundsException
- - if the index is out of range
(index < 0 || index >= size())public MapProvider getProvider()
public void repaint()
Component
public void moveLeft()
public void moveRight()
public void moveUp()
public void moveDown()
public void zoomIn()
public void zoomOut()
public void zoomTo(BoundingBox boundingBox)
boundingBox
- to zoom toIllegalArgumentException
- if the boundingBox is not wg84 formatpublic void zoomTo(Coord coord, int zoomLevel)
coord
- center map to this coordinate, coord should be in wg84
formatzoomLevel
- zoom map to this level;IllegalArgumentException
- if the coord is not wg84 formatpublic void zoomToLayers()
public Coord getCenter()
public int getZoomLevel()
public void setZoomLevel(int zoom)
zoom
- Zoom levelpublic int getMaxZoomLevel()
public int getMinZoomLevel()
public Coord center()
protected boolean isLeftKey(int keyCode)
keyCode
- The key-code to check.protected boolean isRightKey(int keyCode)
keyCode
- The key code to checkprotected boolean isDownKey(int keyCode)
keyCode
- The key code to check.protected boolean isUpKey(int keyCode)
keyCode
- The key code to check.protected boolean isZoomInKey(int keyCode)
keyCode
- The key code to checkprotected boolean isZoomOutKey(int keyCode)
keyCode
- The key code to check.protected boolean isZoomToLayersKey(int keyCode)
keyCode
- The key-code to check.public static long distance(double latitude1, double longitude1, double latitude2, double longitude2)
latitude1
- longitude1
- latitude2
- longitude2
- public void addMapListener(MapListener listener)
listener
- the listener callbackpublic void removeMapListener(MapListener listener)
listener
- the listenerpublic String[] getPropertyNames()
getPropertyNames
in class Component
public Class[] getPropertyTypes()
getPropertyTypes
in class Component
public Object getPropertyValue(String name)
getPropertyValue
in class Component
name
- the name of the propertypublic String setPropertyValue(String name, Object value)
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the property