当前位置: 首页>>代码示例>>C++>>正文


C++ XmlTree::setAttribute方法代码示例

本文整理汇总了C++中XmlTree::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlTree::setAttribute方法的具体用法?C++ XmlTree::setAttribute怎么用?C++ XmlTree::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlTree的用法示例。


在下文中一共展示了XmlTree::setAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: writeSettings

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 );
}
开发者ID:UIKit0,项目名称:Cinder-Warping,代码行数:34,代码来源:Warp.cpp

示例2:

	XmlTree	VDFbo::toXml() const {
		XmlTree		xml;
		xml.setTag("details");
		xml.setAttribute("path", mFilePathOrText);
		xml.setAttribute("width", mVDSettings->mFboWidth);
		xml.setAttribute("height", mVDSettings->mFboHeight);
		xml.setAttribute("shadername", mShaderName);
		xml.setAttribute("inputtextureindex", mInputTextureIndex);
		return xml;
	}
开发者ID:videodromm,项目名称:Cinder-Videodromm-Shaders,代码行数:10,代码来源:VDFbo.cpp

示例3:

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;
}
开发者ID:Aurite,项目名称:museomix-pimp-my-room,代码行数:18,代码来源:WarpPerspectiveBilinear.cpp

示例4: toXml

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;
}
开发者ID:UIKit0,项目名称:Cinder-Warping,代码行数:64,代码来源:Warp.cpp


注:本文中的XmlTree::setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。