aboutsummaryrefslogtreecommitdiff
path: root/src/projects.h
AgeCommit message (Collapse)Author
2018-12-30Merge projects.h into proj_internal.hEven Rouault
2018-12-30projects.h: remove deprecated XY, XYZ, LP, LPZ, UV, UVW, projUV and projUVW ↵Even Rouault
structures
2018-12-30projects.h: remove #ifdef __cpluplus test since it must now be included from ↵Even Rouault
C++ file due to C++ objects in struct PJconsts
2018-12-30Move PJ_OBJ members into struct PJconstsEven Rouault
2018-12-30Allocate PJ* as a C++ objectEven Rouault
2018-12-26cpp conversion: fix remaining warningsEven Rouault
2018-12-26cpp conversion: fix zero-as-null-pointer-constant warningsEven Rouault
2018-12-26cpp conversion: minimal steps to fix compilation errors, not warningsEven Rouault
2018-11-29Redirect epsg:XXXX and IGNF:XXXX CRS expansions to the database, and remove ↵Even Rouault
the data/epsg and data/IGNF files
2018-11-22Make proj_create_crs_to_crs() use proj_obj_create_operations() and use area ↵Even Rouault
of use argument, and make createFromUserInput() recognize init=epsg: / init=IGNF: in legacy mode, that is when proj_context_get_use_proj4_init_rules() is used
2018-11-14Implement RFC 2: Initial integration of "GDAL SRS barn" workEven Rouault
This work mostly consists of: - a C++ implementation of the ISO-19111:2018 / OGC Topic 2 "Referencing by coordinates" classes to represent Datums, Coordinate systems, CRSs (Coordinate Reference Systems) and Coordinate Operations. - methods to convert between this C++ modeling and WKT1, WKT2 and PROJ string representations of those objects - management and query of a SQLite3 database of CRS and Coordinate Operation definition - a C API binding part of those capabilities This is all-in-one squashed commit of the work of https://github.com/OSGeo/proj.4/pull/1040
2018-11-10Remove unused struct from projects.hKristian Evers
2018-10-16Move struct definitions for proj_list_* functions to proj.hKristian Evers
With projects.h not being available to outside users anymore we need to define PJ_UNITS, PJ_ELLPS, PJ_PRIME_MERIDIANS and PJ_OPERATIONS elsewhere. Related pj_get_*_ref() functions have been removed in favour of their proj_ namespaced counterparts. char pointers have been changed to const char pointers. Resolves #983 Resolved #1147 Make char pointers const
2018-10-16Change pj_mkparam to take const char pointerKristian Evers
pj_mkparam() and pj_mkparam_ws() doesn't alter the input string should therefore be const. This will be useful when making other changes to the code base later.
2018-09-21Remove misspelled-constant PJD_ERR_UNKNOW_UNIT_IDKristian Evers
Closes #853
2018-09-18Only allow usage of proj_api.h if explicit consent was givenKristian Evers
We want to flag that proj_api_h is now deprecated. With this commit it is now mandatory to #define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H before proj_api.h can be included. proj_api.h is used internally a bunch of places. Therefore ACCEPT_USE_OF_DEPRECATED_PROJ_API_H has been defined in projects.h and a few other necessary files to ensure that PROJ compiles. Closes #836
2018-08-11projects.h: use param[] variable-length member syntax with GCC >= 8 to fix ↵Even Rouault
optimization issue with gcc 8.2 (fixes #1084)
2018-08-11Fix wrong behaviour of torad_coord() with gcc 8.1 -O2 (fixes #1084)Even Rouault
torad_coord() of gie.c has this sequence: ``` if( cond ) axis = l->param + strlen ("axis="); n = strlen (axis); ``` When the if branch is evaluated, n is always zero even if on inspection axis is non empty The reason is that the struct ARG_list which is the type of l use a variable-length array for the param member struct ARG_list { paralist *next; char used; char param[1]; }; But this is not a proper way of declaring it, and gcc 8 has apparently optimizations to detect that l->param + 5 points out of the array, hence it optimizes strlen() to 0. Reported as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914 According to https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html, the proper way of declaring such arrays is to use [0]
2018-06-21Add support for deg, rad and grad in unitconvert (fixes #1052), and document ↵Even Rouault
that it supports numeric factors (refs #1053)
2018-05-30Fix warnings found by clang with new warning flags to be added in later commitEven Rouault
Fixes consist in: - no use of comma operator for multi statement purpose - avoid confusing comma in for loops first and third clauses - avoid implicit long to int casts by storing to long, or explicit bound checking before cast
2018-04-16Collect custom C99 math functions in proj_math.hKristian Evers
We are relying more and more on C99 math functions. On C89 systems where those functions are not available our own custom versions of those functions are used instead. So far these has been spread across the code base. This commit gathers them in the same file and introduces the proj_math.h header. The build system checks for C99 math functions. If not found the proj_math.h header make sure that C99 functions are defined as their pj_ equivalent. Ideally proj_math.h is included instead of math.h. This removes the need for any checks against HAVE_C99_MATH in the code making it easier to read. For this commit the functions hypot, log1p and asinh has been taken care of.
2018-03-11typo fix: Rename PJD_ERR_UNKNOW_UNIT_ID as PJD_ERR_UNKNOWN_UNIT_IDEven Rouault
Original mispelled constant kept for backward compatibility.
2018-02-12typedef some recurring function signaturesThomas Knudsen
2018-02-09Avoid XY, LP and UV datatype clashes with other libraries.Kristian Evers
Remove unnecessary definitions of UV and UVW from project.h that collides with external libraries. To prevent similar problems in the future the datatypes XY, LP, UV, XYZ, LPZ and UVW has been prefixed by PJ_ in proj.h and proj_internal.h
2018-02-07Shrink PJ_XXX_INFO structs, but keep same syntax. (#775)Thomas Knudsen
* Shrink PJ_XXX_INFO structs, but keep same syntax. A number of the fixed length strings in the INFO structs are simply reflections of material that already exists as static strings at a number of places in the library (or in the case of PJ_INFO, really *should* exist, and now is implemented). This PR replaces these cases of constant length strings with const char pointers. The usage syntax is unchanged, and so is the nice property of having the return value allocated on the stack, and hence not requiring explicit memory management by the caller. proj_info now only does setup once - and the searchpath entry of PJ_INFO is not arbitrarily truncated at 512 bytes. Repeated calls simply returns a copy of already prepared material. The id, description and definition entries of PJ_PROJ_INFO are now also guaranteed to hold the entire text of the corresponding static string, by being represented by a const char pointer to that actual static string. PJ_GRID_INFO and PJ_INIT_INFO (i.e. the two smallest INFO structs) are unchanged. * Eliminate pj_strlcpy - not needed anymore: Remining calls could safely be replaced by strncpy. * Extend PROJ_INFO with paths from pj_set_searchpath. NOTE: Need to call pj_set_searchpath before first call to proj_info Huge thanks to Kristian Evers and Even Rouault for comments, debugging and advice.
2018-02-01Remove Windows CE cruft (wince/msvc80)Mateusz Loskot
Closes #582
2018-02-01Remove unnecessary functions and restructure proj.def. Closes #728Kristian Evers
2018-01-31Renamed PJ_IO_UNITS_RADIANS to PJ_IO_UNITS_ANGULARThomas Knudsen
2018-01-31Introduce compatibility for cs2cs-style proj-strings into the 4D API.Thomas Knudsen
Parameters such as towgs84, nadgrids and geoidgrids was previously only handled by pj_transform(). This commit add a compatibility layer in proj_create() by calling the pj_cs2cs_emulation_setup() function. This function sets up a handful of predefined transformation objects on the PJ object that is being created. Each of these transformation objects are related to the cs2cs-style parameters we are trying to emulate in the 4D API. That is, if the +towgs84 parameters is used we create P->helmert with the parameters specified in +towgs84. Similarly for +axis, +nadgrids and +geoidgrids. When these transformation objects exists we use them in the prepare and finalize functions in pj_fwd/ pj_inv. If no cs2cs-style parametes are specified we skip those parts of the prepare and finalizing steps. Co-authored-by:Thomas Knudsen <thokn@sdfe.dk> Co-authored-by:Kristian Evers <kristianevers@gmail.com>
2018-01-08Discern between 2D projected and 3D cartesian linear units (#732)Thomas Knudsen
2018-01-03Introduce preparation/finalization steps in fwd/inv subsystem, supporting ↵Thomas Knudsen
arbitrary dimensionality in test code * Call trans func of same dimensionality as input in gie * Refactor prep/fin code for pj_fwd/pj_inv 2D,3D,4D * Remove prime meridian handling from pj_transform (now handled in pj_fwd_prepare/pj_inv_finalize) * Introduce prep/fin skips, mostly in support of axisswap and pipeline drivers * Refactor fwd/inv subsystem * pj_transform: Let pj_fwd/inv handle scaling * Let pj_fwd/inv3d fall back to 2D eventually
2017-12-17Declare non-local variables as const where possibleAaron Puchert
Having non-const variables of static lifetime or even global scope is usually a bad idea. These variables are inherently constants, and this should be enforced. This required marking some functions as not modifying input parameters and marking some pointers as pointers to const. One advantage is that the compiler usually puts const static variables in a read-only code segment, so they can't be modified physically. This can be verified with `nm` (on POSIX systems). To avoid changes to the public API, functions returning non-const pointers to data tables were left intact, but the returned data may not be modified. Internally we prefer using the proj_list_* functions over the pj_get_*_ref functions, because the former return const pointers.
2017-12-17Free format everywhere (#693)Thomas Knudsen
* Free format now in cmd lines, in gie, and in init files * Corrected handling of defaults * Add demo of integrated definition and validation * Repair stack-smashing memmove in get_init * repair paralist corruption, clean up debug output * Install test files for nmake builds * Add many improvements following suggestions by @schwehr * Be consistent in requiring lower case everywhere in gie.c Also, this Fixes #703 and Fixes #697
2017-11-27Replace some asserts by compile-time assertionsAaron Puchert
Decisions regarding the size of certain types are always made at compile time, hence this is where the assertion should take place. If the assertions fail, there is now a compiler error.
2017-11-25Improve API (#683)Thomas Knudsen
Increase the focus on PJ_COORD as primary datatype: Eliminate use of PJ_TRIPLET etc. Trim proj.h by removing material that has become unnecessary. Improve constness Make proj_factors work in proj.h space, by providing a trimmed down PJ_FACTORS (which even has more meaningful field names)
2017-11-22Avoid div-by-zero in rf setupThomas Knudsen
2017-11-20Replace pj_ell_set with reimplementation... (#675)Thomas Knudsen
* Replace pj_ell_set with reimplementation supporting ellipsoid inheritance * remove unreachable code from pj_ell_set.c * Swap steps, so ellps args are read first, in accordance with historical behaviour * Add ellipsoid tests to CI targets * Reduce some optimistic tolerances OS/X appears to have a slightly off float handling, resulting in differences at the nanometer level. Switching to 10 nm.
2017-11-15Support numerical factors only (#664)Thomas Knudsen
* Support numerical factors only * Make sure h positive. Improve some comments * Let pole overshoot check have effect even for geocentric latitudes * Factor-typological constants, now all returning false, for backwards compatibility
2017-11-13Removed remaining traces of the built in selftest system (#661)Thomas Knudsen
* Removed remaining traces of the builtin selftest system. Moved all functionality to test/gie * Updated Appveyor and Travis build scripts * Another appveyor script update
2017-11-11Merge pull request #647 from kbevers/use_have_c99_mathKristian Evers
Use HAVE_C99_MATH instead of _WIN32_ and __ANSI__
2017-11-10Use HAVE_C99_MATH instead of _WIN32_ and __ANSI__Kristian Evers
HAVE_C99_MATH was recently added to the build system as a safer way to determine if non-ansi math functions are available on the current system. Previously different combinations of tests including _WIN32_ and __ANSI__ have been in use, but cases where that strategy has failed is known. Hence this change to a hopefully more robust check of math function availability.
2017-11-08minor clean ups in and around proj_4D_api (#649)Thomas Knudsen
2017-11-06Eliminate the last traces of PJ_OBS (#643)Thomas Knudsen
PJ_OBS eliminated, API adjusted to reflect that we now have only one 4D data type. 2 new API functions added to determine output types of a PJ.
2017-11-05Improve ISO 19000 alignment (#639)Thomas Knudsen
* Discern between conversions and transformations
2017-11-05Pipeline cleanup (WIP) (#637)Thomas Knudsen
* Remove a number of debugging calls and memory management from the inner loop of the pipeline drivers * An attempt at handling inverted steps in a more straightforward way
2017-10-28Allow nested pipelines. (#629)Kristian Evers
Allow nested pipelines when wrapped in +init's. The previous behaviour was to quit pipeline initialization when encountering a nested pipeline definition. With this commit that behaviour is changed so that it is possible to nest pipelines as long as they are defined elsewhere in a init-file. This is useful in init-files where steps in complicated transformations can be grouped in "sub-pipelines". These "sub-pipelines" can then be used as individual steps in a larger and more complicated pipeline. Nested pipelines are governed by the following rules: 1. You can't have more than one literal +proj=pipeline in a proj-string 2. Pipelines can be nested if they are wrapped up in a +init 3. More than one +init is disallowed in non-pipeline proj-strings 4. +inits are expanded as late as possible, that is they will only be expanded in single operations (that can be a part of a pipeline)
2017-10-27Linguistics: Clarify this and that, here and there (#632)Thomas Knudsen
* Linguistics: Clarify this and that, here and there * Revert nullification of PJ_cart->fwd, inv
2017-10-25Remove PJ_OBS from the API surface, rename pj_obs_api.c to pj_4D_api.c (#625)Thomas Knudsen
* Remove PJ_OBS from the API surface, rename pj_obs_api.c to pj_4D_api.c * Repair proj.def
2017-10-20Addition of an "area of use" argument to proj_transform_crs_to_crs (#565)Kristian Evers
In anticipation of a late-binding implementation of the proj_transform_crs_to_crs function an area argument is added to the function prototype. The PJ_AREA struct is not in use yet, but will be when the function is more tightly coupled to the EPSG database in the future.
2017-10-19Prevent crashes and leaks on allocation failure (#606)Aaron Puchert
* Prevent crashes and leaks on allocation failure Memory allocation can fail. We need to gracefully handle this case and prevent dereferencing null pointers. * Make NULL checks consistent within a file * Properly report allocation errors * Improve cleanup in pj_gc_reader.c * Implement pj_strdup and use instead of strdup The function strdup is not part of ANSI C 89, but a POSIX extension. Therefore we can not rely on it being available on all platforms.