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


C++ Visual::getName方法代码示例

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


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

示例1: position

	/* PUBLIC STATIC FUNCTIONS */
	VisualWavesControl *VisualWavesControl::load(std::string file)
	{
		XMLNode doc = XMLNode::openFileHelper(file.c_str(), XML_WAVES_CONTROL);

		float width = atof(doc.getAttribute(XML_WIDTH));
		std::string visualName = doc.getAttribute(XML_VISUAL);
		
		WavesGlobalState *wgs = WavesGlobalState::getInstance();
		assert(wgs != NULL);

		const std::vector<Visual *> factoryVisuals = wgs->getFactoryVisuals();
		
		Visual *visual = NULL;
		for(unsigned int i = 0; i < factoryVisuals.size(); i++)
		{
			Visual *cmp = factoryVisuals[i];
			assert(cmp != NULL);

			if(cmp->getName() == visualName)
			{
				visual = cmp->getInstance();
				break;
			}
		}

		if(visual == NULL)
		{
			return NULL;
		}
		else
		{
			assert(visual != NULL);

			XMLNode positionNode = doc.getChildNode(XML_POSITION);
			float x = atof(positionNode.getAttribute(XML_X));
			float y = atof(positionNode.getAttribute(XML_Y));
			Point2f position(x, y);

			std::string nickname = doc.getAttribute(XML_NICKNAME);

			bool forOutput = (bool)atoi(doc.getAttribute(XML_FOR_OUTPUT));

			// load tracks
			std::vector<Track *> tracks;
			unsigned int trackCount = doc.nChildNode(XML_TRACK);
			for(unsigned int i = 0; i < trackCount; i++)
			{
				XMLNode trackNode = doc.getChildNode(XML_TRACK, i);

				XMLNode trackPositionNode = trackNode.getChildNode(XML_POSITION);
				float tx = atof(trackPositionNode.getAttribute(XML_X));
				float ty = atof(trackPositionNode.getAttribute(XML_Y));
				Point2f position(tx, ty);

				float width = atof(trackNode.getAttribute(XML_WIDTH));
				float height = atof(trackNode.getAttribute(XML_HEIGHT));

				std::string parameterName = trackNode.getAttribute(XML_PARAMETER);
				Parameter *parameter = visual->getParameter(parameterName);

				Track *track = new Track(position, width, height, parameter);	
				std::map<unsigned int, SplinePreset *> &splinePresets = wgs->getSplinePresets();

				Track::TrackMode mode = (Track::TrackMode)atoi(trackNode.getAttribute(XML_MODE));
				track->setMode(mode);

				// load presets for menu
				unsigned int numFFTPresets = trackNode.nChildNode(XML_FFT_PRESET);
				for(unsigned int j = 0; j < numFFTPresets; j++)
				{
					XMLNode fftPresetNode = trackNode.getChildNode(XML_FFT_PRESET, j);
					unsigned int pId = atoi(fftPresetNode.getAttribute(XML_ID));
					track->addFFTPreset(pId);
				}

				unsigned int numtemporalPresets = trackNode.nChildNode(XML_TEMPORAL_PRESET);
				for(unsigned int j = 0; j < numtemporalPresets; j++)
				{
					XMLNode temporalPresetNode = trackNode.getChildNode(XML_TEMPORAL_PRESET, j);
					unsigned int pId = atoi(temporalPresetNode.getAttribute(XML_ID));
					track->addTemporalPreset(pId);
				}

				// load current presets (if any)
				std::map<unsigned int, SplinePreset *> &loadedPresets = wgs->getSplinePresets();
				std::map<unsigned int, SplinePreset *> &defaultPresets = wgs->getDefaultPresets();

				bool hasTemporalCurrentPreset = (bool)trackNode.isAttributeSet(XML_TEMPORAL_PRESET);
				if(hasTemporalCurrentPreset)
				{
					unsigned int temporalCurrentPreset = atoi(trackNode.getAttribute(XML_TEMPORAL_PRESET));
					
					SplinePreset *sp = NULL;
					
					if(loadedPresets.count(temporalCurrentPreset) > 0)
					{
						sp = loadedPresets[temporalCurrentPreset];
					}
					else if(defaultPresets.count(temporalCurrentPreset) > 0)
//.........这里部分代码省略.........
开发者ID:jonathanhook,项目名称:Waves,代码行数:101,代码来源:VisualWavesControl.cpp


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