예제 #1
0
void Warp::writeSettings( const WarpList &warps, const DataTargetRef &target )
{
	// create default <profile> (profiles are not yet supported)
	XmlTree profile;
	profile.setTag( "profile" );
	profile.setAttribute( "name", "default" );

	//
	for( unsigned i = 0; i < warps.size(); ++i ) {
		// create <map>
		XmlTree map;
		map.setTag( "map" );
		map.setAttribute( "id", i + 1 );
		map.setAttribute( "display", 1 ); // not supported yet

		// create <warp>
		map.push_back( warps[i]->toXml() );

		// add map to profile
		profile.push_back( map );
	}

	// create config document and root <warpconfig>
	XmlTree doc;
	doc.setTag( "warpconfig" );
	doc.setAttribute( "version", "1.0" );
	doc.setAttribute( "profile", "default" );

	// add profile to root
	doc.push_back( profile );

	// write file
	doc.write( target );
}
예제 #2
0
파일: cApp.cpp 프로젝트: stdmtb/uf_0.9.0
void cApp::saveXml(){
    
    XmlTree xml, mn;
    xml.setTag("gui_setting");
    mn.setTag("main");
    
    mn.push_back( XmlTree("frame", to_string(frame) ));
    mn.push_back( XmlTree("ortho", to_string(bOrtho) ));
    mn.push_back( XmlTree("xyz_global_scale", to_string(Ramses::globalScale) ));
    //mn.push_back( XmlTree("r_resolution", to_string(Ramses::boxelx) ));
    //mn.push_back( XmlTree("theta_resolution", to_string(Ramses::boxely) ));
    
    xml.push_back( mn );
    
    XmlTree sim;
    sim.setTag("simType_"+to_string(simType));
    
    for( int i=0; i<rms.size(); i++){
        Ramses & r = rms[i];
        string name = Ramses::prm[i];
        XmlTree prm;
        prm.setTag(name);
        prm.push_back( XmlTree("show", to_string( r.bShow) ));
        prm.push_back( XmlTree("polar", to_string( r.bPolar )));
        prm.push_back( XmlTree("Auto_Min_Max", to_string( r.bAutoMinMax) ));
        prm.push_back( XmlTree("in_min", to_string(r.in_min) ));
        prm.push_back( XmlTree("in_max",to_string(r.in_max)));
        prm.push_back( XmlTree("z_extrude", to_string(r.extrude)));
        prm.push_back( XmlTree("x_offset", to_string(r.xoffset)));
        prm.push_back( XmlTree("y_offset", to_string(r.yoffset)));
        prm.push_back( XmlTree("z_offset", to_string(r.zoffset)));
        prm.push_back( XmlTree("xy_scale", to_string( r.scale )));
        prm.push_back( XmlTree("log", to_string( r.eStretch )));
        sim.push_back( prm );
    }
    xml.push_back(sim);

    DataTargetRef file = DataTargetPath::createRef( "gui.xml" );
    xml.write( file );

}
예제 #3
0
void DataManager::generateXmlFile(){
    XmlTree dataTree;
    dataTree.setTag("QLT_Genome_Data");

    dataTree.push_back(XmlTree("datapath","./data/exons/"));
    
    XmlTree datas("datasets","");
    for(int i=0;i<23;i++){
        XmlTree dataset("dataset","");
        dataset.setAttribute("id", i);
        dataset.push_back( XmlTree("title","Chromosome "+toString(i+1)) );
        dataset.push_back( XmlTree("map","exons."+toString(i+1)+".locations") );
        dataset.push_back( XmlTree("bases","exons."+toString(i+1)+".bases") );
        datas.push_back( dataset );
    }
    dataTree.push_back( datas );

    DataTargetPathRef f = writeFile( getAssetPath( "QLT_Genome_Data.xml" ), true );
    dataTree.write( f );
    
}
예제 #4
0
void XMLTestApp::mouseDown( MouseEvent event )
{
	XmlTree doc = XmlTree::createDoc();
	XmlTree library( "library", "" );
	XmlTree album( "album", "" );
	album.setAttribute( "musician", "Sufjan Stevens" );
	album.setAttribute( "year", "2004" );
	album.push_back( XmlTree( "title", "Seven Swans" ) );
	album.push_back( XmlTree( "track", "All the Trees of the Field Will Clap Their Hands" ) );
	album.push_back( XmlTree( "track", "The Dress Looks Nice on You" ) );
	album.push_back( XmlTree( "track", "In the Devil's Territory" ) );
	album.push_back( XmlTree( "track", "To Be Alone With You" ) );
	library.push_back( album );
	doc.push_back( library );
	console() << doc;
	doc.write( writeFile( getHomeDirectory() / "testoutput.xml" ), false );
}
XmlTree	WarpPerspectiveBilinear::toXml() const
{
	XmlTree xml = WarpBilinear::toXml();

	// set corners
	for(unsigned i=0;i<4;++i) {
		Vec2f corner = mWarp->getControlPoint(i);

		XmlTree cp;
		cp.setTag("corner");
		cp.setAttribute("x", corner.x);
		cp.setAttribute("y", corner.y);

		xml.push_back(cp);
	}

	return xml;
}
예제 #6
0
XmlTree Warp::toXml() const
{
	XmlTree xml;
	xml.setTag( "warp" );
	switch( mType ) {
	case BILINEAR:
		xml.setAttribute( "method", "bilinear" );
		break;
	case PERSPECTIVE:
		xml.setAttribute( "method", "perspective" );
		break;
	case PERSPECTIVE_BILINEAR:
		xml.setAttribute( "method", "perspectivebilinear" );
		break;
	default:
		xml.setAttribute( "method", "unknown" );
		break;
	}
	xml.setAttribute( "width", mControlsX );
	xml.setAttribute( "height", mControlsY );
	xml.setAttribute( "brightness", mBrightness );

	// add <controlpoint> tags (column-major)
	std::vector<vec2>::const_iterator itr;
	for( itr = mPoints.begin(); itr != mPoints.end(); ++itr ) {
		XmlTree cp;
		cp.setTag( "controlpoint" );
		cp.setAttribute( "x", ( *itr ).x );
		cp.setAttribute( "y", ( *itr ).y );

		xml.push_back( cp );
	}

	// add <blend> parameters
	XmlTree blend;
	blend.setTag( "blend" );
	blend.setAttribute( "exponent", mExponent );
	{
		XmlTree edges;
		edges.setTag( "edges" );
		edges.setAttribute( "left", mEdges.x );
		edges.setAttribute( "top", mEdges.y );
		edges.setAttribute( "right", mEdges.z );
		edges.setAttribute( "bottom", mEdges.w );
		blend.push_back( edges );

		XmlTree gamma;
		gamma.setTag( "gamma" );
		gamma.setAttribute( "red", mGamma.x );
		gamma.setAttribute( "green", mGamma.y );
		gamma.setAttribute( "blue", mGamma.z );
		blend.push_back( gamma );

		XmlTree luminance;
		luminance.setTag( "luminance" );
		luminance.setAttribute( "red", mLuminance.x );
		luminance.setAttribute( "green", mLuminance.y );
		luminance.setAttribute( "blue", mLuminance.z );
		blend.push_back( luminance );
	}
	xml.push_back( blend );

	return xml;
}
예제 #7
0
void Config::save(fs::path filePath)
{
    std::string myXmlStr( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" );
	XmlTree doc(myXmlStr);
	XmlTree* node;
	node = new XmlTree();
	node->setTag("general");

	for(std::vector<ConfigParam>::iterator it = mConfigParameters.begin(); it!=mConfigParameters.end(); ++it)
	{
		XmlTree pn;
		pn.setTag(it->name);

		switch(it->type)
		{
		case _NODE:
			doc.push_back( *node );
			node = new XmlTree();
			node->setTag(it->name);
			break;
		case _BOOL:
			pn.setValue<string>( toString(*((bool*)it->param)) );
			node->push_back( pn );
			break;
		case _FLOAT:
			pn.setValue<float>( *((float*)it->param) );
			node->push_back( pn );
			break;
		case _DOUBLE:
			pn.setValue<double>( *((double*)it->param) );
			node->push_back( pn );
			break;
		case _INT:
			pn.setValue<int>( *((int*)it->param) );
			node->push_back( pn );
			break;
		case _VEC3F:
			pn.setAttribute<float>("x", (*((Vec3f*)it->param)).x);
			pn.setAttribute<float>("y", (*((Vec3f*)it->param)).y);
			pn.setAttribute<float>("z", (*((Vec3f*)it->param)).z);
			node->push_back( pn );
			break;
		case _QUATF:
			pn.setAttribute<float>("w", (*((Quatf*)it->param)).w);
			pn.setAttribute<float>("x", (*((Quatf*)it->param)).v.x);
			pn.setAttribute<float>("y", (*((Quatf*)it->param)).v.y);
			pn.setAttribute<float>("z", (*((Quatf*)it->param)).v.z);
			node->push_back( pn );
			break;
		case _COLOR:
			pn.setAttribute<float>("r", (*((Color*)it->param)).r);
			pn.setAttribute<float>("g", (*((Color*)it->param)).g);
			pn.setAttribute<float>("b", (*((Color*)it->param)).b);
			node->push_back( pn );
			break;
		case _COLORA:
			pn.setAttribute<float>("r", (*((ColorA*)it->param)).r);
			pn.setAttribute<float>("g", (*((ColorA*)it->param)).g);
			pn.setAttribute<float>("b", (*((ColorA*)it->param)).b);
			pn.setAttribute<float>("a", (*((ColorA*)it->param)).a);
			node->push_back( pn );
			break;
		case _STRING:
			pn.setValue<std::string>( *((std::string*)it->param) );
			node->push_back( pn );
			break;
		}
	}
	
	doc.push_back( *node );
	doc.write(writeFile(filePath));

	node = NULL;
}