85 GUINet& net, FXGLVisual* glVis,
89 myTLSGame(
OptionsCont::getOptions().getString("game.mode") == "tls")
91 , myCurrentVideo(
nullptr)
106 for (std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i) {
116 "\tLocate Junction\tLocate a junction within the network.",
118 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
121 "\tLocate Street\tLocate a street within the network.",
123 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
127 "\tLocate Vehicle\tLocate a vehicle within the network.",
129 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
134 "\tLocate Vehicle\tLocate a person within the network.",
136 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
141 "\tLocate TLS\tLocate a tls within the network.",
143 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
146 "\tLocate Additional\tLocate an additional structure within the network.",
148 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
151 "\tLocate PoI\tLocate a PoI within the network.",
153 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
156 "\tLocate Polygon\tLocate a Polygon within the network.",
158 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
181 bool hide,
double hideThreshold) {
183 double minValue = std::numeric_limits<double>::infinity();
184 double maxValue = -std::numeric_limits<double>::infinity();
190 }
else if (active == 24) {
194 for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
197 minValue =
MIN2(minValue, val);
198 maxValue =
MAX2(maxValue, val);
200 const std::vector<MSLane*>& lanes = (*it)->getLanes();
201 for (std::vector<MSLane*>::const_iterator it_l = lanes.begin(); it_l != lanes.end(); it_l++) {
203 minValue =
MIN2(minValue, val);
204 maxValue =
MAX2(maxValue, val);
210 std::set<const MSJunction*> junctions;
212 junctions.insert(edge->getFromJunction());
213 junctions.insert(edge->getToJunction());
215 for (
const MSJunction* junction : junctions) {
216 minValue =
MIN2(minValue, junction->getPosition().z());
217 maxValue =
MAX2(maxValue, junction->getPosition().z());
224 std::set<SVCPermissions> codes;
226 for (
MSLane* lane : edge->getLanes()) {
227 codes.insert(lane->getPermissions());
230 int step =
MAX2(1, 360 / (
int)codes.size());
234 hue = (hue + step) % 360;
239 if (minValue != std::numeric_limits<double>::infinity()) {
243 minValue =
MAX2(hideThreshold + 1, minValue);
246 double range = maxValue - minValue;
258 std::vector<std::string>
263 return std::vector<std::string>();
267 std::vector<std::string>
269 std::set<std::string> keys;
272 for (
const auto& item : e->getParametersMap()) {
273 keys.insert(item.first);
276 for (
const auto lane : e->getLanes()) {
277 for (
const auto& item : lane->getParametersMap()) {
278 keys.insert(item.first);
283 return std::vector<std::string>(keys.begin(), keys.end());
293 glMatrixMode(GL_MODELVIEW);
295 glDisable(GL_TEXTURE_2D);
296 glDisable(GL_ALPHA_TEST);
298 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
299 glEnable(GL_DEPTH_TEST);
310 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
311 const float minB[2] = { (float)bound.
xmin(), (float)bound.
ymin() };
312 const float maxB[2] = { (float)bound.
xmax(), (float)bound.
ymax() };
314 glEnable(GL_POLYGON_OFFSET_FILL);
315 glEnable(GL_POLYGON_OFFSET_LINE);
319 glTranslated(0, 0, -.01);
325 glTranslated(0, 0, .01);
363 const std::vector<MSTrafficLightLogic*>& logics = tlsControl.
getAllLogics();
365 double minDist = std::numeric_limits<double>::infinity();
366 for (std::vector<MSTrafficLightLogic*>::const_iterator i = logics.begin(); i != logics.end(); ++i) {
372 if (lanes.size() > 0) {
373 const Position& endPos = lanes[0]->getShape().back();
381 if (minTll !=
nullptr) {
383 const std::vector<MSTrafficLightLogic*> logics = vars.
getAllLogics();
384 if (logics.size() > 1) {
386 for (
int i = 0; i < (int)logics.size() - 1; ++i) {
387 if (minTll->
getProgramID() == logics[i]->getProgramID()) {
392 if (l == logics[0]) {
405 if (sel.size() == 0) {
407 double minDist = std::numeric_limits<double>::infinity();
417 if (dist < minDist) {
423 if (closest !=
nullptr) {
429 double minDist = std::numeric_limits<double>::infinity();
432 for (
auto it = stops.
begin(); it != stops.
end(); ++it) {
435 if (dist < minDist) {
440 if (closestStop != 0) {
458 if (sel.size() > 0) {
483 return dynamic_cast<GUILane*
>(o);
494 if (lane !=
nullptr) {
506 if (lane !=
nullptr) {
518 if (lane !=
nullptr) {
543 if (myCurrentVideo ==
nullptr) {
557 if (myCurrentVideo !=
nullptr) {
558 delete myCurrentVideo;
559 myCurrentVideo =
nullptr;
568 if (myCurrentVideo !=
nullptr) {
576 const std::vector<SUMOTime>
Locate junction - button.
void paintGLGrid()
paints a grid
static const RGBColor BLUE
show vehicle's current continued from the current position
double ymin() const
Returns minimum y-coordinate.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
double xmax() const
Returns maximum x-coordinate.
GUICompleteSchemeStorage gSchemeStorage
MSEdge & getEdge() const
Returns the lane's edge.
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
double scale
information about a lane's width (temporary, used for a single view)
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
Storage for all programs of a single tls.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
bool setColorScheme(const std::string &name)
set color scheme
const std::string & getName() const
A lane area vehicles can halt at.
void unlock()
release exclusive access to the simulation state
SUMORTree * myGrid
The visualization speed-up.
MSLane * getLane() const
Returns the lane the vehicle is on.
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb.htm.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
bool gaming
whether the application is in gaming mode or not
Locate addtional structure - button.
void onGamingRightClick(Position pos)
Stores the information about how to visualize structures.
The base class for an intersection.
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
const double SUMO_const_laneWidth
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
GUIMainWindow * myApp
The application.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
void writeFrame(uint8_t *buffer)
bool isActive(const MSTrafficLightLogic *tl) const
Returns whether the given tls program is the currently active for his tls.
static const RGBColor ORANGE
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
void lock()
grant exclusive access to the simulation state
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
const std::string & getID() const
Returns the id.
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
A map of named object pointers.
#define UNUSED_PARAMETER(x)
A class that stores a 2D geometrical boundary.
A fixed traffic light logic.
const LaneVector & getLanesAt(int i) const
Returns the list of lanes that are controlled by the signals at the given position.
std::map< const GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
Representation of a lane in the micro simulation (gui-version)
A class that stores and controls tls and switching of their programs.
A road/street connecting two junctions (gui-version)
A road/street connecting two junctions.
double getEndLanePosition() const
Returns the end position of this stop.
SUMOTime duration
The duration of the phase.
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
std::vector< MSTrafficLightLogic * > getAllLogics() const
static const RGBColor GREEN
Locate polygons - button.
int addColor(const T &color, const double threshold, const std::string &name="")
std::string name
The name of this setting.
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
const std::string & getProgramID() const
Returns this tl-logic's id.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
A point in 2D or 3D with translation and scaling methods.
long onCmdAddRerouter(FXObject *, FXSelector, void *)
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
long onCmdCloseEdge(FXObject *, FXSelector, void *)
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
bool myTLSGame
whether game mode was set to 'tls'
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
static const std::string SCHEME_NAME_PERMISSION_CODE
GUIVisualizationSettings & get(const std::string &name)
Returns the named scheme.
bool isGaming() const
return whether the gui is in gaming mode
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static const RGBColor MAGENTA
double xmin() const
Returns minimum x-coordinate.
void onGamingClick(Position pos)
handle mouse click in gaming mode
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
A simple video encoder from RGBA pics to anything ffmpeg can handle.
void startTrack(int id)
Starts vehicle tracking.
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
virtual void checkSnapshots()
Checks whether it is time for a snapshot.
FXDEFMAP(GUIViewTraffic) GUIViewTrafficMap[]
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const
return list of available edge parameters
long onDoubleClicked(FXObject *, FXSelector, void *)
bool myUseToolTips
use tool tips
void checkSnapshots()
Checks whether it is time for a snapshot.
std::string line
The vehicle's line (mainly for public transport)
SUMOTime getCurrentTimeStep() const
get the current simulation time
A single child window which contains a view of the simulation area.
void endSnapshot()
Ends a video snapshot.
void buildColorRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, int active, GUIGlObjectType objectType, bool hide=false, double hideThreshold=0)
recalibrate color scheme according to the current value range
FXbool makeCurrent()
A reimplementation due to some internal reasons.
static const RGBColor YELLOW
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
static const RGBColor RED
named colors
double m2p(double meter) const
meter-to-pixels conversion method
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
static const RGBColor CYAN
GUIVisualizationSettings * myVisualizationSettings
visualization settings
A MSNet extended by some values for usage within the gui.
void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
virtual ~GUIViewTraffic()
destructor
int doPaintGL(int mode, const Boundary &bound)
paint GL
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
bool contains(const std::string &name) const
Returns the information whether a setting with the given name is stored.
A storage for options typed value containers)
static const GUIGlID INVALID_ID
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
void clear()
Clears the list of selected objects.
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
bool showGrid
Information whether a grid shall be shown.
void drawDecals()
Draws the stored decals.
FXComboBox * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world...
void addSnapshot(SUMOTime time, const std::string &file, const int width=-1, const int height=-1)
Sets the snapshot time to file map.
GUIGlID getGlID() const
Returns the numerical id of the object.
The parent class for traffic light logics.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void unblockObject(GUIGlID id)
Marks an object as unblocked.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
The class responsible for building and deletion of vehicles.
std::vector< MSEdge * > MSEdgeVector
const MSLane & getLane() const
Returns the lane this stop is located at.
GUIGlID getObjectUnderCursor()
returns the id of the front object under the cursor using GL_SELECT
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
double ymax() const
Returns maximum y-coordinate.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
GUISelectedStorage gSelected
A global holder of selected objects.
Representation of a lane in the micro simulation.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
void stopTrack()
Stops vehicle tracking.
GUILane * getLaneUnderCursor()
FXPopup * getLocatorPopup()
@ brief return a pointer to locator popup
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
A MSVehicle extended by some values for usage within the gui.