本文整理汇总了C++中DDFRecord::AddField方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFRecord::AddField方法的具体用法?C++ DDFRecord::AddField怎么用?C++ DDFRecord::AddField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFRecord
的用法示例。
在下文中一共展示了DDFRecord::AddField方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeRecord
int S57Writer::WriteDSPM( int nScale )
{
if( nScale == 0 )
nScale = 52000;
/* -------------------------------------------------------------------- */
/* Add the DSID field. */
/* -------------------------------------------------------------------- */
DDFRecord *poRec = MakeRecord();
DDFField *poField;
poField = poRec->AddField( poModule->FindFieldDefn( "DSPM" ) );
poRec->SetIntSubfield ( "DSPM", 0, "RCNM", 0, 20 );
poRec->SetIntSubfield ( "DSPM", 0, "RCID", 0, 1 );
poRec->SetIntSubfield ( "DSPM", 0, "HDAT", 0, 2 );
poRec->SetIntSubfield ( "DSPM", 0, "VDAT", 0, 17 );
poRec->SetIntSubfield ( "DSPM", 0, "SDAT", 0, 23 );
poRec->SetIntSubfield ( "DSPM", 0, "CSCL", 0, nScale );
poRec->SetIntSubfield ( "DSPM", 0, "DUNI", 0, 1 );
poRec->SetIntSubfield ( "DSPM", 0, "HUNI", 0, 1 );
poRec->SetIntSubfield ( "DSPM", 0, "PUNI", 0, 1 );
poRec->SetIntSubfield ( "DSPM", 0, "COUN", 0, 1 );
poRec->SetIntSubfield ( "DSPM", 0, "COMF", 0, nCOMF );
poRec->SetIntSubfield ( "DSPM", 0, "SOMF", 0, nSOMF );
/* -------------------------------------------------------------------- */
/* Write out the record. */
/* -------------------------------------------------------------------- */
poRec->Write();
delete poRec;
return TRUE;
}
示例2: DDFRecord
DDFRecord *S57Writer::MakeRecord()
{
DDFRecord *poRec = new DDFRecord( poModule );
DDFField *poField;
unsigned char abyData[3];
abyData[0] = nNext0001Index % 256;
abyData[1] = nNext0001Index / 256;
abyData[2] = DDF_FIELD_TERMINATOR;
poField = poRec->AddField( poModule->FindFieldDefn( "0001" ) );
poRec->SetFieldRaw( poField, 0, (const char *) abyData, 3 );
nNext0001Index++;
return poRec;
}
示例3: mk_s57
void mk_s57()
{
DDFModule oModule;
DDFFieldDefn *poFDefn;
oModule.Initialize();
/* -------------------------------------------------------------------- */
/* Create the '0000' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0000", "", "0001DSIDDSIDDSSI0001DSPM0001VRIDVRIDATTVVRIDVRPCVRIDVRPTVRIDSGCCVRIDSG2DVRIDSG3D0001FRIDFRIDFOIDFRIDATTFFRIDNATFFRIDFFPCFRIDFFPTFRIDFSPCFRIDFSPT", dsc_elementary, dtc_char_string );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the '0001' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0001", "ISO 8211 Record Identifier", "",
dsc_elementary, dtc_bit_string,
"(b12)" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the DSID field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "DSID", "Data set identification field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "RCNM", "b11" );
poFDefn->AddSubfield( "RCID", "b14" );
poFDefn->AddSubfield( "EXPP", "b11" );
poFDefn->AddSubfield( "INTU", "b11" );
poFDefn->AddSubfield( "DSNM", "A" );
poFDefn->AddSubfield( "EDTN", "A" );
poFDefn->AddSubfield( "UPDN", "A" );
poFDefn->AddSubfield( "UADT", "A(8)" );
poFDefn->AddSubfield( "ISDT", "A(8)" );
poFDefn->AddSubfield( "STED", "R(4)" );
poFDefn->AddSubfield( "PRSP", "b11" );
poFDefn->AddSubfield( "PSDN", "A" );
poFDefn->AddSubfield( "PRED", "A" );
poFDefn->AddSubfield( "PROF", "b11" );
poFDefn->AddSubfield( "AGEN", "b12" );
poFDefn->AddSubfield( "COMT", "A" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the DSSI field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "DSSI", "Data set structure information field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "DSTR", "b11" );
poFDefn->AddSubfield( "AALL", "b11" );
poFDefn->AddSubfield( "NALL", "b11" );
poFDefn->AddSubfield( "NOMR", "b14" );
poFDefn->AddSubfield( "NOCR", "b14" );
poFDefn->AddSubfield( "NOGR", "b14" );
poFDefn->AddSubfield( "NOLR", "b14" );
poFDefn->AddSubfield( "NOIN", "b14" );
poFDefn->AddSubfield( "NOCN", "b14" );
poFDefn->AddSubfield( "NOED", "b14" );
poFDefn->AddSubfield( "NOFA", "b14" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the DSPM field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "DSPM", "Data set parameter field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "RCNM", "b11" );
poFDefn->AddSubfield( "RCID", "b14" );
poFDefn->AddSubfield( "HDAT", "b11" );
poFDefn->AddSubfield( "VDAT", "b11" );
poFDefn->AddSubfield( "SDAT", "b11" );
poFDefn->AddSubfield( "CSCL", "b14" );
poFDefn->AddSubfield( "DUNI", "b11" );
poFDefn->AddSubfield( "HUNI", "b11" );
poFDefn->AddSubfield( "PUNI", "b11" );
poFDefn->AddSubfield( "COUN", "b11" );
poFDefn->AddSubfield( "COMF", "b14" );
poFDefn->AddSubfield( "SOMF", "b14" );
poFDefn->AddSubfield( "COMT", "A" );
oModule.AddField( poFDefn );
//.........这里部分代码省略.........
示例4: 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;
}
示例5: main
//.........这里部分代码省略.........
const char* pszFormatControls = CPLGetXMLValue(psIter, "formatControls", NULL);
if( eStructCode != dsc_elementary )
pszFormatControls = NULL;
const char* pszArrayDescr = CPLGetXMLValue(psIter, "arrayDescr", "");
if( eStructCode == dsc_vector )
pszArrayDescr = "";
else if( eStructCode == dsc_array )
pszArrayDescr = "*";
poFDefn->Create( CPLGetXMLValue(psIter, "tag", ""),
CPLGetXMLValue(psIter, "fieldName", ""),
pszArrayDescr,
eStructCode, eTypeCode,
pszFormatControls );
CPLXMLNode* psSubIter = psIter->psChild;
while( psSubIter != NULL )
{
if( psSubIter->eType == CXT_Element &&
strcmp(psSubIter->pszValue, "DDFSubfieldDefn") == 0 )
{
poFDefn->AddSubfield( CPLGetXMLValue(psSubIter, "name", ""),
CPLGetXMLValue(psSubIter, "format", "") );
}
psSubIter = psSubIter->psNext;
}
pszFormatControls = CPLGetXMLValue(psIter, "formatControls", NULL);
if( pszFormatControls )
poFDefn->SetFormatControls(pszFormatControls);
oModule.AddField( poFDefn );
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "DDFRecord") == 0 )
{
//const bool bFirstRecord = !bCreated;
if( !bCreated )
{
oModule.Create( pszOutFilename );
bCreated = TRUE;
}
DDFRecord *poRec = new DDFRecord( &oModule );
std::map<std::string, int> oMapField;
//if( !bFirstRecord )
// poRec->SetReuseHeader(atoi(CPLGetXMLValue(psIter, "reuseHeader", CPLSPrintf("%d", poRec->GetReuseHeader()))));
poRec->SetSizeFieldLength(atoi(CPLGetXMLValue(psIter, "_sizeFieldLength", CPLSPrintf("%d", poRec->GetSizeFieldLength()))));
poRec->SetSizeFieldPos(atoi(CPLGetXMLValue(psIter, "_sizeFieldPos", CPLSPrintf("%d", poRec->GetSizeFieldPos()))));
poRec->SetSizeFieldTag(atoi(CPLGetXMLValue(psIter, "_sizeFieldTag", CPLSPrintf("%d", poRec->GetSizeFieldTag()))));
CPLXMLNode* psSubIter = psIter->psChild;
while( psSubIter != NULL )
{
if( psSubIter->eType == CXT_Element &&
strcmp(psSubIter->pszValue, "DDFField") == 0 )
{
const char* pszFieldName = CPLGetXMLValue(psSubIter, "name", "");
DDFFieldDefn* poFieldDefn = oModule.FindFieldDefn( pszFieldName );
if( poFieldDefn == NULL )
{
fprintf(stderr, "Can't find field '%s'\n", pszFieldName );
exit(1);
示例6: if
int S57Writer::WritePrimitive( OGRFeature *poFeature )
{
DDFRecord *poRec = MakeRecord();
DDFField *poField;
OGRGeometry *poGeom = poFeature->GetGeometryRef();
/* -------------------------------------------------------------------- */
/* Add the VRID field. */
/* -------------------------------------------------------------------- */
poField = poRec->AddField( poModule->FindFieldDefn( "VRID" ) );
poRec->SetIntSubfield ( "VRID", 0, "RCNM", 0,
poFeature->GetFieldAsInteger( "RCNM") );
poRec->SetIntSubfield ( "VRID", 0, "RCID", 0,
poFeature->GetFieldAsInteger( "RCID") );
poRec->SetIntSubfield ( "VRID", 0, "RVER", 0, 1 );
poRec->SetIntSubfield ( "VRID", 0, "RUIN", 0, 1 );
/* -------------------------------------------------------------------- */
/* Handle simple point. */
/* -------------------------------------------------------------------- */
if( poGeom != NULL && wkbFlatten(poGeom->getGeometryType()) == wkbPoint )
{
double dfX, dfY, dfZ;
OGRPoint *poPoint = (OGRPoint *) poGeom;
CPLAssert( poFeature->GetFieldAsInteger( "RCNM") == RCNM_VI
|| poFeature->GetFieldAsInteger( "RCNM") == RCNM_VC );
dfX = poPoint->getX();
dfY = poPoint->getY();
dfZ = poPoint->getZ();
if( dfZ == 0.0 )
WriteGeometry( poRec, 1, &dfX, &dfY, NULL );
else
WriteGeometry( poRec, 1, &dfX, &dfY, &dfZ );
}
/* -------------------------------------------------------------------- */
/* For multipoints we assuming SOUNDG, and write out as SG3D. */
/* -------------------------------------------------------------------- */
else if( poGeom != NULL
&& wkbFlatten(poGeom->getGeometryType()) == wkbMultiPoint )
{
OGRMultiPoint *poMP = (OGRMultiPoint *) poGeom;
int i, nVCount = poMP->getNumGeometries();
double *padfX, *padfY, *padfZ;
CPLAssert( poFeature->GetFieldAsInteger( "RCNM") == RCNM_VI
|| poFeature->GetFieldAsInteger( "RCNM") == RCNM_VC );
padfX = (double *) CPLMalloc(sizeof(double) * nVCount);
padfY = (double *) CPLMalloc(sizeof(double) * nVCount);
padfZ = (double *) CPLMalloc(sizeof(double) * nVCount);
for( i = 0; i < nVCount; i++ )
{
OGRPoint *poPoint = (OGRPoint *) poMP->getGeometryRef( i );
padfX[i] = poPoint->getX();
padfY[i] = poPoint->getY();
padfZ[i] = poPoint->getZ();
}
WriteGeometry( poRec, nVCount, padfX, padfY, padfZ );
CPLFree( padfX );
CPLFree( padfY );
CPLFree( padfZ );
}
/* -------------------------------------------------------------------- */
/* Handle LINESTRINGs (edge) geometry. */
/* -------------------------------------------------------------------- */
else if( poGeom != NULL
&& wkbFlatten(poGeom->getGeometryType()) == wkbLineString )
{
OGRLineString *poLS = (OGRLineString *) poGeom;
int i, nVCount = poLS->getNumPoints();
double *padfX, *padfY;
CPLAssert( poFeature->GetFieldAsInteger( "RCNM") == RCNM_VE );
padfX = (double *) CPLMalloc(sizeof(double) * nVCount);
padfY = (double *) CPLMalloc(sizeof(double) * nVCount);
for( i = 0; i < nVCount; i++ )
{
padfX[i] = poLS->getX(i);
padfY[i] = poLS->getY(i);
}
WriteGeometry( poRec, nVCount, padfX, padfY, NULL );
CPLFree( padfX );
CPLFree( padfY );
}
//.........这里部分代码省略.........