SPH
TimeLine.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "gui/Controller.h"
4 #include "io/FileSystem.h"
5 #include "thread/CheckFunction.h"
6 #include <map>
7 #include <wx/dcclient.h>
8 #include <wx/panel.h>
9 #include <wx/sizer.h>
10 
12 
13 std::map<int, Path> getSequenceFiles(const Path& inputPath);
14 
16 public:
17  virtual void frameChanged(const Path& newFile) const = 0;
18 
19  virtual void startSequence(const Path& firstFile) const = 0;
20 
21  virtual void stop() const = 0;
22 
23  virtual void pause() const = 0;
24 };
25 
26 
27 class TimeLinePanel : public wxPanel {
28 private:
30 
31  std::map<int, Path> fileMap;
32  int currentFrame = 0;
33  int mouseFrame = 0;
34 
35 public:
36  TimeLinePanel(wxWindow* parent, const Path& inputFile, SharedPtr<ITimeLineCallbacks> callbacks);
37 
38  void update(const Path& inputFile);
39 
40  void setFrame(const Size newFrame);
41 
42  void setNext();
43 
44  void setPrevious();
45 
46  void startSequence();
47 
48 private:
49  int positionToFrame(const wxPoint position) const;
50 
51  void reload();
52 
53  void onPaint(wxPaintEvent& evt);
54 
55  void onMouseMotion(wxMouseEvent& evt);
56 
57  void onLeftClick(wxMouseEvent& evt);
58 
59  void onKeyUp(wxKeyEvent& evt);
60 };
61 
62 class TimeLine : public wxPanel {
63 private:
64  TimeLinePanel* timeline;
65 
66 public:
67  TimeLine(wxWindow* parent, const Path& inputFile, SharedPtr<ITimeLineCallbacks> callbacks);
68 
69  void update(const Path& inputFile) {
70  timeline->update(inputFile);
71  }
72 
73  void setFrame(const Size newFrame) {
74  timeline->setFrame(newFrame);
75  }
76 };
77 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
Helper functions to check the internal consistency of the code.
uint32_t Size
Integral type used to index arrays (by default).
Definition: Globals.h:16
#define NAMESPACE_SPH_END
Definition: Object.h:12
NAMESPACE_SPH_BEGIN std::map< int, Path > getSequenceFiles(const Path &inputPath)
Definition: TimeLine.cpp:7
virtual void pause() const =0
virtual void startSequence(const Path &firstFile) const =0
virtual void frameChanged(const Path &newFile) const =0
virtual void stop() const =0
Object representing a path on a filesystem.
Definition: Path.h:17
void startSequence()
Definition: TimeLine.cpp:89
void setPrevious()
Definition: TimeLine.cpp:79
void setFrame(const Size newFrame)
Definition: TimeLine.cpp:74
void setNext()
Definition: TimeLine.cpp:93
TimeLinePanel(wxWindow *parent, const Path &inputFile, SharedPtr< ITimeLineCallbacks > callbacks)
Definition: TimeLine.cpp:42
void update(const Path &inputFile)
Definition: TimeLine.cpp:55
TimeLine(wxWindow *parent, const Path &inputFile, SharedPtr< ITimeLineCallbacks > callbacks)
Definition: TimeLine.cpp:255
void setFrame(const Size newFrame)
Definition: TimeLine.h:73
void update(const Path &inputFile)
Definition: TimeLine.h:69
Vector position(const Float a, const Float e, const Float u)
Computes the position on the elliptic trajectory.
Definition: TwoBody.cpp:82
Base class for all polymorphic objects.
Definition: Object.h:88