@holoviz/geoviews 1.9.7-a4 → 1.10.0-a1

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/dist/geoviews.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors
2
+ * Copyright (c) 2012 - 2023, Anaconda, Inc., and Bokeh Contributors
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without modification,
@@ -44,30 +44,31 @@
44
44
  "c764d38756": /* index.js */ function _(require, module, exports, __esModule, __esExport) {
45
45
  __esModule();
46
46
  const tslib_1 = require("tslib");
47
- const GeoViews = (0, tslib_1.__importStar)(require("b4555bea44") /* ./models */);
47
+ const GeoViews = tslib_1.__importStar(require("b4555bea44") /* ./models */);
48
48
  exports.GeoViews = GeoViews;
49
49
  const base_1 = require("@bokehjs/base");
50
50
  (0, base_1.register_models)(GeoViews);
51
51
  },
52
52
  "b4555bea44": /* models/index.js */ function _(require, module, exports, __esModule, __esExport) {
53
53
  __esModule();
54
- var checkpoint_tool_1 = require("fc272d6e02") /* ./checkpoint_tool */;
54
+ var checkpoint_tool_1 = require("1d7c6c8516") /* ./checkpoint_tool */;
55
55
  __esExport("CheckpointTool", checkpoint_tool_1.CheckpointTool);
56
- var clear_tool_1 = require("eddee4057c") /* ./clear_tool */;
56
+ var clear_tool_1 = require("1c15765006") /* ./clear_tool */;
57
57
  __esExport("ClearTool", clear_tool_1.ClearTool);
58
- var poly_draw_1 = require("8288feb407") /* ./poly_draw */;
58
+ var poly_draw_1 = require("cddc7627cc") /* ./poly_draw */;
59
59
  __esExport("PolyVertexDrawTool", poly_draw_1.PolyVertexDrawTool);
60
- var poly_edit_1 = require("5e7ea505ce") /* ./poly_edit */;
60
+ var poly_edit_1 = require("296f32feb2") /* ./poly_edit */;
61
61
  __esExport("PolyVertexEditTool", poly_edit_1.PolyVertexEditTool);
62
- var restore_tool_1 = require("e81e0595cf") /* ./restore_tool */;
62
+ var restore_tool_1 = require("92294e6ad2") /* ./restore_tool */;
63
63
  __esExport("RestoreTool", restore_tool_1.RestoreTool);
64
64
  },
