[Marble-devel] Review Request: Default range normalization of GeoDataCoordinates

Bernhard Beschow bbeschow at cs.tu-berlin.de
Tue May 22 10:50:44 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104990/#review14035
-----------------------------------------------------------


I wonder if it is a good idea to "fix" wrong usage of our API because "fixing" introduces the potential of surprises. I'd expect the API to return garbage if I pass garbage (garbage-in-garbage-out principle) rather than having it perform arbitrary changes in the background. After all, fixing usually depends on the context and in addition, there are more efficient methods to ensure intended behavior of corner cases such as unit tests.

Moreover, I don't like the flags approach which adds even more complexity to our API. In particular, it'll be hard to predict the behavior of instances of GeoDataCoordinates ("does the instance normalize or not?"). I think that a isNormalized() method, perhaps in conjunction with Q_ASSERT(), could catch wrong usage of our API and will not add additional complexity.

- Bernhard Beschow


On May 19, 2012, 9:15 a.m., Dennis Nienhüser wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104990/
> -----------------------------------------------------------
> 
> (Updated May 19, 2012, 9:15 a.m.)
> 
> 
> Review request for Marble.
> 
> 
> Description
> -------
> 
> We don't officially support non-normalized coordinates (lon outside -180...180 degree, lat outside -90..90 degree). To avoid potential pitfalls when developers using Marble as a library ignore that, it might make sense to normalize coordinates behind the scenes. The patch adds that for GeoDataCoordinates, which should cover most cases. It's controlled by a flag (using QFlags for future extensibility) which defaults to normalization.
> 
> 
> Diffs
> -----
> 
>   src/lib/geodata/data/GeoDataCoordinates.h 8929430 
>   src/lib/geodata/data/GeoDataCoordinates.cpp c1563a6 
>   src/lib/geodata/data/GeoDataCoordinates_p.h 14c5164 
> 
> Diff: http://git.reviewboard.kde.org/r/104990/diff/
> 
> 
> Testing
> -------
> 
> The major concern should be performance.
> 
> Loading a long route (2500 km, 35.000 coordinates), the performance was pretty much identical (~200 ms) for several runs with and without normalization
> 
> The startup time for parsing the various files at startup increases slighty from around 1200 ms on my system to around 1300 ms. We might reduce this difference when we remove now unnecessary calls to normalizeLonLat e.g. in GeoDataLatLonBox::fromString. It could even lead to performance improvements later on.
> 
> A callgrind log measuring the start, initialization and shutdown of Marble shows that 0.07% of the time (110.000 calls) was spent in normalizeLonLat(). From that 50.000 calls could be spared when removing the normalization in GeoDataLatLonBox::fromString. In summary, the runtime overhead seems to be small.
> 
> 
> Thanks,
> 
> Dennis Nienhüser
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20120522/7ccba22e/attachment.html>


More information about the Marble-devel mailing list