本文整理汇总了C++中GDALWMSRasterBand::AddOverview方法的典型用法代码示例。如果您正苦于以下问题:C++ GDALWMSRasterBand::AddOverview方法的具体用法?C++ GDALWMSRasterBand::AddOverview怎么用?C++ GDALWMSRasterBand::AddOverview使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDALWMSRasterBand
的用法示例。
在下文中一共展示了GDALWMSRasterBand::AddOverview方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
//.........这里部分代码省略.........
CPLError( CE_Failure, CPLE_AppDefined,
"GDALWMS: Invalid value in DataType. Data type \"%s\" is not supported.", data_type );
ret = CE_Failure;
}
}
// Initialize the bands and the overviews. Assumes overviews are powers of two
if (ret == CE_None)
{
nRasterXSize = m_data_window.m_sx;
nRasterYSize = m_data_window.m_sy;
if (!GDALCheckDatasetDimensions(nRasterXSize, nRasterYSize) ||
!GDALCheckBandCount(nBands, TRUE))
{
return CE_Failure;
}
GDALColorInterp default_color_interp[4][4] = {
{ GCI_GrayIndex, GCI_Undefined, GCI_Undefined, GCI_Undefined },
{ GCI_GrayIndex, GCI_AlphaBand, GCI_Undefined, GCI_Undefined },
{ GCI_RedBand, GCI_GreenBand, GCI_BlueBand, GCI_Undefined },
{ GCI_RedBand, GCI_GreenBand, GCI_BlueBand, GCI_AlphaBand }
};
for (int i = 0; i < nBands; ++i)
{
GDALColorInterp color_interp = (nBands <= 4 && i <= 3 ? default_color_interp[nBands - 1][i] : GCI_Undefined);
GDALWMSRasterBand *band = new GDALWMSRasterBand(this, i, 1.0);
band->m_color_interp = color_interp;
SetBand(i + 1, band);
double scale = 0.5;
for (int j = 0; j < nOverviews; ++j)
{
band->AddOverview(scale);
band->m_color_interp = color_interp;
scale *= 0.5;
}
}
}
}
// UserPwd
const char *pszUserPwd = CPLGetXMLValue(config, "UserPwd", "");
if (pszUserPwd[0] != '\0')
m_osUserPwd = pszUserPwd;
const char *pszUserAgent = CPLGetXMLValue(config, "UserAgent", "");
if (pszUserAgent[0] != '\0')
m_osUserAgent = pszUserAgent;
const char *pszReferer = CPLGetXMLValue(config, "Referer", "");
if (pszReferer[0] != '\0')
m_osReferer = pszReferer;
if (ret == CE_None) {
const char *pszHttpZeroBlockCodes = CPLGetXMLValue(config, "ZeroBlockHttpCodes", "");
if(pszHttpZeroBlockCodes[0] == '\0') {
m_http_zeroblock_codes.push_back(204);
} else {
char **kv = CSLTokenizeString2(pszHttpZeroBlockCodes,",",CSLT_HONOURSTRINGS);
int nCount = CSLCount(kv);
for(int i=0; i<nCount; i++) {
int code = atoi(kv[i]);
if(code <= 0) {
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: Invalid value of ZeroBlockHttpCodes \"%s\", comma separated HTTP response codes expected.",
kv[i]);
示例2: Initialize
//.........这里部分代码省略.........
}
}
}
}
if (ret == CE_None) {
const char *proj = CPLGetXMLValue(config, "Projection", "");
if (proj[0] != '\0') {
m_projection = ProjToWKT(proj);
if (m_projection.size() == 0) {
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: Bad projection specified.");
ret = CE_Failure;
}
}
}
const char *bands_count = CPLGetXMLValue(config, "BandsCount", "3");
int nBandCount = atoi(bands_count);
if (ret == CE_None) {
CPLXMLNode *cache_node = CPLGetXMLNode(config, "Cache");
if (cache_node != NULL) {
m_cache = new GDALWMSCache();
if (m_cache->Initialize(cache_node) != CE_None) {
delete m_cache;
m_cache = NULL;
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: Failed to initialize cache.");
ret = CE_Failure;
}
}
}
if (ret == CE_None) {
CPLXMLNode *service_node = CPLGetXMLNode(config, "Service");
if (service_node != NULL) {
const char *service_name = CPLGetXMLValue(service_node, "name", "");
if (service_name[0] != '\0') {
GDALWMSMiniDriverManager *const mdm = GetGDALWMSMiniDriverManager();
GDALWMSMiniDriverFactory *const mdf = mdm->Find(CPLString(service_name));
if (mdf != NULL) {
m_mini_driver = mdf->New();
m_mini_driver->m_parent_dataset = this;
if (m_mini_driver->Initialize(service_node) == CE_None) {
m_mini_driver_caps.m_capabilities_version = -1;
m_mini_driver->GetCapabilities(&m_mini_driver_caps);
if (m_mini_driver_caps.m_capabilities_version == -1) {
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: Internal error, mini-driver capabilities version not set.");
ret = CE_Failure;
}
} else {
delete m_mini_driver;
m_mini_driver = NULL;
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: Failed to initialize minidriver.");
ret = CE_Failure;
}
} else {
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: No mini-driver registered for '%s'.", service_name);
ret = CE_Failure;
}
} else {
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: No Service specified.");
ret = CE_Failure;
}
} else {
CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS: No Service specified.");
ret = CE_Failure;
}
}
if (ret == CE_None) {
nRasterXSize = m_data_window.m_sx;
nRasterYSize = m_data_window.m_sy;
if (!GDALCheckDatasetDimensions(nRasterXSize, nRasterYSize) ||
!GDALCheckBandCount(nBandCount, TRUE))
{
return CE_Failure;
}
for (int i = 0; i < nBandCount; ++i) {
GDALWMSRasterBand *band = new GDALWMSRasterBand(this, i, 1.0);
SetBand(i + 1, band);
double scale = 0.5;
for (int j = 0; j < m_overview_count; ++j) {
band->AddOverview(scale);
scale *= 0.5;
}
}
}
if (ret == CE_None) {
/* If we dont have projection already set ask mini-driver. */
if (!m_projection.size()) {
const char *proj = m_mini_driver->GetProjectionInWKT();
if (proj != NULL) {
m_projection = proj;
}
}
}
return ret;
}