本文整理汇总了C++中TiXmlElement::QueryDoubleAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::QueryDoubleAttribute方法的具体用法?C++ TiXmlElement::QueryDoubleAttribute怎么用?C++ TiXmlElement::QueryDoubleAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::QueryDoubleAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readProperties
bool EditorSelectModule::readProperties (TiXmlElement *element)
{
TiXmlElement *prop;
double dval;
if (!readSourceModules (element))
return false;
prop = element->FirstChildElement ("LowerBound");
if (prop == NULL || prop->QueryDoubleAttribute ("value", &dval) != TIXML_SUCCESS)
return false;
mModule.setLowerBound (dval);
prop = element->FirstChildElement ("UpperBound");
if (prop == NULL || prop->QueryDoubleAttribute ("value", &dval) != TIXML_SUCCESS)
return false;
mModule.setUpperBound (dval);
prop = element->FirstChildElement ("EdgeFalloff");
if (prop == NULL || prop->QueryDoubleAttribute ("value", &dval) != TIXML_SUCCESS)
return false;
mModule.setEdgeFalloff (dval);
return true;
}
示例2: readProperties
bool EditorScalePointModule::readProperties (TiXmlElement *element)
{
TiXmlElement *prop;
double dval;
if (!readSourceModules (element))
return false;
prop = element->FirstChildElement ("ScaleX");
if (prop == NULL || prop->QueryDoubleAttribute ("value", &dval) != TIXML_SUCCESS)
return false;
mModule.setScaleX (dval);
prop = element->FirstChildElement ("ScaleY");
if (prop == NULL || prop->QueryDoubleAttribute ("value", &dval) != TIXML_SUCCESS)
return false;
mModule.setScaleY (dval);
prop = element->FirstChildElement ("ScaleZ");
if (prop == NULL || prop->QueryDoubleAttribute ("value", &dval) != TIXML_SUCCESS)
return false;
mModule.setScaleZ (dval);
return true;
}
示例3: loadRackDefs
// Extract the definitions of the rack types from the xml
void converter::loadRackDefs(TiXmlHandle &hRoot)
{
m_racks.clear();
//printf("Loading rack defs\n");
for( TiXmlElement* pElem=hRoot.FirstChild("racks").FirstChild("rack").Element(); pElem; pElem=pElem->NextSiblingElement())
{
//printf("Loading rack defs - racks\n");
std::map<std::string, samplePosn> posns;
std::string rackName = pElem->Attribute("name");
for ( TiXmlElement *pRack = pElem->FirstChildElement("position") ; pRack ; pRack=pRack->NextSiblingElement() ) {
samplePosn posn;
const char *attrib = pRack->Attribute("name");
if ( attrib!=NULL ) {
posn.name = attrib;
}
else {
errlogPrintf("sampleChanger: rack has no name attribute \"%s\"\n", rackName.c_str());
}
//printf("Loading rack defs - %s\n", posn.name.c_str());
if ( pRack->QueryDoubleAttribute("x", &posn.x)!=TIXML_SUCCESS ) {
errlogPrintf("sampleChanger: unable to read x attribute \"%s\" \"%s\"\n", rackName.c_str(), posn.name.c_str());
}
if ( m_dims>1 && pRack->QueryDoubleAttribute("y", &posn.y)!=TIXML_SUCCESS ) {
errlogPrintf("sampleChanger: unable to read y attribute \"%s\" \"%s\"\n", rackName.c_str(), posn.name.c_str());
}
posns[posn.name] = posn;
}
m_racks[rackName] = posns;
}
}
示例4: loadLeaf
void Leaf::loadLeaf(TiXmlElement *node)
{
int nbStates=0, i=0;
node->QueryIntAttribute("nbPatchs", &_nbPatchs);
node->QueryDoubleAttribute("conf", &_conf);
node->QueryIntAttribute("nbStates", &nbStates);
node->QueryIntAttribute("meanOffsetX", &_meanOffsets.x);
node->QueryIntAttribute("meanOffsetY", &_meanOffsets.y);
node->QueryDoubleAttribute("varianceOffsetX", &_varOffsets.x);
node->QueryDoubleAttribute("varianceOffsetY", &_varOffsets.y);
node->QueryDoubleAttribute("varianceTrace", &_varTrace);
_stateVectorMean = cv::Mat(nbStates, 1, CV_64F, cv::Scalar_<double>(0));
_stateVectorVariance = cv::Mat(nbStates, 1, CV_64F, cv::Scalar_<double>(0));
for (TiXmlElement *pState = node->FirstChildElement() ; pState ; pState = pState->NextSiblingElement())
{
double mean, var;
_stateVectorNames.push_back(pState->ValueStr());
pState->QueryDoubleAttribute("mean", &mean);
pState->QueryDoubleAttribute("variance", &var);
_stateVectorMean.at<double>(i) = mean;
_stateVectorVariance.at<double>(i) = var;
i++;
}
}
示例5: while
Surface::Surface(TiXmlElement* _surface,MapTex& textures){
TiXmlElement* elem;
string textureName = _surface->Attribute("tex");
MapTex::iterator p = textures.find(textureName);
if (p != textures.end()) {
texture = p->second;
}
elem = _surface->FirstChildElement("vertex");
Vertex vertex;
while (elem){
elem->QueryDoubleAttribute("x",&vertex.x);
elem->QueryDoubleAttribute("y",&vertex.y);
elem->QueryDoubleAttribute("z",&vertex.z);
vertexs.push_back(vertex);
elem = elem->NextSiblingElement("vertex");
}
elem = _surface->FirstChildElement("coordTex");
CoordTex coordtex;
while (elem){
elem->QueryDoubleAttribute("x",&coordtex.x);
elem->QueryDoubleAttribute("y",&coordtex.y);
coordTexs.push_back(coordtex);
elem = elem->NextSiblingElement("coordTex");
}
}
示例6: doc
void CamAruco2DObservationModel::loadLandmarks(const char *pathToSetupFile)
{
using namespace arma;
// Load XML containing landmarks
TiXmlDocument doc(pathToSetupFile);
bool loadOkay = doc.LoadFile();
if ( !loadOkay )
{
printf( "Could not load Landmark list . Error='%s'. Exiting.\n", doc.ErrorDesc() );
exit( 1 );
}
TiXmlNode* node = 0;
TiXmlElement* landmarkElement = 0;
TiXmlElement* itemElement = 0;
// Get the landmarklist node
node = doc.FirstChild( "LandmarkList" );
assert( node );
landmarkElement = node->ToElement(); //convert node to element
assert( landmarkElement );
TiXmlNode* child = 0;
//Iterate through all the landmarks and put them into the "landmarks_" list
while( (child = landmarkElement ->IterateChildren(child)))
{
assert( child );
itemElement = child->ToElement();
assert( itemElement );
ObservationType landmark(singleObservationDim);
landmark.zeros();
double attributeVal;
itemElement->QueryDoubleAttribute("id", &attributeVal) ;
landmark[0] = attributeVal;
itemElement->QueryDoubleAttribute("x", &attributeVal) ;
landmark[1] = attributeVal;
itemElement->QueryDoubleAttribute("y", &attributeVal) ;
landmark[2] = attributeVal;
itemElement->QueryDoubleAttribute("theta", &attributeVal) ;
landmark[3] = attributeVal;
this->landmarks_.push_back(landmark);
}
OMPL_INFORM("CamArucoObservationModel: Total number of landmarks loaded successfully : %u", landmarks_.size() );
Visualizer::addLandmarks(landmarks_);
}
示例7: while
Composant::Composant(TiXmlElement* _elements,Vertex _posElement, MapModele& _modeles, MapTex& textures){
posElement = _posElement;
Vertex posRelComposant;
TiXmlElement* elem;
elem = _elements->FirstChildElement("bloc");
while (elem)
{
elem->QueryDoubleAttribute("x",&posRelComposant.x);
elem->QueryDoubleAttribute("y",&posRelComposant.y);
elem->QueryDoubleAttribute("z",&posRelComposant.z);
elements.push_back(Bloc(elem,posRelComposant,_modeles,textures));
elem = elem->NextSiblingElement("bloc"); // iteration
}
}
示例8: doc
Labyrinthe::Labyrinthe(char * nomFichier, MapModele& _modeles,MapTex& textures){
TiXmlDocument doc(nomFichier);
doc.LoadFile();
TiXmlHandle hdl(&doc);
TiXmlElement *elem = hdl.FirstChild("monde").FirstChildElement("composant").Element();
Vertex posComposant;
while (elem){
elem->QueryDoubleAttribute("x",&posComposant.x);
elem->QueryDoubleAttribute("y",&posComposant.y);
elem->QueryDoubleAttribute("z",&posComposant.z);
elemComplexe.push_back(new Composant(elem,posComposant,_modeles,textures));
elem = elem->NextSiblingElement("composant");
}
}
示例9: initXml
bool JointPositionSmoothController::initXml(mechanism::RobotState *robot, TiXmlElement *config)
{
assert(robot);
TiXmlElement *j = config->FirstChildElement("joint");
if (!j)
{
fprintf(stderr, "JointPositionSmoothController was not given a joint\n");
return false;
}
const char *jn = j->Attribute("name");
std::string joint_name = jn ? jn : "";
TiXmlElement *p = j->FirstChildElement("pid");
control_toolbox::Pid pid;
if (p)
pid.initXml(p);
else
fprintf(stderr, "JointPositionSmoothController's config did not specify the default pid parameters.\n");
TiXmlElement *s = config->FirstChildElement("filter");
if(s)
{
if(s->QueryDoubleAttribute("smoothing_factor", & smoothing_factor_)!=TIXML_SUCCESS)
{
std::cerr<<"You specified a filter option but not the smoothing_factor parameter\n";
return false; }
else
std::cout<<"Smoothing factor: "<<smoothing_factor_<<std::endl;
}
return init(robot, joint_name, pid);
}
示例10: load_session
void Session::load_session(const char* fileLocation){
std::vector<std::string> temp_effect_names;
TiXmlDocument doc(fileLocation);
fsom::DebugStream << "Working dir in load session= "<<m_workingDirectory<<std::endl;
if(doc.LoadFile()){
TiXmlHandle docHandle( &doc );
TiXmlElement* sessionElement = docHandle.FirstChild( "Session" ).Element();
if(sessionElement){
double masterLevel = 1;
if(sessionElement->QueryDoubleAttribute("MasterVolume",&masterLevel)){
set_master_level(masterLevel);
}else{
set_master_level(1);
}
load_metadata(this,sessionElement);
TiXmlElement* regionElement = sessionElement->FirstChildElement("Region");
while(regionElement){
RegionPtr t = create_region_from_node(regionElement);
add_region(t);
regionElement = regionElement->NextSiblingElement("Region");
}
} else {
throw XMLParseException();
}
}
}
示例11: initXml
bool JointCalibrationController::initXml(mechanism::RobotState *robot, TiXmlElement *config)
{
assert(robot);
assert(config);
TiXmlElement *cal = config->FirstChildElement("calibrate");
if (!cal)
{
std::cerr<<"JointCalibrationController was not given calibration parameters"<<std::endl;
return false;
}
if(cal->QueryDoubleAttribute("velocity", &search_velocity_) != TIXML_SUCCESS)
{
std::cerr<<"Velocity value was not specified\n";
return false;
}
const char *joint_name = cal->Attribute("joint");
joint_ = joint_name ? robot->getJointState(joint_name) : NULL;
if (!joint_)
{
fprintf(stderr, "Error: JointCalibrationController could not find joint \"%s\"\n",
joint_name);
return false;
}
const char *actuator_name = cal->Attribute("actuator");
actuator_ = actuator_name ? robot->model_->getActuator(actuator_name) : NULL;
if (!actuator_)
{
fprintf(stderr, "Error: JointCalibrationController could not find actuator \"%s\"\n",
actuator_name);
return false;
}
const char *transmission_name = cal->Attribute("transmission");
transmission_ = transmission_name ? robot->model_->getTransmission(transmission_name) : NULL;
if (!transmission_)
{
fprintf(stderr, "Error: JointCalibrationController could not find transmission \"%s\"\n",
transmission_name);
return false;
}
control_toolbox::Pid pid;
TiXmlElement *pid_el = config->FirstChildElement("pid");
if (!pid_el)
{
fprintf(stderr, "Error: JointCalibrationController was not given a pid element.\n");
return false;
}
if (!pid.initXml(pid_el))
return false;
if (!vc_.init(robot, joint_name, pid))
return false;
return true;
}
示例12: loadCache
void ClassifierSVM::loadCache(TiXmlElement* settings, boost::filesystem::path file){
clearData();
svm = svm_load_model(file.c_str());
TiXmlElement* pScales = settings->FirstChildElement("scales");
if(!pScales){
throw "Bad cache file - no scales";
}
pScales->QueryIntAttribute("desc_len", &descLen);
scalesSub = new double[descLen];
scalesDiv = new double[descLen];
TiXmlElement* pValue = pScales->FirstChildElement("value");
while(pValue){
int d = -1;
pValue->QueryIntAttribute("idx", &d);
if(d == -1){
throw "Bad cache file - no idx for value";
}
pValue->QueryDoubleAttribute("sub", &scalesSub[d]);
pValue->QueryDoubleAttribute("div", &scalesDiv[d]);
pValue = pValue->NextSiblingElement();
}
TiXmlElement* pLabels = settings->FirstChildElement("labels");
if(!pLabels){
throw "Bad cache file - no labels";
}
pLabels->QueryIntAttribute("num", &numLabels);
}
示例13: Deserialize
void FEPlayer::Deserialize(TiXmlDocument* _poXmlDoc, TiXmlElement* _poParent)
{
TiXmlElement* poElement = _poParent->FirstChildElement("Player");
if(poElement)
{
int isMovable, isDeletable;
poElement->QueryIntAttribute("is_movable", &isMovable);
poElement->QueryIntAttribute("is_deletable", &isDeletable);
if(isMovable)
AddFlags(EFEFlag_Movable);
else
RemoveFlags(EFEFlag_Movable);
if(isDeletable)
AddFlags(EFEFlag_Deletable);
else
RemoveFlags(EFEFlag_Deletable);
TiXmlElement* poPosElement = poElement->FirstChildElement("Position");
D_CHECK(poPosElement);
double x, y;
poPosElement->QueryDoubleAttribute("x", &x);
poPosElement->QueryDoubleAttribute("y", &y);
SetPosition(Vec3(x, y, 0.f));
SetColor(GetColor(m_id));
}
}
示例14: readDoubleAttribute
//---------------------------------------------------------
bool ofxXmlSettings::readDoubleAttribute(const string& tag, const string& attribute, double& outValue, int which){
TiXmlElement* elem = getElementForAttribute(tag, which);
if (elem)
return (elem->QueryDoubleAttribute(attribute, &outValue) == TIXML_SUCCESS);
return false;
}
示例15: readProperties
bool EditorTerraceModule::readProperties (TiXmlElement *element)
{
int ival;
TiXmlElement *prop = NULL;
TiXmlNode *child = NULL;
if (!readSourceModules (element))
return false;
prop = element->FirstChildElement ("Invert");
if (prop == NULL || prop->QueryIntAttribute ("value", &ival) != TIXML_SUCCESS)
return false;
mModule.invert (ival != 0);
mModule.clearControlPoints ();
while( (child = element->IterateChildren( "Point", child )) != NULL )
{
prop = child->ToElement();
if (prop)
{
double value;
if (prop->QueryDoubleAttribute ("value", &value) != TIXML_SUCCESS)
return false;
mModule.addControlPoint (value);
}
}
mPointCount = mModule.getControlPoints().size();
return true;
}