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;
}
Beispiel #2
0
/**
 * 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);
	}
}
Beispiel #3
0
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 );  
	
}
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);
}
Beispiel #5
0
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);
}
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);
}
Beispiel #7
0
/*
	Функция сохраняет массив прямоугольников в 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");
}
////////////////////////////////////////////////////////////////////////
///
/// @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() );
}
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");
}
Beispiel #10
0
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);
}
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();
    }
}
  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;
  };
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);

}
Beispiel #14
0
/**
 * 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);
		}
	}
}
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());
}
Beispiel #16
0
void HPoint::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element;
	element = new TiXmlElement( "Point" );
	root->LinkEndChild( element );
	element->SetAttribute("col", color.COLORREF_color());
	element->SetDoubleAttribute("x", m_p.X());
	element->SetDoubleAttribute("y", m_p.Y());
	element->SetDoubleAttribute("z", m_p.Z());
	WriteBaseXML(element);
}
  TiXmlElement* GeneticSimpleChemicalConvertAction::toXmlElement() {
    TiXmlElement* element;
    element = new TiXmlElement("ChemicalConvertAction");

    element->SetAttribute("FromName",fromChemName);
    element->SetAttribute("ToName",toChemName);
    element->SetDoubleAttribute("Amount",amount);
    element->SetDoubleAttribute("Ratio",ratio);

    return element;
  };
void ETHEntityProperties::SetColorPropertyToXmlElement(
	TiXmlElement *pRoot,
	const str_type::string& name,
	const Vector3& value)
{
	TiXmlElement* pElement = new TiXmlElement(name);
	pRoot->LinkEndChild(pElement);
	pElement->SetDoubleAttribute(GS_L("r"), value.x);
	pElement->SetDoubleAttribute(GS_L("g"), value.y);
	pElement->SetDoubleAttribute(GS_L("b"), value.z);
}
  TiXmlElement* GeneticColorMutation::toXmlElement() {
    TiXmlElement* element;
    element = new TiXmlElement("ColorMutation");

    element->SetDoubleAttribute("Min",min);
    element->SetDoubleAttribute("Max",max);
    element->SetDoubleAttribute("Maxstep",maxstep);
    element->SetDoubleAttribute("Probability",prob);
    element->SetAttribute("Description",description);

    return element;
  };
Beispiel #20
0
void CTag::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element;
	element = new TiXmlElement( "Tag" );
	wxGetApp().LinkXMLEndChild( root,  element );
	element->SetDoubleAttribute( "x", m_pos[0]);
	element->SetDoubleAttribute( "y", m_pos[1]);
	element->SetDoubleAttribute( "width", m_width);
	element->SetDoubleAttribute( "angle", m_angle);
	element->SetDoubleAttribute( "height", m_height);
	WriteBaseXML(element);
}
Beispiel #21
0
void CTappingParams::WriteXMLAttributes(TiXmlNode *root)
{
	TiXmlElement * element;
	element = heeksCAD->NewXMLElement( "params" );
	heeksCAD->LinkXMLEndChild( root,  element );

	element->SetDoubleAttribute( "standoff", m_standoff);
	element->SetDoubleAttribute( "dwell", m_dwell);
	element->SetDoubleAttribute( "depth", m_depth);
	element->SetAttribute( "sort_tapping_locations", m_sort_tapping_locations);
	element->SetAttribute( "tap_mode", m_tap_mode);
}
Beispiel #22
0
void writeFitnessToXml(string xmlCompleteFileName, const double fitness, const double distance)
{
	screen << "Writing fitness: " << fitness << " to file: "	<< xmlCompleteFileName << " ... ";
	TiXmlDocument cppn(xmlCompleteFileName);
	TiXmlElement *root = getIndividualXml(cppn);

	root->SetDoubleAttribute("Fitness", fitness);
  root->SetDoubleAttribute("Distance", distance);

	cppn.SaveFile();
	screen << "done" << endl;
}
TiXmlElement* cGoldBase::saveGoldXML( TiXmlElement* pRoot )
{
    TiXmlElement* pGold = new TiXmlElement( "Gold" );
    pRoot->LinkEndChild( pGold );
    pGold->SetDoubleAttribute( "value", m_value );
    pGold->SetDoubleAttribute( "income", m_income );
    pGold->SetDoubleAttribute( "upkeep", m_upkeep );
    pGold->SetDoubleAttribute( "cash_in", m_cash_in );
    pGold->SetDoubleAttribute( "cash_out", m_cash_out );
    
    return pGold;
}
  TiXmlElement* GeneticMaxAmountMutation::toXmlElement() {
    TiXmlElement* element;
    element = new TiXmlElement("MaxAmountMutation");

    element->SetDoubleAttribute("Min",min);
    element->SetDoubleAttribute("Max",max);
    element->SetDoubleAttribute("Maxstep",maxstep);
    element->SetDoubleAttribute("Probability",prob);
    element->SetAttribute("Description",description);
    element->SetAttribute("ChemicalName",chemName);

    return element;
  };
Beispiel #25
0
void CWaterlineParams::WriteXMLAttributes(TiXmlNode *root)
{
	TiXmlElement * element;
	element = heeksCAD->NewXMLElement( "params" );
	heeksCAD->LinkXMLEndChild( root,  element );
	element->SetDoubleAttribute( "minx", m_box.m_x[0]);
	element->SetDoubleAttribute( "maxx", m_box.m_x[3]);
	element->SetDoubleAttribute( "miny", m_box.m_x[1]);
	element->SetDoubleAttribute( "maxy", m_box.m_x[4]);
	element->SetDoubleAttribute( "step_over", m_step_over);
	element->SetDoubleAttribute( "material_allowance", m_material_allowance);
	element->SetDoubleAttribute( "tolerance", m_tolerance);
}
////////////////////////////////////////////////////////////////////////
///
/// @fn void ConfigScene::creerDOM ( TiXmlNode& node ) const
///
/// Cette fonction écrit les valeurs de la configuration dans un élément XML.
///
/// @return Aucune.
///
////////////////////////////////////////////////////////////////////////
void ConfigScene::creerDOM ( TiXmlNode* node )
{
	// Créer le noeud 'configuration'
	TiXmlElement* elementConfiguration = new TiXmlElement("configuration");

	// Créer le noeud scene et définir ses attributs
	TiXmlElement* elementScene = new TiXmlElement("CScene");
	elementScene->SetAttribute("Calculs_par_image", 20);
	CALCULS_PAR_IMAGE=20;
	elementScene->SetDoubleAttribute("CoefFriSol",2);
	coefFriSol_=2;
	elementScene->SetDoubleAttribute("CoefFriSable",6);
	coefFriSable_=6;
	elementScene->SetDoubleAttribute("CoefRebondMur",0.95);
	coefRebondMur_=0.95;
	elementScene->SetDoubleAttribute("AccelBonus",0);
	accelBonus_=0;
	elementScene->SetAttribute("TailleEditionLargeur", 500);//Placeholder a modifier
	elementScene->SetAttribute("TailleEditionHauteur", 500);
	toucheClavier_[0]=37;
	toucheClavier_[1]=39;
	toucheClavier_[2]=38;
	toucheClavier_[3]=40;
	toucheClavier_[4]=32;
	tailleEdition_[0]=500;
	tailleEdition_[1]=500;
	toucheOptionClavier_.push_back("gauche");
	toucheOptionClavier_.push_back("droit");
	toucheOptionClavier_.push_back("haut");
	toucheOptionClavier_.push_back("bas");
	toucheOptionClavier_.push_back("espace");
	elementScene->SetAttribute("toucheClavierGauche", 37);
	elementScene->SetAttribute("toucheClavierDroit", 39);
	elementScene->SetAttribute("toucheClavierHaut", 38);
	elementScene->SetAttribute("toucheClavierBas", 40);
	elementScene->SetAttribute("toucheClavierEspace", 32);
	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 'elementScene'
	elementConfiguration->LinkEndChild(elementScene);

	// 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)
	node->LinkEndChild(elementConfiguration);
}
Beispiel #27
0
void CPattern::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element = new TiXmlElement( "Pattern" );
	wxGetApp().LinkXMLEndChild( root,  element );

	element->SetAttribute( "copies1", m_copies1);
	element->SetDoubleAttribute( "x_shift1", m_x_shift1);
	element->SetDoubleAttribute( "y_shift1", m_y_shift1);
	element->SetAttribute( "copies2", m_copies2);
	element->SetDoubleAttribute( "x_shift2", m_x_shift2);
	element->SetDoubleAttribute( "y_shift2", m_y_shift2);

	IdNamedObj::WriteBaseXML(element);
}
Beispiel #28
0
void CPocket::WriteXMLAttributes(TiXmlNode *root)
{
	TiXmlElement * element;
	element = new TiXmlElement( "params" );
	wxGetApp().LinkXMLEndChild( root,  element );
	element->SetDoubleAttribute( "step", m_step_over);
	element->SetAttribute( "cut_mode", m_cut_mode);
	element->SetDoubleAttribute( "mat", m_material_allowance);
	element->SetAttribute( "from_center", m_starting_place);
	element->SetAttribute( "keep_tool_down", m_keep_tool_down_if_poss ? 1:0);
	element->SetAttribute( "use_zig_zag", m_use_zig_zag ? 1:0);
	element->SetDoubleAttribute( "zig_angle", m_zig_angle);
	element->SetAttribute( "zig_unidirectional", m_zig_unidirectional ? 1:0);
	element->SetAttribute( "entry_move", (int) m_entry_move);
}
Beispiel #29
0
    virtual void double_(double value)
      {
        TiXmlElement* node = new TiXmlElement("double");
        node_->LinkEndChild( node );

        node->SetDoubleAttribute("value", value);
      }
Beispiel #30
0
    virtual void float_(float value)
      {
        TiXmlElement* node = new TiXmlElement("float");
        node_->LinkEndChild( node );

        node->SetDoubleAttribute("value", value);
      }