bool PropertyElement::IsPropertyElement(MSXML2::IXMLDOMNodePtr  pNode)
{
	MSXML2::IXMLDOMNodePtr pNameElement = pNode->selectSingleNode(bstr_t(L"Name"));
	MSXML2::IXMLDOMNodePtr pValueElement = pNode->selectSingleNode(bstr_t(L"Value"));
	if(pNameElement!=NULL && pValueElement !=NULL)
		return true;
	return false;
}
bool PropertyElement::IsDistributionReferenceProperty(MSXML2::IXMLDOMNodePtr  pNode)
{
	MSXML2::IXMLDOMNodePtr pDistRefElement = pNode->selectSingleNode(bstr_t(L"./DistributionDefinitionReference/DistributionDefinitionIdentifier"));
	if(pDistRefElement !=NULL)
		return true;
	return false;
}
CString CTransformationsDialog::FindOptionEnumItemLabelFromValue(
							MSXML2::IXMLDOMNodePtr & options_node,
							LPCTSTR variable_name,
							LPCTSTR otion_value)
{
	
    CString value_label_query_str;
	value_label_query_str.Format(
		"/visualization/visualization_options/enum_option[@variable_name=\"%s\"]/enum_item[@value = \"%s\"]/@label",
		variable_name, otion_value);

	_bstr_t ret;
	try
	{
		ret = options_node->selectSingleNode((LPCTSTR) value_label_query_str)->text;
	}
	catch (_com_error &)
	{
		CString msg;
		msg.Format("Label for value \"%s\" of enum variable \"%s\" is missing.", otion_value, variable_name);
		throw msg;
	}
	
	return  (LPCTSTR) ret;
}
bstr_t CCMSDIntegrator::GetProperty(MSXML2::IXMLDOMNodePtr pNode,bstr_t PropName, bstr_t defaultVal, bstr_t NodeType)
{
	MSXML2::IXMLDOMNodeListPtr properties = pNode->selectNodes(NodeType);
	for(int j=0; j< properties->length; j++)
	{
		MSXML2::IXMLDOMNodePtr pProp = NULL;					
		properties->get_item(j, &pProp);
		MSXML2::IXMLDOMNodePtr pName = pProp->selectSingleNode(bstr_t(".//Name"));
		MSXML2::IXMLDOMNodePtr pValue = pProp->selectSingleNode(bstr_t(".//Value"));
		bstr_t propName =  (pName!=NULL) ? pName->Gettext() : L"None";
		if( propName == PropName)
		{
			return (pValue!=NULL) ? pValue->Gettext() : defaultVal;
		}
	}
	return defaultVal;
}
Exemplo n.º 5
0
String getChildText(MSXML2::IXMLDOMNodePtr& parent, const String& childNodeName) {
  MSXML2::IXMLDOMNodePtr child = parent->selectSingleNode(childNodeName.c_str());
  if (child == NULL) {
    throw XMLUtils::ParseError();
  }

  return getNodeText(child);
}
MappedValues CCMSDIntegrator::GetNameValueProperties(MSXML2::IXMLDOMNodePtr pNode, bstr_t NodeType)
{
	MappedValues namedvalues;
	MSXML2::IXMLDOMNodeListPtr properties= pNode->selectNodes(NodeType);
	for(int j=0; j< properties->length; j++)
	{
		MSXML2::IXMLDOMNodePtr pProp = NULL;					
		properties->get_item(j, &pProp);
		MSXML2::IXMLDOMNodePtr pName = pProp->selectSingleNode(bstr_t(".//Name"));
		MSXML2::IXMLDOMNodePtr pValue = pProp->selectSingleNode(bstr_t(".//Value"));
		bstr_t propName =  (pName!=NULL) ? pName->Gettext() : L"None";
		bstr_t propValue = (pValue!=NULL) ? pValue->Gettext() :  L"None";
		if( propName != bstr_t(L"None") && propValue != bstr_t(L"None"))
		{
			namedvalues[propName]=propValue;
		}
	}
	return namedvalues;
}
CString CTransformationsDialog::FindOptionEnumItemValueFromLabel(
							MSXML2::IXMLDOMNodePtr & options_node,
							LPCTSTR variable_name,
							LPCTSTR otion_label)
{
	
    CString label_query_str;
	label_query_str.Format(
		"/visualization/visualization_options/enum_option[@variable_name=\"%s\"]/enum_item[@label = \"%s\"]/@value",
		variable_name, otion_label);

	return (LPCTSTR) options_node->selectSingleNode((LPCTSTR) label_query_str)->text;
}
Exemplo n.º 8
0
BOOL CVCAMetaParserMSXML::ParseBBox( MSXML2::IXMLDOMNodePtr pNode, VCA5_RECT *pBbox )
{
	MSXML2::IXMLDOMNodePtr pSubNode;
	CComBSTR bsTag;

	// Bounding Box
	bsTag = CComBSTR( _XML_BB ) += CComBSTR("/") += CComBSTR( _XML_X );
	pSubNode = pNode->selectSingleNode( bsTag.operator BSTR() );
	if( pSubNode )
	{
		VarUI2FromStr( pSubNode->text, LCID_ENGLISH, LOCALE_NOUSEROVERRIDE, (unsigned short *)&pBbox->x );
	}

	bsTag = CComBSTR( _XML_BB ) += CComBSTR("/") += CComBSTR( _XML_Y );
	pSubNode = pNode->selectSingleNode( bsTag.operator BSTR() );
	if( pSubNode )
	{
		VarUI2FromStr( pSubNode->text, LCID_ENGLISH, LOCALE_NOUSEROVERRIDE, (unsigned short *)&pBbox->y );
	}

	bsTag = CComBSTR( _XML_BB ) += CComBSTR("/") += CComBSTR( _XML_W );
	pSubNode = pNode->selectSingleNode( bsTag.operator BSTR() );
	if( pSubNode )
	{
		VarUI2FromStr( pSubNode->text, LCID_ENGLISH, LOCALE_NOUSEROVERRIDE, (unsigned short *)&pBbox->w );
	}

	bsTag = CComBSTR( _XML_BB ) += CComBSTR("/") += CComBSTR( _XML_H );
	pSubNode = pNode->selectSingleNode( bsTag.operator BSTR() );
	if( pSubNode )
	{
		VarUI2FromStr( pSubNode->text, LCID_ENGLISH, LOCALE_NOUSEROVERRIDE, (unsigned short *)&pBbox->h);
	}

	return TRUE;
}
Exemplo n.º 9
0
	void readMesh(dae_reader_t *reader, MSXML2::IXMLDOMNodePtr geometry)
	{
		MSXML2::IXMLDOMNodePtr mesh = geometry->selectSingleNode("r:mesh");
		if (mesh == NULL) return;

		geometry_t object;
		MSXML2::IXMLDOMNamedNodeMapPtr attributes = geometry->attributes;
		if (attributes->length > 0)
			object.name = attributes->getNamedItem("name")->text;

		readVerticesNormalsTexcoords(mesh, object);
		readTriangles(mesh, object);

		object.maxIndex = 0;
		reader->geometry.push_back(object);
	}
