diff --git a/vtm-extras/src/org/oscim/utils/osm/Bound.java b/vtm-extras/src/org/oscim/core/osm/Bound.java
similarity index 96%
rename from vtm-extras/src/org/oscim/utils/osm/Bound.java
rename to vtm-extras/src/org/oscim/core/osm/Bound.java
index 28084f22..e99ec18c 100644
--- a/vtm-extras/src/org/oscim/utils/osm/Bound.java
+++ b/vtm-extras/src/org/oscim/core/osm/Bound.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.utils.osm;
+package org.oscim.core.osm;
public class Bound {
diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMData.java b/vtm-extras/src/org/oscim/core/osm/OsmData.java
similarity index 69%
rename from vtm-extras/src/org/oscim/utils/osm/OSMData.java
rename to vtm-extras/src/org/oscim/core/osm/OsmData.java
index 79c12b16..ca69c7fc 100644
--- a/vtm-extras/src/org/oscim/utils/osm/OSMData.java
+++ b/vtm-extras/src/org/oscim/core/osm/OsmData.java
@@ -14,22 +14,22 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.utils.osm;
+package org.oscim.core.osm;
import java.util.Collection;
/**
- * OSM dataset containing nodes, areas and relations
+ * Osm dataset containing nodes, areas and relations
*/
-public class OSMData {
+public class OsmData {
private final Collection bounds;
- private final Collection nodes;
- private final Collection ways;
- private final Collection relations;
+ private final Collection nodes;
+ private final Collection ways;
+ private final Collection relations;
- public OSMData(Collection bounds, Collection nodes,
- Collection ways, Collection relations) {
+ public OsmData(Collection bounds, Collection nodes,
+ Collection ways, Collection relations) {
this.bounds = bounds;
this.nodes = nodes;
@@ -38,15 +38,15 @@ public class OSMData {
}
- public Collection getNodes() {
+ public Collection getNodes() {
return nodes;
}
- public Collection getWays() {
+ public Collection getWays() {
return ways;
}
- public Collection getRelations() {
+ public Collection getRelations() {
return relations;
}
diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMElement.java b/vtm-extras/src/org/oscim/core/osm/OsmElement.java
similarity index 91%
rename from vtm-extras/src/org/oscim/utils/osm/OSMElement.java
rename to vtm-extras/src/org/oscim/core/osm/OsmElement.java
index f8de460d..91b0eb47 100644
--- a/vtm-extras/src/org/oscim/utils/osm/OSMElement.java
+++ b/vtm-extras/src/org/oscim/core/osm/OsmElement.java
@@ -14,18 +14,18 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.utils.osm;
+package org.oscim.core.osm;
import org.oscim.core.TagSet;
import com.vividsolutions.jts.geom.Geometry;
-public abstract class OSMElement {
+public abstract class OsmElement {
public final TagSet tags;
public final long id;
- public OSMElement(TagSet tags, long id) {
+ public OsmElement(TagSet tags, long id) {
assert tags != null;
this.tags = tags;
this.id = id;
@@ -47,7 +47,7 @@ public abstract class OSMElement {
return false;
if (getClass() != obj.getClass())
return false;
- OSMElement other = (OSMElement) obj;
+ OsmElement other = (OsmElement) obj;
if (id != other.id)
return false;
return true;
diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMMember.java b/vtm-extras/src/org/oscim/core/osm/OsmMember.java
similarity index 88%
rename from vtm-extras/src/org/oscim/utils/osm/OSMMember.java
rename to vtm-extras/src/org/oscim/core/osm/OsmMember.java
index e935dd88..aa04469b 100644
--- a/vtm-extras/src/org/oscim/utils/osm/OSMMember.java
+++ b/vtm-extras/src/org/oscim/core/osm/OsmMember.java
@@ -14,9 +14,9 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.utils.osm;
+package org.oscim.core.osm;
-public class OSMMember {
+public class OsmMember {
public enum MemberType {
NODE,
WAY,
@@ -24,9 +24,9 @@ public class OSMMember {
}
public final String role;
- public final OSMElement member;
+ public final OsmElement member;
- public OSMMember(String role, OSMElement member) {
+ public OsmMember(String role, OsmElement member) {
assert role != null && member != null;
this.role = role;
this.member = member;
diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMNode.java b/vtm-extras/src/org/oscim/core/osm/OsmNode.java
similarity index 89%
rename from vtm-extras/src/org/oscim/utils/osm/OSMNode.java
rename to vtm-extras/src/org/oscim/core/osm/OsmNode.java
index 8ac6328d..94f7d6e2 100644
--- a/vtm-extras/src/org/oscim/utils/osm/OSMNode.java
+++ b/vtm-extras/src/org/oscim/core/osm/OsmNode.java
@@ -14,18 +14,18 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.utils.osm;
+package org.oscim.core.osm;
import org.oscim.core.TagSet;
import com.vividsolutions.jts.geom.Geometry;
-public class OSMNode extends OSMElement {
+public class OsmNode extends OsmElement {
public final double lat;
public final double lon;
- public OSMNode(double lat, double lon, TagSet tags, long id) {
+ public OsmNode(double lat, double lon, TagSet tags, long id) {
super(tags, id);
this.lat = lat;
this.lon = lon;
diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMRelation.java b/vtm-extras/src/org/oscim/core/osm/OsmRelation.java
similarity index 82%
rename from vtm-extras/src/org/oscim/utils/osm/OSMRelation.java
rename to vtm-extras/src/org/oscim/core/osm/OsmRelation.java
index 8ebe80c7..6ef5d356 100644
--- a/vtm-extras/src/org/oscim/utils/osm/OSMRelation.java
+++ b/vtm-extras/src/org/oscim/core/osm/OsmRelation.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.utils.osm;
+package org.oscim.core.osm;
import java.util.ArrayList;
import java.util.List;
@@ -23,16 +23,16 @@ import org.oscim.core.TagSet;
import com.vividsolutions.jts.geom.Geometry;
-public class OSMRelation extends OSMElement {
+public class OsmRelation extends OsmElement {
- public final List relationMembers;
+ public final List relationMembers;
// content added after constructor call
- public OSMRelation(TagSet tags, long id, int initialMemberSize) {
+ public OsmRelation(TagSet tags, long id, int initialMemberSize) {
super(tags, id);
this.relationMembers =
- new ArrayList(initialMemberSize);
+ new ArrayList(initialMemberSize);
}
@Override
diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMWay.java b/vtm-extras/src/org/oscim/core/osm/OsmWay.java
similarity index 89%
rename from vtm-extras/src/org/oscim/utils/osm/OSMWay.java
rename to vtm-extras/src/org/oscim/core/osm/OsmWay.java
index 50d8505d..f5d01991 100644
--- a/vtm-extras/src/org/oscim/utils/osm/OSMWay.java
+++ b/vtm-extras/src/org/oscim/core/osm/OsmWay.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.utils.osm;
+package org.oscim.core.osm;
import java.util.List;
@@ -25,11 +25,11 @@ import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.impl.PackedCoordinateSequenceFactory;
-public class OSMWay extends OSMElement {
+public class OsmWay extends OsmElement {
- public final List nodes;
+ public final List nodes;
- public OSMWay(TagSet tags, long id, List nodes) {
+ public OsmWay(TagSet tags, long id, List nodes) {
super(tags, id);
this.nodes = nodes;
}
@@ -47,7 +47,7 @@ public class OSMWay extends OSMElement {
public Geometry toJts() {
double[] coords = new double[nodes.size() * 2];
int i = 0;
- for (OSMNode n : nodes) {
+ for (OsmNode n : nodes) {
coords[i++] = n.lon;
coords[i++] = n.lat;
}
diff --git a/vtm-extras/src/org/oscim/layers/OsmVectorLayer.java b/vtm-extras/src/org/oscim/layers/OsmVectorLayer.java
new file mode 100644
index 00000000..91d7a8d1
--- /dev/null
+++ b/vtm-extras/src/org/oscim/layers/OsmVectorLayer.java
@@ -0,0 +1,19 @@
+package org.oscim.layers;
+
+import org.oscim.core.BoundingBox;
+import org.oscim.core.osm.OsmElement;
+import org.oscim.layers.vector.AbstractVectorLayer;
+import org.oscim.map.Map;
+
+public class OsmVectorLayer extends AbstractVectorLayer {
+
+ public OsmVectorLayer(Map map) {
+ super(map);
+ }
+
+ @Override
+ protected void processFeatures(Task t, BoundingBox b) {
+
+ }
+
+}
diff --git a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java
index dc4c2ccf..248585ea 100644
--- a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java
+++ b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java
@@ -25,11 +25,11 @@ import org.openstreetmap.osmosis.osmbinary.BinaryParser;
import org.openstreetmap.osmosis.osmbinary.Osmformat;
import org.oscim.core.Tag;
import org.oscim.core.TagSet;
-import org.oscim.utils.osm.OSMData;
-import org.oscim.utils.osm.OSMMember;
-import org.oscim.utils.osm.OSMNode;
-import org.oscim.utils.osm.OSMRelation;
-import org.oscim.utils.osm.OSMWay;
+import org.oscim.core.osm.OsmData;
+import org.oscim.core.osm.OsmMember;
+import org.oscim.core.osm.OsmNode;
+import org.oscim.core.osm.OsmRelation;
+import org.oscim.core.osm.OsmWay;
/**
* Class that reads and parses binary files and sends the contained entities to
@@ -65,8 +65,8 @@ public class OsmPbfParser extends BinaryParser {
/** The magic number used to indicate no changeset metadata for this entity. */
static final int NOCHANGESET = -1;
- HashMap mNodeMap = new HashMap();
- HashMap mWayMap = new HashMap();
+ HashMap mNodeMap = new HashMap();
+ HashMap mWayMap = new HashMap();
@Override
protected void parseNodes(List nodes) {
@@ -82,16 +82,16 @@ public class OsmPbfParser extends BinaryParser {
// long id, int version, Date timestamp, OsmUser user,
// long changesetId, Collection tags,
// double latitude, double longitude
- OSMNode tmp;
+ OsmNode tmp;
long id = i.getId();
double latf = parseLat(i.getLat()), lonf = parseLon(i.getLon());
// if (i.hasInfo()) {
// Osmformat.Info info = i.getInfo();
- // tmp = new OSMNode(new CommonEntityData(id, info.getVersion(), getDate(info),
+ // tmp = new OsmNode(new CommonEntityData(id, info.getVersion(), getDate(info),
// getUser(info), info.getChangeset(), tags), latf, lonf);
// } else {
- tmp = new OSMNode(latf, lonf, tags, id);
+ tmp = new OsmNode(latf, lonf, tags, id);
// tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
// NOCHANGESET, tags), latf, lonf);
// }
@@ -115,7 +115,7 @@ public class OsmPbfParser extends BinaryParser {
// }
for (int i = 0; i < nodes.getIdCount(); i++) {
- OSMNode tmp;
+ OsmNode tmp;
TagSet tags = new TagSet(4);
long lat = nodes.getLat(i) + lastLat;
lastLat = lat;
@@ -150,9 +150,9 @@ public class OsmPbfParser extends BinaryParser {
// user = new OsmUser(uid, getStringById(userSid));
// }
//
- // tmp = new OSMNode(id, tags, latf, lonf);
+ // tmp = new OsmNode(id, tags, latf, lonf);
// } else {
- tmp = new OSMNode(latf, lonf, tags, id);
+ tmp = new OsmNode(latf, lonf, tags, id);
mNodeMap.put(Long.valueOf(id), tmp);
@@ -178,11 +178,11 @@ public class OsmPbfParser extends BinaryParser {
// }
long lastId = 0;
- List nodes = new ArrayList();
+ List nodes = new ArrayList();
for (long j : i.getRefsList()) {
- OSMNode n = mNodeMap.get(Long.valueOf(j + lastId));
+ OsmNode n = mNodeMap.get(Long.valueOf(j + lastId));
if (n == null)
- n = new OSMNode(Double.NaN, Double.NaN, null, j + lastId);
+ n = new OsmNode(Double.NaN, Double.NaN, null, j + lastId);
nodes.add(n);
lastId = j + lastId;
@@ -193,13 +193,13 @@ public class OsmPbfParser extends BinaryParser {
// long id, int version, Date timestamp, OsmUser user,
// long changesetId, Collection tags,
// List wayNodes
- OSMWay tmp;
+ OsmWay tmp;
// if (i.hasInfo()) {
// Osmformat.Info info = i.getInfo();
// tmp = new Way(new CommonEntityData(id, info.getVersion(), getDate(info),
// getUser(info), info.getChangeset(), tags), nodes);
// } else {
- tmp = new OSMWay(tags, id, nodes);
+ tmp = new OsmWay(tags, id, nodes);
// }
mWayMap.put(Long.valueOf(id), tmp);
@@ -220,7 +220,7 @@ public class OsmPbfParser extends BinaryParser {
long id = i.getId();
long lastMid = 0;
- List nodes = new ArrayList();
+ List nodes = new ArrayList();
int memberCnt = i.getMemidsCount();
// for (int j = 0; j < memberCnt; j++) {
@@ -240,14 +240,14 @@ public class OsmPbfParser extends BinaryParser {
// assert false; // TODO; Illegal file?
// }
//
- // nodes.add(new OSMMember(mid, etype, role));
+ // nodes.add(new OsmMember(mid, etype, role));
// }
// long id, int version, TimestampContainer timestampContainer,
// OsmUser user,
// long changesetId, Collection tags,
// List members
- OSMRelation tmp = new OSMRelation(tags, id, memberCnt);
+ OsmRelation tmp = new OsmRelation(tags, id, memberCnt);
// if (i.hasInfo()) {
// Osmformat.Info info = i.getInfo();
@@ -290,16 +290,16 @@ public class OsmPbfParser extends BinaryParser {
// }
}
- public OSMData getData() {
+ public OsmData getData() {
- // for (Entry> entry : relationMembersForRelation
+ // for (Entry> entry : relationMembersForRelation
// .entrySet()) {
//
- // OSMRelation relation = entry.getKey();
+ // OsmRelation relation = entry.getKey();
//
// for (TmpRelation member : entry.getValue()) {
//
- // OSMElement memberObject = null;
+ // OsmElement memberObject = null;
//
// if ("node".equals(member)) {
// memberObject = nodesById.get(member.id);
@@ -313,7 +313,7 @@ public class OsmPbfParser extends BinaryParser {
// }
//
// if (memberObject != null) {
- // OSMMember ownMember = new OSMMember(member.role,
+ // OsmMember ownMember = new OsmMember(member.role,
// memberObject);
//
// relation.relationMembers.add(ownMember);
@@ -323,11 +323,11 @@ public class OsmPbfParser extends BinaryParser {
// give up references to original collections
- ArrayList ways = new ArrayList(mWayMap.values());
- ArrayList nodes = new ArrayList(mNodeMap.values());
+ ArrayList ways = new ArrayList(mWayMap.values());
+ ArrayList nodes = new ArrayList(mNodeMap.values());
//log.debug("nodes: " + nodes.size() + " ways: " + ways.size());
- return new OSMData(null, nodes, ways, null);
+ return new OsmData(null, nodes, ways, null);
}
}
diff --git a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java
index 2678b6f4..7e62b602 100644
--- a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java
+++ b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java
@@ -20,11 +20,11 @@ import java.io.IOException;
import java.io.InputStream;
import org.openstreetmap.osmosis.osmbinary.file.BlockInputStream;
-import org.oscim.utils.osm.OSMData;
+import org.oscim.core.osm.OsmData;
public class OsmPbfReader {
- public static OSMData process(InputStream is) {
+ public static OsmData process(InputStream is) {
OsmPbfParser parser = new OsmPbfParser();
try {
diff --git a/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java b/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java
index 8db73976..64ea2b11 100644
--- a/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java
+++ b/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java
@@ -35,13 +35,13 @@ import java.util.zip.InflaterInputStream;
import org.oscim.core.Tag;
import org.oscim.core.TagSet;
-import org.oscim.utils.osm.Bound;
-import org.oscim.utils.osm.OSMData;
-import org.oscim.utils.osm.OSMElement;
-import org.oscim.utils.osm.OSMMember;
-import org.oscim.utils.osm.OSMNode;
-import org.oscim.utils.osm.OSMRelation;
-import org.oscim.utils.osm.OSMWay;
+import org.oscim.core.osm.Bound;
+import org.oscim.core.osm.OsmData;
+import org.oscim.core.osm.OsmElement;
+import org.oscim.core.osm.OsmMember;
+import org.oscim.core.osm.OsmNode;
+import org.oscim.core.osm.OsmRelation;
+import org.oscim.core.osm.OsmWay;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParseException;
@@ -166,15 +166,15 @@ public class OverpassAPIReader {
}
private final List bounds = new ArrayList();
- private Map nodesById = new HashMap();
- private Map waysById = new HashMap();
- private Map relationsById = new HashMap();
- private Map> relationMembersForRelation =
- new HashMap>();
+ private Map nodesById = new HashMap();
+ private Map waysById = new HashMap();
+ private Map relationsById = new HashMap();
+ private Map> relationMembersForRelation =
+ new HashMap>();
- private final Collection ownNodes = new ArrayList(10000);
- private final Collection ownWays = new ArrayList(1000);
- private final Collection ownRelations = new ArrayList(
+ private final Collection ownNodes = new ArrayList(10000);
+ private final Collection ownWays = new ArrayList(1000);
+ private final Collection ownRelations = new ArrayList(
100);
public void parse(InputStream in) throws IOException {
@@ -214,7 +214,7 @@ public class OverpassAPIReader {
long id = 0;
double lat = 0, lon = 0;
- TagSet tags = null;
+ TagSet tags = null;
while (jp.nextToken() != JsonToken.END_OBJECT) {
@@ -236,7 +236,7 @@ public class OverpassAPIReader {
}
// log("node: "+id + " "+ lat + " " + lon);
- OSMNode node = new OSMNode(lat, lon, tags, id);
+ OsmNode node = new OsmNode(lat, lon, tags, id);
ownNodes.add(node);
nodesById.put(Long.valueOf(id), node);
}
@@ -245,7 +245,7 @@ public class OverpassAPIReader {
long id = 0;
TagSet tags = null;
- ArrayList wayNodes = new ArrayList();
+ ArrayList wayNodes = new ArrayList();
while (jp.nextToken() != JsonToken.END_OBJECT) {
@@ -259,7 +259,7 @@ public class OverpassAPIReader {
while (jp.nextToken() != JsonToken.END_ARRAY) {
Long nodeId = Long.valueOf(jp.getLongValue());
- OSMNode node = nodesById.get(nodeId);
+ OsmNode node = nodesById.get(nodeId);
if (node != null)
// log("missing node " + nodeId);
// else
@@ -270,7 +270,7 @@ public class OverpassAPIReader {
}
// log("way: "+ id + " " + wayNodes.size());
- OSMWay way = new OSMWay(tags, id, wayNodes);
+ OsmWay way = new OsmWay(tags, id, wayNodes);
ownWays.add(way);
waysById.put(Long.valueOf(id), way);
}
@@ -313,7 +313,7 @@ public class OverpassAPIReader {
tags = parseTags(jp);
}
- OSMRelation relation = new OSMRelation(tags, id, members.size());
+ OsmRelation relation = new OsmRelation(tags, id, members.size());
ownRelations.add(relation);
relationsById.put(Long.valueOf(id), relation);
relationMembersForRelation.put(relation, members);
@@ -342,7 +342,7 @@ public class OverpassAPIReader {
System.out.println(msg);
}
- public OSMData getData() {
+ public OsmData getData() {
String encoded;
try {
@@ -371,14 +371,14 @@ public class OverpassAPIReader {
inputStream = null;
}
- for (Entry> entry : relationMembersForRelation
+ for (Entry> entry : relationMembersForRelation
.entrySet()) {
- OSMRelation relation = entry.getKey();
+ OsmRelation relation = entry.getKey();
for (TmpRelation member : entry.getValue()) {
- OSMElement memberObject = null;
+ OsmElement memberObject = null;
if ("node".equals(member)) {
memberObject = nodesById.get(member.id);
@@ -392,7 +392,7 @@ public class OverpassAPIReader {
}
if (memberObject != null) {
- OSMMember ownMember = new OSMMember(member.role,
+ OsmMember ownMember = new OsmMember(member.role,
memberObject);
relation.relationMembers.add(ownMember);
@@ -408,6 +408,6 @@ public class OverpassAPIReader {
relationsById = null;
relationMembersForRelation = null;
- return new OSMData(bounds, ownNodes, ownWays, ownRelations);
+ return new OsmData(bounds, ownNodes, ownWays, ownRelations);
}
}