Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix precision handling in GlobeCoordinateFormatter and GeoCoordinateFormatter #19

Merged
merged 4 commits into from Oct 9, 2014

Conversation

brightbyte
Copy link

This patch does two things:

  1. It makes GlobeCoordinbateFormatter pas the precision stored in GlobeCoordinateValues to the GeoCoordinateFormatter, so the precision used is the one stored in the value, not the one defined by the options.

  2. It changes the interpretation of "precision" used by the GeoCoordinateFormatter to be fractional degrees, as generated by the GlobeCoordinateParser and thus present in the database, instead of the previous interpretation "number of decimal digits".

daniel added 2 commits October 2, 2014 14:01
Also fixes the GlobeCoordinateFormatter tests.
@brightbyte
Copy link
Author

@jeroen: That depends on whether you believe that the old behaviour was actually well defined, or a bug. This changes the formatter to use the interpretation of "precision" to be the one used by the parser, fixing round trip compatibility. I'll leave it to you to decide whether this is a breaking change, or a fixing change...

@jeroenwtf
Copy link

@brightbyte :)

@@ -101,6 +107,22 @@ public function __construct( FormatterOptions $options ) {
* @throws InvalidArgumentException
*/
public function format( $value ) {
$precision = $this->options->getOption( self::OPT_PRECISION );
return $this->formatLatLongValue( $value, $precision );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fatal if not instanceof LatLongValue

@JeroenDeDauw
Copy link
Member

The non-WB users of the lib that I know do not appear to be using OPT_PRECISION. So let's go with treating this as a fix then.

JeroenDeDauw added a commit that referenced this pull request Oct 9, 2014
Fix precision handling in GlobeCoordinateFormatter and GeoCoordinateFormatter
@JeroenDeDauw JeroenDeDauw merged commit e8d7017 into master Oct 9, 2014
@JeroenDeDauw JeroenDeDauw deleted the FixPrecisionInFormatter branch October 9, 2014 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants