public class OsmReader extends AbstractReader
Modifier and Type | Class and Description |
---|---|
private static class |
OsmReader.OsmParsingCanceledException
Exception thrown after user cancelation.
|
private static class |
OsmReader.OsmParsingException |
Modifier and Type | Field and Description |
---|---|
protected boolean |
cancel |
protected javax.xml.stream.XMLStreamReader |
parser |
private static java.util.List<OsmServerReadPostprocessor> |
postprocessors
Used by plugins to register themselves as data postprocessors.
|
ds, externalIdMap, relations, uploadChangeset, ways
Modifier | Constructor and Description |
---|---|
protected |
OsmReader()
constructor (for private and subclasses use only)
|
Modifier and Type | Method and Description |
---|---|
private User |
createUser(java.lang.String uid,
java.lang.String name) |
static void |
deregisterPostprocessor(OsmServerReadPostprocessor pp)
Deregister a postprocessor previously registered with
registerPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor) . |
protected DataSet |
doParseDataSet(java.io.InputStream source,
ProgressMonitor progressMonitor) |
private long |
getLong(java.lang.String name) |
private void |
jumpToEnd() |
private void |
jumpToEnd(boolean printWarning)
When cursor is at the start of an element, moves it to the end tag of that element.
|
protected void |
parse() |
private void |
parseBounds(java.lang.String generator) |
private void |
parseChangeset(java.lang.Long uploadChangesetId) |
static DataSet |
parseDataSet(java.io.InputStream source,
ProgressMonitor progressMonitor)
Parse the given input source and return the dataset.
|
protected Node |
parseNode() |
private void |
parseOsm() |
protected Relation |
parseRelation() |
private RelationMemberData |
parseRelationMember(Relation r) |
protected void |
parseRoot() |
private void |
parseTag(Tagged t) |
protected void |
parseUnknown() |
protected void |
parseUnknown(boolean printWarning) |
protected Way |
parseWay() |
private long |
parseWayNode(Way w) |
private void |
readCommon(PrimitiveData current)
Read out the common attributes and put them into current OsmPrimitive.
|
static void |
registerPostprocessor(OsmServerReadPostprocessor pp)
Register a new postprocessor.
|
protected void |
setParser(javax.xml.stream.XMLStreamReader parser) |
protected void |
throwException(java.lang.String msg) |
protected void |
throwException(java.lang.String msg,
java.lang.Throwable th) |
getDataSet, prepareDataSet, processChangesetAfterParsing, processNodesAfterParsing, processRelationsAfterParsing, processWaysAfterParsing
protected javax.xml.stream.XMLStreamReader parser
protected boolean cancel
private static volatile java.util.List<OsmServerReadPostprocessor> postprocessors
protected OsmReader()
public static void registerPostprocessor(OsmServerReadPostprocessor pp)
pp
- postprocessorderegisterPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor)
public static void deregisterPostprocessor(OsmServerReadPostprocessor pp)
registerPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor)
.pp
- postprocessorregisterPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor)
protected void setParser(javax.xml.stream.XMLStreamReader parser)
protected void throwException(java.lang.String msg, java.lang.Throwable th) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void throwException(java.lang.String msg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void parse() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void parseRoot() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void parseOsm() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void parseBounds(java.lang.String generator) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected Node parseNode() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected Way parseWay() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private long parseWayNode(Way w) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected Relation parseRelation() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private RelationMemberData parseRelationMember(Relation r) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void parseChangeset(java.lang.Long uploadChangesetId) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void parseTag(Tagged t) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void parseUnknown(boolean printWarning) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void parseUnknown() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void jumpToEnd(boolean printWarning) throws javax.xml.stream.XMLStreamException
printWarning
- if true
, a warning message will be printed if an unknown element is metjavax.xml.stream.XMLStreamException
- if there is an error processing the underlying XML sourceprivate void jumpToEnd() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private User createUser(java.lang.String uid, java.lang.String name) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void readCommon(PrimitiveData current) throws javax.xml.stream.XMLStreamException
current
- primitive to updatejavax.xml.stream.XMLStreamException
- if there is an error processing the underlying XML sourceprivate long getLong(java.lang.String name) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected DataSet doParseDataSet(java.io.InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
IllegalDataException
public static DataSet parseDataSet(java.io.InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
source
- the source input stream. Must not be null.progressMonitor
- the progress monitor. If null, NullProgressMonitor.INSTANCE
is assumedIllegalDataException
- if an error was found while parsing the data from the sourcejava.lang.IllegalArgumentException
- if source is null