Class TLcdMagneticNorthGXYController
- All Implemented Interfaces:
ILcdUndoableSource,ILcdAWTEventListener,ILcdStatusSource,ILcdGXYChainableController,ILcdGXYController,KeyListener,MouseListener,MouseMotionListener,Serializable,EventListener
ILcdGXYView, this ILcdController
will catch each mouseClicked and try to modify the properties of the
ILcdProjection currently on the ILcdGXYView accordingly.
More specifically it re-centers the projection at the touched point and it will rotate the map such that the direction to the magnetic north (what a compass would indicate) is equal to the (vertical) direction to the top of your screen.
This controller will also display a tool tip showing the declination at the point under
the mouse cursor, see formatToolTip..
Note that the user of this class is responsible for giving this object a correctly initialized magnetic north map.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor, you will have to set a magnetic north map before the object is usable.TLcdMagneticNorthGXYController(ILcdMagneticNorthMap aMagneticNorthMap) Creates a newTLcdMagneticNorthGXYControllerwith the givenILcdMagneticNorthMap.TLcdMagneticNorthGXYController(Cursor aCursor) Constructs a new controller with the given cursor.TLcdMagneticNorthGXYController(Cursor aCursor, ILcdMagneticNorthMap aMagneticNorthMap) Creates a newTLcdMagneticNorthGXYControllerwith the given cursor and the givenILcdMagneticNorthMap. -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method will append the passed controller to the end of the chain.protected String[]formatToolTip(double aValue) Formats the tool tip for the given declination value.Returns the action that will be triggered after each recenter and rotation of the gxy.floatGets the height the cursor is assumed to be above the surface of the earth.Returns the label background color.Returns the font for used by the label displaying the declination.Returns the color of the font of the label displaying the declination.Returns the magnetic north map this controller is using.Returns a reference to the controller that is located after this one in a chain, or null if this controller is the last element of the chain.voidhandleAWTEvent(AWTEvent aEvent) This is method is called when the target of the listener has a new AWTEvent available.booleanReturns true if the label should be displayed, false otherwise.booleanReturns true if the map will be rotated such that the magnetic north is at the top of the map on a mouse click.voidmouseClicked(MouseEvent aMouseEvent) Invoked when a mouse button has been clicked on theILcdGXYViewcomponent.voidmouseDragged(MouseEvent aMouseEvent) voidInvoked when the mouse enters theILcdGXYViewcomponent.voidInvoked when the mouse exits theILcdGXYViewcomponent.voidmouseMoved(MouseEvent aMouseEvent) voidInvoked when a mouse button has been pressed on theILcdGXYViewcomponent.voidmouseReleased(MouseEvent aMouseEvent) voidEnables the controller to give visual feedback on the current user interactions.voidrestore()Restores the map rotation to normal.protected doubleretrieveDeclination(MouseEvent aMouseEvent) Returns the declination for the point associated with the current mouse position.voidsetActionToTrigger(ILcdAction aActionToTrigger) Sets anILcdActionto trigger just after having recentered and rotated theILcdGXYView.voidsetDisplayLabel(boolean aDisplayLabel) Sets whether this controller should display a label containing the declination at the point under the mouse cursor.voidsetHeightAboveSeaLevel(float aHeightAboveSeaLevel) Sets the height above the surface of the earth to perform the calculations for.voidsetLabelBackgroundColor(Color aLabelBackgroundColor) Sets a new background color for the label.voidsetLabelFont(Font aLabelFont) Sets a new font for the label displaying the declination.voidsetLabelFontColor(Color aLabelFontColor) Sets the font color of the label.voidsetMagneticNorthMap(ILcdMagneticNorthMap aMagneticNorthMap) Sets the magnetic north map this controller will use.voidThis method sets the next controller in the chain for this controller.voidsetRotateNorthToTopOnClick(boolean aRotateNorthToTopOnClick) Sets whether this controller should rotate the map such that the magnetic north is at the top of the map.voidstartInteraction(ILcdGXYView aView) Sets up the controller to receive input through the view passed.voidterminateInteraction(ILcdGXYView aGXYView) Releases a few items.Methods inherited from class com.luciad.view.gxy.controller.ALcdGXYSmartController
addUndoableListener, doPanGXYView, doZoomGXYView, fireUndoableEvent, getDownPanChars, getDownPanCodes, getLeftPanChars, getLeftPanCodes, getPanAbsDelta, getPanAbsDelta, getRightPanChars, getRightPanCodes, getUndoableListenerCount, getUpPanChars, getUpPanCodes, getZoomInChars, getZoomInCodes, getZoomOutChars, getZoomOutCodes, isDragging, isPanOnMouseDragExit, isPanOnMouseMoveExit, isPanUndoable, isRequestFocusOnMouseEntered, isRequestFocusOnMousePressed, isTraceOn, isZoomUndoable, keyPressed, keyReleased, keyTyped, removeUndoableListener, setDownPanChars, setDownPanCodes, setIsDragging, setLeftPanChars, setLeftPanCodes, setPanAbsDelta, setPanOnMouseDragExit, setPanOnMouseMoveExit, setPanUndoable, setRequestFocusOnMouseEntered, setRequestFocusOnMousePressed, setRightPanChars, setRightPanCodes, setTraceOn, setUpPanChars, setUpPanCodes, setZoomInChars, setZoomInCodes, setZoomOutChars, setZoomOutCodes, setZoomUndoable, updateViewLocationAfterZoomSFCTMethods inherited from class com.luciad.view.gxy.controller.ALcdGXYController
addStatusListener, asGXYController, fireStatusEvent, getCursor, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription, viewRepaintMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.gxy.ILcdGXYController
getCursor, getIcon, getLayered, getName, getShortDescription, viewRepaint
-
Constructor Details
-
TLcdMagneticNorthGXYController
public TLcdMagneticNorthGXYController()Default constructor, you will have to set a magnetic north map before the object is usable. -
TLcdMagneticNorthGXYController
Constructs a new controller with the given cursor. You will have to set a magnetic north map before the object is usable.- Parameters:
aCursor- The cursor for this controller
-
TLcdMagneticNorthGXYController
Creates a newTLcdMagneticNorthGXYControllerwith the givenILcdMagneticNorthMap. The object is ready to use.- Parameters:
aMagneticNorthMap- The magnetic north map the controller will use.
-
TLcdMagneticNorthGXYController
Creates a newTLcdMagneticNorthGXYControllerwith the given cursor and the givenILcdMagneticNorthMap.- Parameters:
aCursor- The cursor for this controlleraMagneticNorthMap- The magnetic north map this controller will use.
-
-
Method Details
-
setActionToTrigger
Sets anILcdActionto trigger just after having recentered and rotated theILcdGXYView. This can be used to set anotherILcdGXControllerafter each recenter.- Parameters:
aActionToTrigger- The action that will be triggered after each recenter and rotation of the gxy.- See Also:
-
getActionToTrigger
Returns the action that will be triggered after each recenter and rotation of the gxy.- Returns:
- the action that will be triggered after each recenter and rotation of the gxy.
- See Also:
-
getMagneticNorthMap
Returns the magnetic north map this controller is using.- Returns:
- the magnetic north map this controller is using.
- See Also:
-
setMagneticNorthMap
Sets the magnetic north map this controller will use.- Parameters:
aMagneticNorthMap- The magnetic north map this controller will use- See Also:
-
getLabelFontColor
Returns the color of the font of the label displaying the declination.- Returns:
- the color of the font of the label displaying the declination.
- See Also:
-
setLabelFontColor
Sets the font color of the label.- Parameters:
aLabelFontColor- The color for the font of the label.- See Also:
-
getLabelBackgroundColor
Returns the label background color.- Returns:
- the label background color.
- See Also:
-
setLabelBackgroundColor
Sets a new background color for the label.- Parameters:
aLabelBackgroundColor- The background color for the label.- See Also:
-
getLabelFont
Returns the font for used by the label displaying the declination.- Returns:
- the font for used by the label displaying the declination.
- See Also:
-
setLabelFont
Sets a new font for the label displaying the declination.- Parameters:
aLabelFont- The new font.- See Also:
-
isDisplayLabel
public boolean isDisplayLabel()Returns true if the label should be displayed, false otherwise.- Returns:
- true if the label should be displayed, false otherwise.
- See Also:
-
setDisplayLabel
public void setDisplayLabel(boolean aDisplayLabel) Sets whether this controller should display a label containing the declination at the point under the mouse cursor.- Parameters:
aDisplayLabel- True if the label has to be displayed, false otherwise.- See Also:
-
isRotateNorthToTopOnClick
public boolean isRotateNorthToTopOnClick()Returns true if the map will be rotated such that the magnetic north is at the top of the map on a mouse click.- Returns:
- True if the map will be rotated on mouse click, false otherwise.
- See Also:
-
setRotateNorthToTopOnClick
public void setRotateNorthToTopOnClick(boolean aRotateNorthToTopOnClick) Sets whether this controller should rotate the map such that the magnetic north is at the top of the map.- Parameters:
aRotateNorthToTopOnClick- True if the map should be rotated on mouse click, false otherwise.- See Also:
-
getHeightAboveSeaLevel
public float getHeightAboveSeaLevel()Gets the height the cursor is assumed to be above the surface of the earth.- Returns:
- The height the cursor is assumed to be above the surface of the earth. Unit is km.
- See Also:
-
setHeightAboveSeaLevel
public void setHeightAboveSeaLevel(float aHeightAboveSeaLevel) Sets the height above the surface of the earth to perform the calculations for.- Parameters:
aHeightAboveSeaLevel- The height the cursor is above the surface of the earth. Unit is km.- See Also:
-
startInteraction
Description copied from class:ALcdGXYControllerSets up the controller to receive input through the view passed.All
ILcdGXYViewimplementations that support interaction call this method when the controller has been made active withsetGXYControlleron the view, so this method shouldn't normally be called directly. Note that most view implementations add the controller as listener if appropriate before calling this method.Sets the cursor on the view and sets the view for which this controller is now active. Sends out a status event based on the
short description.- Specified by:
startInteractionin interfaceILcdGXYController- Overrides:
startInteractionin classALcdGXYSmartController- Parameters:
aView- theILcdGXYViewthisILcdGXYControllerwill interact with.- See Also:
-
terminateInteraction
Description copied from class:ALcdGXYControllerReleases a few items. Can be redefined but this 'super' method should be called too.- Specified by:
terminateInteractionin interfaceILcdGXYController- Overrides:
terminateInteractionin classALcdGXYSmartController- Parameters:
aGXYView- theILcdGXYViewthisILcdGXYControllerinteracted with.- See Also:
-
retrieveDeclination
Returns the declination for the point associated with the current mouse position.- Parameters:
aMouseEvent- the mouse event that contains the current mouse position.- Returns:
- the declination for the point associated with the current mouse position.
-
paint
Description copied from class:ALcdGXYControllerEnables the controller to give visual feedback on the current user interactions. Note that the controller is responsible for repainting the view.Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.
- Specified by:
paintin interfaceILcdGXYController- Overrides:
paintin classALcdGXYController- Parameters:
aGraphics- the Graphics on which the view was rendered.
-
formatToolTip
Formats the tool tip for the given declination value.- Parameters:
aValue- The declination value, as an angle in degrees.- Returns:
- The formatted array of strings. Every string is painted on a new line.
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classALcdGXYSmartController
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classALcdGXYSmartController
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classALcdGXYSmartController
-
restore
public void restore()Restores the map rotation to normal. -
mouseClicked
Invoked when a mouse button has been clicked on theILcdGXYViewcomponent.- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classALcdGXYSmartController
-
mousePressed
Invoked when a mouse button has been pressed on theILcdGXYViewcomponent.- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classALcdGXYSmartController
-
mouseEntered
Invoked when the mouse enters theILcdGXYViewcomponent.- Specified by:
mouseEnteredin interfaceMouseListener- Overrides:
mouseEnteredin classALcdGXYSmartController
-
mouseExited
Invoked when the mouse exits theILcdGXYViewcomponent.- Specified by:
mouseExitedin interfaceMouseListener- Overrides:
mouseExitedin classALcdGXYSmartController
-
getNextGXYController
Description copied from interface:ILcdGXYChainableControllerReturns a reference to the controller that is located after this one in a chain, or null if this controller is the last element of the chain.- Specified by:
getNextGXYControllerin interfaceILcdGXYChainableController- Returns:
- a reference to the next controller.
- See Also:
-
setNextGXYController
Description copied from interface:ILcdGXYChainableControllerThis method sets the next controller in the chain for this controller. You can set null if you want the chain to end. This method does not start or terminate any interaction. If you need to replace a controller while it's being used you are responsible for properly terminating and starting it yourself.- Specified by:
setNextGXYControllerin interfaceILcdGXYChainableController- Parameters:
aNext- the reference to the controller that will be the next element in the chain- See Also:
-
appendGXYController
Description copied from interface:ILcdGXYChainableControllerThis method will append the passed controller to the end of the chain. The controller will be the stored as the next controller in the last element of the current chain.- Specified by:
appendGXYControllerin interfaceILcdGXYChainableController- Parameters:
aEnd- the controller to be appended to the end of the chain.
-
handleAWTEvent
Description copied from interface:ILcdAWTEventListenerThis is method is called when the target of the listener has a new AWTEvent available.- Specified by:
handleAWTEventin interfaceILcdAWTEventListener- Parameters:
aEvent- The event to be handled.
-