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


C++ Parm::get_geom方法代码示例

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


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

示例1: ReadPHolderListDES

void PHolderListMgr::ReadPHolderListDES( char *newfile )
{
	FILE *fp;
	fp = fopen( newfile, "r" );
	char temp[255];

	fgets( temp, 255, fp );
	Stringc line = temp;
	int nparm = line.convert_to_integer();

	if( nparm > 0 )
	{
		pHolderListMgrPtr->DelAllPHolders();

		vector< Geom* > gVec = aircraftPtr->getGeomVec();
		gVec.push_back( aircraftPtr->getUserGeom() );


		for ( int i = 0 ; i < nparm ; i++ )
		{
			fgets( temp, 255, fp );
			line = temp;

			int istart = 0;
			int iend = line.search_for_substring(':');
			int id = line.get_range( istart, iend-1 ).convert_to_integer();

			istart = iend + 1;
			iend = line.search_for_substring( istart, ':' );
			istart = iend + 1;
			iend = line.search_for_substring( istart, ':' );
			Stringc group = line.get_range( istart, iend-1 );

			istart = iend + 1;
			iend = line.search_for_substring( istart, ':' );
			Stringc parm = line.get_range( istart, iend-1 );

			istart = iend + 1;
			iend = line.get_length();
			double val = line.get_range( istart, iend-1 ).convert_to_double();

			Parm* p = parmMgrPtr->FindParm( gVec, id, group, parm );

			if ( p )
			{
				p->set_from_link( val );
				p->get_geom()->parm_changed( p );

				ParmHolder* ph = new ParmHolder();
				ph->setParm( p );

				m_PHolderVec.push_back( ph );
				m_CurrPHolderIndex = (int)m_PHolderVec.size() - 1;
			}
		}
	}
	fclose( fp );
}
开发者ID:Phoenix-Integration,项目名称:OpenVSP,代码行数:58,代码来源:parmLinkMgr.cpp

示例2: ReadPHolderListXDDM

void PHolderListMgr::ReadPHolderListXDDM( char *newfile )
{
	pHolderListMgrPtr->DelAllPHolders();

	//==== Read Xml File ====//
	xmlDocPtr doc;
	xmlNodePtr node;

	LIBXML_TEST_VERSION
	xmlKeepBlanksDefault(0);

	//==== Build an XML tree from a the file ====//
	doc = xmlParseFile(newfile);
//			if (doc == NULL) return 0;

	xmlNodePtr root = xmlDocGetRootElement(doc);
	if (root == NULL)
	{
		fprintf(stderr,"empty document\n");
		xmlFreeDoc(doc);
//				return 0;
	}

	vector< Geom* > gVec = aircraftPtr->getGeomVec();
	gVec.push_back( aircraftPtr->getUserGeom() );

	vector< xmlNodePtr > vlist;

	int num_v = xmlGetNumNames( root, "Variable" );
	for ( int i = 0 ; i < num_v ; i++ )
	{
		xmlNodePtr var_node = xmlGetNode( root, "Variable", i );
		vlist.push_back( var_node );
	}

	int num_c = xmlGetNumNames( root, "Constant" );
	for ( int i = 0 ; i < num_c ; i++ )
	{
		xmlNodePtr cst_node = xmlGetNode( root, "Constant", i );
		vlist.push_back( cst_node );
	}

	int num_tot = num_v + num_c;

	for ( int i = 0 ; i < num_tot ; i++ )
	{
		xmlNodePtr var_node = vlist[i];

		if ( var_node )
		{
			Stringc varname = Stringc( xmlFindPropString( var_node, "VSPVarName", " " ) );

			int istart = 0;
			int iend = varname.search_for_substring(':');
			int id = varname.get_range( istart, iend-1 ).convert_to_integer();

			istart = iend + 1;
			iend = varname.search_for_substring( istart, ':' );
			istart = iend + 1;
			iend = varname.search_for_substring( istart, ':' );
			Stringc group = varname.get_range( istart, iend-1 );

			istart = iend + 1;
			iend = varname.get_length();
			Stringc parm = varname.get_range( istart, iend-1 );

			Parm* p = parmMgrPtr->FindParm( gVec, id, group, parm );

			if ( p )
			{
				double val = xmlFindPropDouble( var_node, "Value", p->get() );

				p->set_from_link( val );
				p->get_geom()->parm_changed( p );

				ParmHolder* ph = new ParmHolder();
				ph->setParm( p );

				const xmlChar* varstr = (xmlChar*) "Variable";

				if( !xmlStrcmp(var_node->name, varstr ) )
					ph->setDesType( XDDM_VAR );
				else
					ph->setDesType( XDDM_CONST );

				m_PHolderVec.push_back( ph );
				m_CurrPHolderIndex = (int)m_PHolderVec.size() - 1;
			}
		}
	}

	//===== Free Doc =====//
	xmlFreeDoc( doc );

//			return 1;
}
开发者ID:Phoenix-Integration,项目名称:OpenVSP,代码行数:96,代码来源:parmLinkMgr.cpp


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