[postgis-devel] Jdbc driver class patches - Request for comments

Markus Schaber schabios at logi-track.com
Thu Dec 9 07:53:37 PST 2004


Hello,

I just ran a cvs diff containing all additions to the PostGIS jdbc code.
As I noticed that there seems to be a lot of noise because of white
space and other formatting changes. I suspect this was caused by using
the automatic code reformatting capabilities in my IDE without thinking
before.

I re-ran the diff with the -b option, and removed some additional noise,
so the second diff is a lot more readable, but still contains some
noise. (If you want to play with it, the verbose one is expected to
apply cleanly.). If needed, I'll reformat the code to adhere to your
coding style, or split the patch into a reformat-only and a code change
patch.

The changes are:

- Some cleaned import statements (this was accomplished by accidentally
using Eclipse "organize imports" features.)

- Added or implemented the following methods to Geometry:
  - hashCode() - useful when using Geometries as Keys in java.util.Map
  - equals(Object) - for the same purpose
  - equals(Geometry) - Avoids runtime cast when caller compares two 
                       Objects known to be geometries
  - numPoints() - implements the corresponding OpenGis method.
  - getFirstPoint()
  - getLastPoint()
  - getTypeString(int) - returns the Type as a String.

- Provided appropriate overridden methods for the above in the Geometry
  subclasses.

- Removed misleading comment about the backend not supporting
GeometryCollection as I sucessfully created and used those with PostGIS
0.8.1 via psql.

- Reworked GeometryFactory to not create compiler errors any more.
  (it can be discussed whether it should throw an NoSuchMethodError
  instead of silently returning null, but the best approach would
  be to implement it, of course, perhaps using code from wkb4j.)

- Added the followin Methods to LineString:
  - reverse() - creates a new LineString with the points in the 
    reverse order
  - Added a length() method that calculates the length of the String
  - Added a getPoints() method to get all Points at once.

- Added a length() method to MultiLineString.

- Refactored PGgeometry.setValue. I moved the actual geometry creation
  into a static method. This way it can be used by some of our code that
  reads WKT without using Postgres.

- Added a distance(Point other) Method to Points. This method is
  used by the length() methods discussed above.



Most of the code is tested an in production here, but I cannot give any
guarantee that I covered all code pathes.

The additions are currently licensed under GPL, but we will re-license
it under LGPL when postgis jdbc switches to LGPL.





-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios at logi-track.com | www.logi-track.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cvs_diff
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20041209/5cf31e3d/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff_cleaned
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20041209/5cf31e3d/attachment-0001.ksh>


More information about the postgis-devel mailing list