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


C++ IDomain::valueType方法代码示例

本文整理汇总了C++中IDomain::valueType方法的典型用法代码示例。如果您正苦于以下问题:C++ IDomain::valueType方法的具体用法?C++ IDomain::valueType怎么用?C++ IDomain::valueType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDomain的用法示例。


在下文中一共展示了IDomain::valueType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createInsertValueString

QString PostgresqlTableConnector::createInsertValueString(QVariant value, const ColumnDefinition &coldef) const {
    IDomain domain = coldef.datadef().domain<>();
    if (hasType(domain->valueType(),itINTEGER)) {

        return QString::number(value.toInt());

    } else if (hasType(domain->valueType(),itDOUBLE | itFLOAT)) {

        return QString::number(value.toDouble());

    } else if (hasType(domain->valueType(),itTHEMATICITEM | itNAMEDITEM | itINDEXEDITEM | itNUMERICITEM | itTIMEITEM)) {

        return domain->impliedValue(value).toString();

    } else if (hasType(domain->valueType(), itDATETIME)) {
        if ( QString(value.typeName()).compare("Ilwis::Time") != 0){
            ERROR2(ERR_COULD_NOT_CONVERT_2,value.toString(), "time");
            Time time(0,0,0,0,0);
            return time.toString(itDATE);
        } else{
            Time time = value.value<Ilwis::Time>();
            return time.toString(itDATETIME);
        }
    } else if (hasType(domain->valueType(),itSTRING)){

        return QString("'%1'").arg(value.toString());

    } else {
        ERROR0("Could not determine data type.");
        return QString("");
    }
}
开发者ID:maduhu,项目名称:IlwisConnectors,代码行数:32,代码来源:postgresqltableconnector.cpp

示例2: setAttributes

void GdalFeatureConnector::setAttributes(OGRFeatureH hfeature, SPFeatureI& feature, const std::vector<bool>& validAttributes, const std::vector<ColumnDefinition>& columnDef) {
    int index = 0;
    for(int i=0; i < feature->attributeColumnCount(); ++i){
        if ( !validAttributes[i])
            continue;
        IDomain dom = columnDef[i].datadef().domain<>();
        if(hasType(dom->valueType(),itINTEGER)) {
            gdal()->setIntegerAttribute(hfeature,index,feature->cell(i).toInt());
        } else if (hasType(dom->valueType(),itDOUBLE | itFLOAT)) {
            gdal()->setDoubleAttribute(hfeature,index,feature->cell(i).toDouble());
        } else if (hasType(dom->valueType(),itTHEMATICITEM | itNAMEDITEM | itINDEXEDITEM | itNUMERICITEM | itTIMEITEM)) {
            gdal()->setStringAttribute(hfeature,index,dom->impliedValue(feature->cell(i)).toString().toLocal8Bit());
        } else if (hasType(dom->valueType(), itDATETIME)) {
            QVariant v = feature->cell(i);
            if ( QString(v.typeName()).compare("Ilwis::Time") != 0){
                ERROR2(ERR_COULD_NOT_CONVERT_2,v.toString(), "time");
                gdal()->setDateTimeAttribute(hfeature,index,0,0,0,0,0,0,0);
            }else{
                Time time = v.value<Ilwis::Time>();
                gdal()->setDateTimeAttribute(hfeature,index,
                                             time.get(Time::tpYEAR),
                                             time.get(Time::tpMONTH),
                                             time.get(Time::tpDAYOFMONTH),
                                             time.get(Time::tpHOUR),
                                             time.get(Time::tpMINUTE),
                                             time.get(Time::tpSECOND),
                                             0);//TODO TimeZone??
            }
        } else if (hasType(dom->valueType(),itSTRING)){
            gdal()->setStringAttribute(hfeature,index,feature->cell(i).toString().toLocal8Bit());
        }
        ++index;
    }

}
开发者ID:maduhu,项目名称:IlwisConnectors,代码行数:35,代码来源:gdalfeatureconnector.cpp

示例3: valuetype

QString IlwisObjectModel::valuetype() const
{
    try{
        if ( !_ilwisobject.isValid())
            return "";

        IlwisTypes objectype = _ilwisobject->ilwisType();
        IlwisTypes valueType = itUNKNOWN;
        if ( hasType( objectype, itCOVERAGE|itDOMAIN)){
            if ( objectype == itRASTER){
                IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
                valueType = raster->datadef().domain()->valueType();
            } else if ( hasType( objectype , itFEATURE)){
                IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
                ColumnDefinition coldef = features->attributeDefinitions().columndefinition(COVERAGEKEYCOLUMN);
                if ( coldef.isValid()){
                    valueType = coldef.datadef().domain()->valueType();
                }

            } else if ( hasType( objectype , itDOMAIN)){
                IDomain dom = _ilwisobject.as<Domain>();
                valueType = dom->valueType();

            }
        }
        QString typeName =  TypeHelper::type2HumanReadable(valueType);

        return typeName == sUNDEF ? "" : typeName;
    }catch(const ErrorObject& ){
        // no exceptions may escape here
    }
    return "";
}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:33,代码来源:ilwisobjectmodel.cpp

