@dra2020/baseclient 1.0.12 → 1.0.13

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.
Files changed (120) hide show
  1. package/package.json +16 -15
  2. package/LICENSE +0 -21
  3. package/README.md +0 -26
  4. package/dist/all/all.d.ts +0 -20
  5. package/dist/baseclient.js +0 -10113
  6. package/dist/baseclient.js.map +0 -1
  7. package/dist/context/all.d.ts +0 -1
  8. package/dist/context/context.d.ts +0 -13
  9. package/dist/filterexpr/all.d.ts +0 -1
  10. package/dist/filterexpr/filterexpr.d.ts +0 -67
  11. package/dist/fsm/all.d.ts +0 -1
  12. package/dist/fsm/fsm.d.ts +0 -119
  13. package/dist/geo/all.d.ts +0 -2
  14. package/dist/geo/geo.d.ts +0 -67
  15. package/dist/geo/vfeature.d.ts +0 -4
  16. package/dist/logabstract/all.d.ts +0 -1
  17. package/dist/logabstract/log.d.ts +0 -26
  18. package/dist/logclient/all.d.ts +0 -1
  19. package/dist/logclient/log.d.ts +0 -6
  20. package/dist/ot-editutil/all.d.ts +0 -2
  21. package/dist/ot-editutil/oteditutil.d.ts +0 -14
  22. package/dist/ot-editutil/otmaputil.d.ts +0 -21
  23. package/dist/ot-js/all.d.ts +0 -9
  24. package/dist/ot-js/otarray.d.ts +0 -111
  25. package/dist/ot-js/otclientengine.d.ts +0 -38
  26. package/dist/ot-js/otcomposite.d.ts +0 -37
  27. package/dist/ot-js/otcounter.d.ts +0 -17
  28. package/dist/ot-js/otengine.d.ts +0 -22
  29. package/dist/ot-js/otmap.d.ts +0 -19
  30. package/dist/ot-js/otserverengine.d.ts +0 -38
  31. package/dist/ot-js/otsession.d.ts +0 -114
  32. package/dist/ot-js/ottypes.d.ts +0 -29
  33. package/dist/poly/all.d.ts +0 -15
  34. package/dist/poly/blend.d.ts +0 -1
  35. package/dist/poly/boundbox.d.ts +0 -16
  36. package/dist/poly/cartesian.d.ts +0 -5
  37. package/dist/poly/graham-scan.d.ts +0 -8
  38. package/dist/poly/hash.d.ts +0 -1
  39. package/dist/poly/matrix.d.ts +0 -24
  40. package/dist/poly/minbound.d.ts +0 -1
  41. package/dist/poly/poly.d.ts +0 -52
  42. package/dist/poly/polybin.d.ts +0 -5
  43. package/dist/poly/polylabel.d.ts +0 -7
  44. package/dist/poly/polypack.d.ts +0 -30
  45. package/dist/poly/polyround.d.ts +0 -1
  46. package/dist/poly/polysimplify.d.ts +0 -1
  47. package/dist/poly/quad.d.ts +0 -48
  48. package/dist/poly/selfintersect.d.ts +0 -1
  49. package/dist/poly/shamos.d.ts +0 -1
  50. package/dist/poly/simplify.d.ts +0 -2
  51. package/dist/poly/topo.d.ts +0 -46
  52. package/dist/poly/union.d.ts +0 -49
  53. package/dist/util/all.d.ts +0 -5
  54. package/dist/util/bintrie.d.ts +0 -93
  55. package/dist/util/countedhash.d.ts +0 -19
  56. package/dist/util/gradient.d.ts +0 -15
  57. package/dist/util/indexedarray.d.ts +0 -15
  58. package/dist/util/util.d.ts +0 -68
  59. package/docs/context.md +0 -2
  60. package/docs/filterexpr.md +0 -22
  61. package/docs/fsm.md +0 -243
  62. package/docs/logabstract.md +0 -2
  63. package/docs/logclient.md +0 -2
  64. package/docs/ot-editutil.md +0 -2
  65. package/docs/ot-js.md +0 -95
  66. package/docs/poly.md +0 -103
  67. package/docs/util.md +0 -2
  68. package/lib/all/all.ts +0 -21
  69. package/lib/context/all.ts +0 -1
  70. package/lib/context/context.ts +0 -82
  71. package/lib/filterexpr/all.ts +0 -1
  72. package/lib/filterexpr/filterexpr.ts +0 -699
  73. package/lib/fsm/all.ts +0 -1
  74. package/lib/fsm/fsm.ts +0 -559
  75. package/lib/geo/all.ts +0 -2
  76. package/lib/geo/geo.ts +0 -452
  77. package/lib/geo/vfeature.ts +0 -34
  78. package/lib/logabstract/all.ts +0 -1
  79. package/lib/logabstract/log.ts +0 -55
  80. package/lib/logclient/all.ts +0 -1
  81. package/lib/logclient/log.ts +0 -105
  82. package/lib/ot-editutil/all.ts +0 -2
  83. package/lib/ot-editutil/oteditutil.ts +0 -180
  84. package/lib/ot-editutil/otmaputil.ts +0 -209
  85. package/lib/ot-js/all.ts +0 -9
  86. package/lib/ot-js/otarray.ts +0 -1168
  87. package/lib/ot-js/otclientengine.ts +0 -327
  88. package/lib/ot-js/otcomposite.ts +0 -247
  89. package/lib/ot-js/otcounter.ts +0 -145
  90. package/lib/ot-js/otengine.ts +0 -71
  91. package/lib/ot-js/otmap.ts +0 -144
  92. package/lib/ot-js/otserverengine.ts +0 -329
  93. package/lib/ot-js/otsession.ts +0 -202
  94. package/lib/ot-js/ottypes.ts +0 -98
  95. package/lib/poly/all.ts +0 -15
  96. package/lib/poly/blend.ts +0 -27
  97. package/lib/poly/boundbox.ts +0 -102
  98. package/lib/poly/cartesian.ts +0 -130
  99. package/lib/poly/graham-scan.ts +0 -401
  100. package/lib/poly/hash.ts +0 -15
  101. package/lib/poly/matrix.ts +0 -309
  102. package/lib/poly/minbound.ts +0 -211
  103. package/lib/poly/poly.ts +0 -767
  104. package/lib/poly/polybin.ts +0 -218
  105. package/lib/poly/polylabel.ts +0 -204
  106. package/lib/poly/polypack.ts +0 -468
  107. package/lib/poly/polyround.ts +0 -30
  108. package/lib/poly/polysimplify.ts +0 -24
  109. package/lib/poly/quad.ts +0 -272
  110. package/lib/poly/selfintersect.ts +0 -87
  111. package/lib/poly/shamos.ts +0 -297
  112. package/lib/poly/simplify.ts +0 -119
  113. package/lib/poly/topo.ts +0 -499
  114. package/lib/poly/union.ts +0 -388
  115. package/lib/util/all.ts +0 -5
  116. package/lib/util/bintrie.ts +0 -603
  117. package/lib/util/countedhash.ts +0 -83
  118. package/lib/util/gradient.ts +0 -108
  119. package/lib/util/indexedarray.ts +0 -80
  120. package/lib/util/util.ts +0 -695
