1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    PCNetProjectionLoader.h
11 /// @author  Daniel Krajzewicz
12 /// @author  Jakob Erdmann
13 /// @author  Michael Behrisch
14 /// @date    Thu, 02.11.2006
15 /// @version $Id$
16 ///
17 // A reader for a SUMO network's projection description
18 /****************************************************************************/
19 #ifndef PCNetProjectionLoader_h
20 #define PCNetProjectionLoader_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <utils/xml/SUMOSAXHandler.h>
30 #include <utils/common/UtilExceptions.h>
31 #include <utils/geom/Position.h>
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
37 class OptionsCont;
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 /**
44  * @class PCNetProjectionLoader
45  * @brief A reader for a SUMO network's projection description
46  */
47 class PCNetProjectionLoader : public SUMOSAXHandler {
48 public:
49     /** @brief Loads network projection if wished
50      *
51      * @param[in] file The network file from which to parse the location element
52      * @param[in] shift The shift of the decimal point when interpreting loaded coordinates
53      */
54     static void load(const std::string& file, double scale);
55 
56 
57 protected:
58     /** @brief Constructor
59      */
60     PCNetProjectionLoader(double scale);
61 
62 
63     /// @brief Destructor
64     ~PCNetProjectionLoader();
65 
66 
67     /** @brief Returns whether all needed values were read
68      * @return Whether all needed values were read
69      */
70     bool hasReadAll() const;
71 
72 
73 protected:
74     /// @name inherited from GenericSAXHandler
75     //@{
76 
77     /** @brief Called on the opening of a tag;
78      *
79      * @param[in] element ID of the currently opened element
80      * @param[in] attrs Attributes within the currently opened element
81      * @exception ProcessError If something fails
82      * @see GenericSAXHandler::myStartElement
83      */
84     virtual void myStartElement(int element,
85                                 const SUMOSAXAttributes& attrs);
86     //@}
87 
88 
89 private:
90     /// @brief Information whether the parameter was read
91     bool myFoundLocation;
92 
93     /// @brief scaling of input coordinates (not given in the location element)
94     double myScale;
95 
96 
97 };
98 
99 
100 #endif
101 
102 /****************************************************************************/
103 
104