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


C++ XMLNode::GetChildList方法代码示例

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


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

示例1: if

Gmeter::Gmeter(XMLNode gaugeNode) : MarkedDial(gaugeNode)
{
	m_minValue = 0.0;
	m_maxValue = 0.0;

	m_PhysicalSize.x = 44.0;
	m_PhysicalSize.y = 50.0;

	// Set the gauge label
	if (gaugeNode.HasChild("Text")) {
		SetLabel(gaugeNode.GetChild("Text").GetText());
	}
	else
	{
		SetLabel("");
	}

	// Set the yellow, red and absolute limits
	if (gaugeNode.HasChild("Limit")) {
		double maxAbsolute = 0.0, minYellow = 0.0, minRed = 0.0; // temp variables

		XMLNode::NodeList nodeList = gaugeNode.GetChildList("Limit");
		XMLNode::NodeList::iterator iter;
		for (iter = nodeList.begin(); iter != nodeList.end(); ++iter)
		{
			string color = (*iter).GetProperty("color");

			if (color == "yellow")
			{
				minYellow = (*iter).GetTextAsDouble();
			}
			else if (color == "red")
			{
				minRed = (*iter).GetTextAsDouble();
			}
			else if (color == "")
			{
				maxAbsolute = (*iter).GetTextAsDouble();
			}
		}

		SetMinMax(-1 * fabs(maxAbsolute), fabs(maxAbsolute));
		SetColourRanges(fabs(minYellow), fabs(minRed));
	}
	else
	{
		SetMinMax(-8.0, 8.0);
		SetColourRanges(2.0, 4.0);
	}
}
开发者ID:sirdel,项目名称:buildrt,代码行数:50,代码来源:Gmeter.cpp

示例2: if

EngineDial::EngineDial(XMLNode gaugeNode) : GenericDial(gaugeNode)
{
	m_PhysicalSize.x = 42.0;
	m_PhysicalSize.y = 79.0;

	// Set the gauge label
	if (gaugeNode.HasChild("Text")) {
		SetLabel(gaugeNode.GetChild("Text").GetText());
	}
	else
	{
		SetLabel("");
	}

	// Set the yellow and red limits
	if (gaugeNode.HasChild("Limit")) {
		double minYellow = 0.0, minRed = 0.0; // temp variables

		XMLNode::NodeList nodeList = gaugeNode.GetChildList("Limit");
		XMLNode::NodeList::iterator iter;
		for (iter = nodeList.begin(); iter != nodeList.end(); ++iter)
		{
			string color = (*iter).GetProperty("color");

			if (color == "yellow")
			{
				minYellow = (*iter).GetTextAsDouble();
			}
			else if (color == "red")
			{
				minRed = (*iter).GetTextAsDouble();
			}
		}

		SetColourRanges(minYellow, minRed);
	}
	else
	{
		SetColourRanges(0.0, 0.0);
	}
}
开发者ID:sirdel,项目名称:buildrt,代码行数:41,代码来源:EngineDial.cpp

示例3: InitFromXMLNode

void GaugePanel::InitFromXMLNode(XMLNode gaugeNode)
{
	Check(gaugeNode.IsValid() && gaugeNode.GetName() == "Panel");

	// Create gauges as described by the XML file
	XMLNode::NodeList nodeList = gaugeNode.GetChildList("Gauge");
	XMLNode::NodeList::iterator iter;
	for (iter = nodeList.begin(); iter != nodeList.end(); ++iter)
	{
		Gauge *pGauge = GaugeFactory::CreateGaugeInstance(*iter);

		if (pGauge != NULL) {
			pGauge->SetParentRenderObject(this);
			AddGauge(pGauge);
		}
	}

	double scale = globals->m_PrefManager->GetPrefD("DefaultPanelScale");
	double zoom = globals->m_PrefManager->GetPrefD("Zoom");
	double x, y; // temp variables

	// Set the units per pixel
	if (gaugeNode.HasChild("UnitsPerPixel"))
	{
		SetUnitsPerPixel(gaugeNode.GetChild("UnitsPerPixel").GetTextAsDouble());
	}
	else
	{
		SetUnitsPerPixel(globals->m_PrefManager->GetPrefD("UnitsPerPixel"));
	}

	// Set the scale
	if (gaugeNode.HasChild("Scale"))
	{
		gaugeNode.GetChild("Scale").GetTextAsCoord(x, y);
		SetScale(x * zoom * scale, y * zoom * scale);
	}
	else
	{
		SetScale(zoom * scale, zoom * scale);
	}

	// Set the position
	if (gaugeNode.HasChild("Position"))
	{
		gaugeNode.GetChild("Position").GetTextAsCoord(x, y);
		SetPosition(x * zoom, y * zoom);
	}
	else
	{
		SetPosition(0.0, 0.0);
	}

	// Set the size
	if (gaugeNode.HasChild("Size"))
	{
		gaugeNode.GetChild("Size").GetTextAsCoord(x, y);
		SetSize(x, y);
	}
	else
	{
		SetSize(0.0, 0.0);
	}

	// Set the gauge outline
	if (gaugeNode.HasChild("Outline"))
	{
		SetPanelOutline(gaugeNode.GetChild("Outline").GetTextAsBool());
	}
}
开发者ID:sirdel,项目名称:buildrt,代码行数:70,代码来源:GaugePanel.cpp


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