示例#1
0
int CMyTreeView::GetSelectedDeviceData(int iPos, TagDevice* p_data)
{
    //get region id
    int iRegionID = GetCurrentRegionID();

    //get device description
    CString strDesc;
    CTreeCtrl* p_tree = g_GlobalData.m_tree;
    HTREEITEM hSelectedTreeItem = p_tree->GetSelectedItem();  
    if (!hSelectedTreeItem)
        return -1;

    int iData = p_tree->GetItemData(hSelectedTreeItem);
    if (iData < TREE_ITEMDATA_REGION)
        return -1;

    if (iData == TREE_ITEMDATA_REGION) {
        HTREEITEM hTemp = GetChildNode(hSelectedTreeItem, iPos);
        if (!hTemp)
            return -1;

        strDesc = p_tree->GetItemText(hTemp);
    }

    //find device data
    return findDeviceDataByDescAndRegionId(strDesc.GetBuffer(), 
        iRegionID, p_data);
}
int32 UBTCompositeNode::GetMatchingChildIndex(int32 ActiveInstanceIdx, struct FBTNodeIndex& NodeIdx) const
{
	const int32 OutsideRange = BTSpecialChild::ReturnToParent;
	const int32 UnlimitedRange = Children.Num() - 1;

	// search ends at the same instance level: use execution index to determine branch containing node index
	if (ActiveInstanceIdx == NodeIdx.InstanceIndex)
	{
		// is composite even in range of search?
		if (GetExecutionIndex() > NodeIdx.ExecutionIndex)
		{
			return OutsideRange;
		}

		// find child outside range
		for (int32 i = 0; i < Children.Num(); i++)
		{
			const UBTNode* ChildNode = GetChildNode(i);
			if (ChildNode->GetExecutionIndex() > NodeIdx.ExecutionIndex)
			{
				return i ? (i - 1) : 0;
			}
		}

		return UnlimitedRange;
	}

	// search ends at higher level: allow every node
	// search ends at lower level: outside allowed range
	return (ActiveInstanceIdx > NodeIdx.InstanceIndex) ? UnlimitedRange : OutsideRange;
}
示例#3
0
int CMyTreeView::GetSelectedOpPointData(int iPos, TagOpPoint* p_data)
{
    //get device id
    int iDeviceID = GetCurrentDeviceID();

    //get operation description
    CString strDesc;
    CTreeCtrl* p_tree = g_GlobalData.m_tree;
    HTREEITEM hSelectedTreeItem = p_tree->GetSelectedItem();  
    if (!hSelectedTreeItem)
        return -1;

    int iData = p_tree->GetItemData(hSelectedTreeItem);
    if (iData < TREE_ITEMDATA_DEVICE)
        return -1;

    if (iData == TREE_ITEMDATA_DEVICE) {
        HTREEITEM hTemp = GetChildNode(hSelectedTreeItem, iPos);
        if (!hTemp)
            return -1;

        strDesc = p_tree->GetItemText(hTemp);
    }
    else if (iData == TREE_ITEMDATA_OPOPINT) 
        strDesc = p_tree->GetItemText(hSelectedTreeItem);

    //find op data

    return findOpPointDataByDescAndDeviceId(strDesc.GetBuffer(), 
        iDeviceID, p_data);
}
bool THISCLASS::ReadComponents(SwisTrackCore *stc) {
	SwisTrackCoreEditor stce(stc);
	if (! stce.IsEditable()) {
		return false;
	}

	// Read the component list
	SelectRootNode();
	stce.ConfigurationReadXML(GetChildNode(wxT("components")), &mErrorList);
	return true;
}
示例#5
0
void MkWindowBaseNode::Update(double currTime)
{
	// tooltip 상태 갱신
	if (ChildExist(ToolTipName))
	{
		MkSceneNode* tooltipNode = GetChildNode(ToolTipName);
		if (tooltipNode != NULL)
		{
			tooltipNode->SetVisible(m_CursorInside);
		}
	}

	MkWindowThemedNode::Update(currTime);
}
// Recursively set so we don't have to recursively check.
void plMaxNodeBase::SetItinerant(hsBool b)
{ 
    const char* dbgNodeName = GetName();

    if( !CanConvert() )
        return;

    GetMD; 
    pMD->SetItinerant(b);           

    int i;
    for( i = 0; i < NumChildren(); i++ )
    {
        ((plMaxNodeBase*)GetChildNode(i))->SetItinerant(b);
    }
}
void MkCheckBoxControlNode::SaveObject(MkDataNode& node) const
{
	MkWindowBaseNode::SaveObject(node);

	// caption
	if (ChildExist(CaptionNodeName))
	{
		const MkWindowTagNode* captionNode = dynamic_cast<const MkWindowTagNode*>(GetChildNode(CaptionNodeName));
		if (captionNode != NULL)
		{
			node.CreateUnitEx(ObjKey_CaptionTextName, captionNode->GetTextName());
			node.SetData(ObjKey_CaptionString, m_CaptionString, 0);
		}
	}

	// check
	node.SetData(ObjKey_OnCheck, m_OnCheck, 0);
}
示例#8
0
文件: skin.cpp 项目: dpaladin/openbor
HRESULT CSkin::Create(CHAR* szXmlFile)
{
	if (CXmlDocument::Load(szXmlFile)<0)
	{
		OutputDebugString("\nUnable to load xml file.\n");
		return E_FAIL;
	}

	XmlNode xnNode = GetNextNode(XML_ROOT_NODE);
	while (xnNode>0)
	{
		CHAR* szCurrentTag = GetNodeTag(xnNode);

		if ( !strcmpi(szCurrentTag,"mode") )
		{
			CMode* pNewMode = new CMode;
			if (SUCCEEDED(pNewMode->Create(this,xnNode)))
			{
				OutputDebugString("Enumerated mode: ");
				OutputDebugString(pNewMode->ToString().c_str());
				OutputDebugString("\n");

				m_modes[pNewMode->ToString()] = pNewMode;

				XmlNode xnDefaultMode;
				if (xnDefaultMode = GetChildNode(xnNode,"default"))
				{
					if ( !strcmpi(GetNodeText(xnDefaultMode),"true") )
						m_pDefaultMode = pNewMode;
				}

			}
			else
			{
				delete pNewMode;
			}
		}

		xnNode = GetNextNode(xnNode);
	}

	return S_OK;
}
void UBTCompositeNode::NotifyDecoratorsOnFailedActivation(struct FBehaviorTreeSearchData& SearchData, int32 ChildIdx, EBTNodeResult::Type& NodeResult) const
{
	const FBTCompositeChild& ChildInfo = Children[ChildIdx];
	const uint16 ActiveInstanceIdx = SearchData.OwnerComp->GetActiveInstanceIdx();

	for (int32 i = 0; i < ChildInfo.Decorators.Num(); i++)
	{
		const UBTDecorator* DecoratorOb = ChildInfo.Decorators[i];
		DecoratorOb->ConditionalOnNodeProcessed(SearchData, NodeResult);

		if (DecoratorOb->GetFlowAbortMode() == EBTFlowAbortMode::LowerPriority ||
			DecoratorOb->GetFlowAbortMode() == EBTFlowAbortMode::Both)
		{
			SearchData.AddUniqueUpdate(FBehaviorTreeSearchUpdate(DecoratorOb, ActiveInstanceIdx, EBTNodeUpdateMode::Add));
		}
	}

	SearchData.OwnerComp->StoreDebuggerSearchStep(GetChildNode(ChildIdx), ActiveInstanceIdx, NodeResult);
}
示例#10
0
// Merges an entire tree hierarchy into our hierarchy.
bool StyleSheetNode::MergeHierarchy(StyleSheetNode* node, int specificity_offset)
{
	// Merge the other node's properties into ours.
	MergeProperties(node->properties, specificity_offset);

	selector = node->selector;
	a = node->a;
	b = node->b;

	for (int i = 0; i < NUM_NODE_TYPES; i++)
	{
		for (NodeMap::iterator iterator = node->children[i].begin(); iterator != node->children[i].end(); iterator++)
		{
			StyleSheetNode* local_node = GetChildNode((*iterator).second->name, (NodeType) i);
			local_node->MergeHierarchy((*iterator).second, specificity_offset);
		}
	}

	return true;
}
void MkCheckBoxControlNode::_SetCaption(const MkArray<MkHashStr>& textNode, const MkStr& caption)
{
	if (textNode.Empty() || (!MK_STATIC_RES.TextNodeExist(textNode)))
	{
		RemoveChildNode(CaptionNodeName);
		m_CaptionString.Clear();
		return;
	}

	// MkWindowTagNode 사용
	MkWindowTagNode* node = NULL;
	if (ChildExist(CaptionNodeName))
	{
		node = dynamic_cast<MkWindowTagNode*>(GetChildNode(CaptionNodeName));
	}
	else
	{
		node = MkWindowTagNode::CreateChildNode(this, CaptionNodeName);
		if (node != NULL)
		{
			node->SetAlignmentPivotIsWindowRect(true);
			node->SetAlignmentPosition(eRAP_RMostCenter);
			node->SetAlignmentOffset(MkFloat2(node->GetLengthOfBetweenIconAndText(), 0.f));
		}
	}

	if (node != NULL)
	{
		m_CaptionString = caption;
		if (caption.Empty())
		{
			node->SetTextName(textNode);
		}
		else
		{
			node->SetTextName(textNode, caption);
		}
	}
}
示例#12
0
bool MkWindowThemedNode::_UpdateThemeComponent(void)
{
	m_UpdateCommand.Set(eUC_Region); // theme, component, shadow가 변경되면 region도 갱신되야 함

	const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(m_ThemeName, m_ComponentType, m_CustomFormName);
	if ((formData != NULL) && formData->AttachForm(this))
	{
		if (m_UseShadow)
		{
			if (ChildExist(ShadowNodeName))
			{
				MkWindowThemedNode* shadowNode = dynamic_cast<MkWindowThemedNode*>(GetChildNode(ShadowNodeName));
				if (shadowNode != NULL)
				{
					shadowNode->SetThemeName(m_ThemeName);
				}
			}
			else
			{
				MkWindowThemedNode* shadowNode = CreateChildNode(this, ShadowNodeName);
				if (shadowNode != NULL)
				{
					shadowNode->SetLocalDepth(0.1f); // form panel들과 겹치는 것을 피하기 위해 0.1f만큼 뒤에 위치
					shadowNode->SetThemeName(m_ThemeName);
					shadowNode->SetComponentType(MkWindowThemeData::eCT_ShadowBox);
					shadowNode->SetFormState(MkWindowThemeFormData::eS_Default);
					shadowNode->SetAlignmentTargetIsWindowRect(false); // 자신과 shadow node의 client rect끼리 정렬
					shadowNode->SetAlignmentPosition(eRAP_LeftBottom); // client size를 동일하게 맞출 것이므로 아무거나 상관 없음
				}
			}
		}
		return true;
	}

	MkWindowThemeFormData::RemoveForm(this);
	RemoveChildNode(ShadowNodeName);
	return false;
}
void MkCheckBoxControlNode::_SetCheck(bool onCheck, bool makeEvent)
{
	if (onCheck != m_OnCheck)
	{
		m_OnCheck = onCheck;

		MkWindowThemedNode* node = NULL;
		if (ChildExist(CheckIconName))
		{
			node = dynamic_cast<MkWindowThemedNode*>(GetChildNode(CheckIconName));
		}
		else
		{
			MkWindowThemeData::eComponentType iconCT = MkWindowThemeData::GetSystemIconComponent(m_FrameType, MkWindowThemeData::eIT_CheckMark);
			if (iconCT != MkWindowThemeData::eCT_None)
			{
				node = MkWindowThemedNode::CreateChildNode(this, CheckIconName);
				if (node != NULL)
				{
					node->SetLocalDepth(-0.1f); // check box와 겹치는 것을 피하기 위해 0.1f만큼 앞에 위치
					node->SetThemeName(GetThemeName());
					node->SetComponentType(iconCT);
					node->SetAlignmentPosition(eRAP_MiddleCenter);
				}
			}
		}

		if (node != NULL)
		{
			node->SetVisible(m_OnCheck);
		}

		if (makeEvent)
		{
			StartNodeReportTypeEvent((m_OnCheck) ? ePA_SNE_CheckOn : ePA_SNE_CheckOff, NULL);
		}
	}
}
示例#14
0
int CMyTreeView::GetSelectedRegionData(int iPos, TagRegion* p_data)
{
    CString strDesc;
    CTreeCtrl* p_tree = g_GlobalData.m_tree;
    HTREEITEM hSelectedTreeItem = p_tree->GetSelectedItem();  
    if (!hSelectedTreeItem)
        return -1;

    int iData = p_tree->GetItemData(hSelectedTreeItem);
    if (iData < TREE_ITEMDATA_ROOT)
        return -1;

    if (iData == TREE_ITEMDATA_ROOT) {
        HTREEITEM hTemp = GetChildNode(hSelectedTreeItem, iPos);
        if (!hTemp)
            return -1;

        strDesc = p_tree->GetItemText(hTemp);
    }

    return findDataByDesc(EH_TBL_REGION,
        strDesc.GetBuffer(), p_data);
}
示例#15
0
		void MapRequest::setData( const std::string& value )
		{
			_data = value;

			/// @todo Throw an exception if xml parsing fails
			XMLNode dataNode = XMLNode::parseString (_data.c_str (), "data");

			// Fill in local registries

			XMLNode citiesNode = GetChildNode (dataNode, "cities", 0);
			int nbCities = GetChildNodeCount (citiesNode, "city");
			for (int i=0; i<nbCities; ++i)
			{
				XMLNode cityNode = GetChildNode (citiesNode, "city", i);
				_temporaryEnvironment.getEditableRegistry<City>().add (pt::XmlBuilder::CreateCity (cityNode));
			}

			XMLNode connectionPlacesNode = GetChildNode (dataNode, "connectionPlaces", 0);
			int nbConnectionPlaces = GetChildNodeCount (connectionPlacesNode, "connectionPlace");
			for (int i=0; i<nbConnectionPlaces; ++i)
			{
				XMLNode connectionPlaceNode = GetChildNode (connectionPlacesNode, "connectionPlace", i);
				_temporaryEnvironment.getEditableRegistry<StopArea>().add (synthese::pt::XmlBuilder::CreateConnectionPlace (connectionPlaceNode, _temporaryEnvironment.getEditableRegistry<City>()));
			}

			XMLNode physicalStopsNode = GetChildNode (dataNode, "physicalStops", 0);
			int nbPhysicalStops = GetChildNodeCount (physicalStopsNode, "physicalStop");
			for (int i=0; i<nbPhysicalStops; ++i)
			{
				XMLNode physicalStopNode = GetChildNode (physicalStopsNode, "physicalStop", i);
				_temporaryEnvironment.getEditableRegistry<StopPoint>().add (synthese::pt::XmlBuilder::CreatePhysicalStop (physicalStopNode, _temporaryEnvironment.getEditableRegistry<StopArea>()));
			}

			XMLNode commercialLinesNode = GetChildNode (dataNode, "commercialLines", 0);
			int nbCommercialLines = GetChildNodeCount (commercialLinesNode, "commercialLine");
			for (int i=0; i<nbCommercialLines; ++i)
			{
				XMLNode commercialLineNode = GetChildNode (commercialLinesNode, "commercialLine", i);
				_temporaryEnvironment.getEditableRegistry<CommercialLine>().add (synthese::pt::XmlBuilder::CreateCommercialLine (commercialLineNode));
			}

			XMLNode linesNode = GetChildNode (dataNode, "lines", 0);
			int nbLines = GetChildNodeCount (linesNode, "line");
			for (int i=0; i<nbLines; ++i)
			{
				XMLNode lineNode = GetChildNode (linesNode, "line", i);
				_temporaryEnvironment.getEditableRegistry<JourneyPattern>().add(
					pt::XmlBuilder::CreateLine(
						lineNode,
						_temporaryEnvironment.getEditableRegistry<CommercialLine>()
				)	);
			}

			XMLNode lineStopsNode = GetChildNode (dataNode, "lineStops", 0);
			int nbLineStops = GetChildNodeCount (lineStopsNode, "lineStop");
			for (int i=0; i<nbLineStops; ++i)
			{
				XMLNode lineStopNode = GetChildNode (lineStopsNode, "lineStop", i);
				_temporaryEnvironment.getEditableRegistry<LineStop>().add (synthese::pt::XmlBuilder::CreateLineStop (lineStopNode, _temporaryEnvironment.getEditableRegistry<JourneyPattern>(), _temporaryEnvironment.getEditableRegistry<StopPoint>()));
			}
		}
void THISCLASS::WriteComponents(SwisTrackCore *stc) {
	SelectRootNode();
	wxXmlNode *node = GetChildNode(wxT("components"));
	stc->ConfigurationWriteXML(node, &mErrorList);
}
uint16 UBTCompositeNode::GetChildExecutionIndex(int32 Index) const
{
	const UBTNode* ChildNode = GetChildNode(Index);
	return ChildNode ? ChildNode->GetExecutionIndex() : (LastExecutionIndex + 1);
}