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


C++ Attributes::toString方法代码示例

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


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

示例1: setAttributes

void ObserverStateMachine::setAttributes(QStringList &attribs, QStringList legKeys,
                                         QStringList legAttribs)
{
    attribList = attribs;

#ifdef DEBUG_OBSERVER
    qDebug() << "\nattribs:\n" << attribs;
    qDebug() << "\nMapAttributes()->keys(): " << mapAttributes->keys() << "\n";

    qDebug() << "LEGEND_ITENS: " << LEGEND_ITENS;
    qDebug() << "num de legendas: " << (int) legKeys.size() / LEGEND_ITENS;

    for (int j = 0; j < legKeys.size(); j++)
        qDebug() << legKeys.at(j) << " = " << legAttrib.at(j);
#endif

    for (int j = 0; (legKeys.size() > 0 && j < LEGEND_KEYS.size()); j++)
    {
        if (legKeys.indexOf(LEGEND_KEYS.at(j)) < 0)
        {
            qFatal("Error: Parameter legend \"%s\" not found. "
                "Please check it in the model.", qPrintable( LEGEND_KEYS.at(j) ) );
        }
    }

    int type = legKeys.indexOf(TYPE);
    int mode = legKeys.indexOf(GROUP_MODE);
    int slices = legKeys.indexOf(SLICES);
    int precision = legKeys.indexOf(PRECISION);
    int stdDeviation = legKeys.indexOf(STD_DEV);
    int max = legKeys.indexOf(MAX);
    int min = legKeys.indexOf(MIN);
    int colorBar = legKeys.indexOf(COLOR_BAR);
    int font = legKeys.indexOf(FONT_FAMILY);
    int fontSize = legKeys.indexOf(FONT_SIZE);
    int symbol = legKeys.indexOf(SYMBOL);

#ifdef DEBUG_OBSERVER
    qDebug() << "\nattribs:\n" << attribs;
    qDebug() << "\nlegKeys: \n" << legKeys;
    qDebug() << "\nlegAttrib: \n" << legAttrib;
    qDebug() << "\nMapAttributes()->keys(): " << mapAttributes->keys() << "\n";
#endif

    QTreeWidgetItem *item = 0;
    Attributes *attrib = 0;
    for( int i = 0; i < attribs.size(); i++)
    {
        if ((! mapAttributes->contains(attribs.at(i)))
            && (attribs.at(i) != QString("x")) && (attribs.at(i) != QString("y")) )
        {
            obsAttrib.append(attribs.at(i));
            attrib = new Attributes(attribs.at(i), 2, 0, 0); // states->size(), 0, 0);

            //------- Recupera a legenda do arquivo e cria o objeto attrib
            if (legKeys.size() > 0)
            {
                attrib->setDataType( (TypesOfData) legAttribs.at(type).toInt());
                attrib->setGroupMode( (GroupingMode) legAttribs.at(mode ).toInt());
                attrib->setSlices(legAttribs.at(slices).toInt() - 1);				// conta com o zero
                attrib->setPrecisionNumber(legAttribs.at(precision).toInt() - 1);	// conta com o zero
                attrib->setStdDeviation( (StdDev) legAttribs.at(stdDeviation ).toInt());
                attrib->setMaxValue(legAttribs.at(max).toDouble());
                attrib->setMinValue(legAttribs.at(min).toDouble());

                //Fonte
                attrib->setFontFamily(legAttribs.at(font));
                attrib->setFontSize(legAttribs.at(fontSize).toInt());

                //Converte o código ASCII do símbolo em caracter
                bool ok = false;
                int asciiCode = legAttribs.at(symbol).toInt(&ok, 10);
                if (ok)
                    attrib->setSymbol( QString( QChar(asciiCode) ));
                else
                    attrib->setSymbol(legAttribs.at(symbol));

                std::vector<ColorBar> colorBarVec;
                std::vector<ColorBar> stdColorBarVec;
                QStringList labelList, valueList;

                ObserverMap::createColorsBar(legAttribs.at(colorBar),
                    colorBarVec, stdColorBarVec, valueList, labelList);

                attrib->setColorBar(colorBarVec);
                attrib->setStdColorBar(stdColorBarVec);
                attrib->setValueList(valueList);
                attrib->setLabelList(labelList);

#ifdef DEBUG_OBSERVER
            qDebug() << "valueList.size(): " << valueList.size();
            qDebug() << valueList;
            qDebug() << "\nlabelList.size(): " << labelList.size();
            qDebug() << labelList;

            qDebug() << "\nattrib->toString()\n" << attrib->toString();
#endif
            }

            mapAttributes->insert(attribs.at(i), attrib);
//.........这里部分代码省略.........
开发者ID:saraiva3,项目名称:terrame,代码行数:101,代码来源:observerStateMachine.cpp


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