|
|
57bda0 |
|
|
|
57bda0 |
#ifndef SIMULATOR_H
|
|
|
57bda0 |
#define SIMULATOR_H
|
|
|
57bda0 |
|
|
|
57bda0 |
|
|
|
57bda0 |
#include <algorithm></algorithm>
|
|
|
57bda0 |
|
|
|
57bda0 |
#include "track.h"
|
|
|
57bda0 |
#include "raster.h"
|
|
|
d2b2b5 |
#include "tool.h"
|
|
|
57bda0 |
|
|
|
57bda0 |
|
|
|
57bda0 |
class Simulator {
|
|
|
57bda0 |
public:
|
|
|
57bda0 |
virtual ~Simulator() { }
|
|
|
d2b2b5 |
virtual void simulate(const Track &track, const Tool &tool) = 0;
|
|
|
57bda0 |
virtual void scroll_to(int index) = 0;
|
|
|
57bda0 |
virtual void draw() const = 0;
|
|
|
57bda0 |
};
|
|
|
57bda0 |
|
|
|
57bda0 |
|
|
|
0a0ecd |
class SimulatorXYZ: public Simulator {
|
|
|
0a0ecd |
private:
|
|
|
0a0ecd |
TouchPointList points;
|
|
|
0a0ecd |
int simu_index;
|
|
|
0a0ecd |
|
|
|
0a0ecd |
public:
|
|
|
0a0ecd |
FlatRaster raster;
|
|
|
0a0ecd |
|
|
|
0a0ecd |
explicit SimulatorXYZ(int xpixels = 0, int ypixels = 0):
|
|
|
0a0ecd |
simu_index(), raster(xpixels, ypixels, 0, 0, 0, 0, 0, 0) { }
|
|
|
0a0ecd |
|
|
|
0a0ecd |
const TouchPointList& get_points() const { return points; }
|
|
|
0a0ecd |
int get_simu_index() const { return simu_index; }
|
|
|
0a0ecd |
int get_index() const { return simu_index <= 0 ? -1 : points[simu_index-1].index; }
|
|
|
0a0ecd |
|
|
|
0a0ecd |
void simulate(const Track &track, const Tool &tool) override;
|
|
|
0a0ecd |
void scroll_to(int index) override;
|
|
|
0a0ecd |
void draw() const override
|
|
|
0a0ecd |
{ raster.draw(); }
|
|
|
0a0ecd |
};
|
|
|
0a0ecd |
|
|
|
0a0ecd |
|
|
|
57bda0 |
class SimulatorXYZA: public Simulator {
|
|
|
57bda0 |
private:
|
|
|
57bda0 |
TouchPointList points;
|
|
|
57bda0 |
int simu_index;
|
|
|
57bda0 |
|
|
|
57bda0 |
public:
|
|
|
d2b2b5 |
PolarRaster raster;
|
|
|
57bda0 |
|
|
|
d2b2b5 |
explicit SimulatorXYZA(int xpixels = 0, int ypixels = 0):
|
|
|
d2b2b5 |
simu_index(), raster(xpixels, ypixels, 0, 0, 0, 0) { }
|
|
|
57bda0 |
|
|
|
57bda0 |
const TouchPointList& get_points() const { return points; }
|
|
|
57bda0 |
int get_simu_index() const { return simu_index; }
|
|
|
57bda0 |
int get_index() const { return simu_index <= 0 ? -1 : points[simu_index-1].index; }
|
|
|
57bda0 |
|
|
|
d2b2b5 |
void simulate(const Track &track, const Tool &tool) override;
|
|
|
d2b2b5 |
void scroll_to(int index) override;
|
|
|
d2b2b5 |
void draw() const override
|
|
|
d2b2b5 |
{ raster.draw(); }
|
|
|
57bda0 |
};
|
|
|
57bda0 |
|
|
|
57bda0 |
|
|
|
57bda0 |
#endif
|