@@ -1,211 +0,0 @@
1
- //
2
- // MINIMUM BOUNDING RECTANGLE - aka minimum area rectangle -or- smallest enclosing rectangle
3
- //
4
-
5
- //
6
- // WHUBER'S ELEGANT, TRIG-FREE SOLUTION IN R
7
- //
8
- // https://gis.stackexchange.com/questions/22895/finding-minimum-area-rectangle-for-given-points
9
- //
10
-
11
- /*
12
-
13
- MBR <- function(p) {
14
- # Analyze the convex hull edges
15
- a <- chull(p) # Indexes of extremal points
16
- a <- c(a, a[1]) # Close the loop
17
- e <- p[a[-1],] - p[a[-length(a)], ] # Edge directions
18
- norms <- sqrt(rowSums(e^2)) # Edge lengths
19
- v <- e / norms # Unit edge directions
20
- w <- cbind(-v[,2], v[,1]) # Normal directions to the edges
21
-
22
- # Find the MBR
23
- vertices <- p[a, ] # Convex hull vertices
24
- x <- apply(vertices %*% t(v), 2, range) # Extremes along edges
25
- y <- apply(vertices %*% t(w), 2, range) # Extremes normal to edges
26
- areas <- (y[1,]-y[2,])*(x[1,]-x[2,]) # Areas
27
- k <- which.min(areas) # Index of the best edge (smallest area)
28
-
29
- # Form a rectangle from the extremes of the best edge
30
- cbind(x[c(1,2,2,1,1),k], y[c(1,1,2,2,1),k]) %*% rbind(v[k,], w[k,])
31
- }
32
-
33
- */
34
-
35
-
36
- //
37
- // THIS RE-IMPLEMENTS THE R IN TYPESCRIPT, USING CUSTOM MATRIX OPERATIONS
38
- //
39
-
40
- import { polyConvexHull } from './poly';
41
- import * as M from './matrix';
42
-
43
- type Point = [number, number];
44
-
45
- // For point addressing
46
- const X = 0, Y = 1;
47
-
48
- export function minimumBoundingRectangle(poly: any): any
49
- {
50
- // Get the convex hull polygon in standard form
51
- const ch = polyConvexHull(poly);
52
-
53
- // Select the exterior points (outer ring = 0)
54
- let chExt: Point[] = ch[0];
55
-
56
- // Close the loop (ring)
57
- chExt.push(chExt[0]);
58
-
59
- // Edge directions - Note the implict offset array indexing
60
- const e: Point[] = chExt.slice(1).map((pt, i) => [(pt[X] - chExt[i][X]), (pt[Y] - chExt[i][Y])]);
61
-
62
- // Edge lengths
63
- const norms: number[] = e.map(pt => Math.sqrt((pt[X] ** 2) + (pt[Y] ** 2)));
64
-
65
- // Unit edge directions
66
- const v: Point[] = e.map((pt, i) => [(pt[X] / norms[i]), (pt[Y] / norms[i])]);
67
-
68
- // Normal directions to the edges
69
- const w: Point[] = v.map(pt => [-pt[Y], pt[X]]);
70
-
71
- // FIND THE MBR - Switch to matrix operations
72
-
73
- // Convex hull vertices
74
- const vertices = M.matrix(chExt);
75
-
76
- const vT = M.transpose(M.matrix(v));
77
- const wT = M.transpose(M.matrix(w));
78
-
79
- // Extremes along edges
80
- const temp1 = M.matrix([M.apply(M.multiply(vertices, vT), M.Dim.Columns, M.min)]);
81
- const temp2 = M.matrix([M.apply(M.multiply(vertices, vT), M.Dim.Columns, M.max)]);
82
- const x = M.concat(temp1, temp2, M.Dim.Rows);
83
-
84
- // Extremes normal to edges
85
- const temp3 = M.matrix([M.apply(M.multiply(vertices, wT), M.Dim.Columns, M.min)]);
86
- const temp4 = M.matrix([M.apply(M.multiply(vertices, wT), M.Dim.Columns, M.max)]);
87
- const y = M.concat(temp3, temp4, M.Dim.Rows);
88
-
89
- // Areas
90
- const temp5 = M.subtract(M.row(y, 0), M.row(y, 1));
91
- const temp6 = M.subtract(M.row(x, 0), M.row(x, 1));
92
- const areas = M.dotMultiply(temp5, temp6);
93
-
94
- // Index of the best edge (smallest area)
95
- const smallestArea = Math.min(...areas);
96
- const k = [ areas.indexOf(smallestArea) ];
97
-
98
- // Form a rectangle from the extremes of the best edge
99
- const temp7 = M.subset(x, M.index([0, 1, 1, 0, 0], k));
100
- const temp8 = M.subset(y, M.index([0, 0, 1, 1, 0], k));
101
- const temp9 = M.subset(v, M.index(k, M.range(0, 1, true)));
102
- const temp10 = M.subset(w, M.index(k, M.range(0, 1, true)));
103
- const temp11 = M.concat(temp7, temp8, M.Dim.Columns);
104
- const temp12 = M.concat(temp9, temp10, M.Dim.Rows);
105
-
106
- const rect = M.multiply(temp11, temp12);
107
-
108
- // Revert back to standard TypeScript arrays
109
- const points = rect.slice(0, -1); // Remove the closing point
110
-
111
- // Convert to standard polygon form
112
- return [ points ];
113
- }
114
-
115
-
116
- //
117
- // THIS RE-IMPLEMENTS THE R IN TYPESCRIPT, USING MATHJS FOR MATRIX OPERATIONS
118
- //
119
-
120
- /*
121
-
122
- const {
123
- matrix,
124
- multiply,
125
- transpose,
126
- apply,
127
- min,
128
- max,
129
- concat,
130
- row,
131
- subtract,
132
- dotMultiply,
133
- index,
134
- range,
135
- subset
136
- } = require('mathjs');
137
-
138
- type SimplePoint = [number, number];
139
-
140
- // For point addressing
141
- const X = 0, Y = 1;
142
- const COLUMNS = 0, ROWS = 1;
143
-
144
- export function minimumBoundingRectangle(poly: any): any
145
- {
146
- // Get the convex hull polygon in standard form
147
- const ch = polyConvexHull(poly);
148
-
149
- // Select the exterior points
150
- let chExt: SimplePoint[] = ch[0];
151
-
152
- // Close the loop (ring)
153
- chExt.push(chExt[0]);
154
-
155
- // Edge directions - Note the implict offset array indexing
156
- const e: SimplePoint[] = chExt.slice(1).map((pt, i) => [(pt[X] - chExt[i][X]), (pt[Y] - chExt[i][Y])]);
157
-
158
- // Edge lengths
159
- const norms: number[] = e.map(pt => Math.sqrt((pt[X] ** 2) + (pt[Y] ** 2)));
160
-
161
- // Unit edge directions
162
- const v: SimplePoint[] = e.map((pt, i) => [(pt[X] / norms[i]), (pt[Y] / norms[i])]);
163
-
164
- // Normal directions to the edges
165
- const w: SimplePoint[] = v.map(pt => [-pt[Y], pt[X]]);
166
-
167
- // FIND THE MBR
168
-
169
- // Switch to MathJS matrices for matrix operations
170
-
171
- // Convex hull vertices
172
- const vertices = matrix(chExt);
173
-
174
- const vT = transpose(matrix(v));
175
- const wT = transpose(matrix(w));
176
-
177
- // Extremes along edges
178
- const temp1 = matrix([apply(multiply(vertices, vT), COLUMNS, min)]);
179
- const temp2 = matrix([apply(multiply(vertices, vT), COLUMNS, max)]);
180
- const x = concat(temp1, temp2, COLUMNS);
181
-
182
- // Extremes normal to edges
183
- const temp3 = matrix([apply(multiply(vertices, wT), COLUMNS, min)]);
184
- const temp4 = matrix([apply(multiply(vertices, wT), COLUMNS, max)]);
185
- const y = concat(temp3, temp4, COLUMNS);
186
-
187
- // Areas
188
- const temp5 = subtract(row(y, 0), row(y, 1));
189
- const temp6 = subtract(row(x, 0), row(x, 1));
190
- const areas = dotMultiply(temp5, temp6);
191
-
192
- // Index of the best edge (smallest area)
193
- const areasArr = areas.valueOf()[0]; // Make the 2D matrix a 1D array
194
- const smallestArea = Math.min( ...areasArr );
195
- const k = areasArr.indexOf(smallestArea);
196
-
197
- // Form a rectangle from the extremes of the best edge
198
- const temp7 = subset(x, index([0, 1, 1, 0, 0], k));
199
- const temp8 = subset(y, index([0, 0, 1, 1, 0], k));
200
- const temp9 = subset(v, index(k, range(0, 1, true)));
201
- const temp10 = subset(w, index(k, range(0, 1, true)));
202
- const rect = multiply(concat(temp7, temp8), concat(temp9, temp10, COLUMNS));
203
-
204
- // Revert back to standard TypeScript arrays
205
- const points = rect.valueOf().slice(0, -1); // Remove the closing point
206
-
207
- // Convert to standard polygon form
208
- return [ points ];
209
- }
210
-
211
- */