Esempio n. 1
0
bool CSimpleXml::AddNodes(const string &strPath, list<XMLNODEINFO> &lstaddnode)
{
    if(m_pDoc == NULL || m_pRoot == NULL)
    {
        return false;
    }
    TiXmlElement *pCurrNode = m_pRoot;

    list<string> lstNode;
    SeperateString(lstNode, strPath, "/");

    list<string>::iterator itlstNode = lstNode.begin();

    while (NULL != pCurrNode)
    {
        if (itlstNode != lstNode.end() && *itlstNode == pCurrNode->Value())
        {
            string strShow = pCurrNode->Value();
            if (++itlstNode == lstNode.end())
            {
                AddOneNode(&pCurrNode, lstaddnode);
                goto SIMXML;
            }
            pCurrNode = pCurrNode->FirstChildElement();
        }
        else
        {
            pCurrNode = pCurrNode->NextSiblingElement();
        }
    }
    return false;

    SIMXML:

    TiXmlPrinter printer;

    char szBuf[32];
    memset(szBuf, 0, 32);
    szBuf[0] = 0x9;
    printer.SetIndent(szBuf);
    szBuf[0] = 0x0a;
    printer.SetLineBreak(szBuf);
    if(m_pDoc->Accept(&printer))
    {
        m_strXml = printer.CStr();
    }
    else
    {
        return false;
    }
    return true;
}
Esempio n. 2
0
HRESULT KG3DTerrainRoad::LoadNode(DWORD dwNumOfNode,D3DXVECTOR3* pNodePos)
{
	HRESULT hr = E_FAIL;
	for(DWORD i = 0; i< dwNumOfNode; i++)
	{
		KG3DRepresentObjectNode* pNode = NULL;		
		KG3DSceneSceneEditor* pEditor= NULL;
		KG3DScene* pScene = g_cGraphicsTool.GetCurScene();
		KG_PROCESS_ERROR(pScene);
		pEditor = static_cast<KG3DSceneSceneEditor*>(pScene);
		pEditor->AddNodeToScene(&pNode,&(pNodePos[i]),&D3DXVECTOR3(m_fNodeSize,m_fNodeSize,m_fNodeSize));
		/*pNode->SetTranslation(&(pNodePos[i]));
		pNode->SetScaling(&D3DXVECTOR3(m_fNodeSize,m_fNodeSize,m_fNodeSize));*/
		pNode->SetNodeType(NODETYPE_ROAD);
		pNode->SetPointer((PVOID)this);
		AddOneNode(pNode,pNodePos[i]);
	}
	hr = S_OK;
Exit0:
	return hr;
}