[Gcblue-commits] gcb_wx/src/database tcAirDBObject.cpp,1.6,1.7 tcDatabase.cpp,1.8,1.9 tcDatabaseObje
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-03-28 23:23:49
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1383/src/database Modified Files: tcAirDBObject.cpp tcDatabase.cpp tcDatabaseObject.cpp tcESMDBObject.cpp tcFixedDBObject.cpp tcFlightportDBObject.cpp tcGenericDBObject.cpp tcLauncherDBObject.cpp tcMissileDBObject.cpp tcRadarDBObject.cpp tcSensorDBObject.cpp Log Message: Index: tcESMDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcESMDBObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcESMDBObject.cpp 28 Mar 2004 19:00:05 -0000 1.4 --- tcESMDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.5 *************** *** 66,69 **** --- 66,81 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcESMDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + + tcSensorDBObject::SerializeXml(node, load); + } + int tcESMDBObject::WriteCSVHeader(Database::CsvTranslator *csv) Index: tcRadarDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcRadarDBObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcRadarDBObject.cpp 28 Mar 2004 18:55:40 -0000 1.7 --- tcRadarDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.8 *************** *** 135,138 **** --- 135,158 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcRadarDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + /* + node->SetAttribute("DBCLASS", mzClass.mz); + node->SetAttribute("MODELTYPE", int(mnModelType)); + node->SetAttribute("FUNCTYPE", int(mnType)); + node->SetAttribute("IMAGE", mzImageFileName.mz); + node->SetAttribute("3DMODEL", mz3DModelFileName.mz); + TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); + descriptionNode->InsertEndChild(TiXmlText(mzDescription)); + */ + tcSensorDBObject::SerializeXml(node, load); + } + int tcRadarDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { Index: tcFlightportDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcFlightportDBObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcFlightportDBObject.cpp 4 Jan 2004 22:24:52 -0000 1.1 --- tcFlightportDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- #include "randfn.h" #include "CsvTranslator.h" + #include "common/tinyxml.h" *************** *** 109,112 **** --- 110,182 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcFlightportDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + + + TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("FlightPort"))->ToElement(); + + localNode->SetAttribute("onlyHelo", (int)heloOnly); + localNode->SetAttribute("hangarCap", (int)hangarCapacity); + + for(std::vector<spotDBInfo>::iterator iter = spotInfo.begin() + ; iter != spotInfo.end(); ++iter) + { + TiXmlElement* spotNode = node->InsertEndChild(TiXmlElement("Spot"))->ToElement(); + spotNode->SetAttribute("isLaunch", (*iter).isLaunch); + spotNode->SetAttribute("x", (*iter).x); + spotNode->SetAttribute("y", (*iter).y); + spotNode->SetAttribute("z", (*iter).z); + spotNode->SetAttribute("orientation", (*iter).orientation_deg); + spotNode->SetAttribute("length", (*iter).length); + } + + /* + std::vector::iterator + *csv << (long)heloOnly; ///< set non-zero for helo-only flight port + *csv << (long)hangarCapacity; + size_t numSpots = spotInfo.size(); + size_t i; + for(i=0;i<MAX_DB_SPOTS;i++) + { + if (i<numSpots) + { + spotDBInfo info = spotInfo[i]; + *csv << (long)info.isLaunch; + *csv << info.x; + *csv << info.y; // y and z swapped in header due to OSG coord change + *csv << info.z; + *csv << info.orientation_deg; + *csv << info.length; + } + else + { + *csv << ""; + *csv << ""; + *csv << ""; + *csv << ""; + *csv << ""; + *csv << ""; + } + } + */ + /* + node->SetAttribute("DBCLASS", mzClass.mz); + node->SetAttribute("MODELTYPE", int(mnModelType)); + node->SetAttribute("FUNCTYPE", int(mnType)); + node->SetAttribute("IMAGE", mzImageFileName.mz); + node->SetAttribute("3DMODEL", mz3DModelFileName.mz); + TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); + descriptionNode->InsertEndChild(TiXmlText(mzDescription)); + */ + tcDatabaseObject::SerializeXml(node, load); + } + + int tcFlightportDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { Index: tcLauncherDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcLauncherDBObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcLauncherDBObject.cpp 28 Mar 2004 18:58:29 -0000 1.4 --- tcLauncherDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.5 *************** *** 120,123 **** --- 120,143 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcLauncherDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + /* + node->SetAttribute("DBCLASS", mzClass.mz); + node->SetAttribute("MODELTYPE", int(mnModelType)); + node->SetAttribute("FUNCTYPE", int(mnType)); + node->SetAttribute("IMAGE", mzImageFileName.mz); + node->SetAttribute("3DMODEL", mz3DModelFileName.mz); + TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); + descriptionNode->InsertEndChild(TiXmlText(mzDescription)); + */ + tcDatabaseObject::SerializeXml(node, load); + } + int tcLauncherDBObject::WriteCSVHeader(Database::CsvTranslator *csv) Index: tcGenericDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcGenericDBObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcGenericDBObject.cpp 14 Jan 2004 01:13:22 -0000 1.5 --- tcGenericDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.6 *************** *** 27,30 **** --- 27,31 ---- #include "CsvTranslator.h" #include "tc3DModel.h" + #include "common/tinyxml.h" using namespace std; *************** *** 293,296 **** --- 294,367 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcGenericDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + /* + node->SetAttribute("DBCLASS", mzClass.mz); + node->SetAttribute("MODELTYPE", int(mnModelType)); + node->SetAttribute("FUNCTYPE", int(mnType)); + node->SetAttribute("IMAGE", mzImageFileName.mz); + node->SetAttribute("3DMODEL", mz3DModelFileName.mz); + TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); + descriptionNode->InsertEndChild(TiXmlText(mzDescription)); + */ + + TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("generic"))->ToElement(); + + + localNode->SetAttribute("rcs_dbsm", mfRcs_dbsm); + localNode->SetAttribute("maxSpeed_kts", mfMaxSpeed_kts); + localNode->SetAttribute("accel_ktsps", mfAccel_ktsps); + localNode->SetAttribute("turnRate_degps", mfTurnRate_degps); + localNode->SetAttribute("fuelCapacity_kg", mfFuelCapacity_kg); + localNode->SetAttribute("fuelRate_kgps", mfFuelRate_kgps); + localNode->SetAttribute("maxAltitude_m", mfMaxAltitude_m); + localNode->SetAttribute("maxDepth_m", mfMaxDepth_m); + localNode->SetAttribute("altitudeRate_mps", mfAltitudeRate_mps); + localNode->SetAttribute("toughness", mfToughness); + localNode->SetAttribute("damage", mfDamage); + localNode->SetAttribute("weight_kg", mfWeight_kg); + localNode->SetAttribute("maxThrust_N", mfMaxThrust_N); + localNode->SetAttribute("range_km", mfRange_km); + + // write flightport info if one exists for this object + if (strlen(flightportClass.mz)) + { + TiXmlElement* childNode = node->InsertEndChild(TiXmlElement("flightPort"))->ToElement(); + childNode->SetAttribute("class", flightportClass.mz); + } + + int i; + for(i=0;(i<mnNumLaunchers)&&(i<MAXLAUNCHERS);i++) + { + TiXmlElement* childNode = node->InsertEndChild(TiXmlElement("launcher"))->ToElement(); + childNode->SetAttribute("class", maLauncherClass[i].mz); + childNode->SetAttribute("az", launcherAz[i]); + } + + for(i=0;(i<mnNumSensors)&&(i<MAXSENSORS);i++) + { + TiXmlElement* childNode = node->InsertEndChild(TiXmlElement("sensor"))->ToElement(); + childNode->SetAttribute("class", maSensorClass[i].mz); + childNode->SetAttribute("az", sensorAz[i]); + } + + for(std::vector<animationDBInfo>::iterator iter = animationInfo.begin() + ; iter != animationInfo.end(); ++iter) + { + TiXmlElement* childNode = node->InsertEndChild(TiXmlElement("animation"))->ToElement(); + childNode->SetAttribute("object", (*iter).objectName); + childNode->SetAttribute("type", (*iter).animationType); + childNode->SetAttribute("param", (*iter).param); + } + + tcDatabaseObject::SerializeXml(node, load); + } + int tcGenericDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcDatabase.cpp 25 Mar 2004 01:33:39 -0000 1.8 --- tcDatabase.cpp 28 Mar 2004 23:12:28 -0000 1.9 *************** *** 168,172 **** // create root node to be XML compliant ! TiXmlNode* root = doc->InsertEndChild(TiXmlElement("DATA")); // for each DB object: add new TiXmlElement to doc, and call virtual SerializeXml method --- 168,172 ---- // create root node to be XML compliant ! TiXmlNode* root = doc->InsertEndChild(TiXmlElement("data")); // for each DB object: add new TiXmlElement to doc, and call virtual SerializeXml method *************** *** 182,186 **** wxASSERT(obj); ! TiXmlNode* objNode = root->InsertEndChild(TiXmlElement("OBJ")); obj->SerializeXml(objNode->ToElement(), false); } --- 182,186 ---- wxASSERT(obj); ! TiXmlNode* objNode = root->InsertEndChild(TiXmlElement("obj")); obj->SerializeXml(objNode->ToElement(), false); } Index: tcAirDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcAirDBObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcAirDBObject.cpp 29 Jan 2004 00:05:22 -0000 1.6 --- tcAirDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.7 *************** *** 25,28 **** --- 25,29 ---- #include "tcGenericDBObject.h" #include "CsvTranslator.h" + #include "common/tinyxml.h" namespace Database *************** *** 75,78 **** --- 76,108 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcAirDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + + TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("air"))->ToElement(); + + localNode->SetAttribute("altThrustDecay_pm", mfAltThrustDecay_pm); + localNode->SetAttribute("afterburnFuelRate_kgps", mfAfterburnFuelRate_kgps); + localNode->SetAttribute("afterburnThrust_N", mfAfterburnThrust_N); + localNode->SetAttribute("dragArea_sm", mfDragArea_sm); + localNode->SetAttribute("wingArea_sm", mfWingArea_sm); + localNode->SetAttribute("cdpsub", mfCdpsub); + localNode->SetAttribute("cdptran", mfCdptran); + localNode->SetAttribute("cdpsup", mfCdpsup); + localNode->SetAttribute("mcm", mfMcm); + localNode->SetAttribute("msupm", mfMsupm); + localNode->SetAttribute("kdi", mfKdi); + localNode->SetAttribute("maxAoa_rad", mfMaxAoa_rad); + localNode->SetAttribute("maxCl", mfMaxCl); + localNode->SetAttribute("gmax", mfGmax); + + tcGenericDBObject::SerializeXml(node, load); + } + int tcAirDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { Index: tcSensorDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSensorDBObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorDBObject.cpp 28 Mar 2004 18:53:03 -0000 1.3 --- tcSensorDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.4 *************** *** 87,90 **** --- 87,110 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcSensorDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + /* + node->SetAttribute("DBCLASS", mzClass.mz); + node->SetAttribute("MODELTYPE", int(mnModelType)); + node->SetAttribute("FUNCTYPE", int(mnType)); + node->SetAttribute("IMAGE", mzImageFileName.mz); + node->SetAttribute("3DMODEL", mz3DModelFileName.mz); + TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); + descriptionNode->InsertEndChild(TiXmlText(mzDescription)); + */ + tcDatabaseObject::SerializeXml(node, load); + } + int tcSensorDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { Index: tcFixedDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcFixedDBObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcFixedDBObject.cpp 28 Mar 2004 18:59:05 -0000 1.4 --- tcFixedDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.5 *************** *** 64,67 **** --- 64,79 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcFixedDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + + tcDatabaseObject::SerializeXml(node, load); + } + int tcFixedDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { Index: tcDatabaseObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcDatabaseObject.cpp 28 Mar 2004 18:57:02 -0000 1.7 --- tcDatabaseObject.cpp 28 Mar 2004 23:12:28 -0000 1.8 *************** *** 211,233 **** return 1; } ! ! /** ! * Loads/saves XML data for database object ! * @param load true to load, false to save ! */ ! ! void tcDatabaseObject::SerializeXml(TiXmlElement* node, bool load) ! { ! if (load) return; // write only for now ! wxASSERT(node); ! ! node->SetAttribute("DBCLASS", mzClass.mz); ! node->SetAttribute("MODELTYPE", int(mnModelType)); ! node->SetAttribute("FUNCTYPE", int(mnType)); ! node->SetAttribute("IMAGE", mzImageFileName.mz); ! node->SetAttribute("3DMODEL", mz3DModelFileName.mz); ! TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); ! descriptionNode->InsertEndChild(TiXmlText(mzDescription)); } int tcDatabaseObject::WriteCSVHeader(Database::CsvTranslator *csv) --- 211,234 ---- return 1; } ! ! ! /** ! * Loads/saves XML data for database object ! * @param load true to load, false to save ! */ ! void tcDatabaseObject::SerializeXml(TiXmlElement* node, bool load) ! { ! if (load) return; // write only for now ! wxASSERT(node); ! node->SetAttribute("dbClass", GetClassName()); ! node->SetAttribute("class", mzClass.mz); ! node->SetAttribute("modelType", int(mnModelType)); ! node->SetAttribute("funcType", int(mnType)); ! node->SetAttribute("image", mzImageFileName.mz); ! node->SetAttribute("3DModel", mz3DModelFileName.mz); ! TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); ! descriptionNode->InsertEndChild(TiXmlText(mzDescription)); } + int tcDatabaseObject::WriteCSVHeader(Database::CsvTranslator *csv) Index: tcMissileDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcMissileDBObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcMissileDBObject.cpp 28 Mar 2004 18:57:40 -0000 1.5 --- tcMissileDBObject.cpp 28 Mar 2004 23:12:28 -0000 1.6 *************** *** 253,256 **** --- 253,276 ---- } + /** + * Loads/saves XML data for database object + * @param load true to load, false to save + */ + void tcMissileDBObject::SerializeXml(TiXmlElement* node, bool load) + { + if (load) return; // write only for now + wxASSERT(node); + /* + node->SetAttribute("DBCLASS", mzClass.mz); + node->SetAttribute("MODELTYPE", int(mnModelType)); + node->SetAttribute("FUNCTYPE", int(mnType)); + node->SetAttribute("IMAGE", mzImageFileName.mz); + node->SetAttribute("3DMODEL", mz3DModelFileName.mz); + TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("DESCRIPTION")); + descriptionNode->InsertEndChild(TiXmlText(mzDescription)); + */ + tcDatabaseObject::SerializeXml(node, load); + } + int tcMissileDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { |