|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.MapHandlerChild com.bbn.openmap.OMComponent com.bbn.openmap.proj.ProjectionFactory
public class ProjectionFactory
The ProjectionFactory creates Projections. It used to have Projection classes hard-coded into it which were accessible through static methods, but this paradigm has been changed slightly so the ProjectionFactory is a SoloMapComponent added to the MapHandler. It will attach itself to a MapBean if it finds one in the MapHandler.
The ProjectionFactory can look for ProjectionLoaders in the MapHandler to dynamically add projections to the factory. The ProjectionHandler can also create ProjectionLoaders from property settings. Changes to the available projections can be discovered through property changes.
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
Projection height (pixels) property parameter for new projections passed to ProjectionLoader. |
protected java.beans.PropertyChangeSupport |
pcs
PropertyChangeSupport for letting listeners know about new projections that are available from the factory. |
static java.lang.String |
ProjectionLoadersProperty
ProjectionFactory property used to designate new projection loaders that should be created from properties. |
protected java.util.Vector<ProjectionLoader> |
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, isolated |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
ProjectionFactory()
|
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()
|
java.lang.String[] |
getAvailableProjections()
Returns an array of Projection names available from this factory. |
Projection |
getDefaultProjectionFromEnvironment(Environment e)
Looks at the Environment settings for the default projection and returns a Projection suited for those settings. |
Projection |
getDefaultProjectionFromEnvironment(Environment environment,
int width,
int height)
Looks at the Environment settings for the default projection and returns a Projection suited for those settings. |
java.lang.Class<? extends Projection> |
getProjClassForName(java.lang.String name)
Return the Projection Class with the given pretty name. |
java.util.Collection<ProjectionLoader> |
getProjectionLoaders()
|
java.util.Properties |
getProperties(java.util.Properties props)
Create the properties to create ProjectionLoaders that this loader created. |
java.util.Iterator<ProjectionLoader> |
iterator()
|
static ProjectionFactory |
loadDefaultProjections()
Convenience method to load default projections into a ProjectionFactory that will be created. |
static void |
loadDefaultProjections(MapHandler mapHandler)
Convenience method to load a ProjectionFactory and default projections into the provided MapHandler. |
static ProjectionFactory |
loadDefaultProjections(ProjectionFactory pf)
Convenience method to load default projections into a ProjectionFactory. |
Projection |
makeProjection(java.lang.Class<? extends Projection> projClass,
java.awt.geom.Point2D center,
float scale,
int width,
int height)
Create a projection. |
Projection |
makeProjection(ProjectionLoader loader,
java.awt.geom.Point2D center,
float scale,
int width,
int height)
Call the provided ProjectionLoader to create the projection with the given parameters. |
Projection |
makeProjection(ProjectionLoader loader,
java.awt.geom.Point2D center,
float scale,
int width,
int height,
java.util.Properties projProps)
Call the provided ProjectionLoader to create the projection with the given parameters. |
Projection |
makeProjection(java.lang.String projClassName,
java.awt.geom.Point2D center,
float scale,
int width,
int height)
Create a projection. |
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. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Check the properties for those to create ProjectionLoaders. |
Methods inherited from class com.bbn.openmap.OMComponent |
---|
getPropertyInfo, getPropertyPrefix, setProperties, setPropertyPrefix |
Methods inherited from class com.bbn.openmap.MapHandlerChild |
---|
addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removeVetoableChangeListener, setBeanContext, setIsolated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CENTER
public static final java.lang.String SCALE
public static final java.lang.String HEIGHT
public static final java.lang.String WIDTH
public static final java.lang.String DATUM
public static final java.lang.String AvailableProjectionProperty
public static final java.lang.String ProjectionLoadersProperty
protected java.beans.PropertyChangeSupport pcs
protected java.util.Vector<ProjectionLoader> projLoaders
Constructor Detail |
---|
public ProjectionFactory()
Method Detail |
---|
public void setProperties(java.lang.String prefix, java.util.Properties props)
setProperties
in interface PropertyConsumer
setProperties
in class OMComponent
prefix
- the token to prefix the property namesprops
- the Properties
objectpublic java.util.Properties getProperties(java.util.Properties props)
getProperties
in interface PropertyConsumer
getProperties
in class OMComponent
props
- a Properties object to load the PropertyConsumer properties
into. If props equals null, then a new Properties object should be
created.
public java.lang.String[] getAvailableProjections()
public java.lang.Class<? extends Projection> getProjClassForName(java.lang.String name)
name
- the name of the projection, set in the pretty name of it's
ProjectionLoader.
public Projection makeProjection(java.lang.String projClassName, Projection p)
public Projection makeProjection(java.lang.String projClassName, java.awt.geom.Point2D center, float scale, int width, int height)
projClassName
- the classname of the projection.center
- Point2D center of the projection.scale
- float scale.width
- pixel width of projection.height
- pixel height of projection.
public Projection makeProjection(java.lang.Class<? extends Projection> projClass, java.awt.geom.Point2D center, float scale, int width, int height)
projClass
- the class of the projection.center
- Point2D center of the projection.scale
- float scale.width
- pixel width of projection.height
- pixel height of projection.
public Projection getDefaultProjectionFromEnvironment(Environment e)
public Projection getDefaultProjectionFromEnvironment(Environment environment, int width, int height)
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.
public Projection makeProjection(ProjectionLoader loader, java.awt.geom.Point2D center, float scale, int width, int height)
loader
- ProjectionLoader for projection typecenter
- center coordinate for projectionscale
- scale for projectionwidth
- pixel width of projectionheight
- pixel height of projection
public Projection makeProjection(ProjectionLoader loader, java.awt.geom.Point2D center, float scale, int width, int height, java.util.Properties projProps)
loader
- projection loader to use.center
- Point2D center of the projection.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.
public void addProjectionLoader(ProjectionLoader loader)
public boolean removeProjectionLoader(ProjectionLoader loader)
public void clearProjectionLoaders()
public java.util.Iterator<ProjectionLoader> iterator()
public int numProjections()
public java.util.Collection<ProjectionLoader> getProjectionLoaders()
protected void fireLoadersChanged()
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)
MapHandlerChild
addPropertyChangeListener
in interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener
in class MapHandlerChild
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)
MapHandlerChild
removePropertyChangeListener
in interface java.beans.beancontext.BeanContextChild
removePropertyChangeListener
in class MapHandlerChild
public void findAndInit(java.lang.Object obj)
findAndInit
in interface LightMapHandlerChild
findAndInit
in class MapHandlerChild
public void findAndUndo(java.lang.Object obj)
findAndUndo
in interface LightMapHandlerChild
findAndUndo
in class MapHandlerChild
public static void loadDefaultProjections(MapHandler mapHandler)
mapHandler
- the MapHandler to receive the default ProjectionFactorypublic static ProjectionFactory loadDefaultProjections()
public static ProjectionFactory loadDefaultProjections(ProjectionFactory pf)
pf
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |