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


C++ Parm类代码示例

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


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

示例1: sort

//==== Load Parm Vec, Find Groups And Sort ====//
void ParmContainer::LoadGroupParmVec( vector< string > & parm_vec, bool displaynames )
{
    m_GroupNames.clear();
    m_GroupParmMap.clear();

    //==== Map Parms To Group Names ====//
    for ( int i = 0 ; i < ( int )parm_vec.size() ; i++ )
    {
        string pid = parm_vec[i];
        Parm* p = ParmMgr.FindParm( pid );
        if ( p )
        {
            string group_name;
            if( displaynames )
            {
                group_name = p->GetDisplayGroupName();
            }
            else
            {
                group_name = p->GetGroupName();
            }

            m_GroupParmMap[group_name].push_back( pid );
        }
    }

    map< string, vector< string > >::iterator iter;
    for ( iter = m_GroupParmMap.begin() ; iter != m_GroupParmMap.end() ; iter++ )
    {
        m_GroupNames.push_back( iter->first );
        sort( iter->second.begin(), iter->second.end(), ParmNameCompare );
    }
}
开发者ID:aeromedia,项目名称:OpenVSP,代码行数:34,代码来源:ParmContainer.cpp

示例2: Link

//==== Add New Link ====//
bool LinkMgrSingleton::AddLink( const string& pidA, const string& pidB )
{
    //==== Make Sure Parm Are Not Already Linked ====//
    for ( int i = 0 ; i < ( int )m_LinkVec.size() ; i++ )
    {
        if ( m_LinkVec[i]->GetParmA() == pidA && m_LinkVec[i]->GetParmB() == pidB  )
        {
            return false;
        }
    }

    //==== Check If ParmIDs Are Valid ====//
    Parm* pA = ParmMgr.FindParm( pidA );
    Parm* pB = ParmMgr.FindParm( pidB );

    if ( pA == NULL || pB == NULL )
    {
        return false;
    }

    Link* pl = new Link();

    pl->SetParmA( pidA );
    pl->SetParmB( pidB );
    pl->SetOffsetFlag( true );
    pl->m_Offset.Set( pB->Get() - pA->Get() );
    pl->SetScaleFlag( false );
    pl->m_Scale.Set( 1.0 );

    m_LinkVec.push_back( pl );
    m_CurrLinkIndex = ( int )m_LinkVec.size() - 1;

    return true;
}
开发者ID:sanbales,项目名称:OpenVSP,代码行数:35,代码来源:LinkMgr.cpp

示例3: xmlNewChild

//==== Encode Data Into XML Data Struct ====//
xmlNodePtr ParmContainer::EncodeXml( xmlNodePtr & node )
{
    xmlNodePtr parmcontain_node = xmlNewChild( node, NULL, BAD_CAST "ParmContainer", NULL );
    if ( parmcontain_node )
    {
        XmlUtil::AddStringNode( parmcontain_node, "ID", m_ID );
        XmlUtil::AddStringNode( parmcontain_node, "Name", m_Name );
    }

    xmlNodePtr gnode;

    LoadGroupParmVec( m_ParmVec, false );

    map< string, vector< string > >::iterator groupIter;
    for ( groupIter = m_GroupParmMap.begin() ; groupIter != m_GroupParmMap.end() ; groupIter++ )
    {
        string name = groupIter->first;
        gnode = xmlNewChild( parmcontain_node, NULL, BAD_CAST name.c_str(), NULL );

        if ( gnode )
        {
            vector< string >::iterator parmIter;
            for ( parmIter = groupIter->second.begin(); parmIter != groupIter->second.end(); parmIter++ )
            {
                Parm* p = ParmMgr.FindParm( ( *parmIter ) );
                p->EncodeXml( gnode );
            }
        }
    }

    return parmcontain_node;
}
开发者ID:aeromedia,项目名称:OpenVSP,代码行数:33,代码来源:ParmContainer.cpp

示例4: LoadAllParms

void ParmLinkMgr::LoadAllParms()
{
	//==== Clear All Existing Parms ====//
	map< GeomBase*, map< string, vector< Parm* > > >::iterator g;
	map< string, vector<Parm*> >::iterator itr;
	for ( g = m_ParmMap.begin() ; g != m_ParmMap.end() ; g++ )
	{
		for ( itr = g->second.begin() ; itr != g->second.end() ; itr++ )
		{
			itr->second.clear();
		}
		g->second.clear();
	}
	m_ParmMap.clear();	

	if ( aircraftPtr == NULL )
		return;

	//==== Loop Thru All Geoms ====//
	vector< Geom* > geomVec = aircraftPtr->getGeomVec();
	geomVec.push_back( aircraftPtr->getUserGeom() );
	for ( int i = 0 ; i < (int)geomVec.size() ; i++ )
	{
		vector < Parm* > parmVec;
		geomVec[i]->LoadLinkableParms( parmVec );
		for ( int j = 0 ; j < (int)parmVec.size() ; j++ )
		{
			Parm* p = parmVec[j];
			p->set_linked_flag( false );
			Register( p, p->get_geom_base(), p->get_group_name().get_char_star() );
		}
	}
}
开发者ID:CarltonFraley,项目名称:OpenVSP,代码行数:33,代码来源:parmLinkMgr.cpp

