本文整理汇总了C++中IRasterCoverage::hasAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ IRasterCoverage::hasAttributes方法的具体用法?C++ IRasterCoverage::hasAttributes怎么用?C++ IRasterCoverage::hasAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRasterCoverage
的用法示例。
在下文中一共展示了IRasterCoverage::hasAttributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetAttributeModel
void IlwisObjectModel::resetAttributeModel(const QString& attributeName){
auto setAttributeModel = [&](int i, const ColumnDefinition& coldef, const QString& attributeName){
if ( coldef.name() == attributeName){
AttributeModel *attribute = new AttributeModel(coldef, this, _ilwisobject);
_attributes[i] = attribute;
}
};
IlwisTypes objecttype = _ilwisobject->ilwisType();
if ( objecttype == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( raster->hasAttributes()){
for(int i = 0; i < raster->attributeTable()->columnCount(); ++i){
setAttributeModel(i,raster->attributeTable()->columndefinition(i), attributeName);
}
}
} else if ( hasType(objecttype,itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
for(int i = 0; i < features->attributeDefinitions().definitionCount(); ++i){
setAttributeModel(i,features->attributeTable()->columndefinition(i), attributeName);
}
} else if ( hasType(objecttype,itTABLE)){
ITable tbl = _ilwisobject.as<Table>();
for(int i = 0; i < tbl->columnCount(); ++i){
setAttributeModel(i,tbl->columndefinition(i),attributeName);
}
}
}
示例2: setActiveVisualAttribute
void RasterLayerDrawer::setActiveVisualAttribute(const QString &attr)
{
IRasterCoverage raster = coverage().as<RasterCoverage>();
if ( attr == PIXELVALUE){
LayerDrawer::setActiveVisualAttribute(attr);
}
else if ( raster.isValid() ) {
if(raster->hasAttributes()) {
if ( raster->attributeTable()->columnIndex(attr) != iUNDEF){
IRepresentation newrpr = Representation::defaultRepresentation(raster->attributeTable()->columndefinition(attr).datadef().domain());
if ( newrpr.isValid()){
LayerDrawer::setActiveVisualAttribute(attr);
}
}
}
}
}
示例3: AttributeModel
QQmlListProperty<AttributeModel> IlwisObjectModel::attributes()
{
try {
if ( _attributes.size() == 0){
if ( _ilwisobject.isValid()) {
IlwisTypes objecttype = _ilwisobject->ilwisType();
if ( objecttype == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( raster->hasAttributes()){
for(int i = 0; i < raster->attributeTable()->columnCount(); ++i){
AttributeModel *attribute = new AttributeModel(raster->attributeTable()->columndefinition(i), this, _ilwisobject);
_attributes.push_back(attribute);
}
}else {
AttributeModel *attribute = new AttributeModel(ColumnDefinition(PIXELVALUE, raster->datadef(),i64UNDEF), this, _ilwisobject);
_attributes.push_back(attribute);
}
} else if ( hasType(objecttype,itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
for(int i = 0; i < features->attributeDefinitions().definitionCount(); ++i){
AttributeModel *attribute = new AttributeModel(features->attributeDefinitions().columndefinition(i), this, _ilwisobject);
_attributes.push_back(attribute);
}
} else if ( hasType(objecttype,itTABLE)){
ITable tbl = _ilwisobject.as<Table>();
for(int i = 0; i < tbl->columnCount(); ++i){
AttributeModel *attribute = new AttributeModel(tbl->columndefinition(i), this, _ilwisobject);
_attributes.push_back(attribute);
}
}
}
}
if ( _attributes.size() > 0){
return QQmlListProperty<AttributeModel>(this, _attributes) ;
}
}
catch(const ErrorObject& ){
// no exceptions may escape here
}
return QQmlListProperty<AttributeModel>();
}
示例4: toString
QString IlwisObjectModel::value2string(const QVariant &value, const QString &attrName)
{
auto v2s = [](const ColumnDefinition& coldef, const QVariant& value)->QString {
if ( coldef.isValid()){
if ( coldef.datadef().domain()->ilwisType() == itTEXTDOMAIN)
return value.toString();
return coldef.datadef().domain()->impliedValue(value).toString();
}
if ( value.toDouble() == rUNDEF)
return sUNDEF;
return value.toString();
};
if ( attrName != "") {
IlwisTypes objectype = _ilwisobject->ilwisType();
if ( hasType(objectype, itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
ColumnDefinition coldef = features->attributeDefinitions().columndefinition(attrName);
return v2s(coldef, value);
}else if (hasType(objectype, itRASTER)){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( raster->hasAttributes()){
ColumnDefinition coldef = raster->attributeTable()->columndefinition(attrName);
return v2s(coldef, value);
}
if ( raster->datadef().domain()->ilwisType() == itCOLORDOMAIN){
auto clr = ColorRangeBase::toColor(value, ColorRangeBase::cmRGBA);
return ColorRangeBase::toString(clr,ColorRangeBase::cmRGBA) ;
}
}
}
if ( value.toDouble() == rUNDEF)
return sUNDEF;
return value.toString();
}