int GraphicProducer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: strikePath((*reinterpret_cast< const VectorPath(*)>(_a[1])),(*reinterpret_cast< const GraphicContext(*)>(_a[2]))); break;
        case 1: fillPath((*reinterpret_cast< const VectorPath(*)>(_a[1])),(*reinterpret_cast< const GraphicContext(*)>(_a[2])),(*reinterpret_cast< Qt::FillRule(*)>(_a[3]))); break;
        case 2: parsingDone((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: { bool _r = parseStream((*reinterpret_cast< const char*(*)>(_a[1])),(*reinterpret_cast< ulong(*)>(_a[2])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 4: { bool _r = parsePDF((*reinterpret_cast< const QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
示例#2
0
bool ObjectModelParser::parseStateEstimator(ClassModel* obj_model, const TiXmlElement* elem, std::stringstream& error) {

    // check behavior model's attribute and model type
    string attribute_name, model_type;
    if (!getAttributeValue(elem, "attribute", attribute_name, error)
            | !getAttributeValue(elem, "model", model_type, error)) {
        return false;
    }

    Attribute attribute = AttributeConv::attribute(attribute_name);

    if (!object_model_loader_->isClassAvailable(model_type)){
        std::vector<std::string> classes = object_model_loader_->getDeclaredClasses();
        for(unsigned int i = 0; i < classes.size(); ++i){
            if(model_type == object_model_loader_->getName(classes[i])){
                //if we've found a match... we'll get the fully qualified name and break out of the loop
                ROS_WARN("Planner specifications should now include the package name. You are using a deprecated API. Please switch from %s to %s in your yaml file.",
                        model_type.c_str(), classes[i].c_str());
                model_type = classes[i];
                break;
            }
        }
    }

    IStateEstimator* estimator;

    if (object_model_loader_->isClassAvailable(model_type)) {
        estimator = object_model_loader_->createClassInstance(model_type)->clone();
    } else {
        error << "Unknown model: " << model_type << endl;
        return false;
    }

    // set estimator parameters
    const TiXmlElement* param = elem->FirstChildElement("param");
    while (param) {
        const char* param_name = param->Attribute("name");

        if (param_name) {
            bool v_bool;
            int v_int;
            double v_double;

            bool set_param_ok = true;
            if (param->QueryDoubleAttribute("value", &v_double) == TIXML_SUCCESS) {
                set_param_ok = estimator->setParameter(string(param_name), v_double);
            } else if (param->QueryIntAttribute("value", &v_int) == TIXML_SUCCESS) {
                set_param_ok = estimator->setParameter(string(param_name), (double)v_int);
            } else if (param->QueryBoolAttribute("value", &v_bool) == TIXML_SUCCESS) {
                set_param_ok = estimator->setParameter(string(param_name), v_bool);
            } else {
                const char* v_str = param->Attribute("value");
                if (v_str) {
                    set_param_ok = estimator->setParameter(string(param_name), string(v_str));
                } else {
                    error << "State estimator parameters should always have a 'name' and 'value' attribute." << endl;
                }
            }

            if (!set_param_ok) {
                error << "Unknown parameter for estimator '" << model_type << "': " << param_name << endl;
            }

        } else {
            error << "State estimator parameters should always have a 'name' and 'value' attribute." << endl;
        }

        param = param->NextSiblingElement("param");
    }

    const TiXmlElement* pnew = elem->FirstChildElement("pnew");
    if (pnew) {
        pbl::PDF* pdf_new = parsePDF(pnew, error);
        if (pdf_new) {
            obj_model->setNewPDF(attribute, *pdf_new);

            estimator->update(*pdf_new, 0);

            delete pdf_new;
        } else {
            return false;
        }
    } else {
        error << "Estimator specification does not contain 'pnew'." << endl;
        return false;
    }

    const TiXmlElement* pclutter = elem->FirstChildElement("pclutter");
    if (pnew) {
        pbl::PDF* pdf_clutter = parsePDF(pclutter, error);
        if (pdf_clutter) {
            obj_model->setClutterPDF(attribute, *pdf_clutter);

            delete pdf_clutter;
        } else {
            return false;
        }
    } else {
        error << "Estimator specification does not contain 'pclutter'." << endl;
        return false;
    }

    obj_model->setEstimator(attribute, *estimator);

    return true;
}