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 XMLStreamReader |
parser |
private static 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(String uid,
String name) |
static void |
deregisterPostprocessor(OsmServerReadPostprocessor pp)
Deregister a postprocessor previously registered with
registerPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor) . |
protected DataSet |
doParseDataSet(InputStream source,
ProgressMonitor progressMonitor) |
private long |
getLong(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(String generator) |
private void |
parseChangeset(Long uploadChangesetId) |
static DataSet |
parseDataSet(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(XMLStreamReader parser) |
protected void |
throwException(String msg) |
protected void |
throwException(String msg,
Throwable th) |
getDataSet, prepareDataSet, processChangesetAfterParsing, processNodesAfterParsing, processRelationsAfterParsing, processWaysAfterParsing
protected XMLStreamReader parser
protected boolean cancel
private static volatile 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(XMLStreamReader parser)
protected void throwException(String msg, Throwable th) throws XMLStreamException
XMLStreamException
protected void throwException(String msg) throws XMLStreamException
XMLStreamException
protected void parse() throws XMLStreamException
XMLStreamException
protected void parseRoot() throws XMLStreamException
XMLStreamException
private void parseOsm() throws XMLStreamException
XMLStreamException
private void parseBounds(String generator) throws XMLStreamException
XMLStreamException
protected Node parseNode() throws XMLStreamException
XMLStreamException
protected Way parseWay() throws XMLStreamException
XMLStreamException
private long parseWayNode(Way w) throws XMLStreamException
XMLStreamException
protected Relation parseRelation() throws XMLStreamException
XMLStreamException
private RelationMemberData parseRelationMember(Relation r) throws XMLStreamException
XMLStreamException
private void parseChangeset(Long uploadChangesetId) throws XMLStreamException
XMLStreamException
private void parseTag(Tagged t) throws XMLStreamException
XMLStreamException
protected void parseUnknown(boolean printWarning) throws XMLStreamException
XMLStreamException
protected void parseUnknown() throws XMLStreamException
XMLStreamException
private void jumpToEnd(boolean printWarning) throws XMLStreamException
printWarning
- if true
, a warning message will be printed if an unknown element is metXMLStreamException
- if there is an error processing the underlying XML sourceprivate void jumpToEnd() throws XMLStreamException
XMLStreamException
private User createUser(String uid, String name) throws XMLStreamException
XMLStreamException
private void readCommon(PrimitiveData current) throws XMLStreamException
current
- primitive to updateXMLStreamException
- if there is an error processing the underlying XML sourceprivate long getLong(String name) throws XMLStreamException
XMLStreamException
protected DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
IllegalDataException
public static DataSet parseDataSet(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 sourceIllegalArgumentException
- if source is null