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.proj
Class ProjectionFactory

    java.lang.Object
      com.bbn.openmap.MapHandlerChild
          com.bbn.openmap.OMComponent
              com.bbn.openmap.proj.ProjectionFactory

All Implemented Interfaces:
  java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, LightMapHandlerChild, PropertyConsumer

public class ProjectionFactory
extends OMComponent

The ProjectionFactory creates Projections. It used to have Projection classes hard-coded into it which were accessable through static methods, but this paradigm has been changed slightly so the ProjectionFactory is actually a singleton which can be accessed by a ProjectionFactory.getInstance() static method. This was done so that the singleton, when added to the MapHandler, can look for ProjectionLoaders to dynamically add projections to the factory. For convenience, there are still some static methods on the ProjectionFactory class which use the singleton to create and return projection objects. Changes to the available projections can be discovered through property changes.

The ProjectionFactory singleton instance can be added to the MapHandler via the openmap.properties file by adding the ProjectionFactoryLoader to the openmap.components property. If you are using the openmap.properties file to configure your application, you MUST add the ProjectionFactoryLoader, or you won't see any projections.

Field Summary
`static java.lang.String` | `AvailableProjectionProperty` The property name that is fired when the list of available projections has changed.
`static java.lang.String` | `CENTER` Center lat/lon property parameter for new projections passed to ProjectionLoader.
`static java.lang.String` | `DATUM` Datum property parameter for new projections passed to ProjectionLoader.
`static java.lang.String` | `HEIGHT` Projeciton height (pixels) property parameter for new projections passed to ProjectionLoader.
`protected static ProjectionFactory` | `instance` Singleton instance.
`protected java.beans.PropertyChangeSupport` | `pcs` PropertyChangeSupport for letting listeners know about new projections that are available from the factory.
`protected java.util.Vector` | `projLoaders`
`static java.lang.String` | `SCALE` Scale property parameter for new projections passed to ProjectionLoader.
`static java.lang.String` | `WIDTH` Projection width (pixels) property parameter for new projections passed to ProjectionLoader.

Fields inherited from class com.bbn.openmap.OMComponent
`i18n, propertyPrefix`

Fields inherited from class com.bbn.openmap.MapHandlerChild
`beanContextChildSupport`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Method Summary
`void` | `addProjectionLoader(ProjectionLoader loader)`
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener pcl)`
`void` | `addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)` Method for BeanContextChild interface.
`void` | `clearProjectionLoaders()`
`void` | `findAndInit(java.lang.Object obj)` Using the MapHandler to find ProjectionLoaders being added from the application.
`void` | `findAndUndo(java.lang.Object obj)` Using the MapHandler to find ProjectionLoaders being removed from the application.
`protected void` | `fireLoadersChanged()`
`static java.lang.String[]` | `getAvailableProjections()` Returns an array of Projection names available from this factory.
`static Projection` | `getDefaultProjectionFromEnvironment()` Looks at the Environment settings for the default projection and returns a Projection suited for those settings.
`static Projection` | `getDefaultProjectionFromEnvironment(int width, int height)` Looks at the Environment settings for the default projection and returns a Projection suited for those settings.
`static ProjectionFactory` | `getInstance()` Get the singleton instance of the ProjectionFactory.
`static java.lang.Class` | `getProjClassForName(java.lang.String name)` Return the Projection Class with the given pretty name.
`java.util.Collection` | `getProjectionLoaders()`
`static int` | `getProjType(java.lang.String projName)` Deprecated. The notion of a projection type number is going away, use the class of the projection instead.
`java.util.Iterator` | `iterator()`
`static ProjectionFactory` | `loadDefaultProjections()` Convenience method to load default projections into the shared instance of the ProjectionFactory.
`static ProjectionFactory` | `loadDefaultProjections(ProjectionFactory pf)` Convenience method to load default projections into a ProjectionFactory.
`static Projection` | `makeProjection(java.lang.Class projClass, float centerLat, float centerLon, float scale, int width, int height)` Create a projection.
`static Projection` | `makeProjection(int projType, float centerLat, float centerLon, float scale, int width, int height)` Deprecated. The notion of a projection type number is going away, use the class of the projection instead.
`static Projection` | `makeProjection(int newProjType, Projection p)` Deprecated. The notion of a projection type number is going away, use the class of the projection instead.
`Projection` | `makeProjection(ProjectionLoader loader, float centerLat, float centerLon, float scale, int width, int height)` Call the provided ProjectionLoader to create the projection with the given parameters.
`Projection` | `makeProjection(ProjectionLoader loader, float centerLat, float centerLon, float scale, int width, int height, java.util.Properties projProps)` Call the provided ProjectionLoader to create the projection with the given parameters.
`static Projection` | `makeProjection(java.lang.String projClassName, float centerLat, float centerLon, float scale, int width, int height)` Create a projection.
`static Projection` | `makeProjection(java.lang.String projClassName, Projection p)` Makes a new projection based on the given projection class name and parameters from the given projection.
`int` | `numProjections()`
`boolean` | `removeProjectionLoader(ProjectionLoader loader)`
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener pcl)`
`void` | `removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)` Method for BeanContextChild interface.

