/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-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 PCLoaderXML.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Thu, 02.11.200618///19// A reader for polygons and pois stored in XML-format20/****************************************************************************/21#pragma once22#include <config.h>2324#include <string>25#include "PCPolyContainer.h"26#include "PCTypeMap.h"27#include <utils/shapes/ShapeHandler.h>28#include <utils/common/UtilExceptions.h>293031// ===========================================================================32// class definitions33// ===========================================================================34class OptionsCont;353637// ===========================================================================38// class declarations39// ===========================================================================40/**41* @class PCLoaderXML42* @brief A reader for polygons and pois stored in XML-format43*44* Reads pois stored as XML definition. The definitions must match45* the format POLYCONVERT generates.46*/47class PCLoaderXML : public ShapeHandler {48public:49/** @brief Loads pois/polygons assumed to be stored as XML50*51* If the option "xml" is set within the given options container,52* an instance of PCLoaderXML is built and used as a handler for the53* files given in this option.54*55* @param[in] oc The options container to get further options from56* @param[in] toFill The poly/pois container to add loaded polys/pois to57* @param[in] tm The type map to use for setting values of loaded polys/pois58* @exception ProcessError if something fails59*/60static void loadIfSet(OptionsCont& oc, PCPolyContainer& toFill,61PCTypeMap& tm);626364Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos, bool friendlyPos, double lanePosLat);6566protected:67/** @brief Constructor68* @param[in] toFill The poly/pois container to add loaded polys/pois to69* @param[in] tm The type map to use for setting values of loaded polys/pois70* @param[in] oc The options container to get further options from71*/72PCLoaderXML(PCPolyContainer& toFill,73PCTypeMap& tm, OptionsCont& oc);747576/// @brief Destructor77~PCLoaderXML();787980protected:81/// @name inherited from GenericSAXHandler82//@{8384/** @brief Called on the opening of a tag;85*86* @param[in] element ID of the currently opened element87* @param[in] attrs Attributes within the currently opened element88* @exception ProcessError If something fails89* @see GenericSAXHandler::myStartElement90*/91virtual void myStartElement(int element, const SUMOSAXAttributes& attrs);92//@}939495private:96/// @brief The type map to use97PCTypeMap& myTypeMap;9899/// @brief Settings to use100OptionsCont& myOptions;101102};103104105