move OSMData to utils
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.core.osm;
|
||||
|
||||
public class Bound {
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Tobias Knerr
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.core.osm;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* OSM dataset containing nodes, areas and relations
|
||||
*/
|
||||
public class OSMData {
|
||||
|
||||
private final Collection<Bound> bounds;
|
||||
private final Collection<OSMNode> nodes;
|
||||
private final Collection<OSMWay> ways;
|
||||
private final Collection<OSMRelation> relations;
|
||||
|
||||
public OSMData(Collection<Bound> bounds, Collection<OSMNode> nodes,
|
||||
Collection<OSMWay> ways, Collection<OSMRelation> relations) {
|
||||
|
||||
this.bounds = bounds;
|
||||
this.nodes = nodes;
|
||||
this.ways = ways;
|
||||
this.relations = relations;
|
||||
|
||||
}
|
||||
|
||||
public Collection<OSMNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public Collection<OSMWay> getWays() {
|
||||
return ways;
|
||||
}
|
||||
|
||||
public Collection<OSMRelation> getRelations() {
|
||||
return relations;
|
||||
}
|
||||
|
||||
public Collection<Bound> getBounds() {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Tobias Knerr
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.core.osm;
|
||||
|
||||
import org.oscim.core.TagSet;
|
||||
|
||||
public abstract class OSMElement {
|
||||
|
||||
public final TagSet tags;
|
||||
public final long id;
|
||||
|
||||
public OSMElement(TagSet tags, long id) {
|
||||
assert tags != null;
|
||||
this.tags = tags;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
OSMElement other = (OSMElement) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the id, plus an one-letter prefix for the element type
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "?" + id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Tobias Knerr
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.core.osm;
|
||||
|
||||
public class OSMMember {
|
||||
public enum MemberType{
|
||||
NODE,
|
||||
WAY,
|
||||
RELATIOM
|
||||
}
|
||||
static final boolean useDebugLabels = true;
|
||||
|
||||
public final String role;
|
||||
public final OSMElement member;
|
||||
|
||||
public OSMMember(String role, OSMElement member) {
|
||||
assert role != null && member != null;
|
||||
this.role = role;
|
||||
this.member = member;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return role + ":" + member;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Tobias Knerr
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.core.osm;
|
||||
|
||||
import org.oscim.core.TagSet;
|
||||
|
||||
public class OSMNode extends OSMElement {
|
||||
//public static EMPTY_NODE = new OSMNode()
|
||||
|
||||
public final double lat;
|
||||
public final double lon;
|
||||
|
||||
public OSMNode(double lat, double lon, TagSet tags, long id) {
|
||||
super(tags, id);
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "n" + id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Tobias Knerr
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.core.osm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.oscim.core.TagSet;
|
||||
|
||||
public class OSMRelation extends OSMElement {
|
||||
|
||||
public final List<OSMMember> relationMembers;
|
||||
|
||||
// content added after constructor call
|
||||
|
||||
public OSMRelation(TagSet tags, long id, int initialMemberSize) {
|
||||
super(tags, id);
|
||||
this.relationMembers =
|
||||
new ArrayList<OSMMember>(initialMemberSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "r" + id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Tobias Knerr
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.core.osm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.oscim.core.TagSet;
|
||||
|
||||
public class OSMWay extends OSMElement {
|
||||
|
||||
public final List<OSMNode> nodes;
|
||||
|
||||
public OSMWay(TagSet tags, long id, List<OSMNode> nodes) {
|
||||
super(tags, id);
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
return nodes.size() > 0 &&
|
||||
nodes.get(0).equals(nodes.get(nodes.size() - 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "w" + id;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user