@dra2020/baseclient 1.0.117 → 1.0.119
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.
- package/LICENSE +1 -1
- package/dist/baseclient.js +22 -19
- package/dist/baseclient.js.map +1 -1
- package/dist/ot-js/otsession.d.ts +2 -0
- package/dist/util/util.d.ts +2 -0
- package/lib/ot-js/otsession.ts +4 -2
- package/lib/poly/pointinpoly.ts +0 -5
- package/lib/poly/union.ts +7 -13
- package/lib/util/util.ts +13 -0
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ export declare const PermRead: number;
|
|
|
29
29
|
export declare const PermWrite: number;
|
|
30
30
|
export declare const PermOwner: number;
|
|
31
31
|
export declare const PermAdmin: number;
|
|
32
|
+
export declare const PermVersion: number;
|
|
32
33
|
export declare const PermEdit: number;
|
|
33
34
|
export declare const PermAll: number;
|
|
34
35
|
export declare type Permission = number;
|
|
@@ -49,6 +50,7 @@ export interface Revision {
|
|
|
49
50
|
id: string;
|
|
50
51
|
modifyTime: any;
|
|
51
52
|
label?: string;
|
|
53
|
+
editcache?: string;
|
|
52
54
|
}
|
|
53
55
|
export declare type RevisionList = Revision[];
|
|
54
56
|
export interface SessionUser {
|
package/dist/util/util.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export declare class Deadline {
|
|
|
29
29
|
done(): boolean;
|
|
30
30
|
}
|
|
31
31
|
export declare function createGuid(): string;
|
|
32
|
+
export declare function createKeyedGuid(key: string): string;
|
|
33
|
+
export declare function guidKey(guid: string): string;
|
|
32
34
|
export declare function sizeof(a: any): number;
|
|
33
35
|
export declare function depthof(a: any): number;
|
|
34
36
|
export declare function isEmpty(o: any): boolean;
|
package/lib/ot-js/otsession.ts
CHANGED
|
@@ -34,6 +34,7 @@ export const PermRead: number = 1; // Can view
|
|
|
34
34
|
export const PermWrite: number = 2; // Can modify
|
|
35
35
|
export const PermOwner: number = 4; // Can change deleted, published, access permissions
|
|
36
36
|
export const PermAdmin: number = 8; // Can administer site
|
|
37
|
+
export const PermVersion: number = 16; // Can view a specific version
|
|
37
38
|
export const PermEdit: number = (PermWrite|PermOwner);
|
|
38
39
|
export const PermAll: number = (PermRead|PermWrite|PermOwner|PermAdmin);
|
|
39
40
|
export type Permission = number;
|
|
@@ -64,8 +65,9 @@ export interface Access
|
|
|
64
65
|
export interface Revision
|
|
65
66
|
{
|
|
66
67
|
id: string;
|
|
67
|
-
modifyTime: any;
|
|
68
|
-
label?: string;
|
|
68
|
+
modifyTime: any; // JSON date
|
|
69
|
+
label?: string; // optional label
|
|
70
|
+
editcache?: string; // optional editcache key
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export type RevisionList = Revision[];
|
package/lib/poly/pointinpoly.ts
CHANGED
|
@@ -4,20 +4,15 @@ export function polyContainsPoint(poly: any, x: number, y: number): boolean
|
|
|
4
4
|
{
|
|
5
5
|
let pp = PP.polyPack(poly);
|
|
6
6
|
if (pp == null) return false;
|
|
7
|
-
let bFound = false;
|
|
8
7
|
let bInside = false;
|
|
9
8
|
let iCurPoly = -1;
|
|
10
9
|
let bCurInside = false;
|
|
11
10
|
|
|
12
11
|
PP.polyPackEachRing(pp, (b: Float64Array, iPoly: number, iRing: number, iOffset: number, nPoints: number) => {
|
|
13
|
-
if (bFound) return;
|
|
14
12
|
if (iRing == 0)
|
|
15
13
|
{
|
|
16
14
|
if (iCurPoly >= 0 && bCurInside)
|
|
17
|
-
{
|
|
18
15
|
bInside = true;
|
|
19
|
-
bFound = true;
|
|
20
|
-
}
|
|
21
16
|
iCurPoly = iPoly;
|
|
22
17
|
bCurInside = false;
|
|
23
18
|
}
|
package/lib/poly/union.ts
CHANGED
|
@@ -66,19 +66,13 @@ export function polyIntersectArea(p1: any, p2: any): number
|
|
|
66
66
|
let area: number = 0;
|
|
67
67
|
|
|
68
68
|
PP.polyPackEachRing(pp1, (buffer1: Float64Array, iPoly1: number, iRing1: number, iOffset1: number, nPoints1: number) => {
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let result = _intersection(c1, c2);
|
|
77
|
-
if (result && result.length > 0)
|
|
78
|
-
area += Poly.polyArea(result);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
69
|
+
let c1 = unpackCoords(buffer1, iOffset1, nPoints1);
|
|
70
|
+
PP.polyPackEachRing(pp2, (buffer2: Float64Array, iPoly2: number, iRing2: number, iOffset2: number, nPoints2: number) => {
|
|
71
|
+
let c2 = unpackCoords(buffer2, iOffset2, nPoints2);
|
|
72
|
+
let result = _intersection(c1, c2);
|
|
73
|
+
if (result && result.length > 0)
|
|
74
|
+
area += Poly.polyArea(result) * ((!iRing1 == !iRing2) ? 1 : -1);
|
|
75
|
+
});
|
|
82
76
|
});
|
|
83
77
|
return area;
|
|
84
78
|
}
|
package/lib/util/util.ts
CHANGED
|
@@ -132,6 +132,19 @@ export function createGuid(): string
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
export function createKeyedGuid(key: string): string
|
|
136
|
+
{
|
|
137
|
+
return `xxxxxxxx-xxxx-${key}xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g, function(c) {
|
|
138
|
+
var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);
|
|
139
|
+
return v.toString(16);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function guidKey(guid: string): string
|
|
144
|
+
{
|
|
145
|
+
return guid.substr(14, 1); // See above
|
|
146
|
+
}
|
|
147
|
+
|
|
135
148
|
type LoopTest = WeakMap<any,boolean>;
|
|
136
149
|
|
|
137
150
|
function _sizeof(a: any, loops: LoopTest): number
|