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


C++ VSIFPrintfL函数代码示例

本文整理汇总了C++中VSIFPrintfL函数的典型用法代码示例。如果您正苦于以下问题:C++ VSIFPrintfL函数的具体用法?C++ VSIFPrintfL怎么用?C++ VSIFPrintfL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: VSIFPrintfL

int ERSHdrNode::WriteSelf( VSILFILE * fp, int nIndent )

{
    CPLString oIndent;

    oIndent.assign( nIndent, '\t' );

    for( int i = 0; i < nItemCount; i++ )
    {
        if( papszItemValue[i] != nullptr )
        {
            if( VSIFPrintfL( fp, "%s%s\t= %s\n",
                             oIndent.c_str(),
                             papszItemName[i],
                             papszItemValue[i] ) < 1 )
                return FALSE;
        }
        else
        {
            VSIFPrintfL( fp, "%s%s Begin\n",
                         oIndent.c_str(), papszItemName[i] );
            if( !papoItemChild[i]->WriteSelf( fp, nIndent+1 ) )
                return FALSE;
            if( VSIFPrintfL( fp, "%s%s End\n",
                             oIndent.c_str(), papszItemName[i] ) < 1 )
                return FALSE;
        }
    }

    return TRUE;
}
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:31,代码来源:ershdrnode.cpp

示例2: OGRGetXML_UTF8_EscapedString

void OGRJMLWriterLayer::WriteColumnDeclaration( const char* pszName,
                                                     const char* pszType )
{
    char* pszEscapedName = OGRGetXML_UTF8_EscapedString( pszName );
    if( bClassicGML )
    {
        VSIFPrintfL(fp, "     <column>\n"
                        "          <name>%s</name>\n"
                        "          <type>%s</type>\n"
                        "          <valueElement elementName=\"%s\"/>\n"
                        "          <valueLocation position=\"body\"/>\n"
                        "     </column>\n",
                    pszEscapedName, pszType, pszEscapedName);
    }
    else
    {
        VSIFPrintfL(fp, "     <column>\n"
                        "          <name>%s</name>\n"
                        "          <type>%s</type>\n"
                        "          <valueElement elementName=\"property\" attributeName=\"name\" attributeValue=\"%s\"/>\n"
                        "          <valueLocation position=\"body\"/>\n"
                        "     </column>\n",
                    pszEscapedName, pszType, pszEscapedName);
    }
    CPLFree(pszEscapedName);
}
开发者ID:drownedout,项目名称:datamap,代码行数:26,代码来源:ogrjmlwriterlayer.cpp

示例3: VSIFPrintfL

OGRJMLWriterLayer::~OGRJMLWriterLayer()
{
    if( !bFeaturesWritten )
        VSIFPrintfL(fp, "</ColumnDefinitions>\n</JCSGMLInputTemplate>\n<featureCollection>\n");
    VSIFPrintfL(fp, "</featureCollection>\n</JCSDataFile>\n");
    poFeatureDefn->Release();
}
开发者ID:drownedout,项目名称:datamap,代码行数:7,代码来源:ogrjmlwriterlayer.cpp

示例4: VSIFPrintfL

OGRGeoRSSDataSource::~OGRGeoRSSDataSource()

