Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.layer.mysql
Class MysqlGeometryLayer

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  com.bbn.openmap.Layer
                      com.bbn.openmap.layer.OMGraphicHandlerLayer
                          com.bbn.openmap.layer.mysql.MysqlGeometryLayer

All Implemented Interfaces:
  java.awt.event.ActionListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, GestureResponsePolicy, java.awt.image.ImageObserver, java.awt.MenuContainer, ProjectionListener, ProjectionPainter, PropertyConsumer, java.io.Serializable

public class MysqlGeometryLayer
extends OMGraphicHandlerLayer

This layer is for the reading and display of any spatial data retrieved from a MySQL Database (Version 4.1). At this time MySQL 4.1 is available only as alfa release, and represents the first version with support for the Datatype Geometry. Therefore, be careful in expecting too much. Usefull information can be found in the chapter 9 of the MySQL Reference (Spatial Extensions in MySQL) http://www.mysql.com/documentation/mysql/bychapter/index.html#GIS_spatial_extensions_in_MySQL partially this layer is inspired by Ian Batley's OracleSpatialLayer which can be found on the on the OpenMap website. Thanks Ian.

MysqlGeometryLayer uses at this stage a set of Classes which wraps the Geometries retrieved from the database. They are thougth to be a provisorium until a nice MySQL Geometry API is available. Coordinate values are stored as values of double precision in arrays as a sequence of Latitude/Longitude pairs. This differs from tha database where values are stored as X/Y or Easting/Northing pairs.

Properties to be set:

      mygeo.prettyName=&ltYour Layer Name&gt
      mygeo.dbUrl=&lt Driver Class &gt eg.  "jdbc:mysql://localhost/openmap?user=me&password=secret"
      mygeo.dbClass=&lt Driver Class &gt eg. "com.mysql.jdbc.Driver"
      mygeo.geomTable=&ltDatabase Tablename&gt
      mygeo.geomColumn=&ltColumn name which contains the geometry&gt
      mygeo.pointSymbol=&ltFilename and path for image to use for point objects&gtDefault is
      # Optional Properties - use as required
      # NOTE: There are default for each of these
      mygeo.lineColor=&ltColor for lines&gtDefault is red
      mygeo.lineWidth=&ltPixel width of lines&gtDefault is 0
      mygeo.fillColor=&ltColor of fill&gtDefault is red

Copyright 2003 by the Author

Version:
  1.0
