@knowvah/dot-engine 2.12.3 → 2.12.4
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/api.js +12 -2
- package/dist/api.js.map +2 -2
- package/dist/common/clust-map.d.ts +16 -0
- package/dist/common/clust-map.d.ts.map +1 -0
- package/dist/common/htmltable-emit.d.ts +9 -6
- package/dist/common/htmltable-emit.d.ts.map +1 -1
- package/dist/common/layers.d.ts +9 -0
- package/dist/common/layers.d.ts.map +1 -1
- package/dist/common/poly-gencode.d.ts.map +1 -1
- package/dist/common/xlabels-place.d.ts.map +1 -1
- package/dist/gvc/anchor.d.ts +17 -19
- package/dist/gvc/anchor.d.ts.map +1 -1
- package/dist/gvc/device-cluster.d.ts +9 -0
- package/dist/gvc/device-cluster.d.ts.map +1 -1
- package/dist/gvc/device.d.ts +2 -1
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/emit-walk.d.ts +7 -0
- package/dist/gvc/emit-walk.d.ts.map +1 -1
- package/dist/gvc/job.d.ts +13 -6
- package/dist/gvc/job.d.ts.map +1 -1
- package/dist/gvc/viewport.d.ts +14 -0
- package/dist/gvc/viewport.d.ts.map +1 -1
- package/dist/index.js +557 -469
- package/dist/index.js.map +4 -4
- package/dist/layout/dot/compound.d.ts +0 -4
- package/dist/layout/dot/compound.d.ts.map +1 -1
- package/dist/layout/fdp/cluster-edges.d.ts.map +1 -1
- package/dist/model/cgraph-ops.d.ts +7 -0
- package/dist/model/cgraph-ops.d.ts.map +1 -1
- package/dist/model/graph.d.ts +12 -2
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/parser/builder.d.ts +11 -10
- package/dist/parser/builder.d.ts.map +1 -1
- package/dist/parser/graph-attr-syms.d.ts +35 -0
- package/dist/parser/graph-attr-syms.d.ts.map +1 -0
- package/dist/render/dot/agwrite.d.ts +6 -7
- package/dist/render/dot/agwrite.d.ts.map +1 -1
- package/dist/render/dot/attrs.d.ts +5 -0
- package/dist/render/dot/attrs.d.ts.map +1 -1
- package/dist/render/json-cluster-edge.d.ts +3 -2
- package/dist/render/json-cluster-edge.d.ts.map +1 -1
- package/dist/render/json.d.ts +7 -1
- package/dist/render/json.d.ts.map +1 -1
- package/dist/render/map.d.ts +14 -10
- package/dist/render/map.d.ts.map +1 -1
- package/dist/render/svg-graph.d.ts.map +1 -1
- package/dist/render/svg-id.d.ts +9 -0
- package/dist/render/svg-id.d.ts.map +1 -1
- package/dist/render.js +643 -555
- package/dist/render.js.map +4 -4
- package/dist/util/printf-round.d.ts +8 -0
- package/dist/util/printf-round.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/clust-map.ts +58 -0
- package/src/common/htmltable-emit.ts +87 -7
- package/src/common/layers.ts +25 -4
- package/src/common/poly-gencode.ts +3 -11
- package/src/common/xlabels-place.ts +22 -4
- package/src/gvc/anchor.ts +18 -30
- package/src/gvc/device-cluster.ts +16 -0
- package/src/gvc/device.ts +20 -20
- package/src/gvc/emit-walk.ts +11 -1
- package/src/gvc/job.ts +17 -9
- package/src/gvc/viewport.ts +27 -6
- package/src/layout/dot/compound.ts +1 -21
- package/src/layout/fdp/cluster-edges.ts +2 -23
- package/src/model/cgraph-ops.ts +12 -0
- package/src/model/graph.ts +13 -2
- package/src/parser/builder.ts +67 -100
- package/src/parser/graph-attr-syms.ts +62 -0
- package/src/render/dot/agwrite.ts +12 -12
- package/src/render/dot/attrs.ts +6 -2
- package/src/render/json-cluster-edge.ts +8 -4
- package/src/render/json.ts +15 -8
- package/src/render/map.ts +49 -58
- package/src/render/svg-cluster.ts +3 -3
- package/src/render/svg-graph.ts +1 -3
- package/src/render/svg-helpers.ts +6 -6
- package/src/render/svg-id.ts +23 -5
- package/src/util/printf-round.ts +11 -0
package/dist/index.js
CHANGED
|
@@ -3656,8 +3656,8 @@ var Graph = class {
|
|
|
3656
3656
|
graphDefaultsSnapshot;
|
|
3657
3657
|
/**
|
|
3658
3658
|
* Keys in `attrs` the BUILDER seeded from `graphDefaultsSnapshot` rather than
|
|
3659
|
-
* the input declaring them in this scope
|
|
3660
|
-
*
|
|
3659
|
+
* the input declaring them in this scope: every key of the snapshot the
|
|
3660
|
+
* scope did not set (agmakeattrs). cgraph distinguishes these structurally — a seeded value is inherited
|
|
3661
3661
|
* through the dict view and has no local symbol, while a local declaration
|
|
3662
3662
|
* creates one even when its value equals the inherited value — so the
|
|
3663
3663
|
* serializer needs the provenance to decide what write_dict would print.
|
|
@@ -3665,6 +3665,16 @@ var Graph = class {
|
|
|
3665
3665
|
* @see lib/cgraph/write.c:262 write_dict
|
|
3666
3666
|
*/
|
|
3667
3667
|
seededAttrs;
|
|
3668
|
+
/**
|
|
3669
|
+
* Graph-attribute keys this subgraph holds a local symbol for without having
|
|
3670
|
+
* declared them: `unviewsubgraphsattr` gives each direct subgraph one, with
|
|
3671
|
+
* its current value, when the parent updates its own symbol. The value is
|
|
3672
|
+
* the `attrs` entry (absent for the empty default). A subgraph opened in
|
|
3673
|
+
* this one later copies that value, not a nearer ancestor's newer one.
|
|
3674
|
+
* Undefined on the root and on a subgraph that was never pinned.
|
|
3675
|
+
* @see lib/cgraph/attr.c:232 unviewsubgraphsattr
|
|
3676
|
+
*/
|
|
3677
|
+
pinnedAttrs;
|
|
3668
3678
|
/**
|
|
3669
3679
|
* Graph-attribute keys whose declaration in THIS scope was the first anywhere
|
|
3670
3680
|
* in the graph. cgraph's `setattr` splits on exactly this: a key with no
|
|
@@ -4116,6 +4126,40 @@ function agGraphAttr(g, name) {
|
|
|
4116
4126
|
if (own !== void 0) return own;
|
|
4117
4127
|
return g.root.declaredGraphAttrs.has(name) ? "" : void 0;
|
|
4118
4128
|
}
|
|
4129
|
+
function localGraphAttrs(g) {
|
|
4130
|
+
const local = new Map(g.attrs);
|
|
4131
|
+
for (const key of g.seededAttrs ?? []) local.delete(key);
|
|
4132
|
+
return local;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
// src/parser/graph-attr-syms.ts
|
|
4136
|
+
function hasLocalGraphSym(g, key) {
|
|
4137
|
+
if (g.parent === null) return g.declaredGraphAttrs.has(key);
|
|
4138
|
+
if (g.pinnedAttrs?.has(key) === true) return true;
|
|
4139
|
+
return g.attrs.has(key) && g.seededAttrs?.has(key) !== true;
|
|
4140
|
+
}
|
|
4141
|
+
function pinSubgraphsAttr(parent2, key) {
|
|
4142
|
+
for (const sub of parent2.subgraphs.values()) {
|
|
4143
|
+
if (!hasLocalGraphSym(sub, key)) (sub.pinnedAttrs ??= /* @__PURE__ */ new Set()).add(key);
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
function effectiveGraphDefaults(scope) {
|
|
4147
|
+
const eff = /* @__PURE__ */ new Map();
|
|
4148
|
+
const found = /* @__PURE__ */ new Set();
|
|
4149
|
+
const take = (g, key) => {
|
|
4150
|
+
if (found.has(key)) return;
|
|
4151
|
+
found.add(key);
|
|
4152
|
+
const v = g.attrs.get(key);
|
|
4153
|
+
if (v !== void 0) eff.set(key, v);
|
|
4154
|
+
};
|
|
4155
|
+
for (let g = scope; g !== null; g = g.parent) {
|
|
4156
|
+
for (const key of g.attrs.keys()) {
|
|
4157
|
+
if (g.seededAttrs?.has(key) !== true) take(g, key);
|
|
4158
|
+
}
|
|
4159
|
+
for (const key of g.pinnedAttrs ?? []) take(g, key);
|
|
4160
|
+
}
|
|
4161
|
+
return eff;
|
|
4162
|
+
}
|
|
4119
4163
|
|
|
4120
4164
|
// src/parser/builder.ts
|
|
4121
4165
|
function normaliseAttrValue(value) {
|
|
@@ -4141,16 +4185,6 @@ function effectiveNodeDefaults(scope) {
|
|
|
4141
4185
|
}
|
|
4142
4186
|
return eff;
|
|
4143
4187
|
}
|
|
4144
|
-
var GRAPH_LABEL_INHERIT_KEYS = ["label", "fontname", "fontsize", "fontcolor", "labelloc", "labeljust"];
|
|
4145
|
-
function effectiveGraphDefaults(scope) {
|
|
4146
|
-
const eff = /* @__PURE__ */ new Map();
|
|
4147
|
-
for (let g = scope; g !== null; g = g.parent) {
|
|
4148
|
-
for (const [k, v] of g.attrs) {
|
|
4149
|
-
if (!eff.has(k)) eff.set(k, v);
|
|
4150
|
-
}
|
|
4151
|
-
}
|
|
4152
|
-
return eff;
|
|
4153
|
-
}
|
|
4154
4188
|
var NodeRegistry = class {
|
|
4155
4189
|
nextId = 0;
|
|
4156
4190
|
reset() {
|
|
@@ -4165,29 +4199,6 @@ var NodeRegistry = class {
|
|
|
4165
4199
|
return node;
|
|
4166
4200
|
}
|
|
4167
4201
|
};
|
|
4168
|
-
var NameCollector = class _NameCollector {
|
|
4169
|
-
static fromStmts(stmts) {
|
|
4170
|
-
const out = [];
|
|
4171
|
-
for (const s of stmts) _NameCollector.fromStmt(s, out);
|
|
4172
|
-
return out;
|
|
4173
|
-
}
|
|
4174
|
-
static fromStmt(stmt, out) {
|
|
4175
|
-
if (stmt.type === "node") {
|
|
4176
|
-
out.push(stmt.id.id);
|
|
4177
|
-
} else if (stmt.type === "edge") {
|
|
4178
|
-
for (const item of stmt.nodes) _NameCollector.fromEndpoint(item, out);
|
|
4179
|
-
} else if (stmt.type === "subgraph") {
|
|
4180
|
-
out.push(..._NameCollector.fromStmts(stmt.stmts));
|
|
4181
|
-
}
|
|
4182
|
-
}
|
|
4183
|
-
static fromEndpoint(item, out) {
|
|
4184
|
-
if ("type" in item && item.type === "subgraph") {
|
|
4185
|
-
out.push(..._NameCollector.fromStmts(item.stmts));
|
|
4186
|
-
} else {
|
|
4187
|
-
out.push(item.id);
|
|
4188
|
-
}
|
|
4189
|
-
}
|
|
4190
|
-
};
|
|
4191
4202
|
var StmtProcessor = class _StmtProcessor {
|
|
4192
4203
|
constructor(registry) {
|
|
4193
4204
|
this.registry = registry;
|
|
@@ -4256,22 +4267,32 @@ var StmtProcessor = class _StmtProcessor {
|
|
|
4256
4267
|
this.anonCounter++;
|
|
4257
4268
|
}
|
|
4258
4269
|
processAssign(stmt, graph) {
|
|
4259
|
-
graph.attrs.set(stmt.key, normaliseAttrValue(stmt.value));
|
|
4260
4270
|
this.declareGraphAttr(graph, stmt.key);
|
|
4271
|
+
graph.attrs.set(stmt.key, normaliseAttrValue(stmt.value));
|
|
4261
4272
|
}
|
|
4262
|
-
/** Record a graph-attribute declaration,
|
|
4263
|
-
* first to declare the key anywhere — the branch
|
|
4264
|
-
* setattr. @see
|
|
4273
|
+
/** Record a graph-attribute declaration, BEFORE its value is stored, noting
|
|
4274
|
+
* whether THIS scope was the first to declare the key anywhere — the branch
|
|
4275
|
+
* selector in cgraph's setattr. @see model/graph.ts firstGraphDecl
|
|
4276
|
+
* A scope that already holds a symbol for the key (the root always; the
|
|
4277
|
+
* first declarer, through bindattrs' empty declaration) updates it, which
|
|
4278
|
+
* first pins its direct subgraphs; a new local definition pins nothing.
|
|
4279
|
+
* A key declared in a re-opened subgraph's later body gets a local symbol,
|
|
4280
|
+
* so it is no longer a seeded one. @see lib/cgraph/attr.c:setattr */
|
|
4265
4281
|
declareGraphAttr(graph, key) {
|
|
4266
|
-
|
|
4282
|
+
const first = !graph.root.declaredGraphAttrs.has(key);
|
|
4283
|
+
if (first) {
|
|
4267
4284
|
(graph.firstGraphDecl ??= /* @__PURE__ */ new Set()).add(key);
|
|
4268
4285
|
graph.root.declaredGraphAttrs.add(key);
|
|
4269
4286
|
}
|
|
4287
|
+
if (first || hasLocalGraphSym(graph, key)) pinSubgraphsAttr(graph, key);
|
|
4288
|
+
graph.seededAttrs?.delete(key);
|
|
4270
4289
|
}
|
|
4271
4290
|
processAttr(stmt, graph) {
|
|
4272
4291
|
if (stmt.target === "graph") {
|
|
4273
|
-
|
|
4274
|
-
|
|
4292
|
+
for (const a of stmt.attrs) {
|
|
4293
|
+
this.declareGraphAttr(graph, a.key);
|
|
4294
|
+
applyAttrs([a], graph.attrs);
|
|
4295
|
+
}
|
|
4275
4296
|
} else if (stmt.target === "node") {
|
|
4276
4297
|
applyAttrs(stmt.attrs, graph.nodeDefaults);
|
|
4277
4298
|
} else {
|
|
@@ -4286,10 +4307,14 @@ var StmtProcessor = class _StmtProcessor {
|
|
|
4286
4307
|
}
|
|
4287
4308
|
}
|
|
4288
4309
|
processEdgeStmt(stmt, graph, root, directed) {
|
|
4289
|
-
const
|
|
4290
|
-
|
|
4310
|
+
const refs = stmt.nodes.map((item) => ({
|
|
4311
|
+
ref: this.resolveEndpoint(item, root, graph, directed),
|
|
4291
4312
|
port: portStringOf(item)
|
|
4292
4313
|
}));
|
|
4314
|
+
const ends = refs.map(({ ref, port }) => ({
|
|
4315
|
+
nodes: ref instanceof Graph ? [...ref.nodes.values()].sort((a, b) => a.id - b.id) : ref,
|
|
4316
|
+
port
|
|
4317
|
+
}));
|
|
4293
4318
|
for (let i = 0; i < ends.length - 1; i++) {
|
|
4294
4319
|
this.connectEndpoints(ends[i], ends[i + 1], stmt.attrs, graph, root);
|
|
4295
4320
|
}
|
|
@@ -4297,16 +4322,18 @@ var StmtProcessor = class _StmtProcessor {
|
|
|
4297
4322
|
processSubgraph(stmt, graph, root, directed) {
|
|
4298
4323
|
const sgName = stmt.id ?? `%${this.nextAnonId()}`;
|
|
4299
4324
|
const prior2 = graph.subgraphs.get(sgName);
|
|
4325
|
+
if (prior2 !== void 0) {
|
|
4326
|
+
buildGraph(stmt.stmts, prior2, root, directed, this);
|
|
4327
|
+
return prior2;
|
|
4328
|
+
}
|
|
4300
4329
|
const sg = new Graph(sgName, graph.kind);
|
|
4301
4330
|
sg.parent = graph;
|
|
4302
4331
|
sg.root = root;
|
|
4303
|
-
|
|
4304
|
-
else assignSubgSeq(graph, sg);
|
|
4332
|
+
assignSubgSeq(graph, sg);
|
|
4305
4333
|
sg.graphDefaultsSnapshot = effectiveGraphDefaults(graph);
|
|
4306
4334
|
buildGraph(stmt.stmts, sg, root, directed, this);
|
|
4307
|
-
for (const key of
|
|
4308
|
-
|
|
4309
|
-
if (v !== void 0 && !sg.attrs.has(key)) {
|
|
4335
|
+
for (const [key, v] of sg.graphDefaultsSnapshot) {
|
|
4336
|
+
if (!sg.attrs.has(key)) {
|
|
4310
4337
|
sg.attrs.set(key, v);
|
|
4311
4338
|
(sg.seededAttrs ??= /* @__PURE__ */ new Set()).add(key);
|
|
4312
4339
|
}
|
|
@@ -4347,12 +4374,11 @@ var StmtProcessor = class _StmtProcessor {
|
|
|
4347
4374
|
}
|
|
4348
4375
|
}
|
|
4349
4376
|
}
|
|
4377
|
+
/** One endpoint of an edge statement: a node item's node, or a subgraph
|
|
4378
|
+
* item's subgraph, which the caller expands after the whole statement. */
|
|
4350
4379
|
resolveEndpoint(item, root, scope, directed) {
|
|
4351
4380
|
if ("type" in item && item.type === "subgraph") {
|
|
4352
|
-
this.processSubgraph(item, scope, root, directed);
|
|
4353
|
-
const seen2 = /* @__PURE__ */ new Set();
|
|
4354
|
-
const nodes = NameCollector.fromStmts(item.stmts).map((n) => this.registry.ensure(n, root, scope)).filter((nd) => seen2.has(nd.id) ? false : (seen2.add(nd.id), true));
|
|
4355
|
-
return nodes.sort((a, b) => a.id - b.id);
|
|
4381
|
+
return this.processSubgraph(item, scope, root, directed);
|
|
4356
4382
|
}
|
|
4357
4383
|
return [this.registry.ensure(item.id, root, scope)];
|
|
4358
4384
|
}
|
|
@@ -5604,21 +5630,29 @@ var P_LPROMOTER = {
|
|
|
5604
5630
|
vertices: null
|
|
5605
5631
|
};
|
|
5606
5632
|
|
|
5607
|
-
// src/
|
|
5608
|
-
function fillMap(g,
|
|
5633
|
+
// src/common/clust-map.ts
|
|
5634
|
+
function fillMap(g, st) {
|
|
5609
5635
|
const n = g.info.n_cluster ?? 0;
|
|
5610
5636
|
for (let c = 0; c < n; c++) {
|
|
5611
5637
|
const cl = g.info.clust[c];
|
|
5612
5638
|
const s = cl.name;
|
|
5613
|
-
|
|
5614
|
-
|
|
5639
|
+
const anon = s.startsWith(LOCALNAMEPREFIX);
|
|
5640
|
+
if (st.map.has(s) || anon && st.anonKeyed) {
|
|
5641
|
+
agwarningf(`Two clusters named ${s} - the second will be ignored`);
|
|
5642
|
+
} else {
|
|
5643
|
+
st.map.set(s, cl);
|
|
5644
|
+
if (anon) st.anonKeyed = true;
|
|
5645
|
+
}
|
|
5646
|
+
fillMap(cl, st);
|
|
5615
5647
|
}
|
|
5616
5648
|
}
|
|
5617
5649
|
function mkClustMap(g) {
|
|
5618
|
-
const
|
|
5619
|
-
fillMap(g,
|
|
5620
|
-
return map;
|
|
5650
|
+
const st = { map: /* @__PURE__ */ new Map(), anonKeyed: false };
|
|
5651
|
+
fillMap(g, st);
|
|
5652
|
+
return st.map;
|
|
5621
5653
|
}
|
|
5654
|
+
|
|
5655
|
+
// src/layout/fdp/cluster-edges.ts
|
|
5622
5656
|
function mapc(cmap, n) {
|
|
5623
5657
|
if (n.name.startsWith("cluster")) return cmap.get(n.name) ?? null;
|
|
5624
5658
|
return null;
|
|
@@ -6359,6 +6393,9 @@ function printfFixed(v, decimals) {
|
|
|
6359
6393
|
const fracPart = s.slice(s.length - decimals);
|
|
6360
6394
|
return sign2 + intPart + "." + fracPart;
|
|
6361
6395
|
}
|
|
6396
|
+
function printfFixed0(v) {
|
|
6397
|
+
return Object.is(v, -0) ? "-0" : printfFixed(v, 0);
|
|
6398
|
+
}
|
|
6362
6399
|
function printfSig(v, sig) {
|
|
6363
6400
|
if (!Number.isFinite(v)) return printfNonFinite(v);
|
|
6364
6401
|
if (v === 0) return sig > 1 ? "0." + "0".repeat(sig - 1) : "0";
|
|
@@ -6749,19 +6786,27 @@ var RenderJob = class {
|
|
|
6749
6786
|
/** GD_fontnames of the root graph — selects which PostScript-alias fields the
|
|
6750
6787
|
* SVG emitter uses. @see plugin/core/gvrender_core_svg.c:464 */
|
|
6751
6788
|
fontnames = FontnameKind.NativeFonts;
|
|
6752
|
-
/**
|
|
6753
|
-
* the `<gid>_` prefix
|
|
6789
|
+
/** GD_drawing(root)->id: the root graph's `id`, substituted, '' if unset. Set
|
|
6790
|
+
* by render() for every renderer (drawingIdOf); the `<gid>_` prefix of
|
|
6791
|
+
* non-root object ids. @see lib/common/emit.c:getObjId */
|
|
6754
6792
|
drawingId = "";
|
|
6755
6793
|
/**
|
|
6756
|
-
* Resolve an object's
|
|
6757
|
-
*
|
|
6758
|
-
*
|
|
6759
|
-
*
|
|
6794
|
+
* Resolve an object's id like C's getObjId. The layer half of
|
|
6795
|
+
* layerPagePrefix comes first (`<layer>_` after the first layer), ahead of
|
|
6796
|
+
* every other step. Then a non-empty DOT `id` attr wins verbatim; otherwise
|
|
6797
|
+
* non-root objects are prefixed with `<drawingId>_` when the root graph has
|
|
6798
|
+
* an id. The root's id gets the same prefix in emit_page (NotFirstPage).
|
|
6799
|
+
* The page half (`page<x>,<y>_`) is left out: only ps and quartz page, and
|
|
6800
|
+
* neither prints an id.
|
|
6801
|
+
* @see lib/common/emit.c:getObjId
|
|
6802
|
+
* @see lib/common/emit.c:layerPagePrefix
|
|
6803
|
+
* @see lib/common/emit.c:emit_page
|
|
6760
6804
|
*/
|
|
6761
6805
|
objId(idAttr, defaultId, isRoot = false) {
|
|
6762
|
-
|
|
6763
|
-
if (
|
|
6764
|
-
return defaultId;
|
|
6806
|
+
const pfx = this.idLayerPrefix();
|
|
6807
|
+
if (idAttr !== void 0 && idAttr.length > 0) return pfx + idAttr;
|
|
6808
|
+
if (!isRoot && this.drawingId.length > 0) return pfx + this.drawingId + "_" + defaultId;
|
|
6809
|
+
return pfx + defaultId;
|
|
6765
6810
|
}
|
|
6766
6811
|
/** Active renderer plugin; set by render() before walkNodes. */
|
|
6767
6812
|
renderer;
|
|
@@ -25389,7 +25434,7 @@ function emitHtmlCell(cell2, pos, renderer, job) {
|
|
|
25389
25434
|
}
|
|
25390
25435
|
emitCellDecoration(cell2, pos, renderer, job);
|
|
25391
25436
|
if (cell2.nested !== void 0) {
|
|
25392
|
-
|
|
25437
|
+
emitHtmlTbl(cell2.nested, pos, renderer, job);
|
|
25393
25438
|
} else if (cell2.image !== void 0) {
|
|
25394
25439
|
emitHtmlImg(cell2.image, pos, renderer, job);
|
|
25395
25440
|
} else {
|
|
@@ -25413,7 +25458,7 @@ function emitTableRules(placed, pos, renderer, job) {
|
|
|
25413
25458
|
}
|
|
25414
25459
|
});
|
|
25415
25460
|
}
|
|
25416
|
-
function
|
|
25461
|
+
function emitHtmlTbl(placed, pos, renderer, job) {
|
|
25417
25462
|
resetHtmlFillPenWidth();
|
|
25418
25463
|
const anchorData = { href: placed.href, title: placed.title, target: placed.target, id: placed.id };
|
|
25419
25464
|
const tblBox = absBox(placed.box, pos);
|
|
@@ -25444,6 +25489,40 @@ function emitHtmlLabel(placed, pos, renderer, job) {
|
|
|
25444
25489
|
endHtmlAnchor(renderer, job);
|
|
25445
25490
|
}
|
|
25446
25491
|
}
|
|
25492
|
+
function allocObj(job, parent2) {
|
|
25493
|
+
const obj = createObjState(parent2.type);
|
|
25494
|
+
obj.parent = parent2;
|
|
25495
|
+
obj.penColor = parent2.penColor;
|
|
25496
|
+
obj.fillColor = parent2.fillColor;
|
|
25497
|
+
obj.pen = parent2.pen;
|
|
25498
|
+
obj.fill = parent2.fill;
|
|
25499
|
+
obj.penWidth = parent2.penWidth;
|
|
25500
|
+
obj.gradientAngle = parent2.gradientAngle;
|
|
25501
|
+
obj.stopColor = parent2.stopColor;
|
|
25502
|
+
obj.emitState = parent2.emitState;
|
|
25503
|
+
obj.graphObj = parent2.graphObj;
|
|
25504
|
+
obj.url = parent2.url;
|
|
25505
|
+
obj.tooltip = parent2.tooltip;
|
|
25506
|
+
obj.target = parent2.target;
|
|
25507
|
+
obj.explicitTooltip = parent2.explicitTooltip;
|
|
25508
|
+
job.pushObj(obj);
|
|
25509
|
+
}
|
|
25510
|
+
function freeObj(job) {
|
|
25511
|
+
job.popObj();
|
|
25512
|
+
}
|
|
25513
|
+
function emitHtmlLabel(placed, pos, renderer, job) {
|
|
25514
|
+
const parent2 = job.obj;
|
|
25515
|
+
if (parent2 === null) {
|
|
25516
|
+
emitHtmlTbl(placed, pos, renderer, job);
|
|
25517
|
+
return;
|
|
25518
|
+
}
|
|
25519
|
+
allocObj(job, parent2);
|
|
25520
|
+
try {
|
|
25521
|
+
emitHtmlTbl(placed, pos, renderer, job);
|
|
25522
|
+
} finally {
|
|
25523
|
+
freeObj(job);
|
|
25524
|
+
}
|
|
25525
|
+
}
|
|
25447
25526
|
|
|
25448
25527
|
// src/common/poly-vertices.ts
|
|
25449
25528
|
function ellipseVertices(w, h) {
|
|
@@ -26726,6 +26805,297 @@ function buildPoint(x, y) {
|
|
|
26726
26805
|
return pt;
|
|
26727
26806
|
}
|
|
26728
26807
|
|
|
26808
|
+
// src/gvc/anchor.ts
|
|
26809
|
+
function attr(attrs, key) {
|
|
26810
|
+
const v = attrs.get(key);
|
|
26811
|
+
return v !== void 0 && v !== "" ? v : void 0;
|
|
26812
|
+
}
|
|
26813
|
+
function subst(s, obj) {
|
|
26814
|
+
return substObjAnchor(s, obj);
|
|
26815
|
+
}
|
|
26816
|
+
function tip(s, obj) {
|
|
26817
|
+
return substObjAnchor(preprocessTooltip(s), obj);
|
|
26818
|
+
}
|
|
26819
|
+
function textOf(lp) {
|
|
26820
|
+
return lp?.text ?? null;
|
|
26821
|
+
}
|
|
26822
|
+
function pickFirst(attrs, keys, xform) {
|
|
26823
|
+
for (const k of keys) {
|
|
26824
|
+
const s = attr(attrs, k);
|
|
26825
|
+
if (s !== void 0) return { v: xform(s), explicit: true };
|
|
26826
|
+
}
|
|
26827
|
+
return { v: void 0, explicit: false };
|
|
26828
|
+
}
|
|
26829
|
+
function pickEdge(e, keys) {
|
|
26830
|
+
return pickFirst(e.attrs, keys, (s) => subst(s, e));
|
|
26831
|
+
}
|
|
26832
|
+
function pickEdgeTip(e, keys) {
|
|
26833
|
+
return pickFirst(e.attrs, keys, (s) => tip(s, e));
|
|
26834
|
+
}
|
|
26835
|
+
function withFallback(p, dflt, current) {
|
|
26836
|
+
return { v: p.v ?? dflt ?? current, explicit: p.explicit };
|
|
26837
|
+
}
|
|
26838
|
+
function resolveEdgeLabels(e, obj) {
|
|
26839
|
+
obj.label = textOf(e.info.label);
|
|
26840
|
+
obj.xlabel = textOf(e.info.xlabel) ?? obj.label;
|
|
26841
|
+
obj.tailLabel = textOf(e.info.tail_label) ?? obj.label;
|
|
26842
|
+
obj.headLabel = textOf(e.info.head_label) ?? obj.label;
|
|
26843
|
+
}
|
|
26844
|
+
function resolveEdgeUrls(e, obj) {
|
|
26845
|
+
const dflt = pickEdge(e, ["href", "URL"]).v;
|
|
26846
|
+
obj.url = withFallback(pickEdge(e, ["edgehref", "edgeURL"]), dflt, obj.url).v;
|
|
26847
|
+
obj.labelUrl = withFallback(pickEdge(e, ["labelhref", "labelURL"]), dflt, obj.labelUrl).v;
|
|
26848
|
+
const tail = withFallback(pickEdge(e, ["tailhref", "tailURL"]), dflt, obj.tailUrl);
|
|
26849
|
+
obj.tailUrl = tail.v;
|
|
26850
|
+
obj.explicitTailUrl = tail.explicit;
|
|
26851
|
+
const head = withFallback(pickEdge(e, ["headhref", "headURL"]), dflt, obj.headUrl);
|
|
26852
|
+
obj.headUrl = head.v;
|
|
26853
|
+
obj.explicitHeadUrl = head.explicit;
|
|
26854
|
+
}
|
|
26855
|
+
function resolveEdgeTargets(e, obj) {
|
|
26856
|
+
const dflt = pickEdge(e, ["target"]).v;
|
|
26857
|
+
const edge = withFallback(pickEdge(e, ["edgetarget"]), dflt, obj.target);
|
|
26858
|
+
obj.target = edge.v;
|
|
26859
|
+
obj.explicitEdgeTarget = edge.explicit;
|
|
26860
|
+
obj.labelTarget = withFallback(pickEdge(e, ["labeltarget"]), dflt, obj.labelTarget).v;
|
|
26861
|
+
const tail = withFallback(pickEdge(e, ["tailtarget"]), dflt, obj.tailTarget);
|
|
26862
|
+
obj.tailTarget = tail.v;
|
|
26863
|
+
obj.explicitTailTarget = tail.explicit;
|
|
26864
|
+
const head = withFallback(pickEdge(e, ["headtarget"]), dflt, obj.headTarget);
|
|
26865
|
+
obj.headTarget = head.v;
|
|
26866
|
+
obj.explicitHeadTarget = head.explicit;
|
|
26867
|
+
}
|
|
26868
|
+
function resolveEdgeTooltips(e, obj) {
|
|
26869
|
+
const t = withFallback(pickEdgeTip(e, ["tooltip", "edgetooltip"]), obj.label, obj.tooltip);
|
|
26870
|
+
obj.tooltip = t.v;
|
|
26871
|
+
obj.explicitTooltip = t.explicit;
|
|
26872
|
+
const lt = withFallback(pickEdgeTip(e, ["labeltooltip"]), obj.label, obj.labelTooltip);
|
|
26873
|
+
obj.labelTooltip = lt.v;
|
|
26874
|
+
obj.explicitLabelTooltip = lt.explicit;
|
|
26875
|
+
const tt = withFallback(pickEdgeTip(e, ["tailtooltip"]), obj.tailLabel, obj.tailTooltip);
|
|
26876
|
+
obj.tailTooltip = tt.v;
|
|
26877
|
+
obj.explicitTailTooltip = tt.explicit;
|
|
26878
|
+
const ht = withFallback(pickEdgeTip(e, ["headtooltip"]), obj.headLabel, obj.headTooltip);
|
|
26879
|
+
obj.headTooltip = ht.v;
|
|
26880
|
+
obj.explicitHeadTooltip = ht.explicit;
|
|
26881
|
+
}
|
|
26882
|
+
function resolveEdgeAnchor(e, id, obj) {
|
|
26883
|
+
resolveEdgeLabels(e, obj);
|
|
26884
|
+
resolveEdgeUrls(e, obj);
|
|
26885
|
+
resolveEdgeTargets(e, obj);
|
|
26886
|
+
resolveEdgeTooltips(e, obj);
|
|
26887
|
+
obj.id = subst(id, e);
|
|
26888
|
+
}
|
|
26889
|
+
function resolveObjAnchor(g, label, id, obj) {
|
|
26890
|
+
obj.label = label;
|
|
26891
|
+
const ga = (key) => {
|
|
26892
|
+
for (let s = g; s !== null; s = s.parent) {
|
|
26893
|
+
const v = attr(s.attrs, key);
|
|
26894
|
+
if (v !== void 0) return v;
|
|
26895
|
+
}
|
|
26896
|
+
return void 0;
|
|
26897
|
+
};
|
|
26898
|
+
const url = ga("href") ?? ga("URL");
|
|
26899
|
+
if (url !== void 0) obj.url = subst(url, g);
|
|
26900
|
+
const tt = ga("tooltip");
|
|
26901
|
+
if (tt !== void 0) {
|
|
26902
|
+
obj.tooltip = tip(tt, g);
|
|
26903
|
+
obj.explicitTooltip = true;
|
|
26904
|
+
} else if (label !== null) obj.tooltip = label;
|
|
26905
|
+
const tgt = ga("target");
|
|
26906
|
+
if (tgt !== void 0) obj.target = subst(tgt, g);
|
|
26907
|
+
obj.id = subst(id, g);
|
|
26908
|
+
}
|
|
26909
|
+
function openAnchorWith(renderer, job, url, tooltip, target, id) {
|
|
26910
|
+
renderer.beginAnchor?.(url ?? "", tooltip ?? "", target ?? "", id, job);
|
|
26911
|
+
}
|
|
26912
|
+
function beginAnchorIf(renderer, job) {
|
|
26913
|
+
const obj = job.obj;
|
|
26914
|
+
if (obj === null || obj.url === null && !obj.explicitTooltip) return false;
|
|
26915
|
+
openAnchorWith(renderer, job, obj.url, obj.tooltip, obj.target, obj.id ?? "");
|
|
26916
|
+
return true;
|
|
26917
|
+
}
|
|
26918
|
+
var DFLT_SAMPLE = 20;
|
|
26919
|
+
var MAP_HW = 2;
|
|
26920
|
+
function mapTransform(p, ctx) {
|
|
26921
|
+
return applyScale(p, ctx.translation.x, ctx.translation.y, ctx.scale.x, ctx.scale.y);
|
|
26922
|
+
}
|
|
26923
|
+
function nodeIsFilled(n) {
|
|
26924
|
+
return parseStyleFlags(nodeAttr(n, n.root, "style")).filled;
|
|
26925
|
+
}
|
|
26926
|
+
function nodeAttrSet(n, key) {
|
|
26927
|
+
const v = nodeAttr(n, n.root, key);
|
|
26928
|
+
return v !== void 0 && v !== "";
|
|
26929
|
+
}
|
|
26930
|
+
function nodeHasHotspot(n) {
|
|
26931
|
+
return nodeAttrSet(n, "href") || nodeAttrSet(n, "URL") || nodeAttrSet(n, "tooltip");
|
|
26932
|
+
}
|
|
26933
|
+
function isRectPoly(p) {
|
|
26934
|
+
return p.sides === 4 && Math.abs(p.orientation % 90) < 0.5 && p.distortion === 0 && p.skew === 0;
|
|
26935
|
+
}
|
|
26936
|
+
function samplePoints(n) {
|
|
26937
|
+
const s = n.attrs.get("samplepoints");
|
|
26938
|
+
if (s === void 0) return DFLT_SAMPLE;
|
|
26939
|
+
const v = parseInt(s, 10);
|
|
26940
|
+
return Number.isNaN(v) || v < 4 || v > 60 ? DFLT_SAMPLE : v;
|
|
26941
|
+
}
|
|
26942
|
+
function pEllipse(a, b, np) {
|
|
26943
|
+
const del = 2 * Math.PI / np;
|
|
26944
|
+
const ps = [];
|
|
26945
|
+
let theta = 0;
|
|
26946
|
+
for (let i = 0; i < np; i++) {
|
|
26947
|
+
ps.push({ x: a * Math.cos(theta), y: b * Math.sin(theta) });
|
|
26948
|
+
theta += del;
|
|
26949
|
+
}
|
|
26950
|
+
return ps;
|
|
26951
|
+
}
|
|
26952
|
+
function ellipseNodeMap(poly, coord, ur, nump) {
|
|
26953
|
+
if (poly.regular) {
|
|
26954
|
+
return { shape: 1 /* Circle */, pts: [coord, { x: coord.x + ur.x, y: coord.y + ur.y }] };
|
|
26955
|
+
}
|
|
26956
|
+
const pts = pEllipse(ur.x, ur.y, nump).map((p) => ({ x: p.x + coord.x, y: p.y + coord.y }));
|
|
26957
|
+
return { shape: 2 /* Polygon */, pts };
|
|
26958
|
+
}
|
|
26959
|
+
function generalNodeMap(poly, coord, vertices, peripheries, nump) {
|
|
26960
|
+
const offset = (peripheries - 1) * poly.sides;
|
|
26961
|
+
const pts = [];
|
|
26962
|
+
if (poly.sides >= nump) {
|
|
26963
|
+
const delta2 = Math.trunc(poly.sides / nump);
|
|
26964
|
+
for (let i = 0, j = 0; j < nump; i += delta2, j++) {
|
|
26965
|
+
const v = vertices[i + offset];
|
|
26966
|
+
pts.push({ x: coord.x + v.x, y: coord.y + v.y });
|
|
26967
|
+
}
|
|
26968
|
+
} else {
|
|
26969
|
+
for (let i = 0; i < poly.sides; i++) {
|
|
26970
|
+
const v = vertices[i + offset];
|
|
26971
|
+
pts.push({ x: coord.x + v.x, y: coord.y + v.y });
|
|
26972
|
+
}
|
|
26973
|
+
}
|
|
26974
|
+
return { shape: 2 /* Polygon */, pts };
|
|
26975
|
+
}
|
|
26976
|
+
function nodePolyMap(n, poly, coord, filled) {
|
|
26977
|
+
const peripheries = poly.peripheries < 2 ? 1 : poly.peripheries;
|
|
26978
|
+
const vertices = poly.vertices;
|
|
26979
|
+
const nump = samplePoints(n);
|
|
26980
|
+
const info = n.info;
|
|
26981
|
+
if (poly.peripheries === 0 && !filled) {
|
|
26982
|
+
return { shape: 0 /* Rectangle */, pts: [
|
|
26983
|
+
{ x: coord.x - info.lw, y: coord.y - info.ht / 2 },
|
|
26984
|
+
{ x: coord.x + info.lw, y: coord.y + info.ht / 2 }
|
|
26985
|
+
] };
|
|
26986
|
+
}
|
|
26987
|
+
if (poly.sides < 3 && poly.skew === 0 && poly.distortion === 0) {
|
|
26988
|
+
return ellipseNodeMap(poly, coord, vertices[2 * peripheries - 1], nump);
|
|
26989
|
+
}
|
|
26990
|
+
return generalNodeMap(poly, coord, vertices, peripheries, nump);
|
|
26991
|
+
}
|
|
26992
|
+
function computeNodeUrlMap(n, obj, ctx) {
|
|
26993
|
+
if (!nodeHasHotspot(n)) return;
|
|
26994
|
+
const info = n.info;
|
|
26995
|
+
const coord = info.coord;
|
|
26996
|
+
const poly = info.shape_info;
|
|
26997
|
+
const filled = nodeIsFilled(n);
|
|
26998
|
+
const isRect = poly !== void 0 && isRectPoly(poly) && (poly.peripheries !== 0 || filled);
|
|
26999
|
+
let m;
|
|
27000
|
+
if (poly !== void 0 && poly.vertices != null && !isRect && ctx.mapPolygon) {
|
|
27001
|
+
m = nodePolyMap(n, poly, coord, filled);
|
|
27002
|
+
} else {
|
|
27003
|
+
m = { shape: 0 /* Rectangle */, pts: [
|
|
27004
|
+
{ x: coord.x - info.lw, y: coord.y - info.ht / 2 },
|
|
27005
|
+
{ x: coord.x + info.rw, y: coord.y + info.ht / 2 }
|
|
27006
|
+
] };
|
|
27007
|
+
}
|
|
27008
|
+
obj.urlMapShape = m.shape;
|
|
27009
|
+
obj.urlMapPts = m.pts.map((p) => mapTransform(p, ctx));
|
|
27010
|
+
}
|
|
27011
|
+
function computeGraphUrlMap(obj, ctx) {
|
|
27012
|
+
const { ll, ur } = ctx.pageBox;
|
|
27013
|
+
obj.urlMapShape = 0 /* Rectangle */;
|
|
27014
|
+
obj.urlMapPts = [mapTransform(ll, ctx), mapTransform(ur, ctx)];
|
|
27015
|
+
}
|
|
27016
|
+
function computeClusterUrlMap(bb, obj, ctx) {
|
|
27017
|
+
obj.urlMapShape = 0 /* Rectangle */;
|
|
27018
|
+
obj.urlMapPts = [mapTransform(bb.ll, ctx), mapTransform(bb.ur, ctx)];
|
|
27019
|
+
}
|
|
27020
|
+
function computeLabelRectMap(lab, obj, ctx) {
|
|
27021
|
+
const dx = lab.dimen.x / 2;
|
|
27022
|
+
const dy = lab.dimen.y / 2;
|
|
27023
|
+
obj.urlMapShape = 0 /* Rectangle */;
|
|
27024
|
+
obj.urlMapPts = [
|
|
27025
|
+
mapTransform({ x: lab.pos.x - dx, y: lab.pos.y - dy }, ctx),
|
|
27026
|
+
mapTransform({ x: lab.pos.x + dx, y: lab.pos.y + dy }, ctx)
|
|
27027
|
+
];
|
|
27028
|
+
}
|
|
27029
|
+
function checkControlPoints2(cp) {
|
|
27030
|
+
return ptToLine2(cp[0], cp[3], cp[1]) < MAP_HW * MAP_HW && ptToLine2(cp[0], cp[3], cp[2]) < MAP_HW * MAP_HW;
|
|
27031
|
+
}
|
|
27032
|
+
function bezierHalf(v) {
|
|
27033
|
+
const left2 = [];
|
|
27034
|
+
const right2 = [];
|
|
27035
|
+
bezier(v, 0.5, left2, right2);
|
|
27036
|
+
return { left: left2, right: right2 };
|
|
27037
|
+
}
|
|
27038
|
+
function approxBezier(cp, out) {
|
|
27039
|
+
if (checkControlPoints2(cp)) {
|
|
27040
|
+
if (out.length === 0) out.push(cp[0]);
|
|
27041
|
+
out.push(cp[3]);
|
|
27042
|
+
} else {
|
|
27043
|
+
const { left: left2, right: right2 } = bezierHalf(cp);
|
|
27044
|
+
approxBezier(left2, out);
|
|
27045
|
+
approxBezier(right2, out);
|
|
27046
|
+
}
|
|
27047
|
+
}
|
|
27048
|
+
function mkSegPts(prv, cur, nxt, w2) {
|
|
27049
|
+
let pp;
|
|
27050
|
+
let np;
|
|
27051
|
+
if (prv) {
|
|
27052
|
+
pp = prv;
|
|
27053
|
+
np = nxt ?? { x: 2 * (cur.x - pp.x), y: 2 * (cur.y - pp.y) };
|
|
27054
|
+
} else {
|
|
27055
|
+
np = nxt;
|
|
27056
|
+
pp = { x: 2 * (cur.x - np.x), y: 2 * (cur.y - np.y) };
|
|
27057
|
+
}
|
|
27058
|
+
const theta = Math.atan2(np.y - cur.y, np.x - cur.x);
|
|
27059
|
+
const phi = Math.atan2(pp.y - cur.y, pp.x - cur.x);
|
|
27060
|
+
let ang = theta - phi;
|
|
27061
|
+
if (ang > 0) ang -= 2 * Math.PI;
|
|
27062
|
+
const bis = phi + ang / 2;
|
|
27063
|
+
const del = { x: w2 * Math.cos(bis), y: w2 * Math.sin(bis) };
|
|
27064
|
+
return { p1: { x: cur.x + del.x, y: cur.y + del.y }, p2: { x: cur.x - del.x, y: cur.y - del.y } };
|
|
27065
|
+
}
|
|
27066
|
+
function mapOutputBspline(bp, w2, polys) {
|
|
27067
|
+
const nc = Math.trunc((bp.size - 1) / 3);
|
|
27068
|
+
const segs = [];
|
|
27069
|
+
for (let j = 0; j < nc; j++) {
|
|
27070
|
+
approxBezier([bp.list[3 * j], bp.list[3 * j + 1], bp.list[3 * j + 2], bp.list[3 * j + 3]], segs);
|
|
27071
|
+
}
|
|
27072
|
+
const pt1 = [];
|
|
27073
|
+
const pt2 = [];
|
|
27074
|
+
let cnt = 0;
|
|
27075
|
+
for (let i = 0; i < segs.length; i++) {
|
|
27076
|
+
const prev = i === 0 ? null : segs[i - 1];
|
|
27077
|
+
const next = i + 1 < segs.length ? segs[i + 1] : null;
|
|
27078
|
+
const seg2 = mkSegPts(prev, segs[i], next, w2);
|
|
27079
|
+
pt1[cnt] = seg2.p1;
|
|
27080
|
+
pt2[cnt] = seg2.p2;
|
|
27081
|
+
cnt++;
|
|
27082
|
+
if (i + 1 === segs.length || cnt === 50) {
|
|
27083
|
+
const poly = [];
|
|
27084
|
+
for (let k = 0; k < cnt; k++) poly.push(pt1[k]);
|
|
27085
|
+
for (let k = 0; k < cnt; k++) poly.push(pt2[cnt - 1 - k]);
|
|
27086
|
+
polys.push(poly);
|
|
27087
|
+
pt1[0] = pt1[cnt - 1];
|
|
27088
|
+
pt2[0] = pt2[cnt - 1];
|
|
27089
|
+
cnt = 1;
|
|
27090
|
+
}
|
|
27091
|
+
}
|
|
27092
|
+
}
|
|
27093
|
+
function computeEdgeSplineMaps(spl, w2, ctx) {
|
|
27094
|
+
const polys = [];
|
|
27095
|
+
for (const bz of spl.list) mapOutputBspline(bz, w2, polys);
|
|
27096
|
+
return polys.map((poly) => poly.map((p) => mapTransform(p, ctx)));
|
|
27097
|
+
}
|
|
27098
|
+
|
|
26729
27099
|
// src/gvc/device-cluster.ts
|
|
26730
27100
|
function applyClusterGradient(obj, fill) {
|
|
26731
27101
|
obj.fill = fill.kind === "radial" ? 3 /* Radial */ : 2 /* Linear */;
|
|
@@ -26827,8 +27197,18 @@ function applyClusterFill(obj, fillRes) {
|
|
|
26827
27197
|
applyClusterGradient(obj, fillRes);
|
|
26828
27198
|
return true;
|
|
26829
27199
|
}
|
|
27200
|
+
function beginClusterAnchor(sg, renderer, job) {
|
|
27201
|
+
const obj = job.obj;
|
|
27202
|
+
if (obj === null || obj.url === null && !obj.explicitTooltip) return false;
|
|
27203
|
+
renderer.emitMapRect?.(sg.info.bb, job);
|
|
27204
|
+
return beginAnchorIf(renderer, job);
|
|
27205
|
+
}
|
|
26830
27206
|
|
|
26831
27207
|
// src/render/svg-id.ts
|
|
27208
|
+
function drawingIdOf(g) {
|
|
27209
|
+
const id = g.attrs.get("id");
|
|
27210
|
+
return id !== void 0 && id.length > 0 ? substObjAnchor(id, g) : "";
|
|
27211
|
+
}
|
|
26832
27212
|
function svgClass(kind, classAttr) {
|
|
26833
27213
|
return classAttr !== void 0 && classAttr.length > 0 ? 'class="' + kind + " " + escapeXmlTitle(classAttr) + '"' : 'class="' + kind + '"';
|
|
26834
27214
|
}
|
|
@@ -27106,19 +27486,11 @@ function polyGencode(rawJob, rawNode) {
|
|
|
27106
27486
|
const ctx = resolveNodeDrawCtx(job, n);
|
|
27107
27487
|
if (ctx === null) return;
|
|
27108
27488
|
const clustersLast = (job.flags & EMIT_CLUSTERS_LAST) !== 0;
|
|
27109
|
-
const savedShape = job.obj?.urlMapShape;
|
|
27110
|
-
const savedPts = job.obj?.urlMapPts;
|
|
27111
27489
|
let inAnchor = clustersLast ? false : beginNodeAnchor(n, renderer, job);
|
|
27112
27490
|
renderPeripheries(ctx.poly, ctx.coord, ctx.filled, ctx.ringCtx);
|
|
27113
27491
|
if (!isPointNode(n)) renderUsershape(n, ctx);
|
|
27114
27492
|
if (!isPointNode(n)) renderNodeLabel(n, ctx.coord, renderer, job);
|
|
27115
|
-
if (clustersLast)
|
|
27116
|
-
if (job.obj && savedPts !== void 0 && savedShape !== void 0) {
|
|
27117
|
-
job.obj.urlMapShape = savedShape;
|
|
27118
|
-
job.obj.urlMapPts = savedPts;
|
|
27119
|
-
}
|
|
27120
|
-
inAnchor = beginNodeAnchor(n, renderer, job);
|
|
27121
|
-
}
|
|
27493
|
+
if (clustersLast) inAnchor = beginNodeAnchor(n, renderer, job);
|
|
27122
27494
|
if (inAnchor) renderer.endAnchor?.(job);
|
|
27123
27495
|
}
|
|
27124
27496
|
|
|
@@ -28988,7 +29360,6 @@ function svgBeginGraph(g, job) {
|
|
|
28988
29360
|
job.devscale = { x: 1, y: -1 };
|
|
28989
29361
|
job.directed = g.kind === "directed" || g.kind === "strict-directed";
|
|
28990
29362
|
job.fontnames = g.info.fontnames ?? FontnameKind.NativeFonts;
|
|
28991
|
-
job.drawingId = g.attrs.get("id") ?? "";
|
|
28992
29363
|
job.write(SVG_XML_DECL);
|
|
28993
29364
|
const stylesheet = g.attrs.get("stylesheet");
|
|
28994
29365
|
if (stylesheet !== void 0 && stylesheet.length > 0) {
|
|
@@ -29014,7 +29385,7 @@ function svgBeginPage(g, job) {
|
|
|
29014
29385
|
const tx = job.rotation !== 0 ? -clip.ur.x - job.margin.x / z : -clip.ll.x + job.margin.x / z;
|
|
29015
29386
|
const ty = clip.ur.y + job.margin.y / z;
|
|
29016
29387
|
emitGraphGroupOpen(
|
|
29017
|
-
|
|
29388
|
+
svgGraphId(g, job),
|
|
29018
29389
|
svgGraphClass(g),
|
|
29019
29390
|
tx,
|
|
29020
29391
|
ty,
|
|
@@ -29220,7 +29591,7 @@ function textAnchor(just) {
|
|
|
29220
29591
|
return "middle";
|
|
29221
29592
|
}
|
|
29222
29593
|
function svgBeginNode(n, job) {
|
|
29223
|
-
job.write('<g id="' + escapeXmlTitle(
|
|
29594
|
+
job.write('<g id="' + escapeXmlTitle(svgNodeId(n, job) + job.idLayerSuffix()) + '" ' + svgNodeClass(n) + ">\n");
|
|
29224
29595
|
job.write("<title>" + escapeXmlTitle(n.name) + "</title>\n");
|
|
29225
29596
|
}
|
|
29226
29597
|
function svgEndNode(job) {
|
|
@@ -29234,7 +29605,7 @@ function svgBeginEdge(e, job) {
|
|
|
29234
29605
|
const tp = e.info.tail_port?.name;
|
|
29235
29606
|
const hp = e.info.head_port?.name;
|
|
29236
29607
|
const raw = e.tail.name + (tp ? ":" + tp : "") + sep + e.head.name + (hp ? ":" + hp : "");
|
|
29237
|
-
job.write('<g id="' + escapeXmlTitle(
|
|
29608
|
+
job.write('<g id="' + escapeXmlTitle(svgEdgeId(e, job)) + '" ' + svgEdgeClass(e) + ">\n");
|
|
29238
29609
|
job.write("<title>" + escapeEdgeTitle(raw) + "</title>\n");
|
|
29239
29610
|
}
|
|
29240
29611
|
function svgEndEdge(job) {
|
|
@@ -29515,318 +29886,27 @@ function initJobViewportZoom(bb, size, pad) {
|
|
|
29515
29886
|
return 1;
|
|
29516
29887
|
}
|
|
29517
29888
|
function setupPageClip(bb, size, pad, z) {
|
|
29518
|
-
const jbLL = { x: bb.ll.x - pad.x, y: bb.ll.y - pad.y };
|
|
29519
|
-
const jbUR = { x: bb.ur.x + pad.x, y: bb.ur.y + pad.y };
|
|
29520
|
-
const sz = { x: jbUR.x - jbLL.x, y: jbUR.y - jbLL.y };
|
|
29521
|
-
if (size !== null && size.x > 1e-3 && size.y > 1e-3) {
|
|
29522
|
-
if (sz.x <= 1e-3) sz.x = size.x;
|
|
29523
|
-
if (sz.y <= 1e-3) sz.y = size.y;
|
|
29524
|
-
}
|
|
29525
29889
|
const focus = { x: 0.5 * (bb.ll.x + bb.ur.x), y: 0.5 * (bb.ll.y + bb.ur.y) };
|
|
29526
|
-
const pageSize =
|
|
29890
|
+
const pageSize = setupPageSize(bb, size, pad, z);
|
|
29527
29891
|
const ll = {
|
|
29528
29892
|
x: focus.x + pageSize.x * (0 - 1 / 2),
|
|
29529
29893
|
y: focus.y + pageSize.y * (0 - 1 / 2)
|
|
29530
29894
|
};
|
|
29531
29895
|
return { ll, ur: { x: ll.x + pageSize.x, y: ll.y + pageSize.y } };
|
|
29532
29896
|
}
|
|
29533
|
-
|
|
29534
|
-
|
|
29535
|
-
|
|
29536
|
-
const
|
|
29537
|
-
|
|
29538
|
-
|
|
29539
|
-
|
|
29540
|
-
return substObjAnchor(s, obj);
|
|
29541
|
-
}
|
|
29542
|
-
function tip(s, obj) {
|
|
29543
|
-
return substObjAnchor(preprocessTooltip(s), obj);
|
|
29544
|
-
}
|
|
29545
|
-
function textOf(lp) {
|
|
29546
|
-
return lp?.text ?? null;
|
|
29547
|
-
}
|
|
29548
|
-
function pickFirst(attrs, keys, xform) {
|
|
29549
|
-
for (const k of keys) {
|
|
29550
|
-
const s = attr(attrs, k);
|
|
29551
|
-
if (s !== void 0) return { v: xform(s), explicit: true };
|
|
29552
|
-
}
|
|
29553
|
-
return { v: void 0, explicit: false };
|
|
29554
|
-
}
|
|
29555
|
-
function pickEdge(e, keys) {
|
|
29556
|
-
return pickFirst(e.attrs, keys, (s) => subst(s, e));
|
|
29557
|
-
}
|
|
29558
|
-
function pickEdgeTip(e, keys) {
|
|
29559
|
-
return pickFirst(e.attrs, keys, (s) => tip(s, e));
|
|
29560
|
-
}
|
|
29561
|
-
function withFallback(p, dflt, current) {
|
|
29562
|
-
return { v: p.v ?? dflt ?? current, explicit: p.explicit };
|
|
29563
|
-
}
|
|
29564
|
-
function resolveEdgeLabels(e, obj) {
|
|
29565
|
-
obj.label = textOf(e.info.label);
|
|
29566
|
-
obj.xlabel = textOf(e.info.xlabel) ?? obj.label;
|
|
29567
|
-
obj.tailLabel = textOf(e.info.tail_label) ?? obj.label;
|
|
29568
|
-
obj.headLabel = textOf(e.info.head_label) ?? obj.label;
|
|
29569
|
-
}
|
|
29570
|
-
function resolveEdgeUrls(e, obj) {
|
|
29571
|
-
const dflt = pickEdge(e, ["href", "URL"]).v;
|
|
29572
|
-
obj.url = withFallback(pickEdge(e, ["edgehref", "edgeURL"]), dflt, obj.url).v;
|
|
29573
|
-
obj.labelUrl = withFallback(pickEdge(e, ["labelhref", "labelURL"]), dflt, obj.labelUrl).v;
|
|
29574
|
-
const tail = withFallback(pickEdge(e, ["tailhref", "tailURL"]), dflt, obj.tailUrl);
|
|
29575
|
-
obj.tailUrl = tail.v;
|
|
29576
|
-
obj.explicitTailUrl = tail.explicit;
|
|
29577
|
-
const head = withFallback(pickEdge(e, ["headhref", "headURL"]), dflt, obj.headUrl);
|
|
29578
|
-
obj.headUrl = head.v;
|
|
29579
|
-
obj.explicitHeadUrl = head.explicit;
|
|
29580
|
-
}
|
|
29581
|
-
function resolveEdgeTargets(e, obj) {
|
|
29582
|
-
const dflt = pickEdge(e, ["target"]).v;
|
|
29583
|
-
const edge = withFallback(pickEdge(e, ["edgetarget"]), dflt, obj.target);
|
|
29584
|
-
obj.target = edge.v;
|
|
29585
|
-
obj.explicitEdgeTarget = edge.explicit;
|
|
29586
|
-
obj.labelTarget = withFallback(pickEdge(e, ["labeltarget"]), dflt, obj.labelTarget).v;
|
|
29587
|
-
const tail = withFallback(pickEdge(e, ["tailtarget"]), dflt, obj.tailTarget);
|
|
29588
|
-
obj.tailTarget = tail.v;
|
|
29589
|
-
obj.explicitTailTarget = tail.explicit;
|
|
29590
|
-
const head = withFallback(pickEdge(e, ["headtarget"]), dflt, obj.headTarget);
|
|
29591
|
-
obj.headTarget = head.v;
|
|
29592
|
-
obj.explicitHeadTarget = head.explicit;
|
|
29593
|
-
}
|
|
29594
|
-
function resolveEdgeTooltips(e, obj) {
|
|
29595
|
-
const t = withFallback(pickEdgeTip(e, ["tooltip", "edgetooltip"]), obj.label, obj.tooltip);
|
|
29596
|
-
obj.tooltip = t.v;
|
|
29597
|
-
obj.explicitTooltip = t.explicit;
|
|
29598
|
-
const lt = withFallback(pickEdgeTip(e, ["labeltooltip"]), obj.label, obj.labelTooltip);
|
|
29599
|
-
obj.labelTooltip = lt.v;
|
|
29600
|
-
obj.explicitLabelTooltip = lt.explicit;
|
|
29601
|
-
const tt = withFallback(pickEdgeTip(e, ["tailtooltip"]), obj.tailLabel, obj.tailTooltip);
|
|
29602
|
-
obj.tailTooltip = tt.v;
|
|
29603
|
-
obj.explicitTailTooltip = tt.explicit;
|
|
29604
|
-
const ht = withFallback(pickEdgeTip(e, ["headtooltip"]), obj.headLabel, obj.headTooltip);
|
|
29605
|
-
obj.headTooltip = ht.v;
|
|
29606
|
-
obj.explicitHeadTooltip = ht.explicit;
|
|
29607
|
-
}
|
|
29608
|
-
function resolveEdgeAnchor(e, id, obj) {
|
|
29609
|
-
resolveEdgeLabels(e, obj);
|
|
29610
|
-
resolveEdgeUrls(e, obj);
|
|
29611
|
-
resolveEdgeTargets(e, obj);
|
|
29612
|
-
resolveEdgeTooltips(e, obj);
|
|
29613
|
-
obj.id = subst(id, e);
|
|
29614
|
-
}
|
|
29615
|
-
function resolveObjAnchor(g, label, id, obj) {
|
|
29616
|
-
obj.label = label;
|
|
29617
|
-
const ga = (key) => {
|
|
29618
|
-
for (let s = g; s !== null; s = s.parent) {
|
|
29619
|
-
const v = attr(s.attrs, key);
|
|
29620
|
-
if (v !== void 0) return v;
|
|
29621
|
-
}
|
|
29622
|
-
return void 0;
|
|
29623
|
-
};
|
|
29624
|
-
const url = ga("href") ?? ga("URL");
|
|
29625
|
-
if (url !== void 0) obj.url = subst(url, g);
|
|
29626
|
-
const tt = ga("tooltip");
|
|
29627
|
-
if (tt !== void 0) {
|
|
29628
|
-
obj.tooltip = tip(tt, g);
|
|
29629
|
-
obj.explicitTooltip = true;
|
|
29630
|
-
} else if (label !== null) obj.tooltip = label;
|
|
29631
|
-
const tgt = ga("target");
|
|
29632
|
-
if (tgt !== void 0) obj.target = subst(tgt, g);
|
|
29633
|
-
obj.id = subst(id, g);
|
|
29634
|
-
}
|
|
29635
|
-
function openAnchorWith(renderer, job, url, tooltip, target, id) {
|
|
29636
|
-
renderer.beginAnchor?.(url ?? "", tooltip ?? "", target ?? "", id, job);
|
|
29637
|
-
}
|
|
29638
|
-
function beginAnchorIf(renderer, job) {
|
|
29639
|
-
const obj = job.obj;
|
|
29640
|
-
if (obj === null || obj.url === null && !obj.explicitTooltip) return false;
|
|
29641
|
-
openAnchorWith(renderer, job, obj.url, obj.tooltip, obj.target, obj.id ?? "");
|
|
29642
|
-
return true;
|
|
29643
|
-
}
|
|
29644
|
-
var DFLT_SAMPLE = 20;
|
|
29645
|
-
var MAP_HW = 2;
|
|
29646
|
-
function mapTransform(p, ctx) {
|
|
29647
|
-
return {
|
|
29648
|
-
x: (p.x + ctx.pad.x - ctx.bb.ll.x) * ctx.scale + ctx.marginOff.x,
|
|
29649
|
-
y: (ctx.bb.ur.y + ctx.pad.y - p.y) * ctx.scale + ctx.marginOff.y
|
|
29650
|
-
};
|
|
29651
|
-
}
|
|
29652
|
-
function nodeIsFilled(n) {
|
|
29653
|
-
return parseStyleFlags(nodeAttr(n, n.root, "style")).filled;
|
|
29654
|
-
}
|
|
29655
|
-
function nodeAttrSet(n, key) {
|
|
29656
|
-
const v = nodeAttr(n, n.root, key);
|
|
29657
|
-
return v !== void 0 && v !== "";
|
|
29658
|
-
}
|
|
29659
|
-
function nodeHasHotspot(n) {
|
|
29660
|
-
return nodeAttrSet(n, "href") || nodeAttrSet(n, "URL") || nodeAttrSet(n, "tooltip");
|
|
29661
|
-
}
|
|
29662
|
-
function isRectPoly(p) {
|
|
29663
|
-
return p.sides === 4 && Math.abs(p.orientation % 90) < 0.5 && p.distortion === 0 && p.skew === 0;
|
|
29664
|
-
}
|
|
29665
|
-
function samplePoints(n) {
|
|
29666
|
-
const s = n.attrs.get("samplepoints");
|
|
29667
|
-
if (s === void 0) return DFLT_SAMPLE;
|
|
29668
|
-
const v = parseInt(s, 10);
|
|
29669
|
-
return Number.isNaN(v) || v < 4 || v > 60 ? DFLT_SAMPLE : v;
|
|
29670
|
-
}
|
|
29671
|
-
function pEllipse(a, b, np) {
|
|
29672
|
-
const del = 2 * Math.PI / np;
|
|
29673
|
-
const ps = [];
|
|
29674
|
-
let theta = 0;
|
|
29675
|
-
for (let i = 0; i < np; i++) {
|
|
29676
|
-
ps.push({ x: a * Math.cos(theta), y: b * Math.sin(theta) });
|
|
29677
|
-
theta += del;
|
|
29678
|
-
}
|
|
29679
|
-
return ps;
|
|
29680
|
-
}
|
|
29681
|
-
function ellipseNodeMap(poly, coord, ur, nump) {
|
|
29682
|
-
if (poly.regular) {
|
|
29683
|
-
return { shape: 1 /* Circle */, pts: [coord, { x: coord.x + ur.x, y: coord.y + ur.y }] };
|
|
29684
|
-
}
|
|
29685
|
-
const pts = pEllipse(ur.x, ur.y, nump).map((p) => ({ x: p.x + coord.x, y: p.y + coord.y }));
|
|
29686
|
-
return { shape: 2 /* Polygon */, pts };
|
|
29687
|
-
}
|
|
29688
|
-
function generalNodeMap(poly, coord, vertices, peripheries, nump) {
|
|
29689
|
-
const offset = (peripheries - 1) * poly.sides;
|
|
29690
|
-
const pts = [];
|
|
29691
|
-
if (poly.sides >= nump) {
|
|
29692
|
-
const delta2 = Math.trunc(poly.sides / nump);
|
|
29693
|
-
for (let i = 0, j = 0; j < nump; i += delta2, j++) {
|
|
29694
|
-
const v = vertices[i + offset];
|
|
29695
|
-
pts.push({ x: coord.x + v.x, y: coord.y + v.y });
|
|
29696
|
-
}
|
|
29697
|
-
} else {
|
|
29698
|
-
for (let i = 0; i < poly.sides; i++) {
|
|
29699
|
-
const v = vertices[i + offset];
|
|
29700
|
-
pts.push({ x: coord.x + v.x, y: coord.y + v.y });
|
|
29701
|
-
}
|
|
29702
|
-
}
|
|
29703
|
-
return { shape: 2 /* Polygon */, pts };
|
|
29704
|
-
}
|
|
29705
|
-
function nodePolyMap(n, poly, coord, filled) {
|
|
29706
|
-
const peripheries = poly.peripheries < 2 ? 1 : poly.peripheries;
|
|
29707
|
-
const vertices = poly.vertices;
|
|
29708
|
-
const nump = samplePoints(n);
|
|
29709
|
-
const info = n.info;
|
|
29710
|
-
if (poly.peripheries === 0 && !filled) {
|
|
29711
|
-
return { shape: 0 /* Rectangle */, pts: [
|
|
29712
|
-
{ x: coord.x - info.lw, y: coord.y - info.ht / 2 },
|
|
29713
|
-
{ x: coord.x + info.lw, y: coord.y + info.ht / 2 }
|
|
29714
|
-
] };
|
|
29715
|
-
}
|
|
29716
|
-
if (poly.sides < 3 && poly.skew === 0 && poly.distortion === 0) {
|
|
29717
|
-
return ellipseNodeMap(poly, coord, vertices[2 * peripheries - 1], nump);
|
|
29718
|
-
}
|
|
29719
|
-
return generalNodeMap(poly, coord, vertices, peripheries, nump);
|
|
29720
|
-
}
|
|
29721
|
-
function computeNodeUrlMap(n, obj, ctx) {
|
|
29722
|
-
if (!nodeHasHotspot(n)) return;
|
|
29723
|
-
const info = n.info;
|
|
29724
|
-
const coord = info.coord;
|
|
29725
|
-
const poly = info.shape_info;
|
|
29726
|
-
const filled = nodeIsFilled(n);
|
|
29727
|
-
const isRect = poly !== void 0 && isRectPoly(poly) && (poly.peripheries !== 0 || filled);
|
|
29728
|
-
let m;
|
|
29729
|
-
if (poly !== void 0 && poly.vertices != null && !isRect && ctx.mapPolygon) {
|
|
29730
|
-
m = nodePolyMap(n, poly, coord, filled);
|
|
29731
|
-
} else {
|
|
29732
|
-
m = { shape: 0 /* Rectangle */, pts: [
|
|
29733
|
-
{ x: coord.x - info.lw, y: coord.y - info.ht / 2 },
|
|
29734
|
-
{ x: coord.x + info.rw, y: coord.y + info.ht / 2 }
|
|
29735
|
-
] };
|
|
29736
|
-
}
|
|
29737
|
-
obj.urlMapShape = m.shape;
|
|
29738
|
-
obj.urlMapPts = m.pts.map((p) => mapTransform(p, ctx));
|
|
29739
|
-
}
|
|
29740
|
-
function computeGraphUrlMap(obj, ctx) {
|
|
29741
|
-
const ll = { x: -ctx.pad.x, y: -ctx.pad.y };
|
|
29742
|
-
const ur = {
|
|
29743
|
-
x: ctx.bb.ur.x - ctx.bb.ll.x + ctx.pad.x,
|
|
29744
|
-
y: ctx.bb.ur.y - ctx.bb.ll.y + ctx.pad.y
|
|
29745
|
-
};
|
|
29746
|
-
obj.urlMapShape = 0 /* Rectangle */;
|
|
29747
|
-
obj.urlMapPts = [mapTransform(ll, ctx), mapTransform(ur, ctx)];
|
|
29748
|
-
}
|
|
29749
|
-
function computeClusterUrlMap(bb, obj, ctx) {
|
|
29750
|
-
obj.urlMapShape = 0 /* Rectangle */;
|
|
29751
|
-
obj.urlMapPts = [mapTransform(bb.ll, ctx), mapTransform(bb.ur, ctx)];
|
|
29752
|
-
}
|
|
29753
|
-
function computeLabelRectMap(lab, obj, ctx) {
|
|
29754
|
-
const dx = lab.dimen.x / 2;
|
|
29755
|
-
const dy = lab.dimen.y / 2;
|
|
29756
|
-
obj.urlMapShape = 0 /* Rectangle */;
|
|
29757
|
-
obj.urlMapPts = [
|
|
29758
|
-
mapTransform({ x: lab.pos.x - dx, y: lab.pos.y - dy }, ctx),
|
|
29759
|
-
mapTransform({ x: lab.pos.x + dx, y: lab.pos.y + dy }, ctx)
|
|
29760
|
-
];
|
|
29761
|
-
}
|
|
29762
|
-
function checkControlPoints2(cp) {
|
|
29763
|
-
return ptToLine2(cp[0], cp[3], cp[1]) < MAP_HW * MAP_HW && ptToLine2(cp[0], cp[3], cp[2]) < MAP_HW * MAP_HW;
|
|
29764
|
-
}
|
|
29765
|
-
function bezierHalf(v) {
|
|
29766
|
-
const left2 = [];
|
|
29767
|
-
const right2 = [];
|
|
29768
|
-
bezier(v, 0.5, left2, right2);
|
|
29769
|
-
return { left: left2, right: right2 };
|
|
29770
|
-
}
|
|
29771
|
-
function approxBezier(cp, out) {
|
|
29772
|
-
if (checkControlPoints2(cp)) {
|
|
29773
|
-
if (out.length === 0) out.push(cp[0]);
|
|
29774
|
-
out.push(cp[3]);
|
|
29775
|
-
} else {
|
|
29776
|
-
const { left: left2, right: right2 } = bezierHalf(cp);
|
|
29777
|
-
approxBezier(left2, out);
|
|
29778
|
-
approxBezier(right2, out);
|
|
29779
|
-
}
|
|
29780
|
-
}
|
|
29781
|
-
function mkSegPts(prv, cur, nxt, w2) {
|
|
29782
|
-
let pp;
|
|
29783
|
-
let np;
|
|
29784
|
-
if (prv) {
|
|
29785
|
-
pp = prv;
|
|
29786
|
-
np = nxt ?? { x: 2 * (cur.x - pp.x), y: 2 * (cur.y - pp.y) };
|
|
29787
|
-
} else {
|
|
29788
|
-
np = nxt;
|
|
29789
|
-
pp = { x: 2 * (cur.x - np.x), y: 2 * (cur.y - np.y) };
|
|
29790
|
-
}
|
|
29791
|
-
const theta = Math.atan2(np.y - cur.y, np.x - cur.x);
|
|
29792
|
-
const phi = Math.atan2(pp.y - cur.y, pp.x - cur.x);
|
|
29793
|
-
let ang = theta - phi;
|
|
29794
|
-
if (ang > 0) ang -= 2 * Math.PI;
|
|
29795
|
-
const bis = phi + ang / 2;
|
|
29796
|
-
const del = { x: w2 * Math.cos(bis), y: w2 * Math.sin(bis) };
|
|
29797
|
-
return { p1: { x: cur.x + del.x, y: cur.y + del.y }, p2: { x: cur.x - del.x, y: cur.y - del.y } };
|
|
29798
|
-
}
|
|
29799
|
-
function mapOutputBspline(bp, w2, polys) {
|
|
29800
|
-
const nc = Math.trunc((bp.size - 1) / 3);
|
|
29801
|
-
const segs = [];
|
|
29802
|
-
for (let j = 0; j < nc; j++) {
|
|
29803
|
-
approxBezier([bp.list[3 * j], bp.list[3 * j + 1], bp.list[3 * j + 2], bp.list[3 * j + 3]], segs);
|
|
29804
|
-
}
|
|
29805
|
-
const pt1 = [];
|
|
29806
|
-
const pt2 = [];
|
|
29807
|
-
let cnt = 0;
|
|
29808
|
-
for (let i = 0; i < segs.length; i++) {
|
|
29809
|
-
const prev = i === 0 ? null : segs[i - 1];
|
|
29810
|
-
const next = i + 1 < segs.length ? segs[i + 1] : null;
|
|
29811
|
-
const seg2 = mkSegPts(prev, segs[i], next, w2);
|
|
29812
|
-
pt1[cnt] = seg2.p1;
|
|
29813
|
-
pt2[cnt] = seg2.p2;
|
|
29814
|
-
cnt++;
|
|
29815
|
-
if (i + 1 === segs.length || cnt === 50) {
|
|
29816
|
-
const poly = [];
|
|
29817
|
-
for (let k = 0; k < cnt; k++) poly.push(pt1[k]);
|
|
29818
|
-
for (let k = 0; k < cnt; k++) poly.push(pt2[cnt - 1 - k]);
|
|
29819
|
-
polys.push(poly);
|
|
29820
|
-
pt1[0] = pt1[cnt - 1];
|
|
29821
|
-
pt2[0] = pt2[cnt - 1];
|
|
29822
|
-
cnt = 1;
|
|
29823
|
-
}
|
|
29897
|
+
function setupPageSize(bb, size, pad, z) {
|
|
29898
|
+
const jbLL = { x: bb.ll.x - pad.x, y: bb.ll.y - pad.y };
|
|
29899
|
+
const jbUR = { x: bb.ur.x + pad.x, y: bb.ur.y + pad.y };
|
|
29900
|
+
const sz = { x: jbUR.x - jbLL.x, y: jbUR.y - jbLL.y };
|
|
29901
|
+
if (size !== null && size.x > 1e-3 && size.y > 1e-3) {
|
|
29902
|
+
if (sz.x <= 1e-3) sz.x = size.x;
|
|
29903
|
+
if (sz.y <= 1e-3) sz.y = size.y;
|
|
29824
29904
|
}
|
|
29905
|
+
return { x: z * sz.x / z, y: z * sz.y / z };
|
|
29825
29906
|
}
|
|
29826
|
-
function
|
|
29827
|
-
const
|
|
29828
|
-
|
|
29829
|
-
return polys.map((poly) => poly.map((p) => mapTransform(p, ctx)));
|
|
29907
|
+
function setupPageBox(pageSize, pad) {
|
|
29908
|
+
const ll = { x: 0 * pageSize.x - pad.x, y: 0 * pageSize.y - pad.y };
|
|
29909
|
+
return { ll, ur: { x: ll.x + pageSize.x, y: ll.y + pageSize.y } };
|
|
29830
29910
|
}
|
|
29831
29911
|
|
|
29832
29912
|
// src/common/layers.ts
|
|
@@ -29905,6 +29985,16 @@ function edgeInLayer(info, layerNum, e) {
|
|
|
29905
29985
|
return pn === "" || selectedLayer(info, layerNum, pn);
|
|
29906
29986
|
});
|
|
29907
29987
|
}
|
|
29988
|
+
function clustInLayer(info, layerNum, sg) {
|
|
29989
|
+
if (info.numLayers <= 1) return true;
|
|
29990
|
+
const pg = graphAttrInherited(sg, "layer") ?? "";
|
|
29991
|
+
if (selectedLayer(info, layerNum, pg)) return true;
|
|
29992
|
+
if (pg !== "") return false;
|
|
29993
|
+
for (const n of sg.nodes.values()) {
|
|
29994
|
+
if (nodeInLayer(info, layerNum, n, sg)) return true;
|
|
29995
|
+
}
|
|
29996
|
+
return false;
|
|
29997
|
+
}
|
|
29908
29998
|
function parseLayerselect(info, p) {
|
|
29909
29999
|
const picked = [];
|
|
29910
30000
|
for (let i = 1; i <= info.numLayers; i++) {
|
|
@@ -29926,6 +30016,9 @@ function nodeShown(info, job, n, g) {
|
|
|
29926
30016
|
function edgeShown(info, job, e) {
|
|
29927
30017
|
return info === void 0 || job.numLayers <= 1 || edgeInLayer(info, job.layerNum, e);
|
|
29928
30018
|
}
|
|
30019
|
+
function clusterShown(info, job, sg) {
|
|
30020
|
+
return info === void 0 || job.numLayers <= 1 || clustInLayer(info, job.layerNum, sg);
|
|
30021
|
+
}
|
|
29929
30022
|
function chkOrder(g) {
|
|
29930
30023
|
const p = g.attrs.get("outputorder");
|
|
29931
30024
|
if (p === "nodesfirst") return "nodesfirst";
|
|
@@ -30433,20 +30526,19 @@ function drawClusterInScheme(sg, renderer, job) {
|
|
|
30433
30526
|
renderer.beginCluster?.(sg, job);
|
|
30434
30527
|
if (job.obj !== null) job.obj.id = svgClusterId(sg, job);
|
|
30435
30528
|
setHtmlAnchorObj(svgClusterId(sg, job), labelTextOf2(sg.info.label), job.obj ?? void 0);
|
|
30436
|
-
if (job.obj !== null)
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
const anchored = beginAnchorIf(renderer, job);
|
|
30529
|
+
if (job.obj !== null) resolveObjAnchor(sg, labelTextOf2(sg.info.label), svgClusterId(sg, job), job.obj);
|
|
30530
|
+
const late = (job.flags & EMIT_CLUSTERS_LAST) !== 0;
|
|
30531
|
+
const anchored = !late && beginClusterAnchor(sg, renderer, job);
|
|
30440
30532
|
if ((clusterPeripheries(sg) !== 0 || filled || isStripedCluster(sg)) && job.obj?.pen !== 0 /* None */) {
|
|
30441
30533
|
renderClusterBox(sg, filled, renderer, job);
|
|
30442
30534
|
}
|
|
30443
30535
|
renderClusterLabel(sg, renderer, job);
|
|
30444
|
-
if (anchored) renderer.endAnchor?.(job);
|
|
30536
|
+
if (anchored || late && beginClusterAnchor(sg, renderer, job)) renderer.endAnchor?.(job);
|
|
30445
30537
|
renderer.endCluster?.(sg, job);
|
|
30446
30538
|
}
|
|
30447
|
-
function renderOneCluster(sg, renderer, job) {
|
|
30539
|
+
function renderOneCluster(sg, renderer, job, info) {
|
|
30448
30540
|
const clustersLast = (job.flags & EMIT_CLUSTERS_LAST) !== 0;
|
|
30449
|
-
if (clustersLast) renderClusters(sg, renderer, job);
|
|
30541
|
+
if (clustersLast) renderClusters(sg, renderer, job, info);
|
|
30450
30542
|
const obj = createObjState(1 /* Cluster */);
|
|
30451
30543
|
obj.emitState = 1 /* CDraw */;
|
|
30452
30544
|
job.pushObj(obj);
|
|
@@ -30455,15 +30547,15 @@ function renderOneCluster(sg, renderer, job) {
|
|
|
30455
30547
|
} finally {
|
|
30456
30548
|
job.popObj();
|
|
30457
30549
|
}
|
|
30458
|
-
if (!clustersLast) renderClusters(sg, renderer, job);
|
|
30550
|
+
if (!clustersLast) renderClusters(sg, renderer, job, info);
|
|
30459
30551
|
}
|
|
30460
|
-
function renderClusters(g, renderer, job) {
|
|
30552
|
+
function renderClusters(g, renderer, job, info) {
|
|
30461
30553
|
const nClust = g.info.n_cluster ?? 0;
|
|
30462
30554
|
const clust = g.info.clust;
|
|
30463
30555
|
if (nClust === 0 || !clust) return;
|
|
30464
30556
|
for (let c = 0; c < nClust; c++) {
|
|
30465
30557
|
const sg = clust[c];
|
|
30466
|
-
if (sg) renderOneCluster(sg, renderer, job);
|
|
30558
|
+
if (sg && clusterShown(info, job, sg)) renderOneCluster(sg, renderer, job, info);
|
|
30467
30559
|
}
|
|
30468
30560
|
}
|
|
30469
30561
|
function renderGraph(g, job, renderer) {
|
|
@@ -30502,9 +30594,9 @@ function renderPage(g, renderer, job, info) {
|
|
|
30502
30594
|
});
|
|
30503
30595
|
if (anchored) renderer.endAnchor?.(job);
|
|
30504
30596
|
const clustersLast = (job.flags & EMIT_CLUSTERS_LAST) !== 0;
|
|
30505
|
-
if (!clustersLast) renderClusters(g, renderer, job);
|
|
30597
|
+
if (!clustersLast) renderClusters(g, renderer, job, info);
|
|
30506
30598
|
walkNodesAndEdges(g, renderer, job, info);
|
|
30507
|
-
if (clustersLast) renderClusters(g, renderer, job);
|
|
30599
|
+
if (clustersLast) renderClusters(g, renderer, job, info);
|
|
30508
30600
|
renderer.endPage?.(g, job);
|
|
30509
30601
|
}
|
|
30510
30602
|
function newRenderJob(ctx, format, inlineImages) {
|
|
@@ -30537,6 +30629,7 @@ function render(ctx, g, format, inlineImages = false) {
|
|
|
30537
30629
|
job.scale = { x: z * dpiScale, y: z * dpiScale };
|
|
30538
30630
|
job.rotation = parseLandscape(g) ? 90 : 0;
|
|
30539
30631
|
job.renderer = renderer;
|
|
30632
|
+
job.drawingId = drawingIdOf(g);
|
|
30540
30633
|
setRendererKnownColors(renderer.type === "svg");
|
|
30541
30634
|
resetHtmlAnchorIds();
|
|
30542
30635
|
for (const n of g.nodes.values()) polyInit(n, g, job.measurer);
|
|
@@ -37107,16 +37200,13 @@ function cmapxShape(shape) {
|
|
|
37107
37200
|
return "poly";
|
|
37108
37201
|
}
|
|
37109
37202
|
function cmapxCoordsRect(pts) {
|
|
37110
|
-
return
|
|
37203
|
+
return printfFixed0(pts[0].x) + "," + printfFixed0(pts[1].y) + "," + printfFixed0(pts[1].x) + "," + printfFixed0(pts[0].y);
|
|
37111
37204
|
}
|
|
37112
37205
|
function cmapxCoordsCircle(pts) {
|
|
37113
|
-
|
|
37114
|
-
const cy = Math.round(pts[0].y);
|
|
37115
|
-
const r = Math.round(pts[1].x - pts[0].x);
|
|
37116
|
-
return String(cx) + "," + String(cy) + "," + String(r);
|
|
37206
|
+
return printfFixed0(pts[0].x) + "," + printfFixed0(pts[0].y) + "," + printfFixed0(pts[1].x - pts[0].x);
|
|
37117
37207
|
}
|
|
37118
37208
|
function cmapxCoordsPoly(pts) {
|
|
37119
|
-
return pts.map((p) =>
|
|
37209
|
+
return pts.map((p) => printfFixed0(p.x) + "," + printfFixed0(p.y)).join(",");
|
|
37120
37210
|
}
|
|
37121
37211
|
function cmapxCoords(shape, pts) {
|
|
37122
37212
|
if (shape === 1 /* Circle */) return cmapxCoordsCircle(pts);
|
|
@@ -37139,12 +37229,11 @@ function mapOutputCmapx(shape, pts, a, isXml, out) {
|
|
|
37139
37229
|
function mapOutputImap(shape, pts, url, out) {
|
|
37140
37230
|
if (!url) return;
|
|
37141
37231
|
if (shape === 0 /* Rectangle */) {
|
|
37142
|
-
out.push("rect " + url + " " +
|
|
37232
|
+
out.push("rect " + url + " " + printfFixed0(pts[0].x) + "," + printfFixed0(pts[1].y) + " " + printfFixed0(pts[1].x) + "," + printfFixed0(pts[0].y) + "\n");
|
|
37143
37233
|
} else if (shape === 1 /* Circle */) {
|
|
37144
|
-
|
|
37145
|
-
out.push("circle " + url + " " + Math.round(pts[0].x) + "," + Math.round(pts[0].y) + "," + String(r) + "\n");
|
|
37234
|
+
out.push("circle " + url + " " + printfFixed0(pts[0].x) + "," + printfFixed0(pts[0].y) + "," + printfFixed0(pts[1].x - pts[0].x) + "\n");
|
|
37146
37235
|
} else {
|
|
37147
|
-
const pairs = pts.map((p) =>
|
|
37236
|
+
const pairs = pts.map((p) => printfFixed0(p.x) + "," + printfFixed0(p.y)).join(" ");
|
|
37148
37237
|
out.push("poly " + url + " " + pairs + "\n");
|
|
37149
37238
|
}
|
|
37150
37239
|
}
|
|
@@ -37222,11 +37311,13 @@ function graphMapUrl(g) {
|
|
|
37222
37311
|
}
|
|
37223
37312
|
function buildMapCtx(g, job, mapPolygon) {
|
|
37224
37313
|
const drawingDpi = lateDouble(g.attrs.get("dpi"), lateDouble(g.attrs.get("resolution"), 0, 0), 0);
|
|
37225
|
-
const
|
|
37226
|
-
const
|
|
37227
|
-
const z = initJobViewportZoom(job.bb,
|
|
37228
|
-
const
|
|
37229
|
-
|
|
37314
|
+
const devscale = (drawingDpi > 0 ? drawingDpi : 96) / POINTS_PER_INCH;
|
|
37315
|
+
const size = parseDrawingSize(g.attrs.get("size"));
|
|
37316
|
+
const z = initJobViewportZoom(job.bb, size, job.pad);
|
|
37317
|
+
const clip = setupPageClip(job.bb, size, job.pad, z);
|
|
37318
|
+
const pageBox = setupPageBox(setupPageSize(job.bb, size, job.pad, z), job.pad);
|
|
37319
|
+
const translation = { x: -clip.ll.x + job.margin.x / z, y: -clip.ur.y - job.margin.y / z };
|
|
37320
|
+
return { pageBox, translation, scale: { x: z * devscale, y: z * -devscale }, mapPolygon };
|
|
37230
37321
|
}
|
|
37231
37322
|
function anchorOf(url, tooltip, target, id) {
|
|
37232
37323
|
return { url: url ?? "", tooltip: tooltip ?? "", target: target ?? "", id: id ?? "" };
|
|
@@ -37261,12 +37352,6 @@ var MapRendererBase = class {
|
|
|
37261
37352
|
beginNode(n, job) {
|
|
37262
37353
|
if (this.mapCtx !== null && job.obj !== null) computeNodeUrlMap(n, job.obj, this.mapCtx);
|
|
37263
37354
|
}
|
|
37264
|
-
beginCluster(sg, job) {
|
|
37265
|
-
const bb = sg.info.bb;
|
|
37266
|
-
if (this.mapCtx !== null && job.obj !== null && bb !== void 0) {
|
|
37267
|
-
computeClusterUrlMap(bb, job.obj, this.mapCtx);
|
|
37268
|
-
}
|
|
37269
|
-
}
|
|
37270
37355
|
endEdge(e, job) {
|
|
37271
37356
|
if (this.mapCtx !== null && job.obj !== null) this.emitEdge(e, job.obj, job);
|
|
37272
37357
|
}
|
|
@@ -37321,30 +37406,34 @@ var MapRendererBase = class {
|
|
|
37321
37406
|
url: obj.labelUrl,
|
|
37322
37407
|
tooltip: obj.labelTooltip,
|
|
37323
37408
|
target: obj.labelTarget,
|
|
37324
|
-
explicit: obj.explicitLabelTooltip
|
|
37409
|
+
explicit: obj.explicitLabelTooltip,
|
|
37410
|
+
suffix: "label"
|
|
37325
37411
|
};
|
|
37326
37412
|
this.emitEdgeLabel(e.info.label, centerA, obj, job);
|
|
37327
37413
|
this.emitEdgeLabel(e.info.xlabel, centerA, obj, job);
|
|
37328
|
-
this.emitEdgeLabel(
|
|
37329
|
-
|
|
37330
|
-
|
|
37331
|
-
obj,
|
|
37332
|
-
|
|
37333
|
-
|
|
37334
|
-
|
|
37335
|
-
|
|
37336
|
-
|
|
37337
|
-
obj,
|
|
37338
|
-
|
|
37339
|
-
|
|
37340
|
-
|
|
37341
|
-
|
|
37342
|
-
|
|
37414
|
+
this.emitEdgeLabel(e.info.head_label, {
|
|
37415
|
+
url: obj.headUrl,
|
|
37416
|
+
tooltip: obj.headTooltip,
|
|
37417
|
+
target: obj.headTarget,
|
|
37418
|
+
explicit: obj.explicitHeadTooltip,
|
|
37419
|
+
suffix: "headlabel"
|
|
37420
|
+
}, obj, job);
|
|
37421
|
+
this.emitEdgeLabel(e.info.tail_label, {
|
|
37422
|
+
url: obj.tailUrl,
|
|
37423
|
+
tooltip: obj.tailTooltip,
|
|
37424
|
+
target: obj.tailTarget,
|
|
37425
|
+
explicit: obj.explicitTailTooltip,
|
|
37426
|
+
suffix: "taillabel"
|
|
37427
|
+
}, obj, job);
|
|
37428
|
+
}
|
|
37429
|
+
/** One edge label hot spot (map_label rect), if placed and url/explicit-tip; its id is
|
|
37430
|
+
* `<obj.id>-<suffix>` (C: `if (id)`, else NULL). @see lib/common/emit.c:emit_edge_label (2851-2876) */
|
|
37343
37431
|
emitEdgeLabel(lab, la, obj, job) {
|
|
37344
37432
|
const placed = lab !== void 0 && lab.set && this.mapCtx !== null;
|
|
37345
37433
|
if (!placed || la.url === null && !la.explicit) return;
|
|
37346
37434
|
computeLabelRectMap(lab, obj, this.mapCtx);
|
|
37347
|
-
|
|
37435
|
+
const id = obj.id === null ? null : `${obj.id}-${la.suffix}`;
|
|
37436
|
+
this.emitShape(0 /* Rectangle */, obj.urlMapPts, anchorOf(la.url, la.tooltip, la.target, id), job);
|
|
37348
37437
|
}
|
|
37349
37438
|
};
|
|
37350
37439
|
var ImapRenderer = class extends MapRendererBase {
|
|
@@ -40119,15 +40208,18 @@ function buildArrays(gp, nObjs, nLbls, nClbls, et) {
|
|
|
40119
40208
|
return { ctx };
|
|
40120
40209
|
}
|
|
40121
40210
|
function writeBackLabels(gp, lbls, nLbls) {
|
|
40211
|
+
let cnt = 0;
|
|
40122
40212
|
for (let i = 0; i < nLbls; i++) {
|
|
40123
40213
|
const xlp = lbls[i];
|
|
40124
40214
|
if (xlp.set) {
|
|
40215
|
+
cnt++;
|
|
40125
40216
|
const lp = xlp.lbl;
|
|
40126
40217
|
lp.set = true;
|
|
40127
40218
|
lp.pos = centerPt(xlp);
|
|
40128
40219
|
updateBBForLabel(gp, lp);
|
|
40129
40220
|
}
|
|
40130
40221
|
}
|
|
40222
|
+
return cnt;
|
|
40131
40223
|
}
|
|
40132
40224
|
var XLABEL_WORK_MASK = NODE_XLABEL | EDGE_XLABEL | TAIL_LABEL | HEAD_LABEL;
|
|
40133
40225
|
function needsXLabelWork(gp) {
|
|
@@ -40148,7 +40240,10 @@ function runPlacement(gp) {
|
|
|
40148
40240
|
const force = forceStr === void 0 ? true : mapbool(forceStr);
|
|
40149
40241
|
const params = { bb: { ll: ctx.bb.ll, ur: ctx.bb.ur }, force };
|
|
40150
40242
|
placeLabels(ctx.objs, ctx.lbls, params);
|
|
40151
|
-
writeBackLabels(gp, ctx.lbls, nLbls);
|
|
40243
|
+
const cnt = writeBackLabels(gp, ctx.lbls, nLbls);
|
|
40244
|
+
if (cnt !== nLbls) {
|
|
40245
|
+
agwarningf(`${cnt} out of ${nLbls} exterior labels positioned.`);
|
|
40246
|
+
}
|
|
40152
40247
|
}
|
|
40153
40248
|
function addXLabels(gp) {
|
|
40154
40249
|
if (!needsXLabelWork(gp)) return;
|
|
@@ -42083,19 +42178,6 @@ function boxIntersectf(pp, cp, bb) {
|
|
|
42083
42178
|
}
|
|
42084
42179
|
|
|
42085
42180
|
// src/layout/dot/compound.ts
|
|
42086
|
-
function fillClustMap(g, map) {
|
|
42087
|
-
const nc = g.info.n_cluster ?? 0;
|
|
42088
|
-
for (let c = 1; c <= nc; c++) {
|
|
42089
|
-
const cl = g.info.clust[c - 1];
|
|
42090
|
-
if (!map.has(cl.name)) map.set(cl.name, cl);
|
|
42091
|
-
fillClustMap(cl, map);
|
|
42092
|
-
}
|
|
42093
|
-
}
|
|
42094
|
-
function mkClustMap2(g) {
|
|
42095
|
-
const map = /* @__PURE__ */ new Map();
|
|
42096
|
-
fillClustMap(g, map);
|
|
42097
|
-
return map;
|
|
42098
|
-
}
|
|
42099
42181
|
function arrowEndClipIdx(state3, endp) {
|
|
42100
42182
|
const { e, bez } = state3;
|
|
42101
42183
|
const elen = arrowClipLength(edgeArrowName(e, "head"), edgeArrowsize(e), edgePenwidthAttr(e));
|
|
@@ -42246,7 +42328,7 @@ function makeCompoundEdge(e, clustMap) {
|
|
|
42246
42328
|
if (tailClipped && bez.sflag) restashArrow(e, bez.sp, bez.list[0], true);
|
|
42247
42329
|
}
|
|
42248
42330
|
function dotCompoundEdges(g) {
|
|
42249
|
-
const clustMap =
|
|
42331
|
+
const clustMap = mkClustMap(g);
|
|
42250
42332
|
for (const e of g.edges) makeCompoundEdge(e, clustMap);
|
|
42251
42333
|
}
|
|
42252
42334
|
|
|
@@ -60310,7 +60392,7 @@ function emitAttachment(lp, spl, renderer, job) {
|
|
|
60310
60392
|
|
|
60311
60393
|
// src/render/svg-cluster.ts
|
|
60312
60394
|
function svgBeginCluster(sg, job) {
|
|
60313
|
-
job.write('<g id="' + escapeXmlTitle(
|
|
60395
|
+
job.write('<g id="' + escapeXmlTitle(svgClusterId(sg, job)) + '" ' + svgClusterClass(sg) + ">\n");
|
|
60314
60396
|
job.write("<title>" + escapeXmlTitle(sg.name) + "</title>\n");
|
|
60315
60397
|
}
|
|
60316
60398
|
function svgEndCluster(job) {
|
|
@@ -60689,6 +60771,7 @@ function writeDictSkips(v, inherited) {
|
|
|
60689
60771
|
function echoGraphAttr(g, key) {
|
|
60690
60772
|
const v = g.attrs.get(key);
|
|
60691
60773
|
if (v === void 0) return [];
|
|
60774
|
+
if (g.seededAttrs?.has(key) === true) return [];
|
|
60692
60775
|
if (writeDictSkips(v, g.graphDefaultsSnapshot?.get(key))) return [];
|
|
60693
60776
|
return [`${key}=${agstrcanon(v)}`];
|
|
60694
60777
|
}
|
|
@@ -60734,7 +60817,7 @@ function isDirected(g) {
|
|
|
60734
60817
|
|
|
60735
60818
|
// src/render/dot/agwrite.ts
|
|
60736
60819
|
var DotWriterBase = class {
|
|
60737
|
-
/**
|
|
60820
|
+
/** The clusters xdot_end_cluster ran for (not all of GD_clust: inClusterTree). */
|
|
60738
60821
|
clusters = [];
|
|
60739
60822
|
/**
|
|
60740
60823
|
* Emit `key=<canon value>` through `_agstrcanon`, as `agwrite` does for the xdot
|
|
@@ -60801,7 +60884,7 @@ var DotWriterBase = class {
|
|
|
60801
60884
|
* a boxed graph and an unboxed child — the driver that makes an anon subgraph
|
|
60802
60885
|
* under the root or a cluster "relevant". @see lib/common/output.c:safe_dcl */
|
|
60803
60886
|
hasBb(g) {
|
|
60804
|
-
return g === g.root ||
|
|
60887
|
+
return g === g.root || inClusterTree(g);
|
|
60805
60888
|
}
|
|
60806
60889
|
/** Anonymous subgraph with no own node/edge defaults and no graph attrs
|
|
60807
60890
|
* differing from its parent → inlined into the parent. Native compares every
|
|
@@ -60809,7 +60892,7 @@ var DotWriterBase = class {
|
|
|
60809
60892
|
* the parent, empty on the child) and `rank`. @see write.c:irrelevant_subgraph */
|
|
60810
60893
|
irrelevantSubgraph(g) {
|
|
60811
60894
|
if (!this.isAnonymous(g)) return false;
|
|
60812
|
-
if (
|
|
60895
|
+
if (inClusterTree(g)) return false;
|
|
60813
60896
|
if (g.nodeDefaults.size > 0 || g.edgeDefaults.size > 0) return false;
|
|
60814
60897
|
if (g.parent) {
|
|
60815
60898
|
if (this.hasBb(g) !== this.hasBb(g.parent)) return false;
|
|
@@ -60827,9 +60910,8 @@ var DotWriterBase = class {
|
|
|
60827
60910
|
* `rec_attach_bb` walks the ROOT and then `GD_clust` recursively, so a
|
|
60828
60911
|
* subgraph the layout did not box is attached NEITHER `bb` NOR the label
|
|
60829
60912
|
* triple — both keep the INPUT's values, which agwrite echoes. circo and
|
|
60830
|
-
* twopi lay out no clusters
|
|
60831
|
-
*
|
|
60832
|
-
* `cluster0` comes back carrying the *previous* run's `bb` and `lp`.
|
|
60913
|
+
* twopi lay out no clusters (`GD_clust` empty, `inClusterTree` false), so on a
|
|
60914
|
+
* re-fed dot output `cluster0` carries the *previous* run's `bb` and `lp`.
|
|
60833
60915
|
* @see lib/common/output.c:249 rec_attach_bb */
|
|
60834
60916
|
subgGraphAttrs(sg) {
|
|
60835
60917
|
const parts = [];
|
|
@@ -60861,7 +60943,7 @@ var DotWriterBase = class {
|
|
|
60861
60943
|
* order. @see lib/cgraph/write.c:307 write_dicts
|
|
60862
60944
|
*/
|
|
60863
60945
|
writeDicts(g, top, ctx) {
|
|
60864
|
-
const graphParts = top ? this.graphAttrs(g) :
|
|
60946
|
+
const graphParts = top ? this.graphAttrs(g) : inClusterTree(g) ? this.clusterAttrs(g) : this.subgGraphAttrs(g);
|
|
60865
60947
|
this.writeDict("graph", graphParts, ctx);
|
|
60866
60948
|
this.writeDict("node", nodeDictParts(g, top), ctx);
|
|
60867
60949
|
this.writeDict("edge", dictParts(g.edgeDefaults), ctx);
|
|
@@ -61042,13 +61124,14 @@ var DotWriterBase = class {
|
|
|
61042
61124
|
parts.push(...graphInputParts(g, true, this.emitDraws));
|
|
61043
61125
|
return parts;
|
|
61044
61126
|
}
|
|
61045
|
-
/** Cluster attribute block. C's xdot_end_cluster ALWAYS agsets `_draw_`
|
|
61046
|
-
*
|
|
61047
|
-
*
|
|
61127
|
+
/** Cluster attribute block. C's xdot_end_cluster ALWAYS agsets `_draw_` for a
|
|
61128
|
+
* cluster it ran for (even empty, e.g. peripheries=0); one that emit_clusters
|
|
61129
|
+
* skipped (clust_in_layer) keeps only a stored one. `_ldraw_` only with a label.
|
|
61048
61130
|
* @see plugin/core/gvrender_core_dot.c:284 xdot_end_cluster */
|
|
61049
61131
|
clusterAttrs(sg) {
|
|
61050
61132
|
const d = this.drawsOf(sg);
|
|
61051
|
-
const
|
|
61133
|
+
const drawn = this.emitDraws && this.clusters.includes(sg);
|
|
61134
|
+
const parts = drawn || d?.draw ? [this.drawAttr("_draw_", d?.draw ?? "")] : [];
|
|
61052
61135
|
if (d?.ldraw) parts.push(this.drawAttr("_ldraw_", d.ldraw));
|
|
61053
61136
|
if (sg.info.bb) parts.push('bb="' + this.bbStr(sg) + '"');
|
|
61054
61137
|
parts.push(...graphLabelAttrs(sg));
|
|
@@ -62156,7 +62239,7 @@ function collectDrawLookup(g) {
|
|
|
62156
62239
|
for (const [nm, gChild] of gSub.subgraphs) {
|
|
62157
62240
|
const xgChild = xgSub.subgraphs.get(nm);
|
|
62158
62241
|
if (xgChild !== void 0) {
|
|
62159
|
-
cluster.set(gChild,
|
|
62242
|
+
cluster.set(gChild, localGraphAttrs(xgChild));
|
|
62160
62243
|
correlate(gChild, xgChild);
|
|
62161
62244
|
} else {
|
|
62162
62245
|
correlate(gChild, xgSub);
|
|
@@ -62336,7 +62419,7 @@ function buildEdgesArray(g, ctx) {
|
|
|
62336
62419
|
}
|
|
62337
62420
|
function buildGraphObject(g, top, ctx) {
|
|
62338
62421
|
const o = {};
|
|
62339
|
-
o.name = g
|
|
62422
|
+
o.name = agNameOf(g);
|
|
62340
62423
|
if (top) {
|
|
62341
62424
|
o.directed = g.kind === "directed" || g.kind === "strict-directed";
|
|
62342
62425
|
o.strict = g.kind === "strict-directed" || g.kind === "strict-undirected";
|
|
@@ -62412,11 +62495,16 @@ var Json0Renderer = class extends JsonRendererBase {
|
|
|
62412
62495
|
type = "json0";
|
|
62413
62496
|
beginGraph(_g, _job) {
|
|
62414
62497
|
}
|
|
62415
|
-
/**
|
|
62498
|
+
/**
|
|
62499
|
+
* Attach, then write: C's json_begin_graph runs attach_attrs (which ends by
|
|
62500
|
+
* undoing cluster edges) before json_end_graph writes, and json0 prints what
|
|
62501
|
+
* that stored. Nothing overlays `bb` or an edge's `pos` here, as json's xdot
|
|
62502
|
+
* draw lookup does, so the write-back cannot wait until after the write.
|
|
62503
|
+
* @see plugin/core/gvrender_core_json.c:json_begin_graph
|
|
62504
|
+
*/
|
|
62416
62505
|
endGraph(g, job) {
|
|
62417
|
-
|
|
62506
|
+
attachBeforeWriteWithClusterEdges(g, () => attachAttrs(g))();
|
|
62418
62507
|
job.write(buildJson(g, false));
|
|
62419
|
-
later();
|
|
62420
62508
|
}
|
|
62421
62509
|
};
|
|
62422
62510
|
var JsonRenderer = class extends JsonRendererBase {
|