-
Notifications
You must be signed in to change notification settings - Fork 0
/
SISurface.dart
49 lines (34 loc) · 1.3 KB
/
SISurface.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//Copyright Software By Numbers Ltd
#library('sbnl:space');
#import('Point.dart');
/**
* Models a piece of paper that allows SI units (well meters at the moment)
* to be drawn onto it.
*/
abstract class SIDrawingSurface {
abstract void drawOutline([bool yes]);
//Draws a line between two points
//@throws SIDrawingSurfaceException if the scale functions have not been set
abstract void drawLine(Point2D point1, Point2D point2);
/*
* Draws an x and y axis
*@throws SIDrawingSurfaceException if the scale functions have not been set
*/
abstract void drawXAxis(Point2D origin, num graticuleInterval, num startValue, [String units]);
abstract void drawYAxis(Point2D origin, num graticuleInterval, num startValue, [String units]);
/*
* Draws axis.
*/
abstract void drawNewXAxis();
/*
* These set the scale functions
*/
abstract void setScaleUnitsToPixels(ScaleUnitsToPixels scaleXUnitsToPixels, ScaleUnitsToPixels scaleYUnitsToPixels);
abstract void setScalePixelsToUnits(ScalePixelsToUnits scaleXPixelsToUnits, ScalePixelsToUnits scaleYPixelsToUnits);
}
class SIDrawingSurfaceException implements Exception {
}
//scales a pixel count to an si unit quantity
typedef num ScalePixelsToUnits(int pixels);
//scales si units to pixels
typedef int ScaleUnitsToPixels(num unit);