示例5: RebuildAdjustTab

void FitModelScreen::RebuildAdjustTab()
{
    m_FitScrollGroup->clear();
    m_FitVarScrollLayout.SetGroup( m_FitScrollGroup );
    m_FitVarScrollLayout.InitWidthHeightVals();

    m_ParmSliderVec.clear();

    int num_vars = FitModelMgr.GetNumVars();
    m_ParmSliderVec.resize( num_vars );

    string lastContID;

    for ( int i = 0 ; i < num_vars ; i++ )
    {
        string pID = FitModelMgr.GetVar( i );

        Parm* p = ParmMgr.FindParm( pID );

        string contID = p->GetContainerID();

        if ( contID.compare( lastContID ) != 0 )
        {
            lastContID = contID;
            m_FitVarScrollLayout.AddDividerBox( ParmMgr.FindParmContainer( contID )->GetName() );
        }

        m_FitVarScrollLayout.AddSlider( m_ParmSliderVec[i], "AUTO_UPDATE", 10, "%7.3f" );
        m_ParmSliderVec[i].Update( pID );
    }

    m_NVarLast = num_vars;
}
开发者ID:hensomc,项目名称:OpenVSP-1,代码行数:33,代码来源:FitModelScreen.cpp

示例6: BuildLinkableParmData

//==== Get Container Name Vec And Find Match Index For Parm_ID ====//
int LinkMgrSingleton::GetCurrContainerVec( const string& parm_id, vector< string > & idVec )
{
    int index = 0;
    BuildLinkableParmData();

    //==== Find Container ID ====//
    string curr_container_id;
    Parm* p = ParmMgr.FindParm( parm_id );
    if ( p )
    {
        curr_container_id = p->GetLinkContainerID();
    }

    //==== Find Index And Load Container Names ===//
    for ( int i = 0 ; i < ( int )m_LinkableContainers.size() ; i++ )
    {
        if ( m_LinkableContainers[i] == curr_container_id )
        {
            index = i;
        }

        ParmContainer* pc = ParmMgr.FindParmContainer( m_LinkableContainers[i] );

        string name;
        if ( pc )
        {
            name = pc->GetName();
        }

        idVec.push_back( name );
    }

    return index;
}
开发者ID:sanbales,项目名称:OpenVSP,代码行数:35,代码来源:LinkMgr.cpp

示例7: GetParmIDs

//==== Get Vector Parm IDs And Index For Given Parm ID  ====//
int ParmContainer::GetParmIDs( string parm_id, vector< string > & parm_ids )
{
    int index = 0;

    string group_name;
    Parm* p = ParmMgr.FindParm( parm_id );
    if ( p )
    {
        group_name = p->GetDisplayGroupName();
    }

    map< string, vector< string > >::iterator iter = m_GroupParmMap.find( group_name );

    if ( iter == m_GroupParmMap.end() )
    {
        return index;
    }

    for ( int i = 0 ; i < ( int )iter->second.size() ; i++ )
    {
        if ( parm_id == iter->second[i] )
        {
            index = parm_ids.size();
        }

        parm_ids.push_back( iter->second[i] );
    }

    return index;

}
开发者ID:aeromedia,项目名称:OpenVSP,代码行数:32,代码来源:ParmContainer.cpp

示例8: fopen

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

示例9: ParmNameCompare

//==== Name Compare ====//
bool ParmNameCompare( const string a, const string b )
{
    Parm* pA = ParmMgr.FindParm( a );
    Parm* pB = ParmMgr.FindParm( b );

    if ( pA && pB )
    {
        return ( pA->GetName() < pB->GetName() );
    }
    return ( false );
}
开发者ID:aeromedia,项目名称:OpenVSP,代码行数:12,代码来源:ParmContainer.cpp

示例10: SetDisplaySuffix

void SubSurface::SetDisplaySuffix( int num )
{
    for ( int i = 0 ; i < ( int )m_ParmVec.size() ; i++ )
    {
        Parm* p = ParmMgr.FindParm( m_ParmVec[i] );

        if ( p )
        {
            p->SetGroupDisplaySuffix( num );
        }
    }
}
开发者ID:cptdime,项目名称:OpenVSP,代码行数:12,代码来源:SubSurface.cpp

示例11: AddParm

//==== Add User Defined Parm ====//
string UserParmContainer::AddParm(int type, const string & name, const string & group )
{
    Parm* p = ParmMgr.CreateParm( type );
    if ( p )
    {
        p->Init( name, group, this, 0.0, -1.0e6, 1.0e6, true );
        p->SetDescript( "User Parm Descript" );
        m_UserParmVec.push_back( p );
        return p->GetID();
    }
    return string();
}
开发者ID:aeromedia,项目名称:OpenVSP,代码行数:13,代码来源:ParmContainer.cpp