示例4: mergeDomains

IDomain DomainMerger::mergeDomains(const IDomain &dom1, const IDomain &dom2)
{
    if ( _domain1.isValid() && _domain2.isValid() &&
         _domain1->valueType() == _domain2->valueType()){
        if ( dom1->valueType() == itNUMBER ){
            NumericDomainMerger merger(dom1, dom2);
            merger.merge();
        } else if ( dom1->valueType() == itINDEXEDITEM){
            ItemDomainMergerIndexedItems merger(dom1, dom2);
            merger.merge();

        } else if ( dom1->valueType() == itNAMEDITEM){
            ItemDomainMergerNamedItems merger(dom1, dom2);
            merger.merge();

        }
    }
    return _mergedDomain;
}
开发者ID:52North,项目名称:IlwisCore,代码行数:19,代码来源:domainmerger.cpp

示例5: valueType

QString IlwisObjectModel::valueType() const {
    if ( hasType(_ilwisobject->ilwisType(),itDOMAIN)){
        IDomain domain = _ilwisobject.as<Domain>();
        if ( domain.isValid()){
            IlwisTypes tp = domain->valueType();
            return TypeHelper::type2name(tp);
        }
    }
    return "";
}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:10,代码来源:ilwisobjectmodel.cpp

示例6: setParent

void NumericDomain::setParent(const IDomain &dm)
{
    if ( isReadOnly())
        return;
    changed(true);

    if ( _range.isNull()) {
        return;
    }
    if ( dm->ilwisType() != itNUMERICDOMAIN || hasType(dm->valueType(), itNUMBER) == false)
        return;
    SPNumericRange numrange = dm->range<NumericRange>();
    if ( !numrange->contains(_range))
        return;

    Domain::setParent(dm);
}
开发者ID:MartinSchouwenburg,项目名称:IlwisTest,代码行数:17,代码来源:numericdomain.cpp

示例7: setSubDefinition

void SubFeatureDefinition::setSubDefinition(const IDomain &dom, const std::vector<double> &items)
{
    _index2subFeature.clear();
    _subFeatureDomain = dom;
    for( auto item : items){
        if ( !dom->contains(item)) {
            continue;
        }

        if ( dom->valueType() == itINTEGER){
            _index2subFeature.push_back(QString::number((qint64)item));
        }else {
            _index2subFeature.push_back(QString::number(item));
        }
    }
    for(auto item : _index2subFeature){
        _subFeature2Index[item] = _subFeature2Index.size() - 1;
    }
}
开发者ID:CarstenHollmann,项目名称:IlwisCore,代码行数:19,代码来源:attributedefinition.cpp

示例8: canUse

bool RasterCoverage::canUse(const IlwisObject *obj, bool strict) const
{
    if ( Coverage::canUse(obj, strict))
        return true;

    if ( hasType(obj->ilwisType(),itDOMAIN)){
        IDomain dom;
        dom.prepare(obj->id());
        if ( dom.isValid()){
            if (strict){

            }else {
                if ( hasType(dom->valueType(), itNUMBER) && hasType( datadef().domain()->valueType(), itNUMBER)){
                    return true;
                }
                if ( hasType(dom->ilwisType(), itITEMDOMAIN) && hasType( datadef().domain()->valueType(), itITEMDOMAIN)){
                    return datadef().domain()->isCompatibleWith(obj);
                }
            }
        }
    }
    return false;
}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:23,代码来源:rastercoverage.cpp

示例9: storeMetaData