Methods inherited from class com.bbn.openmap.OMComponent
`getProperties, getPropertyInfo, getPropertyPrefix, setProperties, setProperties, setPropertyPrefix`

Methods inherited from class com.bbn.openmap.MapHandlerChild
`addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, firePropertyChange, fireVetoableChange, getBeanContext, removeVetoableChangeListener, setBeanContext`

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

Field Detail

### CENTER

    public static final java.lang.String CENTER

  Center lat/lon property parameter for new projections passed to ProjectionLoader.

  See Also:
    Constant Field Values

### SCALE

    public static final java.lang.String SCALE

  Scale property parameter for new projections passed to ProjectionLoader.

  See Also:
    Constant Field Values

### HEIGHT

    public static final java.lang.String HEIGHT

  Projeciton height (pixels) property parameter for new projections passed to ProjectionLoader.

  See Also:
    Constant Field Values

### WIDTH

    public static final java.lang.String WIDTH

  Projection width (pixels) property parameter for new projections passed to ProjectionLoader.

  See Also:
    Constant Field Values

### DATUM

    public static final java.lang.String DATUM

  Datum property parameter for new projections passed to ProjectionLoader.

  See Also:
    Constant Field Values

### AvailableProjectionProperty

    public static final java.lang.String AvailableProjectionProperty

  The property name that is fired when the list of available projections has changed.

  See Also:
    Constant Field Values

### pcs

    protected java.beans.PropertyChangeSupport pcs

  PropertyChangeSupport for letting listeners know about new projections that are available from the factory.

### instance

    protected static ProjectionFactory instance

  Singleton instance.

### projLoaders

    protected java.util.Vector projLoaders

Method Detail

### getInstance

    public static ProjectionFactory getInstance()

  Get the singleton instance of the ProjectionFactory.

### getAvailableProjections

    public static java.lang.String[] getAvailableProjections()

  Returns an array of Projection names available from this factory.

### getProjClassForName

    public static java.lang.Class getProjClassForName(java.lang.String name)

  Return the Projection Class with the given pretty name.

  Parameters:
    `name` - the name of the projection, set in the pretty name of it's ProjectionLoader.
  Returns:
    Class of Projection, or null if not found.

### getProjType

    public static int getProjType(java.lang.String projName)

  Deprecated. The notion of a projection type number is going away, use the class of the projection instead.

  Return an int representing the OpenMap projection, given the name of the projection. Useful for setting a projection based on the name stated in a properties file.

  Parameters:
    `projName` - the projection name from the Projection class.
  Returns:
    the projection type number for that name.

### makeProjection

    public static Projection makeProjection(int newProjType,
                                            Projection p)

  Deprecated. The notion of a projection type number is going away, use the class of the projection instead.

  Makes a new projection based on the given projection and given type.

  The `centerLat`,`centerLon`, `scale`,`width`, and `height` parameters are taken from the given projection, and the type is taken from the type argument.

  Parameters:
    `newProjType` - the type for the resulting projection
    `p` - the projection from which to copy other parameters

### makeProjection

    public static Projection makeProjection(int projType,
                                            float centerLat,
                                            float centerLon,
                                            float scale,
                                            int width,
                                            int height)

  Deprecated. The notion of a projection type number is going away, use the class of the projection instead.

  Create a projection.

  Parameters:
    `projType` - projection type
    `centerLat` - center latitude in decimal degrees
    `centerLon` - center latitude in decimal degrees
    `scale` - float scale
    `width` - pixel width of projection
    `height` - pixel height of projection
  Returns:
    Projection

### makeProjection

    public static Projection makeProjection(java.lang.String projClassName,
                                            Projection p)

  Makes a new projection based on the given projection class name and parameters from the given projection.

### makeProjection

    public static Projection makeProjection(java.lang.String projClassName,
                                            float centerLat,
                                            float centerLon,
                                            float scale,
                                            int width,
                                            int height)

  Create a projection. If the Class for the classname can't be found, a Mercator projection will be returned.

  Parameters:
    `projClassName` - the classname of the projection.
    `centerLat` - center latitude in decimal degrees.
    `centerLon` - center latitude in decimal degrees.
    `scale` - float scale.
    `width` - pixel width of projection.
    `height` - pixel height of projection.
  Returns:
    Projection

### makeProjection

    public static Projection makeProjection(java.lang.Class projClass,
                                            float centerLat,
                                            float centerLon,
                                            float scale,
                                            int width,
                                            int height)

  Create a projection. If the class can't be found, a Mercator projection will be returned.

  Parameters:
    `projClass` - the class of the projection.
    `centerLat` - center latitude in decimal degrees.
    `centerLon` - center latitude in decimal degrees.
    `scale` - float scale.
    `width` - pixel width of projection.
    `height` - pixel height of projection.
  Returns:
    Projection

