[Proj] C++ coding practices w.r.t object ownership

Martin Desruisseaux martin.desruisseaux at geomatys.com
Sun May 27 15:14:50 EST 2018

I have one minor suggestion. In crs.hh file, there is the following
comment in the GeodeticCRS class:

    // slight departure from standard. We can't override coordinateSystem() since
    // GeographicCRS::coordinateSystem() returns cs::EllipsoidalCS which is not
    // derived from GeodeticCS (GeodeticCS is a pseudo union) ...
    const cs::GeodeticCS &geodeticCoordinateSystem() const;

I would suggest to not try too hard to represent verbatim the « union »
constructs from ISO 19111, but rather focus on the intent. With this
GeodeticCS « union », ISO 19111 is trying to said that a GeodeticCRS
shall be associated only to an EllipsoidCS, CartesianCS or SphericalCS.
If it is possible to express this constraint in the C/C++ language (with
C union or whatever other construct may fit), good! If it is not
practical, then I think it is okay to just state the constraint in the
documentation. This is what we have done in Java for instance. Having a
second property returning a "CS-like" object gives the impression that
SingleCRS can be associated to two coordinate systems, which may be

Note: ISO 19111 do not define GeodeticCS as a parent of EllipsoidCS,
CartesianCS and SphericalCS because conceptually, "GeodeticCS" is not
really a kind of coordinate system. Another reason is that such
hierarchy would be very specific to GeodeticCRS needs and may fit the
needs of other CRS.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20180527/e7eedef1/attachment-0001.htm 

More information about the Proj mailing list