Package org.openstreetmap.josm.io
Class AbstractReader
java.lang.Object
org.openstreetmap.josm.io.AbstractReader
- Direct Known Subclasses:
GeoJSONReader,OsmJsonReader,OsmPbfReader,OsmReader
Abstract Reader, allowing other implementations than OsmReader (PbfReader in PBF plugin for example)
- Since:
- 4490
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceAn interface for reading binary dataprotected static interfaceprotected static interfaceprotected static interfaceprotected static interfaceprotected static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected DataSetThe dataset to add parsed objects to.protected final Map<PrimitiveId,OsmPrimitive> the map from external ids to read OsmPrimitives.private static List<OsmServerReadPostprocessor>Used by plugins to register themselves as data postprocessors.protected final Map<Long,Collection<RelationMemberData>> Data structure for relation objectsA lookup table to avoid callingString.intern()unnecessarily.protected Changesetprotected final Map<Long,Collection<Long>> Data structure for the remaining way objects -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate NodeaddNode(NodeData nd, AbstractReader.NodeReader nodeReader) private static booleanareLatLonDefined(double lat, double lon) private static booleanareLatLonDefined(String lat, String lon) protected OsmPrimitiveprotected voidcallPostProcessors(ProgressMonitor progressMonitor) Iterate over registered postprocessors and give them each a chance to modify the dataset we have just loaded.private static UsercreateUser(String uid, String name) static voidDeregister a postprocessor previously registered withregisterPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor).protected abstract DataSetdoParseDataSet(InputStream source, ProgressMonitor progressMonitor) private DataSetdoParseDataSet(InputStream source, ProgressMonitor progressMonitor, Object parserWorker) protected final DataSetdoParseDataSet(InputStream source, ProgressMonitor progressMonitor, AbstractReader.BinaryParserWorker parserWorker) protected final DataSetdoParseDataSet(InputStream source, ProgressMonitor progressMonitor, AbstractReader.ParserWorker parserWorker) Replies the parsed data setprotected final longprivate static voidhandleIllegalChangeset(PrimitiveData current, IllegalArgumentException e, Object v) protected final voidparseAction(PrimitiveData current, String action) protected final voidparseBounds(String generator, String minlon, String minlat, String maxlon, String maxlat, String origin) protected final voidparseChangeset(PrimitiveData current, int v) protected final voidparseChangeset(PrimitiveData current, String v) protected final voidparseDownloadPolicy(String key, String downloadPolicy) protected final voidparseId(PrimitiveData current, long id) protected final voidparseLocked(String locked) protected final NodeparseNode(double lat, double lon, AbstractReader.CommonReader commonReader, AbstractReader.NodeReader nodeReader) protected final NodeparseNode(String lat, String lon, AbstractReader.CommonReader commonReader, AbstractReader.NodeReader nodeReader) private static voidparsePolicy(String key, String policy, Consumer<String> consumer) protected final RelationparseRelation(AbstractReader.CommonReader commonReader, AbstractReader.RelationReader relationReader) protected final RelationMemberDataparseRelationMember(RelationData r, long id, String type, String role) protected final RelationMemberDataparseRelationMember(RelationData r, String ref, String type, String role) protected final voidprotected final voidparseTimestamp(PrimitiveData current, String time) protected final voidparseUploadPolicy(String key, String uploadPolicy) protected final voidparseUser(PrimitiveData current, String user, long uid) protected final voidparseUser(PrimitiveData current, String user, String uid) protected final voidparseVersion(String version) protected final voidparseVersion(PrimitiveData current, int version) protected final voidparseVersion(PrimitiveData current, String versionString) protected final voidparseVisible(PrimitiveData current, String visible) protected final WayparseWay(AbstractReader.CommonReader commonReader, AbstractReader.WayReader wayReader) protected final voidprotected voidprotected voidProcesses the parsed nodes after parsing.protected voidCompletes the parsed relations with its members.protected voidProcesses the ways after parsing.static voidRegister a new postprocessor.private static voidvalidateVersion(String version)
-
Field Details
-
postprocessors
Used by plugins to register themselves as data postprocessors. -
cancel
-
tagMap
A lookup table to avoid callingString.intern()unnecessarily. -
ds
The dataset to add parsed objects to. -
uploadChangeset
-
externalIdMap
the map from external ids to read OsmPrimitives. External ids are longs too, but in contrast to internal ids negative values are used to identify primitives unknown to the OSM server -
ways
Data structure for the remaining way objects -
relations
Data structure for relation objects -
timestampCache
-
-
Constructor Details
-
AbstractReader
public AbstractReader()
-
-
Method Details
-
registerPostprocessor
Register a new postprocessor.- Parameters:
pp- postprocessor- Since:
- 14119 (moved from OsmReader)
- See Also:
-
deregisterPostprocessor
Deregister a postprocessor previously registered withregisterPostprocessor(org.openstreetmap.josm.io.OsmServerReadPostprocessor).- Parameters:
pp- postprocessor- Since:
- 14119 (moved from OsmReader)
- See Also:
-
getDataSet
Replies the parsed data set- Returns:
- the parsed data set
-
callPostProcessors
Iterate over registered postprocessors and give them each a chance to modify the dataset we have just loaded.- Parameters:
progressMonitor- Progress monitor
-
processNodesAfterParsing
Processes the parsed nodes after parsing. Just adds them to the dataset -
processWaysAfterParsing
Processes the ways after parsing. Rebuilds the list of nodes of each way and adds the way to the dataset- Throws:
IllegalDataException- if a data integrity problem is detected
-
processRelationsAfterParsing
Completes the parsed relations with its members.- Throws:
IllegalDataException- if a data integrity problem is detected, i.e. if a relation member refers to a local primitive which wasn't available in the data
-
processChangesetAfterParsing
-
prepareDataSet
- Throws:
IllegalDataException
-
doParseDataSet
protected abstract DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException - Throws:
IllegalDataException
-
doParseDataSet
protected final DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor, AbstractReader.BinaryParserWorker parserWorker) throws IllegalDataException - Throws:
IllegalDataException
-
doParseDataSet
protected final DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor, AbstractReader.ParserWorker parserWorker) throws IllegalDataException - Throws:
IllegalDataException
-
doParseDataSet
private DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor, Object parserWorker) throws IllegalDataException - Throws:
IllegalDataException
-
getLong
- Throws:
IllegalDataException
-
parseVersion
- Throws:
IllegalDataException
-
validateVersion
- Throws:
IllegalDataException
-
parseDownloadPolicy
protected final void parseDownloadPolicy(String key, String downloadPolicy) throws IllegalDataException - Throws:
IllegalDataException
-
parseUploadPolicy
- Throws:
IllegalDataException
-
parsePolicy
private static void parsePolicy(String key, String policy, Consumer<String> consumer) throws IllegalDataException - Throws:
IllegalDataException
-
parseLocked
-
parseBounds
protected final void parseBounds(String generator, String minlon, String minlat, String maxlon, String maxlat, String origin) throws IllegalDataException - Throws:
IllegalDataException
-
parseId
- Throws:
IllegalDataException
-
parseTimestamp
-
createUser
- Throws:
IllegalDataException
-
parseUser
-
parseUser
protected final void parseUser(PrimitiveData current, String user, String uid) throws IllegalDataException - Throws:
IllegalDataException
-
parseVisible
-
parseVersion
protected final void parseVersion(PrimitiveData current, String versionString) throws IllegalDataException - Throws:
IllegalDataException
-
parseVersion
- Throws:
IllegalDataException
-
parseAction
-
handleIllegalChangeset
private static void handleIllegalChangeset(PrimitiveData current, IllegalArgumentException e, Object v) throws IllegalDataException - Throws:
IllegalDataException
-
parseChangeset
- Throws:
IllegalDataException
-
parseChangeset
- Throws:
IllegalDataException
-
parseTag
- Throws:
IllegalDataException
-
areLatLonDefined
-
areLatLonDefined
-
buildPrimitive
-
addNode
- Throws:
IllegalDataException
-
parseNode
protected final Node parseNode(double lat, double lon, AbstractReader.CommonReader commonReader, AbstractReader.NodeReader nodeReader) throws IllegalDataException - Throws:
IllegalDataException
-
parseNode
protected final Node parseNode(String lat, String lon, AbstractReader.CommonReader commonReader, AbstractReader.NodeReader nodeReader) throws IllegalDataException - Throws:
IllegalDataException
-
parseWay
protected final Way parseWay(AbstractReader.CommonReader commonReader, AbstractReader.WayReader wayReader) throws IllegalDataException - Throws:
IllegalDataException
-
parseRelation
protected final Relation parseRelation(AbstractReader.CommonReader commonReader, AbstractReader.RelationReader relationReader) throws IllegalDataException - Throws:
IllegalDataException
-
parseRelationMember
protected final RelationMemberData parseRelationMember(RelationData r, String ref, String type, String role) throws IllegalDataException - Throws:
IllegalDataException
-
parseRelationMember
protected final RelationMemberData parseRelationMember(RelationData r, long id, String type, String role) throws IllegalDataException - Throws:
IllegalDataException
-