コード例 #1
0
ファイル: ShootManagerSys.cpp プロジェクト: RaoMiao/freestyle
void CShootManagerSys::LoadShootSolutionSector(int iSector, LPCTSTR szFilename)
{
	if(iSector >= m_ShootSolutionSectorArray.Num())		return;
	
	int i;
	MSXML2::IXMLDOMDocument2Ptr pDoc;
	pDoc.CreateInstance(__uuidof(DOMDocument40));
	pDoc->load((_variant_t)szFilename);
	
	
	// 성공한 슛부터 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListSuccess = pDoc->selectNodes(L"root/success");
	for(i=0; i<pNodeListSuccess->Getlength(); i++)
	{
		MSXML2::IXMLDOMNodePtr pNodeSuccess = pNodeListSuccess->Getitem(i);
		
		CShootSolution Solution;
		Solution.Create(pNodeSuccess, true, this);
		m_ShootSolutionSectorArray[iSector].first.push_back(Solution);
	}

	MSXML2::IXMLDOMNodeListPtr pNodeListFail = pDoc->selectNodes(L"root/fail");
	for(i=0; i<pNodeListFail->Getlength(); i++)
	{
		MSXML2::IXMLDOMNodePtr pNodeFail = pNodeListFail->Getitem(i);

		CShootSolution Solution;
		Solution.Create(pNodeFail, false, this);
		m_ShootSolutionSectorArray[iSector].second.push_back(Solution);
	}

	pDoc.Release();			
}
コード例 #2
0
void CWordManager::WordEditorInsertActiveElement(void)
{
	CElementManager & em = ((CReportAsistentApp *) AfxGetApp())->m_pGeneralManager->ElementManager;
	LPCTSTR strElementName = getLastElementName();

	//load element
	int element_index = em.ElementIdFromName(strElementName);
	MSXML2::IXMLDOMElementPtr active_element = 
		em.CreateEmptyElement(element_index);

	
	//load document
	MSXML2::IXMLDOMDocument2Ptr doc;
	doc.CreateInstance(_T("Msxml2.DOMDocument"));
	em.LoadSkeletonDTD((MSXML2::IXMLDOMDocumentPtr &) doc);
	
	//insert element to chapter and document
	doc->documentElement->
		appendChild(em.CreateEmptyElement(ELID_CHAPTER))->
			appendChild(active_element);


	//configure by dialog
	if (CSkeletonDoc::EditActiveElement(active_element))
	{
		//transform and generate
		CAElTransform transform(active_element);

		transform.DoAllTransnformations();

#ifdef _DEBUG
		MSXML2::IXMLDOMParseErrorPtr err = doc->validate();

		if (err->errorCode != S_OK)
		{
			AfxMessageBox(err->reason);
			AfxMessageBox(active_element->selectSingleNode("output")->xml);
		}
#endif
	
		GenerateXMLStringToWordEditor(active_element->xml);
	}

	
	
	active_element.Release();
	doc.Release();
}
コード例 #3
0
ファイル: ShootManagerSys.cpp プロジェクト: RaoMiao/freestyle
void CShootManagerSys::LoadShootSolutionSet(LPCTSTR szFilename)
{
	int i;
	MSXML2::IXMLDOMDocument2Ptr pDoc;
	pDoc.CreateInstance(__uuidof(DOMDocument40));
	pDoc->load((_variant_t)szFilename);


	// 시뮬레이터에서 사용하는 거리 범위들을 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListDistance;
	MSXML2::IXMLDOMNodePtr pNodeDistance;
	float fDistance;
	pNodeListDistance = pDoc->selectNodes(L"root/distance_range/distance");
	for(i=0; i<pNodeListDistance->Getlength(); i++)
	{
		pNodeDistance = pNodeListDistance->Getitem(i);
		_bstr_t distance = pNodeDistance->GetnodeTypedValue();
		sscanf((LPCTSTR)distance, "%f", &fDistance);
		m_DistanceList.push_back(fDistance);
	}

	
	// 시뮬레이터에서 사용하는 각도 범위들을 로드한다.
	// 여기서 각도는 (골대 - 슈터) 와 양의 z 축 사이의 각도를 말한다.
	// degree 로 저장되어 있으므로 Angle 로 변환시킨다.
	MSXML2::IXMLDOMNodeListPtr pNodeListAngle;
	MSXML2::IXMLDOMNodePtr pNodeAngle;
	float fDegree;
	int iAngle;
	pNodeListAngle = pDoc->selectNodes(L"root/angle_range/degree");
	for(i=0; i<pNodeListAngle->Getlength(); i++)
	{
		pNodeAngle = pNodeListAngle->Getitem(i);
		_bstr_t degree = pNodeAngle->GetnodeTypedValue();
		sscanf((LPCTSTR)degree, "%f", &fDegree);
		iAngle = Degree2Angle(fDegree);					// degree 에서 Angle 로 변환한다.
		m_AngleList.push_back(iAngle);
	}

	// 전체 섹터 개수를 계산하고 여기에 맞게 메모리를 생성한다.
	int iNumSector = m_DistanceList.size() * (m_AngleList.size() + 1) + 6;
	for(i=0; i<iNumSector; i++)
	{
		ShootSolutionSector *pShootSolutionSector = new (m_ShootSolutionSectorArray) ShootSolutionSector;
	}

	// 각 섹터별로 섹터안의 Shoot Solution 들을 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListSector = pDoc->selectNodes(L"root/sector");
	MSXML2::IXMLDOMNodePtr pNodeSector;
	MSXML2::IXMLDOMNodePtr pNodeIndex;
	MSXML2::IXMLDOMNodePtr pNodePath;
	for(i=0; i<pNodeListSector->Getlength(); i++)
	{
		pNodeSector = pNodeListSector->Getitem(i);
		pNodeIndex = pNodeSector->selectSingleNode(L"index");
		pNodePath = pNodeSector->selectSingleNode(L"path");
		_bstr_t index = pNodeIndex->GetnodeTypedValue();
		_bstr_t path = pNodePath->GetnodeTypedValue();

		int iIndex = atoi((LPCTSTR)index);
		SString sFilePath = szFilename;
		sFilePath = DGetPathOnly(sFilePath);
		sFilePath += "\\";
		sFilePath += (LPCTSTR)path;
//		sFilePath.Format("%s\\%s\\%s", g_szCurrentPath, g_szSimulatorPath, (LPCTSTR)path);

		LoadShootSolutionSector(iIndex, (LPCTSTR)sFilePath);
	}

	pDoc.Release();		
}