Exemplo n.º 10
0
HRESULT PlotWindowOpened::LoadXmlElement(MSXML2::IXMLDOMNodePtr pElement)
{
	CString cs;
	MSXML2::IXMLDOMNodePtr pNode;

	pNode = pElement->selectSingleNode(L"WndName");
	if (pNode != 0)
	{
		cs.Format(_T("%S"),(LPCSTR)pNode->text);
		this->_name = cs;
	}
	else
	{
		this->_name = L"invalid name";
	}

	pNode = pElement->selectSingleNode(L"WndNameIsSet");
	if (pNode != 0)
	{
		if(pNode->text == (_bstr_t)(L"0"))
			this->_bNameIsSet = false;
		else
			this->_bNameIsSet = true;
	}

	pNode = pElement->selectSingleNode(L"WndRectTLX");
	if (pNode == 0)
		goto RET;
	int tlx = atoi((LPCSTR)(pNode->text));

	pNode = pElement->selectSingleNode(L"WndRectTLY");
	if (pNode == 0)
		goto RET;
	int tly = atoi((LPCSTR)(pNode->text));

	pNode = pElement->selectSingleNode(L"WndRectBRX");
	if (pNode == 0)
		goto RET;
	int brx = atoi((LPCSTR)(pNode->text));

	pNode = pElement->selectSingleNode(L"WndRectBRY");
	if (pNode == 0)
		goto RET;
	int bry = atoi((LPCSTR)(pNode->text));

	this->_rect.SetRect(tlx,tly,brx,bry);

RET:
	return S_OK;
}
Exemplo n.º 11
0
	void readTriangles(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
	{
		MSXML2::IXMLDOMNodeListPtr polyLists = mesh->selectNodes("r:polylist"); // blender
		MSXML2::IXMLDOMNodePtr p;

		if (polyLists->length == 0)
			polyLists = mesh->selectNodes("r:triangles"); // 3dsmax

		for (int i = 0; i < polyLists->length; i++)
		{
			MSXML2::IXMLDOMNodePtr polylist = polyLists->item[i];
			MSXML2::IXMLDOMNodePtr p = polylist->selectSingleNode("r:p");
			if (p == NULL) continue;

			geometry.vertexOffset.push_back(-1);
			geometry.normalOffset.push_back(-1);
			geometry.texcoordOffset.push_back(-1);

			MSXML2::IXMLDOMNodeListPtr inputList = polylist->selectNodes("r:input");
			for (int j = 0; j < inputList->length; j++)
			{
				MSXML2::IXMLDOMNodePtr input = inputList->Getitem(j);
				MSXML2::IXMLDOMNamedNodeMapPtr attributes = input->attributes;

				string semantic = (_bstr_t)_wcslwr((wchar_t *)attributes->getNamedItem("semantic")->text);
				int offset = _wtoi(attributes->getNamedItem("offset")->text);

				if (semantic == "vertex")
					geometry.vertexOffset[geometry.vertexOffset.size() - 1] = offset;
				else if (semantic == "normal")
					geometry.normalOffset[geometry.normalOffset.size() - 1] = offset;
				else if (semantic == "texcoord")
					geometry.texcoordOffset[geometry.texcoordOffset.size() - 1] = offset;
			}

			vector<int> v = readValues<int>(p);
			geometry.triangles.push_back(v);
		}
	}
bstr_t CCMSDIntegrator::GetElement(MSXML2::IXMLDOMNodePtr pNode,bstr_t ElementName, bstr_t defaultVal)
{
	MSXML2::IXMLDOMNodePtr pElement = pNode->selectSingleNode(ElementName);
	return (pElement!=NULL) ? pElement->Gettext() : defaultVal;
}
Exemplo n.º 13
0
/******************************************************************************
Function Name  :  nLoadHeader
Input(s)       :  MSXML2::IXMLDOMNodePtr& pHeaderDOMNode
Output         :  INT
Functionality  :  Retrives the Header info 
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
Codetag        :  
******************************************************************************/
INT CTestSetupEntity::nLoadHeader(MSXML2::IXMLDOMNodePtr& pHeaderDOMNode)
{
   // CComPtr<IXMLDOMNode> pHeaderDOMNode;
    MSXML2::IXMLDOMNodeListPtr pXMLDOMInfoList;
    MSXML2::IXMLDOMNodePtr pInfoNode;
    MSXML2::IXMLDOMNodePtr pInfoCategoryNode;
    MSXML2::IXMLDOMNodePtr pInfoValueNode;
    _bstr_t bstrNodeName = "info";
    CComVariant NodeValue;		
    pXMLDOMInfoList = pHeaderDOMNode->selectNodes(bstrNodeName);

    LONG lCount = 0;
    pXMLDOMInfoList->get_length(&lCount);
    SInfo ouTempSInfo;
    for(int i = 0; i<lCount; i++)
    {
        pInfoNode = pXMLDOMInfoList->Getitem(i);

        //bstrNodeName = def_STR_CATEGORY_NODE;
		bstrNodeName.Assign(SysAllocString(CT2W(def_STR_CATEGORY_NODE)));
        pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
        pInfoCategoryNode->get_nodeTypedValue(&NodeValue);		
				
		ouTempSInfo.m_omCategory = strCopyBSTRToCString(NodeValue);
		
        pInfoCategoryNode.Release();
        
        //bstrNodeName = def_STR_VALUE_NODE;
		bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VALUE_NODE)));
        pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
        pInfoCategoryNode->get_nodeTypedValue(&NodeValue);			
		ouTempSInfo.m_omValue = strCopyBSTRToCString(NodeValue);
        pInfoCategoryNode.Release();
        
        pInfoNode.Release();


        if(ouTempSInfo.m_omCategory == def_STR_MODULENAME)
        {
            m_ouTestSetupHeader.m_sModuleName.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sModuleName.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_ENGINEERNAME)
        {
            m_ouTestSetupHeader.m_sEngineerInfo1.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sEngineerInfo1.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_ENGINERROLE)
        {
            m_ouTestSetupHeader.m_sEngineerInfo2.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sEngineerInfo2.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_VERSION)
        {
            m_ouTestSetupHeader.m_sVersion.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sVersion.m_omValue = ouTempSInfo.m_omValue;
        }
    }