### getDefaultProjectionFromEnvironment

    public static Projection getDefaultProjectionFromEnvironment()

  Looks at the Environment settings for the default projection and returns a Projection suited for those settings. If there is a problem creating the projection, the default projection of the MapBean will be returned. The ProjectionFactory needs to be loaded with the Projection class described in the properties before this will return an expected projection.

  Returns:
    Projection from Environment settings.

### getDefaultProjectionFromEnvironment

    public static Projection getDefaultProjectionFromEnvironment(int width,
                                                                 int height)

  Looks at the Environment settings for the default projection and returns a Projection suited for those settings. If there is a problem creating the projection, the default projection of the MapBean will be returned. The ProjectionFactory needs to be loaded with the Projection class described in the properties before this will return an expected projection.

  Parameters:
    `width` - pixel height of projection. If 0 or less, the Environment.Width value will be used.
    `height` - pixel height of projection. If 0 or less, the Environment.Height value will be used.
  Returns:
    Projection from Environment settings, fit for the pixel height and width provided.

### makeProjection

    public Projection makeProjection(ProjectionLoader loader,
                                     float centerLat,
                                     float centerLon,
                                     float scale,
                                     int width,
                                     int height)

  Call the provided ProjectionLoader to create the projection with the given parameters. The parameters are converted to Properties before being passed to the ProjectionLoader.

  Parameters:
    `centerLat` - center latitude in decimal degrees.
    `centerLon` - center latitude in decimal degrees.
    `scale` - float scale.
    `width` - pixel width of projection.
    `height` - pixel height of projection.

### makeProjection

    public Projection makeProjection(ProjectionLoader loader,
                                     float centerLat,
                                     float centerLon,
                                     float scale,
                                     int width,
                                     int height,
                                     java.util.Properties projProps)

  Call the provided ProjectionLoader to create the projection with the given parameters. The parameters are converted to Properties before being passed to the ProjectionLoader. The ProjectionLoader should throw a ProjectionException from here if it has a problem creating the projection with the provided parameters.

  Parameters:
    `loader` - projection loader to use.
    `centerLat` - center latitude in decimal degrees.
    `centerLon` - center latitude in decimal degrees.
    `scale` - float scale.
    `width` - pixel width of projection.
    `height` - pixel height of projection.
    `projProps` - a Properties object to add the parameters to, which can include extra parameters that are needed by this particular projection loader. If null, a Properties object will be created.
  Returns:
    projection, or null if the projection can't be created.

### addProjectionLoader

    public void addProjectionLoader(ProjectionLoader loader)

### removeProjectionLoader

    public boolean removeProjectionLoader(ProjectionLoader loader)

### clearProjectionLoaders

    public void clearProjectionLoaders()

### iterator

    public java.util.Iterator iterator()

### numProjections

    public int numProjections()

### getProjectionLoaders

    public java.util.Collection getProjectionLoaders()

### fireLoadersChanged

    protected void fireLoadersChanged()

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)

### addPropertyChangeListener

    public void addPropertyChangeListener(java.lang.String propertyName,
                                          java.beans.PropertyChangeListener pcl)

  Description copied from class: `MapHandlerChild`
  Method for BeanContextChild interface. Uses the BeanContextChildSupport to add a listener to this object's property. You don't need this function for objects that extend java.awt.Component.

  Specified by:
    `addPropertyChangeListener` in interface `java.beans.beancontext.BeanContextChild`
  Overrides:
    `addPropertyChangeListener` in class `MapHandlerChild`

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)

### removePropertyChangeListener

    public void removePropertyChangeListener(java.lang.String propertyName,
                                             java.beans.PropertyChangeListener pcl)

  Description copied from class: `MapHandlerChild`
  Method for BeanContextChild interface. Uses the BeanContextChildSupport to remove a listener to this object's property. You don't need this function for objects that extend java.awt.Component.

  Specified by:
    `removePropertyChangeListener` in interface `java.beans.beancontext.BeanContextChild`
  Overrides:
    `removePropertyChangeListener` in class `MapHandlerChild`

### findAndInit

    public void findAndInit(java.lang.Object obj)

  Using the MapHandler to find ProjectionLoaders being added from the application.

  Specified by:
    `findAndInit` in interface `LightMapHandlerChild`
  Overrides:
    `findAndInit` in class `MapHandlerChild`

### findAndUndo

    public void findAndUndo(java.lang.Object obj)

  Using the MapHandler to find ProjectionLoaders being removed from the application.

  Specified by:
    `findAndUndo` in interface `LightMapHandlerChild`
  Overrides:
    `findAndUndo` in class `MapHandlerChild`

### loadDefaultProjections

    public static ProjectionFactory loadDefaultProjections()

  Convenience method to load default projections into the shared instance of the ProjectionFactory.

  Returns:
    ProjectionFactory shared instance.

### loadDefaultProjections

    public static ProjectionFactory loadDefaultProjections(ProjectionFactory pf)

  Convenience method to load default projections into a ProjectionFactory.

  Parameters:
    `pf` -
  Returns:
    ProjectionFactory

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