2D vs 3D Placemark View

The Google Earth SDK provides the ability to add various types of KML objects to the Earth and utilize the highly adjustable 3D environment of Google Earth for visual awareness of the activity of each object. The GE SDK provides 2 view modes for placemark objects that allows the host application to control the Google Earth camera such that it can show the inherant user-controllable view or an auto-updating 3D view from the prespective of the specified placemark. These views are termed 2D and 3D view modes, respectively.

When switching a certain Placemark to 3D view mode, the Google Earth camera will be oriented such that it points in the direction of the given placemark's heading. This can be used for presenting a pilot's cockpit view as the aircraft flys its course. 2D and 3D placemark view modes are attained with the GE_SwitchTo3DView() and GE_ReturnFrom3DView() functions. When switching to 3D mode, the camera will be fixed to the current heading of the specified placemark. When returning to 2D view mode, the previous camera view before switching to 3D will be restored.

The following code samples and screenshots show various 2D and 3D views.

2D View:

pm_2dview.png
// switch to 3D for SamplePlacemark1
GE_SwitchTo3DView("SamplePlacemark1");

3D View:

pm_3dview.png

The camera view may be adjusted while in 3D view mode by using the various SetPlacemark3DCamera functions. The following code shows yaw adjustments to the above 3D view.

// adjust the camera yaw 40 degrees left from center
GE_SetPlacemark3DCameraYaw("SamplePlacemark1", -40);
pm_3dview40degLeft.png
// adjust the camera yaw 32 degrees right from center
GE_SetPlacemark3DCameraYaw("SamplePlacemark1", 32);
pm_3dview32degRight.png

The camera view can still always be controlled with the Google Earth pan and zoom features, however, it is recommended that the 3D views be controlled primarily by the GE SDK. This will avoid any sudden changes to the camera that can be distracting to the view.

<< Back to Code Samples


Generated on Wed Sep 16 23:50:34 2009 for Google Earth SDK by  doxygen 1.6.1