 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
51 return mySelected.count(
id) > 0;
57 mySelected.insert(
id);
79 const std::set<GUIGlID>&
151 throw ProcessError(
"Unkown object in GUISelectedStorage::toggleSelection (id=" +
toString(
id) +
").");
164 const std::set<GUIGlID>&
170 const std::set<GUIGlID>&
178 for (std::map<GUIGlObjectType, SingleTypeSelections>::iterator it =
mySelections.begin(); it !=
mySelections.end(); it++) {
190 std::set<GUIGlID> result;
191 std::ostringstream msg;
192 std::ifstream strm(filename.c_str());
196 msgOut =
"Could not open '" + filename +
"'.\n";
199 while (strm.good()) {
202 if (line.length() == 0) {
210 if (numIgnored + numMissing <= maxErrors) {
211 msg <<
"Ignoring item '" << line <<
"' because of invalid type " <<
toString(object->
getType()) <<
"\n";
214 result.insert(object->
getGlID());
218 if (numIgnored + numMissing <= maxErrors) {
219 msg <<
"Item '" + line +
"' not found\n";
225 if (numIgnored + numMissing > maxErrors) {
226 msg <<
"...\n" << numIgnored <<
" objects ignored, " << numMissing <<
" objects not found\n";
236 const std::set<GUIGlID> ids =
loadIDs(filename, errors, type);
237 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
274 for (std::set<GUIGlID>::const_iterator i = ids.begin(); i != ids.end(); ++i) {
276 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.