|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.kolls.railworld.opening.MapLoader
public abstract class MapLoader
A class that loads maps and their images, along with other supporting data.
Includes functionality to prompt user to select a local file.
Instances of this class are created using factory methods which specify
how to get the map.
The image won't be loaded right away. It will wait for the first call to
getImage(). This allows uses of the map without the delay
of loading the image if it is not needed.
| Constructor Summary | |
|---|---|
protected |
MapLoader(RailSegment[] la,
MetaData mmd)
Protected constructor. |
| Method Summary | |
|---|---|
abstract java.awt.image.BufferedImage |
getImage()
Loads the map image on the first call; caches it for subsequent calls. |
MetaData |
getMetaData()
|
RailSegment[] |
getSegments()
|
abstract MapLoader |
loadAgain()
Loads another instance of this map from its original source (file or URL). |
static MapLoader |
loadFromFile(java.io.File file)
Loads the map from the given file. |
static MapLoader |
loadFromURL(java.net.URL url)
Loads the map from the given URL. |
static MapLoader |
loadFromUserPrompt(ScriptManager scripts,
java.io.File directory)
Popup a file chooser dialog to allow the user to select a map file locally. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected MapLoader(RailSegment[] la,
MetaData mmd)
la - RailSegmentsmmd - MetaData| Method Detail |
|---|
public RailSegment[] getSegments()
public MetaData getMetaData()
public abstract MapLoader loadAgain()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public abstract java.awt.image.BufferedImage getImage()
throws java.io.IOException
java.io.IOException - If the map image cannot be loaded.
public static MapLoader loadFromUserPrompt(ScriptManager scripts,
java.io.File directory)
throws java.io.IOException,
org.xml.sax.SAXException
scripts - If provided, indicates that a ScriptPanel should
be shown allowing the user to choose scripts. The given script manager
(assumed to be empty when passed in; but will be cleared if not)
will then be loaded with the selected scripts.directory - Specifies the directory to start in. May be null.
java.io.IOException - If the map selected by the user cannot be loaded.
org.xml.sax.SAXException - If the map selected by the user cannot be parsed.
public static MapLoader loadFromFile(java.io.File file)
throws java.io.IOException,
org.xml.sax.SAXException
file - The file containing a compatible map to load, either in Rail World
or Yard Duty format.
java.io.IOException - If the map cannot be loaded.
org.xml.sax.SAXException - If the map cannot be parsed.
public static MapLoader loadFromURL(java.net.URL url)
throws java.io.IOException,
org.xml.sax.SAXException
url - The URL pointing to a compatible map to load, in Rail World
format. Yard Duty files cannot be loaded over URLs.
java.io.IOException - If the map cannot be loaded.
org.xml.sax.SAXException - If the map cannot be parsed.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||