/****************************************************************************/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 GUIDottedGeometry.h14/// @author Pablo Alvarez Lopez15/// @date Oct 202116///17// File for dotted geometry classes and functions18/****************************************************************************/19#pragma once20#include <config.h>2122#include <utils/geom/PositionVector.h>23#include <utils/gui/settings/GUIVisualizationSettings.h>2425// ===========================================================================26// class definitions27// ===========================================================================2829class GUIDottedGeometry {3031public:32/// @enum for dotted cotour type33enum class DottedContourType {34INSPECT, // Inspecting element35REMOVE, // Mouse over element to remove36SELECT, // Mouse over element to select37MOVE, // Mouse over element to move38FRONT, // Element marked as "front element"39OVER, // Mouse over element (orange)40FROM, // Element marked as from (green)41TO, // Element marked as to (magenta)42RELATED, // Element marked as related (cyan)43WALKINGAREA, // Used if we're drawing walking areas in contour mode44NOTHING45};4647/// @brief class for pack all variables related with GUIDottedGeometry color48class DottedGeometryColor {4950public:51/// @brief constructor52DottedGeometryColor();5354/// @brief get inspected color (and change flag)55const RGBColor getColor(const GUIVisualizationSettings& settings, DottedContourType type);5657/// @brief change color58void changeColor();5960/// @brief rest Dotted Geometry Color61void reset();6263private:64/// @brief flag to get color65bool myColorFlag;6667/// @brief Invalidated assignment operator68DottedGeometryColor& operator=(const DottedGeometryColor& other) = delete;69};7071/// @brief dotted geometry segment72struct Segment {7374/// @brief default constructor75Segment();7677/// @brief constructor for a given shape78Segment(PositionVector newShape);7980/// @brief shape81PositionVector shape;8283/// @brief rotations84std::vector<double> rotations;8586/// @brief lengths87std::vector<double> lengths;88};8990/// @brief constructor91GUIDottedGeometry();9293/// @brief constructor for shapes94GUIDottedGeometry(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,95PositionVector shape, const bool closeShape);9697/// @brief update GUIDottedGeometry (using lane shape)98void updateDottedGeometry(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,99const PositionVector& laneShape);100101/// @brief update GUIDottedGeometry (using shape)102void updateDottedGeometry(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,103PositionVector shape, const bool closeShape);104105/// @brief draw dotted geometry106void drawDottedGeometry(const GUIVisualizationSettings& s, GUIDottedGeometry::DottedContourType type,107DottedGeometryColor& dottedGeometryColor, const double lineWidth, const bool addOffset) const;108109/// @brief draw innen geometry110void drawInnenGeometry(const double lineWidth) const;111112/// @brief move shape to side113void moveShapeToSide(const double value);114115/// @brief get front position116Position getFrontPosition() const;117118/// @brief get back position119Position getBackPosition() const;120121/// @brief get simple shape (the shape without resampling)122const PositionVector& getUnresampledShape() const;123124/// @brief clear dotted geometry125void clearDottedGeometry();126127private:128/// @brief calculate shape rotations and lengths129void calculateShapeRotationsAndLengths();130131/// @brief shape without resampling132PositionVector myUnresampledShape;133134/// @brief dotted element shape (note: It's centered in 0,0 due scaling)135std::vector<GUIDottedGeometry::Segment> myDottedGeometrySegments;136};137138139