本文整理汇总了C++中DDFRecord::SetStringSubfield方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFRecord::SetStringSubfield方法的具体用法?C++ DDFRecord::SetStringSubfield怎么用?C++ DDFRecord::SetStringSubfield使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFRecord
的用法示例。
在下文中一共展示了DDFRecord::SetStringSubfield方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mk_s57
//.........这里部分代码省略.........
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" ) );
poRec->SetIntSubfield ( "DSSI", 0, "DSTR", 0, 2 );
poRec->SetIntSubfield ( "DSSI", 0, "AALL", 0, 1 );
poRec->SetIntSubfield ( "DSSI", 0, "NALL", 0, 1 );
poRec->SetIntSubfield ( "DSSI", 0, "NOMR", 0, 22 );
poRec->SetIntSubfield ( "DSSI", 0, "NOCR", 0, 0 );
poRec->SetIntSubfield ( "DSSI", 0, "NOGR", 0, 2141 );
poRec->SetIntSubfield ( "DSSI", 0, "NOLR", 0, 15 );
poRec->SetIntSubfield ( "DSSI", 0, "NOIN", 0, 512 );
poRec->SetIntSubfield ( "DSSI", 0, "NOCN", 0, 2181 );
poRec->SetIntSubfield ( "DSSI", 0, "NOED", 0, 3192 );
poRec->SetIntSubfield ( "DSSI", 0, "NOFA", 0, 0 );
poRec->Write();
delete poRec;
/* -------------------------------------------------------------------- */
/* Create a record. */
/* -------------------------------------------------------------------- */
示例2: 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;
}
示例3: if
//.........这里部分代码省略.........
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 );
}
/* -------------------------------------------------------------------- */
/* edge node linkages. */
/* -------------------------------------------------------------------- */
if( poFeature->GetDefnRef()->GetFieldIndex( "NAME_RCNM_0" ) >= 0 )
{
DDFField *poField;
char szName[5];
int nRCID;
CPLAssert( poFeature->GetFieldAsInteger( "NAME_RCNM_0") == RCNM_VC );
poField = poRec->AddField( poModule->FindFieldDefn( "VRPT" ) );
nRCID = poFeature->GetFieldAsInteger( "NAME_RCID_0");
szName[0] = RCNM_VC;
szName[1] = nRCID & 0xff;
szName[2] = (nRCID & 0xff00) >> 8;
szName[3] = (nRCID & 0xff0000) >> 16;
szName[4] = (nRCID & 0xff000000) >> 24;
poRec->SetStringSubfield( "VRPT", 0, "NAME", 0, szName, 5 );
poRec->SetIntSubfield ( "VRPT", 0, "ORNT", 0,
poFeature->GetFieldAsInteger( "ORNT_0") );
poRec->SetIntSubfield ( "VRPT", 0, "USAG", 0,
poFeature->GetFieldAsInteger( "USAG_0") );
poRec->SetIntSubfield ( "VRPT", 0, "TOPI", 0,
poFeature->GetFieldAsInteger( "TOPI_0") );
poRec->SetIntSubfield ( "VRPT", 0, "MASK", 0,
poFeature->GetFieldAsInteger( "MASK_0") );
nRCID = poFeature->GetFieldAsInteger( "NAME_RCID_1");
szName[0] = RCNM_VC;
szName[1] = nRCID & 0xff;
szName[2] = (nRCID & 0xff00) >> 8;
szName[3] = (nRCID & 0xff0000) >> 16;
szName[4] = (nRCID & 0xff000000) >> 24;
poRec->SetStringSubfield( "VRPT", 0, "NAME", 1, szName, 5 );
poRec->SetIntSubfield ( "VRPT", 0, "ORNT", 1,
poFeature->GetFieldAsInteger( "ORNT_1") );
poRec->SetIntSubfield ( "VRPT", 0, "USAG", 1,
poFeature->GetFieldAsInteger( "USAG_1") );
poRec->SetIntSubfield ( "VRPT", 0, "TOPI", 1,
poFeature->GetFieldAsInteger( "TOPI_1") );
poRec->SetIntSubfield ( "VRPT", 0, "MASK", 1,
poFeature->GetFieldAsInteger( "MASK_1") );
}
示例4: main
//.........这里部分代码省略.........
if( pszValue != NULL && STARTS_WITH(pszValue, "0x") )
{
pszValue += 2;
int nDataLen = (int)strlen(pszValue) / 2;
char* pabyData = (char*) malloc(nDataLen);
for(int i=0;i<nDataLen;i++)
{
char c;
int nHigh, nLow;
c = pszValue[2*i];
if( c >= 'A' && c <= 'F' )
nHigh = 10 + c - 'A';
else
nHigh = c - '0';
c = pszValue[2*i + 1];
if( c >= 'A' && c <= 'F' )
nLow = 10 + c - 'A';
else
nLow = c - '0';
pabyData[i] = (nHigh << 4) + nLow;
}
poRec->SetFieldRaw( poField, nFieldOcc, (const char *) pabyData, nDataLen );
free(pabyData);
}
else
{
CPLXMLNode* psSubfieldIter = psSubIter->psChild;
std::map<std::string, int> oMapSubfield;
while( psSubfieldIter != NULL )
{
if( psSubfieldIter->eType == CXT_Element &&
strcmp(psSubfieldIter->pszValue, "DDFSubfield") == 0 )
{
const char* pszSubfieldName = CPLGetXMLValue(psSubfieldIter, "name", "");
const char* pszSubfieldType = CPLGetXMLValue(psSubfieldIter, "type", "");
const char* pszSubfieldValue = CPLGetXMLValue(psSubfieldIter, NULL, "");
int nOcc = oMapSubfield[pszSubfieldName];
oMapSubfield[pszSubfieldName] ++ ;
if( strcmp(pszSubfieldType, "float") == 0 )
{
poRec->SetFloatSubfield( pszFieldName, nFieldOcc, pszSubfieldName, nOcc,
CPLAtof(pszSubfieldValue) );
}
else if( strcmp(pszSubfieldType, "integer") == 0 )
{
poRec->SetIntSubfield( pszFieldName, nFieldOcc, pszSubfieldName, nOcc,
atoi(pszSubfieldValue) );
}
else if( strcmp(pszSubfieldType, "string") == 0 )
{
poRec->SetStringSubfield( pszFieldName, nFieldOcc, pszSubfieldName, nOcc,
pszSubfieldValue );
}
else if( strcmp(pszSubfieldType, "binary") == 0 &&
STARTS_WITH(pszSubfieldValue, "0x") )
{
pszSubfieldValue += 2;
int nDataLen = (int)strlen(pszSubfieldValue) / 2;
char* pabyData = (char*) malloc(nDataLen);
for(int i=0;i<nDataLen;i++)
{
char c;
int nHigh, nLow;
c = pszSubfieldValue[2*i];
if( c >= 'A' && c <= 'F' )
nHigh = 10 + c - 'A';
else
nHigh = c - '0';
c = pszSubfieldValue[2*i + 1];
if( c >= 'A' && c <= 'F' )
nLow = 10 + c - 'A';
else
nLow = c - '0';
pabyData[i] = (nHigh << 4) + nLow;
}
poRec->SetStringSubfield( pszFieldName, nFieldOcc, pszSubfieldName, nOcc,
pabyData, nDataLen );
free(pabyData);
}
}
psSubfieldIter = psSubfieldIter->psNext;
}
}
}
psSubIter = psSubIter->psNext;
}
poRec->Write();
delete poRec;
}
psIter = psIter->psNext;
}
CPLDestroyXMLNode(poRoot);
oModule.Close();
return 0;
}
示例5: MakeRecord
int S57Writer::WriteDSID( const char *pszDSNM, const char *pszISDT,
const char *pszSTED, int nAGEN,
const char *pszCOMT )
{
/* -------------------------------------------------------------------- */
/* Default values. */
/* -------------------------------------------------------------------- */
if( pszDSNM == NULL )
pszDSNM = "";
if( pszISDT == NULL )
pszISDT = "20030801";
if( pszSTED == NULL )
pszSTED = "03.1";
if( pszCOMT == NULL )
pszCOMT = "";
/* -------------------------------------------------------------------- */
/* Add the DSID field. */
/* -------------------------------------------------------------------- */
DDFRecord *poRec = MakeRecord();
DDFField *poField;
poField = poRec->AddField( poModule->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, pszDSNM );
poRec->SetStringSubfield( "DSID", 0, "EDTN", 0, "2" );
poRec->SetStringSubfield( "DSID", 0, "UPDN", 0, "0" );
poRec->SetStringSubfield( "DSID", 0, "UADT", 0, pszISDT );
poRec->SetStringSubfield( "DSID", 0, "ISDT", 0, pszISDT );
poRec->SetStringSubfield( "DSID", 0, "STED", 0, pszSTED );
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, nAGEN );
poRec->SetStringSubfield( "DSID", 0, "COMT", 0, pszCOMT );
/* -------------------------------------------------------------------- */
/* Add the DSSI record. Eventually we will need to return and */
/* correct these when we are finished writing. */
/* -------------------------------------------------------------------- */
poField = poRec->AddField( poModule->FindFieldDefn( "DSSI" ) );
poRec->SetIntSubfield ( "DSSI", 0, "DSTR", 0, 2 );
poRec->SetIntSubfield ( "DSSI", 0, "AALL", 0, 1 );
poRec->SetIntSubfield ( "DSSI", 0, "NALL", 0, 1 );
poRec->SetIntSubfield ( "DSSI", 0, "NOMR", 0, 0 );
poRec->SetIntSubfield ( "DSSI", 0, "NOCR", 0, 0 );
poRec->SetIntSubfield ( "DSSI", 0, "NOGR", 0, 3 );
poRec->SetIntSubfield ( "DSSI", 0, "NOLR", 0, 0 );
poRec->SetIntSubfield ( "DSSI", 0, "NOIN", 0, 3 );
poRec->SetIntSubfield ( "DSSI", 0, "NOCN", 0, 0 );
poRec->SetIntSubfield ( "DSSI", 0, "NOED", 0, 0 );
poRec->SetIntSubfield ( "DSSI", 0, "NOFA", 0, 0 );
/* -------------------------------------------------------------------- */
/* Write out the record. */
/* -------------------------------------------------------------------- */
poRec->Write();
delete poRec;
return TRUE;
}