Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/polyconvert/PCLoaderXML.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file PCLoaderXML.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @date Thu, 02.11.2006
19
///
20
// A reader for polygons and pois stored in XML-format
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <string>
26
#include "PCPolyContainer.h"
27
#include "PCTypeMap.h"
28
#include <utils/shapes/ShapeHandler.h>
29
#include <utils/common/UtilExceptions.h>
30
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
class OptionsCont;
36
37
38
// ===========================================================================
39
// class declarations
40
// ===========================================================================
41
/**
42
* @class PCLoaderXML
43
* @brief A reader for polygons and pois stored in XML-format
44
*
45
* Reads pois stored as XML definition. The definitions must match
46
* the format POLYCONVERT generates.
47
*/
48
class PCLoaderXML : public ShapeHandler {
49
public:
50
/** @brief Loads pois/polygons assumed to be stored as XML
51
*
52
* If the option "xml" is set within the given options container,
53
* an instance of PCLoaderXML is built and used as a handler for the
54
* files given in this option.
55
*
56
* @param[in] oc The options container to get further options from
57
* @param[in] toFill The poly/pois container to add loaded polys/pois to
58
* @param[in] tm The type map to use for setting values of loaded polys/pois
59
* @exception ProcessError if something fails
60
*/
61
static void loadIfSet(OptionsCont& oc, PCPolyContainer& toFill,
62
PCTypeMap& tm);
63
64
65
Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos, bool friendlyPos, double lanePosLat);
66
67
protected:
68
/** @brief Constructor
69
* @param[in] toFill The poly/pois container to add loaded polys/pois to
70
* @param[in] tm The type map to use for setting values of loaded polys/pois
71
* @param[in] oc The options container to get further options from
72
*/
73
PCLoaderXML(PCPolyContainer& toFill,
74
PCTypeMap& tm, OptionsCont& oc);
75
76
77
/// @brief Destructor
78
~PCLoaderXML();
79
80
81
protected:
82
/// @name inherited from GenericSAXHandler
83
//@{
84
85
/** @brief Called on the opening of a tag;
86
*
87
* @param[in] element ID of the currently opened element
88
* @param[in] attrs Attributes within the currently opened element
89
* @exception ProcessError If something fails
90
* @see GenericSAXHandler::myStartElement
91
*/
92
virtual void myStartElement(int element, const SUMOSAXAttributes& attrs);
93
//@}
94
95
96
private:
97
/// @brief The type map to use
98
PCTypeMap& myTypeMap;
99
100
/// @brief Settings to use
101
OptionsCont& myOptions;
102
103
};
104
105