jaron.google
Class GoogleEarthKMLProvider

java.lang.Object
  extended by jaron.google.GoogleEarthKMLProvider
All Implemented Interfaces:
TrackpointListener, java.util.EventListener

public class GoogleEarthKMLProvider
extends java.lang.Object
implements TrackpointListener

The GoogleEarthKMLProvider class provides a KLM structure containing a GPS track and its information. The structure can be requested by Google Earth via a HTTP connection.
The track information that is contained in the KML structure is collected from a GPS provider/device that supports the TrackpointListener interface.
By opening the following KML file, Google Earth starts polling the HTTP server every 2 seconds and displays the real time tracking information.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
  <NetworkLink>
    <name>UAV Playground Network Link</name>
    <Link>
      <href>http://127.0.0.1:8080/</href>
      <refreshMode>onInterval</refreshMode>
      <refreshInterval>2</refreshInterval>
    </Link>
  </NetworkLink>
</kml>

Since:
1.1
Version:
1.2
Author:
jarontec gmail com

Field Summary
static java.lang.String ALTITUDE_MODE_ABSOLUTE
          A preset value to be used with the setTrackAltitudeMode method.
static java.lang.String CLAMP_TO_GROUND
          A preset value to be used with the setTrackAltitudeMode method.
static int DEFAULT_PORT
          The default port 8080 that is used for the HTTP server.
static java.lang.String RELATIVE_TO_GROUND
          A preset value to be used with the setTrackAltitudeMode method.
 
Constructor Summary
GoogleEarthKMLProvider()
          Creates a new GoogleEarthKMLProvider and starts its HTTP server through which the KML tracking data is provided.
GoogleEarthKMLProvider(int port)
          Creates a new GoogleEarthKMLProvider and starts its HTTP server through which the KML tracking data is provided.
 
Method Summary
 java.lang.String getKML()
          Returns the KML track information.
 void setPlacemarkAltitudeMode(java.lang.String placemarkAltitudeMode)
          Sets the KML placemarks altitude mode.
 void setTrackAltitudeMode(java.lang.String trackAltitudeMode)
          Sets the KML track altitude mode.
 void setWritePlacemaks(java.lang.Boolean flag)
          Sets the placemaks write flag.
 void setWriteTrack(java.lang.Boolean flag)
          Sets the track write flag.
 void trackpointChanged(Trackpoint trackpoint)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALTITUDE_MODE_ABSOLUTE

public static final java.lang.String ALTITUDE_MODE_ABSOLUTE
A preset value to be used with the setTrackAltitudeMode method.

See Also:
Constant Field Values

CLAMP_TO_GROUND

public static final java.lang.String CLAMP_TO_GROUND
A preset value to be used with the setTrackAltitudeMode method.

See Also:
Constant Field Values

RELATIVE_TO_GROUND

public static final java.lang.String RELATIVE_TO_GROUND
A preset value to be used with the setTrackAltitudeMode method.

See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port 8080 that is used for the HTTP server.

See Also:
Constant Field Values
Constructor Detail

GoogleEarthKMLProvider

public GoogleEarthKMLProvider(int port)
Creates a new GoogleEarthKMLProvider and starts its HTTP server through which the KML tracking data is provided.

Parameters:
port - the port to be used for the HTTP connection

GoogleEarthKMLProvider

public GoogleEarthKMLProvider()
Creates a new GoogleEarthKMLProvider and starts its HTTP server through which the KML tracking data is provided.

Method Detail

setWriteTrack

public void setWriteTrack(java.lang.Boolean flag)
Sets the track write flag. If set to true (default) the track information will be included in the requested KML output.

Parameters:
flag - true if the track information should part of the KML output

setWritePlacemaks

public void setWritePlacemaks(java.lang.Boolean flag)
Sets the placemaks write flag. If set to true (default) the plcaemaks will be included in the requested KML output.

Parameters:
flag - true if the placemaks should part of the KML output

setTrackAltitudeMode

public void setTrackAltitudeMode(java.lang.String trackAltitudeMode)
Sets the KML track altitude mode. For more information about the track altitude mode read the KML reference.

Parameters:
trackAltitudeMode - a KML <altitudeMode> value

setPlacemarkAltitudeMode

public void setPlacemarkAltitudeMode(java.lang.String placemarkAltitudeMode)
Sets the KML placemarks altitude mode. For more information about the placemarks altitude mode read the KML reference.

Parameters:
placemarkAltitudeMode - a KML <altitudeMode> value

getKML

public java.lang.String getKML()
Returns the KML track information. The track information is collected from a GPS provider/device that supports the TrackpointListener interface.

Returns:
KML track information

trackpointChanged

public void trackpointChanged(Trackpoint trackpoint)
Specified by:
trackpointChanged in interface TrackpointListener