{
    if ( fpOutput != NULL )
    {
        if (bWriteHeaderAndFooter)
        {
            if (eFormat == GEORSS_RSS)
            {
                VSIFPrintfL(fpOutput, "  </channel>\n");
                VSIFPrintfL(fpOutput, "</rss>\n");
            }
            else
            {
                VSIFPrintfL(fpOutput, "</feed>\n");
            }
        }
        VSIFCloseL( fpOutput);
    }

    for( int i = 0; i < nLayers; i++ )
        delete papoLayers[i];
    CPLFree( papoLayers );
    CPLFree( pszName );
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:25,代码来源:ogrgeorssdatasource.cpp

示例5: OGRFormatDouble

void OGRBNALayer::WriteCoord(VSILFILE* fp, double dfX, double dfY)
{
    char szBuffer[64];
    OGRFormatDouble(szBuffer, sizeof(szBuffer), dfX, '.', poDS->GetCoordinatePrecision());
    VSIFPrintfL( fp, "%s", szBuffer);
    VSIFPrintfL( fp, "%s", poDS->GetCoordinateSeparator());
    OGRFormatDouble(szBuffer, sizeof(szBuffer), dfY, '.', poDS->GetCoordinatePrecision());
    VSIFPrintfL( fp, "%s", szBuffer);
}
开发者ID:Mofangbao,项目名称:node-gdal,代码行数:9,代码来源:ogrbnalayer.cpp

示例6: EQUAL

OGRErr OGRILI2Layer::ICreateFeature( OGRFeature *poFeature ) {
    char szTempBuffer[80];
    const char* tid;
    int iField = 0;
    if( poFeatureDefn->GetFieldCount() &&
        EQUAL(poFeatureDefn->GetFieldDefn(iField)->GetNameRef(), "TID") )
    {
        tid = poFeature->GetFieldAsString(0);
        ++iField;
    }
    else
    {
        snprintf( szTempBuffer, sizeof(szTempBuffer), CPL_FRMT_GIB,
                  poFeature->GetFID() );
        tid = szTempBuffer;
    }

    VSILFILE* fp = poDS->GetOutputFP();
    if (fp == NULL)
        return OGRERR_FAILURE;

    VSIFPrintfL(fp, "<%s TID=\"%s\">\n", poFeatureDefn->GetName(), tid);

    // Write out Geometries
    for( int iGeomField = 0;
         iGeomField < poFeatureDefn->GetGeomFieldCount();
         iGeomField++ )
    {
        OGRGeomFieldDefn *poFieldDefn
            = poFeatureDefn->GetGeomFieldDefn(iGeomField);
        OGRGeometry* poGeom = poFeature->GetGeomFieldRef(iGeomField);
        if( poGeom != NULL )
        {
            CPLString iliGeomType = GetIliGeomType(poFieldDefn->GetNameRef());
            OGR2ILIGeometryAppend( poGeom, fp, poFieldDefn->GetNameRef(),
                                   iliGeomType );
        }
    }

    // Write all "set" fields.
    for( ; iField < poFeatureDefn->GetFieldCount(); iField++ )
    {

        OGRFieldDefn *poField = poFeatureDefn->GetFieldDefn( iField );

        if( poFeature->IsFieldSet( iField ) )
        {
            const char *pszRaw = poFeature->GetFieldAsString( iField );
            VSIFPrintfL(fp, "<%s>%s</%s>\n", poField->GetNameRef(), pszRaw, poField->GetNameRef());
        }
    }

    VSIFPrintfL(fp, "</%s>\n", poFeatureDefn->GetName());

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

示例7: VSIFPrintfL

OGRGeoJSONWriteLayer::~OGRGeoJSONWriteLayer()
{
    VSILFILE* fp = poDS_->GetOutputFile();

    VSIFPrintfL( fp, "\n]" );

    if( bWriteFC_BBOX && sEnvelopeLayer.IsInit() )
    {
        CPLString osBBOX = "[ ";
        if( bRFC7946_ )
        {
            osBBOX += CPLSPrintf("%.*f, ", nCoordPrecision_, sEnvelopeLayer.MinX);
            osBBOX += CPLSPrintf("%.*f, ", nCoordPrecision_, sEnvelopeLayer.MinY);
            if( bBBOX3D )
                osBBOX += CPLSPrintf("%.*f, ", nCoordPrecision_, sEnvelopeLayer.MinZ);
            osBBOX += CPLSPrintf("%.*f, ", nCoordPrecision_, sEnvelopeLayer.MaxX);
            osBBOX += CPLSPrintf("%.*f", nCoordPrecision_, sEnvelopeLayer.MaxY);
            if( bBBOX3D )
                osBBOX += CPLSPrintf(", %.*f", nCoordPrecision_, sEnvelopeLayer.MaxZ);
        }
        else
        {
            osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MinX);
            osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MinY);
            if( bBBOX3D )
                osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MinZ);
            osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MaxX);
            osBBOX += CPLSPrintf("%.15g", sEnvelopeLayer.MaxY);
            if( bBBOX3D )
                osBBOX += CPLSPrintf(", %.15g", sEnvelopeLayer.MaxZ);
        }
        osBBOX += " ]";

        if( poDS_->GetFpOutputIsSeekable() &&
            osBBOX.size() + 9 < OGRGeoJSONDataSource::SPACE_FOR_BBOX )
        {
            VSIFSeekL(fp, poDS_->GetBBOXInsertLocation(), SEEK_SET);
            VSIFPrintfL( fp, "\"bbox\": %s,", osBBOX.c_str() );
            VSIFSeekL(fp, 0, SEEK_END);
        }
        else
        {
            VSIFPrintfL( fp, ",\n\"bbox\": %s", osBBOX.c_str() );
        }
    }

    VSIFPrintfL( fp, "\n}\n" );

    if( nullptr != poFeatureDefn_ )
    {
        poFeatureDefn_->Release();
    }

    delete poCT_;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:55,代码来源:ogrgeojsonwritelayer.cpp

