当前位置: 首页>>代码示例>>Java>>正文


Java OsmNode.getLongitude方法代码示例

本文整理汇总了Java中de.topobyte.osm4j.core.model.iface.OsmNode.getLongitude方法的典型用法代码示例。如果您正苦于以下问题:Java OsmNode.getLongitude方法的具体用法?Java OsmNode.getLongitude怎么用?Java OsmNode.getLongitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.topobyte.osm4j.core.model.iface.OsmNode的用法示例。


在下文中一共展示了OsmNode.getLongitude方法的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;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:52,代码来源:ListDataSetLoader.java

示例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;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:52,代码来源:MapDataSetLoader.java

示例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);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:7,代码来源:ImplUtil.java

示例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);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:12,代码来源:NodeBuilder.java


注:本文中的de.topobyte.osm4j.core.model.iface.OsmNode.getLongitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。