Commit graph

246 commits

Author SHA1 Message Date
Paul Ramsey 500fe3af33 Basic co-linearity support. Remove touching cases from crossingdirection.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3426 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-17 00:19:27 +00:00
Paul Ramsey 04d43077be Add ST_CrossingDirection(line, line) bindings into SQL.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3425 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-16 23:43:02 +00:00
Paul Ramsey 768cd3ac72 First cut of line crossing function, and associated cunit tests.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3424 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-16 22:29:42 +00:00
Mark Cave-Ayland 29ec5b20ad Increase the amount of allocated memory by 3 bytes, so that if maxlength < 3 and we return just "..." then we still have enough space to store the string without clobbering memory.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3376 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-11 14:55:21 +00:00
Mark Cave-Ayland ddbd8474f5 Fix up a couple of errors in the new lwmessage_truncate() function found by Kevin - correct an off-by-one error in the code, and include a missing startpos offset in the end truncation code. Also ensure that if maxlength gets too small then we return "..." rather than crashing.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3375 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-11 13:46:29 +00:00
Mark Cave-Ayland 47d116374a Resolve local merge conflict from previous commit.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3374 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-10 12:36:28 +00:00
Mark Cave-Ayland f86114f64c Add new lwmessage_truncate() function to liblwgeom that will truncate a string to a maximum number of characters, adding a "..." to indicate where the string has been trimmed. Truncation can be specified to occur from either the start or end of the string as required. Also update the parser error handler to use the new function.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3373 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-10 12:32:40 +00:00
Mark Leslie 9bb3d0bde7 Porting the floating point comparison operator upgrade from the 1.3 branch.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3372 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-09 23:29:31 +00:00
Regina Obe c587643fc2 #GBT 80: ST_Multi seg faults when given MULTILINESTRING
git-svn-id: http://svn.osgeo.org/postgis/trunk@3362 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-05 12:33:20 +00:00
Mark Cave-Ayland e24e85a3ed Lightbulb moment: the fix for GBT#21: locate_along_measure: wrong values, invalid data required extra work as floating point errors could still be introduced by the removal of the memcpy(). In fact it was the clipping logic that was wrong, so this patch re-adds the memcpy() in the correct place(s) and corrects the clipping flags to remove this floating point error. With thanks to Stephen Davies.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3357 b70326c6-7e19-0410-871a-916f4a2858ee
2008-12-03 16:02:32 +00:00
Mark Cave-Ayland 0835b2fb6d Apply patch from strk to prevent unneccesary invocation of 'ar' when building liblwgeom.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3340 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-26 13:40:07 +00:00
Mark Cave-Ayland cb938b7564 Move lwgeom_contains_subgeoms() into liblwgeom core as it seems it is now required outside of lwgeom_dump.c.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3324 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-24 11:01:39 +00:00
Mark Cave-Ayland 678e623139 Add missing lwgeom_getcurve_inspected() function which is required for some of the latest GBT fixes.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3275 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-07 14:05:53 +00:00
Mark Cave-Ayland 77d5b7c78e Fix for GBT#68 - ST_Shift_Longitude doesn't work with MULTIPOINT. Looks like this was just a simple mistake in the code. I've also improved the error message to return the proper type name instead of just a number.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3253 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-05 11:06:22 +00:00
Mark Cave-Ayland 7b54f79534 Fix lwgeom_typename() not returning a valid string for any of the newer geometry types.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3243 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-04 14:09:53 +00:00
Mark Cave-Ayland f27e3fcbb5 Add missing serialized_lwgeom_from_hexwkb() function to liblwgeom which is required for adding liblwgeom support to pgsql2shp.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3223 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-31 10:41:37 +00:00
Mark Cave-Ayland 8e173fb266 Update the LWGEOM parser to provide error HINTs when being called from PostgreSQL, and update regression tests accordingly.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3113 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-15 15:03:54 +00:00
Mark Cave-Ayland e28c430e58 Nearly finish work on the new parser API. The key part of this patch is to alter the behaviour of the parser so that instead of generating errors directly, it returns an error code, error location and an error message. Hence the caller is now in charge of the behaviour when parsing invalid geometries, and so can ignore errors or proceed onto the next geometry if required. The regression test change is due to a change in an error message, since the error is now returned from the unparser before it even gets to GEOS.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3106 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-14 19:51:24 +00:00
Mark Cave-Ayland 2f63d64292 Rename parser_check_flags to current_parser_check_flags and unparser_check_flags to current_unparser_check_flags to clarify that these status variables only reflect the checks enabled for the current parse.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3095 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-13 13:16:14 +00:00
Mark Cave-Ayland 4227c1e549 Move the liblwgeom unparser example over to the dynptarray API which is the proper way to alter point arrays in memory.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3094 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-13 13:03:23 +00:00
Mark Leslie e23659e1a0 Rebuilt the box3d generation for circular strings to account for a special large-arc case. Fix for issue 58, includes regression test for the case.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3080 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-08 10:14:46 +00:00
Mark Cave-Ayland 971be1e74a Fix stupid mistake in the liblwgeom parser...
git-svn-id: http://svn.osgeo.org/postgis/trunk@3067 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-05 17:33:03 +00:00
Mark Cave-Ayland 74949bc755 Update LWGEOM unparser to (E)WKT/WKB to resturn a LWGEOM_UNPARSER_RESULT structure instead of just the WKT/WKB character array. This is the same work done for r3023 but applied to the unparser instead.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3026 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-28 19:48:17 +00:00
Mark Cave-Ayland 137120a034 With the advent of LWGEOM_PARSER_RESULT, it is now possible to get rid of the horrible SERIALIZED_LWGEOM hack for PostgreSQL 8.3 to allow us to return the size separate from the result. This is good as it removes another level of indirection from the parser. Note that the size field has now been added to the LWGEOM_PARSER_RESULT structure.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3025 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-28 16:18:12 +00:00
Mark Cave-Ayland b6083bfddc Update (E)WKT/WKB parser to return a structure (LWGEOM_PARSER_RESULT) instead of just the serialized lwgeom. This is in preparation for returning more detailed error information back to the caller.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3023 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-28 15:32:46 +00:00
Mark Cave-Ayland ddc7e96a1d Rename parser_check_flags to unparser_check_flags for the unparser to prevent linking error under OS X. Also add missing function prototype to silence compiler warning in the PiP code.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3021 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-27 08:19:18 +00:00
Mark Cave-Ayland a6a0bbc574 Add parser flags to the LWGEOM to (E)WKB/WKT parsers, similar to has already been done for the (E)WKB/WKT to LWGEOM parsers.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3012 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-25 21:50:19 +00:00
Mark Cave-Ayland e3a4081c51 Use __va_copy() to pass a copy of the variadic structure to lw_vasprintf() to solve ABI difference between 32bit/64bit architectures.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2998 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-23 21:32:19 +00:00
Mark Cave-Ayland 442d938075 Revert commit 2990: the real bug was that the LWDEBUG statement was incorrect rather than the code - the additional read_int() was causing an off-by-one error when outputting WKB causing several regression tests to fail.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2996 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-23 19:53:12 +00:00
Mark Cave-Ayland b53c6b8ebb Refactor the memory management routines to account for the fact that variadic functions can't be called directly from the initial allocators. Also solve issues related to differences between the system vasprintf() (if supplied) and the liblwgeom vasprintf() by renaming to lw_vasprintf() and using it throughout PostGIS. With all this in place, GBT#54 is fixed which is very useful when debugging ;)
git-svn-id: http://svn.osgeo.org/postgis/trunk@2995 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-23 19:44:57 +00:00
Paul Ramsey 2b6e3d5b0b Add cnt declaration where missing.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2990 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-22 22:59:47 +00:00
Mark Cave-Ayland 248a9bcb69 Update the code for unparsing LWGEOMs to WKB/WKT so that it includes the standard simple checks: LINESTRINGs must have > 2 points, POLYGONs must have closed rings and CIRCULARSTRINGs must have > 2 points and the number of points must be odd. There is still a little more work to do to allow flags to be passed into the parser to specify which checks should be enforced, much like has already been done for the parsing from WKB/WKT to LWGEOM.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2983 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-18 13:54:05 +00:00
Mark Cave-Ayland 552023181f Silence a few more compiler warnings that had appeared during my last few parser commits.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2972 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-16 22:43:31 +00:00
Mark Cave-Ayland 8a8f2140d6 Add an example of how the liblwgeom API can be used by other C programs to manipulate geometries and output the result. Currently the unparser.c program shows how a geometry can be constructed "on the fly" and then exported in both WKT and HEXWKB formats; however it gives programmers the potential to devise some very unique processing tools which can generate files that can be loaded into PostGIS.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2971 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-16 22:29:54 +00:00
Mark Cave-Ayland 29f98cefc4 Move the LWGEOM-specific functions from lwgeom_sqlmm.c into liblwgeom/lwsegmentize.c to ensure that liblwgeom can exist as a standalone library.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2970 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-16 18:44:49 +00:00
Mark Cave-Ayland 742d9515ca Allow a flags parameter to be passed into the WKT parser to determine which consistency checks are performed out of polygon ring closure, minimum number of points and odd number of points.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2949 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-09 21:10:46 +00:00
Mark Cave-Ayland 0f7eae6d0e Commit generated versions of the new parser files for people who do not have flex or bison installed.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2948 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-08 20:17:29 +00:00
Mark Cave-Ayland 8437f89419 Enhance geometry parser so that it keeps track of the current position during parsing. With a bit more work, this should allow error messages to pinpoint the exact location of an invalid geometry section or syntax error.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2947 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-08 20:16:04 +00:00
Mark Cave-Ayland b0641e9c1d Yet another update to the liblwgeom parser API - lwgeom_from_ewkt() has been renamed to serialized_lwgeom_from_ewkt() to indicate that the function returns a serialied LWGEOM rather than an unserialized LWGEOM structure.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2945 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-07 11:02:05 +00:00
Mark Cave-Ayland 9a8647cfe6 Fix -o option for flex; the output filename must be specified immediately after -o without any preceding white space. Per report from Jorgen Austvik.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2884 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-28 09:13:45 +00:00
Mark Cave-Ayland bdaf9c2271 Rename the new parser function ewkt_to_lwgeom() to lwgeon_from_ewkt() so that it matches the rest of the parser API
git-svn-id: http://svn.osgeo.org/postgis/trunk@2841 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-13 17:33:19 +00:00
Mark Cave-Ayland 49b827c8d6 Add some additional LWDEBUG(F) statements for debugging that I missed the first time around with the new debugging infrastructure
git-svn-id: http://svn.osgeo.org/postgis/trunk@2840 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-13 11:09:34 +00:00
Mark Cave-Ayland 4f8c4b5e8f More work on improving the EWKT/B parser; remove all references to allocator functions from outside of liblwgeom by generating wrapper functions with more meaningful names. As well as cleaning up the API, it also makes the code much more readable
git-svn-id: http://svn.osgeo.org/postgis/trunk@2839 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-13 10:50:56 +00:00
Mark Cave-Ayland 94babd74af Add the parser build rules back into the liblwgeom Makefile, so now any changes to either the lexer or parser source files will automatically invoke a rebuild of the relevant output files during make
git-svn-id: http://svn.osgeo.org/postgis/trunk@2820 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-03 09:28:38 +00:00
Mark Cave-Ayland 0e7e3e01d9 Fix liblwgeom requiring gcc to compile. By using macros and variables supplied by libtool, we can now detect the PIC flags and whether the compiler will accept additional gcc warning flags for developers
git-svn-id: http://svn.osgeo.org/postgis/trunk@2819 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-01 14:15:33 +00:00
Mark Cave-Ayland ffde636dc0 Split the basic geometry accessors into a separate static library liblwgeom.a; this potentially allows re-use of the liblwgeom functions from within PostGIS, or could be extended at a later date to include databases other than MySQL. This patch includes a change to the liblwgeom handler functions; instead of sprinkling init_pg_func()s around the source, I have changed the default liblwgeom handlers to make use of a callback to allow linked libraries to set their own handlers the first time any of them are called. I have also tidied up the parser API a little in liblwgeom.h, which means wktparse.h can be removed from all of the headers in the lwgeom/ directory, plus renamed wktunparse.c to lwgunparse.c to keep things similar to lwgparse.c. Finally, I renamed liblwgeom.c to lwutil.c to avoid confusion within the new interface. TODO: the liblwgeom Makefile has some gcc-specific options, but these can be fixed later - it seemed more important to make the warnings visible to developers.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2815 b70326c6-7e19-0410-871a-916f4a2858ee
2008-06-29 19:11:48 +00:00