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


C++ SpatialReference::empty方法代码示例

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


在下文中一共展示了SpatialReference::empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transformWkt

std::string transformWkt(std::string wkt, const SpatialReference& from,
    const SpatialReference& to)
{
    //ABELL - Should this throw?  Return empty string?
    if (from.empty() || to.empty())
        return wkt;

    gdal::SpatialRef fromRef(from.getWKT());
    gdal::SpatialRef toRef(to.getWKT());
    gdal::Geometry geom(wkt, fromRef);
    geom.transform(toRef);
    return geom.wkt();
}
开发者ID:OldMogy,项目名称:PDAL,代码行数:13,代码来源:GDALUtils.cpp

示例2: transform

Polygon Polygon::transform(const SpatialReference& ref) const
{
    if (m_srs.empty())
        throw pdal_error("Polygon::transform failed due to m_srs being empty");
    if (ref.empty())
        throw pdal_error("Polygon::transform failed due to ref being empty");

    gdal::SpatialRef fromRef(m_srs.getWKT());
    gdal::SpatialRef toRef(ref.getWKT());
    gdal::Geometry geom(wkt(12, true), fromRef);
    geom.transform(toRef);
    return Polygon(geom.wkt(), ref, m_ctx);
}
开发者ID:kirkjens,项目名称:PDAL,代码行数:13,代码来源:Polygon.cpp

示例3: extractMetadata

void StatsFilter::extractMetadata(PointTableRef table)
{
    uint32_t position(0);

    for (auto di = m_stats.begin(); di != m_stats.end(); ++di)
    {
        const Summary& s = di->second;

        MetadataNode t = m_metadata.addList("statistic");
        t.add("position", position++);
        s.extractMetadata(t);
    }

    // If we have X, Y, & Z dims, output bboxes
    auto xs = m_stats.find(Dimension::Id::X);
    auto ys = m_stats.find(Dimension::Id::Y);
    auto zs = m_stats.find(Dimension::Id::Z);
    if (xs != m_stats.end() &&
        ys != m_stats.end() &&
        zs != m_stats.end())
    {
        BOX3D box(xs->second.minimum(), ys->second.minimum(), zs->second.minimum(),
                  xs->second.maximum(), ys->second.maximum(), zs->second.maximum());
        pdal::Polygon p(box);

        MetadataNode mbox = Utils::toMetadata(box);
        MetadataNode box_metadata = m_metadata.add("bbox");
        MetadataNode metadata = box_metadata.add("native");
        MetadataNode boundary = metadata.add("boundary", p.json());
        MetadataNode bbox = metadata.add(mbox);
        SpatialReference ref = table.anySpatialReference();
        // if we don't get an SRS from the PointTableRef,
        // we won't add another metadata node
        if (!ref.empty())
        {
            p.setSpatialReference(ref);
            SpatialReference epsg4326("EPSG:4326");
            pdal::Polygon pdd = p.transform(epsg4326);
            BOX3D ddbox = pdd.bounds();
            MetadataNode epsg_4326_box = Utils::toMetadata(ddbox);
            MetadataNode dddbox = box_metadata.add("EPSG:4326");
            dddbox.add(epsg_4326_box);
            MetadataNode ddboundary = dddbox.add("boundary", pdd.json());


        }
    }
}
开发者ID:FeodorFitsner,项目名称:PDAL,代码行数:48,代码来源:StatsFilter.cpp

示例4: setSrsFromGeotiff

void LasHeader::setSrsFromGeotiff()
{
    LasVLR *vlr;
    uint8_t *data;
    size_t dataLen;

    vlr = findVlr(TRANSFORM_USER_ID, GEOTIFF_DIRECTORY_RECORD_ID);
    // We must have a directory entry.
    if (!vlr)
        return;
    data = (uint8_t *)vlr->data();
    dataLen = vlr->dataLen();

    std::vector<uint8_t> directoryRec(data, data + dataLen);

    vlr = findVlr(TRANSFORM_USER_ID, GEOTIFF_DOUBLES_RECORD_ID);
    data = NULL;
    dataLen = 0;
    if (vlr && !vlr->isEmpty())
    {
        data = (uint8_t *)vlr->data();
        dataLen = vlr->dataLen();
    }
    std::vector<uint8_t> doublesRec(data, data + dataLen);

    vlr = findVlr(TRANSFORM_USER_ID, GEOTIFF_ASCII_RECORD_ID);
    data = NULL;
    dataLen = 0;
    if (vlr && !vlr->isEmpty())
    {
        data = (uint8_t *)vlr->data();
        dataLen = vlr->dataLen();
    }
    std::vector<uint8_t> asciiRec(data, data + dataLen);

    GeotiffSrs geotiff(directoryRec, doublesRec, asciiRec);
    SpatialReference gtiffSrs = geotiff.srs();
    if (!gtiffSrs.empty())
        m_srs = gtiffSrs;
}
开发者ID:,项目名称:,代码行数:40,代码来源:

