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


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

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


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

示例1: checkInput

QVariant AttributeDefinition::checkInput(const QVariant& inputVar, quint32 columnIndex)  const{
    QVariant actualval= inputVar;
    const ColumnDefinition& coldef = columndefinitionRef(columnIndex);
    QString typenm = inputVar.typeName();
    if ( !coldef.datadef().domain<>().isValid()){
        ERROR2(ERR_NO_INITIALIZED_2,"Domain",coldef.name());
        return QVariant();
    }
    IlwisTypes domtype = coldef.datadef().domain<>()->ilwisType();
    IlwisTypes valueType = coldef.datadef().domain<>()->valueType();
    IDomain dm = coldef.datadef().domain<>();
    if ( domtype == itITEMDOMAIN){
        if ( inputVar == sUNDEF){
            return QVariant((int)iUNDEF);
        } else if ( typenm == "QString"){
            actualval = dm->impliedValue(inputVar);

            SPItemRange rng2 = coldef.datadef().range<ItemRange>();

            if ( !hasType(valueType,itINDEXEDITEM)){
                SPItemRange rng1 = dm->range<ItemRange>();
                SPDomainItem item = rng1->item(inputVar.toString());
                if ( item.isNull()){
                    return QVariant((int)iUNDEF);
                }
                if ( !rng2->contains(item->name())){
                    rng2->add(item->clone());
                }
                actualval = item->raw();
            }
        }

    }else if ( domtype == itNUMERICDOMAIN){
        if (typenm == "QString")
            actualval =  dm->impliedValue(inputVar);
        if ( hasType(valueType,itDATETIME) && actualval.value<Ilwis::Time>() == tUNDEF)
            return actualval;
        else if (isNumericalUndef(actualval.toDouble()))
            return rUNDEF;
        if (! dm->contains(actualval))
            actualval = rUNDEF;
        else {
            SPNumericRange rng = coldef.datadef().range<NumericRange>();
            if ( !rng.isNull()){
                if ( hasType(valueType,itDATETIME))
                    rng->add(actualval.value<Ilwis::Time>());
                else
                    rng->add(actualval.toDouble());
            }
        }
    } else if ( domtype == itTEXTDOMAIN){
        return dm->impliedValue(inputVar);
    }
    return actualval;
}
开发者ID:52North,项目名称:IlwisCore,代码行数:55,代码来源:attributedefinition.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: 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


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