 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
50 return mySelected.count(
id) > 0;
56 mySelected.insert(
id);
78 const std::set<GUIGlID>&
150 throw ProcessError(
"Unkown object in GUISelectedStorage::toggleSelection (id=" +
toString(
id) +
").");
163 const std::set<GUIGlID>&
169 const std::set<GUIGlID>&
177 for (std::map<GUIGlObjectType, SingleTypeSelections>::iterator it =
mySelections.begin(); it !=
mySelections.end(); it++) {
189 std::set<GUIGlID> result;
190 std::ostringstream msg;
191 std::ifstream strm(filename.c_str());
195 msgOut =
"Could not open '" + filename +
"'.\n";
198 while (strm.good()) {
201 if (line.length() == 0) {
209 if (numIgnored + numMissing <= maxErrors) {
210 msg <<
"Ignoring item '" << line <<
"' because of invalid type " <<
toString(object->
getType()) <<
"\n";
213 result.insert(object->
getGlID());
217 if (numIgnored + numMissing <= maxErrors) {
218 msg <<
"Item '" + line +
"' not found\n";
224 if (numIgnored + numMissing > maxErrors) {
225 msg <<
"...\n" << numIgnored <<
" objects ignored, " << numMissing <<
" objects not found\n";
235 const std::set<GUIGlID> ids =
loadIDs(filename, errors, type);
236 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
273 for (std::set<GUIGlID>::const_iterator i = ids.begin(); i != ids.end(); ++i) {
275 if (
object !=
nullptr) {
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void select(GUIGlID id)
Adds the object with the given id to the list of selected objects.
SingleTypeSelections()
Constructor.
virtual void selectionUpdated()=0
called when selection is updated
Static storage of an output device and its base (abstract) implementation.
void save(GUIGlObjectType type, const std::string &filename)
Saves a selection list.
void clear()
Clears the list of selected objects.
void save(const std::string &filename)
Saves the list of selected objects to a file named as given.
std::map< GUIGlObjectType, SingleTypeSelections > mySelections
map with the selections
std::set< GUIGlID > loadIDs(const std::string &filename, std::string &msgOut, GUIGlObjectType type=GLO_MAX, int maxErrors=16)
Loads a selection list (optionally with restricted type) and returns the ids of all active objects.
const std::string & getFullName() const
void close()
Closes the device and removes it from the dictionary.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX)
Loads a selection list (optionally with restricted type)
~SingleTypeSelections()
Destructor.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
GUIGlID getGlID() const
Returns the numerical id of the object.
void remove2Update()
Removes the dialog to be updated.
std::set< GUIGlID > myAllSelected
List of selected objects.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
const std::set< GUIGlID > & getSelected() const
Returns the list of selected ids.
bool isSelected(const GUIGlObject *o)
void clear()
Clears the list of selected objects.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
bool isSelected(GUIGlID id)
Returns the information whether the object with the given id is qithin the selection.
GUISelectedStorage()
Constructor.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
UpdateTarget * myUpdateTarget
The dialog to be updated.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
void toggleSelection(GUIGlID id)
Toggles selection of an object.
~GUISelectedStorage()
Destructor.
void deselect(GUIGlID id)
Deselects the object with the given id from the list of selected objects.
void deselect(GUIGlID id)
Deselects the object with the given id.
void add2Update(UpdateTarget *updateTarget)
Adds a dialog to be updated.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.