/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2005-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file PCTypeMap.cpp14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Mon, 05 Dec 200518///19// A storage for type mappings20/****************************************************************************/21#include <config.h>2223#include <string>24#include <map>25#include "utils/options/OptionsCont.h"26#include "PCTypeMap.h"272829// ===========================================================================30// method definitions31// ===========================================================================32PCTypeMap::PCTypeMap(const OptionsCont& oc) {33myDefaultType.id = oc.getString("type");34myDefaultType.color = RGBColor::parseColor(oc.getString("color"));35myDefaultType.icon = oc.getString("icon");36myDefaultType.layer = oc.getFloat("layer");37myDefaultType.discard = oc.getBool("discard");38myDefaultType.allowFill = oc.getBool("fill") ? Filltype::FILL : Filltype::NOFILL;39myDefaultType.prefix = oc.getString("prefix");40}414243PCTypeMap::~PCTypeMap() {}444546bool47PCTypeMap::add(const std::string& id, const std::string& newid, const std::string& color,48const std::string& prefix, const std::string& icon, double layer,49double angle, const std::string& imgFile, bool discard, Filltype allowFill) {50if (has(id)) {51return false;52}53TypeDef td;54td.id = newid;55td.color = RGBColor::parseColor(color);56td.icon = icon;57td.layer = layer;58td.angle = angle;59td.imgFile = imgFile;60td.discard = discard;61td.allowFill = allowFill;62td.prefix = prefix;63myTypes[id] = td;64return true;65}666768const PCTypeMap::TypeDef&69PCTypeMap::get(const std::string& id) {70return myTypes.find(id)->second;71}727374bool75PCTypeMap::has(const std::string& id) {76return myTypes.find(id) != myTypes.end();77}787980/****************************************************************************/818283