本文整理汇总了Java中de.topobyte.osm4j.core.model.iface.OsmNode.getLatitude方法的典型用法代码示例。如果您正苦于以下问题:Java OsmNode.getLatitude方法的具体用法?Java OsmNode.getLatitude怎么用?Java OsmNode.getLatitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.topobyte.osm4j.core.model.iface.OsmNode
的用法示例。
在下文中一共展示了OsmNode.getLatitude方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import de.topobyte.osm4j.core.model.iface.OsmNode; //导入方法依赖的package包/类
public static InMemoryListDataSet read(OsmIterator iterator,
boolean keepNodeTags, boolean keepWayTags, boolean keepRelationTags)
throws IOException {
InMemoryListDataSet dataSet = new InMemoryListDataSet();
List<OsmNode> nodes = dataSet.getNodes();
List<OsmWay> ways = dataSet.getWays();
List<OsmRelation> relations = dataSet.getRelations();
if (iterator.hasBounds()) {
dataSet.setBounds(iterator.getBounds());
}
while (iterator.hasNext()) {
EntityContainer container = iterator.next();
switch (container.getType()) {
case Node:
OsmNode node = (OsmNode) container.getEntity();
if (!keepNodeTags) {
node = new Node(node.getId(), node.getLongitude(),
node.getLatitude());
}
nodes.add(node);
break;
case Way:
OsmWay way = (OsmWay) container.getEntity();
if (!keepWayTags) {
TLongArrayList ids = new TLongArrayList();
for (int i = 0; i < way.getNumberOfNodes(); i++) {
ids.add(way.getNodeId(i));
}
way = new Way(way.getId(), ids);
}
ways.add(way);
break;
case Relation:
OsmRelation relation = (OsmRelation) container.getEntity();
if (!keepRelationTags) {
List<OsmRelationMember> members = new ArrayList<>();
for (int i = 0; i < relation.getNumberOfMembers(); i++) {
members.add(relation.getMember(i));
}
relation = new Relation(relation.getId(), members);
}
relations.add(relation);
break;
}
}
return dataSet;
}
示例2: read
import de.topobyte.osm4j.core.model.iface.OsmNode; //导入方法依赖的package包/类
public static InMemoryMapDataSet read(OsmIterator iterator,
boolean keepNodeTags, boolean keepWayTags, boolean keepRelationTags)
throws IOException {
InMemoryMapDataSet dataSet = new InMemoryMapDataSet();
TLongObjectMap<OsmNode> nodes = dataSet.getNodes();
TLongObjectMap<OsmWay> ways = dataSet.getWays();
TLongObjectMap<OsmRelation> relations = dataSet.getRelations();
if (iterator.hasBounds()) {
dataSet.setBounds(iterator.getBounds());
}
while (iterator.hasNext()) {
EntityContainer container = iterator.next();
switch (container.getType()) {
case Node:
OsmNode node = (OsmNode) container.getEntity();
if (!keepNodeTags) {
node = new Node(node.getId(), node.getLongitude(),
node.getLatitude());
}
nodes.put(node.getId(), node);
break;
case Way:
OsmWay way = (OsmWay) container.getEntity();
if (!keepWayTags) {
TLongArrayList ids = new TLongArrayList();
for (int i = 0; i < way.getNumberOfNodes(); i++) {
ids.add(way.getNodeId(i));
}
way = new Way(way.getId(), ids);
}
ways.put(way.getId(), way);
break;
case Relation:
OsmRelation relation = (OsmRelation) container.getEntity();
if (!keepRelationTags) {
List<OsmRelationMember> members = new ArrayList<>();
for (int i = 0; i < relation.getNumberOfMembers(); i++) {
members.add(relation.getMember(i));
}
relation = new Relation(relation.getId(), members);
}
relations.put(relation.getId(), relation);
break;
}
}
return dataSet;
}
示例3: clone
import de.topobyte.osm4j.core.model.iface.OsmNode; //导入方法依赖的package包/类
public static Node clone(OsmNode node) {
List<? extends OsmTag> tags = cloneTags(node);
OsmMetadata metadata = cloneMetadata(node);
return new Node(node.getId(), node.getLongitude(), node.getLatitude(),
tags, metadata);
}
示例4: buildCoordinate
import de.topobyte.osm4j.core.model.iface.OsmNode; //导入方法依赖的package包/类
/**
* Build a Coordinate from the given node.
*
* @param node the node to use for building.
* @return the constructed Coordinate.
*/
public Coordinate buildCoordinate(OsmNode node) {
double lon = node.getLongitude();
double lat = node.getLatitude();
return new Coordinate(lon, lat);
}