forked from yocontra/node-gdal-next
-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathapi_circularstring.test.ts
39 lines (34 loc) · 1.13 KB
/
api_circularstring.test.ts
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
import { assert } from 'chai'
import * as gdal from 'gdal-async'
describe('gdal.CircularString', () => {
afterEach(() => void global.gc!())
it('should be instantiable', () => {
new gdal.CircularString()
})
it('should inherit from Curve', () => {
assert.instanceOf(new gdal.CircularString(), gdal.CircularString)
assert.instanceOf(new gdal.CircularString(), gdal.SimpleCurve)
assert.instanceOf(new gdal.CircularString(), gdal.Geometry)
})
describe('instance', () => {
it('should support getArea()', () => {
const arc: gdal.CircularString = new gdal.CircularString()
arc.points.add(-5, 0)
arc.points.add(0, 2.5)
arc.points.add(5, 0)
assert.closeTo(arc.getLength(), 11.5911, 0.001)
})
it('should support addSubLineString', () => {
const arc = new gdal.CircularString()
arc.points.add(-5, 0)
arc.points.add(0, 2.5)
arc.points.add(5, 0)
const line = new gdal.LineString()
line.points.add(0, 0, 0)
line.points.add(10, 10, 0)
line.points.add(10, 20, 0)
arc.addSubLineString(line)
assert.equal(arc.points.count(), 6)
})
})
})