Robert said:
What exactly do you mean by "intermediate"? Do you mean that all
projections should have the same interface? For that you do not need
inheritance at all - at least in Ruby. Or do you rather mean that they
share behavior (implementation)?
Same interface:
For example
This is the intermediate API
#type="projection=lambert, varphi_0=45, k=1"
type="projection=UTM, zone=30, false_east=40000"
prj=Projection.new(type)
[x,y]=prj.geodetic_to_projected(lambda,phi)
[lambda,phi]=prj.projected_to_geodetic(x,y)
This is an especific API for UTM:
parameters=UtmParameters.new
parameters.zone=30
parameters.false_east=30
prj=UtmProjection.new(parameters)
[x,y]=prj.utm_geodetic_to_projected(lambda,phi)
[lambda,phi]=prj.utm_projected_to_geodetic(x,y)
This is an especific API for lambert:
parameters=LambertParameters.new
parameters.varphi_0=30
parameters.k=1
prj=LambertProjection.new(parameters)
[x,y]=prj.lambert_geodetic_to_projected(lambda,phi)
[lambda,phi]=prj.lambert_projected_to_geodetic(x,y)
I have used the proj.4 C library and they used pointers to functions in
C, in a offuscated code.
http://proj.maptools.org/
proj.4 use a text file like this:
"projection=lambert, varphi_0=45, k=1"
Every projection is an module (ANSI C file) and a only modulo know what
module call using the text file. There are 170 different projections.
+proj=cea +lon_0=Central Meridian
+lat_ts=Standard Parallel
+x_0=False Easting
+y_0=False Northing
+proj=lcc +lat_1=Latitude of natural origin
+lon_0=Longitude of natural origin
+k_0=Scale factor at natural origin
+x_0=False Origin Easting
+y_0=False Origin Northing
+proj=tmerc +lat_0=Latitude of natural origin
+lon_0=Longitude of natural origin
+k=Scale factor at natural origin
+x_0=False Easting
+y_0=False Northing
...
I was going to also suggest the module approach. But I do wonder why
Martin chose to call it "inverse OOP". It seems the more appropriate
term would be "multiple inheritance" or am I missing something?
Okay. then this is a multiple inheritance problem??