SUMO - Simulation of Urban MObility
GNEDialogACChooser.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Class for the window that allows to choose a street, junction or vehicle
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 
23 #include <config.h>
24 
25 #include <string>
26 #include <vector>
27 #include <fxkeys.h>
37 #include <netedit/GNENet.h>
38 #include <netedit/GNEViewNet.h>
40 #include <netedit/GNEViewParent.h>
41 
42 #include "GNEDialogACChooser.h"
43 
44 
45 // ===========================================================================
46 // method definitions
47 // ===========================================================================
48 
49 GNEDialogACChooser::GNEDialogACChooser(GNEViewParent* viewParent, FXIcon* icon, const std::string& title, const std::vector<GNEAttributeCarrier*>& ACs):
50  GUIDialog_GLObjChooser(viewParent, icon, title.c_str(), getGLIds(ACs), GUIGlObjectStorage::gIDStorage),
51  myACs(ACs),
52  myViewParent(viewParent) {
53 }
54 
55 
58 }
59 
60 
61 void
63  GNEAttributeCarrier* ac = myACs[listIndex];
64  if (ac->isAttributeCarrierSelected()) {
66  } else {
68  }
69 }
70 
71 
72 std::vector<GUIGlID>
73 GNEDialogACChooser::getGLIds(const std::vector<GNEAttributeCarrier*>& ACs) {
74  std::vector<GUIGlID> ids;
75  for (auto ac : ACs) {
76  ids.push_back(dynamic_cast<GUIGlObject*>(ac)->getGlID());
77  }
78  return ids;
79 }
80 
81 /****************************************************************************/
82 
virtual void selectAttributeCarrier(bool changeFlag=true)=0
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:70
void toggleSelection(int listIndex)
toggle selection (handled differently in NETEDIT)
~GNEDialogACChooser()
Destructor.
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
std::vector< GUIGlID > getGLIds(const std::vector< GNEAttributeCarrier *> &ACs)
brief get glID for every AC
A storage for of displayed objects via their numerical id.
GNEDialogACChooser()
FOX needs this.
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
void eraseACChooserDialog(GNEDialogACChooser *chooserDialog)
remove created chooser dialog
std::vector< GNEAttributeCarrier * > myACs
list of displayed ACs
GNEViewParent * myViewParent