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


C++ Switch::position方法代码示例

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


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

示例1: nw

bool UdmTests::genericTest::generictest(const char * src, const char * dst)
{

	Udm::SmartDataNetwork nw(LampDiagram::diagram);

		nw.CreateNew(src,"LampDiagram", RootFolder::meta);

		{
			RootFolder rrr = RootFolder::Cast(nw.GetRootObject());
			int count = 0;
			for (count = 0; count < 1; count++)
			{
				cout << "." ;
				Lamp doubleBulbLamp = Lamp::Create(rrr);

				char lamp_name[70]; 
				sprintf(lamp_name, "HighLight XL150 instance no. %d, here follows end-of line:\n", count);
				doubleBulbLamp.name() = lamp_name;
				
				doubleBulbLamp.MaxVoltageRating() = 220.0; 
				doubleBulbLamp.MaxTempRating()    = 200; 
				ElectricTerminal termA = ElectricTerminal::Create(doubleBulbLamp);
				ElectricTerminal termB = ElectricTerminal::Create(doubleBulbLamp);
				termA.position() = "(500,20)";
				termB.position() = "(500,85)";

			
				Plug thePlug = Plug::Create(doubleBulbLamp);
				thePlug.position() = "(500,150)";
				thePlug.name() = "Plug";
				ElectricTerminal plt1 = ElectricTerminal::Create(thePlug);
				plt1.position() = "(20,100)";
				ElectricTerminal plt2 = ElectricTerminal::Create(thePlug);
				plt2.position() = "(20,200)";

		// create mainswitch and its terminals
				Switch mainSwitch = Switch::Create(doubleBulbLamp, Lamp::meta_MainSwitch);
				mainSwitch.position() = "(300,100)";
				mainSwitch.name() = "MainSW";
				ElectricTerminal mst1 = ElectricTerminal::Create(mainSwitch);
				mst1.position() = "(20,100)";
				ElectricTerminal mst2 = ElectricTerminal::Create(mainSwitch);
				mst2.position() = "(220,100)";

		//create switches and its terminals
				Switch switch1 = Switch::Create(doubleBulbLamp, Lamp::meta_FunctionSwitch);
				switch1.position() = "(300,250)";
				switch1.name() = "SW1";
				ElectricTerminal s1t1 = ElectricTerminal::Create(switch1);
				s1t1.position() = "(20,100)";
				ElectricTerminal s1t2 = ElectricTerminal::Create(switch1);
				s1t2.position() = "(220,100)";

				Switch switch2 = Switch::Create(doubleBulbLamp, Lamp::meta_FunctionSwitch);
				switch2.position() = "(300,250)";
				switch2.name() = "SW 2";
				ElectricTerminal s2t1 = ElectricTerminal::Create(switch2);
				s2t1.position() = "(20,100)";
				ElectricTerminal s2t2 = ElectricTerminal::Create(switch2);
				s2t2.position() = "(220,100)";


				Switch switch3 = Switch::Create(doubleBulbLamp, Lamp::meta_FunctionSwitch);
				switch3.position() = "(300,250)";
				switch3.name() = "Halogen switch";
				ElectricTerminal s3t1 = ElectricTerminal::Create(switch3);
				s3t1.position() = "(20,100)";
				ElectricTerminal s3t2 = ElectricTerminal::Create(switch3);
				s3t2.position() = "(220,100)";


			

	// Create bulbs with terminals
				Bulb bulb1	= Bulb::Create(doubleBulbLamp); 
				bulb1.name() = "Bulb1";
				bulb1.position() = "(100,150)";

				ElectricTerminal b1t1 = ElectricTerminal::Create(bulb1);
				b1t1.position() = "(220,100)";
				ElectricTerminal b1t2 = ElectricTerminal::Create(bulb1);
				b1t2.position() = "(220,200)";

				Bulb bulb2	= Bulb::Create(doubleBulbLamp); 
				bulb2.name() = "Bulb2";
				bulb2.position() = "(100,150)";
				ElectricTerminal b2t1 = ElectricTerminal::Create(bulb2);
				b2t1.position() = "(220,100)";
				ElectricTerminal b2t2 = ElectricTerminal::Create(bulb2);
				b2t2.position() = "(220,200)";
	
	//test inherited parentroles & childroles

				HalogenBulb bulb3 = HalogenBulb::Create(doubleBulbLamp, Lamp::meta_Bulb_children);
				bulb3.name() = "HalogenBulb3";
				bulb3.position() = "(100, 150)";
				ElectricTerminal b3t1 = ElectricTerminal::Create(bulb3, HalogenBulb::meta_ElectricTerminal_children);
				b3t1.position() = "(320,100)";
				ElectricTerminal b3t2 = ElectricTerminal::Create(bulb3);
				b3t2.position() = "(320,200)";
//.........这里部分代码省略.........
开发者ID:ksmyth,项目名称:UDM,代码行数:101,代码来源:genericTest.cpp


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