示例8: OGRFeature

OGRErr OGRGeoJSONSeqWriteLayer::ICreateFeature( OGRFeature* poFeature )
{
    VSILFILE* fp = m_poDS->GetOutputFile();

    std::unique_ptr<OGRFeature> poFeatureToWrite;
    if( m_poCT != nullptr )
    {
        poFeatureToWrite.reset(new OGRFeature(m_poFeatureDefn));
        poFeatureToWrite->SetFrom( poFeature );
        poFeatureToWrite->SetFID( poFeature->GetFID() );
        OGRGeometry* poGeometry = poFeatureToWrite->GetGeometryRef();
        if( poGeometry )
        {
            const char* const apszOptions[] = { "WRAPDATELINE=YES", nullptr };
            OGRGeometry* poNewGeom =
                OGRGeometryFactory::transformWithOptions(
                    poGeometry, m_poCT, const_cast<char**>(apszOptions));
            if( poNewGeom == nullptr )
            {
                return OGRERR_FAILURE;
            }

            OGREnvelope sEnvelope;
            poNewGeom->getEnvelope(&sEnvelope);
            if( sEnvelope.MinX < -180.0 || sEnvelope.MaxX > 180.0 ||
                sEnvelope.MinY < -90.0 || sEnvelope.MaxY > 90.0 )
            {
                CPLError(CE_Failure, CPLE_AppDefined,
                         "Geometry extent outside of [-180.0,180.0]x[-90.0,90.0] bounds");
                return OGRERR_FAILURE;
            }

            poFeatureToWrite->SetGeometryDirectly( poNewGeom );
        }
    }

    json_object* poObj =
        OGRGeoJSONWriteFeature(
            poFeatureToWrite.get() ? poFeatureToWrite.get() : poFeature,
            m_oWriteOptions );
    CPLAssert( nullptr != poObj );

    if( m_bRS )
    {
        VSIFPrintfL( fp, "%c", RS);
    }
    VSIFPrintfL( fp, "%s\n", json_object_to_json_string( poObj ) );

    json_object_put( poObj );

    return OGRERR_NONE;
}
开发者ID:koordinates,项目名称:gdal,代码行数:52,代码来源:ogrgeojsonseqdriver.cpp

示例9: AppendCoordinateList

