Thread: [Gcblue-commits] gcb_wx/src/scriptinterface tcScenarioInterface.cpp,1.22,1.23 tcSimPythonInterface.c
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-03-31 03:51:38
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27747/src/scriptinterface Modified Files: tcScenarioInterface.cpp tcSimPythonInterface.cpp Log Message: Added map overlay, fixed smoke trail roll bug, improved FOV calc for autopoint launchers, database tweaks Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcSimPythonInterface.cpp 16 Feb 2005 23:13:49 -0000 1.27 --- tcSimPythonInterface.cpp 31 Mar 2005 03:51:13 -0000 1.28 *************** *** 32,35 **** --- 32,36 ---- #include "simmath.h" #include "tcSimState.h" + #include "tcMapOverlay.h" #include "tcMenu.h" #include "tcTrackInterface.h" *************** *** 225,228 **** --- 226,235 ---- } + void tcSimPythonInterface::AttachMapOverlay(tcMapOverlay* mo) + { + overlay = mo; + tcScenarioInterface::AttachMapOverlay(mo); + } + void tcSimPythonInterface::AttachSimState(tcSimState *apSimState) { *************** *** 301,308 **** } ! /* Executes command line in command text in embedded Python ** using PyRun_String. If there is an exception an error message ! ** is output to various destinations. */ ! void tcSimPythonInterface::CallPython(const char *commandtext, const char *errortext) { try --- 308,318 ---- } ! /** ! ** Executes command line in command text in embedded Python ** using PyRun_String. If there is an exception an error message ! ** is output to various destinations. ! ** @return 0 on success, non-zero for error ! */ ! int tcSimPythonInterface::CallPython(const char *commandtext, const char *errortext) { try *************** *** 310,318 **** handle<>( PyRun_String(commandtext , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) { ReportError(errortext); PyErr_Print(); } } --- 320,330 ---- handle<>( PyRun_String(commandtext , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); + return 0; } ! catch (error_already_set) { ReportError(errortext); PyErr_Print(); + return 1; } } *************** *** 363,368 **** --- 375,384 ---- wxASSERT(mpSimState); wxASSERT(director); + wxASSERT(overlay); + mpSimState->Clear(); director->ClearEvents(); + overlay->ClearMapObjects(); + wxString cmdText; wxString errText; *************** *** 379,394 **** } // import scenario file cmdText = wxString::Format("from %s import *\n", fileNameWx.c_str()); errText = wxString::Format("Error importing scenario file: %s\n", filePath); ! CallPython(cmdText.c_str(), errText.c_str()); // call CreateScenario method with ScenarioManager global object ! CallPython("CreateScenario(ScenarioManager)\n", "Error with CreateScenario method\n"); // call CreateBriefing method with ScenarioManager global object CallPython("CreateBriefing(ScenarioManager)\n", "Error with CreateBriefing method\n"); - - } --- 395,425 ---- } + // import scenario file cmdText = wxString::Format("from %s import *\n", fileNameWx.c_str()); errText = wxString::Format("Error importing scenario file: %s\n", filePath); ! int errorCode = CallPython(cmdText.c_str(), errText.c_str()); ! if (errorCode != 0) ! { ! mpSimState->Clear(); ! director->ClearEvents(); ! overlay->ClearMapObjects(); ! return; ! } // call CreateScenario method with ScenarioManager global object ! errorCode = CallPython("CreateScenario(ScenarioManager)\n", "Error with CreateScenario method\n"); ! if (errorCode != 0) ! { ! mpSimState->Clear(); ! director->ClearEvents(); ! overlay->ClearMapObjects(); ! return; ! } ! // call CreateBriefing method with ScenarioManager global object + // ignore error here CallPython("CreateBriefing(ScenarioManager)\n", "Error with CreateBriefing method\n"); } *************** *** 703,706 **** --- 734,738 ---- director(0), mpHookedObj(0), + overlay(0), isModePushed(false) { Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcScenarioInterface.cpp 29 Mar 2005 00:12:27 -0000 1.22 --- tcScenarioInterface.cpp 31 Mar 2005 03:51:13 -0000 1.23 *************** *** 41,44 **** --- 41,46 ---- #include "tcLauncher.h" #include "tcMapData.h" + #include "tcMapObject.h" + #include "tcMapOverlay.h" #include "tcScenarioInterface.h" #include "tcSimState.h" *************** *** 101,107 **** } ! tcDirector* tcScenarioInterface::director = NULL; ! tcMapData* tcScenarioInterface::mapData = NULL; ! tcSimState* tcScenarioInterface::simState = NULL; // Interface class management functions --- 103,110 ---- } ! tcDirector* tcScenarioInterface::director = 0; ! tcMapData* tcScenarioInterface::mapData = 0; ! tcMapOverlay* tcScenarioInterface::overlay = 0; ! tcSimState* tcScenarioInterface::simState = 0; // Interface class management functions *************** *** 173,176 **** --- 176,181 ---- .def("ConsoleText",&tcScenarioInterface::ConsoleText) .def("MapText",&tcScenarioInterface::MapText) + // overlay graphics + .def("OverlayText", &tcScenarioInterface::OverlayText) // camera and 3D viewer events .def("FlybyCamera",&tcScenarioInterface::FlybyCamera) *************** *** 590,594 **** * @param seekTime time in seconds within audio file */ ! void tcScenarioInterface::PlayAudio(std::string audioName, double seekTime) { wxASSERT(director); --- 595,599 ---- * @param seekTime time in seconds within audio file */ ! void tcScenarioInterface::PlayAudio(const std::string& audioName, double seekTime) { wxASSERT(director); *************** *** 644,648 **** } ! void tcScenarioInterface::ConsoleText(std::string text) { wxASSERT(director); --- 649,653 ---- } ! void tcScenarioInterface::ConsoleText(const std::string& text) { wxASSERT(director); *************** *** 650,654 **** } ! void tcScenarioInterface::MapText(std::string text, double lon_deg, double lat_deg, double duration, int effect) { --- 655,659 ---- } ! void tcScenarioInterface::MapText(const std::string& text, double lon_deg, double lat_deg, double duration, int effect) { *************** *** 659,663 **** } ! void tcScenarioInterface::FlybyCamera(std::string unitName, double duration, float az1_deg, float az2_deg, float el1_deg, float el2_deg, float r1_m, float r2_m) --- 664,680 ---- } ! void tcScenarioInterface::OverlayText(const std::string& text, ! double lon_deg, double lat_deg) ! { ! wxASSERT(overlay); ! ! tcMapTextObject* obj = new tcMapTextObject(text, lon_deg, lat_deg); ! obj->SetColor(osg::Vec4(0, 0, 0, 1)); ! ! overlay->AddMapObject(obj); ! } ! ! ! void tcScenarioInterface::FlybyCamera(const std::string& unitName, double duration, float az1_deg, float az2_deg, float el1_deg, float el2_deg, float r1_m, float r2_m) *************** *** 680,685 **** } ! void tcScenarioInterface::TrackCamera(std::string unitName, double duration, float x1, float x2, ! float y1, float y2, float z1, float z2) { wxASSERT(director); --- 697,702 ---- } ! void tcScenarioInterface::TrackCamera(const std::string& unitName, double duration, ! float x1, float x2, float y1, float y2, float z1, float z2) { wxASSERT(director); *************** *** 698,702 **** } ! void tcScenarioInterface::Text3D(std::string text, double duration, float x, float y, float size, int effect) { --- 715,719 ---- } ! void tcScenarioInterface::Text3D(const std::string& text, double duration, float x, float y, float size, int effect) { |