-
Notifications
You must be signed in to change notification settings - Fork 13
/
GlobalsForOle.js
99 lines (97 loc) · 2.19 KB
/
GlobalsForOle.js
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import OLVectorLayer from "ol/layer/Vector";
import VectorSource from "ol/source/Vector";
import Control from "ol/control/Control";
import Draw from "ol/interaction/Draw";
import Snap from "ol/interaction/Snap";
import Pointer from "ol/interaction/Pointer";
import Select from "ol/interaction/Select";
import Modify from "ol/interaction/Modify";
import Style from "ol/style/Style";
import Fill from "ol/style/Fill";
import Stroke from "ol/style/Stroke";
import Circle from "ol/style/Circle";
import Icon from "ol/style/Icon";
import RegularShape from "ol/style/RegularShape";
import Collection from "ol/Collection";
import Feature from "ol/Feature";
import Observable, { unByKey } from "ol/Observable";
import { getCenter } from "ol/extent";
import {
Point,
LineString,
Polygon,
MultiPoint,
MultiLineString,
MultiPolygon,
} from "ol/geom";
import LinearRing from "ol/geom/LinearRing";
import { fromExtent } from "ol/geom/Polygon";
import * as events from "ol/events";
import * as condition from "ol/events/condition";
import { OL3Parser } from "jsts/org/locationtech/jts/io";
import { BufferOp } from "jsts/org/locationtech/jts/operation/buffer";
import { OverlayOp } from "jsts/org/locationtech/jts/operation/overlay";
/**
* This module create window.ol and window.jsts variables for ole editor.
*/
if (!window.ol) {
window.ol = {
Feature,
Collection,
layer: {
Vector: OLVectorLayer,
},
source: {
Vector: VectorSource,
},
interaction: {
Draw,
Snap,
Pointer,
Select,
Modify,
},
control: {
Control,
},
style: {
Style,
Fill,
Stroke,
Circle,
RegularShape,
Icon,
},
geom: {
Point,
LineString,
Polygon,
MultiPoint,
MultiLineString,
MultiPolygon,
LinearRing,
},
extent: {
getCenter,
},
Observable: {
...Observable,
unByKey,
},
events: {
...events,
condition: {
...condition,
},
},
};
window.ol.geom.Polygon.fromExtent = fromExtent;
}
if (!window.jsts) {
window.jsts = {
io: {
OL3Parser,
},
operation: { buffer: { BufferOp }, overlay: { OverlayOp } },
};
}