1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-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    MSVTKExport.h
11 /// @author  Mario Krumnow
12 /// @date    2012-04-26
13 /// @version $Id$
14 ///
15 // Produce a VTK output to use with Tools like ParaView
16 /****************************************************************************/
17 #ifndef MSVTKExport_h
18 #define MSVTKExport_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <utils/common/SUMOTime.h>
27 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class OutputDevice;
33 class MSEdgeControl;
34 class MSEdge;
35 class MSLane;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
41 /**
42  * @class MSVTKExport
43  * @brief Produce a VTK output to use with Tools like ParaView
44  *
45  *  The class offers a static method, which writes VTK Files for each timestep
46  *  of the simulation, where at least one vehicle is present.
47  *
48  * @todo
49  */
50 class MSVTKExport {
51 public:
52     /** @brief Produce a VTK output to use with Tools like ParaView
53      *
54      * @param[in] of The output device to use
55      * @param[in] ec The EdgeControl which holds the edges to write
56      * @param[in] timestep The current time step
57      * @exception IOError If an error on writing occurs (!!! not yet implemented)
58      */
59     static void write(OutputDevice& of, SUMOTime timestep);
60 
61 private:
62     /// @brief Invalidated copy constructor.
63     MSVTKExport(const MSVTKExport&);
64 
65     /// @brief Invalidated assignment operator.
66     MSVTKExport& operator=(const MSVTKExport&);
67 
68     /// @brief Deletes the whitespaces at the end of a String
69     static std::string trim(std::string istring);
70 
71     /// @brief Checks if there is a whitespace
72     static bool ctype_space(const char c);
73 
74     /// @brief Get a comma separated String from a Vector
75     static std::string List2String(std::vector<double> input);
76 
77     /// @brief Get a Vector with the speed values of each vehicle in the actual timestep
78     static std::vector<double> getSpeed();
79 
80     /// @brief Get a Vector of the Positions (x,y,z) of each vehicle in the actual timestep
81     static std::vector<double> getPositions();
82 
83     /// @brief Get a String with the indexes of all vehicles (needed in the VTk File)
84     static std::string getOffset(int nr);
85 
86 };
87 
88 
89 #endif
90 
91 /****************************************************************************/
92