Package com.kheops.jmap.client.views
Class View
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.kheops.jmap.client.views.View
- All Implemented Interfaces:
JMapEventDispatcher,ImageObserver,MenuContainer,Serializable
- Direct Known Subclasses:
OverView,ViewMagnifier
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Toolprotected final ViewEventDispatcherprotected GraphicsRefprotected LayerAdapterprotected MouseOverManagerprotected BufferedImageprotected OrientedRectanglestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected ViewRendererprotected Stringprotected ViewOverlayprotected JPopupMenuFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionView(LayerManager layerMgr, ViewSettings settings) Constructs a new View object associated with the specified LayerManager. -
Method Summary
Modifier and TypeMethodDescriptionlongAdds a new marker to the view.addPopupMenuAction(Action menuItemAction) Adds an action to the view contextual menu.voidaddPopupMenuItem(JMenuItem menuItem) Adds a menu item to the view contextual menu.voidAdds separator to the view contextual menu.voidaddStaticElement(ViewStaticElement staticElem) Adds the specified static element to the list of elements that will be drawn in this view on top of geographic data.voidaddStaticImage(Image im, Point pt, int relativeTo) Deprecated.Use addStaticElement insteadvoidaddViewEventListener(ViewEventListener listener) Adds a listener to the list of view event listeners.voidapplySettings(ViewSettings settings) Sets the settings for the viewvoidRemoves all the markers from this viewvoidclose()Frees resources used by the view.protected booleanvoiddispatchEvent(JMapEvent event) ThedispatchEventmethod is used to dispatch synchronously JMap events to all registered listeners.protected voiddraw(K2DTransform t, OrientedRectangle wcRegion, int drawOptions) protected voiddraw(K2DTransform t, OrientedRectangle wcRegion, Rectangle dcRegion, int drawOptions, boolean updateViewGraphics) voiddrawStaticElements(GraphicsRef gr, K2DTransform t, Rectangle viewBounds) Draws view static elements.voiddrawVolatileElement(K2DElement element, VectorLayer vectorLayer, Graphics g) Deprecated.use viewOverlay.drawVolatileElement(element, layer);voiddrawVolatileElements(K2DElement[] elements, VectorLayer vectorLayer, Rectangle userBoundingBoxDc, Graphics g) Deprecated.use viewOverlay.drawVolatileElement(element, layer);voiddrawVolatileElements(K2DElement[] elements, VectorLayer vectorLayer, Graphics g) Deprecated.use viewOverlay.drawVolatileElement(element, layer);protected voidfirePopupMenuShowingEvent(MouseEvent mouseEvent) protected voidfireToolChangedEvent(Tool oldTool, Tool newTool) voidprotected voidfireViewRedrawOccurredEvent(ViewState viewState) Fires a ViewRedrawEvent.protected voidFires a ViewRedrawEvent.Returns the coordinate of the center of the view in DC coordinates.Returns the current active tool of the view.Returns the coordinate of the center of the view in DC coordinates.This method returns the Display unit.Returns the graphics manager of the current view.Gets the intial view boundsReturns the LayerManager object associated with this view.Returns the current map data projection.Returns the current map data unit.Returns the maximum bounds of this viewReturn theMouseOverManagerfor this view.Returns the ViewRenderer instance which is used to render the map on the view.doubleReturns the view rotation angle in degrees.doubleComputes the view current scale factor denominator.doublegetScaleFactor(double dcScale) Computes a scale factor denominator.Returns view static elements added to this view.Returns the K2DTransform object associated with this view.booleanReturns the verbose mode for this view.Returns the GraphicsRef instance of the view.Gets the view name.Returns the ViewOverlay associated with this viewReturns the current view settings.Returns the current state of the view, including all parameters needed to restore the current state.Returns a Rectangle object representing the area of the view in WC.doubleGets the zoom level expressed in the current map unitsprotected ViewEventDispatcherbooleanisBusy()Indicates if the View is currently busy repainting.booleanDetermines if the mouse cursor is inside the view.booleanReturns whether the view is refreshable.booleanAdjust the view in order to display the region that was displayed prior to the previous change in the view (similar to undo).booleanIf moveBackward() was called, adjust the view in order to display the region that was displayed before the call to moveBackward() (similar to redo).voidmoveTo(double x, double y) Makes the specified WC coordinate the new center of the view.voidMakes the specified WC coordinate the new center of the viewvoidPaint on the graphicvoidpan(int xdc, int ydc) Adjusts the view in order to display a region that corresponds to the current region translated by xDC in x and yDC in y (in DC).voidpanSmooth(int xDC, int yDC) This method will pan the view and dynamically update the view to reflect the translation.voidpanSmooth(int xDC, int yDC, boolean redrawLabels) This method will pan the view and dynamically update the view to reflect the translation.voidredraw(OrientedRectangle wcRegion) Redraws the current view using all layers.voidredraw(OrientedRectangle WCRegion, int drawOptions) Redraws the current view using the specified draw options.voidredraw(OrientedRectangle WCRegion, int drawOptions, boolean stopDrawing) Redraws the current view using the specified draw options.voidredraw(OrientedRectangle wcRegion, int drawOptions, boolean stopDrawing, boolean updateViewGraphics) Redraws the current view using the specified draw options.voidrefresh()Redraws the complete view.voidremoveMarker(long markerId) Removes the specified marker from this viewvoidremovePopupMenuAction(Action menuItemAction) Removes an action from the view contextual menu.voidremovePopupMenuItem(JMenuItem menuItem) Removes a menu item from the view contextual menu.voidremoveStaticElement(ViewStaticElement staticElem) Removes the specified static element from the list.voidremoveViewEventListener(ViewEventListener listener) Removes a listener from the list of view event listeners.voidDeprecated.Is of no use anymore.voidsetBounds(int x, int y, int width, int height) Sets the view bounds.voidsetCurrentTool(Tool tool) Sets the active Tool object for this view.voidsetDisplayUnit(JMapUnit unit) Sets the unit to use when displaying coordinates.voidsetDistanceUnit(JMapUnit unit) Sets the unit to use when displaying distances.voidsetInitialViewBounds(OrientedRectangle initialViewBounds) Sets the initial view boundsvoidsetLayerManager(LayerManager layerMgr) Sets the layer managervoidsetLayerRefreshManagerView(LayerViewRefreshManager dynamicLayerManager) voidsetMapUnit(JMapUnit unit) Sets the unit for this map.voidsetMaximumScale(double scale) Sets the View object maximum scale.voidsetMaxViewBounds(OrientedRectangle maxBounds) Sets the maximum view bounds where the user will be able to zoom/panvoidsetRefreshable(boolean refreshable) Sets whether the view is refreshable.voidsetRotation(double angle) Rotates the map to the specified angle in degrees.voidsetScale(double scaleFactor) Sets the new scale of the view.voidsetScaleValidator(ScaleValidator scaleValidator) voidsetVerbose(boolean verbose) Sets the verbose mode for this view.voidsetViewName(String viewName) Sets the view name.protected voidprotected voidHandles layer position change events.protected voidHandler for LayerPropertyChangedEvent events.protected voidHandles new data events.protected voidHandles layerRefreshrequestEvent Refreshes the layerprotected voidprotected voidHandles layer style change events.protected voidEvent handler for mouse click events.protected voidEvent handler for mouse drag events.protected voidprotected voidprotected voidEvent handler for mouse move events.protected voidEvent handler for mouse down events.protected voidEvent handler for mouse up events.voidzoom(double factor) Zooms by the specified factor and around the center of the view.voidZooms by the specified factor and around specified point.voidzoom(OrientedRectangle rect) Zooms to the specified WC region (rect).voidZooms to the specified WC region (rect).voidAdjusts the view in order to display every element of every visible layer managed by the associated LayerManager object.voidzoomToRect(OrientedRectangle rect) Deprecated.use zoom(OrientedRectangle) insteadMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
PROPERTY_VIEW_NAME
- See Also:
-
PROPERTY_MAP_UNIT
- See Also:
-
PROPERTY_DISTANCE_UNIT
- See Also:
-
PROPERTY_DISPLAY_UNIT
- See Also:
-
PROPERTY_MAP_ROTATION
- See Also:
-
PROPERTY_MOUSEOVER_DISABLED
- See Also:
-
renderer
-
graphicsRef
-
offImage
-
viewOverlay
-
mouseOverManager
-
viewPopupMenu
-
currentTool
-
panSmoothToRedrawRect
-
layerAdapter
-
viewName
-
eventDispatcher
-
-
Constructor Details
-
View
Constructs a new View object associated with the specified LayerManager. The specified view settings are applied to the view.- Parameters:
layerMgr- the associated LayerManagersettings- the settings to be applied to the view- See Also:
-
-
Method Details
-
initEventDispatcher
-
close
public void close()Frees resources used by the view. Should be called when the view is no longer needed. -
createOffImage
protected boolean createOffImage() -
paint
Paint on the graphic- Overrides:
paintin classJComponent- Parameters:
g- the corresponding Graphic instance
-
addPopupMenuItem
Adds a menu item to the view contextual menu.- Parameters:
menuItem- the JMenuItem to add
-
addPopupMenuSeparator
public void addPopupMenuSeparator()Adds separator to the view contextual menu. -
getCurrentTool
Returns the current active tool of the view. Can be null if no tool is active.- Returns:
- the current active tool
-
addPopupMenuAction
Adds an action to the view contextual menu. A JMenuItem is created with the action. This menu item is returned.- Parameters:
menuItemAction- the action to add- Returns:
- the menu item created with the action
-
removePopupMenuItem
Removes a menu item from the view contextual menu.- Parameters:
menuItem- the menu item to remove
-
removePopupMenuAction
Removes an action from the view contextual menu.- Parameters:
menuItemAction- the action to remove
-
getMouseOverManager
Return theMouseOverManagerfor this view.- Returns:
- the mouseOverManager
-
setBounds
public void setBounds(int x, int y, int width, int height) Sets the view bounds. -
getViewOverlay
Returns the ViewOverlay associated with this view- Returns:
- ViewOverlay
-
draw
-
draw
protected void draw(K2DTransform t, OrientedRectangle wcRegion, Rectangle dcRegion, int drawOptions, boolean updateViewGraphics) -
drawVolatileElement
@Deprecated public void drawVolatileElement(K2DElement element, VectorLayer vectorLayer, Graphics g) Deprecated.use viewOverlay.drawVolatileElement(element, layer);This method draws a volatile element while erasing the previous volatile element drawn by this method. Passing null as argument restores the screen with the offImage (clears volatile drawings). resetVolatileImageLastBounds() resets the last element's bound (useful if the user calls redraw and there is no portion of the screen to restore)- Parameters:
element- element that need to be drawn on the screeng- graphics instance. Not used anymore.layer- the layer that contains the element.
-
drawVolatileElements
@Deprecated public void drawVolatileElements(K2DElement[] elements, VectorLayer vectorLayer, Rectangle userBoundingBoxDc, Graphics g) Deprecated.use viewOverlay.drawVolatileElement(element, layer);this method draws the specified elements in a volatile fashion on the screen while restoring the specified region from the offimage.- Parameters:
elements- array of K2DElements elements that need to be drawn on the screenvectorLayer- the layer that contains the array of elements.userBoundingBoxDc- Additional region in DC which needs to be restored. Not used anymore.g- graphics instance. Not used anymore.
-
resetVolatileImageLastBounds
Deprecated.Is of no use anymore.Resets the last drawn bounds for the method -
drawVolatileElements
@Deprecated public void drawVolatileElements(K2DElement[] elements, VectorLayer vectorLayer, Graphics g) Deprecated.use viewOverlay.drawVolatileElement(element, layer);This method draws a volatile elements while each call of this method erases the previous volatile elements drawn by this method. At the end, either drawVolatileElement(null) should be called to restore the view or resetVolatileImageLastBounds() should be called if the user has manually restored it (called redraw, refresh, etc..)- Parameters:
elements- array of K2DStyledElements elements that need to be drawn on the screenvectorLayer- the layer that contains the array of elements.g- the graphics instance. Not used anymore.
-
setCurrentTool
Sets the active Tool object for this view.- Parameters:
tool- the new current active tool of the view
-
dispatchEvent
ThedispatchEventmethod is used to dispatch synchronously JMap events to all registered listeners. The main use of theJMapEventDispatcherinterface is to dispatch events that were previously added to the JMap event queue.
Note: onlyViewEventwill be accepted by this method. Any other JMap event types will cause the view to throw an exception.- Specified by:
dispatchEventin interfaceJMapEventDispatcher- Parameters:
event- the event to be dispatched.- Throws:
IllegalArgumentException- will be thrown if theJMapEventinstance is no an instance of theViewEventclass.- See Also:
-
fireToolChangedEvent
-
firePopupMenuShowingEvent
-
this_mousePressed
Event handler for mouse down events.- Parameters:
e- the mouse event.
-
this_mouseReleased
Event handler for mouse up events.- Parameters:
e- the mouse event.
-
this_mouseMoved
Event handler for mouse move events.- Parameters:
e- the mouse event.
-
this_mouseClicked
Event handler for mouse click events.- Parameters:
e- the mouse event.
-
this_mouseDragged
Event handler for mouse drag events.- Parameters:
e- the mouse event.
-
isBusy
public boolean isBusy()Indicates if the View is currently busy repainting.- Returns:
- true if the drawing thread is repainting
-
this_mouseEntered
-
this_mouseExited
-
isMouseInside
public boolean isMouseInside()Determines if the mouse cursor is inside the view.- Returns:
- true if mouse cursor is inside the view
-
panSmooth
public void panSmooth(int xDC, int yDC) This method will pan the view and dynamically update the view to reflect the translation.- Parameters:
xDC- the translation in x expressed in DC coordinatesyDC- the translation in y expressed in DC coordinates- See Also:
-
panSmooth
public void panSmooth(int xDC, int yDC, boolean redrawLabels) This method will pan the view and dynamically update the view to reflect the translation. When this method is used, fireViewChanged() should be called manually.- Parameters:
xDC- the translation in x expressed in DC coordinatesyDC- the translation in y expressed in DC coordinatesredrawLabels- if this should also redraw the labels- See Also:
-
redraw
Redraws the current view using all layers.- Parameters:
wcRegion- the region to redraw.
-
redraw
Redraws the current view using the specified draw options.- Parameters:
WCRegion- the region to redraw.drawOptions- a bit field value that specifies what to draw.- See Also:
-
redraw
Redraws the current view using the specified draw options.- Parameters:
WCRegion- the region to redraw.drawOptions- a bit field value that specifies what to draw.stopDrawing- defines whether the drawing thread should be stopped drawing before redrawing the view. However, this flag has not effect on a synchronized redraw.- See Also:
-
redraw
public void redraw(OrientedRectangle wcRegion, int drawOptions, boolean stopDrawing, boolean updateViewGraphics) Redraws the current view using the specified draw options.- Parameters:
wcRegion- the region to redraw.drawOptions- a bit field value that specifies what to draw.stopDrawing- defines whether the drawing thread should be stopped drawing before redrawing the view. However, this flag has not effect on a synchronized redraw.updateViewGraphics- defines whether the redraw should update the view graphics (false will only affect the offImage)
-
refresh
public void refresh()Redraws the complete view. -
setLayerManager
Sets the layer manager- Parameters:
layerMgr-
-
setViewName
Sets the view name. IllegalArgumentException if viewName isnull. A PropertyChangeEvent event is fired (propertyName : PROPERTY_VIEW_NAME).- Parameters:
viewName- the new name for this view- See Also:
-
getViewName
Gets the view name.- Returns:
- the name for this view
-
setRefreshable
public void setRefreshable(boolean refreshable) Sets whether the view is refreshable.- Parameters:
refreshable- a boolean value that specifies whether the view is refreshable.
-
this_layerRefreshRequestEvent
protected void this_layerRefreshRequestEvent()Handles layerRefreshrequestEvent Refreshes the layer -
this_layerAddedEventOccurred
-
this_layerRemovedEventOccurred
-
this_layerStyleChangedEventOccurred
Handles layer style change events.- Parameters:
e- the corresponding LayerStyleChangedEvent
-
this_layerPosChangedEventOccurred
Handles layer position change events.- Parameters:
e-
-
this_layerReceivedDataEventOccurred
Handles new data events.- Parameters:
e- the corresponding new data event
-
this_layerPropertyChangedEvent
Handler for LayerPropertyChangedEvent events.- Parameters:
e- the received event.
-
getViewGraphicsRef
Returns the GraphicsRef instance of the view.- Returns:
- the GraphicsRef instance of the view.
-
getRenderer
Returns the ViewRenderer instance which is used to render the map on the view.- Returns:
- the ViewRenderer instance of the view.
-
fireViewRedrawOccurredEvent
Fires a ViewRedrawEvent.- Parameters:
viewState- parameters used to redraw the view.
-
fireViewRepaintOccurredEvent
Fires a ViewRedrawEvent.- Parameters:
g- the graphics instance used to paint the view.
-
addStaticElement
Adds the specified static element to the list of elements that will be drawn in this view on top of geographic data. Static elements are displayed in the order they are added to a view.- Parameters:
staticElem- the static element to be added- See Also:
-
addStaticImage
Deprecated.Use addStaticElement insteadAdds the specified static image to the list of images that will be drawn in this view on top of geographic data. These images are positioned using the specified point and relatively to the corner of the view area specified by the relativeTo constant.- Parameters:
im- the imagept- the position of the image relative to the specified cornerrelativeTo- a constant from KStaticImage class used to specify the corner near which the image will be drawn- See Also:
-
addViewEventListener
Adds a listener to the list of view event listeners.- Parameters:
listener- the event listener to add
-
removeViewEventListener
Removes a listener from the list of view event listeners.- Parameters:
listener- the event listener to remove
-
applySettings
Sets the settings for the view- Parameters:
settings- the ViewSettings instance containing the settings- See Also:
-
drawStaticElements
Draws view static elements.- Parameters:
gr- the graphics instance wrapper to use.t- the view transformation matrix.viewBounds- the view bounds to draw.
-
fireViewChanged
public void fireViewChanged() -
getCenterOfView
Returns the coordinate of the center of the view in DC coordinates.- Returns:
- the center of the view in DC coordinates
-
getDCViewBounds
Returns the coordinate of the center of the view in DC coordinates.- Returns:
- the center of the view in DC coordinates
-
getDisplayUnit
This method returns the Display unit. Note that depending on the scale the alternative Display unit might be used, so the use of the getCurrentDisplayUnit() method should be considered- Returns:
- the main display unit for this view
-
getDistanceUnit
- Returns:
- the current distance unit for this view
-
getGraphicsManager
Returns the graphics manager of the current view. Useful for drawing synchronization.- Returns:
- Returns the graphicsManager.
-
getInitialViewBounds
Gets the intial view bounds- Returns:
- initialViewBounds
-
getLayerManager
Returns the LayerManager object associated with this view. active.- Returns:
- the layer manager of the view
-
getMapProjection
Returns the current map data projection.- Returns:
- the map data projection.
-
getMeasurementProjection
-
getMapUnit
Returns the current map data unit.- Returns:
- the current map data unit.
-
getMaxViewBounds
Returns the maximum bounds of this view- Returns:
- maximum bounds of this view
-
getRotation
public double getRotation()Returns the view rotation angle in degrees.- Returns:
- the rotation angle
-
getScaleFactor
public double getScaleFactor()Computes the view current scale factor denominator. The scale expresses the ratio between the size of the elements displayed on the screen and the real sizes in world coordinates.- Returns:
- the view scale factor denominator as in (1 : denominator)
-
getScaleFactor
public double getScaleFactor(double dcScale) Computes a scale factor denominator. The scale expresses the ratio between the size of the elements displayed on the screen and the real sizes in world coordinates.- Parameters:
dcScale- the ratio between DC and WC coordinates.- Returns:
- the scale factor denominator as in (1 : denominator)
-
getStaticElements
Returns view static elements added to this view.- Returns:
- an array view static elements.
-
getTransform
Returns the K2DTransform object associated with this view.- Returns:
- the transformation of the view
-
getVerbose
public boolean getVerbose()Returns the verbose mode for this view.- Returns:
- the verbose mode.
-
getViewSettings
Returns the current view settings.- Returns:
- a ViewSettings instance with the current settings
-
getViewState
Returns the current state of the view, including all parameters needed to restore the current state.- Returns:
- the current state of the view.
-
getWCViewBounds
Returns a Rectangle object representing the area of the view in WC.- Returns:
- the area of the view in WC coordinates
-
getZoomLevel
public double getZoomLevel()Gets the zoom level expressed in the current map units- Returns:
- the zoom level
-
isRefreshable
public boolean isRefreshable()Returns whether the view is refreshable.- Returns:
- a boolean value that specifies whether the view is refreshable.
-
moveTo
Makes the specified WC coordinate the new center of the view- Parameters:
coord- the new center WC coordinate of the view
-
moveTo
public void moveTo(double x, double y) Makes the specified WC coordinate the new center of the view.- Parameters:
x- the new x valuey- the new y value
-
pan
public void pan(int xdc, int ydc) Adjusts the view in order to display a region that corresponds to the current region translated by xDC in x and yDC in y (in DC).- Parameters:
xdc- the translation in x expressed in DC coordinatesydc- the translation in y expressed in DC coordinates
-
removeStaticElement
Removes the specified static element from the list.- Parameters:
staticElem- the static element to be removed- See Also:
-
setDisplayUnit
Sets the unit to use when displaying coordinates. A PropertyChangeEvent event is fired (propertyName : PROPERTY_DISPLAY_UNIT).- Parameters:
unit- the main display unit to use on this view- See Also:
-
setDistanceUnit
Sets the unit to use when displaying distances. A PropertyChangeEvent event is fired (propertyName : PROPERTY_DISTANCE_UNIT).- Parameters:
unit- the distance unit to use on this view- See Also:
-
setInitialViewBounds
Sets the initial view bounds- Parameters:
initialViewBounds- The initial view bounds.
-
setMapUnit
Sets the unit for this map. A PropertyChangeEvent event is fired (propertyName : PROPERTY_MAP_UNIT).- Parameters:
unit- the corresponding JMapUnit instance.- See Also:
-
setMaxViewBounds
Sets the maximum view bounds where the user will be able to zoom/pan- Parameters:
maxBounds-
-
setMaximumScale
public void setMaximumScale(double scale) Sets the View object maximum scale. This value is automatically respected when zoom operations are executed on the view.- Parameters:
scale- the maximum scale
-
setRotation
public void setRotation(double angle) Rotates the map to the specified angle in degrees. A PropertyChangeEvent event is fired (propertyName : PROPERTY_MAP_ROTATION).- Parameters:
angle- the absolute angle in degrees (0 means north is straight up)- See Also:
-
setVerbose
public void setVerbose(boolean verbose) Sets the verbose mode for this view.- Parameters:
verbose- The verbose mode
-
zoom
Zooms by the specified factor and around specified point. A zoom factor between 0 and 1 will result in a "zoom out" operation and a factor greater than 1 will result in a "zoom in" operation.- Parameters:
factor- the zooming factorWCPt- the center of the zoom operation in WC
-
zoom
public void zoom(double factor) Zooms by the specified factor and around the center of the view. A zoom factor between 0 and 1 will result in a "zoom out" operation and a factor greater than 1 will result in a "zoom in" operation.- Parameters:
factor- the zooming factor
-
zoom
Zooms to the specified WC region (rect). This method ensures that all the region specified by rect will be visible.- Parameters:
rect- the WC region to zoom to.
-
zoom
Zooms to the specified WC region (rect). This method ensures that all the region specified by rect will be visible.- Parameters:
rect- the WC region to zoom to.
-
zoomExtent
public void zoomExtent()Adjusts the view in order to display every element of every visible layer managed by the associated LayerManager object. -
setScale
public void setScale(double scaleFactor) Sets the new scale of the view.- Parameters:
scaleFactor- the scale denominator (pass 1000 for a scale of 1 : 1000)
-
moveBackward
public boolean moveBackward()Adjust the view in order to display the region that was displayed prior to the previous change in the view (similar to undo). Previous regions are maintained in a Stack object automatically.- Returns:
- true if a previous region is available
-
moveForward
public boolean moveForward()If moveBackward() was called, adjust the view in order to display the region that was displayed before the call to moveBackward() (similar to redo). Previous regions are maintained in a Stack object automatically.- Returns:
- true if a following region is available
-
zoomToRect
Deprecated.use zoom(OrientedRectangle) insteadZooms to the specified WC region (rect). This method ensures that all the region specified by rect will be visible.- Parameters:
rect- the region to zoom to.
-
addMarker
Adds a new marker to the view.- Parameters:
coord- The coordinate of the markertext- (Optional) the text of this marker, null if nonemarkerStyle- (Optional) the style of this marker, null if none- Returns:
- id of the marker added to the view
-
removeMarker
public void removeMarker(long markerId) Removes the specified marker from this view- Parameters:
markerId- the id of the marker to remove
-
clearMarkers
public void clearMarkers()Removes all the markers from this view -
setScaleValidator
-
getScaleValidator
-
setLayerRefreshManagerView
-