mascot-vis 3.0.0 → 3.0.1

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 (152) hide show
  1. package/package.json +1 -2
  2. package/js/depGraphVis.js +0 -66
  3. package/src-new-ts/action/createElement.ts +0 -91
  4. package/src-new-ts/action/encode.js +0 -20
  5. package/src-new-ts/action/repeat.js +0 -128
  6. package/src-new-ts/action/traverseScene.js +0 -41
  7. package/src-new-ts/data/Network.js +0 -2
  8. package/src-new-ts/data/Scope.js +0 -135
  9. package/src-new-ts/data/Table.js +0 -263
  10. package/src-new-ts/data/Tree.js +0 -3
  11. package/src-new-ts/data/field.ts +0 -115
  12. package/src-new-ts/data/import.ts +0 -96
  13. package/src-new-ts/data/predicate.ts +0 -82
  14. package/src-new-ts/depgraph/DepGraph.js +0 -178
  15. package/src-new-ts/depgraph/Edge.js +0 -9
  16. package/src-new-ts/depgraph/SceneGraph2DepGraph.js +0 -110
  17. package/src-new-ts/depgraph/Signal.js +0 -12
  18. package/src-new-ts/depgraph/operator/BoundsEvaluator.js +0 -30
  19. package/src-new-ts/depgraph/operator/Dataflow.js +0 -41
  20. package/src-new-ts/depgraph/operator/DomainBuilder.js +0 -50
  21. package/src-new-ts/depgraph/updateDepGraph.js +0 -45
  22. package/src-new-ts/depgraph/variable/BoundsVar.js +0 -81
  23. package/src-new-ts/depgraph/variable/ChannelVar.js +0 -17
  24. package/src-new-ts/depgraph/variable/DataScopeVar.js +0 -12
  25. package/src-new-ts/depgraph/variable/DomainVar.js +0 -15
  26. package/src-new-ts/depgraph/variable/FieldVar.js +0 -17
  27. package/src-new-ts/depgraph/variable/LayoutParameter.js +0 -8
  28. package/src-new-ts/depgraph/variable/ScaleVar.js +0 -13
  29. package/src-new-ts/depgraph/variable/Variable.js +0 -39
  30. package/src-new-ts/element/gradient/LinearGradient.js +0 -37
  31. package/src-new-ts/element/group/Collection.js +0 -109
  32. package/src-new-ts/element/group/Group.js +0 -307
  33. package/src-new-ts/element/group/Scene.js +0 -98
  34. package/src-new-ts/element/mark/CircleMark.ts +0 -85
  35. package/src-new-ts/element/mark/Mark.ts +0 -233
  36. package/src-new-ts/element/mark/PathMark.js +0 -483
  37. package/src-new-ts/element/mark/Segment.js +0 -29
  38. package/src-new-ts/element/mark/Vertex.js +0 -118
  39. package/src-new-ts/encode/Scale.ts +0 -115
  40. package/src-new-ts/index.ts +0 -19
  41. package/src-new-ts/layout/Layout.ts +0 -3
  42. package/src-new-ts/render/CanvasRenderer.ts +0 -24
  43. package/src-new-ts/render/SVGRenderer.js +0 -316
  44. package/src-new-ts/util.ts +0 -3
  45. package/src-old/action/Classify.js +0 -53
  46. package/src-old/action/Densify.js +0 -199
  47. package/src-old/action/Partition.js +0 -531
  48. package/src-old/action/Repeat.js +0 -106
  49. package/src-old/action/Repopulate.js +0 -44
  50. package/src-old/action/Stratify.js +0 -156
  51. package/src-old/basic/Gradient.js +0 -37
  52. package/src-old/basic/Point.js +0 -51
  53. package/src-old/basic/Rectangle.js +0 -63
  54. package/src-old/bind/bindToAngle.js +0 -56
  55. package/src-old/bind/bindToAreaMark.js +0 -360
  56. package/src-old/bind/bindToColor.js +0 -114
  57. package/src-old/bind/bindToLink.js +0 -81
  58. package/src-old/bind/bindToPosition.js +0 -283
  59. package/src-old/bind/bindToRadialDistance.js +0 -62
  60. package/src-old/bind/bindToSize.js +0 -235
  61. package/src-old/bind/bindToText.js +0 -60
  62. package/src-old/bind/bindToThickness.js +0 -100
  63. package/src-old/constraint/AffixConstraint.js +0 -129
  64. package/src-old/constraint/AlignConstraint.js +0 -58
  65. package/src-old/core/Encoding.js +0 -336
  66. package/src-old/core/Scale.js +0 -322
  67. package/src-old/core/SceneLoader.js +0 -290
  68. package/src-old/core/SceneValidator.js +0 -232
  69. package/src-old/core/SpecExecutor.js +0 -113
  70. package/src-old/core/SpecGenerator.js +0 -350
  71. package/src-old/data/DataImporter.js +0 -64
  72. package/src-old/data/DataScope.js +0 -124
  73. package/src-old/data/DataTable.js +0 -338
  74. package/src-old/data/Network.js +0 -106
  75. package/src-old/data/Tree.js +0 -251
  76. package/src-old/data/transform/Bin.js +0 -46
  77. package/src-old/data/transform/Filter.js +0 -48
  78. package/src-old/data/transform/Groupby.js +0 -18
  79. package/src-old/data/transform/KDE.js +0 -58
  80. package/src-old/data/transform/Sort.js +0 -14
  81. package/src-old/data/transform/Split.js +0 -5
  82. package/src-old/data/transform/partition.js +0 -46
  83. package/src-old/history/UndoRedoStack +0 -0
  84. package/src-old/index.js +0 -271
  85. package/src-old/indexSVG.js +0 -259
  86. package/src-old/interaction/Interaction.js +0 -91
  87. package/src-old/interaction/MouseEvent.js +0 -8
  88. package/src-old/interaction/Selection.js +0 -9
  89. package/src-old/interaction/brush.js +0 -362
  90. package/src-old/item/Segment.js +0 -29
  91. package/src-old/item/Vertex.js +0 -118
  92. package/src-old/item/composite/Collection.js +0 -106
  93. package/src-old/item/composite/Glyph.js +0 -19
  94. package/src-old/item/composite/Group.js +0 -310
  95. package/src-old/item/composite/Scene.js +0 -1251
  96. package/src-old/item/mark/ArcPath.js +0 -181
  97. package/src-old/item/mark/AreaPath.js +0 -78
  98. package/src-old/item/mark/CirclePath.js +0 -102
  99. package/src-old/item/mark/EllipsePath.js +0 -5
  100. package/src-old/item/mark/Image.js +0 -101
  101. package/src-old/item/mark/LinkPath.js +0 -118
  102. package/src-old/item/mark/Mark.js +0 -163
  103. package/src-old/item/mark/Path.js +0 -494
  104. package/src-old/item/mark/PointText.js +0 -201
  105. package/src-old/item/mark/PolygonPath.js +0 -64
  106. package/src-old/item/mark/RectPath.js +0 -88
  107. package/src-old/item/mark/RingPath.js +0 -92
  108. package/src-old/item/refs/Axis.js +0 -362
  109. package/src-old/item/refs/EncodingAxis.js +0 -515
  110. package/src-old/item/refs/Gridlines.js +0 -144
  111. package/src-old/item/refs/LayoutAxis.js +0 -316
  112. package/src-old/item/refs/Legend.js +0 -273
  113. package/src-old/layout/Circular.js +0 -95
  114. package/src-old/layout/Force.js +0 -52
  115. package/src-old/layout/Grid.js +0 -423
  116. package/src-old/layout/Layout.js +0 -13
  117. package/src-old/layout/Packing.js +0 -56
  118. package/src-old/layout/Stack.js +0 -264
  119. package/src-old/layout/Strata.js +0 -88
  120. package/src-old/layout/Sugiyama.js +0 -59
  121. package/src-old/layout/TidyTree.js +0 -105
  122. package/src-old/layout/Treemap.js +0 -87
  123. package/src-old/renderer/SVGInteractionHandler.js +0 -241
  124. package/src-old/renderer/SVGRenderer.js +0 -325
  125. package/src-old/renderer/WebGLRenderer.js +0 -1097
  126. package/src-old/renderer/WebGLRenderer2.js +0 -249
  127. package/src-old/renderer/threejs/Line2.js +0 -18
  128. package/src-old/renderer/threejs/LineGeometry.js +0 -77
  129. package/src-old/renderer/threejs/LineMaterial.js +0 -605
  130. package/src-old/renderer/threejs/LineSegments2.js +0 -281
  131. package/src-old/renderer/threejs/LineSegmentsGeometry.js +0 -226
  132. package/src-old/renderer/threejs/Wireframe.js +0 -51
  133. package/src-old/renderer/threejs/WireframeGeometry2.js +0 -16
  134. package/src-old/scale/areaSize.js +0 -0
  135. package/src-old/scale/domain.js +0 -38
  136. package/src-old/util/Constants.js +0 -180
  137. package/src-old/util/DataUtil.js +0 -35
  138. package/src-old/util/ItemUtil.js +0 -586
  139. package/src-old/util/Numerical.js +0 -33
  140. package/tests/demo-tests/README.md +0 -80
  141. package/tests/demo-tests/SVG2PNG.js +0 -56
  142. package/tests/demo-tests/demos2CanvasPNGs.js +0 -69
  143. package/tests/demo-tests/demos2ScenesSVGs.js +0 -100
  144. package/tests/demo-tests/pathElementWorker.js +0 -91
  145. package/tests/demo-tests/pixelTest.js +0 -62
  146. package/tests/demo-tests/renderDemos.html +0 -132
  147. package/tests/demo-tests/serializationTest.js +0 -36
  148. package/tests/demo-tests/serializeDemos.html +0 -134
  149. package/tests/unit-tests/README.md +0 -4
  150. package/tests/unit-tests/jasmine-browser.json +0 -21
  151. package/tests/unit-tests/jasmine.json +0 -14
  152. package/tests/unit-tests/testSpec.js +0 -274
