本文整理汇总了C++中IRasterCoverage::loadData方法的典型用法代码示例。如果您正苦于以下问题:C++ IRasterCoverage::loadData方法的具体用法?C++ IRasterCoverage::loadData怎么用?C++ IRasterCoverage::loadData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRasterCoverage
的用法示例。
在下文中一共展示了IRasterCoverage::loadData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rangeDefinition
QString IlwisObjectModel::rangeDefinition(bool defaultRange, bool calc, const QString& columnName) {
try {
IlwisTypes objectype = _ilwisobject->ilwisType();
QString rangeString;
if ( hasType( objectype, itCOVERAGE|itDOMAIN)){
if ( objectype == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( defaultRange){
rangeString = raster->datadef().domain()->range()->toString();
}else{
if ( calc){
raster->loadData();
raster->statistics(NumericStatistics::pBASIC);
}
rangeString = raster->datadef().range()->toString();
}
} else if ( hasType( objectype , itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
ColumnDefinition coldef = features->attributeDefinitions().columndefinition(COVERAGEKEYCOLUMN);
if ( coldef.isValid()){
if ( defaultRange)
rangeString = coldef.datadef().domain()->range()->toString();
else{
if ( calc){
features->loadData();
std::vector<QVariant> data = features->attributeTable()->column(columnName);
if ( data.size() != 0){
std::vector<double> values(data.size());
int i=0;
for(auto v : data)
values[i++] = v.toDouble();
NumericStatistics stats; // realy like to do this with a template specialization of the proper calculate function, but the syntax was unclear to me
stats.calculate(values.begin(), values.end());
NumericRange *rng = new NumericRange(stats.prop(NumericStatistics::pMIN),stats.prop(NumericStatistics::pMAX));
features->attributeDefinitionsRef().columndefinitionRef(columnName).datadef().range(rng);
}
}
rangeString = coldef.datadef().range()->toString();
}
}
} else if ( hasType( objectype , itDOMAIN)){
rangeString = _ilwisobject.as<Domain>()->range()->toString();
}
}
return rangeString;
}catch(const ErrorObject& ){
// no exceptions may escape here
}
return "";
}