本文整理汇总了C++中CPLJSONObject::GetBool方法的典型用法代码示例。如果您正苦于以下问题:C++ CPLJSONObject::GetBool方法的具体用法?C++ CPLJSONObject::GetBool怎么用?C++ CPLJSONObject::GetBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPLJSONObject
的用法示例。
在下文中一共展示了CPLJSONObject::GetBool方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddLayer
/*
* AddLayer()
*/
void OGRNGWDataset::AddLayer( const CPLJSONObject &oResourceJsonObject,
char **papszOptions, int nOpenFlagsIn )
{
std::string osLayerResourceId;
if( nOpenFlagsIn & GDAL_OF_VECTOR )
{
OGRNGWLayer *poLayer = new OGRNGWLayer( this, oResourceJsonObject );
papoLayers = (OGRNGWLayer**) CPLRealloc(papoLayers, (nLayers + 1) *
sizeof(OGRNGWLayer*));
papoLayers[nLayers++] = poLayer;
osLayerResourceId = poLayer->GetResourceId();
}
else
{
osLayerResourceId = oResourceJsonObject.GetString("resource/id");
}
// Check styles exist and add them as rasters.
if( nOpenFlagsIn & GDAL_OF_RASTER &&
oResourceJsonObject.GetBool( "resource/children", false ) )
{
CPLJSONDocument oResourceChildReq;
bool bResult = oResourceChildReq.LoadUrl( NGWAPI::GetChildren( osUrl,
osLayerResourceId ), papszOptions );
if( bResult )
{
CPLJSONArray oChildren( oResourceChildReq.GetRoot() );
for( int i = 0; i < oChildren.Size(); ++i )
{
AddRaster( oChildren[i], papszOptions );
}
}
}
}
示例2: updateSupportInfo
bool Account::updateSupportInfo()
{
std::string apiEndpoint(API_ENDPOINT);
CPLJSONObject root = http::fetchJson(apiEndpoint + "/support_info/");
if(!root.IsValid()) {
return false;
}
bool supported = root.GetBool("supported");
Settings &settings = Settings::instance();
settings.set("account/supported", supported);
if(supported) {
settings.set("account/sign", root.GetString("sign"));
settings.set("account/start_date", root.GetString("start_date"));
settings.set("account/end_date", root.GetString("end_date"));
// Get key file
const char *settingsPath = CPLGetConfigOption("NGS_SETTINGS_PATH", nullptr);
std::string keyFilePath = File::formFileName(settingsPath, KEY_FILE, "");
return http::getFile(apiEndpoint + "/rsa_public_key/", keyFilePath);
}
m_supported = checkSupported();
return true;
}
示例3: 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>"
//.........这里部分代码省略.........