I'm nearing the first alpha release of my JTS Warped code. The only
package that will be included in this first release allows client code
to integrate angles with JTS geometry operations. The package contains
two (2) primary classes, BasicSurveyorsAngle and
BasicSurveyorsDirection, and a handfull of supporting classes.

You will be able to use the first release of JTS Warped to do
something like this:

// Get the geometry object you want to rotate.
Geometry target = (Some code to obtain or create a JTS geometry goes here.)

// Create your rotation angle using degrees, minutes, seconds, and
fractional seconds values.
BasicSurveyorsAngle angle = new BasicSurveyorsAngle(45, 0, 0, 0.0);

// Create the base point for your rotation.
Coordinate rotationBasePoint = new Coordinate(0,0);

// Rotate the goemtry.
angle.rotate(target, rotationBasePoint);

Or something like this:

// Get the end points of a line.
Coordindate[] coords = someLineString.getCoordinates();

// Get the direction of the line.
BasicSurveyorsDirection direction = new
BasicSurveyorsDirection(coords[0], coords[1]);

// Create a new line along the same direction from the second endpoint
of the original line that is 100 units long.
LineString extension = direction.getLineStringAlongDirection(coords[1], 100.0);

You can view my source code here:

If you are a JTS fan, and are interested in working with angles and
directions in your JTS code, I'd like to get your comments on my code
before I make my first release. I'm mostly interested in the design of
the API. I can worry about style and peformance issues later.

The BasicSurveyorsAngle class has been unit tested, and should be
relatively bug free. I'm currently in the process of unit testing the
other main classes. I will make my release when this testing is
complete. This may be in the next two (2) or three (3) weeks?


The Sunburned Surveyor
jts-devel mailing list

Reply via email to