@@ -1,249 +0,0 @@
1
- import * as THREE from 'three';
2
- import { ItemType } from '../util/Constants';
3
- import * as d3 from "d3";
4
- import SVGRenderer from './SVGRenderer';
5
- import LineGeometry from './threejs/LineGeometry';
6
- import LineMaterial from './threejs/LineMaterial';
7
- import { Line2 } from './threejs/Line2';
8
- // import {SVGLoader} from "three/examples/jsm/loaders/SVGLoader";
9
- // import { schemeAccent } from 'd3';
10
- // import LineSegmentsGeometry from './threejs/LineSegmentsGeometry';
11
- // import { LineSegments } from 'three';
12
- // import WireframeGeometry2 from './threejs/WireframeGeometry2';
13
- // import Wireframe from './threejs/Wireframe';
14
- // import LineSegments2 from './threejs/LineSegments2';
15
-
16
- export default class WebGLRenderer2 {
17
-
18
- constructor(canvasId) {
19
- this._canvasId = canvasId;
20
- this._canvas = document.getElementById(this._canvasId);
21
- this._width = 1600;
22
- this._height = 1200;
23
- this._threeRenderer = new THREE.WebGLRenderer({
24
- antialias: true,
25
- alpha: true,
26
- canvas: this._canvas,
27
- preserveDrawingBuffer: true,
28
- logarithmicDepthBuffer: true,
29
- });
30
- this._threeRenderer.setPixelRatio(window.devicePixelRatio);
31
- this._threeRenderer.setSize(this._width, this._height);
32
- this._threeCamera = new THREE.OrthographicCamera(
33
- this._width / -2,
34
- this._width / 2,
35
- this._height / 2,
36
- this._height / -2,
37
- -1000,
38
- 1000
39
- );
40
- this._threeCamera.position.set(this._width / 2, this._height / -2, 10);
41
- this._threeScene = new THREE.Scene();
42
- this._threeScene.add(this._threeCamera);
43
- this._textLayerId = this._canvasId + "_textLayer_atlas";
44
- this._textLayer = d3.select("#"+this._textLayerId);
45
- if (this._textLayer.empty()) {
46
- this._textLayer = d3.select(this._canvas.parentNode).insert("svg", "#"+this._canvasId + "+*")
47
- .attr("id", this._textLayerId).attr("width", this._width).attr("height", this._height)
48
- .style("position", "absolute")
49
- .style("left", this._canvas.getBoundingClientRect().left+"px")
50
- .style("top", this._canvas.getBoundingClientRect().top);
51
- }
52
- this._svgRenderer = new SVGRenderer(this._textLayerId);
53
- }
54
-
55
- render(scene, params) {
56
- this.clear();
57
- this._renderItem(scene, params);
58
- this._threeRenderer.render( this._threeScene, this._threeCamera );
59
- }
60
-
61
- _renderItem(item) {
62
- switch (item.type) {
63
- case ItemType.Circle:
64
- return this._renderCircle(item);
65
-
66
- case ItemType.Pie:
67
- return this._renderArcPath(item);
68
-
69
- case ItemType.Area:
70
- return this._renderArea(item);
71
-
72
- case ItemType.Polygon:
73
- return this._renderPolygon(item);
74
-
75
- case ItemType.Axis:
76
- case ItemType.Legend:
77
- return this._svgRenderer._renderItem(item);
78
-
79
- case ItemType.Collection:
80
- case ItemType.Glyph:
81
- case ItemType.Group:
82
- case ItemType.Gridlines:
83
- case ItemType.Scene:
84
- return this._renderGroup(item);
85
-
86
- case ItemType.Path:
87
- return this._renderPath(item);
88
-
89
- case ItemType.Line:
90
- return this._renderLinearPath(item);
91
-
92
- case ItemType.Rect:
93
- return this._renderRectangle(item);
94
-
95
- case ItemType.PointText:
96
- return this._svgRenderer._renderItem(item);
97
-
98
- case ItemType.Arc:
99
- return this._renderArc(item);
100
-
101
- case ItemType.Image:
102
- return this._renderImage(item);
103
-
104
- case ItemType.Link:
105
- return this._renderLink(item);
106
-
107
- default:
108
- throw new Error(`Expect: itemType, Actual: ${item}\nWait that's illegal`)
109
- }
110
- }
111
-
112
- _renderGroup(group) {
113
- if (group.type == ItemType.Scene) {
114
- this._threeScene.background = group.fillColor ? new THREE.Color(group.fillColor) : new THREE.Color(0xffffff);
115
- }
116
- for (const item of group.children) {
117
- this._renderItem(item);
118
- }
119
- }
120
-
121
- _renderLinearPath(line) {
122
- // let material = line.strokeDash != "none" ? new THREE.LineDashedMaterial({color: line.strokeColor}) : new THREE.LineBasicMaterial ({color: line.strokeColor});
123
- // let geom = new THREE.BufferGeometry().setFromPoints(line.vertices.map(d => new THREE.Vector3(d.x, -d.y, 0)));
124
- // let l = new THREE.Line(geom, material);
125
- // l.visible = line.visibility != "hidden";
126
- // this._threeScene.add(l);
127
-
128
- let positions = [];
129
- for (let v of line.vertices) {
130
- positions.push(v.x, -v.y, 0);
131
- }
132
- let geom = new LineGeometry();
133
- geom.setPositions(positions);
134
-
135
- let m = new LineMaterial({linewidth: line.strokeWidth, color: line.strokeColor});
136
- m.resolution.set(this._width, this._height);
137
- let l = new Line2(geom, m);
138
- this._threeScene.add(l);
139
-
140
- for (let v of line.vertices) {
141
- this._renderVertex(v);
142
- }
143
- }
144
-
145
- _renderRectangle(rect) {
146
- let geom = new THREE.BoxGeometry(rect.width, rect.height, 0),
147
- material = new THREE.MeshBasicMaterial({color: rect.fillColor});
148
- let mesh = new THREE.Mesh(geom, material);
149
- mesh.position.set(rect.x, -rect.y);
150
- this._threeScene.add(mesh);
151
-
152
- if (rect.strokeWidth > 0) {
153
- let edgeGeom = new THREE.EdgesGeometry(geom),
154
- line = new THREE.LineSegments(edgeGeom, new THREE.LineBasicMaterial({color: rect.strokeColor}));
155
- line.position.set(rect.x, -rect.y);
156
- this._threeScene.add(line);
157
- // let edgeGeom = new THREE.EdgesGeometry(geom);
158
- // let m = new LineMaterial({color: rect.strokeColor, linewidth: 10});
159
- // m.resolution.set(this._width, this._height);
160
- // let geo = new LineSegmentsGeometry().fromEdgesGeometry(edgeGeom);
161
- // let line = new Line2(geo, m);
162
- // this._threeScene.add(line);
163
- }
164
- }
165
-
166
- _renderVertex(v) {
167
- if (v.shape == undefined) return;
168
- switch (v.shape) {
169
- case "rect":
170
- this._renderRectangle(v);
171
- break;
172
- case "circle":
173
- break;
174
- }
175
- }
176
-
177
- _renderCircle(c) {
178
- let geom = new THREE.CircleGeometry(c.radius, 32)
179
- if (c.fillColor != "none") {
180
- let material = new THREE.MeshBasicMaterial({color: c.fillColor});
181
- let circle = new THREE.Mesh(geom, material);
182
- circle.position.set(c.x, -c.y, 0);
183
- this._threeScene.add(circle);
184
- }
185
- if (c.strokeWidth > 0) {
186
- let edge = new THREE.EdgesGeometry(geom);
187
- let line = new THREE.LineSegments(edge, new THREE.LineBasicMaterial({color: c.strokeColor}));
188
- line.position.set(c.x, -c.y, 0);
189
- this._threeScene.add(line);
190
- }
191
-
192
- }
193
-
194
- _renderArc() {
195
-
196
- }
197
-
198
- _renderImage() {
199
-
200
- }
201
-
202
- _renderLink() {
203
-
204
- }
205
-
206
- _renderPath(path) {
207
- //Convert path.vertices to an array of vectors to use in SplineCurve()
208
- var vectorarr = [];
209
- for (let v of path.vertices) {
210
- var vector = new THREE.Vector2(v.x, -v.y);
211
- vectorarr.push(vector);
212
- }
213
- const curve = new THREE.SplineCurve(vectorarr);
214
- var points = curve.getPoints( 1000 );
215
-
216
- //Converts vector2 array into [ x1, y1, z1, x2, y2, z2, ... ] format
217
- var convertedpoints = [];
218
- for (let v of points) {
219
- convertedpoints.push(v.x);
220
- convertedpoints.push(v.y);
221
- convertedpoints.push(0);
222
- }
223
- const geometry = new LineGeometry();
224
- geometry.setPositions(convertedpoints);
225
-
226
- const linematerial = new LineMaterial({
227
- color: path.strokeColor,
228
- linewidth: path.strokeWidth, // px
229
- resolution: new THREE.Vector2(640, 480) // resolution of the viewport
230
- });
231
- const myLine = new Line2(geometry, linematerial);
232
- this._threeScene.add(myLine);
233
- }
234
-
235
- _renderPolygon() {
236
-
237
- }
238
-
239
- _renderText() {
240
-
241
- }
242
-
243
- clear() {
244
- while(this._threeScene.children.length > 0){
245
- this._threeScene.remove(this._threeScene.children[0]);
246
- }
247
- this._svgRenderer.clear();
248
- }
249
- }
@@ -1,18 +0,0 @@
1
- import * as THREE from 'three';
2
- import LineSegments2 from './LineSegments2';
3
-
4
- export class Line2 extends LineSegments2 {
5
-
6
- constructor( geometry = new THREE.LineGeometry(), material = new THREE.LineMaterial( {
7
- color: Math.random() * 0xffffff
8
- } ) ) {
9
-
10
- super( geometry, material );
11
- this.type = 'Line2';
12
-
13
- }
14
-
15
- }
16
-
17
- Line2.prototype.isLine2 = true;
18
-
@@ -1,77 +0,0 @@
1
- import LineSegmentsGeometry from './LineSegmentsGeometry';
2
-
3
- export default class LineGeometry extends LineSegmentsGeometry {
4
-
5
- constructor() {
6
-
7
- super();
8
- this.type = 'LineGeometry';
9
-
10
- }
11
-
12
- setPositions( array ) {
13
-
14
- // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format
15
- var length = array.length - 3;
16
- var points = new Float32Array( 2 * length );
17
-
18
- for ( var i = 0; i < length; i += 3 ) {
19
-
20
- points[ 2 * i ] = array[ i ];
21
- points[ 2 * i + 1 ] = array[ i + 1 ];
22
- points[ 2 * i + 2 ] = array[ i + 2 ];
23
- points[ 2 * i + 3 ] = array[ i + 3 ];
24
- points[ 2 * i + 4 ] = array[ i + 4 ];
25
- points[ 2 * i + 5 ] = array[ i + 5 ];
26
- }
27
-
28
- super.setPositions( points );
29
- return this;
30
-
31
- }
32
-
33
- setColors( array ) {
34
-
35
- // converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format
36
- var length = array.length - 3;
37
- var colors = new Float32Array( 2 * length );
38
-
39
- for ( var i = 0; i < length; i += 3 ) {
40
-
41
- colors[ 2 * i ] = array[ i ];
42
- colors[ 2 * i + 1 ] = array[ i + 1 ];
43
- colors[ 2 * i + 2 ] = array[ i + 2 ];
44
- colors[ 2 * i + 3 ] = array[ i + 3 ];
45
- colors[ 2 * i + 4 ] = array[ i + 4 ];
46
- colors[ 2 * i + 5 ] = array[ i + 5 ];
47
-
48
- }
49
-
50
- super.setColors( colors );
51
- return this;
52
-
53
- }
54
-
55
- fromLine( line ) {
56
-
57
- var geometry = line.geometry;
58
-
59
- if ( geometry.isGeometry ) {
60
-
61
- console.error( 'THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.' );
62
- return;
63
-
64
- } else if ( geometry.isBufferGeometry ) {
65
-
66
- this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
67
-
68
- } // set colors, maybe
69
-
70
-
71
- return this;
72
-
73
- }
74
-
75
- }
76
-
77
- LineGeometry.prototype.isLineGeometry = true;