Search code examples
c#cameragoogle-earthgoogle-earth-pluginpanning

Panning relative to the current view with a fixed FlyToSpeed with GoogleEarth


I try to pan Google Earth relative to the current view with the GE-PlugIn in C# (Interop.GEPlugin.dll) as described in the documentation (https://developers.google.com/earth/documentation/camera_control) with a fixed FlyToSpeed.

While setting the FlyToSpeed to SPEED_TELEPORT, everything works fine as expected:

ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_ABSOLUTE)
lookAt.setLongitude(lookAt.getLongitude() + 1);
ge.getView().setAbstractView(lookAt); // Works as expected

Setting the FlyToSpeed to specific number, the panning is disturbed with a increasing zoom out behavior:

ge.getOptions().setFlyToSpeed(3);
var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_ABSOLUTE)
lookAt.setLongitude(lookAt.getLongitude() + 1);
ge.getView().setAbstractView(lookAt); // why the view zooms out while panning?

If anybody had an idea or an approach, I would be very happy. Thank you in advance for your help.


Solution

  • why does the view zoom out while panning?
    

    This isn't an error, it is the default behaviour.

    If the fly to speed is set to something other than SPEED_TELEPORT the plugin will zoom out towards the midpoint of the movement then zoom back in towards the end in a looping motion.

    AFAIK there is no way to control this other than the speed it happens.

    If you wanted to implement a "fly to at fixed altitude/range" you could do so pretty easily. A common way is to leave the speed at SPEED_TELEPORT (to remove the animated looping) then to move the camera manually in incremental steps via the frameEnd event.

    Take a look at this example of smoothly animating a camera via 'frameEnd' - I am sure you could easily adapt it to suit your needs (top down, fixed altitude, etc).