Class GeoMapViewer
- java.lang.Object
-
- org.eclipse.jface.viewers.Viewer
-
- org.eclipse.jface.viewers.ContentViewer
-
- org.eclipse.nebula.widgets.geomap.jface.GeoMapViewer
-
- All Implemented Interfaces:
org.eclipse.jface.viewers.IInputProvider,org.eclipse.jface.viewers.IInputSelectionProvider,org.eclipse.jface.viewers.ISelectionProvider
public class GeoMapViewer extends org.eclipse.jface.viewers.ContentViewerA JFace viewer for the GeoMap widget, that shows the geo-location of the input elements. The LocationProvider maps the input elements to geo-locations
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classGeoMapViewer.MovePinMouseHandler
-
Field Summary
Fields Modifier and Type Field Description static intCLIP_ON_ELEMENT_POSITIONConstant indicating the location markers should be clipped, based on their positionstatic intCLIP_ON_IMAGE_BOUNDSConstant indicating the location markers should be clipped, based on the bounding box of their imageprivate intclipRuleprivate GeoMapgeoMapprivate org.eclipse.jface.window.ToolTiplastToolTipprivate LocationProviderlocationProviderprivate static intMAX_ZOOM_TOprivate DefaultMouseHandlermouseHandlerstatic intMOVE_SELECTION_ALLOW_CHECK_IMMEDIATEConstant indicating the selection will be moved immediately, using the LocationProvider's set methodstatic intMOVE_SELECTION_ALLOW_CHECK_LATEConstant indicating the selection will be moveable, but the actual move is performed using the LocationProvider's set method, when droppingstatic intMOVE_SELECTION_NONEConstant indicating the selection cannot be moved, i.e.private intmoveSelectionModestatic intNO_CLIPConstant indicating that location markers should not be clippedprivate intrevealMarginprivate java.lang.Objectselectionprivate org.eclipse.swt.graphics.PointselectionOffsetprivate intthumbSizeprivate org.eclipse.jface.window.ToolTiptoolTip
-
Constructor Summary
Constructors Constructor Description GeoMapViewer(GeoMap geoMap)Creates a GeoMapViewer for a specific GeoMapGeoMapViewer(org.eclipse.swt.widgets.Composite parent, int flags)Creates a GeoMapViewer with a default GeoMap inside a specific Composite
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.ObjectdoContent(java.lang.Object element, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle contain, java.lang.Object selection)private java.lang.ObjectdoContents(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle contain, java.lang.Object selection)private org.eclipse.swt.graphics.RectanglegetBounds(java.lang.Object[] elements)org.eclipse.swt.widgets.ControlgetControl()java.lang.ObjectgetElementAt(int x, int y, int thumbSize)Gets the element found within the rectangle of the given position and sizeprivate org.eclipse.swt.graphics.PointgetElementPosition(java.lang.Object element, org.eclipse.swt.graphics.Point into, boolean mapRelative)private java.lang.Object[]getElements()GeoMapgetGeoMap()Returns the underlying GeoMap controlLocationProvidergetLocationProvider()Returns the location provider for this GeoMapViewer.intgetMoveSelectionMode()Gets the current move modeorg.eclipse.jface.viewers.ISelectiongetSelection()org.eclipse.jface.window.ToolTipgetToolTip()Gets the current ToolTipprotected voidhandleDispose(org.eclipse.swt.events.DisposeEvent event)protected voidhandleLabelProviderChanged(org.eclipse.jface.viewers.LabelProviderChangedEvent event)private voidhandleToolTip(int x, int y)(package private) voidhandleToolTip(org.eclipse.swt.events.MouseEvent e)(package private) voidhandleToolTip(org.eclipse.swt.widgets.Event e)protected voidinputChanged(java.lang.Object input, java.lang.Object oldInput)private voidpaintOverlay(org.eclipse.swt.events.PaintEvent e)voidrefresh()voidreveal(java.lang.Object selection, boolean center)Pans the viewer so the element is revealedvoidrevealAll()Pans and zooms so all elements are revealed.voidsetClipRule(int clipRule)Sets the clipping rulevoidsetLocationProvider(LocationProvider locationProvider)Sets the location provider for this GeoMapViewer.voidsetMoveSelectionMode(int moveSelectionMode)Sets the current move mode, one of MOVE_SELECTION_NONE, MOVE_SELECTION_ALLOW_CHECK_IMMEDIATE or MOVE_SELECTION_ALLOW_CHECK_LATEprivate voidsetSelection(java.lang.Object selection)voidsetSelection(org.eclipse.jface.viewers.ISelection selection, boolean reveal)voidzoomTo(java.lang.Object[] elements, int maxZoom)Zooms out so all elements are revealed, but only upto a certain zoom level.-
Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, getLabelProvider, hookControl, labelProviderChanged, setContentProvider, setInput, setLabelProvider
-
-
-
-
Field Detail
-
geoMap
private GeoMap geoMap
-
locationProvider
private LocationProvider locationProvider
-
selection
private java.lang.Object selection
-
selectionOffset
private org.eclipse.swt.graphics.Point selectionOffset
-
mouseHandler
private DefaultMouseHandler mouseHandler
-
NO_CLIP
public static int NO_CLIP
Constant indicating that location markers should not be clipped
-
CLIP_ON_ELEMENT_POSITION
public static int CLIP_ON_ELEMENT_POSITION
Constant indicating the location markers should be clipped, based on their position
-
CLIP_ON_IMAGE_BOUNDS
public static int CLIP_ON_IMAGE_BOUNDS
Constant indicating the location markers should be clipped, based on the bounding box of their image
-
clipRule
private int clipRule
-
revealMargin
private int revealMargin
-
MOVE_SELECTION_NONE
public static final int MOVE_SELECTION_NONE
Constant indicating the selection cannot be moved, i.e. its location is read-only- See Also:
- Constant Field Values
-
MOVE_SELECTION_ALLOW_CHECK_IMMEDIATE
public static final int MOVE_SELECTION_ALLOW_CHECK_IMMEDIATE
Constant indicating the selection will be moved immediately, using the LocationProvider's set method- See Also:
- Constant Field Values
-
MOVE_SELECTION_ALLOW_CHECK_LATE
public static final int MOVE_SELECTION_ALLOW_CHECK_LATE
Constant indicating the selection will be moveable, but the actual move is performed using the LocationProvider's set method, when dropping- See Also:
- Constant Field Values
-
moveSelectionMode
private int moveSelectionMode
-
toolTip
private org.eclipse.jface.window.ToolTip toolTip
-
lastToolTip
private org.eclipse.jface.window.ToolTip lastToolTip
-
thumbSize
private int thumbSize
-
MAX_ZOOM_TO
private static final int MAX_ZOOM_TO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GeoMapViewer
public GeoMapViewer(GeoMap geoMap)
Creates a GeoMapViewer for a specific GeoMap- Parameters:
geoMap- the GeoMap
-
GeoMapViewer
public GeoMapViewer(org.eclipse.swt.widgets.Composite parent, int flags)Creates a GeoMapViewer with a default GeoMap inside a specific Composite- Parameters:
parent- the parent Compositeflags- the SWT options
-
-
Method Detail
-
handleDispose
protected void handleDispose(org.eclipse.swt.events.DisposeEvent event)
- Overrides:
handleDisposein classorg.eclipse.jface.viewers.ContentViewer
-
handleLabelProviderChanged
protected void handleLabelProviderChanged(org.eclipse.jface.viewers.LabelProviderChangedEvent event)
- Overrides:
handleLabelProviderChangedin classorg.eclipse.jface.viewers.ContentViewer
-
getLocationProvider
public LocationProvider getLocationProvider()
Returns the location provider for this GeoMapViewer.- Returns:
- the location provider
-
setLocationProvider
public void setLocationProvider(LocationProvider locationProvider)
Sets the location provider for this GeoMapViewer. The location provider determines where the icon for each element is placed.- Parameters:
locationProvider- the location provider
-
paintOverlay
private void paintOverlay(org.eclipse.swt.events.PaintEvent e)
-
getElements
private java.lang.Object[] getElements()
-
doContents
private java.lang.Object doContents(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle contain, java.lang.Object selection)
-
getElementAt
public java.lang.Object getElementAt(int x, int y, int thumbSize)Gets the element found within the rectangle of the given position and size- Parameters:
x- the x coordinate of center of the rectangley- the y coordinate of center of the rectanglethumbSize- the width and height of the rectangle- Returns:
- the element found or null, if none where found
-
setClipRule
public void setClipRule(int clipRule)
Sets the clipping rule- Parameters:
clipRule- the clipping rule, one of the constants NO_CLIP, CLIP_ON_ELEMENT_POSITION or CLIP_ON_IMAGE_BOUNDS
-
doContent
private java.lang.Object doContent(java.lang.Object element, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle contain, java.lang.Object selection)
-
getElementPosition
private org.eclipse.swt.graphics.Point getElementPosition(java.lang.Object element, org.eclipse.swt.graphics.Point into, boolean mapRelative)
-
getControl
public org.eclipse.swt.widgets.Control getControl()
- Specified by:
getControlin classorg.eclipse.jface.viewers.Viewer
-
getGeoMap
public GeoMap getGeoMap()
Returns the underlying GeoMap control- Returns:
- the underlying GeoMap control
-
getSelection
public org.eclipse.jface.viewers.ISelection getSelection()
- Specified by:
getSelectionin interfaceorg.eclipse.jface.viewers.ISelectionProvider- Specified by:
getSelectionin classorg.eclipse.jface.viewers.Viewer
-
refresh
public void refresh()
- Specified by:
refreshin classorg.eclipse.jface.viewers.Viewer
-
inputChanged
protected void inputChanged(java.lang.Object input, java.lang.Object oldInput)- Overrides:
inputChangedin classorg.eclipse.jface.viewers.Viewer
-
setSelection
public void setSelection(org.eclipse.jface.viewers.ISelection selection, boolean reveal)- Specified by:
setSelectionin classorg.eclipse.jface.viewers.Viewer
-
reveal
public void reveal(java.lang.Object selection, boolean center)Pans the viewer so the element is revealed- Parameters:
selection- the element to revealcenter- whether to center on the element
-
revealAll
public void revealAll()
Pans and zooms so all elements are revealed.
-
setSelection
private void setSelection(java.lang.Object selection)
-
setMoveSelectionMode
public void setMoveSelectionMode(int moveSelectionMode)
Sets the current move mode, one of MOVE_SELECTION_NONE, MOVE_SELECTION_ALLOW_CHECK_IMMEDIATE or MOVE_SELECTION_ALLOW_CHECK_LATE- Parameters:
moveSelectionMode-
-
getMoveSelectionMode
public int getMoveSelectionMode()
Gets the current move mode- Returns:
- the current move mode
-
getToolTip
public org.eclipse.jface.window.ToolTip getToolTip()
Gets the current ToolTip- Returns:
- the current ToolTip
-
handleToolTip
void handleToolTip(org.eclipse.swt.widgets.Event e)
-
handleToolTip
void handleToolTip(org.eclipse.swt.events.MouseEvent e)
-
handleToolTip
private void handleToolTip(int x, int y)
-
getBounds
private org.eclipse.swt.graphics.Rectangle getBounds(java.lang.Object[] elements)
-
zoomTo
public void zoomTo(java.lang.Object[] elements, int maxZoom)Zooms out so all elements are revealed, but only upto a certain zoom level.- Parameters:
elements- the elements to revealmaxZoom- the maximum zoom
-
-