Simplify MapProjection constructors
-----------------------------------

         Key: GEOT-786
         URL: http://jira.codehaus.org/browse/GEOT-786
     Project: GeoTools
        Type: Task

  Components: referencing  
    Versions: 2.2.M2    
    Reporter: Martin Desruisseaux
    Priority: Minor


The relationship between various Provider and constructors in MapProjection 
subclasses is currently quite complicated. It can be simplified if we impose 
ourself the following rule:

   One projection class    =    one provider

For example we previously had a single LambertConformal projection 
implementation, but 4 providers for 1SP, 2SP, Belgium and ESRI cases. I 
refactored LambertConformal as an abstract class where the only abstract method 
to define is getParameterDescriptors(), and provided the following subclasses:

    LamberConformal1SP
    LamberConformal2SP
    LamberConformalBelgium
    LamberConformalESRI

each of them with a single Provider inner class. Each LamberConformal subclass 
are as simple as this:

public class LambertConformal1SP extends LambertConformal {
    protected LambertConformal1SP(final ParameterValueGroup parameters)   {
        super(parameters);
    }

    public ParameterDescriptorGroup getParameterDescriptors() {
        return Provider.PARAMETERS;
    }
}

Because de getParameterDescriptors() do not depends anymore on any internal 
state (the previous architecture had a complicated getParameterDescriptors() 
method), we do not need anymore to pass a Collection of expected parameters to 
the constructor.

I started the cleaning for some classes like LambertConformal and it seems to 
work quite well. Remaining class to refactor include Stereographic and 
Orthographic. Once this simplification is completed, we can:

  * Remove the package-private constructor in MapProjection (only the protected 
constructor would be left).
  * Turn the package-private 'doubleValue' and 'set' methods into private ones.
  * Provide simplier 'doubleValue' and 'set' methods.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to