jordoncm / earth-api-samples

Automatically exported from code.google.com/p/earth-api-samples
0 stars 0 forks source link

GEView.project can't return x,y in fractions #789

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure if this is a bug or an oversight. However it ties in with the 
substandard unit implementation in Google Earth in general.

The manual tells me that project is the opposite of HitTest. However, in 
hittest you can specify what kind of units the input values are, pixels or 
fractions.

However, project returns a kmlVec2. If you call getX of the returned vector you 
get the X value in pixels.

I tried to call setXUnits(ge.UNITS_FRACTION) and then call getX but the X value 
is still returned in pixels.

AGAIN. Since the API does not provide a width for the plugin window in pixels, 
I am stuck.

Solution:

Make KmlVec2 a bit smarter and allow the setting of units after the vector is 
populated so that fraction values can be obtained.

The workarounds I am forced to go through in order to make this work on every 
browser at any browser zoom setting are incredibly complex and require a Flash 
object. All because the API won't return some simple window width and height 
parameters.

Original issue reported on code.google.com by vandint...@gmail.com on 25 Apr 2012 at 3:02