本文整理汇总了C++中CPLJSONObject::GetInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ CPLJSONObject::GetInteger方法的具体用法?C++ CPLJSONObject::GetInteger怎么用?C++ CPLJSONObject::GetInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPLJSONObject
的用法示例。
在下文中一共展示了CPLJSONObject::GetInteger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
/*
* Init()
*/
bool OGRNGWDataset::Init(int nOpenFlagsIn)
{
// NOTE: Skip check API version at that moment. We expected API v3.
// Get resource details.
CPLJSONDocument oResourceDetailsReq;
char **papszHTTPOptions = GetHeaders();
bool bResult = oResourceDetailsReq.LoadUrl( NGWAPI::GetResource( osUrl,
osResourceId ), papszHTTPOptions );
CPLDebug("NGW", "Get resource %s details %s", osResourceId.c_str(),
bResult ? "success" : "failed");
if( bResult )
{
CPLJSONObject oRoot = oResourceDetailsReq.GetRoot();
if( oRoot.IsValid() )
{
std::string osResourceType = oRoot.GetString("resource/cls");
FillMetadata( oRoot );
if( osResourceType == "resource_group" )
{
// Check feature paging.
FillCapabilities( papszHTTPOptions );
if( oRoot.GetBool( "resource/children", false ) ) {
// Get child resources.
bResult = FillResources( papszHTTPOptions, nOpenFlagsIn );
}
}
else if( (osResourceType == "vector_layer" ||
osResourceType == "postgis_layer") )
{
// Cehck feature paging.
FillCapabilities( papszHTTPOptions );
// Add vector layer.
AddLayer( oRoot, papszHTTPOptions, nOpenFlagsIn );
}
else if( osResourceType == "mapserver_style" ||
osResourceType == "qgis_vector_style" ||
osResourceType == "raster_style" ||
osResourceType == "wmsclient_layer" )
{
// GetExtent from parent.
OGREnvelope stExtent;
std::string osParentId = oRoot.GetString("resource/parent/id");
bool bExtentResult = NGWAPI::GetExtent(osUrl, osParentId,
papszHTTPOptions, 3857, stExtent);
if( !bExtentResult )
{
// Set full extent for EPSG:3857.
stExtent.MinX = -20037508.34;
stExtent.MaxX = 20037508.34;
stExtent.MinY = -20037508.34;
stExtent.MaxY = 20037508.34;
}
CPLDebug("NGW", "Raster extent is: %f, %f, %f, %f",
stExtent.MinX, stExtent.MinY,
stExtent.MaxX, stExtent.MaxY);
int nEPSG = 3857;
// Get parent details. We can skip this as default SRS in NGW is 3857.
if( osResourceType == "wmsclient_layer" )
{
nEPSG = oRoot.GetInteger("wmsclient_layer/srs/id", nEPSG);
}
else
{
CPLJSONDocument oResourceReq;
bResult = oResourceReq.LoadUrl( NGWAPI::GetResource( osUrl,
osResourceId ), papszHTTPOptions );
if( bResult )
{
CPLJSONObject oParentRoot = oResourceReq.GetRoot();
if( osResourceType == "mapserver_style" ||
osResourceType == "qgis_vector_style" )
{
nEPSG = oParentRoot.GetInteger("vector_layer/srs/id", nEPSG);
}
else if( osResourceType == "raster_style")
{
nEPSG = oParentRoot.GetInteger("raster_layer/srs/id", nEPSG);
}
}
}
// Create raster dataset.
std::string osRasterUrl = NGWAPI::GetTMS(osUrl, osResourceId);
char* pszRasterUrl = CPLEscapeString(osRasterUrl.c_str(), -1, CPLES_XML);
const char *pszConnStr = CPLSPrintf("<GDAL_WMS><Service name=\"TMS\">"
"<ServerUrl>%s</ServerUrl></Service><DataWindow>"
"<UpperLeftX>-20037508.34</UpperLeftX><UpperLeftY>20037508.34</UpperLeftY>"
"<LowerRightX>20037508.34</LowerRightX><LowerRightY>-20037508.34</LowerRightY>"
//.........这里部分代码省略.........