Package gov.nasa.worldwindx.examples.kml
Class KMLViewer.WorkerThread
- java.lang.Object
-
- java.lang.Thread
-
- gov.nasa.worldwindx.examples.kml.KMLViewer.WorkerThread
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- KMLViewer
public static class KMLViewer.WorkerThread extends java.lang.ThreadAThreadthat loads a KML file and displays it in anAppFrame.
-
-
Field Summary
Fields Modifier and Type Field Description protected KMLViewer.AppFrameappFrameIndicates theAppFramethe KML file content is displayed in.protected java.lang.ObjectkmlSourceIndicates the source of the KML file loaded by this thread.
-
Constructor Summary
Constructors Constructor Description WorkerThread(java.lang.Object kmlSource, KMLViewer.AppFrame appFrame)Creates a new worker thread from a specifiedkmlSourceandappFrame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected KMLRootparse()Parse the KML document.voidrun()Loads this worker thread's KML source into a new, then adds the newKMLRootKMLRootto this worker thread'sAppFrame.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield
-
-
-
-
Field Detail
-
kmlSource
protected java.lang.Object kmlSource
Indicates the source of the KML file loaded by this thread. Initialized during construction.
-
appFrame
protected KMLViewer.AppFrame appFrame
Indicates theAppFramethe KML file content is displayed in. Initialized during construction.
-
-
Constructor Detail
-
WorkerThread
public WorkerThread(java.lang.Object kmlSource, KMLViewer.AppFrame appFrame)Creates a new worker thread from a specifiedkmlSourceandappFrame.- Parameters:
kmlSource- the source of the KML file to load. May be aFile, aURL, or anInputStream, or aStringidentifying a file path or URL.appFrame- theAppFramein which to display the KML source.
-
-
Method Detail
-
run
public void run()
Loads this worker thread's KML source into a new, then adds the newKMLRootKMLRootto this worker thread'sAppFrame. TheKMLRoot'sAVKey.DISPLAY_NAMEfield contains a display name created from either the KML source or the KML root feature name.If loading the KML source fails, this prints the exception and its stack trace to the standard error stream, but otherwise does nothing.
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
parse
protected KMLRoot parse() throws java.io.IOException, javax.xml.stream.XMLStreamException
Parse the KML document.- Returns:
- The parsed document.
- Throws:
java.io.IOException- if the document cannot be read.javax.xml.stream.XMLStreamException- if document cannot be parsed.
-
-