65
- "fc272d6e02": /* models/checkpoint_tool.js */ function _(require, module, exports, __esModule, __esExport) {
65
+ "1d7c6c8516": /* models/checkpoint_tool.js */ function _(require, module, exports, __esModule, __esExport) {
66
66
  __esModule();
67
- const tslib_1 = require("tslib");
68
- const p = (0, tslib_1.__importStar)(require("@bokehjs/core/properties"));
67
+ var _a;
69
68
  const array_1 = require("@bokehjs/core/util/array");
70
69
  const action_tool_1 = require("@bokehjs/models/tools/actions/action_tool");
70
+ const column_data_source_1 = require("@bokehjs/models/sources/column_data_source");
71
+ const icons_css_1 = require("@bokehjs/styles/icons.css");
71
72
  class CheckpointToolView extends action_tool_1.ActionToolView {
72
73
  doit() {
73
74
  const sources = this.model.sources;
@@ -99,25 +100,26 @@
99
100
  constructor(attrs) {
100
101
  super(attrs);
101
102
  this.tool_name = "Checkpoint";
102
- this.icon = "bk-tool-icon-save";
103
- }
104
- static init_CheckpointTool() {
105
- this.prototype.default_view = CheckpointToolView;
106
- this.define({
107
- sources: [p.Array, []],
108
- });
103
+ this.tool_icon = icons_css_1.tool_icon_save;
109
104
  }
110
105
  }
111
106
  exports.CheckpointTool = CheckpointTool;
107
+ _a = CheckpointTool;
112
108
  CheckpointTool.__name__ = "CheckpointTool";
113
109
  CheckpointTool.__module__ = "geoviews.models.custom_tools";
114
- CheckpointTool.init_CheckpointTool();
110
+ (() => {
111
+ _a.prototype.default_view = CheckpointToolView;
112
+ _a.define(({ Array, Ref }) => ({
113
+ sources: [Array(Ref(column_data_source_1.ColumnDataSource)), []],
114
+ }));
115
+ })();
115
116
  },
116
- "eddee4057c": /* models/clear_tool.js */ function _(require, module, exports, __esModule, __esExport) {
117
+ "1c15765006": /* models/clear_tool.js */ function _(require, module, exports, __esModule, __esExport) {
117
118
  __esModule();
118
- const tslib_1 = require("tslib");
119
- const p = (0, tslib_1.__importStar)(require("@bokehjs/core/properties"));
119
+ var _a;
120
120
  const action_tool_1 = require("@bokehjs/models/tools/actions/action_tool");
121
+ const column_data_source_1 = require("@bokehjs/models/sources/column_data_source");
122
+ const icons_css_1 = require("@bokehjs/styles/icons.css");
121
123
  class ClearToolView extends action_tool_1.ActionToolView {
122
124
  doit() {
123
125
  for (var source of this.model.sources) {
@@ -135,24 +137,23 @@
135
137
  constructor(attrs) {
136
138
  super(attrs);
137
139
  this.tool_name = "Clear data";
138
- this.icon = "bk-tool-icon-reset";
139
- }
140
- static init_ClearTool() {
141
- this.prototype.default_view = ClearToolView;
142
- this.define({
143
- sources: [p.Array, []],
144
- });
140
+ this.tool_icon = icons_css_1.tool_icon_reset;
145
141
  }
146
142
  }
147
143
  exports.ClearTool = ClearTool;
144
+ _a = ClearTool;
148
145
  ClearTool.__name__ = "ClearTool";
149
146
  ClearTool.__module__ = "geoviews.models.custom_tools";
150
- ClearTool.init_ClearTool();
147
+ (() => {
148
+ _a.prototype.default_view = ClearToolView;
149
+ _a.define(({ Array, Ref }) => ({
150
+ sources: [Array(Ref(column_data_source_1.ColumnDataSource)), []],
151
+ }));
152
+ })();
151
153
  },
152
- "8288feb407": /* models/poly_draw.js */ function _(require, module, exports, __esModule, __esExport) {
154
+ "cddc7627cc": /* models/poly_draw.js */ function _(require, module, exports, __esModule, __esExport) {
153
155
  __esModule();
154
- const tslib_1 = require("tslib");
155
- const p = (0, tslib_1.__importStar)(require("@bokehjs/core/properties"));
156
+ var _a;
156
157
  const object_1 = require("@bokehjs/core/util/object");
157
158
  const types_1 = require("@bokehjs/core/util/types");
158
159
  const poly_draw_tool_1 = require("@bokehjs/models/tools/edit/poly_draw_tool");
@@ -216,6 +217,8 @@
216
217
  return [x, y];
217
218
  }
218
219
  _set_vertices(xs, ys, styles) {
220
+ if (this.model.vertex_renderer == null)
221
+ return;
219
222
  const point_glyph = this.model.vertex_renderer.glyph;
220
223
  const point_cds = this.model.vertex_renderer.data_source;
221
224
  const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];
@@ -312,23 +315,22 @@
312
315
  constructor(attrs) {
313
316
  super(attrs);
314
317
  }
315
- static init_PolyVertexDrawTool() {
316
- this.prototype.default_view = PolyVertexDrawToolView;
317
- this.define({
318
- end_style: [p.Any, {}],
319
- node_style: [p.Any, {}],
320
- });
321
- }
322
318
  }
323
319
  exports.PolyVertexDrawTool = PolyVertexDrawTool;
320
+ _a = PolyVertexDrawTool;
324
321
  PolyVertexDrawTool.__name__ = "PolyVertexDrawTool";
325
322
  PolyVertexDrawTool.__module__ = "geoviews.models.custom_tools";
326
- PolyVertexDrawTool.init_PolyVertexDrawTool();
323
+ (() => {
324
+ _a.prototype.default_view = PolyVertexDrawToolView;
325
+ _a.define(({ Any }) => ({
326
+ end_style: [Any, {}],
327
+ node_style: [Any, {}],
328
+ }));
329
+ })();
327
330
  },
328
- "5e7ea505ce": /* models/poly_edit.js */ function _(require, module, exports, __esModule, __esExport) {
331
+ "296f32feb2": /* models/poly_edit.js */ function _(require, module, exports, __esModule, __esExport) {
329
332
  __esModule();
330
- const tslib_1 = require("tslib");
331
- const p = (0, tslib_1.__importStar)(require("@bokehjs/core/properties"));
333
+ var _a;
332
334
  const object_1 = require("@bokehjs/core/util/object");
333
335
  const types_1 = require("@bokehjs/core/util/types");
334
336
  const poly_edit_tool_1 = require("@bokehjs/models/tools/edit/poly_edit_tool");
@@ -345,20 +347,20 @@
345
347
  this._emit_cds_changes(this._selected_renderer.data_source, false, true, false);
346
348
  }
347
349
  _pan(ev) {
348
- if (this._basepoint == null)
350
+ if (this._basepoint == null || this.model.vertex_renderer == null)
349
351
  return;
350
352
  const points = this._drag_points(ev, [this.model.vertex_renderer]);
351
- if (!ev.shiftKey) {
353
+ if (!ev.shift_key) {
352
354
  this._move_linked(points);
353
355
  }
354
356
  if (this._selected_renderer)
355
357
  this._selected_renderer.data_source.change.emit();
356
358
  }
357
359
  _pan_end(ev) {
358
- if (this._basepoint == null)
360
+ if (this._basepoint == null || this.model.vertex_renderer == null)
359
361
  return;
360
362
  const points = this._drag_points(ev, [this.model.vertex_renderer]);
361
- if (!ev.shiftKey) {
363
+ if (!ev.shift_key) {
362
364
  this._move_linked(points);
363
365
  }
364
366
  this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true);
@@ -405,6 +407,8 @@
405
407
  return points;
406
408
  }
407
409
  _set_vertices(xs, ys, styles) {
410
+ if (this.model.vertex_renderer == null)
411
+ return;
408
412
  const point_glyph = this.model.vertex_renderer.glyph;
409
413
  const point_cds = this.model.vertex_renderer.data_source;
410
414
  const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];
@@ -457,6 +461,8 @@
457
461
  }
458
462
  }
459
463
  _tap(ev) {
464
+ if (this.model.vertex_renderer == null)
465
+ return;
460
466
  const renderer = this.model.vertex_renderer;
461
467
  const point = this._map_drag(ev.sx, ev.sy, renderer);
462
468
  if (point == null)
@@ -542,24 +548,25 @@
542
548
  constructor(attrs) {
543
549
  super(attrs);
544
550
  }
545
- static init_PolyVertexEditTool() {
546
- this.prototype.default_view = PolyVertexEditToolView;
547
- this.define({
548
- node_style: [p.Any, {}],
549
- end_style: [p.Any, {}],
550
- });
551
- }
552
551
  }
553
552
  exports.PolyVertexEditTool = PolyVertexEditTool;
553
+ _a = PolyVertexEditTool;
554
554
  PolyVertexEditTool.__name__ = "PolyVertexEditTool";
555
555
  PolyVertexEditTool.__module__ = "geoviews.models.custom_tools";
556
- PolyVertexEditTool.init_PolyVertexEditTool();
556
+ (() => {
557
+ _a.prototype.default_view = PolyVertexEditToolView;
558
+ _a.define(({ Any }) => ({
559
+ end_style: [Any, {}],
560
+ node_style: [Any, {}],
561
+ }));
562
+ })();
557
563
  },
558
- "e81e0595cf": /* models/restore_tool.js */ function _(require, module, exports, __esModule, __esExport) {
564
+ "92294e6ad2": /* models/restore_tool.js */ function _(require, module, exports, __esModule, __esExport) {
559
565
  __esModule();
560
- const tslib_1 = require("tslib");
561
- const p = (0, tslib_1.__importStar)(require("@bokehjs/core/properties"));
566
+ var _a;
562
567
  const action_tool_1 = require("@bokehjs/models/tools/actions/action_tool");
568
+ const column_data_source_1 = require("@bokehjs/models/sources/column_data_source");
569
+ const icons_css_1 = require("@bokehjs/styles/icons.css");
563
570
  class RestoreToolView extends action_tool_1.ActionToolView {
564
571
  doit() {
565
572
  const sources = this.model.sources;
@@ -579,19 +586,19 @@
579
586
  constructor(attrs) {
580
587
  super(attrs);
581
588
  this.tool_name = "Restore";
582
- this.icon = "bk-tool-icon-undo";
583
- }
584
- static init_RestoreTool() {
585
- this.prototype.default_view = RestoreToolView;
586
- this.define({
587
- sources: [p.Array, []]
588
- });
589
+ this.tool_icon = icons_css_1.tool_icon_undo;
589
590
  }
590
591
  }
591
592
  exports.RestoreTool = RestoreTool;
593
+ _a = RestoreTool;
592
594
  RestoreTool.__name__ = "RestoreTool";
593
595
  RestoreTool.__module__ = "geoviews.models.custom_tools";
594
- RestoreTool.init_RestoreTool();
596
+ (() => {
597
+ _a.prototype.default_view = RestoreToolView;
598
+ _a.define(({ Array, Ref }) => ({
599
+ sources: [Array(Ref(column_data_source_1.ColumnDataSource)), []],
600
+ }));
601
+ })();
595
602
  },
596
- }, "c764d38756", {"index":"c764d38756","models/index":"b4555bea44","models/checkpoint_tool":"fc272d6e02","models/clear_tool":"eddee4057c","models/poly_draw":"8288feb407","models/poly_edit":"5e7ea505ce","models/restore_tool":"e81e0595cf"}, {});});
603
+ }, "c764d38756", {"index":"c764d38756","models/index":"b4555bea44","models/checkpoint_tool":"1d7c6c8516","models/clear_tool":"1c15765006","models/poly_draw":"cddc7627cc","models/poly_edit":"296f32feb2","models/restore_tool":"92294e6ad2"}, {});});
597
604
  //# sourceMappingURL=geoviews.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@@/geoviews/dist/lib/index.js","@@/geoviews/dist/lib/models/index.js","@@/geoviews/dist/lib/models/checkpoint_tool.js","@@/geoviews/dist/lib/models/clear_tool.js","@@/geoviews/dist/lib/models/poly_draw.js","@@/geoviews/dist/lib/models/poly_edit.js","@@/geoviews/dist/lib/models/restore_tool.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"generated.js","sourceRoot":"","sourcesContent":["/* index.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n const tslib_1 = require(\"tslib\");\n const GeoViews = (0, tslib_1.__importStar)(require(\"b4555bea44\") /* ./models */);\n exports.GeoViews = GeoViews;\n const base_1 = require(\"@bokehjs/base\");\n (0, base_1.register_models)(GeoViews);\n}\n","/* models/index.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n var checkpoint_tool_1 = require(\"fc272d6e02\") /* ./checkpoint_tool */;\n __esExport(\"CheckpointTool\", checkpoint_tool_1.CheckpointTool);\n var clear_tool_1 = require(\"eddee4057c\") /* ./clear_tool */;\n __esExport(\"ClearTool\", clear_tool_1.ClearTool);\n var poly_draw_1 = require(\"8288feb407\") /* ./poly_draw */;\n __esExport(\"PolyVertexDrawTool\", poly_draw_1.PolyVertexDrawTool);\n var poly_edit_1 = require(\"5e7ea505ce\") /* ./poly_edit */;\n __esExport(\"PolyVertexEditTool\", poly_edit_1.PolyVertexEditTool);\n var restore_tool_1 = require(\"e81e0595cf\") /* ./restore_tool */;\n __esExport(\"RestoreTool\", restore_tool_1.RestoreTool);\n}\n","/* models/checkpoint_tool.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n const tslib_1 = require(\"tslib\");\n const p = (0, tslib_1.__importStar)(require(\"@bokehjs/core/properties\"));\n const array_1 = require(\"@bokehjs/core/util/array\");\n const action_tool_1 = require(\"@bokehjs/models/tools/actions/action_tool\");\n class CheckpointToolView extends action_tool_1.ActionToolView {\n doit() {\n const sources = this.model.sources;\n for (const source of sources) {\n if (!source.buffer) {\n source.buffer = [];\n }\n let data_copy = {};\n for (const key in source.data) {\n const column = source.data[key];\n const new_column = [];\n for (const arr of column) {\n if (Array.isArray(arr) || (ArrayBuffer.isView(arr))) {\n new_column.push((0, array_1.copy)(arr));\n }\n else {\n new_column.push(arr);\n }\n }\n data_copy[key] = new_column;\n }\n source.buffer.push(data_copy);\n }\n }\n }\n exports.CheckpointToolView = CheckpointToolView;\n CheckpointToolView.__name__ = \"CheckpointToolView\";\n class CheckpointTool extends action_tool_1.ActionTool {\n constructor(attrs) {\n super(attrs);\n this.tool_name = \"Checkpoint\";\n this.icon = \"bk-tool-icon-save\";\n }\n static init_CheckpointTool() {\n this.prototype.default_view = CheckpointToolView;\n this.define({\n sources: [p.Array, []],\n });\n }\n }\n exports.CheckpointTool = CheckpointTool;\n CheckpointTool.__name__ = \"CheckpointTool\";\n CheckpointTool.__module__ = \"geoviews.models.custom_tools\";\n CheckpointTool.init_CheckpointTool();\n}\n","/* models/clear_tool.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n const tslib_1 = require(\"tslib\");\n const p = (0, tslib_1.__importStar)(require(\"@bokehjs/core/properties\"));\n const action_tool_1 = require(\"@bokehjs/models/tools/actions/action_tool\");\n class ClearToolView extends action_tool_1.ActionToolView {\n doit() {\n for (var source of this.model.sources) {\n for (const column in source.data) {\n source.data[column] = [];\n }\n source.change.emit();\n source.properties.data.change.emit();\n }\n }\n }\n exports.ClearToolView = ClearToolView;\n ClearToolView.__name__ = \"ClearToolView\";\n class ClearTool extends action_tool_1.ActionTool {\n constructor(attrs) {\n super(attrs);\n this.tool_name = \"Clear data\";\n this.icon = \"bk-tool-icon-reset\";\n }\n static init_ClearTool() {\n this.prototype.default_view = ClearToolView;\n this.define({\n sources: [p.Array, []],\n });\n }\n }\n exports.ClearTool = ClearTool;\n ClearTool.__name__ = \"ClearTool\";\n ClearTool.__module__ = \"geoviews.models.custom_tools\";\n ClearTool.init_ClearTool();\n}\n","/* models/poly_draw.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n const tslib_1 = require(\"tslib\");\n const p = (0, tslib_1.__importStar)(require(\"@bokehjs/core/properties\"));\n const object_1 = require(\"@bokehjs/core/util/object\");\n const types_1 = require(\"@bokehjs/core/util/types\");\n const poly_draw_tool_1 = require(\"@bokehjs/models/tools/edit/poly_draw_tool\");\n class PolyVertexDrawToolView extends poly_draw_tool_1.PolyDrawToolView {\n _split_path(x, y) {\n for (let r = 0; r < this.model.renderers.length; r++) {\n const renderer = this.model.renderers[r];\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n const xpaths = cds.data[xkey];\n const ypaths = cds.data[ykey];\n for (let index = 0; index < xpaths.length; index++) {\n let xs = xpaths[index];\n if (!(0, types_1.isArray)(xs)) {\n xs = Array.from(xs);\n cds.data[xkey][index] = xs;\n }\n let ys = ypaths[index];\n if (!(0, types_1.isArray)(ys)) {\n ys = Array.from(ys);\n cds.data[ykey][index] = ys;\n }\n for (let i = 0; i < xs.length; i++) {\n if ((xs[i] == x) && (ys[i] == y) && (i != 0) && (i != (xs.length - 1))) {\n xpaths.splice(index + 1, 0, xs.slice(i));\n ypaths.splice(index + 1, 0, ys.slice(i));\n xs.splice(i + 1);\n ys.splice(i + 1);\n for (const column of cds.columns()) {\n if ((column !== xkey) && (column != ykey))\n cds.data[column].splice(index + 1, 0, cds.data[column][index]);\n }\n return;\n }\n }\n }\n }\n }\n _snap_to_vertex(ev, x, y) {\n if (this.model.vertex_renderer) {\n // If an existing vertex is hit snap to it\n const vertex_selected = this._select_event(ev, \"replace\", [this.model.vertex_renderer]);\n const point_ds = this.model.vertex_renderer.data_source;\n // Type once dataspecs are typed\n const point_glyph = this.model.vertex_renderer.glyph;\n const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n if (vertex_selected.length) {\n // If existing vertex is hit split path at that location\n // converting to feature vertex\n const index = point_ds.selected.indices[0];\n if (pxkey)\n x = point_ds.data[pxkey][index];\n if (pykey)\n y = point_ds.data[pykey][index];\n if (ev.type != 'mousemove')\n this._split_path(x, y);\n point_ds.selection_manager.clear();\n }\n }\n return [x, y];\n }\n _set_vertices(xs, ys, styles) {\n const point_glyph = this.model.vertex_renderer.glyph;\n const point_cds = this.model.vertex_renderer.data_source;\n const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n if (pxkey) {\n if ((0, types_1.isArray)(xs))\n point_cds.data[pxkey] = xs;\n else\n point_glyph.x = { value: xs };\n }\n if (pykey) {\n if ((0, types_1.isArray)(ys))\n point_cds.data[pykey] = ys;\n else\n point_glyph.y = { value: ys };\n }\n if (styles != null) {\n for (const key of (0, object_1.keys)(styles)) {\n point_cds.data[key] = styles[key];\n point_glyph[key] = { field: key };\n }\n }\n else {\n for (const col of point_cds.columns()) {\n point_cds.data[col] = [];\n }\n }\n this._emit_cds_changes(point_cds, true, true, false);\n }\n _show_vertices() {\n if (!this.model.active) {\n return;\n }\n const xs = [];\n const ys = [];\n const styles = {};\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key] = [];\n for (let i = 0; i < this.model.renderers.length; i++) {\n const renderer = this.model.renderers[i];\n const cds = renderer.data_source;\n const glyph = renderer.glyph;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n for (const array of cds.get_array(xkey)) {\n Array.prototype.push.apply(xs, array);\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key].push(this.model.end_style[key]);\n for (const key of (0, object_1.keys)(this.model.node_style)) {\n for (let index = 0; index < (array.length - 2); index++) {\n styles[key].push(this.model.node_style[key]);\n }\n }\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key].push(this.model.end_style[key]);\n }\n for (const array of cds.get_array(ykey))\n Array.prototype.push.apply(ys, array);\n if (this._drawing && (i == (this.model.renderers.length - 1))) {\n // Skip currently drawn vertex\n xs.splice(xs.length - 1, 1);\n ys.splice(ys.length - 1, 1);\n for (const key of (0, object_1.keys)(styles))\n styles[key].splice(styles[key].length - 1, 1);\n }\n }\n this._set_vertices(xs, ys, styles);\n }\n _remove() {\n const renderer = this.model.renderers[0];\n const cds = renderer.data_source;\n const glyph = renderer.glyph;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n if (xkey) {\n const xidx = cds.data[xkey].length - 1;\n const xs = cds.get_array(xkey)[xidx];\n xs.splice(xs.length - 1, 1);\n if (xs.length == 1)\n cds.data[xkey].splice(xidx, 1);\n }\n if (ykey) {\n const yidx = cds.data[ykey].length - 1;\n const ys = cds.get_array(ykey)[yidx];\n ys.splice(ys.length - 1, 1);\n if (ys.length == 1)\n cds.data[ykey].splice(yidx, 1);\n }\n this._emit_cds_changes(cds);\n this._drawing = false;\n this._show_vertices();\n }\n }\n exports.PolyVertexDrawToolView = PolyVertexDrawToolView;\n PolyVertexDrawToolView.__name__ = \"PolyVertexDrawToolView\";\n class PolyVertexDrawTool extends poly_draw_tool_1.PolyDrawTool {\n constructor(attrs) {\n super(attrs);\n }\n static init_PolyVertexDrawTool() {\n this.prototype.default_view = PolyVertexDrawToolView;\n this.define({\n end_style: [p.Any, {}],\n node_style: [p.Any, {}],\n });\n }\n }\n exports.PolyVertexDrawTool = PolyVertexDrawTool;\n PolyVertexDrawTool.__name__ = \"PolyVertexDrawTool\";\n PolyVertexDrawTool.__module__ = \"geoviews.models.custom_tools\";\n PolyVertexDrawTool.init_PolyVertexDrawTool();\n}\n","/* models/poly_edit.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n const tslib_1 = require(\"tslib\");\n const p = (0, tslib_1.__importStar)(require(\"@bokehjs/core/properties\"));\n const object_1 = require(\"@bokehjs/core/util/object\");\n const types_1 = require(\"@bokehjs/core/util/types\");\n const poly_edit_tool_1 = require(\"@bokehjs/models/tools/edit/poly_edit_tool\");\n class PolyVertexEditToolView extends poly_edit_tool_1.PolyEditToolView {\n deactivate() {\n this._hide_vertices();\n if (!this._selected_renderer) {\n return;\n }\n else if (this._drawing) {\n this._remove_vertex();\n this._drawing = false;\n }\n this._emit_cds_changes(this._selected_renderer.data_source, false, true, false);\n }\n _pan(ev) {\n if (this._basepoint == null)\n return;\n const points = this._drag_points(ev, [this.model.vertex_renderer]);\n if (!ev.shiftKey) {\n this._move_linked(points);\n }\n if (this._selected_renderer)\n this._selected_renderer.data_source.change.emit();\n }\n _pan_end(ev) {\n if (this._basepoint == null)\n return;\n const points = this._drag_points(ev, [this.model.vertex_renderer]);\n if (!ev.shiftKey) {\n this._move_linked(points);\n }\n this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true);\n if (this._selected_renderer) {\n this._emit_cds_changes(this._selected_renderer.data_source);\n }\n this._basepoint = null;\n }\n _drag_points(ev, renderers) {\n if (this._basepoint == null)\n return [];\n const [bx, by] = this._basepoint;\n const points = [];\n for (const renderer of renderers) {\n const basepoint = this._map_drag(bx, by, renderer);\n const point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null || basepoint == null) {\n continue;\n }\n const [x, y] = point;\n const [px, py] = basepoint;\n const [dx, dy] = [x - px, y - py];\n // Type once dataspecs are typed\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n for (const index of cds.selected.indices) {\n const point = [];\n if (xkey) {\n point.push(cds.data[xkey][index]);\n cds.data[xkey][index] += dx;\n }\n if (ykey) {\n point.push(cds.data[ykey][index]);\n cds.data[ykey][index] += dy;\n }\n point.push(dx);\n point.push(dy);\n points.push(point);\n }\n cds.change.emit();\n }\n this._basepoint = [ev.sx, ev.sy];\n return points;\n }\n _set_vertices(xs, ys, styles) {\n const point_glyph = this.model.vertex_renderer.glyph;\n const point_cds = this.model.vertex_renderer.data_source;\n const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n if (pxkey) {\n if ((0, types_1.isArray)(xs))\n point_cds.data[pxkey] = xs;\n else\n point_glyph.x = { value: xs };\n }\n if (pykey) {\n if ((0, types_1.isArray)(ys))\n point_cds.data[pykey] = ys;\n else\n point_glyph.y = { value: ys };\n }\n if (styles != null) {\n for (const key of (0, object_1.keys)(styles)) {\n point_cds.data[key] = styles[key];\n point_glyph[key] = { field: key };\n }\n }\n else {\n for (const col of point_cds.columns()) {\n point_cds.data[col] = [];\n }\n }\n this._emit_cds_changes(point_cds, true, true, false);\n }\n _move_linked(points) {\n if (!this._selected_renderer)\n return;\n const renderer = this._selected_renderer;\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n const xpaths = cds.data[xkey];\n const ypaths = cds.data[ykey];\n for (const point of points) {\n const [x, y, dx, dy] = point;\n for (let index = 0; index < xpaths.length; index++) {\n const xs = xpaths[index];\n const ys = ypaths[index];\n for (let i = 0; i < xs.length; i++) {\n if ((xs[i] == x) && (ys[i] == y)) {\n xs[i] += dx;\n ys[i] += dy;\n }\n }\n }\n }\n }\n _tap(ev) {\n const renderer = this.model.vertex_renderer;\n const point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null)\n return;\n else if (this._drawing && this._selected_renderer) {\n let [x, y] = point;\n const cds = renderer.data_source;\n // Type once dataspecs are typed\n const glyph = renderer.glyph;\n const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n const indices = cds.selected.indices;\n [x, y] = this._snap_to_vertex(ev, x, y);\n const index = indices[0];\n cds.selected.indices = [index + 1];\n if (xkey) {\n const xs = cds.get_array(xkey);\n const nx = xs[index];\n xs[index] = x;\n xs.splice(index + 1, 0, nx);\n }\n if (ykey) {\n const ys = cds.get_array(ykey);\n const ny = ys[index];\n ys[index] = y;\n ys.splice(index + 1, 0, ny);\n }\n cds.change.emit();\n this._emit_cds_changes(this._selected_renderer.data_source, true, false, true);\n return;\n }\n this._select_event(ev, this._select_mode(ev), [renderer]);\n }\n _show_vertices(ev) {\n if (!this.model.active)\n return;\n const renderers = this._select_event(ev, \"replace\", this.model.renderers);\n if (!renderers.length) {\n this._hide_vertices();\n this._selected_renderer = null;\n this._drawing = false;\n return;\n }\n const renderer = renderers[0];\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const index = cds.selected.indices[0];\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n let xs;\n let ys;\n if (xkey) {\n xs = cds.data[xkey][index];\n if (!(0, types_1.isArray)(xs))\n cds.data[xkey][index] = xs = Array.from(xs);\n }\n else {\n xs = glyph.xs.value;\n }\n if (ykey) {\n ys = cds.data[ykey][index];\n if (!(0, types_1.isArray)(ys))\n cds.data[ykey][index] = ys = Array.from(ys);\n }\n else {\n ys = glyph.ys.value;\n }\n const styles = {};\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key] = [this.model.end_style[key]];\n for (const key of (0, object_1.keys)(this.model.node_style)) {\n for (let index = 0; index < (xs.length - 2); index++) {\n styles[key].push(this.model.node_style[key]);\n }\n }\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key].push(this.model.end_style[key]);\n this._selected_renderer = renderer;\n this._set_vertices(xs, ys, styles);\n }\n }\n exports.PolyVertexEditToolView = PolyVertexEditToolView;\n PolyVertexEditToolView.__name__ = \"PolyVertexEditToolView\";\n class PolyVertexEditTool extends poly_edit_tool_1.PolyEditTool {\n constructor(attrs) {\n super(attrs);\n }\n static init_PolyVertexEditTool() {\n this.prototype.default_view = PolyVertexEditToolView;\n this.define({\n node_style: [p.Any, {}],\n end_style: [p.Any, {}],\n });\n }\n }\n exports.PolyVertexEditTool = PolyVertexEditTool;\n PolyVertexEditTool.__name__ = \"PolyVertexEditTool\";\n PolyVertexEditTool.__module__ = \"geoviews.models.custom_tools\";\n PolyVertexEditTool.init_PolyVertexEditTool();\n}\n","/* models/restore_tool.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n const tslib_1 = require(\"tslib\");\n const p = (0, tslib_1.__importStar)(require(\"@bokehjs/core/properties\"));\n const action_tool_1 = require(\"@bokehjs/models/tools/actions/action_tool\");\n class RestoreToolView extends action_tool_1.ActionToolView {\n doit() {\n const sources = this.model.sources;\n for (const source of sources) {\n if (!source.buffer || (source.buffer.length == 0)) {\n continue;\n }\n source.data = source.buffer.pop();\n source.change.emit();\n source.properties.data.change.emit();\n }\n }\n }\n exports.RestoreToolView = RestoreToolView;\n RestoreToolView.__name__ = \"RestoreToolView\";\n class RestoreTool extends action_tool_1.ActionTool {\n constructor(attrs) {\n super(attrs);\n this.tool_name = \"Restore\";\n this.icon = \"bk-tool-icon-undo\";\n }\n static init_RestoreTool() {\n this.prototype.default_view = RestoreToolView;\n this.define({\n sources: [p.Array, []]\n });\n }\n }\n exports.RestoreTool = RestoreTool;\n RestoreTool.__name__ = \"RestoreTool\";\n RestoreTool.__module__ = \"geoviews.models.custom_tools\";\n RestoreTool.init_RestoreTool();\n}\n"]}
