|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.formaria.svg.SvgImageMap
public class SvgImageMap
Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.
$Revision: 1.2 $
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected java.lang.String |
blockPrefix
|
protected java.lang.String |
rolloverPrefix
|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
SvgImageMap()
Class constructor. |
|
| Method Summary | |
|---|---|
void |
addActionListener(java.awt.event.ActionListener al)
Used to add an ActionListener to the list of action listeners. |
void |
addMapMouseListener(java.awt.event.MouseListener l)
Adds a mouse listener to this component to listen for mouse events. |
SVGDiagram |
display()
Displays the SVG image by adding the file to an SVGUniverse instance, extracting an SVGDiagram instance from SVGUniverse and displaying the diagram in an SVGDisplayPanel |
void |
drawAuxilaryImages(java.awt.Graphics2D g2d)
Draws the auxilary images within the image map component. |
void |
endCoalesce()
Stop coalescing, meaning the image will be repainted after the next pan or zoom action. |
protected void |
fireActionPerformed(java.awt.event.ActionEvent event)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireActionPerformed(java.awt.event.MouseEvent event)
Notifies all mouse listeners that have registered interest for notification on mouse event types. |
java.awt.image.BufferedImage |
getBufferedImage()
Returns the rendered buffered image of the svg displayed by this class |
double |
getCenterX()
Return the center position of the image on the x-axis. |
double |
getCenterY()
Return the center position of the image on the y-axis. |
javax.swing.JPanel |
getGlassPane()
Returns the glass pane component of the layered pane |
java.lang.String |
getImageName()
Returns the content of the image map. |
boolean |
getPreserveAspect()
Does the component preserve the aspect ratio of the image? |
double |
getScaleX()
Return the scaleFactor currently being applied to the x-axis. |
double |
getScaleY()
Return the scaleFactor currently being applied to the y-axis. |
java.lang.String |
getSelectedRollover(java.awt.event.MouseEvent e)
Returns the id of the rollover block currently selected. |
RenderingSemaphore |
getSemaphore()
Returns the semaphore used by this class to block on rendering events. |
SVGDiagram |
getSvgDiagram()
Returns the instance of the SVG diagram used to access the image data. |
SvgRolloverFinder |
getSvgRolloverFinder()
Get the compare interface |
java.lang.String |
getUrl()
Returns the url of the image displayed in the image map. |
java.net.URL |
getURL()
Used to return the URL pointing to the SVG image that is being displayed. |
java.awt.geom.Point2D |
glassPaneToSvg(double x,
double y)
Converts a coordinate from the glasspane coordinate system to the svg map coordinate system. |
void |
loadArrays()
Extracts Group objects from SVG file and loads them into the corresponding arrays |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Monitors mouse dragged events. |
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
Detect if mouse has exited the component and reset visible rollove to hidden. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Monitors mouse movement and calls checkBlock method. |
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
notifyListeners()
Notify all listening components that the svg has been re-rendered. |
void |
paintComponent(java.awt.Graphics g)
Used to paint a buffered image of the rendered svg to the component. |
void |
pan(double x,
double y)
Used to pan the image based on percentage of the current x and y locations. |
void |
removeActionListener(java.awt.event.ActionListener l)
Removes an ActionListener from the button. |
void |
removeMapMouseListener(java.awt.event.MouseListener l)
Removes a mouse listener to this component. |
void |
resetBuffer()
Reset the image buffer meaning that the image will be re-rendered the next time the paintComponent method is called. |
void |
resetPanning()
Resets the image to its original displayed coordinates. |
void |
resetZoom()
Resets the image to its original zoomed view. |
void |
resize()
Resizes the SVG image to fit the panel |
void |
setAuxilaryImages(java.awt.image.BufferedImage[] images)
Set the auxilary images to be displayed when dragging the image map. |
void |
setBlockPrefix(java.lang.String prefix)
Set the prefix for each block within the svg image. |
void |
setContent(java.lang.String value)
Set teh content |
void |
setDrawAuxImages(boolean b)
Sets whether the auxilary images are to be drawn or not. |
void |
setImage(java.awt.image.BufferedImage b)
Sets the buffered image to be painted. |
void |
setImageLocation(int x,
int y)
Set the location of the buffered image in the panel. |
void |
setImageName(java.lang.String attribValue)
Set the content of the image map. |
void |
setPanCoords(double x,
double y)
Set position of where the pan method is to begin panning from in the next pan action. |
void |
setPreserveAspect(boolean preserve)
Set the aspect ratio preservation flag |
void |
setRolloverPrefix(java.lang.String prefix)
Set the prefix for each rollover within the svg image. |
void |
setRollOverStatus(boolean setRollOvers)
Allow rollovers or not based on boolean value. |
void |
setSvgRolloverFinder(SvgRolloverFinder sim)
Set the compare interfaces for comparing groups/elements for identification of the rollovers |
void |
setURL(java.net.URL newUrl)
Used to set the URL pointing to the SVG image that is to be displayed. |
void |
setViewBox(double x,
double y,
double width,
double height)
Sets the viewbox at the specified coordinates and preserves the aspect ratio of the image. |
void |
setVisibility(java.lang.String group,
boolean v)
Sets the visibility of a group |
void |
startCoalesce()
Start coalesce, of panning and zooming actions. |
java.awt.geom.Point2D |
svgToGlassPane(double x,
double y)
Converts a coordinate from the svg map coordinate system to the glasspane coordinate system. |
void |
zoom(double zoom)
Zooms the image by the scaling factor specified. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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 |
| Methods 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods 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, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String blockPrefix
protected java.lang.String rolloverPrefix
| Constructor Detail |
|---|
public SvgImageMap()
| Method Detail |
|---|
public javax.swing.JPanel getGlassPane()
JPanel component returned
public java.awt.geom.Point2D glassPaneToSvg(double x,
double y)
x - a double specifying the x coordinate to be converted.y - a double specifying the y coordinate to be converted.
Point2D object containing the converted coordinates.
public java.awt.geom.Point2D svgToGlassPane(double x,
double y)
x - a double specifying the x coordinate to be converted.y - a double specifying the y coordinate to be converted.
Point2D object containing the converted coordinates.public void setSvgRolloverFinder(SvgRolloverFinder sim)
sim - the comparison classpublic SvgRolloverFinder getSvgRolloverFinder()
public void setBlockPrefix(java.lang.String prefix)
prefix - String specifying the block prefix.public void setRolloverPrefix(java.lang.String prefix)
prefix - String specifying the rollover prefix.public void setContent(java.lang.String value)
value - the path specifying the location of the SVG image.public void setURL(java.net.URL newUrl)
newUrl - URL object specifying the location of the SVG image.public java.net.URL getURL()
URL object returned specifying the location of the SVG image.public SVGDiagram display()
public void resetBuffer()
public void notifyListeners()
public void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - the delegate Graphics object.public void resize()
public void pan(double x,
double y)
x - double specifying the percentage to increase/decrease the x-coordinate by.y - double specifying the percentage to increase/decrease the y-coordinate by.public void resetPanning()
public void zoom(double zoom)
zoom - double specifying the scaling factor.public void startCoalesce()
public void endCoalesce()
public void setPanCoords(double x,
double y)
x - double specifying the x coordinate of where the image is to be panned from.y - double specifying the y coordinate of where the image is to be panned from.public void resetZoom()
public void setAuxilaryImages(java.awt.image.BufferedImage[] images)
images - BufferedImage array containing the auxilary images to be displayed.public void drawAuxilaryImages(java.awt.Graphics2D g2d)
g2d - the Graphics2D object used to draw the images.public void setDrawAuxImages(boolean b)
b - boolean specifying whether the auxilary images are to be drawn or not.public RenderingSemaphore getSemaphore()
public void setImageLocation(int x,
int y)
x - the x coordinate of the buffered image.y - the y coordinate of the buffered image.public void setImage(java.awt.image.BufferedImage b)
b - BufferedImage set to true if movable image is to be repainted.public java.awt.image.BufferedImage getBufferedImage()
BufferedImage instancepublic SVGDiagram getSvgDiagram()
public void setViewBox(double x,
double y,
double width,
double height)
x - double specifying the x coordinatey - double specifying the y coordinatewidth - double specifying the widthheight - double specifying the heightpublic void loadArrays()
public void setVisibility(java.lang.String group,
boolean v)
group - String specifying the SVG grouping to be displayedv - boolean specifying whether the group is to be set visible or hiddenpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenere - the MouseEvent that occuredpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - the MouseEvent that occuredpublic void setImageName(java.lang.String attribValue)
attribValue - Object specifying the content.public java.lang.String getImageName()
String specifying the content value.public java.lang.String getUrl()
String specifying the content value.public void setRollOverStatus(boolean setRollOvers)
setRollOvers - boolean used to set if rollovers are to be allowed or not.public double getScaleX()
public double getScaleY()
public double getCenterX()
public double getCenterY()
public void addMapMouseListener(java.awt.event.MouseListener l)
l - the MouseListener that is to be added.public void removeMapMouseListener(java.awt.event.MouseListener l)
l - the MouseListener that is to be removed.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void addActionListener(java.awt.event.ActionListener al)
ActionListener to the list of action listeners.
al - the listener to be addedpublic void removeActionListener(java.awt.event.ActionListener l)
ActionListener from the button.
If the listener is the currently set Action
for the button, then the Action
is set to null.
l - the listener to be removedprotected void fireActionPerformed(java.awt.event.MouseEvent event)
event
parameter.
event - the MouseEvent objectprotected void fireActionPerformed(java.awt.event.ActionEvent event)
event
parameter.
event - the ActionEvent objectEventListenerListpublic java.lang.String getSelectedRollover(java.awt.event.MouseEvent e)
e - the triggered MouseEvent.
String.public boolean getPreserveAspect()
public void setPreserveAspect(boolean preserve)
preserve - true to preserve the aspect
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||