本文整理汇总了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;
}
示例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);
}
示例3: VSIFPrintfL
OGRJMLWriterLayer::~OGRJMLWriterLayer()
{
if( !bFeaturesWritten )
VSIFPrintfL(fp, "</ColumnDefinitions>\n</JCSGMLInputTemplate>\n<featureCollection>\n");
VSIFPrintfL(fp, "</featureCollection>\n</JCSDataFile>\n");
poFeatureDefn->Release();
}
示例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 );
}
示例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);
}
示例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;
}
示例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_;
}
示例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;
}
示例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");
}
}
示例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" );
}
示例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;
}
示例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);
}
示例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");
}
示例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");
}
示例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
}