|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bbn.openmap.MapHandlerChild
com.bbn.openmap.OMComponent
com.bbn.openmap.proj.ProjectionFactory
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 |
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
protected java.beans.PropertyChangeSupport pcs
protected static ProjectionFactory instance
protected java.util.Vector projLoaders
Method Detail |
public static ProjectionFactory getInstance()
public static java.lang.String[] getAvailableProjections()
public static java.lang.Class getProjClassForName(java.lang.String name)
name
- the name of the projection, set in the pretty name of it's
ProjectionLoader.
public static int getProjType(java.lang.String projName)
projName
- the projection name from the Projection class.
public static Projection makeProjection(int newProjType, Projection p)
The centerLat
,centerLon
,
scale
,width
, and
height
parameters are taken from the given
projection, and the type is taken from the type argument.
newProjType
- the type for the resulting projectionp
- the projection from which to copy other parameterspublic static Projection makeProjection(int projType, float centerLat, float centerLon, float scale, int width, int height)
projType
- projection typecenterLat
- center latitude in decimal degreescenterLon
- center latitude in decimal degreesscale
- float scalewidth
- pixel width of projectionheight
- pixel height of projection
public static Projection makeProjection(java.lang.String projClassName, Projection p)
public static Projection makeProjection(java.lang.String projClassName, float centerLat, float centerLon, float scale, int width, int height)
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.
public static Projection makeProjection(java.lang.Class projClass, float centerLat, float centerLon, float scale, int width, int height)
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.
public static Projection getDefaultProjectionFromEnvironment()
public static Projection getDefaultProjectionFromEnvironment(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, float centerLat, float centerLon, float scale, int width, int height)
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.public Projection makeProjection(ProjectionLoader loader, float centerLat, float centerLon, float scale, int width, int height, java.util.Properties projProps)
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.
public void addProjectionLoader(ProjectionLoader loader)
public boolean removeProjectionLoader(ProjectionLoader loader)
public void clearProjectionLoaders()
public java.util.Iterator iterator()
public int numProjections()
public java.util.Collection 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 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 |