本文整理汇总了C++中TiXmlElement::SetDoubleAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::SetDoubleAttribute方法的具体用法?C++ TiXmlElement::SetDoubleAttribute怎么用?C++ TiXmlElement::SetDoubleAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::SetDoubleAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
TiXmlElement* mitk::ProportionalTimeGeometryToXML::ToXML(const ProportionalTimeGeometry* timeGeom)
{
assert(timeGeom);
TiXmlElement* timeGeomElem = new TiXmlElement("ProportionalTimeGeometry");
timeGeomElem->SetAttribute("NumberOfTimeSteps", timeGeom->CountTimeSteps());
// TinyXML cannot serialize infinity (default value for time step)
// So we guard this value and the first time point against serialization problems
// by not writing them. The reader can then tell that absence of those values
// means "keep the default values"
if (timeGeom->GetFirstTimePoint() != -std::numeric_limits<TimePointType>::max())
timeGeomElem->SetDoubleAttribute("FirstTimePoint", timeGeom->GetFirstTimePoint());
if (timeGeom->GetStepDuration() != std::numeric_limits<TimePointType>::infinity())
timeGeomElem->SetDoubleAttribute("StepDuration", timeGeom->GetStepDuration());
for (TimeStepType t = 0; t < timeGeom->CountTimeSteps(); ++t)
{
// add a node for the geometry of each time step
const Geometry3D* geom3D(nullptr);
if ( (geom3D = dynamic_cast<const Geometry3D*>( timeGeom->GetGeometryForTimeStep(t).GetPointer() )) )
{
TiXmlElement* geom3DElement = Geometry3DToXML::ToXML( geom3D );
geom3DElement->SetAttribute("TimeStep", t); // mark order for us
timeGeomElem->LinkEndChild( geom3DElement );
}
else
{
MITK_WARN << "Serializing a ProportionalTimeGeometry that contains something other than Geometry3D!"
<< " (in time step " << t << ")"
<<" File will miss information!";
}
}
return timeGeomElem;
}
示例2: saveLayer
/**
* Creates the object of one layer in the XML structure.
**/
void IO::saveLayer(TiXmlElement *parent, Layer *layer)
{
TiXmlElement *layerXML = new TiXmlElement("layer");
layerXML->SetAttribute("name", layer->getName());
layerXML->SetDoubleAttribute("x", layer->getX());
layerXML->SetDoubleAttribute("y", layer->getY());
layerXML->SetDoubleAttribute("z", layer->getZ());
layerXML->SetDoubleAttribute("alpha", layer->getAlpha());
layerXML->SetDoubleAttribute("scale", layer->getScale());
layerXML->SetAttribute("vis", layer->getVisibility());
Mesh *m = layer->getMesh();
Texture *t = m->getAttachedTexture();
saveTexture(layerXML, t);
saveMesh(layerXML, m);
Skeleton *s = layer->getSkeleton();
saveSkeleton(layerXML, s, m);
parent->LinkEndChild(layerXML);
vector<Layer *> *sublayers = layer->getLayers();
if (!(sublayers->empty()))
{
saveLayers(layerXML, sublayers);
}
}
示例3: TiXmlElement
void
EigenGrasp::writeToFile(TiXmlElement *ep)
{
TiXmlElement * EigenValue = new TiXmlElement( "EigenValue" );
EigenValue->SetDoubleAttribute("value",mEigenValue);
ep->LinkEndChild( EigenValue );
if(mPredefinedLimits)
{
TiXmlElement * Limits = new TiXmlElement( "Limits" );
Limits->SetDoubleAttribute("min",mMin);
Limits->SetDoubleAttribute("max",mMax);
ep->LinkEndChild( Limits );
}
TiXmlElement * DimVals = new TiXmlElement( "DimVals" );
QString varStr;
for (int i=0; i<mSize; i++)
{
varStr.setNum(i);
varStr="d"+varStr;
DimVals->SetDoubleAttribute(varStr,mVals[i]);
}
ep->LinkEndChild( DimVals );
}
示例4: saveXML
void ControlSuper::saveXML(TiXmlElement &root)
{
root.SetAttribute("enabled",enabled);
root.SetAttribute("hidden",hidden);
root.SetDoubleAttribute("left",controlPos.left);
root.SetDoubleAttribute("right",controlPos.right);
root.SetDoubleAttribute("top",controlPos.top);
root.SetDoubleAttribute("bottom",controlPos.bottom);
}
示例5: writeProperties
void EditorTurbulenceModule::writeProperties (TiXmlElement *element)
{
TiXmlElement *prop;
writeSourceModules (element);
prop = new TiXmlElement ("Power");
prop->SetDoubleAttribute ("value", mModule.getPower());
element->LinkEndChild (prop);
prop = new TiXmlElement ("Roughness");
prop->SetDoubleAttribute ("value", mModule.getRoughness());
element->LinkEndChild (prop);
prop = new TiXmlElement ("Frequency");
prop->SetDoubleAttribute ("value", mModule.getFrequency());
element->LinkEndChild (prop);
prop = new TiXmlElement ("Seed");
prop->SetAttribute ("value", mModule.getSeed());
element->LinkEndChild (prop);
prop = new TiXmlElement ("Quality");
prop->SetAttribute ("value", mModule.getQuality());
element->LinkEndChild (prop);
}
示例6: SaveInitParams
VAUTILS_API bool SaveInitParams(const char* lpFileName, TVAInitParams* params)
{
if (lpFileName == NULL || params == NULL)
return false;
TiXmlElement* element = new TiXmlElement("VAPARAMS");
TiXmlElement* e = new TiXmlElement("Camera");
e->SetDoubleAttribute("height", params->Camera.Height);
e->SetDoubleAttribute("angle", params->Camera.Angle);
e->SetDoubleAttribute("focus", params->Camera.Focus);
e->SetDoubleAttribute("wsize", params->Camera.WChipSize);
e->SetDoubleAttribute("hsize", params->Camera.HChipSize);
element->LinkEndChild(e);
TiXmlElement* e1 = new TiXmlElement("Zones");
//
for (int i = 0; i < params->NumZones; i++)
{
if (params->Zones[i].IsRect)
{
//сохранить прямоугольник
TiXmlElement* e3 = new TiXmlElement("rect");
e3->SetDoubleAttribute("x", params->Zones[i].Rect.LeftTop.X);
e3->SetDoubleAttribute("y", params->Zones[i].Rect.LeftTop.Y);
e3->SetDoubleAttribute("bx", params->Zones[i].Rect.RightBottom.X);
e3->SetDoubleAttribute("by", params->Zones[i].Rect.RightBottom.Y);
e1->LinkEndChild(e3);
}
else
{
//сохранить контур
TiXmlElement* e3 = new TiXmlElement("contour");
for (int j = 0; j < params->Zones[i].NumPoints; j++)
{
TiXmlElement* e2 = new TiXmlElement("Point");
e2->SetDoubleAttribute("x", params->Zones[i].Points[j].X);
e2->SetDoubleAttribute("y", params->Zones[i].Points[j].Y);
e3->LinkEndChild(e2);
}
e1->LinkEndChild(e3);
}
}
element->LinkEndChild(e1);
TiXmlElement* e3 = new TiXmlElement("sensitivity");
e3->SetDoubleAttribute("eventsens", params->EventSens);
e3->SetDoubleAttribute("eventtimesens", params->EventTimeSens);
element->LinkEndChild(e3);
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );
doc.LinkEndChild( element );
return doc.SaveFile(lpFileName);
}
示例7: SaveConnector
void XMLSaver::SaveConnector(Connector *c, TiXmlElement *se)
{
TiXmlElement *ce;
CONNECTOR_TYPE ct = c->Type();
switch (ct)
{
case CONNECTOR_TYPE_SLIDING:
{
ce = new TiXmlElement("ConnectorSliding");
ConnectorSliding *cs = (ConnectorSliding *)c;
ce->SetAttribute("name", cs->name);
ce->SetDoubleAttribute("ro", cs->ro);
ce->SetDoubleAttribute("phi", cs->phi);
ce->SetDoubleAttribute("alpha", cs->alpha);
break;
}
case CONNECTOR_TYPE_TURN:
{
ce = new TiXmlElement("ConnectorTurn");
ConnectorTurn *ct = (ConnectorTurn *)c;
ce->SetAttribute("name", ct->name);
ce->SetDoubleAttribute("ro", ct->ro);
ce->SetDoubleAttribute("phi", ct->phi);
break;
}
}
se->LinkEndChild(ce);
}
示例8: SaveRects
/*
Функция сохраняет массив прямоугольников в xml файл out_r.xml
параметры w,h предназначены для сохранения в относительных координатах
*/
void SaveRects(int w, int h)
{
double value = 0;
TiXmlElement* element = new TiXmlElement("Rects");
for (int i = 0; i < g_rects_count; i++)
{
TiXmlElement* e = new TiXmlElement("rect");
value = 100.*g_rects[i].x / (double)w;
e->SetDoubleAttribute("x", value);
value = 100.*g_rects[i].y / (double)h;
e->SetDoubleAttribute("y", value);
value = 100.*g_rects[i].width / (double)w;
e->SetDoubleAttribute("w", value);
value = 100.*g_rects[i].height / (double)h;
e->SetDoubleAttribute("h", value);
element->LinkEndChild(e);
}
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );
doc.LinkEndChild( element );
doc.SaveFile("out_r.xml");
}
示例9: enregistrerFichierConfig
////////////////////////////////////////////////////////////////////////
///
/// @fn void ConfigScene::ecrireFichierConfig(const std::string nomFichier)
///
/// Cette fonction ecrit les valeurs de la configuration courante dans le nom
/// de fichier passe en parametre.
///
/// @return Aucune.
///
////////////////////////////////////////////////////////////////////////
void ConfigScene::enregistrerFichierConfig(const std::string nomFichier)
{
TiXmlHandle docHandle(confXml_);
// Tenter d'obtenir les elements de configurations de la scene.
TiXmlElement* elementScene = docHandle.FirstChild("configuration").FirstChild("CScene").ToElement();
elementScene->SetAttribute("Calculs_par_image", CALCULS_PAR_IMAGE);
elementScene->SetDoubleAttribute("CoefFriSol",coefFriSol_);
elementScene->SetDoubleAttribute("CoefFriSable",coefFriSable_);
elementScene->SetDoubleAttribute("CoefRebondMur",coefRebondMur_);
elementScene->SetDoubleAttribute("AccelBonus",accelBonus_);
elementScene->SetAttribute("TailleEditionLargeur", tailleEdition_[0]);
elementScene->SetAttribute("TailleEditionHauteur", tailleEdition_[1]);
elementScene->SetAttribute("toucheClavierGauche", toucheClavier_[0]);
elementScene->SetAttribute("toucheClavierDroit", toucheClavier_[1]);
elementScene->SetAttribute("toucheClavierHaut", toucheClavier_[2]);
elementScene->SetAttribute("toucheClavierBas", toucheClavier_[3]);
elementScene->SetAttribute("toucheClavierEspace", toucheClavier_[4]);
elementScene->SetAttribute("toucheOptionGauche", toucheOptionClavier_[0].c_str());
elementScene->SetAttribute("toucheOptionDroit", toucheOptionClavier_[1].c_str());
elementScene->SetAttribute("toucheOptionHaut", toucheOptionClavier_[2].c_str());
elementScene->SetAttribute("toucheOptionBas", toucheOptionClavier_[3].c_str());
elementScene->SetAttribute("toucheOptionEspace", toucheOptionClavier_[4].c_str());
//// Adjoindre le noeud 'configuration' au noeud principal
//// (Rappel : pas besoin de libérer la mémoire de elementConfiguration
//// puisque toutes les fonctions Link... le font pour nous)
confXml_->SaveFile( nomFichier.c_str() );
}
示例10: writeXMLFile
void MontagingToTraceEditorXMLConverter::writeXMLFile()
{
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "");
doc.LinkEndChild(decl);
TiXmlElement* root = new TiXmlElement("Source");
doc.LinkEndChild(root);
std::vector<ImageTransformData*>::iterator image_transforms_data_iter;
int counter = 0;
for (image_transforms_data_iter = image_transforms_data.begin(); image_transforms_data_iter != image_transforms_data.end(); image_transforms_data_iter++)
{
TiXmlElement *File = new TiXmlElement("File");
root->LinkEndChild(File);
ImageTransformData *image_transform = *image_transforms_data_iter;
File->SetDoubleAttribute("tX", -1.0 * (*image_transforms_data_iter)->gettX());
File->SetDoubleAttribute("tY", -1.0 * (*image_transforms_data_iter)->gettY());
File->SetDoubleAttribute("tZ", -1.0 * (*image_transforms_data_iter)->gettZ());
File->SetAttribute("FileName", (*image_transforms_data_iter)->getFileName());
File->SetAttribute("Type", "Image");
}
doc.SaveFile("project.xml");
}
示例11: WriteXMLAttributes
void CSpeedOpParams::WriteXMLAttributes(TiXmlNode* pElem)
{
TiXmlElement * element = heeksCAD->NewXMLElement( "speedop" );
heeksCAD->LinkXMLEndChild( pElem, element );
element->SetDoubleAttribute( "hfeed", m_horizontal_feed_rate);
element->SetDoubleAttribute( "vfeed", m_vertical_feed_rate);
element->SetDoubleAttribute( "spin", m_spindle_speed);
}
示例12: SaveXML
void CelestialNavigationDialog::SaveXML(wxString filename)
{
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "utf-8", "" );
doc.LinkEndChild( decl );
TiXmlElement * root = new TiXmlElement( "OpenCPNCelestialNavigation" );
doc.LinkEndChild( root );
char version[24];
sprintf(version, "%d.%d", PLUGIN_VERSION_MAJOR, PLUGIN_VERSION_MINOR);
root->SetAttribute("version", version);
root->SetAttribute("creator", "Opencpn Celestial Navigation plugin");
TiXmlElement *c = new TiXmlElement( "ClockError" );
c->SetAttribute("Seconds", m_ClockCorrectionDialog.m_sClockCorrection->GetValue());
root->LinkEndChild(c);
for(int i = 0; i<m_lSights->GetItemCount(); i++) {
TiXmlElement *c = new TiXmlElement( "Sight" );
Sight *s = (Sight*)wxUIntToPtr(m_lSights->GetItemData(i));
c->SetAttribute("Visible", s->m_bVisible);
c->SetAttribute("Type", s->m_Type);
c->SetAttribute("Body", s->m_Body.mb_str());
c->SetAttribute("BodyLimb", s->m_BodyLimb);
c->SetAttribute("Date", s->m_DateTime.FormatISODate().mb_str());
c->SetAttribute("Time", s->m_DateTime.FormatISOTime().mb_str());
c->SetDoubleAttribute("TimeCertainty", s->m_TimeCertainty);
c->SetDoubleAttribute("Measurement", s->m_Measurement);
c->SetDoubleAttribute("MeasurementCertainty", s->m_MeasurementCertainty);
c->SetDoubleAttribute("EyeHeight", s->m_EyeHeight);
c->SetDoubleAttribute("Temperature", s->m_Temperature);
c->SetDoubleAttribute("Pressure", s->m_Pressure);
c->SetDoubleAttribute("IndexError", s->m_IndexError);
c->SetDoubleAttribute("ShiftNm", s->m_ShiftNm);
c->SetDoubleAttribute("ShiftBearing", s->m_ShiftBearing);
c->SetDoubleAttribute("MagneticShiftBearing", s->m_bMagneticShiftBearing);
c->SetAttribute("ColourName", s->m_ColourName.mb_str());
c->SetAttribute("Colour", s->m_Colour.GetAsString().mb_str());
c->SetAttribute("Transparency", s->m_Colour.Alpha());
root->LinkEndChild(c);
}
if(!doc.SaveFile(filename.mb_str())) {
wxMessageDialog mdlg(this, _("Failed to save xml file: ") + filename,
_("Celestial Navigation"), wxOK | wxICON_ERROR);
mdlg.ShowModal();
}
}
示例13: toXmlElement
TiXmlElement* GeneticSetColorAction::toXmlElement() {
TiXmlElement* element = new TiXmlElement("SetColorAction");
element->SetDoubleAttribute("Red", color.r);
element->SetDoubleAttribute("Green", color.g);
element->SetDoubleAttribute("Blue", color.b);
element->SetDoubleAttribute("Alpha", color.a);
return element;
};
示例14: saveBones
/**
* Creates XML objects for all the bones in a skeleton.
**/
void IO::saveBones(TiXmlElement *parent, vector<Bone *> *bones,
vector<Joint *> *joints, vector<Vertex *> *vertices)
{
TiXmlElement *bonesXML = new TiXmlElement("bones");
parent->LinkEndChild(bonesXML);
vector<Bone *>::iterator i = bones->begin();
for (; i < bones->end(); i++)
{
Bone *b = *i;
TiXmlElement *boneXML = new TiXmlElement("bone");
const char *name = b->getName();
if (name[0] != 0) // save name only for named bones
boneXML->SetAttribute("name", name);
// find vertex indices in mesh and set attributes
boneXML->SetAttribute("j0",
index(joints->begin(), joints->end(), b->j0));
boneXML->SetAttribute("j1",
index(joints->begin(), joints->end(), b->j1));
boneXML->SetDoubleAttribute("stiffness", b->damp);
boneXML->SetDoubleAttribute("lm", b->getLengthMult());
boneXML->SetDoubleAttribute("lmmin", b->getLengthMultMin());
boneXML->SetDoubleAttribute("lmmax", b->getLengthMultMax());
boneXML->SetDoubleAttribute("tempo", b->getTempo());
boneXML->SetDoubleAttribute("time", b->getTime());
boneXML->SetDoubleAttribute("size", b->getOrigSize());
boneXML->SetAttribute("selected", b->selected);
boneXML->SetDoubleAttribute("radius", b->getRadiusMult());
bonesXML->LinkEndChild(boneXML);
// save attached vertices
float *dsts, *weights, *ca, *sa;
vector<Vertex *> *attachedVertices =
b->getAttachedVertices(&dsts, &weights, &ca, &sa);
int count = attachedVertices->size();
if (!count) // no vertices attached
continue;
TiXmlElement *attachedXML = new TiXmlElement("attached");
boneXML->LinkEndChild(attachedXML);
for (int j = 0; j < count; j++)
{
Vertex *v = (*attachedVertices)[j];
TiXmlElement *vertexXML = new TiXmlElement("vertex");
// find and set vertex index
vertexXML->SetAttribute("id",
index(vertices->begin(), vertices->end(), v));
vertexXML->SetDoubleAttribute("d", dsts[j]); // distance
vertexXML->SetDoubleAttribute("w", weights[j]); // weight
vertexXML->SetDoubleAttribute("ca", ca[j]); // cosinus
vertexXML->SetDoubleAttribute("sa", sa[j]); // sinus
attachedXML->LinkEndChild(vertexXML);
}
}
}
示例15: SaveToFile
void Template::SaveToFile(const std::string &path)
{
TiXmlDocument *doc = new TiXmlDocument();
TiXmlElement *baseEle = new TiXmlElement("Template");
TiXmlElement *descEle = new TiXmlElement("Description");
descEle->LinkEndChild(new TiXmlText(m_description.c_str()));
TiXmlElement *ele = new TiXmlElement("Keyframes");
ele->SetDoubleAttribute("period", m_period);
ele->SetAttribute("types", m_types);
for(std::map<std::string, BoneAnimation>::iterator it = m_keyFrames.begin(); it != m_keyFrames.end(); it++)
{
TiXmlElement *boneEle = new TiXmlElement("Bone");
boneEle->SetAttribute("name", it->first.c_str());
for(std::map<KeyFrameType, std::vector<KeyFrame> >::iterator it2 = it->second.keyFrames.begin(); it2 != it->second.keyFrames.end(); it2++)
{
TiXmlElement *keyframetypeEle = new TiXmlElement("Type");
keyframetypeEle->SetDoubleAttribute("type", static_cast<int>(it2->first));
for(unsigned int a = 0; a < it2->second.size(); a++)
{
TiXmlElement *timefloatEle = new TiXmlElement("Keyframe");
timefloatEle->SetDoubleAttribute("time", it2->second.at(a).time);
timefloatEle->SetDoubleAttribute("value", it2->second.at(a).value);
timefloatEle->SetAttribute("valueStr", it2->second.at(a).valueStr.c_str());
timefloatEle->SetAttribute("interpolation", it2->second.at(a).interpolation.c_str());
keyframetypeEle->LinkEndChild(timefloatEle);
}
boneEle->LinkEndChild(keyframetypeEle);
}
ele->LinkEndChild(boneEle);
}
TiXmlElement *descriptionsEle = baseEle->LinkEndChild(new TiXmlElement("BonesDescriptions"))->ToElement();
for(unsigned int a = 0; a < m_boneDescriptions.size(); a++)
{
TiXmlElement *boneDescrEle = new TiXmlElement("BoneDescription");
boneDescrEle->SetAttribute("bone", m_boneDescriptions[a].first.c_str());
boneDescrEle->SetAttribute("description", m_boneDescriptions[a].second.c_str());
descriptionsEle->LinkEndChild(boneDescrEle);
}
baseEle->LinkEndChild(descEle);
baseEle->LinkEndChild(ele);
doc->LinkEndChild(baseEle);
doc->SaveFile(path.c_str());
}