本文整理汇总了C++中GMLPropertyDefn::GetPrecision方法的典型用法代码示例。如果您正苦于以下问题:C++ GMLPropertyDefn::GetPrecision方法的具体用法?C++ GMLPropertyDefn::GetPrecision怎么用?C++ GMLPropertyDefn::GetPrecision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMLPropertyDefn
的用法示例。
在下文中一共展示了GMLPropertyDefn::GetPrecision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
OGRGMLLayer *OGRGMLDataSource::TranslateGMLSchema( GMLFeatureClass *poClass )
{
OGRGMLLayer *poLayer;
/* -------------------------------------------------------------------- */
/* Create an empty layer. */
/* -------------------------------------------------------------------- */
poLayer = new OGRGMLLayer( poClass->GetName(), NULL, FALSE,
wkbUnknown, this );
/* -------------------------------------------------------------------- */
/* Added attributes (properties). */
/* -------------------------------------------------------------------- */
for( int iField = 0; iField < poClass->GetPropertyCount(); iField++ )
{
GMLPropertyDefn *poProperty = poClass->GetProperty( iField );
OGRFieldType eFType;
if( poProperty->GetType() == GMLPT_Untyped )
eFType = OFTString;
else if( poProperty->GetType() == GMLPT_String )
eFType = OFTString;
else if( poProperty->GetType() == GMLPT_Integer )
eFType = OFTInteger;
else if( poProperty->GetType() == GMLPT_Real )
eFType = OFTReal;
else
eFType = OFTString;
OGRFieldDefn oField( poProperty->GetName(), eFType );
if ( EQUALN(oField.GetNameRef(), "ogr:", 4) )
oField.SetName(poProperty->GetName()+4);
if( poProperty->GetWidth() > 0 )
oField.SetWidth( poProperty->GetWidth() );
if( poProperty->GetPrecision() > 0 )
oField.SetPrecision( poProperty->GetPrecision() );
poLayer->GetLayerDefn()->AddFieldDefn( &oField );
}
return poLayer;
}
示例2: CPLCreateXMLNode
//.........这里部分代码省略.........
sprintf( szValue, "%d", m_nFeatureCount );
CPLCreateXMLElementAndValue( psDSI, "FeatureCount", szValue );
}
if( m_bHaveExtents )
{
char szValue[128];
sprintf( szValue, "%.5f", m_dfXMin );
CPLCreateXMLElementAndValue( psDSI, "ExtentXMin", szValue );
sprintf( szValue, "%.5f", m_dfXMax );
CPLCreateXMLElementAndValue( psDSI, "ExtentXMax", szValue );
sprintf( szValue, "%.5f", m_dfYMin );
CPLCreateXMLElementAndValue( psDSI, "ExtentYMin", szValue );
sprintf( szValue, "%.5f", m_dfYMax );
CPLCreateXMLElementAndValue( psDSI, "ExtentYMax", szValue );
}
if( m_pszExtraInfo )
CPLCreateXMLElementAndValue( psDSI, "ExtraInfo", m_pszExtraInfo );
}
/* -------------------------------------------------------------------- */
/* emit property information. */
/* -------------------------------------------------------------------- */
for( iProperty = 0; iProperty < GetPropertyCount(); iProperty++ )
{
GMLPropertyDefn *poPDefn = GetProperty( iProperty );
CPLXMLNode *psPDefnNode;
const char *pszTypeName = "Unknown";
psPDefnNode = CPLCreateXMLNode( psRoot, CXT_Element, "PropertyDefn" );
CPLCreateXMLElementAndValue( psPDefnNode, "Name",
poPDefn->GetName() );
CPLCreateXMLElementAndValue( psPDefnNode, "ElementPath",
poPDefn->GetSrcElement() );
switch( poPDefn->GetType() )
{
case GMLPT_Untyped:
pszTypeName = "Untyped";
break;
case GMLPT_String:
pszTypeName = "String";
break;
case GMLPT_Integer:
pszTypeName = "Integer";
break;
case GMLPT_Real:
pszTypeName = "Real";
break;
case GMLPT_Complex:
pszTypeName = "Complex";
break;
case GMLPT_IntegerList:
pszTypeName = "IntegerList";
break;
case GMLPT_RealList:
pszTypeName = "RealList";
break;
case GMLPT_StringList:
pszTypeName = "StringList";
break;
}
CPLCreateXMLElementAndValue( psPDefnNode, "Type", pszTypeName );
if( EQUAL(pszTypeName,"String") )
{
char szMaxLength[48];
sprintf(szMaxLength, "%d", poPDefn->GetWidth());
CPLCreateXMLElementAndValue ( psPDefnNode, "Width", szMaxLength );
}
if( poPDefn->GetWidth() > 0 && EQUAL(pszTypeName,"Integer") )
{
char szLength[48];
sprintf(szLength, "%d", poPDefn->GetWidth());
CPLCreateXMLElementAndValue ( psPDefnNode, "Width", szLength );
}
if( poPDefn->GetWidth() > 0 && EQUAL(pszTypeName,"Real") )
{
char szLength[48];
sprintf(szLength, "%d", poPDefn->GetWidth());
CPLCreateXMLElementAndValue ( psPDefnNode, "Width", szLength );
char szPrecision[48];
sprintf(szPrecision, "%d", poPDefn->GetPrecision());
CPLCreateXMLElementAndValue ( psPDefnNode, "Precision", szPrecision );
}
}
return psRoot;
}
示例3: osStr
//.........这里部分代码省略.........
/* -------------------------------------------------------------------- */
for( iProperty = 0; iProperty < GetPropertyCount(); iProperty++ )
{
GMLPropertyDefn *poPDefn = GetProperty( iProperty );
CPLXMLNode *psPDefnNode;
const char *pszTypeName = "Unknown";
psPDefnNode = CPLCreateXMLNode( psRoot, CXT_Element, "PropertyDefn" );
CPLCreateXMLElementAndValue( psPDefnNode, "Name",
poPDefn->GetName() );
CPLCreateXMLElementAndValue( psPDefnNode, "ElementPath",
poPDefn->GetSrcElement() );
switch( poPDefn->GetType() )
{
case GMLPT_Untyped:
pszTypeName = "Untyped";
break;
case GMLPT_String:
case GMLPT_Boolean:
pszTypeName = "String";
break;
case GMLPT_Integer:
case GMLPT_Short:
case GMLPT_Integer64:
pszTypeName = "Integer";
break;
case GMLPT_Real:
case GMLPT_Float:
pszTypeName = "Real";
break;
case GMLPT_Complex:
pszTypeName = "Complex";
break;
case GMLPT_IntegerList:
case GMLPT_Integer64List:
pszTypeName = "IntegerList";
break;
case GMLPT_RealList:
pszTypeName = "RealList";
break;
case GMLPT_StringList:
case GMLPT_BooleanList:
pszTypeName = "StringList";
break;
/* should not happen in practise for now because this is not */
/* autodetected */
case GMLPT_FeatureProperty:
pszTypeName = "FeatureProperty";
break;
/* should not happen in practise for now because this is not */
/* autodetected */
case GMLPT_FeaturePropertyList:
pszTypeName = "FeaturePropertyList";
break;
}
CPLCreateXMLElementAndValue( psPDefnNode, "Type", pszTypeName );
if( poPDefn->GetType() == GMLPT_Boolean || poPDefn->GetType() == GMLPT_BooleanList )
CPLCreateXMLElementAndValue( psPDefnNode, "Subtype", "Boolean" );
else if( poPDefn->GetType() == GMLPT_Short )
CPLCreateXMLElementAndValue( psPDefnNode, "Subtype", "Short" );
else if( poPDefn->GetType() == GMLPT_Float )
CPLCreateXMLElementAndValue( psPDefnNode, "Subtype", "Float" );
else if( poPDefn->GetType() == GMLPT_Integer64 ||
poPDefn->GetType() == GMLPT_Integer64List )
CPLCreateXMLElementAndValue( psPDefnNode, "Subtype", "Integer64" );
if( EQUAL(pszTypeName,"String") )
{
char szMaxLength[48];
sprintf(szMaxLength, "%d", poPDefn->GetWidth());
CPLCreateXMLElementAndValue ( psPDefnNode, "Width", szMaxLength );
}
if( poPDefn->GetWidth() > 0 && EQUAL(pszTypeName,"Integer") )
{
char szLength[48];
sprintf(szLength, "%d", poPDefn->GetWidth());
CPLCreateXMLElementAndValue ( psPDefnNode, "Width", szLength );
}
if( poPDefn->GetWidth() > 0 && EQUAL(pszTypeName,"Real") )
{
char szLength[48];
sprintf(szLength, "%d", poPDefn->GetWidth());
CPLCreateXMLElementAndValue ( psPDefnNode, "Width", szLength );
char szPrecision[48];
sprintf(szPrecision, "%d", poPDefn->GetPrecision());
CPLCreateXMLElementAndValue ( psPDefnNode, "Precision", szPrecision );
}
}
return psRoot;
}