本文整理汇总了C++中DDFModule::Dump方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFModule::Dump方法的具体用法?C++ DDFModule::Dump怎么用?C++ DDFModule::Dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFModule
的用法示例。
在下文中一共展示了DDFModule::Dump方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mk_s57
//.........这里部分代码省略.........
poFDefn->Create( "SG2D", "2-D coordinate field", "*",
dsc_vector, dtc_mixed_data_type );
/* how do I mark this as repeating? */
poFDefn->AddSubfield( "YCOO", "b24" );
poFDefn->AddSubfield( "XCOO", "b24" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the SG3D field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "SG3D", "3-D coordinate (sounding array) field", "*",
dsc_vector, dtc_mixed_data_type );
/* how do I mark this as repeating? */
poFDefn->AddSubfield( "YCOO", "b24" );
poFDefn->AddSubfield( "XCOO", "b24" );
poFDefn->AddSubfield( "VE3D", "b24" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
// need to add: VRPC, VRPT, SGCC, FRID, FOID, ATTF, NATF, FFPC,
// FFPT, FSPC, and FSPT
/* -------------------------------------------------------------------- */
/* Create file. */
/* -------------------------------------------------------------------- */
oModule.Dump( stdout );
oModule.Create( "out.000" );
/* -------------------------------------------------------------------- */
/* Create a record. */
/* -------------------------------------------------------------------- */
DDFRecord *poRec = new DDFRecord( &oModule );
DDFField *poField;
poField = poRec->AddField( oModule.FindFieldDefn( "0001" ) );
poRec->SetFieldRaw( poField, 0, "\1\0\036", 3 );
poField = poRec->AddField( oModule.FindFieldDefn( "DSID" ) );
poRec->SetIntSubfield ( "DSID", 0, "RCNM", 0, 10 );
poRec->SetIntSubfield ( "DSID", 0, "RCID", 0, 1 );
poRec->SetIntSubfield ( "DSID", 0, "EXPP", 0, 1 );
poRec->SetIntSubfield ( "DSID", 0, "INTU", 0, 4 );
poRec->SetStringSubfield( "DSID", 0, "DSNM", 0, "GB4X0000.000" );
poRec->SetStringSubfield( "DSID", 0, "EDTN", 0, "2" );
poRec->SetStringSubfield( "DSID", 0, "UPDN", 0, "0" );
poRec->SetStringSubfield( "DSID", 0, "UADT", 0, "20010409" );
poRec->SetStringSubfield( "DSID", 0, "ISDT", 0, "20010409" );
poRec->SetFloatSubfield ( "DSID", 0, "STED", 0, 3.1 );
poRec->SetIntSubfield ( "DSID", 0, "PRSP", 0, 1 );
poRec->SetStringSubfield( "DSID", 0, "PSDN", 0, "" );
poRec->SetStringSubfield( "DSID", 0, "PRED", 0, "2.0" );
poRec->SetIntSubfield ( "DSID", 0, "PROF", 0, 1 );
poRec->SetIntSubfield ( "DSID", 0, "AGEN", 0, 540 );
poRec->SetStringSubfield( "DSID", 0, "COMT", 0, "" );
poField = poRec->AddField( oModule.FindFieldDefn( "DSSI" ) );
示例2: main
//.........这里部分代码省略.........
const char* pachData = poField->GetData();
int nDataSize = poField->GetDataSize();
if( nRepeatCount == 1 && poDefn->GetSubfieldCount() == 0 )
{
printf(" value=\"0x");
for( int i = 0; i < nDataSize - 1; i++ )
printf( "%02X", pachData[i] );
printf("\">\n");
}
else
printf(">\n");
for( nLoopCount = 0; nLoopCount < nRepeatCount; nLoopCount++ )
{
for( int iSubField = 0; iSubField < poDefn->GetSubfieldCount(); iSubField++ )
{
int nBytesConsumed;
DDFSubfieldDefn* poSubFieldDefn = poDefn->GetSubfield(iSubField);
const char* pszSubFieldName = poSubFieldDefn->GetName();
printf(" <DDFSubfield name=\"%s\" ", pszSubFieldName);
DDFDataType eType = poSubFieldDefn->GetType();
const char* pachSubdata = pachData + iOffset;
int nMaxBytes = nDataSize - iOffset;
if( eType == DDFFloat )
printf("type=\"float\">%f",
poSubFieldDefn->ExtractFloatData( pachSubdata, nMaxBytes, NULL ) );
else if( eType == DDFInt )
printf("type=\"integer\">%d",
poSubFieldDefn->ExtractIntData( pachSubdata, nMaxBytes, NULL ) );
else if( eType == DDFBinaryString )
{
int nBytes, i;
GByte *pabyBString = (GByte *)
poSubFieldDefn->ExtractStringData( pachSubdata, nMaxBytes, &nBytes );
printf( "type=\"binary\">0x" );
for( i = 0; i < nBytes; i++ )
printf( "%02X", pabyBString[i] );
}
else
{
GByte* pabyString = (GByte *)poSubFieldDefn->ExtractStringData( pachSubdata, nMaxBytes, NULL );
int bBinary = FALSE;
int i;
for( i = 0; pabyString[i] != '\0'; i ++ )
{
if( pabyString[i] < 32 || pabyString[i] > 127 )
{
bBinary = TRUE;
break;
}
}
if( bBinary )
{
printf( "type=\"binary\">0x" );
for( i = 0; pabyString[i] != '\0'; i ++ )
printf( "%02X", pabyString[i] );
}
else
{
char* pszEscaped = CPLEscapeString((const char*)pabyString, -1, CPLES_XML);
printf("type=\"string\">%s", pszEscaped);
CPLFree(pszEscaped);
}
}
printf("</DDFSubfield>\n");
poSubFieldDefn->GetDataLength( pachSubdata, nMaxBytes, &nBytesConsumed );
iOffset += nBytesConsumed;
}
}
printf(" </DDFField>\n");
}
printf("</DDFRecord>\n");
}
printf("</DDFModule>\n");
}
else
{
oModule.Dump( stdout );
long nStartLoc;
nStartLoc = VSIFTellL( oModule.GetFP() );
for( poRecord = oModule.ReadRecord();
poRecord != NULL; poRecord = oModule.ReadRecord() )
{
printf( "File Offset: %ld\n", nStartLoc );
poRecord->Dump( stdout );
nStartLoc = VSIFTellL( oModule.GetFP() );
}
}
oModule.Close();
#ifdef DBMALLOC
malloc_dump(1);
#endif
}
示例3: mk_catalog
void mk_catalog()
{
DDFModule oModule;
DDFFieldDefn *poFDefn;
oModule.Initialize();
/* -------------------------------------------------------------------- */
/* Create the '0000' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0000", "", "0001CATD",
dsc_elementary,
dtc_char_string );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the '0000' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0001", "ISO 8211 Record Identifier", "",
dsc_elementary, dtc_bit_string,
"(b12)" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the CATD field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "CATD", "Catalog Directory field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "RCNM", "A(2)" );
poFDefn->AddSubfield( "RCID", "I(10)" );
poFDefn->AddSubfield( "FILE", "A" );
poFDefn->AddSubfield( "LFIL", "A" );
poFDefn->AddSubfield( "VOLM", "A" );
poFDefn->AddSubfield( "IMPL", "A(3)" );
poFDefn->AddSubfield( "SLAT", "R" );
poFDefn->AddSubfield( "WLON", "R" );
poFDefn->AddSubfield( "NLAT", "R" );
poFDefn->AddSubfield( "ELON", "R" );
poFDefn->AddSubfield( "CRCS", "A" );
poFDefn->AddSubfield( "COMT", "A" );
oModule.AddField( poFDefn );
oModule.Dump( stdout );
oModule.Create( "out.ddf" );
/* -------------------------------------------------------------------- */
/* Create a record. */
/* -------------------------------------------------------------------- */
DDFRecord *poRec = new DDFRecord( &oModule );
DDFField *poField;
poField = poRec->AddField( oModule.FindFieldDefn( "0001" ) );
poRec->SetFieldRaw( poField, 0, "\0\0\036", 3 );
poField = poRec->AddField( oModule.FindFieldDefn( "CATD" ) );
poRec->SetStringSubfield( "CATD", 0, "RCNM", 0, "CD" );
poRec->SetIntSubfield ( "CATD", 0, "RCID", 0, 1 );
poRec->SetStringSubfield( "CATD", 0, "FILE", 0, "CATALOG.030" );
poRec->SetStringSubfield( "CATD", 0, "VOLM", 0, "V01X01" );
poRec->SetStringSubfield( "CATD", 0, "IMPL", 0, "ASC" );
poRec->SetStringSubfield( "CATD", 0, "COMT", 0,
"Exchange Set Catalog file" );
poRec->Write();
delete poRec;
/* -------------------------------------------------------------------- */
/* Create a record. */
/* -------------------------------------------------------------------- */
poRec = new DDFRecord( &oModule );
poField = poRec->AddField( oModule.FindFieldDefn( "0001" ) );
poRec->SetFieldRaw( poField, 0, "\1\0\036", 3 );
poField = poRec->AddField( oModule.FindFieldDefn( "CATD" ) );
poRec->SetStringSubfield( "CATD", 0, "RCNM", 0, "CD" );
poRec->SetIntSubfield ( "CATD", 0, "RCID", 0, 2 );
poRec->SetStringSubfield( "CATD", 0, "FILE", 0, "No410810.000" );
poRec->SetStringSubfield( "CATD", 0, "VOLM", 0, "V01X01" );
poRec->SetStringSubfield( "CATD", 0, "IMPL", 0, "BIN" );
poRec->SetFloatSubfield ( "CATD", 0, "SLAT", 0, 59.000005 );
poRec->SetFloatSubfield ( "CATD", 0, "WLON", 0, 4.999996 );
poRec->SetFloatSubfield ( "CATD", 0, "NLAT", 0, 59.500003 );
poRec->SetFloatSubfield ( "CATD", 0, "ELON", 0, 5.499997 );
poRec->SetStringSubfield( "CATD", 0, "CRCS", 0, "555C3AD4" );
poRec->Write();
delete poRec;
}