Paul,

This is definitely something I would like to talk to you about some
more.I've come up with a very similar interface, but one that skips
the forward and reverse methods you defined. I think we are both
reaching for the same goal.

I'm camping this weekend, but I'll try to look over your e-mail and
code in more detail on Monday.

The Sunburned Surveyor

On 9/7/07, Paul Austin <[EMAIL PROTECTED]> wrote:
> I've come up with a very simple interface for projection algorithms. The
> purpose of this is to be model neutral (not tied to JTS), as such it is
> not for use by end users but instead for use in higher level libraries
> that would work on JTS geometries.
>
> public interface Projection {
>   void forward();
>
>   void reverse();
>
>   double getX();
>   void setX(double x);
>
>   double getY();
>   void setY(double y);
>
> }
>
>
> To perform a forward projection the code would be as follows.
>
>  projection.setX(lonDegrees);
>  projection.setY(latDegrees);
>  projection.forward();
>  x = projection.getX();
>  y = projection.getY();
>
>
>
> Reverse projection would be similar.
>
>  projection.setX(xMetres);
>  projection.setY(yMetres);
>  projection.reverse();
>  lonDegrees = projection.getX();
>  latDegrees = projection.getY();
>
> NOTE: The interface is not thread safe.
>
> The design goals were it must be simple and not require any temporary
> objects.
>
> A JTS wrapper for this would have the following two basic methods
>
>
>   public Coordinate forward(double x, double y, double z) {
>     projection.setX(x);
>     projection.setY(y);
>     projection.forward();
>     Coordinate coordinate = new Coordinate(projection.getX(),
> projection.getY(),z);
>     forwardPrecisionModel.makePrecise(coordinate);
>     return coordinate;
>   }
>
>   public Coordinate reverse(double x, double y, double z) {
>     projection.setX(x);
>     projection.setY(y);
>     projection.reverse();
>     Coordinate coordinate = new Coordinate(projection.getX(),
> projection.getY(),z);
>     reversePrecisionModel.makePrecise(coordinate);
>     return coordinate;
>   }
>
> plus a number of other methods to deal with all the JTS Geometry types,
> see attached for full implementation. Note that there could be a
> performance optimization for coordinate sequences to directly deal with
> the Projection interface.
>
> Most projections go to/from Geographics to a Cartesian system to go from
> one Cartesian to another Cartesian you would need a chained projection
> which goes from one to another.
>
> The last piece in the puzzle is to have a ProjectionFactory that can
> create projections from EPSG srid codes. There can be many factory
> implementations, e.g. one to wrap FME, one to wrap the Java Projection
> Library, one for JUMP specific projections and one for GeoTools. You
> would then interact with an instance of the factory to create your
> projections and then use either the Projection interface or the
> JtsProjection wrapper.
>
> What do you guys think?
>
> Paul
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to