本文整理汇总了C++中SUMOSAXAttributes::getColorReporting方法的典型用法代码示例。如果您正苦于以下问题:C++ SUMOSAXAttributes::getColorReporting方法的具体用法?C++ SUMOSAXAttributes::getColorReporting怎么用?C++ SUMOSAXAttributes::getColorReporting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUMOSAXAttributes
的用法示例。
在下文中一共展示了SUMOSAXAttributes::getColorReporting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pos
void
PCLoaderXML::myStartElement(int element,
const SUMOSAXAttributes& attrs) {
if (element != SUMO_TAG_POI && element != SUMO_TAG_POLY) {
return;
}
if (element == SUMO_TAG_POI) {
bool ok = true;
// get the id, report an error if not given or empty...
std::string id = attrs.getStringReporting(SUMO_ATTR_ID, 0, ok);
SUMOReal x = attrs.getSUMORealReporting(SUMO_ATTR_X, id.c_str(), ok);
SUMOReal y = attrs.getSUMORealReporting(SUMO_ATTR_Y, id.c_str(), ok);
std::string type = attrs.getOptStringReporting(SUMO_ATTR_TYPE, id.c_str(), ok, myOptions.getString("type"));
if (!ok) {
return;
}
Position pos(x, y);
if (!GeoConvHelper::getProcessing().x2cartesian(pos)) {
WRITE_WARNING("Unable to project coordinates for POI '" + id + "'.");
}
// patch the values
bool discard = myOptions.getBool("discard");
SUMOReal layer = (SUMOReal)myOptions.getInt("layer");
RGBColor color;
if (myTypeMap.has(type)) {
const PCTypeMap::TypeDef& def = myTypeMap.get(type);
id = def.prefix + id;
type = def.id;
color = RGBColor::parseColor(def.color);
discard = def.discard;
layer = (SUMOReal)def.layer;
} else {
id = myOptions.getString("prefix") + id;
color = RGBColor::parseColor(myOptions.getString("color"));
}
layer = attrs.getOptSUMORealReporting(SUMO_ATTR_LAYER, id.c_str(), ok, layer);
if (attrs.hasAttribute(SUMO_ATTR_COLOR)) {
color = attrs.getColorReporting(id.c_str(), ok);
}
SUMOReal angle = attrs.getOptSUMORealReporting(SUMO_ATTR_ANGLE, id.c_str(), ok, Shape::DEFAULT_ANGLE);
std::string imgFile = attrs.getOptStringReporting(SUMO_ATTR_IMGFILE, id.c_str(), ok, Shape::DEFAULT_IMG_FILE);
if (imgFile != "" && !FileHelpers::isAbsolute(imgFile)) {
imgFile = FileHelpers::getConfigurationRelative(getFileName(), imgFile);
}
SUMOReal imgWidth = attrs.getOptSUMORealReporting(SUMO_ATTR_WIDTH, id.c_str(), ok, Shape::DEFAULT_IMG_WIDTH);
SUMOReal imgHeight = attrs.getOptSUMORealReporting(SUMO_ATTR_HEIGHT, id.c_str(), ok, Shape::DEFAULT_IMG_HEIGHT);
if (!ok) {
return;
}
if (!discard) {
bool ignorePrunning = false;
if (OptionsCont::getOptions().isInStringVector("prune.keep-list", id)) {
ignorePrunning = true;
}
PointOfInterest* poi = new PointOfInterest(id, type, color, pos, layer, angle, imgFile, imgWidth, imgHeight);
if (!myCont.insert(id, poi, (int)layer, ignorePrunning)) {
WRITE_ERROR("POI '" + id + "' could not be added.");
delete poi;
}
}
}
if (element == SUMO_TAG_POLY) {
bool discard = myOptions.getBool("discard");
SUMOReal layer = (SUMOReal)myOptions.getInt("layer");
bool ok = true;
std::string id = attrs.getOptStringReporting(SUMO_ATTR_ID, myCurrentID.c_str(), ok, "");
std::string type = attrs.getOptStringReporting(SUMO_ATTR_TYPE, myCurrentID.c_str(), ok, myOptions.getString("type"));
if (!ok) {
return;
}
RGBColor color;
if (myTypeMap.has(type)) {
const PCTypeMap::TypeDef& def = myTypeMap.get(type);
id = def.prefix + id;
type = def.id;
color = RGBColor::parseColor(def.color);
discard = def.discard;
layer = (SUMOReal)def.layer;
} else {
id = myOptions.getString("prefix") + id;
color = RGBColor::parseColor(myOptions.getString("color"));
}
layer = attrs.getOptSUMORealReporting(SUMO_ATTR_LAYER, id.c_str(), ok, layer);
if (attrs.hasAttribute(SUMO_ATTR_COLOR)) {
color = attrs.getColorReporting(id.c_str(), ok);
}
SUMOReal angle = attrs.getOptSUMORealReporting(SUMO_ATTR_ANGLE, id.c_str(), ok, Shape::DEFAULT_ANGLE);
std::string imgFile = attrs.getOptStringReporting(SUMO_ATTR_IMGFILE, id.c_str(), ok, Shape::DEFAULT_IMG_FILE);
if (imgFile != "" && !FileHelpers::isAbsolute(imgFile)) {
imgFile = FileHelpers::getConfigurationRelative(getFileName(), imgFile);
}
bool fill = attrs.getOptBoolReporting(SUMO_ATTR_FILL, id.c_str(), ok, false);
if (!ok) {
return;
}
if (!discard) {
bool ignorePrunning = false;
if (OptionsCont::getOptions().isInStringVector("prune.keep-list", id)) {
ignorePrunning = true;
}
//.........这里部分代码省略.........