-
Notifications
You must be signed in to change notification settings - Fork 1
/
geos_perf_test_buffer2.c
59 lines (50 loc) · 1.49 KB
/
geos_perf_test_buffer2.c
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
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#include "geos_perf.h"
/*************************************************************************
* PERFORMANCE TEST
*/
/* Variables where data lives between the setup/run/cleanup stages */
static GEOSGeometryList australiaFile;
static GEOSGeometry *australia;
/* Read any data we need, and create any structures */
static void setup(void)
{
geomlist_init(&australiaFile);
read_data_file("australia.wkt.gz", &australiaFile);
/* takes ownership of just the first geometry */
australia = australiaFile.geoms[0];
/* gently free just the containing geomlist */
geomlist_release(&australiaFile);
}
/* For each run, union all the geometries in the collection */
static void run(void)
{
GEOSGeometry* buffer = GEOSBuffer(
australia, /* input geometry */
0.0001, /* buffer size */
24 /* quadsegs */
);
GEOSGeom_destroy(buffer);
}
/* Clean up any remaining memory */
static void cleanup(void)
{
GEOSGeom_destroy(australia);
}
/*************************************************************************
* CONFIGURATION CALLBACK FUNCTION
*/
gp_test config_buffer_australia(void)
{
gp_test test;
test.name = "Australia buffer";
test.description =
"Load a complex boundary of Australia with many"
"offshore islands and calculate buffer of"
"the multi-polygon.";
test.func_setup = setup;
test.func_run = run;
test.func_cleanup = cleanup;
test.count = 1;
return test;
}