1
+ {"version":3,"sources":["@@/geoviews/dist/lib/index.js","@@/geoviews/dist/lib/models/index.js","@@/geoviews/dist/lib/models/checkpoint_tool.js","@@/geoviews/dist/lib/models/clear_tool.js","@@/geoviews/dist/lib/models/poly_draw.js","@@/geoviews/dist/lib/models/poly_edit.js","@@/geoviews/dist/lib/models/restore_tool.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"generated.js","sourceRoot":"","sourcesContent":["/* index.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n const tslib_1 = require(\"tslib\");\n const GeoViews = tslib_1.__importStar(require(\"b4555bea44\") /* ./models */);\n exports.GeoViews = GeoViews;\n const base_1 = require(\"@bokehjs/base\");\n (0, base_1.register_models)(GeoViews);\n}\n","/* models/index.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n var checkpoint_tool_1 = require(\"1d7c6c8516\") /* ./checkpoint_tool */;\n __esExport(\"CheckpointTool\", checkpoint_tool_1.CheckpointTool);\n var clear_tool_1 = require(\"1c15765006\") /* ./clear_tool */;\n __esExport(\"ClearTool\", clear_tool_1.ClearTool);\n var poly_draw_1 = require(\"cddc7627cc\") /* ./poly_draw */;\n __esExport(\"PolyVertexDrawTool\", poly_draw_1.PolyVertexDrawTool);\n var poly_edit_1 = require(\"296f32feb2\") /* ./poly_edit */;\n __esExport(\"PolyVertexEditTool\", poly_edit_1.PolyVertexEditTool);\n var restore_tool_1 = require(\"92294e6ad2\") /* ./restore_tool */;\n __esExport(\"RestoreTool\", restore_tool_1.RestoreTool);\n}\n","/* models/checkpoint_tool.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n var _a;\n const array_1 = require(\"@bokehjs/core/util/array\");\n const action_tool_1 = require(\"@bokehjs/models/tools/actions/action_tool\");\n const column_data_source_1 = require(\"@bokehjs/models/sources/column_data_source\");\n const icons_css_1 = require(\"@bokehjs/styles/icons.css\");\n class CheckpointToolView extends action_tool_1.ActionToolView {\n doit() {\n const sources = this.model.sources;\n for (const source of sources) {\n if (!source.buffer) {\n source.buffer = [];\n }\n let data_copy = {};\n for (const key in source.data) {\n const column = source.data[key];\n const new_column = [];\n for (const arr of column) {\n if (Array.isArray(arr) || (ArrayBuffer.isView(arr))) {\n new_column.push((0, array_1.copy)(arr));\n }\n else {\n new_column.push(arr);\n }\n }\n data_copy[key] = new_column;\n }\n source.buffer.push(data_copy);\n }\n }\n }\n exports.CheckpointToolView = CheckpointToolView;\n CheckpointToolView.__name__ = \"CheckpointToolView\";\n class CheckpointTool extends action_tool_1.ActionTool {\n constructor(attrs) {\n super(attrs);\n this.tool_name = \"Checkpoint\";\n this.tool_icon = icons_css_1.tool_icon_save;\n }\n }\n exports.CheckpointTool = CheckpointTool;\n _a = CheckpointTool;\n CheckpointTool.__name__ = \"CheckpointTool\";\n CheckpointTool.__module__ = \"geoviews.models.custom_tools\";\n (() => {\n _a.prototype.default_view = CheckpointToolView;\n _a.define(({ Array, Ref }) => ({\n sources: [Array(Ref(column_data_source_1.ColumnDataSource)), []],\n }));\n })();\n}\n","/* models/clear_tool.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n var _a;\n const action_tool_1 = require(\"@bokehjs/models/tools/actions/action_tool\");\n const column_data_source_1 = require(\"@bokehjs/models/sources/column_data_source\");\n const icons_css_1 = require(\"@bokehjs/styles/icons.css\");\n class ClearToolView extends action_tool_1.ActionToolView {\n doit() {\n for (var source of this.model.sources) {\n for (const column in source.data) {\n source.data[column] = [];\n }\n source.change.emit();\n source.properties.data.change.emit();\n }\n }\n }\n exports.ClearToolView = ClearToolView;\n ClearToolView.__name__ = \"ClearToolView\";\n class ClearTool extends action_tool_1.ActionTool {\n constructor(attrs) {\n super(attrs);\n this.tool_name = \"Clear data\";\n this.tool_icon = icons_css_1.tool_icon_reset;\n }\n }\n exports.ClearTool = ClearTool;\n _a = ClearTool;\n ClearTool.__name__ = \"ClearTool\";\n ClearTool.__module__ = \"geoviews.models.custom_tools\";\n (() => {\n _a.prototype.default_view = ClearToolView;\n _a.define(({ Array, Ref }) => ({\n sources: [Array(Ref(column_data_source_1.ColumnDataSource)), []],\n }));\n })();\n}\n","/* models/poly_draw.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n var _a;\n const object_1 = require(\"@bokehjs/core/util/object\");\n const types_1 = require(\"@bokehjs/core/util/types\");\n const poly_draw_tool_1 = require(\"@bokehjs/models/tools/edit/poly_draw_tool\");\n class PolyVertexDrawToolView extends poly_draw_tool_1.PolyDrawToolView {\n _split_path(x, y) {\n for (let r = 0; r < this.model.renderers.length; r++) {\n const renderer = this.model.renderers[r];\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n const xpaths = cds.data[xkey];\n const ypaths = cds.data[ykey];\n for (let index = 0; index < xpaths.length; index++) {\n let xs = xpaths[index];\n if (!(0, types_1.isArray)(xs)) {\n xs = Array.from(xs);\n cds.data[xkey][index] = xs;\n }\n let ys = ypaths[index];\n if (!(0, types_1.isArray)(ys)) {\n ys = Array.from(ys);\n cds.data[ykey][index] = ys;\n }\n for (let i = 0; i < xs.length; i++) {\n if ((xs[i] == x) && (ys[i] == y) && (i != 0) && (i != (xs.length - 1))) {\n xpaths.splice(index + 1, 0, xs.slice(i));\n ypaths.splice(index + 1, 0, ys.slice(i));\n xs.splice(i + 1);\n ys.splice(i + 1);\n for (const column of cds.columns()) {\n if ((column !== xkey) && (column != ykey))\n cds.data[column].splice(index + 1, 0, cds.data[column][index]);\n }\n return;\n }\n }\n }\n }\n }\n _snap_to_vertex(ev, x, y) {\n if (this.model.vertex_renderer) {\n // If an existing vertex is hit snap to it\n const vertex_selected = this._select_event(ev, \"replace\", [this.model.vertex_renderer]);\n const point_ds = this.model.vertex_renderer.data_source;\n // Type once dataspecs are typed\n const point_glyph = this.model.vertex_renderer.glyph;\n const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n if (vertex_selected.length) {\n // If existing vertex is hit split path at that location\n // converting to feature vertex\n const index = point_ds.selected.indices[0];\n if (pxkey)\n x = point_ds.data[pxkey][index];\n if (pykey)\n y = point_ds.data[pykey][index];\n if (ev.type != 'mousemove')\n this._split_path(x, y);\n point_ds.selection_manager.clear();\n }\n }\n return [x, y];\n }\n _set_vertices(xs, ys, styles) {\n if (this.model.vertex_renderer == null)\n return;\n const point_glyph = this.model.vertex_renderer.glyph;\n const point_cds = this.model.vertex_renderer.data_source;\n const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n if (pxkey) {\n if ((0, types_1.isArray)(xs))\n point_cds.data[pxkey] = xs;\n else\n point_glyph.x = { value: xs };\n }\n if (pykey) {\n if ((0, types_1.isArray)(ys))\n point_cds.data[pykey] = ys;\n else\n point_glyph.y = { value: ys };\n }\n if (styles != null) {\n for (const key of (0, object_1.keys)(styles)) {\n point_cds.data[key] = styles[key];\n point_glyph[key] = { field: key };\n }\n }\n else {\n for (const col of point_cds.columns()) {\n point_cds.data[col] = [];\n }\n }\n this._emit_cds_changes(point_cds, true, true, false);\n }\n _show_vertices() {\n if (!this.model.active) {\n return;\n }\n const xs = [];\n const ys = [];\n const styles = {};\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key] = [];\n for (let i = 0; i < this.model.renderers.length; i++) {\n const renderer = this.model.renderers[i];\n const cds = renderer.data_source;\n const glyph = renderer.glyph;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n for (const array of cds.get_array(xkey)) {\n Array.prototype.push.apply(xs, array);\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key].push(this.model.end_style[key]);\n for (const key of (0, object_1.keys)(this.model.node_style)) {\n for (let index = 0; index < (array.length - 2); index++) {\n styles[key].push(this.model.node_style[key]);\n }\n }\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key].push(this.model.end_style[key]);\n }\n for (const array of cds.get_array(ykey))\n Array.prototype.push.apply(ys, array);\n if (this._drawing && (i == (this.model.renderers.length - 1))) {\n // Skip currently drawn vertex\n xs.splice(xs.length - 1, 1);\n ys.splice(ys.length - 1, 1);\n for (const key of (0, object_1.keys)(styles))\n styles[key].splice(styles[key].length - 1, 1);\n }\n }\n this._set_vertices(xs, ys, styles);\n }\n _remove() {\n const renderer = this.model.renderers[0];\n const cds = renderer.data_source;\n const glyph = renderer.glyph;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n if (xkey) {\n const xidx = cds.data[xkey].length - 1;\n const xs = cds.get_array(xkey)[xidx];\n xs.splice(xs.length - 1, 1);\n if (xs.length == 1)\n cds.data[xkey].splice(xidx, 1);\n }\n if (ykey) {\n const yidx = cds.data[ykey].length - 1;\n const ys = cds.get_array(ykey)[yidx];\n ys.splice(ys.length - 1, 1);\n if (ys.length == 1)\n cds.data[ykey].splice(yidx, 1);\n }\n this._emit_cds_changes(cds);\n this._drawing = false;\n this._show_vertices();\n }\n }\n exports.PolyVertexDrawToolView = PolyVertexDrawToolView;\n PolyVertexDrawToolView.__name__ = \"PolyVertexDrawToolView\";\n class PolyVertexDrawTool extends poly_draw_tool_1.PolyDrawTool {\n constructor(attrs) {\n super(attrs);\n }\n }\n exports.PolyVertexDrawTool = PolyVertexDrawTool;\n _a = PolyVertexDrawTool;\n PolyVertexDrawTool.__name__ = \"PolyVertexDrawTool\";\n PolyVertexDrawTool.__module__ = \"geoviews.models.custom_tools\";\n (() => {\n _a.prototype.default_view = PolyVertexDrawToolView;\n _a.define(({ Any }) => ({\n end_style: [Any, {}],\n node_style: [Any, {}],\n }));\n })();\n}\n","/* models/poly_edit.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n var _a;\n const object_1 = require(\"@bokehjs/core/util/object\");\n const types_1 = require(\"@bokehjs/core/util/types\");\n const poly_edit_tool_1 = require(\"@bokehjs/models/tools/edit/poly_edit_tool\");\n class PolyVertexEditToolView extends poly_edit_tool_1.PolyEditToolView {\n deactivate() {\n this._hide_vertices();\n if (!this._selected_renderer) {\n return;\n }\n else if (this._drawing) {\n this._remove_vertex();\n this._drawing = false;\n }\n this._emit_cds_changes(this._selected_renderer.data_source, false, true, false);\n }\n _pan(ev) {\n if (this._basepoint == null || this.model.vertex_renderer == null)\n return;\n const points = this._drag_points(ev, [this.model.vertex_renderer]);\n if (!ev.shift_key) {\n this._move_linked(points);\n }\n if (this._selected_renderer)\n this._selected_renderer.data_source.change.emit();\n }\n _pan_end(ev) {\n if (this._basepoint == null || this.model.vertex_renderer == null)\n return;\n const points = this._drag_points(ev, [this.model.vertex_renderer]);\n if (!ev.shift_key) {\n this._move_linked(points);\n }\n this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true);\n if (this._selected_renderer) {\n this._emit_cds_changes(this._selected_renderer.data_source);\n }\n this._basepoint = null;\n }\n _drag_points(ev, renderers) {\n if (this._basepoint == null)\n return [];\n const [bx, by] = this._basepoint;\n const points = [];\n for (const renderer of renderers) {\n const basepoint = this._map_drag(bx, by, renderer);\n const point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null || basepoint == null) {\n continue;\n }\n const [x, y] = point;\n const [px, py] = basepoint;\n const [dx, dy] = [x - px, y - py];\n // Type once dataspecs are typed\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n for (const index of cds.selected.indices) {\n const point = [];\n if (xkey) {\n point.push(cds.data[xkey][index]);\n cds.data[xkey][index] += dx;\n }\n if (ykey) {\n point.push(cds.data[ykey][index]);\n cds.data[ykey][index] += dy;\n }\n point.push(dx);\n point.push(dy);\n points.push(point);\n }\n cds.change.emit();\n }\n this._basepoint = [ev.sx, ev.sy];\n return points;\n }\n _set_vertices(xs, ys, styles) {\n if (this.model.vertex_renderer == null)\n return;\n const point_glyph = this.model.vertex_renderer.glyph;\n const point_cds = this.model.vertex_renderer.data_source;\n const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n if (pxkey) {\n if ((0, types_1.isArray)(xs))\n point_cds.data[pxkey] = xs;\n else\n point_glyph.x = { value: xs };\n }\n if (pykey) {\n if ((0, types_1.isArray)(ys))\n point_cds.data[pykey] = ys;\n else\n point_glyph.y = { value: ys };\n }\n if (styles != null) {\n for (const key of (0, object_1.keys)(styles)) {\n point_cds.data[key] = styles[key];\n point_glyph[key] = { field: key };\n }\n }\n else {\n for (const col of point_cds.columns()) {\n point_cds.data[col] = [];\n }\n }\n this._emit_cds_changes(point_cds, true, true, false);\n }\n _move_linked(points) {\n if (!this._selected_renderer)\n return;\n const renderer = this._selected_renderer;\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n const xpaths = cds.data[xkey];\n const ypaths = cds.data[ykey];\n for (const point of points) {\n const [x, y, dx, dy] = point;\n for (let index = 0; index < xpaths.length; index++) {\n const xs = xpaths[index];\n const ys = ypaths[index];\n for (let i = 0; i < xs.length; i++) {\n if ((xs[i] == x) && (ys[i] == y)) {\n xs[i] += dx;\n ys[i] += dy;\n }\n }\n }\n }\n }\n _tap(ev) {\n if (this.model.vertex_renderer == null)\n return;\n const renderer = this.model.vertex_renderer;\n const point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null)\n return;\n else if (this._drawing && this._selected_renderer) {\n let [x, y] = point;\n const cds = renderer.data_source;\n // Type once dataspecs are typed\n const glyph = renderer.glyph;\n const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n const indices = cds.selected.indices;\n [x, y] = this._snap_to_vertex(ev, x, y);\n const index = indices[0];\n cds.selected.indices = [index + 1];\n if (xkey) {\n const xs = cds.get_array(xkey);\n const nx = xs[index];\n xs[index] = x;\n xs.splice(index + 1, 0, nx);\n }\n if (ykey) {\n const ys = cds.get_array(ykey);\n const ny = ys[index];\n ys[index] = y;\n ys.splice(index + 1, 0, ny);\n }\n cds.change.emit();\n this._emit_cds_changes(this._selected_renderer.data_source, true, false, true);\n return;\n }\n this._select_event(ev, this._select_mode(ev), [renderer]);\n }\n _show_vertices(ev) {\n if (!this.model.active)\n return;\n const renderers = this._select_event(ev, \"replace\", this.model.renderers);\n if (!renderers.length) {\n this._hide_vertices();\n this._selected_renderer = null;\n this._drawing = false;\n return;\n }\n const renderer = renderers[0];\n const glyph = renderer.glyph;\n const cds = renderer.data_source;\n const index = cds.selected.indices[0];\n const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n let xs;\n let ys;\n if (xkey) {\n xs = cds.data[xkey][index];\n if (!(0, types_1.isArray)(xs))\n cds.data[xkey][index] = xs = Array.from(xs);\n }\n else {\n xs = glyph.xs.value;\n }\n if (ykey) {\n ys = cds.data[ykey][index];\n if (!(0, types_1.isArray)(ys))\n cds.data[ykey][index] = ys = Array.from(ys);\n }\n else {\n ys = glyph.ys.value;\n }\n const styles = {};\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key] = [this.model.end_style[key]];\n for (const key of (0, object_1.keys)(this.model.node_style)) {\n for (let index = 0; index < (xs.length - 2); index++) {\n styles[key].push(this.model.node_style[key]);\n }\n }\n for (const key of (0, object_1.keys)(this.model.end_style))\n styles[key].push(this.model.end_style[key]);\n this._selected_renderer = renderer;\n this._set_vertices(xs, ys, styles);\n }\n }\n exports.PolyVertexEditToolView = PolyVertexEditToolView;\n PolyVertexEditToolView.__name__ = \"PolyVertexEditToolView\";\n class PolyVertexEditTool extends poly_edit_tool_1.PolyEditTool {\n constructor(attrs) {\n super(attrs);\n }\n }\n exports.PolyVertexEditTool = PolyVertexEditTool;\n _a = PolyVertexEditTool;\n PolyVertexEditTool.__name__ = \"PolyVertexEditTool\";\n PolyVertexEditTool.__module__ = \"geoviews.models.custom_tools\";\n (() => {\n _a.prototype.default_view = PolyVertexEditToolView;\n _a.define(({ Any }) => ({\n end_style: [Any, {}],\n node_style: [Any, {}],\n }));\n })();\n}\n","/* models/restore_tool.js */ function _(require, module, exports, __esModule, __esExport) {\n __esModule();\n var _a;\n const action_tool_1 = require(\"@bokehjs/models/tools/actions/action_tool\");\n const column_data_source_1 = require(\"@bokehjs/models/sources/column_data_source\");\n const icons_css_1 = require(\"@bokehjs/styles/icons.css\");\n class RestoreToolView extends action_tool_1.ActionToolView {\n doit() {\n const sources = this.model.sources;\n for (const source of sources) {\n if (!source.buffer || (source.buffer.length == 0)) {\n continue;\n }\n source.data = source.buffer.pop();\n source.change.emit();\n source.properties.data.change.emit();\n }\n }\n }\n exports.RestoreToolView = RestoreToolView;\n RestoreToolView.__name__ = \"RestoreToolView\";\n class RestoreTool extends action_tool_1.ActionTool {\n constructor(attrs) {\n super(attrs);\n this.tool_name = \"Restore\";\n this.tool_icon = icons_css_1.tool_icon_undo;\n }\n }\n exports.RestoreTool = RestoreTool;\n _a = RestoreTool;\n RestoreTool.__name__ = \"RestoreTool\";\n RestoreTool.__module__ = \"geoviews.models.custom_tools\";\n (() => {\n _a.prototype.default_view = RestoreToolView;\n _a.define(({ Array, Ref }) => ({\n sources: [Array(Ref(column_data_source_1.ColumnDataSource)), []],\n }));\n })();\n}\n"]}