64 FXIMPLEMENT(
GUIParameterTracker, FXMainWindow, GUIParameterTrackerMap, ARRAYNUMBER(GUIParameterTrackerMap))
71 const std::
string& name)
72 : FXMainWindow(app.getApp(), "Tracker", NULL, NULL, DECOR_ALL, 20, 20, 300, 200),
75 app.addChild(
this,
true);
76 FXVerticalFrame* glcanvasFrame =
new FXVerticalFrame(
this, FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
78 setTitle(name.c_str());
85 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
99 FXMainWindow::create();
110 new FXButton(
myToolBar,
"\t\tSave the data...",
138 return FXMainWindow::onConfigure(sender, sel, data);
145 return FXMainWindow::onPaint(sender, sel, data);
183 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
184 (*i1)->setAggregationSpan(
TIME2STEPS(aggInt));
199 std::vector<TrackerValueDesc*>::iterator i;
220 for (
int j = 0; j < max; j++) {
233 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
256 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*) 0, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 300, 200),
265 glMatrixMode(GL_PROJECTION);
267 glMatrixMode(GL_MODELVIEW);
269 glDisable(GL_TEXTURE_2D);
271 for (std::vector<TrackerValueDesc*>::iterator i = myParent->myTracked.begin(); i != myParent->myTracked.end(); i++) {
274 (
double) myWidthInPixels / (
double) myParent->myTracked.size() * (double) run);
283 const double fontWidth = 0.1 * 300. / myWidthInPixels;
284 const double fontHeight = 0.1 * 300. / myHeightInPixels;
290 glScaled(0.8, 0.8, 1);
292 double ys = (double) 2.0 / (
double) desc.
getRange();
293 glScaled(1.0, ys, 1.0);
303 glVertex2d(0, desc.
getMin());
304 glVertex2d(2.0, desc.
getMin());
307 glVertex2d(0, desc.
getMax());
308 glVertex2d(2.0, desc.
getMax());
310 glColor4ub(red, green, blue, 77);
311 for (
int a = 1; a < 6; a++) {
312 double ypos = (desc.
getRange()) / (
double) 6.0 * (double) a + desc.
getMin();
315 glVertex2d(2.0, ypos);
320 if (values.size() < 2) {
325 latest = values.back();
327 double xStep = (double) 2.0 / (
double) values.size();
328 std::vector<double>::const_iterator i = values.begin();
332 glColor4ub(red, green, blue, 255);
333 for (; i != values.end(); i++) {
335 double xn = xp + xStep;
348 glColor3b(red, green, blue);
353 double w = 50 / myWidthInPixels;
354 glTranslated(-0.8 - w / 2., -0.88, 0);
356 glTranslated(0.8 + w / 2., 0.88, 0);
359 glTranslated(0.75, -0.88, 0);
362 glTranslated(-0.75, 0.88, 0);
365 glTranslated(-0.98, -0.82, 0);
367 glTranslated(0.98, 0.82, 0);
370 glTranslated(-0.98, 0.78, 0);
372 glTranslated(0.98, -0.78, 0);
375 double p = (double) 0.8 -
377 glTranslated(-0.98, -(p + .02), 0);
379 glTranslated(0.98, p + .02, 0);
382 glTranslated(-0.98, .92, 0);
384 glTranslated(0.98, -.92, 0);
392 myWidthInPixels = myParent->getWidth();
393 myHeightInPixels = myParent->getHeight();
394 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
395 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
396 glClearColor(1.0, 1.0, 1.0, 1);
397 glDisable(GL_DEPTH_TEST);
398 glDisable(GL_LIGHTING);
399 glDisable(GL_LINE_SMOOTH);
401 glEnable(GL_ALPHA_TEST);
402 glDisable(GL_COLOR_MATERIAL);
404 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
419 myWidthInPixels = getWidth();
420 myHeightInPixels = getHeight();
421 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
422 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
423 glClearColor(1.0, 1.0, 1.0, 1);
424 glDisable(GL_DEPTH_TEST);
425 glDisable(GL_LIGHTING);
426 glDisable(GL_LINE_SMOOTH);
428 glEnable(GL_ALPHA_TEST);
429 glDisable(GL_COLOR_MATERIAL);
431 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
433 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
double getYCenter() const
Returns the center of the value.
void close()
Closes the device and removes it from the dictionary.
void drawValue(TrackerValueDesc &desc, double namePos)
Draws a single value.
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Change aggregation interval.
std::string time2string(SUMOTime t)
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
void unlockValues()
Releases the locking after the values have been drawn.
SUMOTime getRecordingBegin() const
Returns the timestep the recording started.
Representation of a timeline of floats with their names and moments.
FXString gCurrentFolder
The folder used as last.
unsigned char blue() const
Returns the blue-amount of the color.
static const RGBColor BLACK
long onCmdSave(FXObject *, FXSelector, void *)
Called when the data shall be saved.
GUIMainWindow * myApplication
The main application.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
FXToolBar * myToolBar
The tracker tool bar.
SUMOTime getAggregationSpan() const
get the aggregation amount
~GUIParameterTrackerPanel()
Destructor.
A window which displays the time line of one (or more) value(s)
FXToolBarShell * myToolBarDrag
for some menu detaching fun
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void drawValues()
Draws all values.
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
FXComboBox * myAggregationInterval
A combo box to select an aggregation interval.
A point in 2D or 3D with translation and scaling methods.
void buildToolBar()
Builds the tool bar.
#define GUIDesignComboBoxStatic
Combo box static (not editable)
void removeChild(FXMDIChild *child)
removes the given child window from the list
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
const std::vector< double > & getAggregatedValues()
returns the vector of aggregated values The values will be locked - no further addition will be perfo...
long onSimStep(FXObject *, FXSelector, void *)
Called on a simulation step.
void create()
Creates the window.
~GUIParameterTracker()
Destructor.
const std::string & getName() const
Returns the name of the value.
long onCmdChangeAggregation(FXObject *, FXSelector, void *)
Called when the aggregation interval (combo) has been changed.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
unsigned char green() const
Returns the green-amount of the color.
double getMax() const
Returns the values maximum.
std::vector< TrackerValueDesc * > myTracked
The list of tracked values.
GUIParameterTrackerPanel * myPanel
The panel to display the values in.
unsigned char red() const
Returns the red-amount of the color.
Static storage of an output device and its base (abstract) implementation.
const RGBColor & getColor() const
Returns the color to use to display the value.
A Simulation step was performed.
double getMin() const
Returns the values minimum.
#define GUIDesignToolBarShell3
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
std::vector< GLObjectValuePassConnector< double > * > myValuePassers
The value sources.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
double getRange() const
returns the maximum value range
FXDEFMAP(GUIParameterTracker) GUIParameterTrackerMap[]
Class passing values from a GUIGlObject to another object.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.