示例5: execute

PointViewSet Stage::execute(PointTableRef table)
{
    table.finalize();

    PointViewSet views;

    // If the inputs are empty, we're a reader.
    if (m_inputs.empty())
    {
        views.insert(PointViewPtr(new PointView(table)));
    }
    else
    {
        for (size_t i = 0; i < m_inputs.size(); ++i)
        {
            Stage *prev = m_inputs[i];
            PointViewSet temp = prev->execute(table);
            views.insert(temp.begin(), temp.end());
        }
    }

    PointViewSet outViews;
    std::vector<StageRunnerPtr> runners;

    // Put the spatial references from the views onto the table.
    // The table's spatial references are only valid as long as the stage
    // is running.
    // ABELL - Should we clear the references once the stage run has
    //   completed?  Wondering if that would break something where a
    //   writer wants to check a table's SRS.
    SpatialReference srs;
    table.clearSpatialReferences();
    for (auto const& it : views)
        table.addSpatialReference(it->spatialReference());

    // Do the ready operation and then start running all the views
    // through the stage.
    ready(table);
    for (auto const& it : views)
    {
        StageRunnerPtr runner(new StageRunner(this, it));
        runners.push_back(runner);
        runner->run();
    }

    // As the stages complete (synchronously at this time), propagate the
    // spatial reference and merge the output views.
    srs = getSpatialReference();
    for (auto const& it : runners)
    {
        StageRunnerPtr runner(it);
        PointViewSet temp = runner->wait();

        // If our stage has a spatial reference, the view takes it on once
        // the stage has been run.
        if (!srs.empty())
            for (PointViewPtr v : temp)
                v->setSpatialReference(srs);
        outViews.insert(temp.begin(), temp.end());
    }
    done(table);
    return outViews;
}
开发者ID:cugwhp,项目名称:PDAL,代码行数:63,代码来源:Stage.cpp

示例6: execute

// Streamed execution.
void Stage::execute(StreamPointTable& table)
{
    typedef std::list<Stage *> StageList;

    SpatialReference srs;
    std::list<StageList> lists;
    StageList stages;
    StageList readies;

    table.finalize();

    // Walk from the current stage backwards.  As we add each input, copy
    // the list of stages and push it on a list.  We then pull a list from the
    // back of list and keep going.  Pushing on the front and pulling from the
    // back insures that the stages will be executed in the order that they
    // were added.  If we hit stage with no previous stages, we execute
    // the stage list.
    // All this often amounts to a bunch of list copying for
    // no reason, but it's more simple than what we might otherwise do and
    // this should be a nit in the grand scheme of execution time.
    //
    // As an example, if there are four paths from the end stage (writer) to
    // reader stages, there will be four stage lists and execute(table, stages)
    // will be called four times.
    Stage *s = this;
    stages.push_front(s);
    while (true)
    {
        if (s->m_inputs.empty())
        {
            // Ready stages before we execute.
            for (auto s2 : stages)
                if (!Utils::contains(readies, s2))
                {
                    s2->pushLogLeader();
                    s2->ready(table);
                    s2->pushLogLeader();
                    readies.push_back(s2);
                    srs = s2->getSpatialReference();
                    if (!srs.empty())
                        table.setSpatialReference(srs);
                }
            execute(table, stages);
        }
        else
        {
            for (auto s2 : s->m_inputs)
            {
                StageList newStages(stages);
                newStages.push_front(s2);
                lists.push_front(newStages);
            }
        }
        if (lists.empty())
            break;
        stages = lists.back();
        lists.pop_back();
        s = stages.front();
    }

    for (auto s2 : stages)
    {
        s2->pushLogLeader();
        s2->l_done(table);
        s2->popLogLeader();
    }
}
开发者ID:,项目名称:,代码行数:68,代码来源:


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