Skip to content

Commit

Permalink
adding more schema references, refs #2
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk@15818 afbd958f-9f77-42d5-a016-97a22340ccf4
  • Loading branch information
behrisch committed Mar 5, 2014
1 parent 85b20db commit c153e36
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion sumo/src/activitygen/activitygen_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ main(int argc, char* argv[]) {
}

std::string statFile = oc.getString("stat-file");
OutputDevice::createDeviceByOption("output-file", "routes");
OutputDevice::createDeviceByOption("output-file", "routes", "routes_file.xsd");
AGTime duration(1, 0, 0);
AGTime begin(0);
AGTime end(0);
Expand Down
8 changes: 4 additions & 4 deletions sumo/src/dfrouter/RODFDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ RODFDetectorCon::writeEmitters(const std::string& file,
}
//
OutputDevice& out = OutputDevice::getDevice(file);
out.writeXMLHeader("additional");
out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\"");
for (std::vector<RODFDetector*>::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) {
RODFDetector* det = *i;
// get file name for values (emitter/calibrator definition)
Expand Down Expand Up @@ -674,7 +674,7 @@ void
RODFDetectorCon::writeEmitterPOIs(const std::string& file,
const RODFDetectorFlows& flows) {
OutputDevice& out = OutputDevice::getDevice(file);
out.writeXMLHeader("additional");
out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\"");
for (std::vector<RODFDetector*>::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) {
RODFDetector* det = *i;
SUMOReal flow = flows.getFlowSumSecure(det->getID());
Expand Down Expand Up @@ -753,7 +753,7 @@ RODFDetectorCon::writeSpeedTrigger(const RODFNet* const net,
SUMOTime startTime, SUMOTime endTime,
SUMOTime stepOffset) {
OutputDevice& out = OutputDevice::getDevice(file);
out.writeXMLHeader("additional");
out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\"");
for (std::vector<RODFDetector*>::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) {
RODFDetector* det = *i;
// write the declaration into the file
Expand All @@ -771,7 +771,7 @@ RODFDetectorCon::writeSpeedTrigger(const RODFNet* const net,
void
RODFDetectorCon::writeEndRerouterDetectors(const std::string& file) {
OutputDevice& out = OutputDevice::getDevice(file);
out.writeXMLHeader("additional");
out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\"");
for (std::vector<RODFDetector*>::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) {
RODFDetector* det = *i;
// write the declaration into the file
Expand Down
14 changes: 7 additions & 7 deletions sumo/src/microsim/MSFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,15 @@ MSFrame::fillOptions() {
void
MSFrame::buildStreams() {
// standard outputs
OutputDevice::createDeviceByOption("netstate-dump", "netstate");
OutputDevice::createDeviceByOption("summary-output", "summary");
OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos");
OutputDevice::createDeviceByOption("netstate-dump", "netstate", "netstate_file.xsd");
OutputDevice::createDeviceByOption("summary-output", "summary", "summary_file.xsd");
OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos", "tripinfo_file.xsd");

//extended
OutputDevice::createDeviceByOption("fcd-output", "fcd-export");
OutputDevice::createDeviceByOption("emission-output", "emission-export");
OutputDevice::createDeviceByOption("full-output", "full-export");
OutputDevice::createDeviceByOption("queue-output", "queue-export");
OutputDevice::createDeviceByOption("fcd-output", "fcd-export", "fcd_file.xsd");
OutputDevice::createDeviceByOption("emission-output", "emission-export", "emission_file.xsd");
OutputDevice::createDeviceByOption("full-output", "full-export", "full_file.xsd");
OutputDevice::createDeviceByOption("queue-output", "queue-export", "queue_file.xsd");

//OutputDevice::createDeviceByOption("vtk-output", "vtk-export");
OutputDevice::createDeviceByOption("link-output", "link-output");
Expand Down
2 changes: 1 addition & 1 deletion sumo/src/microsim/devices/MSDevice_Vehroutes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ std::map<const SUMOTime, std::string> MSDevice_Vehroutes::myRouteInfos;
void
MSDevice_Vehroutes::init() {
if (OptionsCont::getOptions().isSet("vehroute-output")) {
OutputDevice::createDeviceByOption("vehroute-output", "routes");
OutputDevice::createDeviceByOption("vehroute-output", "routes", "routes_file.xsd");
mySaveExits = OptionsCont::getOptions().getBool("vehroute-output.exit-times");
myLastRouteOnly = OptionsCont::getOptions().getBool("vehroute-output.last-route");
mySorted = OptionsCont::getOptions().getBool("vehroute-output.sorted");
Expand Down
2 changes: 1 addition & 1 deletion sumo/src/netload/NLHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ NLHandler::addPOI(const SUMOSAXAttributes& attrs) {
if (laneID != "") {
MSLane* lane = MSLane::dictionary(laneID);
if (lane == 0) {
WRITE_ERROR("Lane '" + laneID + "' to place a poi '" + id + "'on is not known.");
WRITE_ERROR("Lane '" + laneID + "' to place poi '" + id + "' on is not known.");
return;
}
if (lanePos < 0) {
Expand Down
4 changes: 2 additions & 2 deletions sumo/src/od2trips/od2trips_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,14 @@ main(int argc, char** argv) {
}
// write
bool haveOutput = false;
if (OutputDevice::createDeviceByOption("output-file", "routes")) {
if (OutputDevice::createDeviceByOption("output-file", "routes", "routes_file.xsd")) {
matrix.write(string2time(oc.getString("begin")), string2time(oc.getString("end")),
OutputDevice::getDeviceByOption("output-file"),
oc.getBool("spread.uniform"), oc.getBool("ignore-vehicle-type"),
oc.getString("prefix"), !oc.getBool("no-step-log"));
haveOutput = true;
}
if (OutputDevice::createDeviceByOption("flow-output", "routes")) {
if (OutputDevice::createDeviceByOption("flow-output", "routes", "routes_file.xsd")) {
matrix.writeFlows(string2time(oc.getString("begin")), string2time(oc.getString("end")),
OutputDevice::getDeviceByOption("flow-output"),
oc.getBool("ignore-vehicle-type"), oc.getString("prefix"));
Expand Down
2 changes: 1 addition & 1 deletion sumo/src/polyconvert/PCPolyContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ PCPolyContainer::report() {
void
PCPolyContainer::save(const std::string& file) {
OutputDevice& out = OutputDevice::getDevice(file);
out.writeXMLHeader("shapes");
out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\"");
// write polygons
for (PolyCont::iterator i = myPolyCont.begin(); i != myPolyCont.end(); ++i) {
Polygon* p = i->second;
Expand Down
7 changes: 4 additions & 3 deletions sumo/src/utils/iodevices/OutputDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ OutputDevice::getDevice(const std::string& name) {

bool
OutputDevice::createDeviceByOption(const std::string& optionName,
const std::string& rootElement) {
const std::string& rootElement,
const std::string& schemaFile) {
if (!OptionsCont::getOptions().isSet(optionName)) {
return false;
}
OutputDevice& dev = OutputDevice::getDevice(OptionsCont::getOptions().getString(optionName));
if (rootElement != "") {
if (rootElement == "routes" || rootElement == "netstate") {
dev.writeXMLHeader(rootElement, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/" + rootElement + "_file.xsd\"");
if (schemaFile != "") {
dev.writeXMLHeader(rootElement, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/" + schemaFile + "\"");
} else {
dev.writeXMLHeader(rootElement);
}
Expand Down
6 changes: 4 additions & 2 deletions sumo/src/utils/iodevices/OutputDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ class OutputDevice {
* within XML-declarations of structures which paths already is aware of the
* cwd.
*
* @param[in] optionName The name of the option to use for retrieving the output definition
* @param[in] optionName The name of the option to use for retrieving the output definition
* @param[in] rootElement The root element to use (XML-output)
* @param[in] schemaFile The basename of the schema file to use (XML-output)
* @return Whether a device was built (the option was set)
* @exception IOError If the output could not be built for any reason (error message is supplied)
*/
static bool createDeviceByOption(const std::string& optionName,
const std::string& rootElement = "");
const std::string& rootElement = "",
const std::string& schemaFile = "");


/** @brief Returns the device described by the option
Expand Down

0 comments on commit c153e36

Please sign in to comment.