//Taking Database
    
    //bstrNodeName = def_STR_LISTOFDB;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_LISTOFDB)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	m_ouTestSetupHeader.m_omDatabasePath = strCopyBSTRToCString(NodeValue);
    //Set The Database Path
    SetDatabaseFile(m_ouTestSetupHeader.m_omDatabasePath);
    pInfoNode.Release();

    //bstrNodeName = def_STR_REPORT_FORMAT;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_FORMAT)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);
	CString omStrExt;	
	omStrExt = strCopyBSTRToCString(NodeValue);
    pInfoNode.Release();

    
    if(omStrExt == "HTM")
    {
        m_ouTestSetupHeader.m_sReportFile.m_eType = HTM;
    }
    else
    {
        m_ouTestSetupHeader.m_sReportFile.m_eType = TXT;
    }

    //bstrNodeName = def_STR_REPORT_PATH;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_PATH)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	m_ouTestSetupHeader.m_sReportFile.m_omPath = strCopyBSTRToCString(NodeValue);
    pInfoNode.Release();
    
    


    //bstrNodeName = def_STR_REPORT_TIMEMODE;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_TIMEMODE)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    if(strTemp == "ABS")
    {
        m_ouTestSetupHeader.m_sReportFile.m_eTimeMode = ABS;
    }
    else                    //Default
    {
        m_ouTestSetupHeader.m_sReportFile.m_eTimeMode = REL;
    }
    pInfoNode.Release();


    //bstrNodeName = def_STR_BUS_TYPE;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_BUS_TYPE)));
    pInfoNode= pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	strTemp = strCopyBSTRToCString(NodeValue);

    if(strTemp == "CAN")
    {
        m_ouTestSetupHeader.m_eBus = CAN;
    }

    pInfoNode.Release();
    
    return 0;
}
Exemplo n.º 14
0
void CQuickConnection::Initial(void)
{
	IXMLDOMDocument2Ptr pConfig;
#ifdef _DEBUG
	CFileSys::ConvertBinaryXML( "script\\QuickConnection.xml","script\\QuickConnection.bml" );
	FILE* fIn;
	if( NULL != (fIn=fopen( "script\\QuickConnection.bml","rb" )))
	{
		CFileSys::LoadBinaryXML( pConfig, fIn );
	}
	fclose( fIn );
#else
	DFileGPack packFile;
	packFile.Open(SFullName("script","QuickConnection.bml"));
	CFileSys::LoadBinaryXML(pConfig, packFile.GetFile(), packFile.GetSize());
	packFile.Close();
#endif

	MSXML2::IXMLDOMNodePtr pNode = NULL;

	if( pNode = pConfig->selectSingleNode( L"./root/quick_mode" ) )
	{
		long nIsQuickMode = pNode->GetnodeTypedValue(); 
		m_nIsQuickMode = nIsQuickMode;
	}

	if( pNode = pConfig->selectSingleNode( L"./root/frame_speed_on" ) )
	{
		long nFrameSpeedOn = pNode->GetnodeTypedValue(); 
	    m_nFrameSpeedOn = nFrameSpeedOn;
	}

	if( pNode = pConfig->selectSingleNode( L"./root/full_court" ) )
	{
		long nFullCourt = pNode->GetnodeTypedValue(); 
	    m_nIsFullCourt = nFullCourt;
	}


	if( pNode = pConfig->selectSingleNode( L"./root/select_host" ) )
	{
		long nIsHost = pNode->GetnodeTypedValue(); // long, short.
		m_nIsHost = nIsHost;
//
	}

	// 중앙 서버의 ip 주소를 얻어 온다. 
	if(pNode = pConfig->selectSingleNode(L"./root/server_option/server_addr"))
	{
		_bstr_t server_addr = pNode->GetnodeTypedValue();
		m_sServerAddr = server_addr;
	}

	// 중앙 서버의 Port 를 얻어 온다. 
	if(pNode = pConfig->selectSingleNode(L"./root/server_option/server_port"))
	{
		long nServerPort = pNode->GetnodeTypedValue();
		m_iServerPort = nServerPort;
	}

	if(pNode = pConfig->selectSingleNode( L"./root/host_config/host_port" ))
	{
		long nHostPort = pNode->GetnodeTypedValue();
		m_nHostPort = nHostPort;
	}
	
	if(pNode = pConfig->selectSingleNode( L"./root/host_config/player_on_player" ))
	{
		long nPlayerOn = pNode->GetnodeTypedValue();
		m_nPlayerOn = nPlayerOn;
	}

	if(pNode = pConfig->selectSingleNode( L"./root/host_config/play_mode" ))
	{
		_bstr_t sPlayMode = pNode->GetnodeTypedValue();
		m_sPlayMode = sPlayMode;

	}


/////
	MSXML2::IXMLDOMNodeListPtr pObjectList = pConfig->selectNodes(L"./root/host_db/character");
	int nObject   = pObjectList->Getlength();
	for( int j = 0; j < nObject; j++ )
	{
		MSXML2::IXMLDOMNodePtr   pNode;
		MSXML2::IXMLDOMNodePtr pObject = pObjectList->Getitem(j);
		pNode = pObject->selectSingleNode(L"./position/x");
		m_vecPos[j].X = pNode->GetnodeTypedValue();
		pNode = pObject->selectSingleNode(L"./position/y");
		m_vecPos[j].Y = pNode->GetnodeTypedValue();
		pNode = pObject->selectSingleNode(L"./position/z");
		m_vecPos[j].Z = pNode->GetnodeTypedValue();
	}
/////
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/connection_addr" ))
	{
		_bstr_t sConnectAddr = pNode->GetnodeTypedValue();
		m_sConnectAddr = sConnectAddr;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/connection_id" ))
	{
		_bstr_t sConnectionId = pNode->GetnodeTypedValue();
		m_sConnectionId = sConnectionId;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/char_id" ))
	{
		long nCharID = pNode->GetnodeTypedValue();
		m_nCharID = nCharID;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/char_type" ))
	{
		long nCharType = pNode->GetnodeTypedValue();
		m_nCharType = nCharType;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/client_port" ))
	{
		long nClientPort = pNode->GetnodeTypedValue();
		m_nClientPort = nClientPort;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/with_ball" ))
	{
		long nWithBall = pNode->GetnodeTypedValue();
		m_nWithBall = nWithBall;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/teamID" ))
	{
		long dwTeamID = pNode->GetnodeTypedValue();
		m_dwTeamID = dwTeamID;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/scale" ))
	{
		m_fScale = pNode->GetnodeTypedValue();
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/latency" ))
	{
		m_fLatency = pNode->GetnodeTypedValue();
	}

    /////
	MSXML2::IXMLDOMNodeListPtr pItemList = pConfig->selectNodes(L"./root/client_option/item");
	int nItemCnt = pItemList->Getlength();
	
	m_nHaveItemCnt = nItemCnt;
	for( int k = 0; k < nItemCnt; k++ )
	{
		MSXML2::IXMLDOMNodePtr   pItemNode;
		MSXML2::IXMLDOMNodePtr pItmeObj = pItemList->Getitem(k);
		pItemNode = pItmeObj->selectSingleNode(L"./path");
		_bstr_t ItemName = pItemNode->GetnodeTypedValue();
		m_sHaveItemList[k] = ItemName;
	}
   ////
	pConfig.Release();
}
Exemplo n.º 15
0
void CShootManagerSys::LoadShootSolutionSet(SFullName nameFile)
{
	int i;
	MSXML2::IXMLDOMDocument2Ptr pDoc = NULL;
	
	DFileGPack packFile;
	packFile.Open(nameFile);
	CFileSys::LoadBinaryXML(pDoc, packFile.GetFile(), packFile.GetSize());
	packFile.Close();
	
	// 시뮬레이터에서 사용하는 거리 범위들을 로드한다.
	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();
		
		SString strName = (LPCTSTR)path;

		DCutPath(strName);
		DCutFileExt(strName);
		strName[strName.Len()-3] = 'b';
		
		int iIndex = atoi((LPCTSTR)index);
		LoadShootSolutionSector(iIndex, SFullName("simulator",strName));

	//	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);
	}
	
	CFileSys::UnloadXML(pDoc);	
}
Exemplo n.º 16
0
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();		
}