static void AppendCoordinateList( OGRLineString *poLine, VSILFILE* fp )
{
    int         b3D = wkbHasZ(poLine->getGeometryType());

    for( int iPoint = 0; iPoint < poLine->getNumPoints(); iPoint++ )
    {
        VSIFPrintfL(fp, "<COORD>");
        VSIFPrintfL(fp, "<C1>%s</C1>", d2str(poLine->getX(iPoint)));
        VSIFPrintfL(fp, "<C2>%s</C2>", d2str(poLine->getY(iPoint)));
        if (b3D) VSIFPrintfL(fp, "<C3>%s</C3>", d2str(poLine->getZ(iPoint)));
        VSIFPrintfL(fp, "</COORD>\n");
    }
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:13,代码来源:ogrili2layer.cpp

示例10: AppendCoumpoundCurve

static void AppendCoumpoundCurve( OGRCompoundCurve *poCC,
                                  OGRILI1DataSource *poDS )
{
    for( int iMember = 0; iMember < poCC->getNumCurves(); iMember++)
    {
        OGRCurve *poGeometry = poCC->getCurve( iMember );
        int b3D = wkbHasZ(poGeometry->getGeometryType());
        int bIsArc = (poGeometry->getGeometryType() == wkbCircularString
              || poGeometry->getGeometryType() == wkbCircularStringZ );
        OGRSimpleCurve *poLine = (OGRSimpleCurve *)poGeometry;
        for( int iPoint = 0; iPoint < poLine->getNumPoints(); iPoint++ )
        {
            //Skip last point in curve member
            if (iPoint == poLine->getNumPoints()-1 && iMember < poCC->getNumCurves()-1)
                continue;
            if (iMember == 0 && iPoint == 0) VSIFPrintfL( poDS->GetTransferFile(), "STPT" );
            else if (bIsArc && iPoint == 1) VSIFPrintfL( poDS->GetTransferFile(), "ARCP" );
            else VSIFPrintfL( poDS->GetTransferFile(), "LIPT" );
            VSIFPrintfL( poDS->GetTransferFile(), " %s", d2str(poLine->getX(iPoint)) );
            VSIFPrintfL( poDS->GetTransferFile(), " %s", d2str(poLine->getY(iPoint)) );
            if (b3D) VSIFPrintfL( poDS->GetTransferFile(), " %s", d2str(poLine->getZ(iPoint)) );
            VSIFPrintfL( poDS->GetTransferFile(), "\n" );
        }
    }
    VSIFPrintfL( poDS->GetTransferFile(), "ELIN\n" );
}
开发者ID:OSGeo,项目名称:gdal,代码行数:26,代码来源:ogrili1layer.cpp

示例11: main

int main(int argc, char* argv[])
{
    OSMContext* psContext;
    const char* pszSrcFilename;
    const char* pszDstFilename;
    VSILFILE* fp;

    if( argc != 3 )
    {
        fprintf(stderr, "Usage: osm2osm input.pbf output.osm\n");
        exit(1);
    }

    pszSrcFilename = argv[1];
    pszDstFilename = argv[2];

    fp = VSIFOpenL(pszDstFilename, "wt");
    if( fp == NULL )
    {
        fprintf(stderr, "Cannot create %s.\n", pszDstFilename);
        exit(1);
    }

    psContext = OSM_Open( pszSrcFilename,
                          myNotifyNodesFunc,
                          myNotifyWayFunc,
                          myNotifyRelationFunc,
                          myNotifyBoundsFunc,
                          fp );
    if( psContext == NULL )
    {
        fprintf(stderr, "Cannot process %s.\n", pszSrcFilename);
        exit(1);
    }

    VSIFPrintfL(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    VSIFPrintfL(fp, "<osm version=\"0.6\" generator=\"pbttoosm\">\n");

    while( OSM_ProcessBlock(psContext) == OSM_OK );

    VSIFPrintfL(fp, "</osm>\n");

    OSM_Close( psContext );

    VSIFCloseL(fp);

    return 0;
}
开发者ID:drownedout,项目名称:datamap,代码行数:48,代码来源:osm2osm.c

示例12: GMLWriteField

static void GMLWriteField(OGRGMLDataSource* poDS,
                          VSILFILE *fp,
                          int bWriteSpaceIndentation,
                          const char* pszPrefix,
                          int bRemoveAppPrefix,
                          OGRFieldDefn* poFieldDefn,
                          const char* pszVal )

{
    const char* pszFieldName = poFieldDefn->GetNameRef();

    while( *pszVal == ' ' )
        pszVal++;

    if (bWriteSpaceIndentation)
        VSIFPrintfL(fp, "      ");

    if( bRemoveAppPrefix )
        poDS->PrintLine( fp, "<%s>%s</%s>",
                        pszFieldName,
                        pszVal,
                        pszFieldName);
    else
        poDS->PrintLine( fp, "<%s:%s>%s</%s:%s>",
                        pszPrefix,
                        pszFieldName,
                        pszVal,
                        pszPrefix,
                        pszFieldName);
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:30,代码来源:ogrgmllayer.cpp

示例13: OGRFeatureDefn

OGRJMLWriterLayer::OGRJMLWriterLayer( const char* pszLayerName,
                                                OGRJMLDataset* poDS,
                                                VSILFILE* fp,
                                                int bAddRGBField,
                                                int bAddOGRStyleField,
                                                int bClassicGML )

{
    this->poDS = poDS;
    this->fp = fp;
    bFeaturesWritten = FALSE;
    this->bAddRGBField = bAddRGBField;
    this->bAddOGRStyleField = bAddOGRStyleField;
    this->bClassicGML = bClassicGML;
    nNextFID = 0;

    poFeatureDefn = new OGRFeatureDefn( pszLayerName );
    SetDescription( poFeatureDefn->GetName() );
    poFeatureDefn->Reference();
    
    VSIFPrintfL(fp, "<?xml version='1.0' encoding='UTF-8'?>\n"
                    "<JCSDataFile xmlns:gml=\"http://www.opengis.net/gml\" "
                    "xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\" >\n"
                    "<JCSGMLInputTemplate>\n"
                    "<CollectionElement>featureCollection</CollectionElement>\n"
                    "<FeatureElement>feature</FeatureElement>\n"
                    "<GeometryElement>geometry</GeometryElement>\n"
                    "<ColumnDefinitions>\n");

}
开发者ID:drownedout,项目名称:datamap,代码行数:30,代码来源:ogrjmlwriterlayer.cpp

示例14: poFeatureDefn

OGRJMLWriterLayer::OGRJMLWriterLayer( const char* pszLayerName,
                                      OGRJMLDataset * /* poDSIn */,
                                      VSILFILE* fpIn,
                                      bool bAddRGBFieldIn,
                                      bool bAddOGRStyleFieldIn,
                                      bool bClassicGMLIn ) :
    poFeatureDefn(new OGRFeatureDefn( pszLayerName )),
    fp(fpIn),
    bFeaturesWritten(false),
    bAddRGBField(bAddRGBFieldIn),
    bAddOGRStyleField(bAddOGRStyleFieldIn),
    bClassicGML(bClassicGMLIn),
    nNextFID(0)
{
    SetDescription( poFeatureDefn->GetName() );
    poFeatureDefn->Reference();

    VSIFPrintfL(fp, "<?xml version='1.0' encoding='UTF-8'?>\n"
                    "<JCSDataFile xmlns:gml=\"http://www.opengis.net/gml\" "
                    "xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\" >\n"
                    "<JCSGMLInputTemplate>\n"
                    "<CollectionElement>featureCollection</CollectionElement>\n"
                    "<FeatureElement>feature</FeatureElement>\n"
                    "<GeometryElement>geometry</GeometryElement>\n"
                    "<ColumnDefinitions>\n");

}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:27,代码来源:ogrjmlwriterlayer.cpp

示例15: VSIFPrintfL

OGRKMLDataSource::~OGRKMLDataSource()
{
    if( fpOutput_ != NULL )
    {
        if( nLayers_ > 0 )
        {
            if( nLayers_ == 1 && papoLayers_[0]->nWroteFeatureCount_ == 0 )
            {
                VSIFPrintfL( fpOutput_, "<Folder><name>%s</name>\n", papoLayers_[0]->GetName() );
            }

            VSIFPrintfL( fpOutput_, "%s", "</Folder>\n");

            for( int i = 0; i < nLayers_; i++ )
            {
                if( !(papoLayers_[i]->bSchemaWritten_) && papoLayers_[i]->nWroteFeatureCount_ != 0 )
                {
                    CPLString osRet = papoLayers_[i]->WriteSchema();
                    if( osRet.size() )
                        VSIFPrintfL( fpOutput_, "%s", osRet.c_str() );
                }
            }
        }
        VSIFPrintfL( fpOutput_, "%s", "</Document></kml>\n" );

        VSIFCloseL( fpOutput_ );
    }

    CSLDestroy( papszCreateOptions_ );
    CPLFree( pszName_ );
    CPLFree( pszNameField_ );
    CPLFree( pszDescriptionField_ );
    CPLFree( pszAltitudeMode_ );

    for( int i = 0; i < nLayers_; i++ )
    {
        delete papoLayers_[i];
    }

    CPLFree( papoLayers_ );

#ifdef HAVE_EXPAT    
    delete poKMLFile_;
#endif
}
开发者ID:drownedout,项目名称:datamap,代码行数:45,代码来源:ogrkmldatasource.cpp


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