Path: blob/main/src/netedit/frames/network/GNEShapeFrame.h
169686 views
/****************************************************************************/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 GNEShapeFrame.h14/// @author Pablo Alvarez Lopez15/// @date Aug 201716///17// The Widget for add polygons18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/frames/GNEFrame.h>2324// ===========================================================================25// class declaration26// ===========================================================================2728class GNEAttributesEditor;29class GNETagSelector;30class GNEDrawingShape;3132// ===========================================================================33// class definitions34// ===========================================================================3536class GNEShapeFrame : public GNEFrame {3738public:3940// ===========================================================================41// class GEOPOICreator42// ===========================================================================4344class GEOPOICreator : public MFXGroupBoxModule {45/// @brief FOX-declaration46FXDECLARE(GNEShapeFrame::GEOPOICreator)4748public:49/// @brief constructor50GEOPOICreator(GNEShapeFrame* polygonFrameParent);5152/// @brief destructor53~GEOPOICreator();5455/// @brief Show list of GEOPOICreator Module56void showGEOPOICreatorModule();5758/// @brief hide GEOPOICreator Module59void hideGEOPOICreatorModule();6061/// @name FOX-callbacks62/// @{63/// @brief called when user change the coordinates TextField64long onCmdSetCoordinates(FXObject*, FXSelector, void*);6566/// @brief called when user select a format radio button67long onCmdSetFormat(FXObject*, FXSelector, void*);6869/// @brief called when user type in search box70long onCmdCreateGEOPOI(FXObject*, FXSelector, void*);71/// @}7273protected:74FOX_CONSTRUCTOR(GEOPOICreator)7576private:77/// @brief pointer to Shape frame parent78GNEShapeFrame* myShapeFrameParent;7980/// @brief radio button for the configuration lon-lat81FXRadioButton* myLonLatRadioButton;8283/// @brief radio button for the configuration lat-lon84FXRadioButton* myLatLonRadioButton;8586/// @brief text field for given geo coordinates87FXTextField* myCoordinatesTextField;8889/// @brief button for enable or disable certer view after creation of GEO POI90FXCheckButton* myCenterViewAfterCreationCheckButton;9192/// @brief button for create GEO Coordinates93FXButton* myCreateGEOPOIButton;9495/// @brief FXLabel for the equivalent position of GEO Position in Cartesian Position96FXLabel* myLabelCartesianPosition;97};9899/**@brief Constructor100* @brief viewParent GNEViewParent in which this GNEFrame is placed101* @brief viewNet viewNet that uses this GNEFrame102*/103GNEShapeFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);104105/// @brief Destructor106~GNEShapeFrame();107108/// @brief show Frame109void show();110111/**@brief process click over Viewnet112* @param[in] clickedPosition clicked position over ViewNet113* @param[in] viewObjects objects under cursor after click over view114* @return AddShapeStatus with the result of operation115*/116bool processClick(const Position& clickedPosition, const GNEViewNetHelper::ViewObjectsSelector& viewObjects, bool& updateTemporalShape);117118/// @brief get list of selecte id's in string format119static std::string getIdsSelected(const FXList* list);120121/// @brief get drawing mode editor122GNEDrawingShape* getDrawingShapeModule() const;123124protected:125/// @brief SumoBaseObject used for create shape126CommonXMLStructure::SumoBaseObject* myBaseShape;127128// @brief create baseShapeObject129void createBaseShapeObject(const SumoXMLTag shapeTag);130131/**@brief build a shaped element using the drawed shape132* return true if was successfully created133* @note called when user stop drawing polygon134*/135bool shapeDrawed();136137/// @brief Tag selected in GNETagSelector138void tagSelected();139140/// @brief process click for Polygons141bool processClickPolygons(const Position& clickedPosition, bool& updateTemporalShape);142143/// @brief process click for POIs over view144bool processClickPOI(SumoXMLTag POITag, const Position& clickedPosition);145146/// @brief process click for POIGeo147bool processClickPOIGeo(const Position& clickedPosition);148149/// @brief process click for POILanes150bool processClickPOILanes(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);151152private:153/// @brief shape tag selector154GNETagSelector* myShapeTagSelector;155156/// @brief shape attributes editor157GNEAttributesEditor* myShapeAttributesEditor = nullptr;158159/// @brief Drawing shape160GNEDrawingShape* myDrawingShape = nullptr;161162/// @brief GEOPOICreator163GEOPOICreator* myGEOPOICreator = nullptr;164};165166167