示例12: GetLatestChangeCnt

//==== Get Latest Change Cnt ====//
int ParmContainer::GetLatestChangeCnt()
{
    int cnt = 0;
    for ( int i = 0 ; i < ( int )m_ParmVec.size() ; i++ )
    {
        string pid = m_ParmVec[i];
        Parm* p = ParmMgr.FindParm( pid );
        if ( p && p->GetChangeCnt() > cnt )
        {
            cnt = p->GetChangeCnt();
        }
    }
    return cnt;
}
开发者ID:aeromedia,项目名称:OpenVSP,代码行数:15,代码来源:ParmContainer.cpp

示例13: FindParm

void ParmLinkMgr::SwapGeom( Geom* gOld, Geom* gNew )
{
	for ( int i = 0 ; i < (int)m_ParmLinkVec.size() ; i++ )
	{
		Parm* pA = m_ParmLinkVec[i]->GetParmA();
		if ( pA->get_geom_base() == gOld )
		{
			Stringc group_name = pA->get_group_name();
			Stringc parm_name  = pA->get_name();
			Parm* p = FindParm( gNew, group_name, parm_name );
			if ( p )
				m_ParmLinkVec[i]->SetParmA( p );
		}
		Parm* pB = m_ParmLinkVec[i]->GetParmB();
		if ( pB->get_geom_base() == gOld )
		{
			Stringc group_name = pB->get_group_name();
			Stringc parm_name  = pB->get_name();
			Parm* p = FindParm( gNew, group_name, parm_name );
			if ( p )
				m_ParmLinkVec[i]->SetParmB( p );
		}
		m_ParmLinkVec[i]->GetParmA()->set_linked_flag( true );
		m_ParmLinkVec[i]->GetParmB()->set_linked_flag( true );
	}
}
开发者ID:CarltonFraley,项目名称:OpenVSP,代码行数:26,代码来源:parmLinkMgr.cpp

示例14: GetNumUserParms

string LinkMgrSingleton::AddUserParm(int type, const string & name, const string & group )
{
    //==== Check For Duplicate ====//
    int num_parms =  GetNumUserParms() - GetNumPredefinedUserParms();
    for ( int i = 0 ; i < num_parms ; i++ )
    {
        string pid = LinkMgr.GetUserParmId( i +  GetNumPredefinedUserParms() );
        Parm* pptr = ParmMgr.FindParm( pid );
        if ( pptr && pptr->GetName() == name && pptr->GetGroupName() == group )
        {
            return string();
        }
    }
    return m_UserParms.AddParm( type, name, group );
 }
开发者ID:sanbales,项目名称:OpenVSP,代码行数:15,代码来源:LinkMgr.cpp

示例15: Renew

//==== Decode Data From XML Data Struct ====//
xmlNodePtr UserParmContainer::DecodeXml( xmlNodePtr & node )
{
    int num_curr_custom = m_UserParmVec.size() - m_NumPredefined;

    xmlNodePtr child_node = XmlUtil::GetNode( node, "UserParmContainer", 0 );
    if ( child_node )
    {
        int num_user = XmlUtil::FindInt( child_node, "NumUserParms", 0 );

        //==== Decode All User Parms ====//
        if ( num_curr_custom == 0 )
        {
            Renew( num_user );
            for ( int i = 0; i < static_cast<int>( m_UserParmVec.size() ); i++ )
            {
                xmlNodePtr pnode = XmlUtil::GetNode( child_node, "UserParm", i );
                if ( pnode && m_UserParmVec[i] )
                {
                    m_UserParmVec[i]->DecodeXml( pnode, true );
                }
            }
        }
        else
        {
            //==== Decode Predefined ====//
            for ( int i = 0; i < m_NumPredefined ; i++ )
            {
                xmlNodePtr pnode = XmlUtil::GetNode( child_node, "UserParm", i );
                if ( pnode && m_UserParmVec[i] )
                {
                    m_UserParmVec[i]->DecodeXml( pnode, true );
                }
            }
            //==== Append New Custom ====//
            int num_new_custom = num_user - m_NumPredefined;

            for ( int i = 0 ; i < num_new_custom ; i++ )
            {
                xmlNodePtr pnode = XmlUtil::GetNode( child_node, "UserParm", i + m_NumPredefined );
                Parm* p = new Parm();
                p->Init( "Temp", "User_Group", this, 0.0, -1.0e12, 1.0e12 );
                p->DecodeXml( pnode, true );
                m_UserParmVec.push_back( p );
            }
        }
    }
    return child_node;
}
开发者ID:aeromedia,项目名称:OpenVSP,代码行数:49,代码来源:ParmContainer.cpp


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