Author:
  Uwe Baier uwe.baier@gmx.net
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected java.sql.Connection` | `conn` Connection to server.
`protected java.lang.String` | `dbClass` ; The driver to use.
`static java.lang.String` | `dbClassProperty` The property to use for specifing the driver: dbClass
`protected java.lang.String` | `dbUrl` ; The connection String to use for the jdbc query, e.g.
`static java.lang.String` | `dbUrlProperty` The Property to set for the query: dbUrl .
`protected DrawingAttributes` | `drawingAttributes`
`protected java.lang.String` | `geomColumn` Column name which contains the geometry to be used.
`static java.lang.String` | `geomColumnProperty` Property to specify geomColumn in the Database: geomColumn
`protected java.lang.String` | `geomTable` Table name which contains the geometry to be used.
`static java.lang.String` | `geomTableProperty` Property to specify geomTable in the Database: geomTable .
`protected java.lang.String` | `pointSymbol` The point Symbol set by the Properties
`static java.lang.String` | `pointSymbolProperty` Property to specify GIF or image file(symbol) to use for Points: pointSymbol .
`protected java.sql.ResultSet` | `rs` The result set object.
`protected java.sql.Statement` | `stmt` Statement to be executed for queries.

Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
`consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty`

Fields inherited from class com.bbn.openmap.Layer
`addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, windowSupport`

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 com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`MysqlGeometryLayer()`

Method Summary
`protected OMGraphic` | `createGraphic(MysqlGeometry mg)` Method chooses what type of geometry to render.
`protected OMGraphic` | `createLine(MysqlLine myLine)` Method createLine.
`protected OMGraphic` | `createPoint(MysqlPoint myPoint)` Method createPoint.
`protected OMGraphic` | `createPolygon(MysqlPolygon myPoly)` Method createPolygon.
`OMGraphicList` | `prepare()` This is the main method you should be concerned with when overriding this class.
`void` | `setProperties(java.lang.String prefix, java.util.Properties properties)` The properties and prefix are managed and decoded here.

Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
`canSetList, copy, createLayerWorker, cut, deselect, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRenderPolicy, getSelected, getToolTipTextFor, getTransparency, getTransparencyAdjustmentPanel, highlight, interrupt, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, setCancelled, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete`

Methods inherited from class com.bbn.openmap.Layer
`actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getGUI, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isRemovable, notifyHideHack, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setIcon, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setRemovable, setVisible, setWindowSupport, showPalette`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Field Detail

### dbUrl

    protected java.lang.String dbUrl

  ; The connection String to use for the jdbc query, e.g. "jdbc:mysql://localhost/openmap?user=me&password=secret"

### dbUrlProperty

    public static final java.lang.String dbUrlProperty

  The Property to set for the query: dbUrl .

  See Also:
    Constant Field Values

### dbClass

    protected java.lang.String dbClass

  ; The driver to use.

### dbClassProperty

    public static final java.lang.String dbClassProperty

  The property to use for specifing the driver: dbClass

  See Also:
    Constant Field Values

### conn

    protected java.sql.Connection conn

  Connection to server.

### rs

    protected java.sql.ResultSet rs

  The result set object.

### stmt

    protected java.sql.Statement stmt

  Statement to be executed for queries.

### geomTable

    protected java.lang.String geomTable

  Table name which contains the geometry to be used.

### geomTableProperty

    public static final java.lang.String geomTableProperty

  Property to specify geomTable in the Database: geomTable .

  See Also:
    Constant Field Values

### geomColumn

    protected java.lang.String geomColumn

  Column name which contains the geometry to be used.

### geomColumnProperty

    public static final java.lang.String geomColumnProperty

  Property to specify geomColumn in the Database: geomColumn

  See Also:
    Constant Field Values

### pointSymbol

    protected java.lang.String pointSymbol

  The point Symbol set by the Properties

### pointSymbolProperty

    public static final java.lang.String pointSymbolProperty

  Property to specify GIF or image file(symbol) to use for Points: pointSymbol .

  See Also:
    Constant Field Values

### drawingAttributes

    protected DrawingAttributes drawingAttributes

Constructor Detail

### MysqlGeometryLayer

    public MysqlGeometryLayer()

Method Detail

### setProperties

    public void setProperties(java.lang.String prefix,
                              java.util.Properties properties)

  The properties and prefix are managed and decoded here.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Overrides:
    `setProperties` in class `OMGraphicHandlerLayer`
  Parameters:
    `prefix` - string prefix used in the properties file for this layer.
    `properties` - the properties set in the properties file.

### prepare

    public OMGraphicList prepare()

  Description copied from class: `OMGraphicHandlerLayer`
  This is the main method you should be concerned with when overriding this class. You have to make sure that this method returns an OMGraphicList that is ready to be rendered. That means they need to be generated with the current projection, which can be retrieved by calling getProjection().

  This method will be called in a separate thread if doPrepare() is called on the layer. This will automatically cause repaint() to be called, which lets java know to call paint() on this class.

  Note that the default action of this method is to get the OMGraphicList as it is currently set in the layer, reprojects the list with the current projection (calls generate() on them), and then returns the current list.

  If your layer needs to change what is on the list based on what the current projection is, you can either clear() the list yourself and add new OMGraphics to it (remember to call generate(Projection) on them), and return the list. You also have the option of setting a ListResetPCPolicy, which will automatically set the list to null when the projection changes before calling this method. The OMGraphicHandlerList will ignore a null OMGraphicList.

  NOTE: If you call prepare directly, you may need to call repaint(), too. With all invocations of this method that are cause by a projection change, repaint() will be called for you. The method is synchronized in case renderDataForProjection() gets called while in the middle of this method. For a different projection, that would be bad.

  Overrides:
    `prepare` in class `OMGraphicHandlerLayer`

### createPoint

    protected OMGraphic createPoint(MysqlPoint myPoint)

  Method createPoint. Renders a Point.

  Parameters:
    `myPoint` -

### createLine

    protected OMGraphic createLine(MysqlLine myLine)

  Method createLine. Renders a Linestring Geometry. ToDo: Holes

  Parameters:
    `myLine` - - Database object which will be rendered

### createPolygon

    protected OMGraphic createPolygon(MysqlPolygon myPoly)

  Method createPolygon. Renders a polygon geometry

  Parameters:
    `myPoly` - - Database object which will be rendered

### createGraphic

    protected OMGraphic createGraphic(MysqlGeometry mg)

  Method chooses what type of geometry to render.

  Parameters:
    `mg` - Database object which will be rendered

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details