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


C++ CoordinateSystem::envelope方法代码示例

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


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

示例1: loadMetaData

bool CoordinateSystemConnector::loadMetaData(IlwisObject* data, const IOOptions& options)
{
    Ilwis3Connector::loadMetaData(data, options);
    CoordinateSystem *csy = static_cast<CoordinateSystem *>(data);
    QString ellipsoideName;

    IEllipsoid ell = getEllipsoid();
    GeodeticDatum *datum = getDatum(ellipsoideName);
    if ( !ell.isValid() && ellipsoideName != sUNDEF){
        QString ellres = QString("ilwis://tables/ellipsoid?code=%1").arg(ellipsoideName);
       if (!ell.prepare(ellres)) {
              return ERROR1("No ellipsoid for this code %1",ellipsoideName);
       }
    }

    QString cb = _odf->value("CoordSystem", "CoordBounds");
    QStringList cbparts = cb.split(" ");
    if ( cbparts.size() == 4 && cbparts[0] != "-1e+308") {
        bool ok1, ok2, ok3, ok4;
        Envelope box( Coordinate(
                                cbparts[0].toDouble(&ok1),
                                cbparts[1].toDouble(&ok2)),
                           Coordinate(
                                cbparts[2].toDouble(&ok3),
                                cbparts[3].toDouble(&ok4)));
        if ( !( ok1 && ok2 && ok3 && ok4)) {
            return ERROR2(ERR_NO_INITIALIZED_2, TR("envelop"), csy->name());
        }
        csy->envelope(box);
    } else {
        QString type = _odf->value("CoordSystem", "Type");
        if ( type == "LatLon") {
            Envelope box(Coordinate(-180,-90), Coordinate(180,90));
            csy->envelope(box);
        }
    }

    if ( type() == itCONVENTIONALCOORDSYSTEM ) {
        ConventionalCoordinateSystem *csycc = static_cast<ConventionalCoordinateSystem *>(csy);
        IProjection proj = getProjection(csycc);
        if ( !proj.isValid()) {
            return ERROR1(ERR_NO_INITIALIZED_1, "projection");
        }
        csycc->setDatum(datum);
        csycc->setEllipsoid(ell);
        csycc->setProjection(proj);
        proj->setCoordinateSystem(csycc);


        proj->setParameter(Projection::pvELLCODE, ell->toProj4());
        csycc->prepare();
    } else if ( type() == itUNKNOWN){
        //TODO: other types of csy
    }
    return true;
}
开发者ID:CarstenHollmann,项目名称:IlwisConnectors,代码行数:56,代码来源:coordinatesystemconnector.cpp

示例2: kernel

bool CoordinateSystemSerializerV1::store(IlwisObject *obj, const IOOptions &options)
{
    if (!VersionedSerializer::store(obj, options))
        return false;

    CoordinateSystem *csy = static_cast<CoordinateSystem *>(obj);
    if ( csy->ilwisType() == itCONVENTIONALCOORDSYSTEM){
        VersionedDataStreamFactory *factory = kernel()->factory<VersionedDataStreamFactory>("ilwis::VersionedDataStreamFactory");
        if (!factory)
            return false;
        std::unique_ptr<DataInterface> projstreamer(factory->create(Version::interfaceVersion, itPROJECTION,_stream));
        if ( !projstreamer)
            return false;
        ConventionalCoordinateSystem *ccsy = static_cast<ConventionalCoordinateSystem *>(csy);
        storeSystemPath(ccsy->projection()->resource());
        projstreamer->store(ccsy->projection().ptr(),options);
        std::unique_ptr<DataInterface> ellstreamer(factory->create(Version::interfaceVersion, itELLIPSOID,_stream));
        if ( !ellstreamer)
            return false;
        storeSystemPath(ccsy->ellipsoid()->resource());
        ellstreamer->store(ccsy->ellipsoid().ptr(),options);

        const std::unique_ptr<GeodeticDatum>& datum = ccsy->datum();
        if ( datum){
            _stream << itGEODETICDATUM << datum->name() << datum->code() << datum->description() << datum->area() << datum->authority();
            for(int i =0; i < 10; ++i)
                _stream << datum->parameter((GeodeticDatum::DatumParameters)i);
        }else
            _stream << itUNKNOWN;

        _stream << ccsy->unit();

    }
    _stream << csy->envelope().min_corner().x << csy->envelope().min_corner().y << csy->envelope().max_corner().x << csy->envelope().max_corner().y;
    return true;

}
开发者ID:52North,项目名称:IlwisConnectors,代码行数:37,代码来源:coordinatesystemserializerv1.cpp


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