public static Proj createOMProjection(Properties props,Projection defaultProj){
  float scale=PropUtils.floatFromProperties(props,SCALE,defaultProj.getScale());
  int height=PropUtils.intFromProperties(props,HEIGHT,defaultProj.getHeight());
  int width=PropUtils.intFromProperties(props,WIDTH,defaultProj.getWidth());
  Point2D llp=defaultProj.getCenter();
  float longitude=PropUtils.floatFromProperties(props,LON,(float)llp.getX());
  float latitude=PropUtils.floatFromProperties(props,LAT,(float)llp.getY());
  Class<? extends Projection> projClass=null;
  String projType=props.getProperty(PROJTYPE);
  ProjectionFactory projFactory=ProjectionFactory.loadDefaultProjections();
  if (projType != null) {
    projClass=projFactory.getProjClassForName(projType);
  }
  if (projClass == null) {
    projClass=defaultProj.getClass();
  }
  if (Debug.debugging("imageserver")) {
    Debug.output("ImageServerUtils.createOMProjection: projection " + projClass.getName() + ", with HEIGHT = "+ height+ ", WIDTH = "+ width+ ", lat = "+ latitude+ ", lon = "+ longitude+ ", scale = "+ scale);
  }
  Proj proj=(Proj)projFactory.makeProjection(projClass,new Point2D.Float(longitude,latitude),scale,width,height);
  return (Proj)proj;
}

public static Proj createOMProjection ( Properties props , Projection defaultProj ) { float scale = PropUtils . floatFromProperties ( props , SCALE , defaultProj . getScale ( ) ) ; int height = PropUtils . intFromProperties ( props , HEIGHT , defaultProj . getHeight ( ) ) ; int width = PropUtils . intFromProperties ( props , WIDTH , defaultProj . getWidth ( ) ) ; Point2D llp = defaultProj . getCenter ( ) ; float longitude = PropUtils . floatFromProperties ( props , LON , ( float ) llp . getX ( ) ) ; float latitude = PropUtils . floatFromProperties ( props , LAT , ( float ) llp . getY ( ) ) ; Class < ? extends Projection > projClass = null ; String projType = props . getProperty ( PROJTYPE ) ; ProjectionFactory projFactory = ProjectionFactory . loadDefaultProjections ( ) ; if ( projType != null ) { projClass = projFactory . getProjClassForName ( projType ) ; } if ( projClass == null ) { projClass = defaultProj . getClass ( ) ; } if ( Debug . debugging ( "imageserver" ) ) { Debug . output ( "ImageServerUtils.createOMProjection: projection " + projClass . getName ( ) + ", with HEIGHT = " + height + ", WIDTH = " + width + ", lat = " + latitude + ", lon = " + longitude + ", scale = " + scale ) ; } Proj proj = ( Proj ) projFactory . makeProjection ( projClass , new Point2D . Float ( longitude , latitude ) , scale , width , height ) ; return ( Proj ) proj ; }
create an openmap projection from the values stored in a properties object . the properties inside should be parsed out from a map request , with the keywords being those defined in the imageserverconstants interface . assumes that the shared instance of the projectionfactory has been initialized with the expected projections .
