当前位置: 首页>>代码示例>>C++>>正文


C++ IRasterCoverage::hasAttributes方法代码示例

本文整理汇总了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);
        }
    }

}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:30,代码来源:ilwisobjectmodel.cpp

示例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);
                }
            }
        }
    }
}
开发者ID:ridoo,项目名称:IlwisCore,代码行数:18,代码来源:rasterlayerdrawer.cpp

示例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>();

}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:43,代码来源:ilwisobjectmodel.cpp

示例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();

}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:36,代码来源:ilwisobjectmodel.cpp


注:本文中的IRasterCoverage::hasAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。