예제 #1
0
TFfGGen::TStopReason TFfGGen::GenGraph(const int& GraphNodes, PGStatVec& EvolStat, const bool& FloodStop) {
	int GrowthStatNodes = 100;
	Graph = PNGraph::New();
	AddNodes(StartNodes);
	TStopReason SR = srUndef;
	while (Graph->GetNodes() < GraphNodes) {
		SR = AddNodes(GrowthStatNodes, FloodStop);
		if (SR != srOk) { return SR; }
		EvolStat->Add(Graph, TSecTm(Graph->GetNodes()));
		GrowthStatNodes = int(1.5*GrowthStatNodes);
	}
	return SR;
}
예제 #2
0
DTVDeviceConfigGroup::DTVDeviceConfigGroup(
    DiSEqCDevSettings &settings, uint cardid, bool switches_enabled) :
    VerticalConfigurationGroup(false, false, true, true),
    m_settings(settings), m_switches_enabled(switches_enabled)
{
    setLabel(DeviceTree::tr("DTV Device Configuration"));

    // load
    m_tree.Load(cardid);

    // initial UI setup
    AddNodes(this, QString::null, m_tree.Root());
}
void IntersectionNodesInAirport::CaculateIntersectionNodes( ALTObjectList objList )
{
	m_vNodeList.clear();
	for(int i=0 ; i< (int) objList.size();i ++)
	{
		for(int j=i +1; j  < (int)objList.size();j++)
		{
			ALTObject * pobj1 = objList.at(i).get();
			ALTObject * pobj2 = objList.at(j).get();
			std::vector<IntersectionNode> reslts;
			GetIntersectionNodes(pobj1,pobj2,reslts);
			AddNodes(reslts);
		}
	}
}
void IncrementalQuoteGraph::UpdateGraph(PNGraph& QGraph) {
  AddNodes();
  CreateEdges();
  QGraph = this->QGraph;
}
예제 #5
0
TFfGGen::TStopReason TFfGGen::GenGraph(const int& GraphNodes, const bool& FloodStop) {
	Graph = PNGraph::New();
	return AddNodes(GraphNodes, FloodStop);
}
std::vector<int> IntersectionNodesInAirport::ReflectChangeOf( ALTObjectList changObjs,ALTObjectList objList )
{	
	
	IntersectionNodeList vOldNodes = m_vNodeList;

	std::vector<int> vChangeNodeIndexs;
	IntersectionNodeList newNodeList;		
	ALTObjectUIDList changeObjIDs = GetObjectUIDList(changObjs);

	for(int i=0;i <(int)m_vNodeList.size();i++)
	{
		IntersectionNode& theNode = m_vNodeList[i];

		bool bChanged = theNode.HasObjectIn(changeObjIDs);

		for(int j=0;j< (int)changeObjIDs.size();j++)
		{
			int changeOjbID = changeObjIDs.at(j);
			theNode.RemoveObjectItem(changeOjbID);
		}
		if(theNode.IsValid())
		{
			newNodeList.push_back(theNode);
			if(bChanged)
				vChangeNodeIndexs.push_back((int)newNodeList.size()-1);
		}
	}
	m_vNodeList = newNodeList;

	//calculate intersection nodes
	for(int i=0;i< (int) changObjs.size();i++)
	{
		ALTObject * pChangObj = changObjs[i].get();
		for(int j=0;j< (int)objList.size();j++)
		{
			ALTObject* OtherObj = objList[j].get();
			if( OtherObj->getID() != pChangObj->getID() )
			{
				std::vector<IntersectionNode> reslts;
				GetIntersectionNodes(pChangObj,OtherObj,reslts);
				AddNodes(reslts);
			}
		}

	}
	
	for(int i=0;i< (int)m_vNodeList.size();i++)
	{
		IntersectionNode& theNode = m_vNodeList[i];
		if(theNode.HasObjectIn(changeObjIDs))
		{
			if( vChangeNodeIndexs.end()== std::find(vChangeNodeIndexs.begin(), vChangeNodeIndexs.end(), i) )
			{
				vChangeNodeIndexs.push_back(i);
			}
		}
	}
	
	UpdateNodesIdx(*this, vChangeNodeIndexs);
	UpdateNodesName(*this, vChangeNodeIndexs);
	//
	for(int i=0;i< (int)m_vNodeList.size();i++)
	{
		IntersectionNode& theNewNode = m_vNodeList[i];
		for(int j=0;j<(int)vOldNodes.size();j++)
		{
			IntersectionNode& theOldNode = vOldNodes[j];
			if( theNewNode.GetID() == theOldNode.GetID()|| theNewNode.IsIdentical(theOldNode) )
			{
				theNewNode.SetID(theOldNode.GetID());
				vOldNodes.erase( vOldNodes.begin() + j);
				break;
			}
		}
	}
	for(int i=0;i< (int)vOldNodes.size();i++)
	{		
		IntersectionNode& theOldNode = vOldNodes[i];
		theOldNode.DeleteData();
	}
	UpdateDataToDB(m_nAirportID, vChangeNodeIndexs);

	return vChangeNodeIndexs;
}
예제 #7
0
void DTVDeviceConfigGroup::AddNodes(
    ConfigurationGroup *group, const QString &trigger, DiSEqCDevDevice *node)
{
    if (!node)
        return;

    Setting *setting = NULL;
    switch (node->GetDeviceType())
    {
        case DiSEqCDevDevice::kTypeSwitch:
            setting = new SwitchSetting(*node, m_settings);
            setting->setEnabled(m_switches_enabled);
            break;
        case DiSEqCDevDevice::kTypeRotor:
        {
            DiSEqCDevRotor *rotor = dynamic_cast<DiSEqCDevRotor*>(node);
            if (rotor && (rotor->GetType() == DiSEqCDevRotor::kTypeDiSEqC_1_2))
                setting = new RotorSetting(*node, m_settings);
            else
                setting = new USALSRotorSetting(*node, m_settings);
            break;
        }
        default:
            break;
    }

    if (!setting)
    {
        AddChild(group, trigger, new TransLabelSetting());
        return;
    }

    m_devs[node->GetDeviceID()] = setting;

    uint num_ch = node->GetChildCount();
    if (DiSEqCDevDevice::kTypeSwitch == node->GetDeviceType())
    {
        bool useframe = (node != m_tree.Root());
        bool zerospace = !useframe;
        TriggeredConfigurationGroup *cgrp = new TriggeredConfigurationGroup(
            false, useframe, true, true, false, false, true, zerospace);

        cgrp->addChild(setting);
        cgrp->setTrigger(setting);

        for (uint i = 0; i < num_ch; i++)
            AddNodes(cgrp, QString::number(i), node->GetChild(i));

        AddChild(group, trigger, cgrp);
        return;
    }

    if (!num_ch)
    {
        AddChild(group, trigger, setting);
        return;
    }

    VerticalConfigurationGroup *cgrp =
        new VerticalConfigurationGroup(false, false, true, true);

    AddChild(cgrp, QString::null, setting);
    for (uint i = 0; i < num_ch; i++)
        AddNodes(cgrp, QString::null, node->GetChild(i));

    AddChild(group, trigger, cgrp);
}