[postgis-users] Bug in latest postgis svn snapshot method LineString.concat()

Eric Lam elam at lisasoft.com
Sun Aug 6 19:56:38 PDT 2006


Hello,

Not sure if there is a bug-reporting list ...
But I have been the LineString().concat method in my code and I keep 
getting errors ...

the line

 int count = points.length + points.length - (cutPoint ? 1 : 0);


should be

 int count = points.length + opoints.length - (cutPoint ? 1 : 0);

??????


pasted below is the code I copied from 
http://svn.refractions.net/postgis/trunk/jdbc2/src/org/postgis/LineString.java

    public LineString concat(LineString other) {
        Point[] points = this.getPoints();
        Point[] opoints = other.getPoints();

        boolean cutPoint = this.getLastPoint() == null
                || this.getLastPoint().equals(other.getFirstPoint());
        int count = points.length + points.length - (cutPoint ? 1 : 0);
        Point[] p = new Point[count];

        // Maybe we should use System.arrayCopy here?
        int i, j;
        for (i = 0; i < points.length; i++) {
            p[i] = points[i];
        }
        if (!cutPoint) {
            p[i++] = other.getFirstPoint();
        }
        for (j = 1; j < opoints.length; j++, i++) {
            p[i] = opoints[j];
        }
        return new LineString(p);
    }

Regards,
Eric Lam


-- 
LISAsoft http://www.lisasoft.com
38 Greenhill Road
Wayville SA 5034
Ph: +61 8 8272 1555
Fax: +61 8 8271 1199
-- 
The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.




More information about the postgis-users mailing list