/****************************************************************************/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 GUIInductLoop.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Sascha Krieg17/// @author Michael Behrisch18/// @date Aug 200319///20// The gui-version of the MSInductLoop, together with the according21/****************************************************************************/22#pragma once23#include <config.h>2425#include <utils/foxtools/fxheader.h>26#include <microsim/output/MSInductLoop.h>27#include <utils/geom/Position.h>28#include "GUIDetectorWrapper.h"293031// ===========================================================================32// class definitions33// ===========================================================================34/**35* @class GUIInductLoop36* @brief The gui-version of the MSInductLoop.37*38* Allows the building of a wrapper (also declared herein) which draws the39* detector on the gl-canvas. Uses a mutex to avoid parallel read/write operations.40* The mutex is only set within methods that change MSInductLoop-internal state41* and within "collectVehiclesOnDet". All other reading operations should be performed42* via the simulation loop only.43*/44class GUIInductLoop : public MSInductLoop {45public:46/**47* @brief Constructor.48* @param[in] id Unique id49* @param[in] lane Lane where detector woks on50* @param[in] position Position of the detector within the lane51* @param[in] vTypes which vehicle types are considered52*/53GUIInductLoop(const std::string& id, MSLane* const lane, double position, double length,54std::string name, const std::string& vTypes,55const std::string& nextEdges,56int detectPersons, bool show);575859/// @brief Destructor60~GUIInductLoop();6162/** @brief Returns this detector's visualisation-wrapper63* @return The wrapper representing the detector64*/65virtual GUIDetectorWrapper* buildDetectorGUIRepresentation();6667/// @brief sets special caller for myWrapper68void setSpecialColor(const RGBColor* color);6970/// @brief whether the induction loop shall be visible71bool isVisible() const {72return myShow;73}7475/// @brief toggle visibility76void setVisible(bool show) {77myShow = show;78}7980public:81/**82* @class GUIInductLoop::MyWrapper83* @brief A MSInductLoop-visualiser84*/85class MyWrapper : public GUIDetectorWrapper {8687public:88/// @brief Constructor89MyWrapper(GUIInductLoop& detector, double pos);9091/// @brief Destructor92~MyWrapper();9394/// @name inherited from GUIGlObject95//@{9697/** @brief Returns an own parameter window98*99* @param[in] app The application needed to build the parameter window100* @param[in] parent The parent window needed to build the parameter window101* @return The built parameter window102* @see GUIGlObject::getParameterWindow103*/104GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;105106/** @brief Returns the boundary to which the view shall be centered in order to show the object107*108* @return The boundary the object is within109* @see GUIGlObject::getCenteringBoundary110*/111Boundary getCenteringBoundary() const override;112113/** @brief Draws the object114* @param[in] s The settings for the current view (may influence drawing)115* @see GUIGlObject::drawGL116*/117void drawGL(const GUIVisualizationSettings& s) const override;118//@}119120/// @brief set (outline) color for extra visualization121void setSpecialColor(const RGBColor* color) {122mySpecialColor = color;123}124125protected:126/// @brief whether this detector has an active virtual detector call127bool haveOverride() const override;128129/// @brief toggle virtual detector call130void toggleOverride() const override;131132private:133/// @brief The wrapped detector134GUIInductLoop& myDetector;135136/// @brief The detector's boundary137Boundary myBoundary;138139/// @brief The rotations of the shape parts140std::vector<double> myFGShapeRotations;141142/// @brief The lengths of the shape parts143std::vector<double> myFGShapeLengths;144145/// @brief The shape146PositionVector myFGShape;147148/// @brief The position in full-geometry mode149Position myFGPosition;150151/// @brief The rotation in full-geometry mode152double myFGRotation;153154PositionVector myOutline;155PositionVector myIndicators;156157/// @brief The position on the lane158double myPosition;159160/// @brief Whether this detector has defined a length161bool myHaveLength;162163/// @brief color for extra visualization164const RGBColor* mySpecialColor;165166private:167void setOutlineColor() const;168169private:170/// @brief Invalidated copy constructor.171MyWrapper(const MyWrapper&);172173/// @brief Invalidated assignment operator.174MyWrapper& operator=(const MyWrapper&);175176};177178private:179180/// @brief the glObject wrapper for this induction loop181MyWrapper* myWrapper;182183/// @brief whether this induction loop shall be visible in the gui184bool myShow;185186};187188189