Path: blob/main/src/netedit/elements/GNEGeneralHandler.h
193964 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 GNEGeneralHandler.h14/// @author Pablo Alvarez Lopez15/// @date Sep 202116///17// General element handler for netedit18/****************************************************************************/19#pragma once20#include <config.h>212223// ===========================================================================24// included modules25// ===========================================================================2627#include <utils/handlers/GeneralHandler.h>28#include <netedit/elements/additional/GNEAdditionalHandler.h>29#include <netedit/elements/demand/GNERouteHandler.h>30#include <netedit/elements/data/GNEMeanDataHandler.h>3132// ===========================================================================33// class declarations34// ===========================================================================35class GNENet;3637// ===========================================================================38// class definitions39// ===========================================================================4041class GNEGeneralHandler : public GeneralHandler {4243public:44/**@brief Constructor45* @param[in] net GNENet46* @param[in] bucket fileBucket in which save the loaded47* @param[in] allowUndoRedo enable or disable undoRedo48*/49GNEGeneralHandler(GNENet* net, FileBucket* bucket, const bool allowUndoRedo);5051/// @brief Destructor52~GNEGeneralHandler();5354/// @brief force overwritte elements (used if we're reloading elements)55void forceOverwriteElements();5657/// @brief get flag for check if a element wasn't created58bool isErrorCreatingElement() const;5960/// @brief check if the parser file is a additional file61bool isAdditionalFile() const;6263/// @brief check if the parser file is a route file64bool isRouteFile() const;6566/// @brief check if the parser file is a meanData file67bool isMeanDataFile() const;6869private:70/// @brief tagType71struct TagType {7273enum class Type {74NONE,75NETWORK,76ADDITIONAL,77DEMAND,78DATA,79MEANDATA,80};8182/// @brief constructor83TagType(SumoXMLTag tag, Type type);8485/// @brief is network element86bool isNetwork() const;8788/// @brief is network element89bool isAdditional() const;9091/// @brief is network element92bool isDemand() const;9394/// @brief is network element95bool isData() const;9697/// @brief is network element98bool isMeanData() const;99100/// @brief tag related with this TagType101const SumoXMLTag tag;102103private:104/// @brief tag type105const Type myType;106};107108/// @brief queue with the inserted tags109std::list<TagType> myQueue;110111/// @brief additional handler112GNEAdditionalHandler myAdditionalHandler;113114/// @brief demand handler115GNERouteHandler myDemandHandler;116117/// @brief meanData handler118GNEMeanDataHandler myMeanDataHandler;119120/// @brief flag for set file type121TagType::Type fileType = TagType::Type::NONE;122123/// @brief start element124void beginTag(SumoXMLTag tag, const SUMOSAXAttributes& attrs);125126/// @brief end element127void endTag();128129/// @brief invalidate copy constructor130GNEGeneralHandler(const GNEGeneralHandler& s) = delete;131132/// @brief invalidate assignment operator133GNEGeneralHandler& operator=(const GNEGeneralHandler& s) = delete;134};135136/****************************************************************************/137138139