bool CoverageConnector::storeMetaData(IlwisObject *obj, IlwisTypes type, const DataDefinition& datadef)
{
    bool ok = Ilwis3Connector::storeMetaData(obj, type);
    if ( !ok)
        return false;

    Coverage *coverage = static_cast<Coverage *>(obj);

    const ICoordinateSystem csy = coverage->coordinateSystem();
    if (!csy.isValid())
        return ERROR2(ERR_NO_INITIALIZED_2, "CoordinateSystem", coverage->name());

    QString localName = Resource::toLocalFile(csy->source().url(),true);
    if ( localName == sUNDEF) {
        localName = CoordinateSystemConnector::createCsyFromCode(csy->code());
    }
    if ( localName == sUNDEF) {
        return ERROR2(ERR_NO_INITIALIZED_2, "CoordinateSystem", coverage->name());
    }
    _odf->setKeyValue("BaseMap","CoordSystem", localName);
    Box2D<double> bounds = coverage->envelope();
    if(!bounds.isValid())
        return ERROR2(ERR_NO_INITIALIZED_2, "Bounds", coverage->name());

    _odf->setKeyValue("BaseMap","CoordBounds",QString("%1 %2 %3 %4").
                      arg(bounds.min_corner().x(),10,'f').
                      arg(bounds.min_corner().y(),10,'f').
                      arg(bounds.max_corner().x(),10,'f').
                      arg(bounds.max_corner().y(),10,'f'));

    const IDomain dom = datadef.domain();
    if (!dom.isValid())
        return ERROR2(ERR_NO_INITIALIZED_2, "Domain", coverage->name());

    calcStatics(obj,NumericStatistics::pBASIC);
    if ( dom->ilwisType() == itNUMERICDOMAIN) {

        quint16 digits = coverage->statistics().significantDigits();
        qint32 delta = coverage->statistics()[NumericStatistics::pDELTA];
        if ( delta >= 0 && delta < 256 && digits == 0){
            if ( delta >= 0 && delta < 256 && digits == 0){
                if ( datadef.domain()->code() == "boolean"){
                    QString domInfo = QString("bool.dom;Byte;bool;0;;");
                    _odf->setKeyValue("BaseMap","DomainInfo",domInfo);
                    _odf->setKeyValue("BaseMap","Range","0:1:offset=-1");
                    _odf->setKeyValue("BaseMap","Domain","bool.dom");
                }
                else{
                    QString domInfo = QString("Image.dom;Byte;image;0;;");
                    _odf->setKeyValue("BaseMap","DomainInfo",domInfo);
                    _odf->setKeyValue("BaseMap","Range","0:255:offset=0");
                    _odf->setKeyValue("BaseMap","MinMax","0:255");
                    _odf->setKeyValue("BaseMap","Domain","Image.dom");
                }
            }
        }
        else {
            const NumericStatistics& stats = coverage->statistics();
            int digits = stats.significantDigits();
            RawConverter conv(stats[NumericStatistics::pMIN], stats[NumericStatistics::pMAX],pow(10, - digits));
            QString rangeString = QString("%1:%2:%3:offset=%4").arg(stats[NumericStatistics::pMIN]).arg(stats[NumericStatistics::pMAX]).arg(conv.scale()).arg(conv.offset());
            _odf->setKeyValue("BaseMap","Range",rangeString);
            _odf->setKeyValue("BaseMap","Domain","value.dom");

            _odf->setKeyValue("BaseMap","MinMax",QString("%1:%2").arg(stats[NumericStatistics::pMIN]).arg(stats[NumericStatistics::pMAX]));
            QString domInfo = QString("value.dom;Long;value;0;-9999999.9:9999999.9:0.1:offset=0");
            _odf->setKeyValue("BaseMap","DomainInfo",domInfo);
        }
    } if ( dom->ilwisType() == itITEMDOMAIN) {
        QString source = Resource::toLocalFile(dom->source().url(), true);
        if ( dom->valueType() == itTHEMATICITEM && coverage->ilwisType() == itRASTER) {
            IThematicDomain themdom = dom.get<ThematicDomain>();
            if ( themdom.isValid()) {
                QString domInfo = QString("%1;Byte;class;%2;;").arg(source).arg(themdom->count());
                _odf->setKeyValue("BaseMap","DomainInfo",domInfo);
                _odf->setKeyValue("BaseMap","Domain",source);
            }
        } else if(dom->valueType() == itINDEXEDITEM) {
            QString domName = _odf->fileinfo().fileName();
            QString domInfo = QString("%1;Long;UniqueID;0;;").arg(domName);
            _odf->setKeyValue("BaseMap","DomainInfo",domInfo);
            _odf->setKeyValue("BaseMap","Domain",domName);
        } else if ( dom->valueType() == itNAMEDITEM) {
            INamedIdDomain iddom = dom.get<NamedIdDomain>();
            QString domName = _odf->fileinfo().fileName();
            int index;
            if ( (index=domName.lastIndexOf("."))!= -1)             {
                domName = domName.left(index);
            }
            QString domInfo = QString("%1;;Int;id;%2;;").arg(domName).arg(iddom->count());
            _odf->setKeyValue("BaseMap","DomainInfo",domInfo);
            _odf->setKeyValue("BaseMap","Domain",domName);
            iddom->connectTo(QUrl(),"domain","ilwis3", IlwisObject::cmOUTPUT);
            iddom->store(Ilwis::IlwisObject::smMETADATA | Ilwis::IlwisObject::smBINARYDATA);
        }
    }

    ITable attTable = coverage->attributeTable();
    if ( attTable.isValid()) {
        QScopedPointer<TableConnector> conn(createTableConnector(attTable, coverage, type));
//.........这里部分代码省略.........
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:101,代码来源:coverageconnector.cpp


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