librtree 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/README.md +4 -4
- data/ext/rtree/extconf.rb +18 -3
- data/ext/rtree/lib/bindex.c +2 -1
- data/ext/rtree/lib/branch.c +2 -1
- data/ext/rtree/lib/branches.c +2 -2
- data/ext/rtree/lib/bsrt.c +8 -18
- data/ext/rtree/lib/csv.c +3 -1
- data/ext/rtree/lib/error.c +2 -2
- data/ext/rtree/lib/json.c +6 -3
- data/ext/rtree/lib/mk/Hdr.mk +3 -3
- data/ext/rtree/lib/node.c +34 -34
- data/ext/rtree/lib/package.c +1 -1
- data/ext/rtree/lib/page.c +1 -1
- data/ext/rtree/lib/postscript.c +20 -16
- data/ext/rtree/lib/{bindex.h → private/bindex.h} +3 -8
- data/ext/rtree/lib/{bounds.h → private/bounds.h} +3 -3
- data/ext/rtree/lib/{rtree → private}/branch.h +10 -17
- data/ext/rtree/lib/{rtree → private}/branches.h +8 -14
- data/ext/rtree/lib/{bsrt.h → private/bsrt.h} +5 -5
- data/ext/rtree/lib/{constants.h → private/constants.h} +3 -3
- data/ext/rtree/lib/{csv.h → private/csv.h} +5 -5
- data/ext/rtree/lib/{endianness.h → private/endianness.h} +4 -8
- data/ext/rtree/lib/{json.h → private/json.h} +5 -5
- data/ext/rtree/lib/private/node.h +86 -0
- data/ext/rtree/lib/private/page.h +13 -0
- data/ext/rtree/lib/private/postscript.h +17 -0
- data/ext/rtree/lib/{rtree → private}/rect.h +6 -14
- data/ext/rtree/lib/{rtree → private}/rectf.h +3 -14
- data/ext/rtree/lib/private/rtree.h +20 -0
- data/ext/rtree/lib/private/search.h +20 -0
- data/ext/rtree/lib/private/split.h +15 -0
- data/ext/rtree/lib/{spvol.h → private/spvol.h} +3 -3
- data/ext/rtree/lib/private/state.h +91 -0
- data/ext/rtree/lib/rect.c +4 -1
- data/ext/rtree/lib/rectf.c +1 -1
- data/ext/rtree/lib/rtree/node.h +0 -75
- data/ext/rtree/lib/rtree/postscript.h +19 -21
- data/ext/rtree/lib/rtree/search.h +0 -6
- data/ext/rtree/lib/rtree/state.h +0 -79
- data/ext/rtree/lib/rtree-base.c +64 -4
- data/ext/rtree/lib/rtree.h +7 -11
- data/ext/rtree/lib/search.c +4 -3
- data/ext/rtree/lib/split.c +9 -6
- data/ext/rtree/lib/spvol.c +1 -1
- data/ext/rtree/lib/state.c +7 -7
- data/ext/rtree/rtree.c +18 -18
- data/lib/rtree.rb +2 -8
- metadata +38 -19
- data/ext/rtree/lib/page.h +0 -13
- data/ext/rtree/lib/split.h +0 -15
@@ -1,16 +1,16 @@
|
|
1
1
|
/*
|
2
|
-
csv.h
|
2
|
+
private/csv.h
|
3
3
|
Copyright (c) J.J. Green 2020
|
4
4
|
*/
|
5
5
|
|
6
|
-
#ifndef
|
7
|
-
#define
|
8
|
-
|
9
|
-
#include <stdio.h>
|
6
|
+
#ifndef PRIVATE_CSV_H
|
7
|
+
#define PRIVATE_CSV_H
|
10
8
|
|
11
9
|
#include <rtree.h>
|
12
10
|
#include <rtree/state.h>
|
13
11
|
|
12
|
+
#include <stdio.h>
|
13
|
+
|
14
14
|
rtree_t* csv_rtree_read(FILE*, size_t, state_flags_t);
|
15
15
|
|
16
16
|
#endif
|
@@ -1,9 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
|
3
|
-
|
4
|
-
This is an "internal" header, it is not used by any public headers
|
5
|
-
and not installed; it handles the messing around that you need to
|
6
|
-
do to get endinannes functions even close to portable.
|
2
|
+
private/endianness.h
|
7
3
|
|
8
4
|
This is largely from https://github.com/mikepb/endian.h which is
|
9
5
|
based on a Gist by Mathias Panzenböck, those are both released into
|
@@ -19,11 +15,11 @@
|
|
19
15
|
Copyright (c) J.J. Green 2020
|
20
16
|
*/
|
21
17
|
|
22
|
-
#ifndef
|
23
|
-
#define
|
18
|
+
#ifndef PRIVATE_ENDIANNESS_H
|
19
|
+
#define PRIVATE_ENDIANNESS_H
|
24
20
|
|
25
21
|
#ifdef HAVE_CONFIG_H
|
26
|
-
#include
|
22
|
+
#include <config.h>
|
27
23
|
#endif
|
28
24
|
|
29
25
|
#if defined HAVE_ENDIAN_H
|
@@ -1,15 +1,15 @@
|
|
1
1
|
/*
|
2
|
-
json.h
|
2
|
+
private/json.h
|
3
3
|
Copyright (c) J.J. Green 2019
|
4
4
|
*/
|
5
5
|
|
6
|
-
#ifndef
|
7
|
-
#define
|
8
|
-
|
9
|
-
#include <stdio.h>
|
6
|
+
#ifndef PRIVATE_JSON_H
|
7
|
+
#define PRIVATE_JSON_H
|
10
8
|
|
11
9
|
#include <rtree.h>
|
12
10
|
|
11
|
+
#include <stdio.h>
|
12
|
+
|
13
13
|
int json_rtree_write(const rtree_t*, FILE*);
|
14
14
|
rtree_t* json_rtree_read(FILE*);
|
15
15
|
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/*
|
2
|
+
node.h
|
3
|
+
Copyright (c) J.J. Green 2023
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef NODE_H
|
7
|
+
#define NODE_H
|
8
|
+
|
9
|
+
#include <stdint.h>
|
10
|
+
#include <stdbool.h>
|
11
|
+
#include <stddef.h>
|
12
|
+
|
13
|
+
typedef uint16_t node_level_t;
|
14
|
+
typedef uint16_t node_count_t;
|
15
|
+
typedef uint16_t node_height_t;
|
16
|
+
|
17
|
+
#define NODE_LEVEL_MAX UINT16_MAX
|
18
|
+
#define NODE_COUNT_MAX UINT16_MAX
|
19
|
+
|
20
|
+
typedef struct node_t node_t;
|
21
|
+
|
22
|
+
#include <private/branch.h>
|
23
|
+
#include <private/state.h>
|
24
|
+
|
25
|
+
#include <rtree/node.h>
|
26
|
+
#include <rtree/types.h>
|
27
|
+
|
28
|
+
struct node_t
|
29
|
+
{
|
30
|
+
node_level_t level;
|
31
|
+
node_count_t count;
|
32
|
+
char branches[];
|
33
|
+
};
|
34
|
+
|
35
|
+
typedef int (nbe_cb_t)(const state_t*, const branch_t*, void*);
|
36
|
+
|
37
|
+
int node_init(const state_t*, node_t*);
|
38
|
+
node_t* node_new(const state_t*);
|
39
|
+
void node_destroy(const state_t*, node_t*);
|
40
|
+
node_t* node_clone(const state_t*, const node_t*);
|
41
|
+
int node_branch_each(const state_t*, const node_t*, nbe_cb_t*, void*);
|
42
|
+
int node_branch_each_level(const state_t*, const node_t*, node_level_t,
|
43
|
+
nbe_cb_t*, void*);
|
44
|
+
size_t node_num_branch(size_t, size_t);
|
45
|
+
int node_detach_branch(const state_t*, node_t*, size_t);
|
46
|
+
node_t* node_add_branch(const state_t*, node_t*, branch_t*);
|
47
|
+
int node_envelope(const state_t*, const node_t*, rtree_coord_t*);
|
48
|
+
node_t* node_add_rect(const state_t*, rtree_id_t, rtree_coord_t*,
|
49
|
+
node_t*, node_level_t);
|
50
|
+
int node_update(const state_t*, const node_t*, rtree_update_t*, void*);
|
51
|
+
bool node_identical(const state_t*, const node_t*, const node_t*);
|
52
|
+
node_height_t node_height(const state_t*, const node_t*);
|
53
|
+
size_t node_bytes(const state_t*, const node_t*);
|
54
|
+
bool node_nonempty(const state_t*, const node_t*);
|
55
|
+
|
56
|
+
inline node_count_t node_count(const node_t *node)
|
57
|
+
{
|
58
|
+
return node->count;
|
59
|
+
}
|
60
|
+
|
61
|
+
inline void node_count_increment(node_t *node)
|
62
|
+
{
|
63
|
+
node->count++;
|
64
|
+
}
|
65
|
+
|
66
|
+
inline void node_count_decrement(node_t *node)
|
67
|
+
{
|
68
|
+
node->count--;
|
69
|
+
}
|
70
|
+
|
71
|
+
inline node_level_t node_level(const node_t *node)
|
72
|
+
{
|
73
|
+
return node->level;
|
74
|
+
}
|
75
|
+
|
76
|
+
inline void node_set_level(node_t *node, node_level_t level)
|
77
|
+
{
|
78
|
+
node->level = level;
|
79
|
+
}
|
80
|
+
|
81
|
+
inline void* node_get_branches(node_t *node)
|
82
|
+
{
|
83
|
+
return node->branches;
|
84
|
+
}
|
85
|
+
|
86
|
+
#endif
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/*
|
2
|
+
private/postscript.h
|
3
|
+
Copyright (c) J.J. Green 2023
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef PRIVATE_POSTSCRIPT_H
|
7
|
+
#define PRIVATE_POSTSCRIPT_H
|
8
|
+
|
9
|
+
#include <private/node.h>
|
10
|
+
#include <private/state.h>
|
11
|
+
|
12
|
+
#include <rtree/postscript.h>
|
13
|
+
|
14
|
+
int postscript_write(const state_t*, const node_t*,
|
15
|
+
const rtree_postscript_t*, FILE*);
|
16
|
+
|
17
|
+
#endif
|
@@ -1,21 +1,17 @@
|
|
1
1
|
/*
|
2
|
-
|
2
|
+
private/rect.h
|
3
3
|
Copyright (c) J.J. Green 2019
|
4
4
|
*/
|
5
5
|
|
6
|
-
#ifndef
|
7
|
-
#define
|
6
|
+
#ifndef PRIVATE_RECT_H
|
7
|
+
#define PRIVATE_RECT_H
|
8
8
|
|
9
|
-
#
|
10
|
-
|
11
|
-
#endif
|
9
|
+
#include <private/state.h>
|
10
|
+
#include <rtree/types.h>
|
12
11
|
|
13
|
-
#include <
|
12
|
+
#include <stddef.h>
|
14
13
|
#include <stdbool.h>
|
15
14
|
|
16
|
-
#include <rtree/state.h>
|
17
|
-
#include <rtree/types.h>
|
18
|
-
|
19
15
|
int rect_init(const state_t*, rtree_coord_t*);
|
20
16
|
|
21
17
|
rtree_coord_t rect_volume(const state_t*, const rtree_coord_t*);
|
@@ -31,8 +27,4 @@ bool rect_identical(const state_t*, const rtree_coord_t*, const rtree_coord_t*);
|
|
31
27
|
int rects_alloc(const state_t*, size_t, rtree_coord_t**);
|
32
28
|
void rects_free(size_t, rtree_coord_t**);
|
33
29
|
|
34
|
-
#ifdef __cplusplus
|
35
|
-
}
|
36
|
-
#endif
|
37
|
-
|
38
30
|
#endif
|
@@ -1,26 +1,18 @@
|
|
1
1
|
/*
|
2
|
-
|
2
|
+
private/rectf.h
|
3
3
|
Copyright (c) J.J. Green 2022
|
4
4
|
*/
|
5
5
|
|
6
|
-
#ifndef
|
7
|
-
#define
|
8
|
-
|
9
|
-
#ifdef __cplusplus
|
10
|
-
extern "C" {
|
11
|
-
#endif
|
6
|
+
#ifndef PRIVATE_RECTF_H
|
7
|
+
#define PRIVATE_RECTF_H
|
12
8
|
|
13
9
|
#include <rtree/types.h>
|
14
10
|
#include <stddef.h>
|
15
11
|
|
16
|
-
/* rect-spherical-volume */
|
17
|
-
|
18
12
|
typedef rtree_coord_t (rectf_rsv_t)(size_t, const rtree_coord_t*);
|
19
13
|
|
20
14
|
rectf_rsv_t* rectf_spherical_volume(size_t);
|
21
15
|
|
22
|
-
/* rect-combine */
|
23
|
-
|
24
16
|
typedef void (rectf_rc_t)(size_t,
|
25
17
|
const rtree_coord_t*,
|
26
18
|
const rtree_coord_t*,
|
@@ -28,7 +20,4 @@ typedef void (rectf_rc_t)(size_t,
|
|
28
20
|
|
29
21
|
rectf_rc_t* rectf_combine(size_t);
|
30
22
|
|
31
|
-
#ifdef __cplusplus
|
32
|
-
}
|
33
|
-
#endif
|
34
23
|
#endif
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
private/rtree.h
|
3
|
+
Copyright (c) J.J. Green 2023
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef PRIVATE_RTREE_H
|
7
|
+
#define PRIVATE_RTREE_H
|
8
|
+
|
9
|
+
#include <private/state.h>
|
10
|
+
#include <private/node.h>
|
11
|
+
|
12
|
+
#include <rtree.h>
|
13
|
+
|
14
|
+
struct rtree_t
|
15
|
+
{
|
16
|
+
state_t *state;
|
17
|
+
node_t *root;
|
18
|
+
};
|
19
|
+
|
20
|
+
#endif
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
private/search.h
|
3
|
+
Copyright (c) J.J. Green 2023
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef PRIVATE_SEARCH_H
|
7
|
+
#define PRIVATE_SEARCH_H
|
8
|
+
|
9
|
+
#include <private/node.h>
|
10
|
+
#include <private/state.h>
|
11
|
+
#include <rtree/search.h>
|
12
|
+
#include <rtree/types.h>
|
13
|
+
|
14
|
+
int search(const state_t*,
|
15
|
+
const rtree_coord_t*,
|
16
|
+
const node_t*,
|
17
|
+
rtree_search_t*,
|
18
|
+
void*);
|
19
|
+
|
20
|
+
#endif
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
private/split.h
|
3
|
+
Copyright (c) J.J. Green 2020
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef PRIVATE_SPLIT_H
|
7
|
+
#define PRIVATE_SPLIT_H
|
8
|
+
|
9
|
+
#include <private/branch.h>
|
10
|
+
#include <private/node.h>
|
11
|
+
#include <private/state.h>
|
12
|
+
|
13
|
+
node_t* split_node(const state_t*, node_t*, branch_t*);
|
14
|
+
|
15
|
+
#endif
|
@@ -0,0 +1,91 @@
|
|
1
|
+
/*
|
2
|
+
private/state.h
|
3
|
+
Copyright (c) J.J. Green 2023
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef PRIVATE_STATE_H
|
7
|
+
#define PRIVATE_STATE_H
|
8
|
+
|
9
|
+
#include <private/rectf.h>
|
10
|
+
|
11
|
+
#include <rtree/state.h>
|
12
|
+
#include <rtree/types.h>
|
13
|
+
|
14
|
+
#include <stddef.h>
|
15
|
+
#include <stdbool.h>
|
16
|
+
|
17
|
+
typedef struct
|
18
|
+
{
|
19
|
+
size_t dims, factor;
|
20
|
+
rtree_coord_t volume;
|
21
|
+
struct {
|
22
|
+
size_t page, branch, node;
|
23
|
+
} size;
|
24
|
+
struct {
|
25
|
+
rectf_rsv_t *spherical_volume;
|
26
|
+
rectf_rc_t *combine;
|
27
|
+
} rectf;
|
28
|
+
state_flags_t flags;
|
29
|
+
} state_t;
|
30
|
+
|
31
|
+
state_t* state_new(size_t, state_flags_t);
|
32
|
+
state_t* state_clone(const state_t*);
|
33
|
+
void state_destroy(state_t*);
|
34
|
+
state_flags_t state_split(const state_t*);
|
35
|
+
state_flags_t state_node_page(const state_t*);
|
36
|
+
bool state_identical(const state_t*, const state_t*);
|
37
|
+
|
38
|
+
inline rtree_coord_t state_rsv(const state_t *state, const rtree_coord_t *rect)
|
39
|
+
{
|
40
|
+
return state->rectf.spherical_volume(state->dims, rect) * state->volume;
|
41
|
+
}
|
42
|
+
|
43
|
+
inline void state_rc(const state_t *state,
|
44
|
+
const rtree_coord_t *rect0,
|
45
|
+
const rtree_coord_t *rect1,
|
46
|
+
rtree_coord_t *rect2)
|
47
|
+
{
|
48
|
+
state->rectf.combine(state->dims, rect0, rect1, rect2);
|
49
|
+
}
|
50
|
+
|
51
|
+
inline size_t state_dims(const state_t *state)
|
52
|
+
{
|
53
|
+
return state->dims;
|
54
|
+
}
|
55
|
+
|
56
|
+
inline size_t state_branch_size(const state_t *state)
|
57
|
+
{
|
58
|
+
return state->size.branch;
|
59
|
+
}
|
60
|
+
|
61
|
+
inline size_t state_page_size(const state_t *state)
|
62
|
+
{
|
63
|
+
return state->size.page;
|
64
|
+
}
|
65
|
+
|
66
|
+
inline size_t state_node_size(const state_t *state)
|
67
|
+
{
|
68
|
+
return state->size.node;
|
69
|
+
}
|
70
|
+
|
71
|
+
inline size_t state_rect_size(const state_t *state)
|
72
|
+
{
|
73
|
+
return state_dims(state) * 2 * sizeof(rtree_coord_t);
|
74
|
+
}
|
75
|
+
|
76
|
+
inline size_t state_branching_factor(const state_t *state)
|
77
|
+
{
|
78
|
+
return state->factor;
|
79
|
+
}
|
80
|
+
|
81
|
+
inline double state_unit_sphere_volume(const state_t *state)
|
82
|
+
{
|
83
|
+
return state->volume;
|
84
|
+
}
|
85
|
+
|
86
|
+
inline size_t state_bytes(const state_t *state)
|
87
|
+
{
|
88
|
+
return (state ? sizeof(state_t) : 0);
|
89
|
+
}
|
90
|
+
|
91
|
+
#endif
|
data/ext/rtree/lib/rect.c
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
#include "config.h"
|
3
3
|
#endif
|
4
4
|
|
5
|
-
#include "
|
5
|
+
#include "private/rect.h"
|
6
|
+
#include "private/state.h"
|
7
|
+
|
6
8
|
#include "rtree/error.h"
|
7
9
|
|
8
10
|
#ifdef HAVE_TGMATH_H
|
@@ -17,6 +19,7 @@
|
|
17
19
|
|
18
20
|
#include <string.h>
|
19
21
|
#include <errno.h>
|
22
|
+
#include <stdlib.h>
|
20
23
|
|
21
24
|
int rect_init(const state_t *state, rtree_coord_t *rect)
|
22
25
|
{
|
data/ext/rtree/lib/rectf.c
CHANGED
data/ext/rtree/lib/rtree/node.h
CHANGED
@@ -8,86 +8,11 @@
|
|
8
8
|
|
9
9
|
#ifdef __cplusplus
|
10
10
|
extern "C" {
|
11
|
-
#if 0
|
12
|
-
}
|
13
|
-
#endif
|
14
11
|
#endif
|
15
12
|
|
16
|
-
#include <stdint.h>
|
17
|
-
#include <stdbool.h>
|
18
|
-
#include <stddef.h>
|
19
|
-
|
20
|
-
typedef uint16_t node_level_t;
|
21
|
-
typedef uint16_t node_count_t;
|
22
|
-
typedef uint16_t node_height_t;
|
23
|
-
|
24
|
-
#define NODE_LEVEL_MAX UINT16_MAX
|
25
|
-
#define NODE_COUNT_MAX UINT16_MAX
|
26
|
-
|
27
|
-
typedef struct node_t node_t;
|
28
|
-
|
29
13
|
#include <rtree/types.h>
|
30
|
-
#include <rtree/state.h>
|
31
|
-
#include <rtree/branch.h>
|
32
|
-
|
33
|
-
struct node_t
|
34
|
-
{
|
35
|
-
node_level_t level;
|
36
|
-
node_count_t count;
|
37
|
-
char branches[];
|
38
|
-
};
|
39
14
|
|
40
15
|
typedef int (rtree_update_t)(rtree_id_t, rtree_coord_t*, void*);
|
41
|
-
typedef int (nbe_cb_t)(const state_t*, const branch_t*, void*);
|
42
|
-
|
43
|
-
int node_init(const state_t*, node_t*);
|
44
|
-
node_t* node_new(const state_t*);
|
45
|
-
void node_destroy(const state_t*, node_t*);
|
46
|
-
node_t* node_clone(const state_t*, const node_t*);
|
47
|
-
int node_branch_each(const state_t*, const node_t*, nbe_cb_t*, void*);
|
48
|
-
int node_branch_each_level(const state_t*, const node_t*, node_level_t,
|
49
|
-
nbe_cb_t*, void*);
|
50
|
-
size_t node_num_branch(size_t, size_t);
|
51
|
-
int node_detach_branch(const state_t*, node_t*, size_t);
|
52
|
-
node_t* node_add_branch(const state_t*, node_t*, branch_t*);
|
53
|
-
int node_envelope(const state_t*, const node_t*, rtree_coord_t*);
|
54
|
-
node_t* node_add_rect(const state_t*, rtree_id_t, rtree_coord_t*,
|
55
|
-
node_t*, node_level_t);
|
56
|
-
int node_update(const state_t*, const node_t*, rtree_update_t*, void*);
|
57
|
-
bool node_identical(const state_t*, const node_t*, const node_t*);
|
58
|
-
node_height_t node_height(const state_t*, const node_t*);
|
59
|
-
size_t node_bytes(const state_t*, const node_t*);
|
60
|
-
bool node_nonempty(const state_t*, const node_t*);
|
61
|
-
|
62
|
-
inline node_count_t node_count(const node_t *node)
|
63
|
-
{
|
64
|
-
return node->count;
|
65
|
-
}
|
66
|
-
|
67
|
-
inline void node_count_increment(node_t *node)
|
68
|
-
{
|
69
|
-
node->count++;
|
70
|
-
}
|
71
|
-
|
72
|
-
inline void node_count_decrement(node_t *node)
|
73
|
-
{
|
74
|
-
node->count--;
|
75
|
-
}
|
76
|
-
|
77
|
-
inline node_level_t node_level(const node_t *node)
|
78
|
-
{
|
79
|
-
return node->level;
|
80
|
-
}
|
81
|
-
|
82
|
-
inline void node_set_level(node_t *node, node_level_t level)
|
83
|
-
{
|
84
|
-
node->level = level;
|
85
|
-
}
|
86
|
-
|
87
|
-
inline void* node_get_branches(node_t *node)
|
88
|
-
{
|
89
|
-
return node->branches;
|
90
|
-
}
|
91
16
|
|
92
17
|
#ifdef __cplusplus
|
93
18
|
}
|
@@ -10,54 +10,52 @@
|
|
10
10
|
extern "C" {
|
11
11
|
#endif
|
12
12
|
|
13
|
-
|
13
|
+
#include <rtree/extent.h>
|
14
14
|
|
15
15
|
#include <stdio.h>
|
16
|
-
#include <rtree/node.h>
|
17
|
-
#include <rtree/extent.h>
|
18
16
|
|
19
|
-
typedef enum
|
20
|
-
|
21
|
-
|
17
|
+
typedef enum {
|
18
|
+
model_none,
|
19
|
+
model_grey,
|
20
|
+
model_rgb,
|
21
|
+
model_cmyk
|
22
|
+
} postscript_colour_model_t;
|
22
23
|
|
23
24
|
typedef struct {
|
24
|
-
|
25
|
+
postscript_colour_model_t model;
|
25
26
|
union {
|
26
27
|
float grey[1];
|
27
28
|
float rgb[3];
|
28
29
|
float cmyk[4];
|
29
30
|
};
|
30
|
-
}
|
31
|
+
} postscript_colour_t;
|
31
32
|
|
32
33
|
typedef struct {
|
33
34
|
struct {
|
34
|
-
|
35
|
+
postscript_colour_t colour;
|
35
36
|
} fill;
|
36
37
|
struct {
|
37
|
-
|
38
|
+
postscript_colour_t colour;
|
38
39
|
float width;
|
39
40
|
} stroke;
|
40
|
-
}
|
41
|
+
} postscript_style_level_t;
|
41
42
|
|
42
43
|
typedef struct {
|
43
44
|
size_t n;
|
44
|
-
|
45
|
-
}
|
45
|
+
postscript_style_level_t *array;
|
46
|
+
} postscript_style_t;
|
46
47
|
|
47
|
-
|
48
|
-
void postscript_style_destroy(
|
48
|
+
postscript_style_t* postscript_style_read(FILE*);
|
49
|
+
void postscript_style_destroy(postscript_style_t*);
|
49
50
|
|
50
|
-
struct rtree_postscript_t
|
51
|
+
typedef struct rtree_postscript_t
|
51
52
|
{
|
52
|
-
const
|
53
|
+
const postscript_style_t *style;
|
53
54
|
extent_axis_t axis;
|
54
55
|
float extent;
|
55
56
|
float margin;
|
56
57
|
const char *title;
|
57
|
-
};
|
58
|
-
|
59
|
-
int postscript_write(const state_t*, const node_t*,
|
60
|
-
const rtree_postscript_t*, FILE*);
|
58
|
+
} rtree_postscript_t;
|
61
59
|
|
62
60
|
#ifdef __cplusplus
|
63
61
|
}
|
@@ -10,16 +10,10 @@
|
|
10
10
|
extern "C" {
|
11
11
|
#endif
|
12
12
|
|
13
|
-
#include <rtree/node.h>
|
14
13
|
#include <rtree/types.h>
|
15
|
-
#include <rtree/state.h>
|
16
14
|
|
17
15
|
typedef int (rtree_search_t)(rtree_id_t, void*);
|
18
16
|
|
19
|
-
int search(const state_t*,
|
20
|
-
const rtree_coord_t*, const node_t*,
|
21
|
-
rtree_search_t*, void*);
|
22
|
-
|
23
17
|
#ifdef __cplusplus
|
24
18
|
}
|
25
19
|
#endif
|