int wxGISGPToolManager::Execute(IGPToolSPtr pTool, ITrackCancel* pTrackCancel) { if(!pTool) return false; //get tool name and add it to stat of exec wxString sToolName = pTool->GetName(); m_ToolsMap[sToolName].nCount++; wxString sToolParams = pTool->GetAsString(); sToolParams.Replace(wxT("\""), wxT("\\\"")); //wxString sCommand = wxString::Format(wxT("%s -n "), m_sGeoprocessPath.c_str()) + sToolName + wxT(" -p \"") + sToolParams + wxT("\""); wxFileName FName(m_sGeoprocessPath); wxArrayString saParams; saParams.Add(FName.GetName()); saParams.Add(wxString(wxT("-n"))); saParams.Add(sToolName); saParams.Add(wxString(wxT("-p"))); saParams.Add(sToolParams); WXGISEXECDDATA data = {new wxGPProcess(m_sGeoprocessPath, saParams, static_cast<IProcessParent*>(this), pTrackCancel), pTool, pTrackCancel}; m_ProcessArray.push_back(data); int nTaskID = m_ProcessArray.size() - 1; AddPriority(nTaskID, nTaskID); StartProcess(nTaskID); return nTaskID; }
void wxGISGPToolManager::SetProcessPriority(size_t nIndex, int nPriority) { wxASSERT(nIndex >= 0); wxASSERT(nIndex < m_ProcessArray.size()); for(size_t i = 0; i < m_aPriorityArray.size(); ++i) { if(m_aPriorityArray[i].nIndex == nIndex) { m_aPriorityArray.erase(m_aPriorityArray.begin() + i); return AddPriority(nIndex, nPriority); } } }
void CSystemManager::Serialize(CArchive& ar) { if(ar.IsStoring()) { ar << m_bActive; ar << m_bSafeMoral; ar << m_bMaxIndustry; ar << m_bNeglectFood; ar << m_iMinMoral; ar << m_iMinMoralProd; ar << m_bBombWarning; ar << m_bOnOffline; ar << static_cast<int>(m_PriorityMap.size()); for(std::map<WORKER::Typ, int>::const_iterator it = m_PriorityMap.begin(); it != m_PriorityMap.end(); ++it) { AssertBotE(it->second > 0); ar << it->second; ar << static_cast<int>(it->first); } ar << static_cast<int>(m_IgnoredBuildings.size()); for(std::set<int>::const_iterator i = m_IgnoredBuildings.begin(); i != m_IgnoredBuildings.end(); ++i) { ar << *i; } } else { ar >> m_bActive; ar >> m_bSafeMoral; ar >> m_bMaxIndustry; ar >> m_bNeglectFood; ar >> m_iMinMoral; ar >> m_iMinMoralProd; ar >> m_bBombWarning; ar >> m_bOnOffline; ClearPriorities(); int size; ar >> size; for(int i = 0; i < size; ++i) { int value; ar >> value; int key; ar >> key; AssertBotE(value > 0); AddPriority(static_cast<WORKER::Typ>(key), value); } ar >> size; m_IgnoredBuildings.clear(); for(int i = 0; i < size; ++i) { int value; ar >> value; m_IgnoredBuildings.insert(value); } } }