开发者

straight camera movement in google earth plugin via Internet Explorer COM

I have a problem to imitate a straight line in Google Earth Plugin. To imitate the straight line, I invoke a JavaScript method in a HTML Document from MATLAB via COM. (MATLAB as COM- Client and Internet Explorer as COM-Server)

The JavaScript code is below:

function UpdateCamera(lat,lon,alt,bearing,pitch,roll) {
  var camera = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE);

  // set the camera values         
  camera.setLatitude(lat);
  camera.setLongitude(lon);
  camera.setAltitude(alt);
  camera.setHeading(bearing);
  camera.setTilt(pitch);
  camera.setRoll(roll);

  // Set the FlyTo speed
  ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);

  // Update the view in Google Earth  
  ge.getView().setAbstractView(camera);
}

And for invoking the JavaScript method, I use this in MATLAB:

for i=1:iend
    h.Document.parentWindow.execScript(['tickAnimation(' num2str(cood(i,1)) ',' ...
                                                    num2str(cood(i,2)) ',' ... 
                                                    num2str(cood(i,3)) ',' ...
                                                    num2str(70) ',' ...
                                                    num2str(90) ',' ...
                                                    num2str(0) ');'] , 'JavaScript');

pause(0.01)

end

I get the latitude and long开发者_如何学运维itude from the distance, which is the output of a simulation. Using the formula here http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html (this formula is accurate within 0.5mm!)

Unfortunately, I still cannot get a straight movement in Google Earth. The movement forwards consists zig-zag motion. you can see the result here http://www.youtube.com/watch?v=KS77qORjFh8

The movements upwards is already smooth. the problem now is only the forwards movement.

Looking forward for your inputs.

Regards, Wan


During the movement not only lat/lng of the camera changes but also the heading. So, you need to update the heading as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