Martin Desruisseaux ha scritto:
> I had a look (by accident) to ReferencedEnvelope. I noticed 3 "reference" 
> methods, which are inconsistent with each other:
> 
> ReferencedEnvelope reference(ReferencedEnvelope)
> ------------------------------------------------
> Had no documentation, but looking at the code it the create a new instance of 
> ReferencedEnvelope inconditionnaly, given a non-null argument.

Yep, it is a sort of a copy constructor, but with a check for null 
before doing so.

> 
> ReferencedEnvelope reference(Envelope)
> --------------------------------------
> Creates a new ReferencedEnvelope only if necessary, in which case the CRS is 
> set 
> to null. Otherwise returns the existing ReferencedEnvelope with its CRS 
> preserved.
> 
> ReferencedEnvelope reference(BoundingBox)
> -----------------------------------------
> Creates a new ReferencedEnvelope only if necessary and set copy the CRS.
> 
> 
> Unless there is some mysterious reasons for having inconsistent "reference" 
> methods in their behavior (whatever new instances are created or not and in 
> CRS 
> setting), can the guys who wrote those methods try to put a little bit of 
> consistency among them please?

That would be me, Justin and Jody, in 3 different times.

The first method is different from the other two, it's a copy 
constructor with null check, but it performs no transformations. It 
should be probably renamed?

The other two are transformation methods, they take in something that
may not be a ReferencedEnvelope and turn it into one. They have the same 
semantic in practice. reference(Envelope) returns the same object
if it's a referenced envelope, if it's not, a JTS Envelope (that's
what the argument is) has no CRS, so setting the crs to null is
both correct and necessary, since the constructor accepting a single
Envelope argument accepts a opengis Envelope, not a JTS one.

The third one gets an object that has srs information and it preserves
it, so the semantic seems to be the same to me.

Cheers
Andrea

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to