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


C++ KmlFactory::CreateFolder方法代码示例

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


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

示例1: ICreateFeature

OGRErr OGRLIBKMLLayer::ICreateFeature (
    OGRFeature * poOgrFeat )
{

    if ( !bUpdate )
        return OGRERR_UNSUPPORTED_OPERATION;

    if( m_bRegionBoundsAuto && poOgrFeat->GetGeometryRef() != NULL &&
        !(poOgrFeat->GetGeometryRef()->IsEmpty()) )
    {
        OGREnvelope sEnvelope;
        poOgrFeat->GetGeometryRef()->getEnvelope(&sEnvelope);
        m_dfRegionMinX = MIN(m_dfRegionMinX, sEnvelope.MinX);
        m_dfRegionMinY = MIN(m_dfRegionMinY, sEnvelope.MinY);
        m_dfRegionMaxX = MAX(m_dfRegionMaxX, sEnvelope.MaxX);
        m_dfRegionMaxY = MAX(m_dfRegionMaxY, sEnvelope.MaxY);
    }

    FeaturePtr poKmlFeature =
        feat2kml ( m_poOgrDS, this, poOgrFeat, m_poOgrDS->GetKmlFactory (  ),
                   m_bUseSimpleField );

    if( m_poKmlLayer != NULL )
        m_poKmlLayer->add_feature ( poKmlFeature );
    else
    {
        CPLAssert( m_poKmlUpdate != NULL );
        KmlFactory *poKmlFactory = m_poOgrDS->GetKmlFactory (  );
        CreatePtr poCreate = poKmlFactory->CreateCreate();
        ContainerPtr poContainer;
        if( m_bUpdateIsFolder )
            poContainer = poKmlFactory->CreateFolder();
        else
            poContainer = poKmlFactory->CreateDocument();
        poContainer->set_targetid(OGRLIBKMLGetSanitizedNCName(GetName()));
        poContainer->add_feature ( poKmlFeature );
        poCreate->add_container(poContainer);
        m_poKmlUpdate->add_updateoperation(poCreate);
    }

    /***** update the layer class count of features  *****/

    if( m_poKmlLayer != NULL )
    {
        nFeatures++;

        const char* pszId = CPLSPrintf("%s.%d",
                        OGRLIBKMLGetSanitizedNCName(GetName()).c_str(), nFeatures);
        poOgrFeat->SetFID(nFeatures);
        poKmlFeature->set_id(pszId);
    }
    else
    {
        if( poOgrFeat->GetFID() < 0 )
        {
            static int bAlreadyWarned = FALSE;
            if( !bAlreadyWarned )
            {
                bAlreadyWarned = TRUE;
                CPLError(CE_Warning, CPLE_AppDefined,
                         "It is recommended to define a FID when calling CreateFeature() in a update document");
            }
        }
        else
        {
            const char* pszId = CPLSPrintf("%s." CPL_FRMT_GIB,
                    OGRLIBKMLGetSanitizedNCName(GetName()).c_str(), poOgrFeat->GetFID());
            poOgrFeat->SetFID(nFeatures);
            poKmlFeature->set_id(pszId);
        }
    }

    /***** mark the layer as updated *****/

    bUpdated = TRUE;
    m_poOgrDS->Updated (  );

    return OGRERR_NONE;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:79,代码来源:ogrlibkmllayer.cpp


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