@knowvah/dot-engine 2.7.1 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js.map +2 -2
- package/dist/common/agerr.d.ts +8 -1
- package/dist/common/agerr.d.ts.map +1 -1
- package/dist/common/fma.d.ts.map +1 -1
- package/dist/common/htmltable-emit-fill.d.ts.map +1 -1
- package/dist/common/htmltable-emit.d.ts +6 -11
- package/dist/common/htmltable-emit.d.ts.map +1 -1
- package/dist/common/htmltable-label.d.ts +3 -0
- package/dist/common/htmltable-label.d.ts.map +1 -1
- package/dist/common/htmltable-lex-attvalue.d.ts.map +1 -1
- package/dist/common/htmltable.d.ts +5 -0
- package/dist/common/htmltable.d.ts.map +1 -1
- package/dist/common/layers.d.ts +12 -0
- package/dist/common/layers.d.ts.map +1 -1
- package/dist/common/layout-state.d.ts +8 -0
- package/dist/common/layout-state.d.ts.map +1 -0
- package/dist/common/make-label.d.ts.map +1 -1
- package/dist/common/multicolor.d.ts +6 -3
- package/dist/common/multicolor.d.ts.map +1 -1
- package/dist/common/nodeinit.d.ts.map +1 -1
- package/dist/common/poly-gencode.d.ts.map +1 -1
- package/dist/common/poly-init.d.ts +21 -0
- package/dist/common/poly-init.d.ts.map +1 -1
- package/dist/common/poly-sizing.d.ts +1 -0
- package/dist/common/poly-sizing.d.ts.map +1 -1
- package/dist/common/postproc.d.ts.map +1 -1
- package/dist/common/style-resolve.d.ts +11 -9
- package/dist/common/style-resolve.d.ts.map +1 -1
- package/dist/gvc/device-cluster.d.ts +5 -6
- package/dist/gvc/device-cluster.d.ts.map +1 -1
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/first-layer.d.ts +21 -5
- package/dist/gvc/first-layer.d.ts.map +1 -1
- package/dist/gvc/gvrender-set-style.d.ts.map +1 -1
- package/dist/gvc/render-usershape.d.ts +60 -0
- package/dist/gvc/render-usershape.d.ts.map +1 -0
- package/dist/gvc/usershape.d.ts +20 -0
- package/dist/gvc/usershape.d.ts.map +1 -1
- package/dist/index.js +8838 -8465
- package/dist/index.js.map +4 -4
- package/dist/layout/circo/index.d.ts.map +1 -1
- package/dist/layout/dot/init.d.ts +10 -0
- package/dist/layout/dot/init.d.ts.map +1 -1
- package/dist/layout/dot/splines.d.ts.map +1 -1
- package/dist/layout/fdp/init.d.ts.map +1 -1
- package/dist/layout/neato/conjgrad-mkernel.d.ts.map +1 -1
- package/dist/layout/neato/constrained-majorization.d.ts.map +1 -1
- package/dist/layout/neato/edge-len.d.ts +6 -2
- package/dist/layout/neato/edge-len.d.ts.map +1 -1
- package/dist/layout/neato/init.d.ts.map +1 -1
- package/dist/layout/neato/kk.d.ts.map +1 -1
- package/dist/layout/neato/make-graph-data.d.ts.map +1 -1
- package/dist/layout/neato/matrix-ops.d.ts +0 -6
- package/dist/layout/neato/matrix-ops.d.ts.map +1 -1
- package/dist/layout/neato/smart-ini-x.d.ts.map +1 -1
- package/dist/layout/neato/splines.d.ts.map +1 -1
- package/dist/layout/neato/start.d.ts.map +1 -1
- package/dist/layout/neato/stress-kernel.d.ts +2 -5
- package/dist/layout/neato/stress-kernel.d.ts.map +1 -1
- package/dist/layout/neato/stress.d.ts +6 -0
- package/dist/layout/neato/stress.d.ts.map +1 -1
- package/dist/layout/osage/index.d.ts.map +1 -1
- package/dist/layout/patchwork/index.d.ts.map +1 -1
- package/dist/layout/sfdp/init.d.ts.map +1 -1
- package/dist/layout/twopi/init.d.ts +12 -6
- package/dist/layout/twopi/init.d.ts.map +1 -1
- package/dist/model/cgraph-ops.d.ts +9 -0
- package/dist/model/cgraph-ops.d.ts.map +1 -1
- package/dist/render/color-resolve.d.ts +7 -0
- package/dist/render/color-resolve.d.ts.map +1 -1
- package/dist/render/dot.d.ts +8 -1
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/json.d.ts +17 -2
- package/dist/render/json.d.ts.map +1 -1
- package/dist/render/map.d.ts +3 -5
- package/dist/render/map.d.ts.map +1 -1
- package/dist/render.js +711 -338
- package/dist/render.js.map +4 -4
- package/package.json +1 -1
- package/src/common/agerr.ts +69 -8
- package/src/common/fma.ts +11 -1
- package/src/common/htmltable-emit-fill.ts +11 -7
- package/src/common/htmltable-emit.ts +11 -46
- package/src/common/htmltable-label.ts +6 -3
- package/src/common/htmltable-lex-attvalue.ts +17 -1
- package/src/common/htmltable.ts +10 -5
- package/src/common/layers.ts +31 -2
- package/src/common/layout-state.ts +35 -0
- package/src/common/make-label.ts +6 -2
- package/src/common/multicolor.ts +12 -6
- package/src/common/nodeinit.ts +4 -1
- package/src/common/poly-gencode.ts +51 -2
- package/src/common/poly-init.ts +34 -13
- package/src/common/poly-sizing.ts +4 -4
- package/src/common/postproc.ts +4 -1
- package/src/common/style-resolve.ts +118 -50
- package/src/gvc/device-cluster.ts +33 -40
- package/src/gvc/device.ts +56 -43
- package/src/gvc/first-layer.ts +60 -11
- package/src/gvc/gvrender-set-style.ts +1 -6
- package/src/gvc/render-usershape.ts +209 -0
- package/src/gvc/usershape.ts +40 -0
- package/src/layout/circo/index.ts +4 -0
- package/src/layout/dot/init.ts +32 -0
- package/src/layout/dot/splines.ts +3 -0
- package/src/layout/fdp/init.ts +17 -0
- package/src/layout/neato/conjgrad-mkernel.ts +2 -3
- package/src/layout/neato/constrained-majorization.ts +2 -1
- package/src/layout/neato/edge-len.ts +39 -7
- package/src/layout/neato/init.ts +8 -3
- package/src/layout/neato/kk.ts +2 -1
- package/src/layout/neato/make-graph-data.ts +1 -2
- package/src/layout/neato/matrix-ops.ts +1 -11
- package/src/layout/neato/smart-ini-x.ts +1 -1
- package/src/layout/neato/splines.ts +3 -1
- package/src/layout/neato/start.ts +3 -2
- package/src/layout/neato/stress-kernel.ts +45 -86
- package/src/layout/neato/stress.ts +19 -0
- package/src/layout/osage/index.ts +8 -1
- package/src/layout/patchwork/index.ts +4 -0
- package/src/layout/sfdp/init.ts +3 -0
- package/src/layout/twopi/init.ts +21 -9
- package/src/layout/twopi/pipeline.ts +3 -3
- package/src/model/cgraph-ops.ts +19 -0
- package/src/render/color-resolve.ts +17 -2
- package/src/render/dot.ts +14 -1
- package/src/render/json.ts +9 -10
- package/src/render/map.ts +5 -6
package/dist/render.js
CHANGED
|
@@ -5105,7 +5105,9 @@ var WHITESPACE = /* @__PURE__ */ new Set([9, 10, 11, 12, 13]);
|
|
|
5105
5105
|
var OCTAL_WIDTH = 3;
|
|
5106
5106
|
var OCTAL_RADIX = 8;
|
|
5107
5107
|
var lastLevel = "warning";
|
|
5108
|
+
var pending = { line: null, channel: "warn" };
|
|
5108
5109
|
registerRenderState(() => {
|
|
5110
|
+
flushPending();
|
|
5109
5111
|
lastLevel = "warning";
|
|
5110
5112
|
});
|
|
5111
5113
|
function escapeControl(message) {
|
|
@@ -5119,17 +5121,43 @@ function escapeControl(message) {
|
|
|
5119
5121
|
return out;
|
|
5120
5122
|
}
|
|
5121
5123
|
function agerrLineOn(channel, line) {
|
|
5124
|
+
flushPending();
|
|
5125
|
+
writeLine(channel, line);
|
|
5126
|
+
}
|
|
5127
|
+
function flushPending() {
|
|
5128
|
+
if (pending.line === null) return;
|
|
5129
|
+
const { line, channel } = pending;
|
|
5130
|
+
pending.line = null;
|
|
5131
|
+
writeLine(channel, line);
|
|
5132
|
+
}
|
|
5133
|
+
function writeLine(channel, line) {
|
|
5122
5134
|
if (channel === "warn") console.warn(escapeControl(line));
|
|
5123
5135
|
else console.error(escapeControl(line));
|
|
5124
5136
|
}
|
|
5125
|
-
function
|
|
5126
|
-
if (level === "prev")
|
|
5127
|
-
agerrLineOn(channel ?? (lastLevel === "warning" ? "warn" : "error"), msg);
|
|
5128
|
-
return;
|
|
5129
|
-
}
|
|
5130
|
-
lastLevel = level;
|
|
5137
|
+
function assemble(level, msg) {
|
|
5138
|
+
if (level === "prev") return msg;
|
|
5131
5139
|
const prefix = level === "error" ? PREFIX_ERROR : PREFIX_WARNING;
|
|
5132
|
-
|
|
5140
|
+
return `${prefix}${PREFIX_SEP}${msg}`;
|
|
5141
|
+
}
|
|
5142
|
+
function channelOf(level) {
|
|
5143
|
+
const eff = level === "prev" ? lastLevel : level;
|
|
5144
|
+
return eff === "warning" ? "warn" : "error";
|
|
5145
|
+
}
|
|
5146
|
+
function emit(level, msg, channel, hold) {
|
|
5147
|
+
const target = channel ?? channelOf(level);
|
|
5148
|
+
if (level !== "prev") lastLevel = level;
|
|
5149
|
+
const text = assemble(level, msg);
|
|
5150
|
+
if (pending.line === null) {
|
|
5151
|
+
pending.channel = target;
|
|
5152
|
+
pending.line = text;
|
|
5153
|
+
} else pending.line += text;
|
|
5154
|
+
if (!hold) flushPending();
|
|
5155
|
+
}
|
|
5156
|
+
function agerr(level, msg, channel) {
|
|
5157
|
+
emit(level, msg, channel, false);
|
|
5158
|
+
}
|
|
5159
|
+
function agerrPartial(level, msg, channel) {
|
|
5160
|
+
emit(level, msg, channel, true);
|
|
5133
5161
|
}
|
|
5134
5162
|
var agerrorf = (msg, channel) => agerr("error", msg, channel);
|
|
5135
5163
|
var agwarningf = (msg, channel) => agerr("warning", msg, channel);
|
|
@@ -5744,8 +5772,8 @@ function checkAttrs(tag, pairs) {
|
|
|
5744
5772
|
return { attrs, warnings, warn };
|
|
5745
5773
|
}
|
|
5746
5774
|
var StderrLines = class {
|
|
5747
|
-
constructor(
|
|
5748
|
-
this.writeLine =
|
|
5775
|
+
constructor(writeLine2) {
|
|
5776
|
+
this.writeLine = writeLine2;
|
|
5749
5777
|
}
|
|
5750
5778
|
writeLine;
|
|
5751
5779
|
pending = "";
|
|
@@ -6099,6 +6127,15 @@ var NAME_CHAR = /[\w.:\u0080-
|
|
|
6099
6127
|
var DEC_DIGIT = /[0-9]/;
|
|
6100
6128
|
var HEX_DIGIT = /[0-9A-Fa-f]/;
|
|
6101
6129
|
var NON_XML = /[\x00-\x08\x0b\x0c\x0e-\x1f]/;
|
|
6130
|
+
var NON_XML_BEYOND_ASCII = /[\ufffe\uffff]/;
|
|
6131
|
+
var HIGH_SURROGATE = /[\ud800-\udbff]/;
|
|
6132
|
+
var LOW_SURROGATE = /[\udc00-\udfff]/;
|
|
6133
|
+
function isNonXmlAt(text, k) {
|
|
6134
|
+
const c = text[k];
|
|
6135
|
+
if (NON_XML.test(c) || NON_XML_BEYOND_ASCII.test(c)) return true;
|
|
6136
|
+
if (HIGH_SURROGATE.test(c)) return !LOW_SURROGATE.test(text[k + 1] ?? "");
|
|
6137
|
+
return LOW_SURROGATE.test(c) && !HIGH_SURROGATE.test(text[k - 1] ?? "");
|
|
6138
|
+
}
|
|
6102
6139
|
function scanDigits(text, i, digit) {
|
|
6103
6140
|
if (i >= text.length) return { partial: true };
|
|
6104
6141
|
if (!digit.test(text[i])) return { invalid: i };
|
|
@@ -6126,7 +6163,7 @@ function scanAttValue(text, j) {
|
|
|
6126
6163
|
const c = text[k];
|
|
6127
6164
|
if (c === void 0) return { partial: true };
|
|
6128
6165
|
if (c === q) return { close: k };
|
|
6129
|
-
if (c === "<" ||
|
|
6166
|
+
if (c === "<" || isNonXmlAt(text, k)) return { invalid: k };
|
|
6130
6167
|
if (c !== "&") {
|
|
6131
6168
|
k++;
|
|
6132
6169
|
continue;
|
|
@@ -7412,6 +7449,26 @@ function imageIsSupplied(name, sizer, resolver) {
|
|
|
7412
7449
|
function imageOpenWarning(name) {
|
|
7413
7450
|
return `${STRERROR_ENOENT} while opening ${name}`;
|
|
7414
7451
|
}
|
|
7452
|
+
var DEFAULT_DPI = 96;
|
|
7453
|
+
var POINTS_PER_INCH = 72;
|
|
7454
|
+
function usershapeDpi(attrs) {
|
|
7455
|
+
const lateDouble2 = (s, dflt) => {
|
|
7456
|
+
if (s === void 0 || s === "") return dflt;
|
|
7457
|
+
const v = Number(s);
|
|
7458
|
+
return Number.isNaN(v) || s.trim() === "" ? dflt : Math.max(v, 0);
|
|
7459
|
+
};
|
|
7460
|
+
const dpi = lateDouble2(attrs.get("dpi"), lateDouble2(attrs.get("resolution"), 0));
|
|
7461
|
+
return dpi >= 1 ? dpi : DEFAULT_DPI;
|
|
7462
|
+
}
|
|
7463
|
+
function usershapeSizePts(name, dpi, sizer) {
|
|
7464
|
+
if (name === void 0 || name === "") return null;
|
|
7465
|
+
const px = sizer !== void 0 ? sizer(name) : findImageSize(name);
|
|
7466
|
+
if (px === null) return null;
|
|
7467
|
+
return {
|
|
7468
|
+
x: Math.trunc(px.w * POINTS_PER_INCH / dpi),
|
|
7469
|
+
y: Math.trunc(px.h * POINTS_PER_INCH / dpi)
|
|
7470
|
+
};
|
|
7471
|
+
}
|
|
7415
7472
|
|
|
7416
7473
|
// src/common/pointset.ts
|
|
7417
7474
|
function cmpPair(a, b) {
|
|
@@ -7706,15 +7763,15 @@ var sizeTextContent = (texts, measurer, env = defaultSizeEnv()) => {
|
|
|
7706
7763
|
return { w, h };
|
|
7707
7764
|
};
|
|
7708
7765
|
var missingImages = { set: /* @__PURE__ */ new WeakSet() };
|
|
7709
|
-
var sizeHtmlImg = (img, { imageSizer, stderr }) => {
|
|
7766
|
+
var sizeHtmlImg = (img, { imageSizer, imageResolver, imageDpi, stderr }) => {
|
|
7710
7767
|
if (img.width !== void 0 && img.height !== void 0) return missingImages.set.has(img) ? 1 : 0;
|
|
7711
|
-
const sz =
|
|
7768
|
+
const sz = usershapeSizePts(img.src, imageDpi ?? DEFAULT_DPI, imageSizer);
|
|
7712
7769
|
if (sz !== null) {
|
|
7713
|
-
img.width = sz.
|
|
7714
|
-
img.height = sz.
|
|
7770
|
+
img.width = sz.x;
|
|
7771
|
+
img.height = sz.y;
|
|
7715
7772
|
return 0;
|
|
7716
7773
|
}
|
|
7717
|
-
if (!imageIsSupplied(img.src, imageSizer)) agerrLine(stderr, `Warning: ${imageOpenWarning(img.src)}`);
|
|
7774
|
+
if (!imageIsSupplied(img.src, imageSizer, imageResolver)) agerrLine(stderr, `Warning: ${imageOpenWarning(img.src)}`);
|
|
7718
7775
|
agerrLine(stderr, `Error: No or improper image file="${img.src}"`);
|
|
7719
7776
|
img.width = 0;
|
|
7720
7777
|
img.height = 0;
|
|
@@ -8201,7 +8258,7 @@ function posHtmlLabel(label, finfo, measurer) {
|
|
|
8201
8258
|
// src/common/htmltable-label.ts
|
|
8202
8259
|
var HTML_PARSE_FATAL = 3;
|
|
8203
8260
|
function makeHtmlLabelTo(content, finfo, measurer, stderr) {
|
|
8204
|
-
const { fontname, fontsize, fontcolor, imageSizer, pencolor } = finfo;
|
|
8261
|
+
const { fontname, fontsize, fontcolor, imageSizer, imageResolver, imageDpi, pencolor } = finfo;
|
|
8205
8262
|
let lbl, lexWarn;
|
|
8206
8263
|
try {
|
|
8207
8264
|
({ label: lbl, warn: lexWarn } = parseHtmlLabelRv(content, stderr));
|
|
@@ -8215,6 +8272,8 @@ function makeHtmlLabelTo(content, finfo, measurer, stderr) {
|
|
|
8215
8272
|
fontsize,
|
|
8216
8273
|
fontname,
|
|
8217
8274
|
imageSizer,
|
|
8275
|
+
imageResolver,
|
|
8276
|
+
imageDpi,
|
|
8218
8277
|
stderr
|
|
8219
8278
|
});
|
|
8220
8279
|
const placed = posHtmlLabel(lbl, { fontname, fontsize, fontcolor }, measurer);
|
|
@@ -8873,9 +8932,12 @@ function makeLabel(text, fontname, fontsize, fontcolor, measurer) {
|
|
|
8873
8932
|
}
|
|
8874
8933
|
function makeAnyLabel(content, isHtml, font, measurer, obj) {
|
|
8875
8934
|
if (isHtml && content !== "") {
|
|
8876
|
-
const
|
|
8935
|
+
const root = obj !== void 0 ? rootOf(obj) : void 0;
|
|
8936
|
+
const imageSizer = root?.info.gvc?.imageSizer;
|
|
8937
|
+
const imageResolver = root?.info.gvc?.imageResolver;
|
|
8938
|
+
const imageDpi = root !== void 0 ? usershapeDpi(root.attrs) : void 0;
|
|
8877
8939
|
const stderr = labelStderr();
|
|
8878
|
-
const { label, rv } = makeHtmlLabelTo(content, { ...font, pencolor: getPenColor(obj), imageSizer }, measurer, stderr);
|
|
8940
|
+
const { label, rv } = makeHtmlLabelTo(content, { ...font, pencolor: getPenColor(obj), imageSizer, imageResolver, imageDpi }, measurer, stderr);
|
|
8879
8941
|
if (rv !== 0 && obj !== void 0) stderr.write(`${inLabelOf(obj)}
|
|
8880
8942
|
`);
|
|
8881
8943
|
stderr.flush();
|
|
@@ -9083,6 +9145,9 @@ function otherEdge(e) {
|
|
|
9083
9145
|
var SPLIT = 134217729;
|
|
9084
9146
|
function fma(a, b, c) {
|
|
9085
9147
|
const p = a * b;
|
|
9148
|
+
if (!Number.isFinite(p) || !Number.isFinite(c)) {
|
|
9149
|
+
return Number.isFinite(a) && Number.isFinite(b) && !Number.isFinite(c) ? c : p + c;
|
|
9150
|
+
}
|
|
9086
9151
|
const at = SPLIT * a;
|
|
9087
9152
|
const ahi = at - (at - a);
|
|
9088
9153
|
const alo = a - ahi;
|
|
@@ -9472,7 +9537,7 @@ function cwrotatepf(p, cwrot) {
|
|
|
9472
9537
|
function boxOverlap(b0, b1) {
|
|
9473
9538
|
return b0.ur.x >= b1.ll.x && b1.ur.x >= b0.ll.x && b0.ur.y >= b1.ll.y && b1.ur.y >= b0.ll.y;
|
|
9474
9539
|
}
|
|
9475
|
-
var
|
|
9540
|
+
var POINTS_PER_INCH2 = 72;
|
|
9476
9541
|
|
|
9477
9542
|
// src/common/arrows-shapes-poly.ts
|
|
9478
9543
|
var CROW_ARROWWIDTH = 0.45;
|
|
@@ -10990,6 +11055,139 @@ function gvrenderTextspan(renderer, pos, span, job) {
|
|
|
10990
11055
|
}
|
|
10991
11056
|
}
|
|
10992
11057
|
|
|
11058
|
+
// src/gvc/render-usershape.ts
|
|
11059
|
+
var ImageScale = {
|
|
11060
|
+
False: "false",
|
|
11061
|
+
True: "true",
|
|
11062
|
+
Width: "width",
|
|
11063
|
+
Height: "height",
|
|
11064
|
+
Both: "both"
|
|
11065
|
+
};
|
|
11066
|
+
var ImagePos = {
|
|
11067
|
+
TopLeft: "tl",
|
|
11068
|
+
TopCenter: "tc",
|
|
11069
|
+
TopRight: "tr",
|
|
11070
|
+
MiddleLeft: "ml",
|
|
11071
|
+
MiddleCenter: "mc",
|
|
11072
|
+
MiddleRight: "mr",
|
|
11073
|
+
BottomLeft: "bl",
|
|
11074
|
+
BottomCenter: "bc",
|
|
11075
|
+
BottomRight: "br"
|
|
11076
|
+
};
|
|
11077
|
+
var IMAGE_POSITIONS = new Set(Object.values(ImagePos));
|
|
11078
|
+
function getImagescale(s) {
|
|
11079
|
+
if (s === "") return ImageScale.False;
|
|
11080
|
+
const l = s.toLowerCase();
|
|
11081
|
+
if (l === "width") return ImageScale.Width;
|
|
11082
|
+
if (l === "height") return ImageScale.Height;
|
|
11083
|
+
if (l === "both") return ImageScale.Both;
|
|
11084
|
+
if (mapbool(s)) return ImageScale.True;
|
|
11085
|
+
return ImageScale.False;
|
|
11086
|
+
}
|
|
11087
|
+
function getImagepos(s) {
|
|
11088
|
+
if (s === "") return ImagePos.MiddleCenter;
|
|
11089
|
+
const l = s.toLowerCase();
|
|
11090
|
+
return IMAGE_POSITIONS.has(l) ? l : ImagePos.MiddleCenter;
|
|
11091
|
+
}
|
|
11092
|
+
function scaleImage(mode, isz, pw, ph) {
|
|
11093
|
+
let iw = isz.w;
|
|
11094
|
+
let ih = isz.h;
|
|
11095
|
+
const scalex = pw / iw;
|
|
11096
|
+
const scaley = ph / ih;
|
|
11097
|
+
switch (mode) {
|
|
11098
|
+
case ImageScale.True:
|
|
11099
|
+
if (scalex < scaley) {
|
|
11100
|
+
iw *= scalex;
|
|
11101
|
+
ih *= scalex;
|
|
11102
|
+
} else {
|
|
11103
|
+
iw *= scaley;
|
|
11104
|
+
ih *= scaley;
|
|
11105
|
+
}
|
|
11106
|
+
break;
|
|
11107
|
+
case ImageScale.Width:
|
|
11108
|
+
iw *= scalex;
|
|
11109
|
+
break;
|
|
11110
|
+
case ImageScale.Height:
|
|
11111
|
+
ih *= scaley;
|
|
11112
|
+
break;
|
|
11113
|
+
case ImageScale.Both:
|
|
11114
|
+
iw *= scalex;
|
|
11115
|
+
ih *= scaley;
|
|
11116
|
+
break;
|
|
11117
|
+
case ImageScale.False:
|
|
11118
|
+
break;
|
|
11119
|
+
}
|
|
11120
|
+
return { iw, ih };
|
|
11121
|
+
}
|
|
11122
|
+
function positionX(b, position2, iw, pw) {
|
|
11123
|
+
if (!(iw < pw)) return;
|
|
11124
|
+
switch (position2) {
|
|
11125
|
+
case ImagePos.TopLeft:
|
|
11126
|
+
case ImagePos.MiddleLeft:
|
|
11127
|
+
case ImagePos.BottomLeft:
|
|
11128
|
+
b.ur.x = b.ll.x + iw;
|
|
11129
|
+
break;
|
|
11130
|
+
case ImagePos.TopRight:
|
|
11131
|
+
case ImagePos.MiddleRight:
|
|
11132
|
+
case ImagePos.BottomRight:
|
|
11133
|
+
b.ll.x += pw - iw;
|
|
11134
|
+
b.ur.x = b.ll.x + iw;
|
|
11135
|
+
break;
|
|
11136
|
+
default:
|
|
11137
|
+
b.ll.x += (pw - iw) / 2;
|
|
11138
|
+
b.ur.x -= (pw - iw) / 2;
|
|
11139
|
+
break;
|
|
11140
|
+
}
|
|
11141
|
+
}
|
|
11142
|
+
function positionY(b, position2, ih, ph) {
|
|
11143
|
+
if (!(ih < ph)) return;
|
|
11144
|
+
switch (position2) {
|
|
11145
|
+
case ImagePos.TopLeft:
|
|
11146
|
+
case ImagePos.TopCenter:
|
|
11147
|
+
case ImagePos.TopRight:
|
|
11148
|
+
b.ll.y = b.ur.y - ih;
|
|
11149
|
+
break;
|
|
11150
|
+
case ImagePos.BottomLeft:
|
|
11151
|
+
case ImagePos.BottomCenter:
|
|
11152
|
+
case ImagePos.BottomRight:
|
|
11153
|
+
b.ll.y += ih;
|
|
11154
|
+
b.ur.y = b.ll.y - ih;
|
|
11155
|
+
break;
|
|
11156
|
+
default:
|
|
11157
|
+
b.ll.y += (ph - ih) / 2;
|
|
11158
|
+
b.ur.y -= (ph - ih) / 2;
|
|
11159
|
+
break;
|
|
11160
|
+
}
|
|
11161
|
+
}
|
|
11162
|
+
function polygonBox(a) {
|
|
11163
|
+
const first = a[0];
|
|
11164
|
+
const b = { ll: { x: first.x, y: first.y }, ur: { x: first.x, y: first.y } };
|
|
11165
|
+
for (let i = 1; i < a.length; i++) {
|
|
11166
|
+
const p = a[i];
|
|
11167
|
+
if (p.x < b.ll.x) b.ll.x = p.x;
|
|
11168
|
+
if (p.x > b.ur.x) b.ur.x = p.x;
|
|
11169
|
+
if (p.y < b.ll.y) b.ll.y = p.y;
|
|
11170
|
+
if (p.y > b.ur.y) b.ur.y = p.y;
|
|
11171
|
+
}
|
|
11172
|
+
return b;
|
|
11173
|
+
}
|
|
11174
|
+
function gvrenderUsershape(job, name, a, _filled, imagescale, imagepos) {
|
|
11175
|
+
const sizer = job.imageSizer;
|
|
11176
|
+
if (!imageIsSupplied(name, sizer, job.imageResolver)) return;
|
|
11177
|
+
const isz = usershapeSizePts(name, job.dpi.x, sizer);
|
|
11178
|
+
if (isz === null || isz.x <= 0 && isz.y <= 0) return;
|
|
11179
|
+
const b = polygonBox(a);
|
|
11180
|
+
const pw = b.ur.x - b.ll.x;
|
|
11181
|
+
const ph = b.ur.y - b.ll.y;
|
|
11182
|
+
const { iw, ih } = scaleImage(getImagescale(imagescale), { w: isz.x, h: isz.y }, pw, ph);
|
|
11183
|
+
const position2 = getImagepos(imagepos);
|
|
11184
|
+
positionX(b, position2, iw, pw);
|
|
11185
|
+
positionY(b, position2, ih, ph);
|
|
11186
|
+
if (b.ll.x > b.ur.x) [b.ll.x, b.ur.x] = [b.ur.x, b.ll.x];
|
|
11187
|
+
if (b.ll.y > b.ur.y) [b.ll.y, b.ur.y] = [b.ur.y, b.ll.y];
|
|
11188
|
+
job.renderer?.usershape?.(name, b, job);
|
|
11189
|
+
}
|
|
11190
|
+
|
|
10993
11191
|
// src/common/poly-shapes-util.ts
|
|
10994
11192
|
var RBCONST = 12;
|
|
10995
11193
|
var RBCURVE = 0.5;
|
|
@@ -11707,38 +11905,12 @@ function emitCellDecoration(cell2, pos, renderer, job) {
|
|
|
11707
11905
|
emitBorder({ box: cell2.box, pos, border: cell2.border, color: cell2.color, sides: cell2.sides, style: cell2.style }, renderer, job);
|
|
11708
11906
|
}
|
|
11709
11907
|
}
|
|
11710
|
-
function
|
|
11711
|
-
const
|
|
11712
|
-
const
|
|
11713
|
-
const
|
|
11714
|
-
if (mode === "width") return { iw: d.iw * sx, ih: d.ih };
|
|
11715
|
-
if (mode === "height") return { iw: d.iw, ih: d.ih * sy };
|
|
11716
|
-
if (mode === "both") return { iw: d.iw * sx, ih: d.ih * sy };
|
|
11717
|
-
if (mode === "true" || mode === "yes" || mode === "1") {
|
|
11718
|
-
const f = Math.min(sx, sy);
|
|
11719
|
-
return { iw: d.iw * f, ih: d.ih * f };
|
|
11720
|
-
}
|
|
11721
|
-
return { iw: d.iw, ih: d.ih };
|
|
11722
|
-
}
|
|
11723
|
-
function emitHtmlImg(img, pos, renderer, job) {
|
|
11724
|
-
if (img.iw <= 0 && img.ih <= 0) return;
|
|
11725
|
-
const b = {
|
|
11726
|
-
ll: { x: img.box.ll.x + pos.x, y: img.box.ll.y + pos.y },
|
|
11727
|
-
ur: { x: img.box.ur.x + pos.x, y: img.box.ur.y + pos.y }
|
|
11728
|
-
};
|
|
11729
|
-
const pw = b.ur.x - b.ll.x;
|
|
11730
|
-
const ph = b.ur.y - b.ll.y;
|
|
11908
|
+
function emitHtmlImg(img, pos, _renderer, job) {
|
|
11909
|
+
const ll = { x: img.box.ll.x + pos.x, y: img.box.ll.y + pos.y };
|
|
11910
|
+
const ur = { x: img.box.ur.x + pos.x, y: img.box.ur.y + pos.y };
|
|
11911
|
+
const a = [ur, { x: ll.x, y: ur.y }, ll, { x: ur.x, y: ll.y }];
|
|
11731
11912
|
const scale = img.scale !== void 0 ? img.scale : htmlObjImgscale();
|
|
11732
|
-
|
|
11733
|
-
if (iw < pw) {
|
|
11734
|
-
b.ll.x += (pw - iw) / 2;
|
|
11735
|
-
b.ur.x -= (pw - iw) / 2;
|
|
11736
|
-
}
|
|
11737
|
-
if (ih < ph) {
|
|
11738
|
-
b.ll.y += (ph - ih) / 2;
|
|
11739
|
-
b.ur.y -= (ph - ih) / 2;
|
|
11740
|
-
}
|
|
11741
|
-
renderer.usershape?.(img.src, b, job);
|
|
11913
|
+
gvrenderUsershape(job, img.src, a, true, scale, "mc");
|
|
11742
11914
|
}
|
|
11743
11915
|
function emitHtmlCell(cell2, pos, renderer, job) {
|
|
11744
11916
|
const inAnchor = initHtmlAnchor(
|
|
@@ -12009,7 +12181,7 @@ var XPAD = 4 * GAP;
|
|
|
12009
12181
|
var YPAD = 2 * GAP;
|
|
12010
12182
|
var SQRT2 = 1.4142135623730951;
|
|
12011
12183
|
var INCH2PS = 72;
|
|
12012
|
-
function
|
|
12184
|
+
function mapbool2(s) {
|
|
12013
12185
|
if (!s || s.toLowerCase() === "false" || s.toLowerCase() === "no") return false;
|
|
12014
12186
|
if (s.toLowerCase() === "true" || s.toLowerCase() === "yes") return true;
|
|
12015
12187
|
const n = parseInt(s, 10);
|
|
@@ -12233,7 +12405,7 @@ function applySizeConstraints(p, bb0, width0, height0) {
|
|
|
12233
12405
|
let c;
|
|
12234
12406
|
if (p.fixedsize === "shape") {
|
|
12235
12407
|
c = { bb: { x: width0, y: height0 }, width: width0, height: height0, fixedshape: true };
|
|
12236
|
-
} else if (
|
|
12408
|
+
} else if (mapbool2(p.fixedsize)) {
|
|
12237
12409
|
c = { bb: { x: width0, y: height0 }, width: width0, height: height0, fixedshape: false };
|
|
12238
12410
|
} else {
|
|
12239
12411
|
const bb = { x: Math.max(width0, bb0.x), y: Math.max(height0, bb0.y) };
|
|
@@ -12249,7 +12421,8 @@ function polySize(p) {
|
|
|
12249
12421
|
const init = initialSizePts(p);
|
|
12250
12422
|
const dimen = quantize(padLabelDimen(p.labelDimen, p.margin, p.isPlain), p.quantumIn);
|
|
12251
12423
|
const { sides: sides2, isBox: isBox4 } = effectiveShape(p);
|
|
12252
|
-
|
|
12424
|
+
const img = p.imageSize ?? { x: 0, y: 0 };
|
|
12425
|
+
let bb = { x: Math.max(dimen.x, img.x), y: Math.max(dimen.y, img.y) };
|
|
12253
12426
|
if (isBox4) {
|
|
12254
12427
|
} else if (p.optionShape === STAR) {
|
|
12255
12428
|
bb = starSize(bb);
|
|
@@ -12278,7 +12451,7 @@ function labelSpace(p, dimen, bb, minBb, isBox4, fixedshape) {
|
|
|
12278
12451
|
} else {
|
|
12279
12452
|
spaceX = dimen.x - spacex;
|
|
12280
12453
|
}
|
|
12281
|
-
const spaceY = fixedshape ? dimen.y : dimen.y + (bb.y - minBb.y);
|
|
12454
|
+
const spaceY = fixedshape ? dimen.y : dimen.y + (bb.y - minBb.y + Math.max(0, (p.imageSize?.y ?? 0) - dimen.y));
|
|
12282
12455
|
return { space: { x: spaceX, y: spaceY }, valign: labelValign(p) };
|
|
12283
12456
|
}
|
|
12284
12457
|
function effectiveShape(p) {
|
|
@@ -12587,7 +12760,7 @@ function posReclbl(f, ul, sides2) {
|
|
|
12587
12760
|
}
|
|
12588
12761
|
}
|
|
12589
12762
|
function attrBool(n, g, key) {
|
|
12590
|
-
return
|
|
12763
|
+
return mapbool(nodeAttr(n, g, key));
|
|
12591
12764
|
}
|
|
12592
12765
|
function recAttrSize(n, g) {
|
|
12593
12766
|
const w = nodeAttr(n, g, "width");
|
|
@@ -12721,8 +12894,15 @@ function buildNodeLabel(n, g, measurer) {
|
|
|
12721
12894
|
const content = isHtml ? htmlValueContent(labelAttr) : labelAttr ?? n.name;
|
|
12722
12895
|
n.info.label = makeAnyLabel(content, isHtml, font, measurer, n);
|
|
12723
12896
|
}
|
|
12724
|
-
function
|
|
12725
|
-
|
|
12897
|
+
function warnPolyInitImages(n, g) {
|
|
12898
|
+
const shapefile = nodeAttr(n, g, "shapefile");
|
|
12899
|
+
if (shapefile !== void 0 && shapefile !== "") {
|
|
12900
|
+
if (nodeAttr(n, g, "shape") !== "epsf") {
|
|
12901
|
+
agwarningf(imageOpenWarning(shapefile));
|
|
12902
|
+
agwarningf(`No or improper shapefile="${shapefile}" for node "${n.name}"`);
|
|
12903
|
+
return;
|
|
12904
|
+
}
|
|
12905
|
+
}
|
|
12726
12906
|
const image = nodeAttr(n, g, "image");
|
|
12727
12907
|
if (image === void 0 || image === "") return;
|
|
12728
12908
|
const gvc = g.root.info.gvc;
|
|
@@ -12730,18 +12910,23 @@ function warnMissingImage(n, g, shapefile) {
|
|
|
12730
12910
|
agwarningf(imageOpenWarning(image));
|
|
12731
12911
|
agwarningf(`No or improper image="${image}" for node "${n.name}"`);
|
|
12732
12912
|
}
|
|
12913
|
+
function nodeImageSize(n, g) {
|
|
12914
|
+
const shapefile = nodeAttr(n, g, "shapefile");
|
|
12915
|
+
if (shapefile !== void 0 && shapefile !== "") return void 0;
|
|
12916
|
+
const gvc = g.root.info.gvc;
|
|
12917
|
+
const sz = usershapeSizePts(nodeAttr(n, g, "image"), usershapeDpi(g.root.attrs), gvc?.imageSizer);
|
|
12918
|
+
if (sz === null) return void 0;
|
|
12919
|
+
g.root.info.has_images = true;
|
|
12920
|
+
return { x: sz.x + 2, y: sz.y + 2 };
|
|
12921
|
+
}
|
|
12733
12922
|
function polyInit(n, g, measurer) {
|
|
12734
12923
|
const shapeName2 = nodeAttr(n, g, "shape") ?? "ellipse";
|
|
12735
12924
|
const shapefile = nodeAttr(n, g, "shapefile");
|
|
12736
12925
|
n.info.shape = bindShape(shapeName2, shapefile);
|
|
12737
|
-
if (shapefile !== void 0 && shapefile !== "" && shapeName2 !== "epsf") {
|
|
12738
|
-
agwarningf(`No or improper shapefile="${shapefile}" for node "${n.name}"`);
|
|
12739
|
-
}
|
|
12740
12926
|
if (n.info.shape.kind === 2 /* SH_RECORD */) {
|
|
12741
12927
|
if (n.info.shape_info === void 0) recordNodeInit(n, g, measurer);
|
|
12742
12928
|
return;
|
|
12743
12929
|
}
|
|
12744
|
-
warnMissingImage(n, g, shapefile);
|
|
12745
12930
|
buildNodeLabel(n, g, measurer);
|
|
12746
12931
|
if (n.info.shape_info !== void 0) return;
|
|
12747
12932
|
const polyDesc = n.info.shape.polygon;
|
|
@@ -12759,6 +12944,7 @@ function claimWarned() {
|
|
|
12759
12944
|
return true;
|
|
12760
12945
|
}
|
|
12761
12946
|
var claimNever = () => false;
|
|
12947
|
+
var MSG_MANY_COLORS = "More than 2 colors specified for a gradient - ignoring remaining";
|
|
12762
12948
|
var EPS = 1e-5;
|
|
12763
12949
|
function aeq0(x) {
|
|
12764
12950
|
return x < EPS && x > -EPS;
|
|
@@ -12824,8 +13010,8 @@ function scanSegs(colorlist, claim) {
|
|
|
12824
13010
|
function parseSegs(colorlist, context) {
|
|
12825
13011
|
const result = scanSegs(colorlist, claimWarned);
|
|
12826
13012
|
if (result.error === 3) {
|
|
12827
|
-
|
|
12828
|
-
|
|
13013
|
+
agerrPartial("warning", `Total size > 1 in "${colorlist}" color spec `);
|
|
13014
|
+
if (context !== void 0) agerr("prev", context());
|
|
12829
13015
|
} else if (result.error === 2) {
|
|
12830
13016
|
agerrorf(`Illegal value in "${colorlist}" color attribute; float expected after ';'`);
|
|
12831
13017
|
if (context !== void 0) agerr("prev", context());
|
|
@@ -12859,10 +13045,6 @@ var BOX_ORIENTATION_TOLERANCE = 0.5;
|
|
|
12859
13045
|
var BOX_ORIENTATION_STEP = 90;
|
|
12860
13046
|
var BOX_SIDES = 4;
|
|
12861
13047
|
var ELLIPSE_MAX_SIDES = 2;
|
|
12862
|
-
function styleName(token) {
|
|
12863
|
-
const paren = token.indexOf("(");
|
|
12864
|
-
return paren < 0 ? token : token.slice(0, paren);
|
|
12865
|
-
}
|
|
12866
13048
|
function gvrenderSetStyle(styles) {
|
|
12867
13049
|
if (styles === null) return;
|
|
12868
13050
|
for (const token of styles) {
|
|
@@ -15823,6 +16005,13 @@ function firstColor(name) {
|
|
|
15823
16005
|
}
|
|
15824
16006
|
function resolveRenderColor(raw, report = true) {
|
|
15825
16007
|
if (raw === "" || raw === "none") return { type: "none" };
|
|
16008
|
+
return resolveColorName(raw, report);
|
|
16009
|
+
}
|
|
16010
|
+
function resolveFillColorName(raw, report = true) {
|
|
16011
|
+
if (raw === "none") return { type: "none" };
|
|
16012
|
+
return resolveColorName(raw, report);
|
|
16013
|
+
}
|
|
16014
|
+
function resolveColorName(raw, report) {
|
|
15826
16015
|
const known = KNOWN_COLORS.has(raw.toLowerCase());
|
|
15827
16016
|
if (known && (rendererColors.hasKnownList || !report)) return { type: "string", s: raw };
|
|
15828
16017
|
const color = { type: "rgba", r: 0, g: 0, b: 0, a: 0 };
|
|
@@ -15936,7 +16125,7 @@ function reportEdgeColors(e) {
|
|
|
15936
16125
|
reportColorNames(edgeGraphicsColors({
|
|
15937
16126
|
color,
|
|
15938
16127
|
fillcolor: e.attrs.get("fillcolor") ?? "",
|
|
15939
|
-
tapered:
|
|
16128
|
+
tapered: styleTokensQuiet(e.attrs.get("style")).includes("tapered"),
|
|
15940
16129
|
arrows: spl.list.map((bz) => ({ sflag: bz.sflag !== 0, eflag: bz.eflag !== 0 }))
|
|
15941
16130
|
}));
|
|
15942
16131
|
}
|
|
@@ -16291,11 +16480,7 @@ function applyClusterGradient(obj, fill) {
|
|
|
16291
16480
|
obj.gradientAngle = fill.angle;
|
|
16292
16481
|
}
|
|
16293
16482
|
function clusterAttr(sg, key) {
|
|
16294
|
-
|
|
16295
|
-
const v = g.attrs.get(key);
|
|
16296
|
-
if (v !== void 0) return v;
|
|
16297
|
-
}
|
|
16298
|
-
return void 0;
|
|
16483
|
+
return graphAttrInherited(sg, key);
|
|
16299
16484
|
}
|
|
16300
16485
|
function clusterStyle(sg) {
|
|
16301
16486
|
return clusterAttr(sg, "style");
|
|
@@ -16330,12 +16515,10 @@ function applyClusterObjState(sg, job) {
|
|
|
16330
16515
|
if (job.obj === null) return false;
|
|
16331
16516
|
const obj = job.obj;
|
|
16332
16517
|
gvrenderSetStyle(checkClusterStyleTokens(styleTokens2(clusterStyle(sg))));
|
|
16333
|
-
|
|
16334
|
-
|
|
16335
|
-
|
|
16336
|
-
|
|
16337
|
-
return filled;
|
|
16338
|
-
});
|
|
16518
|
+
const filled = applyClusterFill(obj, fillRes);
|
|
16519
|
+
applyClusterPenState(obj, sg);
|
|
16520
|
+
reportColorNames(stripedClusterColors(sg));
|
|
16521
|
+
return filled;
|
|
16339
16522
|
}
|
|
16340
16523
|
function isStripedCluster(sg) {
|
|
16341
16524
|
const flags = parseStyleFlags(clusterStyle(sg));
|
|
@@ -16356,27 +16539,25 @@ function stripedClusterColors(sg) {
|
|
|
16356
16539
|
return segs.flatMap((seg2) => seg2.color !== null && seg2.t > 0 ? [seg2.color] : []);
|
|
16357
16540
|
}
|
|
16358
16541
|
function renderStripedClusterBox(sg, renderer, job) {
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
|
|
16372
|
-
|
|
16373
|
-
|
|
16374
|
-
|
|
16375
|
-
|
|
16376
|
-
|
|
16377
|
-
|
|
16378
|
-
renderer.polygon(rawPts.map((p) => transformPoint(p, job)), false, job);
|
|
16379
|
-
});
|
|
16542
|
+
const { ll, ur } = sg.info.bb;
|
|
16543
|
+
const af = [
|
|
16544
|
+
{ x: ll.x, y: ll.y },
|
|
16545
|
+
{ x: ur.x, y: ll.y },
|
|
16546
|
+
{ x: ur.x, y: ur.y },
|
|
16547
|
+
{ x: ll.x, y: ur.y }
|
|
16548
|
+
].map((p) => transformPoint(p, job));
|
|
16549
|
+
const obj = job.obj;
|
|
16550
|
+
const savedFill = obj?.fill;
|
|
16551
|
+
if (obj !== null && savedFill !== void 0) obj.fill = 1 /* Solid */;
|
|
16552
|
+
stripedBox(job, af, stripedFillSpec(sg), false, renderer, () => `in cluster ${sg.name}`);
|
|
16553
|
+
if (obj !== null && savedFill !== void 0) obj.fill = savedFill;
|
|
16554
|
+
const rawPts = [
|
|
16555
|
+
{ x: ll.x, y: ll.y },
|
|
16556
|
+
{ x: ll.x, y: ur.y },
|
|
16557
|
+
{ x: ur.x, y: ur.y },
|
|
16558
|
+
{ x: ur.x, y: ll.y }
|
|
16559
|
+
];
|
|
16560
|
+
renderer.polygon(rawPts.map((p) => transformPoint(p, job)), false, job);
|
|
16380
16561
|
}
|
|
16381
16562
|
function applyClusterFill(obj, fillRes) {
|
|
16382
16563
|
if (fillRes.kind === "none") {
|
|
@@ -16385,7 +16566,7 @@ function applyClusterFill(obj, fillRes) {
|
|
|
16385
16566
|
}
|
|
16386
16567
|
if (fillRes.kind === "solid") {
|
|
16387
16568
|
obj.fill = 1 /* Solid */;
|
|
16388
|
-
obj.fillColor =
|
|
16569
|
+
obj.fillColor = resolveFillColorName(fillRes.color);
|
|
16389
16570
|
return true;
|
|
16390
16571
|
}
|
|
16391
16572
|
applyClusterGradient(obj, fillRes);
|
|
@@ -16476,6 +16657,32 @@ function renderPeripheries(poly, coord, filled, ctx) {
|
|
|
16476
16657
|
}
|
|
16477
16658
|
}
|
|
16478
16659
|
}
|
|
16660
|
+
var CUSTOM_SHAPE_NAME = "custom";
|
|
16661
|
+
function usershapeName(n) {
|
|
16662
|
+
const shape = n.info.shape;
|
|
16663
|
+
if (shape?.usershape === true) {
|
|
16664
|
+
if (shape.name !== CUSTOM_SHAPE_NAME) return shape.name;
|
|
16665
|
+
const shapefile = nodeAttr(n, n.root, "shapefile");
|
|
16666
|
+
return shapefile !== void 0 && shapefile !== "" ? shapefile : void 0;
|
|
16667
|
+
}
|
|
16668
|
+
const image = nodeAttr(n, n.root, "image");
|
|
16669
|
+
return image !== void 0 && image !== "" ? image : void 0;
|
|
16670
|
+
}
|
|
16671
|
+
function renderUsershape(n, d) {
|
|
16672
|
+
const name = usershapeName(n);
|
|
16673
|
+
if (name === void 0) return;
|
|
16674
|
+
const { poly, coord } = d;
|
|
16675
|
+
const sides2 = poly.sides <= 2 ? 2 : poly.sides;
|
|
16676
|
+
const af = poly.vertices.slice(0, sides2).map((v) => ({ x: v.x + coord.x, y: v.y + coord.y }));
|
|
16677
|
+
gvrenderUsershape(
|
|
16678
|
+
d.ringCtx.job,
|
|
16679
|
+
name,
|
|
16680
|
+
af,
|
|
16681
|
+
poly.peripheries === 0 && d.filled,
|
|
16682
|
+
nodeAttr(n, n.root, "imagescale") ?? "false",
|
|
16683
|
+
nodeAttr(n, n.root, "imagepos") ?? "mc"
|
|
16684
|
+
);
|
|
16685
|
+
}
|
|
16479
16686
|
function renderLabel(label, coord, renderer, job) {
|
|
16480
16687
|
if (label.u.kind !== "txt" || label.u.nspans < 1) return;
|
|
16481
16688
|
reportColorNames([label.fontcolor]);
|
|
@@ -16562,7 +16769,7 @@ function applyFillState(obj, n, job) {
|
|
|
16562
16769
|
}
|
|
16563
16770
|
if (fillRes.kind === "solid") {
|
|
16564
16771
|
obj.fill = 1 /* Solid */;
|
|
16565
|
-
obj.fillColor =
|
|
16772
|
+
obj.fillColor = resolveFillColorName(fillRes.color);
|
|
16566
16773
|
return true;
|
|
16567
16774
|
}
|
|
16568
16775
|
applyGradientFields(obj, fillRes);
|
|
@@ -16648,6 +16855,7 @@ function polyGencode(rawJob, rawNode) {
|
|
|
16648
16855
|
const savedPts = job.obj?.urlMapPts;
|
|
16649
16856
|
let inAnchor = clustersLast ? false : beginNodeAnchor(n, renderer, job);
|
|
16650
16857
|
renderPeripheries(ctx.poly, ctx.coord, ctx.filled, ctx.ringCtx);
|
|
16858
|
+
if (!isPointNode(n)) renderUsershape(n, ctx);
|
|
16651
16859
|
if (!isPointNode(n)) renderNodeLabel(n, ctx.coord, renderer, job);
|
|
16652
16860
|
if (clustersLast) {
|
|
16653
16861
|
if (job.obj && savedPts !== void 0 && savedShape !== void 0) {
|
|
@@ -17344,6 +17552,10 @@ function ncross(ctx) {
|
|
|
17344
17552
|
|
|
17345
17553
|
// src/model/cgraph-ops.ts
|
|
17346
17554
|
var LOCALNAMEPREFIX = "%";
|
|
17555
|
+
var ANONYMOUS_ROOT_ID = 1;
|
|
17556
|
+
function agNameOf(g) {
|
|
17557
|
+
return g.anonymous ? `${LOCALNAMEPREFIX}${ANONYMOUS_ROOT_ID}` : g.name;
|
|
17558
|
+
}
|
|
17347
17559
|
function freshNodeId(root) {
|
|
17348
17560
|
let max = -1;
|
|
17349
17561
|
for (const n of root.nodes.values()) {
|
|
@@ -18552,7 +18764,7 @@ var CHAR_UTF8 = 0;
|
|
|
18552
18764
|
var CHAR_LATIN1 = 1;
|
|
18553
18765
|
var CHAR_BIG5 = 2;
|
|
18554
18766
|
function points(inches) {
|
|
18555
|
-
return cround(inches *
|
|
18767
|
+
return cround(inches * POINTS_PER_INCH2);
|
|
18556
18768
|
}
|
|
18557
18769
|
function findCharset(g) {
|
|
18558
18770
|
const raw = g.attrs.get("charset");
|
|
@@ -18649,7 +18861,7 @@ function graphInit(g, useRankdir) {
|
|
|
18649
18861
|
if (fn !== -1) g.info.fontnames = fn;
|
|
18650
18862
|
parseRatioDrawing(g);
|
|
18651
18863
|
setClType(maptoken(g.attrs.get("clusterrank"), RANK_NAMES, rankCodes()));
|
|
18652
|
-
g.info.concentrate =
|
|
18864
|
+
g.info.concentrate = mapbool(g.attrs.get("concentrate"));
|
|
18653
18865
|
g.info.edgeLabelsDone = false;
|
|
18654
18866
|
doGraphLabel(g, layoutMeasurer(g));
|
|
18655
18867
|
}
|
|
@@ -18691,7 +18903,7 @@ function sameNonemptyGroup(e) {
|
|
|
18691
18903
|
}
|
|
18692
18904
|
function initEdgeConstraint(e) {
|
|
18693
18905
|
const s = e.attrs.get("constraint");
|
|
18694
|
-
if (s !== void 0 && s !== "") e.info.constraint =
|
|
18906
|
+
if (s !== void 0 && s !== "") e.info.constraint = mapbool(s);
|
|
18695
18907
|
}
|
|
18696
18908
|
function applyGroupPenalty(e) {
|
|
18697
18909
|
if (!sameNonemptyGroup(e)) return;
|
|
@@ -18747,7 +18959,24 @@ function removeFill(g) {
|
|
|
18747
18959
|
}
|
|
18748
18960
|
agdelsubg(g.root, sg);
|
|
18749
18961
|
}
|
|
18962
|
+
function gvCleanupEdgeLabels(e) {
|
|
18963
|
+
e.info.label = void 0;
|
|
18964
|
+
e.info.xlabel = void 0;
|
|
18965
|
+
e.info.head_label = void 0;
|
|
18966
|
+
e.info.tail_label = void 0;
|
|
18967
|
+
}
|
|
18968
|
+
function gvCleanupNodeLabels(n) {
|
|
18969
|
+
n.info.label = void 0;
|
|
18970
|
+
n.info.xlabel = void 0;
|
|
18971
|
+
}
|
|
18972
|
+
function dotCleanupGraph(g) {
|
|
18973
|
+
for (const subg of g.subgraphs.values()) dotCleanupGraph(subg);
|
|
18974
|
+
if (g !== g.root) g.info.label = void 0;
|
|
18975
|
+
}
|
|
18750
18976
|
function dotCleanup(g) {
|
|
18977
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
18978
|
+
for (const n2 of g.nodes.values()) gvCleanupNodeLabels(n2);
|
|
18979
|
+
dotCleanupGraph(g);
|
|
18751
18980
|
let n = g.info.nlist;
|
|
18752
18981
|
while (n !== void 0) {
|
|
18753
18982
|
const next = n.info.next;
|
|
@@ -19225,7 +19454,7 @@ var DEFAULT_NODEWIDTH = 0.75;
|
|
|
19225
19454
|
var MIN_NODEWIDTH = 0.01;
|
|
19226
19455
|
var DEFAULT_NODEHEIGHT = 0.5;
|
|
19227
19456
|
var MIN_NODEHEIGHT = 0.02;
|
|
19228
|
-
var
|
|
19457
|
+
var POINTS_PER_INCH3 = 72;
|
|
19229
19458
|
var DEF_POINT = 0.05;
|
|
19230
19459
|
var MIN_POINT = 3e-4;
|
|
19231
19460
|
var DEFAULT_NODEPENWIDTH2 = 1;
|
|
@@ -19293,6 +19522,8 @@ function polySizeParamsFromNode(n, g, shape, labelDimen, flip) {
|
|
|
19293
19522
|
// size_gen discriminant (STAR/CYLINDER)
|
|
19294
19523
|
nojustify: mapbool4(nodeAttr(n, g, "nojustify")),
|
|
19295
19524
|
// shapes.c:2133
|
|
19525
|
+
imageSize: nodeImageSize(n, g),
|
|
19526
|
+
// shapes.c:2039-2051
|
|
19296
19527
|
flip
|
|
19297
19528
|
};
|
|
19298
19529
|
}
|
|
@@ -19329,7 +19560,7 @@ function initPointSize(n, g, shape) {
|
|
|
19329
19560
|
const flip = g.root.info.flip === true;
|
|
19330
19561
|
const peripheries = lateInt(nodeAttr(n, g, "peripheries"), shape.polygon.peripheries, 0);
|
|
19331
19562
|
const penwidth = lateDouble(nodeAttr(n, g, "penwidth"), DEFAULT_NODEPENWIDTH2, MIN_NODEPENWIDTH);
|
|
19332
|
-
const sz0 = pointWidthInches(n, g) *
|
|
19563
|
+
const sz0 = pointWidthInches(n, g) * POINTS_PER_INCH3;
|
|
19333
19564
|
storeNodeSize(n, pointSizeResult(sz0, peripheries, penwidth), flip);
|
|
19334
19565
|
assignShapeInfo(n, { ...shape.polygon, peripheries, sides: 2, penwidth, vertices: null });
|
|
19335
19566
|
}
|
|
@@ -19344,6 +19575,7 @@ function initNodeFromLabel(n, g, measurer) {
|
|
|
19344
19575
|
}
|
|
19345
19576
|
buildNodeLabel(n, g, measurer);
|
|
19346
19577
|
initNodeXLabel(n, g, measurer);
|
|
19578
|
+
if (shape.kind !== 3 /* SH_POINT */) warnPolyInitImages(n, g);
|
|
19347
19579
|
const poly = shape.polygon;
|
|
19348
19580
|
if (poly === null) return false;
|
|
19349
19581
|
if (shape.kind === 3 /* SH_POINT */) {
|
|
@@ -19386,8 +19618,8 @@ function storeNodeSize(n, unflipped, flip) {
|
|
|
19386
19618
|
n.info.base_width = unflipped.baseW / 72;
|
|
19387
19619
|
n.info.base_height = unflipped.baseH / 72;
|
|
19388
19620
|
const size = gvNodesize(
|
|
19389
|
-
n.info.width *
|
|
19390
|
-
n.info.height *
|
|
19621
|
+
n.info.width * POINTS_PER_INCH3,
|
|
19622
|
+
n.info.height * POINTS_PER_INCH3,
|
|
19391
19623
|
flip
|
|
19392
19624
|
);
|
|
19393
19625
|
n.info.lw = size.lw;
|
|
@@ -20564,7 +20796,7 @@ var SIZE_X_RE2 = new RegExp(`^\\s*(${FLOAT})(.?)`);
|
|
|
20564
20796
|
var PAD_XY_RE = new RegExp(`^\\s*(${FLOAT})\\s*,\\s*(${FLOAT})`);
|
|
20565
20797
|
var PAD_X_RE = new RegExp(`^\\s*(${FLOAT})`);
|
|
20566
20798
|
function toPoints(inches) {
|
|
20567
|
-
return cround(inches *
|
|
20799
|
+
return cround(inches * POINTS_PER_INCH2);
|
|
20568
20800
|
}
|
|
20569
20801
|
function parseDrawingSize(raw) {
|
|
20570
20802
|
if (raw === void 0) return null;
|
|
@@ -20585,11 +20817,11 @@ function parseGraphPad(raw) {
|
|
|
20585
20817
|
if (raw !== void 0) {
|
|
20586
20818
|
const xy = PAD_XY_RE.exec(raw);
|
|
20587
20819
|
if (xy) {
|
|
20588
|
-
return { x: Number(xy[1]) *
|
|
20820
|
+
return { x: Number(xy[1]) * POINTS_PER_INCH2, y: Number(xy[2]) * POINTS_PER_INCH2 };
|
|
20589
20821
|
}
|
|
20590
20822
|
const x = PAD_X_RE.exec(raw);
|
|
20591
20823
|
if (x) {
|
|
20592
|
-
const v = Number(x[1]) *
|
|
20824
|
+
const v = Number(x[1]) * POINTS_PER_INCH2;
|
|
20593
20825
|
return { x: v, y: v };
|
|
20594
20826
|
}
|
|
20595
20827
|
}
|
|
@@ -20599,11 +20831,11 @@ function parseGraphMargin(raw) {
|
|
|
20599
20831
|
if (raw !== void 0) {
|
|
20600
20832
|
const xy = PAD_XY_RE.exec(raw);
|
|
20601
20833
|
if (xy) {
|
|
20602
|
-
return { x: Number(xy[1]) *
|
|
20834
|
+
return { x: Number(xy[1]) * POINTS_PER_INCH2, y: Number(xy[2]) * POINTS_PER_INCH2 };
|
|
20603
20835
|
}
|
|
20604
20836
|
const x = PAD_X_RE.exec(raw);
|
|
20605
20837
|
if (x) {
|
|
20606
|
-
const v = Number(x[1]) *
|
|
20838
|
+
const v = Number(x[1]) * POINTS_PER_INCH2;
|
|
20607
20839
|
return { x: v, y: v };
|
|
20608
20840
|
}
|
|
20609
20841
|
}
|
|
@@ -20969,10 +21201,13 @@ function parseLayers(g) {
|
|
|
20969
21201
|
let listSep = g.attrs.get("layerlistsep") || DEFAULT_LAYERLISTSEP;
|
|
20970
21202
|
if ([...sep].some((c) => listSep.includes(c))) listSep = "";
|
|
20971
21203
|
if (p === void 0 || p === "") {
|
|
20972
|
-
return { layerIDs: [], numLayers: 1, sep, listSep };
|
|
21204
|
+
return { layerIDs: [], numLayers: 1, sep, listSep, layerList: null };
|
|
20973
21205
|
}
|
|
20974
21206
|
const toks = splitOnSet(p, sep);
|
|
20975
|
-
|
|
21207
|
+
const info = { layerIDs: [null, ...toks], numLayers: toks.length, sep, listSep, layerList: null };
|
|
21208
|
+
const sel = g.attrs.get("layerselect");
|
|
21209
|
+
if (sel !== void 0 && sel !== "") info.layerList = parseLayerselect(info, sel);
|
|
21210
|
+
return info;
|
|
20976
21211
|
}
|
|
20977
21212
|
function isNaturalNumber(s) {
|
|
20978
21213
|
return /^[0-9]+$/.test(s);
|
|
@@ -21028,6 +21263,19 @@ function edgeInLayer(info, layerNum, e) {
|
|
|
21028
21263
|
return pn === "" || selectedLayer(info, layerNum, pn);
|
|
21029
21264
|
});
|
|
21030
21265
|
}
|
|
21266
|
+
function parseLayerselect(info, p) {
|
|
21267
|
+
const picked = [];
|
|
21268
|
+
for (let i = 1; i <= info.numLayers; i++) {
|
|
21269
|
+
if (selectedLayer(info, i, p)) picked.push(i);
|
|
21270
|
+
}
|
|
21271
|
+
if (picked.length === 0) {
|
|
21272
|
+
agwarningf(
|
|
21273
|
+
`The layerselect attribute "${p}" does not match any layer specifed by the layers attribute - ignored.`
|
|
21274
|
+
);
|
|
21275
|
+
return null;
|
|
21276
|
+
}
|
|
21277
|
+
return [picked.length, ...picked, info.numLayers + 1];
|
|
21278
|
+
}
|
|
21031
21279
|
|
|
21032
21280
|
// src/gvc/emit-walk.ts
|
|
21033
21281
|
function nodeShown(info, job, n, g) {
|
|
@@ -21090,9 +21338,40 @@ var NATIVE_LANGNAME = /* @__PURE__ */ new Map([
|
|
|
21090
21338
|
["cmapx-np", "cmapx_np"],
|
|
21091
21339
|
["imap-np", "imap_np"]
|
|
21092
21340
|
]);
|
|
21093
|
-
function
|
|
21094
|
-
|
|
21095
|
-
|
|
21341
|
+
function warnUnsupported(job) {
|
|
21342
|
+
agwarningf(`layers not supported in ${NATIVE_LANGNAME.get(job.format) ?? job.format} output`);
|
|
21343
|
+
}
|
|
21344
|
+
function numPhysicalLayers(job, info) {
|
|
21345
|
+
return info.layerList !== null ? info.layerList[0] : job.numLayers;
|
|
21346
|
+
}
|
|
21347
|
+
function firstLayer(job, info, doesLayers) {
|
|
21348
|
+
job.numLayers = info.numLayers;
|
|
21349
|
+
const list = info.layerList;
|
|
21350
|
+
if (list !== null) {
|
|
21351
|
+
if (list[0] > 1 && !doesLayers) {
|
|
21352
|
+
warnUnsupported(job);
|
|
21353
|
+
list[2] = job.numLayers + 1;
|
|
21354
|
+
}
|
|
21355
|
+
job.layerNum = list[1];
|
|
21356
|
+
return { list, pos: 2 };
|
|
21357
|
+
}
|
|
21358
|
+
if (job.numLayers > 1 && !doesLayers) {
|
|
21359
|
+
warnUnsupported(job);
|
|
21360
|
+
job.numLayers = 1;
|
|
21361
|
+
}
|
|
21362
|
+
job.layerNum = 1;
|
|
21363
|
+
return { list: null, pos: 0 };
|
|
21364
|
+
}
|
|
21365
|
+
function validLayer(job) {
|
|
21366
|
+
return job.layerNum <= job.numLayers;
|
|
21367
|
+
}
|
|
21368
|
+
function nextLayer(job, cur) {
|
|
21369
|
+
if (cur.list !== null) {
|
|
21370
|
+
job.layerNum = cur.list[cur.pos];
|
|
21371
|
+
cur.pos++;
|
|
21372
|
+
} else {
|
|
21373
|
+
job.layerNum++;
|
|
21374
|
+
}
|
|
21096
21375
|
}
|
|
21097
21376
|
|
|
21098
21377
|
// src/gvc/device-labels.ts
|
|
@@ -21226,7 +21505,7 @@ function renderNode(n, renderer, job, done) {
|
|
|
21226
21505
|
job.popObj();
|
|
21227
21506
|
}
|
|
21228
21507
|
}
|
|
21229
|
-
function setEdgePen(e, job) {
|
|
21508
|
+
function setEdgePen(e, job, styles) {
|
|
21230
21509
|
if (job.obj === null) return;
|
|
21231
21510
|
const obj = job.obj;
|
|
21232
21511
|
const flags = parseStyleFlags(e.attrs.get("style"));
|
|
@@ -21236,24 +21515,24 @@ function setEdgePen(e, job) {
|
|
|
21236
21515
|
);
|
|
21237
21516
|
obj.pen = resolvePenType(flags);
|
|
21238
21517
|
obj.penWidth = resolvePenWidth(flags, e.attrs.get("penwidth"));
|
|
21239
|
-
obj.rawStyle =
|
|
21518
|
+
obj.rawStyle = [...styles];
|
|
21240
21519
|
if (e.info.spl !== void 0) gvrenderSetStyle(obj.rawStyle);
|
|
21241
21520
|
}
|
|
21242
21521
|
function renderEdge(e, renderer, job) {
|
|
21243
21522
|
emitEdgeComments(e, renderer, job);
|
|
21244
21523
|
const edgeStyle = e.attrs.get("style");
|
|
21524
|
+
const styles = styleTokens2(edgeStyle);
|
|
21245
21525
|
if (parseStyleFlags(edgeStyle).invis || styleHasInvisibleAlias(edgeStyle)) return;
|
|
21246
21526
|
const obj = createObjState(3 /* Edge */);
|
|
21247
21527
|
obj.emitState = 9 /* EDraw */;
|
|
21248
21528
|
job.pushObj(obj);
|
|
21249
|
-
setEdgePen(e, job);
|
|
21529
|
+
setEdgePen(e, job, styles);
|
|
21250
21530
|
try {
|
|
21251
21531
|
setHtmlAnchorObj(svgEdgeId(e, job), labelTextOf2(e.info.label), job.obj ?? void 0);
|
|
21252
21532
|
resolveEdgeAnchor(e, svgEdgeId(e, job), obj);
|
|
21253
21533
|
withColorScheme(e.attrs.get("colorscheme"), () => {
|
|
21254
21534
|
renderer.beginEdge(e, job);
|
|
21255
21535
|
reportEdgeColors(e);
|
|
21256
|
-
const styles = styleTokens2(e.attrs.get("style"));
|
|
21257
21536
|
for (let i = edgeStyleResets(e, styles); i > 0; i--) gvrenderSetStyle(styles);
|
|
21258
21537
|
reportEdgeLabelColors(e);
|
|
21259
21538
|
renderer.endEdge(e, job);
|
|
@@ -21280,6 +21559,22 @@ function renderClusterBox(sg, filled, renderer, job) {
|
|
|
21280
21559
|
const rawPts = [{ x: ll.x, y: ll.y }, { x: ll.x, y: ur.y }, { x: ur.x, y: ur.y }, { x: ur.x, y: ll.y }];
|
|
21281
21560
|
renderer.polygon(rawPts.map((p) => transformPoint(p, job)), filled, job);
|
|
21282
21561
|
}
|
|
21562
|
+
function drawClusterInScheme(sg, renderer, job) {
|
|
21563
|
+
const filled = applyClusterObjState(sg, job);
|
|
21564
|
+
renderer.beginCluster?.(sg, job);
|
|
21565
|
+
if (job.obj !== null) job.obj.id = svgClusterId(sg, job);
|
|
21566
|
+
setHtmlAnchorObj(svgClusterId(sg, job), labelTextOf2(sg.info.label), job.obj ?? void 0);
|
|
21567
|
+
if (job.obj !== null) {
|
|
21568
|
+
resolveObjAnchor(sg, labelTextOf2(sg.info.label), svgClusterId(sg, job), job.obj);
|
|
21569
|
+
}
|
|
21570
|
+
const anchored = beginAnchorIf(renderer, job);
|
|
21571
|
+
if ((clusterPeripheries(sg) !== 0 || filled || isStripedCluster(sg)) && job.obj?.pen !== 0 /* None */) {
|
|
21572
|
+
renderClusterBox(sg, filled, renderer, job);
|
|
21573
|
+
}
|
|
21574
|
+
renderClusterLabel(sg, renderer, job);
|
|
21575
|
+
if (anchored) renderer.endAnchor?.(job);
|
|
21576
|
+
renderer.endCluster?.(sg, job);
|
|
21577
|
+
}
|
|
21283
21578
|
function renderOneCluster(sg, renderer, job) {
|
|
21284
21579
|
const clustersLast = (job.flags & EMIT_CLUSTERS_LAST) !== 0;
|
|
21285
21580
|
if (clustersLast) renderClusters(sg, renderer, job);
|
|
@@ -21287,20 +21582,7 @@ function renderOneCluster(sg, renderer, job) {
|
|
|
21287
21582
|
obj.emitState = 1 /* CDraw */;
|
|
21288
21583
|
job.pushObj(obj);
|
|
21289
21584
|
try {
|
|
21290
|
-
|
|
21291
|
-
renderer.beginCluster?.(sg, job);
|
|
21292
|
-
if (job.obj !== null) job.obj.id = svgClusterId(sg, job);
|
|
21293
|
-
setHtmlAnchorObj(svgClusterId(sg, job), labelTextOf2(sg.info.label), job.obj ?? void 0);
|
|
21294
|
-
if (job.obj !== null) {
|
|
21295
|
-
resolveObjAnchor(sg, labelTextOf2(sg.info.label), svgClusterId(sg, job), job.obj);
|
|
21296
|
-
}
|
|
21297
|
-
const anchored = beginAnchorIf(renderer, job);
|
|
21298
|
-
if ((clusterPeripheries(sg) !== 0 || filled || isStripedCluster(sg)) && job.obj?.pen !== 0 /* None */) {
|
|
21299
|
-
renderClusterBox(sg, filled, renderer, job);
|
|
21300
|
-
}
|
|
21301
|
-
renderClusterLabel(sg, renderer, job);
|
|
21302
|
-
if (anchored) renderer.endAnchor?.(job);
|
|
21303
|
-
renderer.endCluster?.(sg, job);
|
|
21585
|
+
withColorScheme(clusterAttr(sg, "colorscheme"), () => drawClusterInScheme(sg, renderer, job));
|
|
21304
21586
|
} finally {
|
|
21305
21587
|
job.popObj();
|
|
21306
21588
|
}
|
|
@@ -21321,16 +21603,15 @@ function renderGraph(g, job, renderer) {
|
|
|
21321
21603
|
job.pushObj(obj);
|
|
21322
21604
|
try {
|
|
21323
21605
|
const info = parseLayers(g);
|
|
21324
|
-
|
|
21325
|
-
job.numLayers = layered ? info.numLayers : 1;
|
|
21606
|
+
job.layerNum = 0;
|
|
21326
21607
|
job.layerIDs = info.layerIDs;
|
|
21327
21608
|
renderer.beginGraph(g, job);
|
|
21328
|
-
|
|
21329
|
-
for (
|
|
21330
|
-
|
|
21331
|
-
if (layered) renderer.beginLayer(info.layerIDs[
|
|
21609
|
+
const cur = firstLayer(job, info, renderer.beginLayer !== void 0);
|
|
21610
|
+
for (; validLayer(job); nextLayer(job, cur)) {
|
|
21611
|
+
const layered = numPhysicalLayers(job, info) > 1;
|
|
21612
|
+
if (layered) renderer.beginLayer?.(info.layerIDs[job.layerNum], job);
|
|
21332
21613
|
renderPage(g, renderer, job, info);
|
|
21333
|
-
if (layered) renderer.endLayer(job);
|
|
21614
|
+
if (layered) renderer.endLayer?.(job);
|
|
21334
21615
|
}
|
|
21335
21616
|
renderer.endGraph(g, job);
|
|
21336
21617
|
} finally {
|
|
@@ -21363,6 +21644,7 @@ function render(ctx, g, format, inlineImages = false) {
|
|
|
21363
21644
|
const job = new RenderJob(format, ctx.textMeasurer);
|
|
21364
21645
|
job.inlineImages = inlineImages;
|
|
21365
21646
|
if (ctx.imageResolver !== void 0) job.imageResolver = ctx.imageResolver;
|
|
21647
|
+
if (ctx.imageSizer !== void 0) job.imageSizer = ctx.imageSizer;
|
|
21366
21648
|
job.bb = g.info.bb;
|
|
21367
21649
|
job.pad = parseGraphPad(g.attrs.get("pad"));
|
|
21368
21650
|
job.margin = parseGraphMargin(g.attrs.get("margin"));
|
|
@@ -21374,9 +21656,9 @@ function render(ctx, g, format, inlineImages = false) {
|
|
|
21374
21656
|
lateDouble(g.attrs.get("resolution"), 0, 0),
|
|
21375
21657
|
0
|
|
21376
21658
|
);
|
|
21377
|
-
const jobDpi = drawingDpi > 0 ? drawingDpi :
|
|
21659
|
+
const jobDpi = drawingDpi > 0 ? drawingDpi : POINTS_PER_INCH2;
|
|
21378
21660
|
job.dpi = { x: jobDpi, y: jobDpi };
|
|
21379
|
-
const dpiScale = jobDpi /
|
|
21661
|
+
const dpiScale = jobDpi / POINTS_PER_INCH2;
|
|
21380
21662
|
job.scale = { x: z * dpiScale, y: z * dpiScale };
|
|
21381
21663
|
job.rotation = parseLandscape(g) ? 90 : 0;
|
|
21382
21664
|
job.renderer = renderer;
|
|
@@ -21387,7 +21669,6 @@ function render(ctx, g, format, inlineImages = false) {
|
|
|
21387
21669
|
}
|
|
21388
21670
|
|
|
21389
21671
|
// src/common/htmltable-emit-fill.ts
|
|
21390
|
-
var MSG_MANY_COLORS = "More than 2 colors specified for a gradient - ignoring remaining";
|
|
21391
21672
|
function findHtmlStopColor(color, silent = false) {
|
|
21392
21673
|
const { segs, error } = silent ? parseSegsSilent(color) : parseSegs(color);
|
|
21393
21674
|
const first = segs[0];
|
|
@@ -21471,7 +21752,7 @@ function penTypeOf(style2) {
|
|
|
21471
21752
|
return 3 /* Solid */;
|
|
21472
21753
|
}
|
|
21473
21754
|
function withHtmlPaint(paint, job, drawFn) {
|
|
21474
|
-
paintObj.fillColor = paint.fill !== void 0 ?
|
|
21755
|
+
paintObj.fillColor = paint.fill !== void 0 ? resolveFillColorName(firstColor(paint.fill)) : { type: "none" };
|
|
21475
21756
|
paintObj.penColor = paint.pen !== void 0 ? resolveRenderColor(paint.pen) : { type: "string", s: "transparent" };
|
|
21476
21757
|
applyHtmlFill(paint);
|
|
21477
21758
|
paintObj.pen = penTypeOf(paint.penStyle);
|
|
@@ -21596,7 +21877,9 @@ function emitSidedPolylines(sides2, corners, renderer, job) {
|
|
|
21596
21877
|
var HTML_DEFAULT_COLOR = "black";
|
|
21597
21878
|
function bgNames(bgcolor) {
|
|
21598
21879
|
const spec = parseGradientSpec(bgcolor);
|
|
21599
|
-
|
|
21880
|
+
if (spec !== null) return [spec[0], spec[1]];
|
|
21881
|
+
if (parseSegsSilent(bgcolor).error !== 0 || firstColor(bgcolor) === "") return [];
|
|
21882
|
+
return [bgcolor];
|
|
21600
21883
|
}
|
|
21601
21884
|
function cellNames(cell2) {
|
|
21602
21885
|
if (htmlStyle(cell2.style).invisible) return [];
|
|
@@ -21652,23 +21935,68 @@ function zeroFlags() {
|
|
|
21652
21935
|
};
|
|
21653
21936
|
}
|
|
21654
21937
|
var FUNLIMIT = 64;
|
|
21938
|
+
var STYLE_SPACE = /* @__PURE__ */ new Set([" ", " ", "\n", "\v", "\f", "\r"]);
|
|
21939
|
+
function isStyleDelim(c) {
|
|
21940
|
+
return c === void 0 || c === "(" || c === ")" || c === ",";
|
|
21941
|
+
}
|
|
21942
|
+
function styleToken2(s, from) {
|
|
21943
|
+
let p = from;
|
|
21944
|
+
while (p < s.length && (STYLE_SPACE.has(s[p]) || s[p] === ",")) p++;
|
|
21945
|
+
if (p >= s.length) return null;
|
|
21946
|
+
if (s[p] === "(" || s[p] === ")") return { type: s[p], text: s[p], next: p + 1 };
|
|
21947
|
+
const start = p;
|
|
21948
|
+
while (!isStyleDelim(s[p])) p++;
|
|
21949
|
+
return { type: "id", text: s.slice(start, p), next: p };
|
|
21950
|
+
}
|
|
21951
|
+
var NO_TOKENS = [];
|
|
21952
|
+
function parseStyleQuiet(s) {
|
|
21953
|
+
const end = s.indexOf("\0");
|
|
21954
|
+
const str = end < 0 ? s : s.slice(0, end);
|
|
21955
|
+
const names = [];
|
|
21956
|
+
const args = [];
|
|
21957
|
+
let inParens = false;
|
|
21958
|
+
for (let c = styleToken2(str, 0); c !== null; c = styleToken2(str, c.next)) {
|
|
21959
|
+
if (c.type === "(") {
|
|
21960
|
+
if (inParens) return { tokens: NO_TOKENS, fault: "nesting" };
|
|
21961
|
+
inParens = true;
|
|
21962
|
+
} else if (c.type === ")") {
|
|
21963
|
+
if (!inParens) return { tokens: NO_TOKENS, fault: "unmatched-close" };
|
|
21964
|
+
inParens = false;
|
|
21965
|
+
} else if (inParens) {
|
|
21966
|
+
args[names.length - 1]?.push(c.text);
|
|
21967
|
+
} else {
|
|
21968
|
+
if (names.length === FUNLIMIT - 1) return { tokens: NO_TOKENS, fault: "truncate" };
|
|
21969
|
+
names.push(c.text);
|
|
21970
|
+
args.push([]);
|
|
21971
|
+
}
|
|
21972
|
+
}
|
|
21973
|
+
if (inParens) return { tokens: NO_TOKENS, fault: "unmatched-open" };
|
|
21974
|
+
const tokens = names.map((n, i) => args[i].length === 0 ? n : `${n}(${args[i].join(",")})`);
|
|
21975
|
+
return { tokens, fault: null };
|
|
21976
|
+
}
|
|
21977
|
+
function reportStyleFault(fault, s) {
|
|
21978
|
+
if (fault === "nesting") agerrorf(`nesting not allowed in style: ${s}`);
|
|
21979
|
+
else if (fault === "unmatched-close") agerrorf(`unmatched ')' in style: ${s}`);
|
|
21980
|
+
else if (fault === "unmatched-open") agerrorf(`unmatched '(' in style: ${s}`);
|
|
21981
|
+
else agwarningf(`truncating style '${s}'`);
|
|
21982
|
+
}
|
|
21655
21983
|
function styleTokens2(style2) {
|
|
21656
21984
|
if (!style2) return [];
|
|
21657
|
-
const
|
|
21658
|
-
|
|
21659
|
-
|
|
21660
|
-
|
|
21661
|
-
|
|
21662
|
-
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
return
|
|
21985
|
+
const { tokens, fault } = parseStyleQuiet(style2);
|
|
21986
|
+
if (fault !== null) reportStyleFault(fault, style2);
|
|
21987
|
+
return tokens;
|
|
21988
|
+
}
|
|
21989
|
+
function styleTokensQuiet(style2) {
|
|
21990
|
+
return style2 ? parseStyleQuiet(style2).tokens : [];
|
|
21991
|
+
}
|
|
21992
|
+
function styleName(token) {
|
|
21993
|
+
const paren = token.indexOf("(");
|
|
21994
|
+
return paren < 0 ? token : token.slice(0, paren);
|
|
21667
21995
|
}
|
|
21668
21996
|
function parseSetLineWidth(token) {
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
const v = parseFloat(m[1]);
|
|
21997
|
+
if (styleName(token) !== "setlinewidth") return null;
|
|
21998
|
+
const m = /^[^(]*\(([^,)]*)/.exec(token);
|
|
21999
|
+
const v = m === null ? Number.NaN : parseFloat(m[1]);
|
|
21672
22000
|
return Number.isNaN(v) ? 0 : v;
|
|
21673
22001
|
}
|
|
21674
22002
|
function applyToken(flags, token) {
|
|
@@ -21692,33 +22020,18 @@ function firstSolidColor(raw) {
|
|
|
21692
22020
|
}
|
|
21693
22021
|
function parseStyleFlags(style2) {
|
|
21694
22022
|
const flags = zeroFlags();
|
|
21695
|
-
|
|
21696
|
-
let fun = 0;
|
|
21697
|
-
for (const raw of style2.split(",")) {
|
|
21698
|
-
const token = raw.trim();
|
|
21699
|
-
if (token.length === 0) continue;
|
|
21700
|
-
if (fun === FUNLIMIT - 1) return zeroFlags();
|
|
21701
|
-
fun++;
|
|
22023
|
+
for (const token of styleTokensQuiet(style2)) {
|
|
21702
22024
|
const lw = parseSetLineWidth(token);
|
|
21703
22025
|
if (lw !== null) {
|
|
21704
22026
|
flags.setLineWidth = lw;
|
|
21705
22027
|
continue;
|
|
21706
22028
|
}
|
|
21707
|
-
|
|
22029
|
+
applyToken(flags, styleName(token));
|
|
21708
22030
|
}
|
|
21709
22031
|
return flags;
|
|
21710
22032
|
}
|
|
21711
22033
|
function styleHasInvisibleAlias(style2) {
|
|
21712
|
-
|
|
21713
|
-
let fun = 0;
|
|
21714
|
-
for (const raw of style2.split(",")) {
|
|
21715
|
-
const token = raw.trim();
|
|
21716
|
-
if (token.length === 0) continue;
|
|
21717
|
-
if (fun === FUNLIMIT - 1) return false;
|
|
21718
|
-
fun++;
|
|
21719
|
-
if (token === "invisible") return true;
|
|
21720
|
-
}
|
|
21721
|
-
return false;
|
|
22034
|
+
return styleTokensQuiet(style2).some((token) => styleName(token) === "invisible");
|
|
21722
22035
|
}
|
|
21723
22036
|
function resolvePenType(flags) {
|
|
21724
22037
|
if (flags.invis) return 0 /* None */;
|
|
@@ -21756,11 +22069,10 @@ function applyBgcolor(attrs, filled, fillcolor) {
|
|
|
21756
22069
|
}
|
|
21757
22070
|
function findStopColor(colorlist) {
|
|
21758
22071
|
const { segs, error } = parseSegs(colorlist);
|
|
21759
|
-
if (error === 1 || error === 2) return null;
|
|
21760
|
-
if (segs.length < 2) return null;
|
|
21761
22072
|
const seg0 = segs[0];
|
|
21762
22073
|
const seg1 = segs[1];
|
|
21763
|
-
if (seg0.color === null) return null;
|
|
22074
|
+
if (error !== 0 || seg0 === void 0 || seg1 === void 0 || seg0.color === null) return null;
|
|
22075
|
+
if (segs.length > 2) agwarningf(MSG_MANY_COLORS);
|
|
21764
22076
|
const fillColor = seg0.color;
|
|
21765
22077
|
const stopColor = seg1.color ?? DEFAULT_COLOR4;
|
|
21766
22078
|
const frac = seg0.hasFraction ? seg0.t : seg1.hasFraction ? 1 - seg1.t : 0;
|
|
@@ -21773,7 +22085,7 @@ function parseAngle(gradientangle2) {
|
|
|
21773
22085
|
}
|
|
21774
22086
|
function buildResolvedFill(rawColor, flags, angle) {
|
|
21775
22087
|
const stop = findStopColor(rawColor);
|
|
21776
|
-
if (stop === null) return { kind: "solid", color: rawColor };
|
|
22088
|
+
if (stop === null) return { kind: "solid", color: rawColor.split(":", 1)[0] };
|
|
21777
22089
|
const kind = flags.radial ? "radial" : "linear";
|
|
21778
22090
|
return { kind, fillColor: stop.fillColor, stopColor: stop.stopColor, frac: stop.frac, angle };
|
|
21779
22091
|
}
|
|
@@ -24146,10 +24458,10 @@ function xgWeak(Xg, t, h, orig, st) {
|
|
|
24146
24458
|
function isNonConstraint(e) {
|
|
24147
24459
|
const v = e.attrs.get("constraint");
|
|
24148
24460
|
if (!v) return false;
|
|
24149
|
-
return !
|
|
24461
|
+
return !mapbool(v);
|
|
24150
24462
|
}
|
|
24151
24463
|
function isAStrongCluster(g) {
|
|
24152
|
-
return
|
|
24464
|
+
return mapbool(g.attrs.get("compact") ?? "");
|
|
24153
24465
|
}
|
|
24154
24466
|
function dotLca(c0, c1) {
|
|
24155
24467
|
let a = c0;
|
|
@@ -24427,7 +24739,7 @@ function setClType(t) {
|
|
|
24427
24739
|
registerRenderState(() => {
|
|
24428
24740
|
clType = LOCAL;
|
|
24429
24741
|
});
|
|
24430
|
-
function
|
|
24742
|
+
function mapbool(s) {
|
|
24431
24743
|
if (!s || s === "") return false;
|
|
24432
24744
|
const l = s.toLowerCase();
|
|
24433
24745
|
if (l === "false" || l === "no") return false;
|
|
@@ -24443,7 +24755,7 @@ function scaleClamp(nnodes, scale) {
|
|
|
24443
24755
|
function isACluster(g) {
|
|
24444
24756
|
if (g === g.root) return true;
|
|
24445
24757
|
if (g.name.toLowerCase().startsWith("cluster")) return true;
|
|
24446
|
-
return
|
|
24758
|
+
return mapbool(g.attrs.get("cluster"));
|
|
24447
24759
|
}
|
|
24448
24760
|
function cleanup1ClearNode(n) {
|
|
24449
24761
|
if (n.info.in) n.info.in.size = 0;
|
|
@@ -24791,7 +25103,7 @@ function dot1Rank(g) {
|
|
|
24791
25103
|
cleanup1(g);
|
|
24792
25104
|
}
|
|
24793
25105
|
function dotRank(g) {
|
|
24794
|
-
if (
|
|
25106
|
+
if (mapbool(g.attrs.get("newrank"))) {
|
|
24795
25107
|
g.info.flags = (g.info.flags ?? 0) | NEW_RANK;
|
|
24796
25108
|
dot2Rank(g);
|
|
24797
25109
|
} else {
|
|
@@ -31147,7 +31459,7 @@ function runPlacement(gp) {
|
|
|
31147
31459
|
const nObjs = gp.nodes.size + nSetLbls + nClbls + nElbls;
|
|
31148
31460
|
const { ctx } = buildArrays(gp, nObjs, nLbls, nClbls, et);
|
|
31149
31461
|
const forceStr = gp.attrs.get("forcelabels");
|
|
31150
|
-
const force = forceStr === void 0 ? true :
|
|
31462
|
+
const force = forceStr === void 0 ? true : mapbool(forceStr);
|
|
31151
31463
|
const params = { bb: { ll: ctx.bb.ll, ur: ctx.bb.ur }, force };
|
|
31152
31464
|
placeLabels(ctx.objs, ctx.lbls, params);
|
|
31153
31465
|
writeBackLabels(gp, ctx.lbls, nLbls);
|
|
@@ -31157,6 +31469,20 @@ function addXLabels(gp) {
|
|
|
31157
31469
|
runPlacement(gp);
|
|
31158
31470
|
}
|
|
31159
31471
|
|
|
31472
|
+
// src/common/layout-state.ts
|
|
31473
|
+
var GVBEGIN = 0;
|
|
31474
|
+
var GVSPLINES = 1;
|
|
31475
|
+
var layoutState = { state: GVBEGIN };
|
|
31476
|
+
registerRenderState(() => {
|
|
31477
|
+
layoutState.state = GVBEGIN;
|
|
31478
|
+
});
|
|
31479
|
+
function getState() {
|
|
31480
|
+
return layoutState.state;
|
|
31481
|
+
}
|
|
31482
|
+
function setState(value) {
|
|
31483
|
+
layoutState.state = value;
|
|
31484
|
+
}
|
|
31485
|
+
|
|
31160
31486
|
// src/common/postproc.ts
|
|
31161
31487
|
var IGNORED_EDGE = 6;
|
|
31162
31488
|
var Rankdir = 0;
|
|
@@ -31248,6 +31574,7 @@ function translateDrawing(g) {
|
|
|
31248
31574
|
if (!shift && !Rankdir) return;
|
|
31249
31575
|
for (const v of g.nodes.values()) {
|
|
31250
31576
|
mapNode(v);
|
|
31577
|
+
if (getState() !== GVSPLINES) continue;
|
|
31251
31578
|
for (const e of g.edges) {
|
|
31252
31579
|
if (e.tail !== v) continue;
|
|
31253
31580
|
if (e.info.spl === void 0) {
|
|
@@ -35237,6 +35564,7 @@ function orthoDispatch(g) {
|
|
|
35237
35564
|
} else rc = dispatchOrthoEdges(g, false);
|
|
35238
35565
|
if (rc !== 0) return rc;
|
|
35239
35566
|
placePortLabels(g);
|
|
35567
|
+
setState(GVSPLINES);
|
|
35240
35568
|
g.info.edgeLabelsDone = true;
|
|
35241
35569
|
return 0;
|
|
35242
35570
|
}
|
|
@@ -35251,6 +35579,7 @@ function finalizeSplines(g, et, normalize) {
|
|
|
35251
35579
|
if (normalize) edgeNormalize(g);
|
|
35252
35580
|
if (et !== EDGETYPE_CURVED) routeDotEdges(g);
|
|
35253
35581
|
placePortLabels(g);
|
|
35582
|
+
setState(GVSPLINES);
|
|
35254
35583
|
g.info.edgeLabelsDone = true;
|
|
35255
35584
|
}
|
|
35256
35585
|
function dotSplines_(g, normalize) {
|
|
@@ -36609,7 +36938,7 @@ function dotPhasePostNoFinish(g) {
|
|
|
36609
36938
|
dotSameports(g);
|
|
36610
36939
|
const r = dotSplines(g);
|
|
36611
36940
|
if (r !== 0) return r;
|
|
36612
|
-
if (
|
|
36941
|
+
if (mapbool(g.attrs.get("compound") ?? g.root.attrs.get("compound"))) dotCompoundEdges(g);
|
|
36613
36942
|
return 0;
|
|
36614
36943
|
}
|
|
36615
36944
|
function dotPhasePost(g) {
|
|
@@ -36950,10 +37279,6 @@ function gvPermutation(bound) {
|
|
|
36950
37279
|
|
|
36951
37280
|
// src/layout/neato/matrix-ops.ts
|
|
36952
37281
|
var fr = Math.fround;
|
|
36953
|
-
function fma2(a, b, c) {
|
|
36954
|
-
const p = a * b;
|
|
36955
|
-
return Number.isFinite(p) && Number.isFinite(c) ? fma(a, b, c) : p + c;
|
|
36956
|
-
}
|
|
36957
37282
|
function orthog1(n, vec) {
|
|
36958
37283
|
let sum = 0;
|
|
36959
37284
|
for (let i = 0; i < n; i++) sum += vec[i];
|
|
@@ -36982,10 +37307,6 @@ function rightMultWithVectorFF(m, n, vector, result) {
|
|
|
36982
37307
|
function vectorsSubtractionF(n, v1, v2, result) {
|
|
36983
37308
|
for (let i = 0; i < n; i++) result[i] = v1[i] - v2[i];
|
|
36984
37309
|
}
|
|
36985
|
-
function vectorsMultAdditionF(n, v1, alpha, v2) {
|
|
36986
|
-
const a = fr(alpha);
|
|
36987
|
-
for (let i = 0; i < n; i++) v1[i] = v1[i] + fr(a * v2[i]);
|
|
36988
|
-
}
|
|
36989
37310
|
function vectorsInnerProductF(n, v1, v2) {
|
|
36990
37311
|
let result = 0;
|
|
36991
37312
|
for (let i = 0; i < n; i++) result += fr(v1[i] * v2[i]);
|
|
@@ -37026,11 +37347,11 @@ function innerProduct(n, v1, v2, block) {
|
|
|
37026
37347
|
const blocked = block === BLOCK_NONE ? 0 : n - n % block;
|
|
37027
37348
|
let i = 0;
|
|
37028
37349
|
for (; i < blocked; i++) result += v1[i] * v2[i];
|
|
37029
|
-
for (; i < n; i++) result =
|
|
37350
|
+
for (; i < n; i++) result = fma(v1[i], v2[i], result);
|
|
37030
37351
|
return result;
|
|
37031
37352
|
}
|
|
37032
37353
|
function scadd(vec1, end, fac, vec2) {
|
|
37033
|
-
for (let i = 0; i <= end; i++) vec1[i] =
|
|
37354
|
+
for (let i = 0; i <= end; i++) vec1[i] = fma(fac, vec2[i], vec1[i]);
|
|
37034
37355
|
}
|
|
37035
37356
|
function norm(vec, end, block) {
|
|
37036
37357
|
return Math.sqrt(innerProduct(end + 1, vec, vec, block));
|
|
@@ -37062,7 +37383,7 @@ function rightMultWithVectorF(matrix, n, vector, result, block) {
|
|
|
37062
37383
|
let res = 0;
|
|
37063
37384
|
let j = 0;
|
|
37064
37385
|
for (; j < blocked; j++) res += row[j] * vector[j];
|
|
37065
|
-
for (; j < n; j++) res =
|
|
37386
|
+
for (; j < n; j++) res = fma(row[j], vector[j], res);
|
|
37066
37387
|
result[i] = res;
|
|
37067
37388
|
}
|
|
37068
37389
|
}
|
|
@@ -37070,7 +37391,7 @@ function rightMultWithVector(matrix, n, vector, result) {
|
|
|
37070
37391
|
for (let i = 0; i < n; i++) {
|
|
37071
37392
|
let res = 0;
|
|
37072
37393
|
const row = matrix[i];
|
|
37073
|
-
for (let j = 0; j < row.nedges; j++) res =
|
|
37394
|
+
for (let j = 0; j < row.nedges; j++) res = fma(row.ewgts[j], vector[row.edges[j]], res);
|
|
37074
37395
|
result[i] = res;
|
|
37075
37396
|
}
|
|
37076
37397
|
}
|
|
@@ -37188,6 +37509,16 @@ function conjugateGradientF(A3, x, b, n, opts) {
|
|
|
37188
37509
|
var TOLERANCE_CG = 1e-3;
|
|
37189
37510
|
var DFLT_ITERATIONS = 200;
|
|
37190
37511
|
var OPT_SMART_INIT = 4;
|
|
37512
|
+
var OPT_EXP_FLAG = 3;
|
|
37513
|
+
var EXP_NAME = "stresswt";
|
|
37514
|
+
function checkExp(g) {
|
|
37515
|
+
const exp = lateInt(g.attrs.get(EXP_NAME), 2, 0);
|
|
37516
|
+
if (exp === 0 || exp > 2) {
|
|
37517
|
+
agwarningf(`${EXP_NAME} attribute value must be 1 or 2 - ignoring`);
|
|
37518
|
+
return 2;
|
|
37519
|
+
}
|
|
37520
|
+
return exp;
|
|
37521
|
+
}
|
|
37191
37522
|
function mdsModel(graph, nG) {
|
|
37192
37523
|
if (graph[0].ewgts.length === 0) return null;
|
|
37193
37524
|
const Dij = computeWeightedApspPacked(graph, nG);
|
|
@@ -37287,19 +37618,40 @@ function dijkstraSgd(graph, source, terms) {
|
|
|
37287
37618
|
|
|
37288
37619
|
// src/layout/neato/edge-len.ts
|
|
37289
37620
|
var DEFAULT_EDGE_LEN = 1;
|
|
37621
|
+
var DOUBLE_PREFIX = /^\s*([+-]?)(0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?|inf(?:inity)?|nan(?:\([\w]*\))?)/i;
|
|
37622
|
+
function scanDouble(s) {
|
|
37623
|
+
const m = DOUBLE_PREFIX.exec(s);
|
|
37624
|
+
if (m === null) return null;
|
|
37625
|
+
const body = m[2].toLowerCase();
|
|
37626
|
+
const sign2 = m[1] === "-" ? -1 : 1;
|
|
37627
|
+
if (body.startsWith("nan")) return Number.NaN;
|
|
37628
|
+
if (body.startsWith("inf")) return sign2 * Infinity;
|
|
37629
|
+
if (!body.startsWith("0x")) return sign2 * parseFloat(body);
|
|
37630
|
+
const [mant, exp] = body.slice(2).split("p");
|
|
37631
|
+
const [ip = "", fp = ""] = mant.split(".");
|
|
37632
|
+
const digits = parseInt(ip + fp || "0", 16);
|
|
37633
|
+
return sign2 * digits * 2 ** (Number(exp ?? 0) - 4 * fp.length);
|
|
37634
|
+
}
|
|
37290
37635
|
function lenattr(ep, g) {
|
|
37291
37636
|
const s = ep.attrs.get("len");
|
|
37292
37637
|
if (s === void 0 || s === "") return DEFAULT_EDGE_LEN;
|
|
37293
|
-
const
|
|
37294
|
-
|
|
37295
|
-
|
|
37296
|
-
agwarningf(`bad edge len "${s}" in ${g.name} - setting to ${DEFAULT_EDGE_LEN.toFixed(2)}`);
|
|
37638
|
+
const len = scanDouble(s);
|
|
37639
|
+
if (len === null || len < 0 || len === 0) {
|
|
37640
|
+
agwarningf(`bad edge len "${s}" in ${agNameOf(g)} - setting to ${DEFAULT_EDGE_LEN.toFixed(2)}`);
|
|
37297
37641
|
return DEFAULT_EDGE_LEN;
|
|
37298
37642
|
}
|
|
37299
37643
|
return len;
|
|
37300
37644
|
}
|
|
37301
37645
|
function setEdgeLen(g) {
|
|
37302
|
-
|
|
37646
|
+
const out = buildOutEdgeIndex(g);
|
|
37647
|
+
let total = 0;
|
|
37648
|
+
for (const np of g.nodes.values()) {
|
|
37649
|
+
for (const ep of out.get(np) ?? []) {
|
|
37650
|
+
ep.info.dist = lenattr(ep, g);
|
|
37651
|
+
total += ep.info.dist;
|
|
37652
|
+
}
|
|
37653
|
+
}
|
|
37654
|
+
return total;
|
|
37303
37655
|
}
|
|
37304
37656
|
|
|
37305
37657
|
// src/util/mt19937.ts
|
|
@@ -37435,7 +37787,7 @@ function unsupported(attr2, value, what) {
|
|
|
37435
37787
|
}
|
|
37436
37788
|
function ipsepHasConstraints(g) {
|
|
37437
37789
|
const dir = g.root.attrs.get("diredgeconstraints") ?? "";
|
|
37438
|
-
if (
|
|
37790
|
+
if (mapbool(dir) || /^hier/i.test(dir)) return true;
|
|
37439
37791
|
if ((g.root.attrs.get("overlap") ?? "").toLowerCase() === "ipsep") return true;
|
|
37440
37792
|
return [...g.root.subgraphs.values()].some((s) => s !== g.root && isACluster(s));
|
|
37441
37793
|
}
|
|
@@ -37457,7 +37809,7 @@ function neatoMode(g) {
|
|
|
37457
37809
|
if (str === void 0 || str === "") return MODE_MAJOR;
|
|
37458
37810
|
const mode = modeByName().get(str);
|
|
37459
37811
|
if (mode !== void 0) return mode;
|
|
37460
|
-
agwarningf(`Illegal value ${str} for attribute "mode" in graph ${g.root
|
|
37812
|
+
agwarningf(`Illegal value ${str} for attribute "mode" in graph ${agNameOf(g.root)} - ignored`);
|
|
37461
37813
|
return MODE_MAJOR;
|
|
37462
37814
|
}
|
|
37463
37815
|
function checkMode(g, mode) {
|
|
@@ -37502,7 +37854,7 @@ function warnCircuitDisconnected(g) {
|
|
|
37502
37854
|
circuitWarned.add(g.root);
|
|
37503
37855
|
agerrLineOn(
|
|
37504
37856
|
"warn",
|
|
37505
|
-
`graph ${g.root
|
|
37857
|
+
`graph ${agNameOf(g.root)} is disconnected. Hence, the circuit model
|
|
37506
37858
|
is undefined. Reverting to the shortest path model.
|
|
37507
37859
|
Alternatively, consider running neato using -Gpack=true or decomposing
|
|
37508
37860
|
the graph into connected components.`
|
|
@@ -38113,7 +38465,7 @@ function moveNode(st, m) {
|
|
|
38113
38465
|
function solveModel(g, st) {
|
|
38114
38466
|
for (let m = chooseNode(st); m >= 0; m = chooseNode(st)) moveNode(st, m);
|
|
38115
38467
|
if (st.move === st.maxIter) {
|
|
38116
|
-
agwarningf(`Max. iterations (${st.maxIter}) reached on graph ${g
|
|
38468
|
+
agwarningf(`Max. iterations (${st.maxIter}) reached on graph ${agNameOf(g)}`);
|
|
38117
38469
|
}
|
|
38118
38470
|
}
|
|
38119
38471
|
function mdsEdges(g, nodes, lens) {
|
|
@@ -38196,7 +38548,7 @@ function addNeighbours(g, np, entry, o) {
|
|
|
38196
38548
|
if (ep.head === ep.tail) continue;
|
|
38197
38549
|
const vp = ep.tail === np ? ep.head : ep.tail;
|
|
38198
38550
|
const vid = vp.info.id;
|
|
38199
|
-
const dist5 = o.haveLen ?
|
|
38551
|
+
const dist5 = o.haveLen ? ep.info.dist ?? 0 : 1;
|
|
38200
38552
|
const idx = seen2.get(vid);
|
|
38201
38553
|
if (idx !== void 0) {
|
|
38202
38554
|
if (o.haveLen) entry.ewgts[idx] = Math.max(entry.ewgts[idx], dist5);
|
|
@@ -38738,7 +39090,7 @@ function matMultVecOrthog(mat, dim, vec, result, orthog) {
|
|
|
38738
39090
|
let sum = 0;
|
|
38739
39091
|
let j = 0;
|
|
38740
39092
|
for (; j < blocked; j++) sum += row[j] * vec[j];
|
|
38741
|
-
for (; j < dim; j++) sum =
|
|
39093
|
+
for (; j < dim; j++) sum = fma(row[j], vec[j], sum);
|
|
38742
39094
|
result[i] = sum;
|
|
38743
39095
|
}
|
|
38744
39096
|
const alpha = -innerProduct(dim, result, orthog, BLOCK_MAT_MULT_ORTHOG);
|
|
@@ -38837,8 +39189,8 @@ function computeAvgs(Dij, n) {
|
|
|
38837
39189
|
sumRow += row[j] * row[j];
|
|
38838
39190
|
}
|
|
38839
39191
|
for (; j < n; j++) {
|
|
38840
|
-
sum =
|
|
38841
|
-
sumRow =
|
|
39192
|
+
sum = fma(row[j], row[j], sum);
|
|
39193
|
+
sumRow = fma(row[j], row[j], sumRow);
|
|
38842
39194
|
}
|
|
38843
39195
|
rowAvg[i] = fr4(fr4(sumRow) / n);
|
|
38844
39196
|
}
|
|
@@ -38851,7 +39203,7 @@ function computeBij(Dij, n) {
|
|
|
38851
39203
|
for (let i = 0; i < n; i++) {
|
|
38852
39204
|
for (let j = 0; j <= i; j++) {
|
|
38853
39205
|
const fD = fr4(Dij[i][j]);
|
|
38854
|
-
const t = fr4(
|
|
39206
|
+
const t = fr4(fma(-fD, fD, rowAvg[i]));
|
|
38855
39207
|
Bij[i][j] = fr4(fr4(t + rowAvg[j]) - allAvg);
|
|
38856
39208
|
Bij[j][i] = Bij[i][j];
|
|
38857
39209
|
}
|
|
@@ -38883,8 +39235,8 @@ function scaleGivenCoords(Dij, n, x) {
|
|
|
38883
39235
|
sum1 += t1 * f;
|
|
38884
39236
|
sum2 += t2 * f;
|
|
38885
39237
|
} else {
|
|
38886
|
-
sum1 =
|
|
38887
|
-
sum2 =
|
|
39238
|
+
sum1 = fma(t1, f, sum1);
|
|
39239
|
+
sum2 = fma(t2, f, sum2);
|
|
38888
39240
|
}
|
|
38889
39241
|
}
|
|
38890
39242
|
}
|
|
@@ -38914,7 +39266,7 @@ function computeResidualDistances(Dij, n, x) {
|
|
|
38914
39266
|
for (let j = 0; j < i; j++) {
|
|
38915
39267
|
const t = posI - x[j];
|
|
38916
39268
|
const d = Dij[i][j];
|
|
38917
|
-
const diff =
|
|
39269
|
+
const diff = fma(d, d, -(t * t));
|
|
38918
39270
|
const v = diff > 0 ? Math.sqrt(diff) : 0;
|
|
38919
39271
|
Dij[i][j] = v;
|
|
38920
39272
|
Dij[j][i] = v;
|
|
@@ -38971,8 +39323,6 @@ function imdsGivenDim(graph, n, givenCoords, newCoords, conjTol) {
|
|
|
38971
39323
|
|
|
38972
39324
|
// src/layout/neato/stress-kernel.ts
|
|
38973
39325
|
var fr5 = Math.fround;
|
|
38974
|
-
var TOLERANCE_CG2 = 1e-3;
|
|
38975
|
-
var OPT_EXP_FLAG = 2;
|
|
38976
39326
|
function computeApspPacked2(graph, n) {
|
|
38977
39327
|
const Dij = new Float32Array(n * (n + 1) / 2);
|
|
38978
39328
|
const Di = new Int32Array(n);
|
|
@@ -39016,51 +39366,16 @@ function initLayout(n, dim, coords, nodes) {
|
|
|
39016
39366
|
for (let d = 0; d < dim; d++) orthog1(n, coords[d]);
|
|
39017
39367
|
return pinned;
|
|
39018
39368
|
}
|
|
39019
|
-
|
|
39020
|
-
|
|
39021
|
-
|
|
39022
|
-
|
|
39023
|
-
|
|
39024
|
-
|
|
39025
|
-
|
|
39026
|
-
|
|
39027
|
-
|
|
39028
|
-
|
|
39029
|
-
vectorsMultAdditionF(n, st.x, alpha, st.p);
|
|
39030
|
-
if (!last) {
|
|
39031
|
-
vectorsMultAdditionF(n, st.r, -alpha, st.Ap);
|
|
39032
|
-
const rRNew = vectorsInnerProductF(n, st.r, st.r);
|
|
39033
|
-
if (st.rR === 0) return false;
|
|
39034
|
-
const betaF = fr5(rRNew / st.rR);
|
|
39035
|
-
st.rR = rRNew;
|
|
39036
|
-
for (let j = 0; j < n; j++) st.p[j] = fr5(betaF * st.p[j]) + st.r[j];
|
|
39037
|
-
}
|
|
39038
|
-
return true;
|
|
39039
|
-
}
|
|
39040
|
-
function conjugateGradientMkernel2(A3, x, b, n, tol, maxIterations) {
|
|
39041
|
-
const st = {
|
|
39042
|
-
A: A3,
|
|
39043
|
-
x,
|
|
39044
|
-
b,
|
|
39045
|
-
n,
|
|
39046
|
-
r: new Float32Array(n),
|
|
39047
|
-
p: new Float32Array(n),
|
|
39048
|
-
Ap: new Float32Array(n),
|
|
39049
|
-
rR: 0
|
|
39050
|
-
};
|
|
39051
|
-
orthog1f(n, x);
|
|
39052
|
-
orthog1f(n, b);
|
|
39053
|
-
const Ax = new Float32Array(n);
|
|
39054
|
-
rightMultWithVectorFF(A3, n, x, Ax);
|
|
39055
|
-
orthog1f(n, Ax);
|
|
39056
|
-
vectorsSubtractionF(n, b, Ax, st.r);
|
|
39057
|
-
copyVectorF(n, st.r, st.p);
|
|
39058
|
-
st.rR = vectorsInnerProductF(n, st.r, st.r);
|
|
39059
|
-
for (let i = 0; i < maxIterations && maxAbsF(n, st.r) > tol; i++) {
|
|
39060
|
-
if (!cgStep(st, i >= maxIterations - 1)) return -1;
|
|
39061
|
-
}
|
|
39062
|
-
return 0;
|
|
39063
|
-
}
|
|
39369
|
+
var FUSED_OPS = {
|
|
39370
|
+
squareAdd: (tmp, acc) => fmaf(tmp, tmp, acc),
|
|
39371
|
+
rightMult: rightMultWithVectorFFFused,
|
|
39372
|
+
cg: conjugateGradientMkernelFused
|
|
39373
|
+
};
|
|
39374
|
+
var COLA_OPS = {
|
|
39375
|
+
squareAdd: (tmp, acc) => acc + fr5(tmp * tmp),
|
|
39376
|
+
rightMult: rightMultWithVectorFF,
|
|
39377
|
+
cg: conjugateGradientMkernelFused
|
|
39378
|
+
};
|
|
39064
39379
|
function buildLap2(lap2, n, exp) {
|
|
39065
39380
|
const lapLength = n * (n + 1) / 2;
|
|
39066
39381
|
if (exp === 2) squareVec(lapLength, lap2);
|
|
@@ -39083,7 +39398,7 @@ function buildLap2(lap2, n, exp) {
|
|
|
39083
39398
|
}
|
|
39084
39399
|
}
|
|
39085
39400
|
function buildLap1(lap1, lap2, coords, shape) {
|
|
39086
|
-
const { n, dim, exp } = shape;
|
|
39401
|
+
const { n, dim, exp, ops } = shape;
|
|
39087
39402
|
const lapLength = n * (n + 1) / 2;
|
|
39088
39403
|
const degrees = new Float64Array(n);
|
|
39089
39404
|
const distAccumulator = new Float32Array(n);
|
|
@@ -39096,7 +39411,7 @@ function buildLap1(lap1, lap2, coords, shape) {
|
|
|
39096
39411
|
const ck = coords[k];
|
|
39097
39412
|
for (let x = 0; x < len; x++) {
|
|
39098
39413
|
const tmp = fr5(ck[i] + fr5(-1 * ck[i + 1 + x]));
|
|
39099
|
-
distAccumulator[x] = distAccumulator[x]
|
|
39414
|
+
distAccumulator[x] = ops.squareAdd(tmp, distAccumulator[x]);
|
|
39100
39415
|
}
|
|
39101
39416
|
}
|
|
39102
39417
|
invertSqrtVec(len, distAccumulator);
|
|
@@ -39129,24 +39444,25 @@ function buildLap1(lap1, lap2, coords, shape) {
|
|
|
39129
39444
|
function computeStress(st) {
|
|
39130
39445
|
let stress = 0;
|
|
39131
39446
|
for (let k = 0; k < st.dim; k++) {
|
|
39132
|
-
|
|
39447
|
+
st.ops.rightMult(st.lap1, st.n, st.coords[k], st.b[k]);
|
|
39133
39448
|
stress += vectorsInnerProductF(st.n, st.coords[k], st.b[k]);
|
|
39134
39449
|
}
|
|
39135
39450
|
stress *= 2;
|
|
39136
39451
|
stress += st.constantTerm;
|
|
39137
39452
|
for (let k = 0; k < st.dim; k++) {
|
|
39138
|
-
|
|
39453
|
+
st.ops.rightMult(st.lap2, st.n, st.coords[k], st.tmpCoords);
|
|
39139
39454
|
stress -= vectorsInnerProductF(st.n, st.coords[k], st.tmpCoords);
|
|
39140
39455
|
}
|
|
39141
39456
|
return stress;
|
|
39142
39457
|
}
|
|
39143
39458
|
function solveAxis(st, k, havePinned, nodes) {
|
|
39459
|
+
const cg = { tol: TOLERANCE_CG, maxIterations: st.n };
|
|
39144
39460
|
if (!havePinned) {
|
|
39145
|
-
return
|
|
39461
|
+
return st.ops.cg(st.lap2, st.coords[k], st.b[k], st.n, cg);
|
|
39146
39462
|
}
|
|
39147
39463
|
copyVectorF(st.n, st.coords[k], st.tmpCoords);
|
|
39148
|
-
const rc =
|
|
39149
|
-
if (rc
|
|
39464
|
+
const rc = st.ops.cg(st.lap2, st.tmpCoords, st.b[k], st.n, cg);
|
|
39465
|
+
if (rc !== 0) return rc;
|
|
39150
39466
|
for (let i = 0; i < st.n; i++) {
|
|
39151
39467
|
if (!isFixed(nodes[i])) st.coords[k][i] = st.tmpCoords[i];
|
|
39152
39468
|
}
|
|
@@ -39177,20 +39493,21 @@ function stressMajorizationKDMkernel(Dij, n, dCoords, nodes, o) {
|
|
|
39177
39493
|
coords,
|
|
39178
39494
|
b: Array.from({ length: dim }, () => new Float32Array(n)),
|
|
39179
39495
|
tmpCoords: new Float32Array(n),
|
|
39180
|
-
constantTerm
|
|
39496
|
+
constantTerm,
|
|
39497
|
+
ops: o.cola === true ? COLA_OPS : FUSED_OPS
|
|
39181
39498
|
};
|
|
39182
39499
|
let oldStress = Number.MAX_VALUE;
|
|
39183
39500
|
let converged = false;
|
|
39184
39501
|
let iterations = 0;
|
|
39185
39502
|
for (; iterations < maxi && !converged; iterations++) {
|
|
39186
|
-
buildLap1(st.lap1, lap2, coords, { n, dim, exp });
|
|
39503
|
+
buildLap1(st.lap1, lap2, coords, { n, dim, exp, ops: st.ops });
|
|
39187
39504
|
const newStress = computeStress(st);
|
|
39188
39505
|
if (typeof process !== "undefined" && process.env["STRESS_DEBUG"] && iterations % 5 === 0) console.error(newStress.toFixed(3));
|
|
39189
39506
|
const change = Math.abs(oldStress - newStress);
|
|
39190
39507
|
converged = change / oldStress < o.epsilon || newStress < o.epsilon;
|
|
39191
39508
|
oldStress = newStress;
|
|
39192
39509
|
for (let k = 0; k < dim; k++) {
|
|
39193
|
-
if (solveAxis(st, k, havePinned, nodes)
|
|
39510
|
+
if (solveAxis(st, k, havePinned, nodes) !== 0) return -1;
|
|
39194
39511
|
}
|
|
39195
39512
|
}
|
|
39196
39513
|
for (let i = 0; i < dim; i++) {
|
|
@@ -39278,7 +39595,7 @@ function distanceKD(coords, dim, i, j) {
|
|
|
39278
39595
|
let sum = 0;
|
|
39279
39596
|
for (let k = 0; k < dim; k++) {
|
|
39280
39597
|
const d = coords[k][i] - coords[k][j];
|
|
39281
|
-
sum =
|
|
39598
|
+
sum = fma(d, d, sum);
|
|
39282
39599
|
}
|
|
39283
39600
|
return Math.sqrt(sum);
|
|
39284
39601
|
}
|
|
@@ -39455,10 +39772,10 @@ function stressMajorizationWithHierarchy(graph, n, dCoords, nodes, o) {
|
|
|
39455
39772
|
}
|
|
39456
39773
|
|
|
39457
39774
|
// src/common/utils-inputscale.ts
|
|
39458
|
-
var
|
|
39775
|
+
var POINTS_PER_INCH4 = 72;
|
|
39459
39776
|
function getInputscale(g) {
|
|
39460
39777
|
const d = lateDouble(g.root.attrs.get("inputscale"), -1, 0);
|
|
39461
|
-
return d === 0 ?
|
|
39778
|
+
return d === 0 ? POINTS_PER_INCH4 : d;
|
|
39462
39779
|
}
|
|
39463
39780
|
function inputscaleDivisor(g) {
|
|
39464
39781
|
const sc = getInputscale(g);
|
|
@@ -39466,7 +39783,7 @@ function inputscaleDivisor(g) {
|
|
|
39466
39783
|
}
|
|
39467
39784
|
|
|
39468
39785
|
// src/layout/neato/set-aspect.ts
|
|
39469
|
-
var
|
|
39786
|
+
var POINTS_PER_INCH5 = 72;
|
|
39470
39787
|
function neatoRatioKind(g) {
|
|
39471
39788
|
const p = g.attrs.get("ratio");
|
|
39472
39789
|
if (p === void 0) return null;
|
|
@@ -39514,8 +39831,8 @@ function neatoTranslate(g) {
|
|
|
39514
39831
|
const bb = g.info.bb;
|
|
39515
39832
|
if (!bb) return;
|
|
39516
39833
|
const ll = bb.ll;
|
|
39517
|
-
const ox = ll.x /
|
|
39518
|
-
const oy = ll.y /
|
|
39834
|
+
const ox = ll.x / POINTS_PER_INCH5;
|
|
39835
|
+
const oy = ll.y / POINTS_PER_INCH5;
|
|
39519
39836
|
for (const n of g.nodes.values()) {
|
|
39520
39837
|
if (!n.info.pos) n.info.pos = [0, 0];
|
|
39521
39838
|
n.info.pos[0] = (n.info.pos[0] ?? 0) - ox;
|
|
@@ -39601,7 +39918,7 @@ var MODEL_CIRCUIT = 1;
|
|
|
39601
39918
|
var MODEL_SUBSET = 2;
|
|
39602
39919
|
var MODEL_MDS2 = 3;
|
|
39603
39920
|
var DFLT_DIM = 2;
|
|
39604
|
-
var
|
|
39921
|
+
var POINTS_PER_INCH6 = 72;
|
|
39605
39922
|
function neatoInitNode(n, dim = DFLT_DIM) {
|
|
39606
39923
|
if (!n.info.pos || n.info.pos.length < dim) {
|
|
39607
39924
|
const pos = [];
|
|
@@ -39623,7 +39940,7 @@ function userPos(n) {
|
|
|
39623
39940
|
n.info.pos = [Number(m[1]) / div, Number(m[2]) / div];
|
|
39624
39941
|
n.info.posSet = true;
|
|
39625
39942
|
const pin = n.attrs.get("pin");
|
|
39626
|
-
if (m[3] === "!" || pin !== void 0 &&
|
|
39943
|
+
if (m[3] === "!" || pin !== void 0 && mapbool(pin)) n.info.pinned = true;
|
|
39627
39944
|
return true;
|
|
39628
39945
|
}
|
|
39629
39946
|
function assignNodeIds2(g) {
|
|
@@ -39662,15 +39979,17 @@ function solveStress(c, vtx, dCoords, nodeList) {
|
|
|
39662
39979
|
dim: DFLT_DIM,
|
|
39663
39980
|
opts,
|
|
39664
39981
|
maxi,
|
|
39665
|
-
epsilon
|
|
39982
|
+
epsilon,
|
|
39983
|
+
cola: mode === MODE_IPSEP
|
|
39666
39984
|
});
|
|
39667
39985
|
}
|
|
39668
39986
|
function runMajorization(g, mode, model) {
|
|
39669
39987
|
const nodeList = assignNodeIds2(g);
|
|
39988
|
+
setEdgeLen(g);
|
|
39670
39989
|
const n = nodeList.length;
|
|
39671
39990
|
const haveLen = graphHasLen(g);
|
|
39672
39991
|
const init = checkStart(g, n, mode === MODE_HIER ? INIT_SELF : INIT_RANDOM);
|
|
39673
|
-
const opts = init === INIT_SELF ?
|
|
39992
|
+
const opts = checkExp(g) | (init === INIT_SELF ? OPT_SMART_INIT : 0);
|
|
39674
39993
|
const haveDir = mode === MODE_HIER || mode === MODE_IPSEP;
|
|
39675
39994
|
const vtx = makeGraphDataC(g, nodeList, haveLen, haveDir, mode);
|
|
39676
39995
|
const dCoords = [new Float64Array(n), new Float64Array(n)];
|
|
@@ -39700,12 +40019,14 @@ function neatoSetAspect(g) {
|
|
|
39700
40019
|
const pos = n.info.pos;
|
|
39701
40020
|
if (!pos) continue;
|
|
39702
40021
|
n.info.coord = {
|
|
39703
|
-
x: (pos[0] ?? 0) *
|
|
39704
|
-
y: (pos[1] ?? 0) *
|
|
40022
|
+
x: (pos[0] ?? 0) * POINTS_PER_INCH6,
|
|
40023
|
+
y: (pos[1] ?? 0) * POINTS_PER_INCH6
|
|
39705
40024
|
};
|
|
39706
40025
|
}
|
|
39707
40026
|
}
|
|
39708
40027
|
function neatoCleanup(g) {
|
|
40028
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
40029
|
+
for (const n of g.nodes.values()) gvCleanupNodeLabels(n);
|
|
39709
40030
|
for (const [, n] of g.nodes) {
|
|
39710
40031
|
n.info.pos = void 0;
|
|
39711
40032
|
n.info.pinned = void 0;
|
|
@@ -41932,7 +42253,7 @@ function splineEdgesImpl(g, sep, edgetype) {
|
|
|
41932
42253
|
function splineEdges(g) {
|
|
41933
42254
|
const edgetype = g.info.flags & 15;
|
|
41934
42255
|
if (edgetype === EDGETYPE_NONE) return;
|
|
41935
|
-
g.root.info.concentrate =
|
|
42256
|
+
g.root.info.concentrate = mapbool(g.root.attrs.get("concentrate"));
|
|
41936
42257
|
for (const n of nodesInSeq(g)) {
|
|
41937
42258
|
for (const e of n.outEdges(g)) {
|
|
41938
42259
|
if (e.info.tail_port.dyna) e.info.tail_port = resolvePort(e.tail, e.head, e.info.tail_port);
|
|
@@ -41942,9 +42263,11 @@ function splineEdges(g) {
|
|
|
41942
42263
|
coalesceEdges(g);
|
|
41943
42264
|
if (edgetype === EDGETYPE_LINE) {
|
|
41944
42265
|
RoutingHelper.straight(g, edgetype);
|
|
42266
|
+
setState(GVSPLINES);
|
|
41945
42267
|
return;
|
|
41946
42268
|
}
|
|
41947
42269
|
splineEdgesImpl(g, esepFactor(g), edgetype);
|
|
42270
|
+
setState(GVSPLINES);
|
|
41948
42271
|
}
|
|
41949
42272
|
function computeBBFromPos(g) {
|
|
41950
42273
|
const bb = {
|
|
@@ -44355,6 +44678,8 @@ function getPos(g, dim) {
|
|
|
44355
44678
|
return pos;
|
|
44356
44679
|
}
|
|
44357
44680
|
function sfdpCleanup(g) {
|
|
44681
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
44682
|
+
for (const n of g.nodes.values()) gvCleanupNodeLabels(n);
|
|
44358
44683
|
for (const n of g.nodes.values()) {
|
|
44359
44684
|
n.info.pos = void 0;
|
|
44360
44685
|
n.info.id = void 0;
|
|
@@ -45263,7 +45588,7 @@ var AM_PORTHOYX = 12;
|
|
|
45263
45588
|
var SCALE = 10;
|
|
45264
45589
|
var SCALE2 = SCALE / 2;
|
|
45265
45590
|
var INT_MAX3 = 2147483647;
|
|
45266
|
-
var
|
|
45591
|
+
var POINTS_PER_INCH7 = 72;
|
|
45267
45592
|
function cmpitem(a, b) {
|
|
45268
45593
|
if (a < b) return -1;
|
|
45269
45594
|
if (a > b) return 1;
|
|
@@ -45491,18 +45816,18 @@ function overlaps(p) {
|
|
|
45491
45816
|
return false;
|
|
45492
45817
|
}
|
|
45493
45818
|
function initItem(n, margin) {
|
|
45494
|
-
const x = cround(SCALE * (n.info.pos?.[0] ?? 0) *
|
|
45495
|
-
const y = cround(SCALE * (n.info.pos?.[1] ?? 0) *
|
|
45819
|
+
const x = cround(SCALE * (n.info.pos?.[0] ?? 0) * POINTS_PER_INCH7);
|
|
45820
|
+
const y = cround(SCALE * (n.info.pos?.[1] ?? 0) * POINTS_PER_INCH7);
|
|
45496
45821
|
const width2 = n.info.width ?? 0;
|
|
45497
45822
|
const height2 = n.info.height ?? 0;
|
|
45498
45823
|
let w2;
|
|
45499
45824
|
let h2;
|
|
45500
45825
|
if (margin.doAdd) {
|
|
45501
|
-
w2 = d2i(SCALE * (cround(width2 / 2 *
|
|
45502
|
-
h2 = d2i(SCALE * (cround(height2 / 2 *
|
|
45826
|
+
w2 = d2i(SCALE * (cround(width2 / 2 * POINTS_PER_INCH7) + margin.x));
|
|
45827
|
+
h2 = d2i(SCALE * (cround(height2 / 2 * POINTS_PER_INCH7) + margin.y));
|
|
45503
45828
|
} else {
|
|
45504
|
-
w2 = cround(margin.x * SCALE2 * width2 *
|
|
45505
|
-
h2 = cround(margin.y * SCALE2 * height2 *
|
|
45829
|
+
w2 = cround(margin.x * SCALE2 * width2 * POINTS_PER_INCH7);
|
|
45830
|
+
h2 = cround(margin.y * SCALE2 * height2 * POINTS_PER_INCH7);
|
|
45506
45831
|
}
|
|
45507
45832
|
return {
|
|
45508
45833
|
val: 0,
|
|
@@ -45537,8 +45862,8 @@ function cAdjust(g, mode) {
|
|
|
45537
45862
|
if (!overlaps(nlist)) return 0;
|
|
45538
45863
|
runPlan(g, nlist, PLANS.get(mode) ?? PLANS.get(AM_PORTHO));
|
|
45539
45864
|
for (const p of nlist) {
|
|
45540
|
-
const x = p.pos.x /
|
|
45541
|
-
const y = p.pos.y /
|
|
45865
|
+
const x = p.pos.x / POINTS_PER_INCH7 / SCALE;
|
|
45866
|
+
const y = p.pos.y / POINTS_PER_INCH7 / SCALE;
|
|
45542
45867
|
if (p.np.info.pos) {
|
|
45543
45868
|
p.np.info.pos[0] = x;
|
|
45544
45869
|
p.np.info.pos[1] = y;
|
|
@@ -45553,10 +45878,10 @@ function cAdjust(g, mode) {
|
|
|
45553
45878
|
var POLY_BOX = 1;
|
|
45554
45879
|
var POLY_CIRCLE = 2;
|
|
45555
45880
|
var DFLT_SAMPLE2 = 20;
|
|
45556
|
-
var
|
|
45881
|
+
var POINTS_PER_INCH8 = 72;
|
|
45557
45882
|
var MIN_SAMPLES = 3;
|
|
45558
45883
|
function ps2inch2(a) {
|
|
45559
|
-
return a /
|
|
45884
|
+
return a / POINTS_PER_INCH8;
|
|
45560
45885
|
}
|
|
45561
45886
|
function isBoxKind(p) {
|
|
45562
45887
|
return (p.kind & POLY_BOX) !== 0;
|
|
@@ -45849,7 +46174,7 @@ function polyOverlap(p, pp, q, qp) {
|
|
|
45849
46174
|
// src/layout/neato/adjust-info.ts
|
|
45850
46175
|
var DEFAULT_VORO_MARGIN = 0.05;
|
|
45851
46176
|
var INCR = 0.05;
|
|
45852
|
-
var
|
|
46177
|
+
var POINTS_PER_INCH9 = 72;
|
|
45853
46178
|
function newInfoState() {
|
|
45854
46179
|
return {
|
|
45855
46180
|
nodeInfo: [],
|
|
@@ -45904,8 +46229,8 @@ function chkBoundBox(st, graph) {
|
|
|
45904
46229
|
function makeInfo(st, graph) {
|
|
45905
46230
|
const pmargin = { ...sepFactor(graph) };
|
|
45906
46231
|
if (pmargin.doAdd) {
|
|
45907
|
-
pmargin.x /=
|
|
45908
|
-
pmargin.y /=
|
|
46232
|
+
pmargin.x /= POINTS_PER_INCH9;
|
|
46233
|
+
pmargin.y /= POINTS_PER_INCH9;
|
|
45909
46234
|
}
|
|
45910
46235
|
const polyf = pmargin.doAdd ? makeAddPoly : makePoly;
|
|
45911
46236
|
const info = [];
|
|
@@ -46971,7 +47296,7 @@ function genYConstraints(rects, vs) {
|
|
|
46971
47296
|
}
|
|
46972
47297
|
|
|
46973
47298
|
// src/layout/neato/vpsc-adjust.ts
|
|
46974
|
-
var
|
|
47299
|
+
var POINTS_PER_INCH10 = 72;
|
|
46975
47300
|
var X_PASS_SCALE = Math.fround(1.0001);
|
|
46976
47301
|
function buildRects(c, size, gap, scale) {
|
|
46977
47302
|
return size.map((s, i) => {
|
|
@@ -46996,8 +47321,8 @@ function solveAxis2(c, size, gap, axis) {
|
|
|
46996
47321
|
function vpscAdjust(g) {
|
|
46997
47322
|
const margin = sepFactor(g);
|
|
46998
47323
|
const gap = {
|
|
46999
|
-
x: 2 * (margin.doAdd ? margin.x : DFLT_MARGIN) /
|
|
47000
|
-
y: 2 * (margin.doAdd ? margin.y : DFLT_MARGIN) /
|
|
47324
|
+
x: 2 * (margin.doAdd ? margin.x : DFLT_MARGIN) / POINTS_PER_INCH10,
|
|
47325
|
+
y: 2 * (margin.doAdd ? margin.y : DFLT_MARGIN) / POINTS_PER_INCH10
|
|
47001
47326
|
};
|
|
47002
47327
|
const nodes = Array.from(g.nodes.values());
|
|
47003
47328
|
const c = [new Float32Array(nodes.length), new Float32Array(nodes.length)];
|
|
@@ -47176,7 +47501,7 @@ function graphAdjustMode(g) {
|
|
|
47176
47501
|
}
|
|
47177
47502
|
|
|
47178
47503
|
// src/layout/twopi/init.ts
|
|
47179
|
-
var
|
|
47504
|
+
var POINTS_PER_INCH11 = 72;
|
|
47180
47505
|
function makeRdata(INF) {
|
|
47181
47506
|
return {
|
|
47182
47507
|
kind: "twopi",
|
|
@@ -47228,19 +47553,24 @@ function finaliseCoords(g) {
|
|
|
47228
47553
|
const pos = n.info.pos;
|
|
47229
47554
|
if (!pos) continue;
|
|
47230
47555
|
n.info.coord = {
|
|
47231
|
-
x: (pos[0] ?? 0) *
|
|
47232
|
-
y: (pos[1] ?? 0) *
|
|
47556
|
+
x: (pos[0] ?? 0) * POINTS_PER_INCH11,
|
|
47557
|
+
y: (pos[1] ?? 0) * POINTS_PER_INCH11
|
|
47233
47558
|
};
|
|
47234
47559
|
}
|
|
47235
47560
|
}
|
|
47236
47561
|
function adjustNodes(g) {
|
|
47237
47562
|
adjustNodesFull(g);
|
|
47238
47563
|
}
|
|
47239
|
-
function
|
|
47564
|
+
function twopiFreeAlg(g) {
|
|
47240
47565
|
const first = g.nodes.values().next().value;
|
|
47241
47566
|
if (first !== void 0 && first.info.alg?.kind === "twopi") {
|
|
47242
47567
|
first.info.alg = void 0;
|
|
47243
47568
|
}
|
|
47569
|
+
}
|
|
47570
|
+
function twopiCleanup(g) {
|
|
47571
|
+
if (g.nodes.size === 0) return;
|
|
47572
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
47573
|
+
for (const n of g.nodes.values()) gvCleanupNodeLabels(n);
|
|
47244
47574
|
g.info.neato_nlist = void 0;
|
|
47245
47575
|
}
|
|
47246
47576
|
|
|
@@ -47509,7 +47839,7 @@ function layoutSingle(g, comps, globalRoot, setRoot) {
|
|
|
47509
47839
|
if (setRoot && globalRoot === null && center !== null) {
|
|
47510
47840
|
g.attrs.set("root", center.name);
|
|
47511
47841
|
}
|
|
47512
|
-
|
|
47842
|
+
twopiFreeAlg(g);
|
|
47513
47843
|
splineEdgesShifted(g);
|
|
47514
47844
|
finaliseCoords(g);
|
|
47515
47845
|
}
|
|
@@ -47518,7 +47848,7 @@ function layoutMulti(g, comps, globalRoot, pinfo) {
|
|
|
47518
47848
|
layoutComponent(g, sg, globalRoot);
|
|
47519
47849
|
finaliseCoords(sg);
|
|
47520
47850
|
}
|
|
47521
|
-
|
|
47851
|
+
twopiFreeAlg(g);
|
|
47522
47852
|
packSubgraphs(comps.length, comps, g, pinfo);
|
|
47523
47853
|
splineEdgesShifted(g);
|
|
47524
47854
|
finaliseCoords(g);
|
|
@@ -47922,7 +48252,18 @@ function fdpInitNodeEdge(g) {
|
|
|
47922
48252
|
}
|
|
47923
48253
|
initialPositions3(g);
|
|
47924
48254
|
}
|
|
48255
|
+
function fdpCleanupSubgs(g) {
|
|
48256
|
+
const nClust = g.info.n_cluster ?? 0;
|
|
48257
|
+
for (let i = 1; i <= nClust; i++) {
|
|
48258
|
+
const subg = g.info.clust[i - 1];
|
|
48259
|
+
subg.info.label = void 0;
|
|
48260
|
+
fdpCleanupSubgs(subg);
|
|
48261
|
+
}
|
|
48262
|
+
}
|
|
47925
48263
|
function fdpCleanup(g) {
|
|
48264
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
48265
|
+
for (const n of g.nodes.values()) gvCleanupNodeLabels(n);
|
|
48266
|
+
fdpCleanupSubgs(g);
|
|
47926
48267
|
for (const n of g.nodes.values()) {
|
|
47927
48268
|
n.info.alg = void 0;
|
|
47928
48269
|
n.info.pos = void 0;
|
|
@@ -48866,7 +49207,7 @@ function expandCluster2(n, cg) {
|
|
|
48866
49207
|
}
|
|
48867
49208
|
|
|
48868
49209
|
// src/layout/fdp/layout.ts
|
|
48869
|
-
var
|
|
49210
|
+
var POINTS_PER_INCH12 = 72;
|
|
48870
49211
|
var DEFAULT_NODEWIDTH_PTS = 54;
|
|
48871
49212
|
var DEFAULT_NODEHEIGHT_PTS = 36;
|
|
48872
49213
|
function initInfo(g) {
|
|
@@ -48961,7 +49302,7 @@ function shiftComponents(cc, pts, pt) {
|
|
|
48961
49302
|
} else {
|
|
48962
49303
|
p = pt;
|
|
48963
49304
|
}
|
|
48964
|
-
const del = { x: p.x /
|
|
49305
|
+
const del = { x: p.x / POINTS_PER_INCH12, y: p.y / POINTS_PER_INCH12 };
|
|
48965
49306
|
for (const n of cc[i].nodes.values()) {
|
|
48966
49307
|
n.info.pos[0] += del.x;
|
|
48967
49308
|
n.info.pos[1] += del.y;
|
|
@@ -48977,8 +49318,8 @@ function finalCC(g, cc, pts, rg, infop) {
|
|
|
48977
49318
|
const pt = applyMarginAndBorder(rg, bb, margin);
|
|
48978
49319
|
if (cc.length > 0) shiftComponents(cc, pts, pt);
|
|
48979
49320
|
gdata(g).bb = {
|
|
48980
|
-
ll: { x: bb.ll.x /
|
|
48981
|
-
ur: { x: bb.ur.x /
|
|
49321
|
+
ll: { x: bb.ll.x / POINTS_PER_INCH12, y: bb.ll.y / POINTS_PER_INCH12 },
|
|
49322
|
+
ur: { x: bb.ur.x / POINTS_PER_INCH12, y: bb.ur.y / POINTS_PER_INCH12 }
|
|
48982
49323
|
};
|
|
48983
49324
|
}
|
|
48984
49325
|
function applyMarginAndBorder(rg, bb, margin) {
|
|
@@ -49024,8 +49365,8 @@ function translateOwnNodes(g, bb) {
|
|
|
49024
49365
|
function setBB(g) {
|
|
49025
49366
|
const bb = gdata(g).bb;
|
|
49026
49367
|
g.info.bb = {
|
|
49027
|
-
ll: { x:
|
|
49028
|
-
ur: { x:
|
|
49368
|
+
ll: { x: POINTS_PER_INCH12 * bb.ll.x, y: POINTS_PER_INCH12 * bb.ll.y },
|
|
49369
|
+
ur: { x: POINTS_PER_INCH12 * bb.ur.x, y: POINTS_PER_INCH12 * bb.ur.y }
|
|
49029
49370
|
};
|
|
49030
49371
|
const nClusters = g.info.n_cluster ?? 0;
|
|
49031
49372
|
for (let i = 0; i < nClusters; i++) {
|
|
@@ -49040,8 +49381,8 @@ function setClustNodes(root) {
|
|
|
49040
49381
|
const bb = gdata(p).bb;
|
|
49041
49382
|
const w = bb.ur.x - bb.ll.x;
|
|
49042
49383
|
const h = bb.ur.y - bb.ll.y;
|
|
49043
|
-
const w2 =
|
|
49044
|
-
const h2 =
|
|
49384
|
+
const w2 = POINTS_PER_INCH12 * (w / 2);
|
|
49385
|
+
const h2 = POINTS_PER_INCH12 * (h / 2);
|
|
49045
49386
|
n.info.pos[0] = w / 2;
|
|
49046
49387
|
n.info.pos[1] = h / 2;
|
|
49047
49388
|
n.info.width = w;
|
|
@@ -49050,7 +49391,7 @@ function setClustNodes(root) {
|
|
|
49050
49391
|
n.info.outline_width = w + penwidth;
|
|
49051
49392
|
n.info.outline_height = h + penwidth;
|
|
49052
49393
|
n.info.lw = n.info.rw = w2;
|
|
49053
|
-
n.info.ht =
|
|
49394
|
+
n.info.ht = POINTS_PER_INCH12 * h;
|
|
49054
49395
|
const poly = n.info.shape_info;
|
|
49055
49396
|
if (poly && poly.vertices) {
|
|
49056
49397
|
poly.vertices[0] = { x: w2, y: h2 };
|
|
@@ -49063,8 +49404,8 @@ function setClustNodes(root) {
|
|
|
49063
49404
|
function syncCoordFromPos(cg) {
|
|
49064
49405
|
for (const n of cg.nodes.values()) {
|
|
49065
49406
|
n.info.coord = {
|
|
49066
|
-
x:
|
|
49067
|
-
y:
|
|
49407
|
+
x: POINTS_PER_INCH12 * n.info.pos[0],
|
|
49408
|
+
y: POINTS_PER_INCH12 * n.info.pos[1]
|
|
49068
49409
|
};
|
|
49069
49410
|
}
|
|
49070
49411
|
}
|
|
@@ -49076,8 +49417,8 @@ function expandComponentClusters(cg, infop, counter) {
|
|
|
49076
49417
|
if (r !== 0) return r;
|
|
49077
49418
|
n.info.width = gdata(sg).bb.ur.x;
|
|
49078
49419
|
n.info.height = gdata(sg).bb.ur.y;
|
|
49079
|
-
const ptx =
|
|
49080
|
-
const pty =
|
|
49420
|
+
const ptx = POINTS_PER_INCH12 * gdata(sg).bb.ur.x;
|
|
49421
|
+
const pty = POINTS_PER_INCH12 * gdata(sg).bb.ur.y;
|
|
49081
49422
|
n.info.rw = n.info.lw = ptx / 2;
|
|
49082
49423
|
n.info.ht = pty;
|
|
49083
49424
|
} else if (isPort(n)) {
|
|
@@ -50727,6 +51068,9 @@ function circoLayoutFull(g) {
|
|
|
50727
51068
|
gvPostprocess(g);
|
|
50728
51069
|
}
|
|
50729
51070
|
function circoCleanup(g) {
|
|
51071
|
+
if (g.nodes.size === 0) return;
|
|
51072
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
51073
|
+
for (const n of g.nodes.values()) gvCleanupNodeLabels(n);
|
|
50730
51074
|
g.info.alg = void 0;
|
|
50731
51075
|
g.info.neato_nlist = void 0;
|
|
50732
51076
|
}
|
|
@@ -50777,7 +51121,7 @@ function PARENT(n) {
|
|
|
50777
51121
|
function isCluster(g) {
|
|
50778
51122
|
if (g === g.root) return true;
|
|
50779
51123
|
if (g.name.toLowerCase().startsWith("cluster")) return true;
|
|
50780
|
-
return
|
|
51124
|
+
return mapbool(g.attrs.get("cluster"));
|
|
50781
51125
|
}
|
|
50782
51126
|
function clusterInitGraph(g) {
|
|
50783
51127
|
graphInit(g, false);
|
|
@@ -51014,11 +51358,17 @@ function osageLayout(g) {
|
|
|
51014
51358
|
}
|
|
51015
51359
|
function cleanupGraphs(g) {
|
|
51016
51360
|
const nClust = g.info.n_cluster ?? 0;
|
|
51017
|
-
for (let i = 1; i <= nClust; i++)
|
|
51361
|
+
for (let i = 1; i <= nClust; i++) {
|
|
51362
|
+
const subg = g.info.clust[i - 1];
|
|
51363
|
+
subg.info.label = void 0;
|
|
51364
|
+
cleanupGraphs(subg);
|
|
51365
|
+
}
|
|
51018
51366
|
g.info.clust = void 0;
|
|
51019
51367
|
g.info.n_cluster = void 0;
|
|
51020
51368
|
}
|
|
51021
51369
|
function osageCleanup(g) {
|
|
51370
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
51371
|
+
for (const n of g.nodes.values()) gvCleanupNodeLabels(n);
|
|
51022
51372
|
for (const n of g.nodes.values()) {
|
|
51023
51373
|
if (n.info.alg?.kind === "osage") n.info.alg = void 0;
|
|
51024
51374
|
}
|
|
@@ -51304,7 +51654,7 @@ function walkTree(tree) {
|
|
|
51304
51654
|
function isCluster2(g) {
|
|
51305
51655
|
if (g === g.root) return true;
|
|
51306
51656
|
if (g.name.toLowerCase().startsWith("cluster")) return true;
|
|
51307
|
-
return
|
|
51657
|
+
return mapbool(g.attrs.get("cluster"));
|
|
51308
51658
|
}
|
|
51309
51659
|
function collectClusters2(g, clusters) {
|
|
51310
51660
|
for (const subg of g.subgraphs.values()) {
|
|
@@ -51369,6 +51719,9 @@ function patchworkEngineLayout(g) {
|
|
|
51369
51719
|
gvPostprocess(g);
|
|
51370
51720
|
}
|
|
51371
51721
|
function patchworkEngineCleanup(g) {
|
|
51722
|
+
if (g.nodes.size === 0) return;
|
|
51723
|
+
for (const e of g.edges) gvCleanupEdgeLabels(e);
|
|
51724
|
+
for (const n of g.nodes.values()) gvCleanupNodeLabels(n);
|
|
51372
51725
|
g.info.clust = void 0;
|
|
51373
51726
|
g.info.n_cluster = void 0;
|
|
51374
51727
|
for (const n of g.nodes.values()) {
|
|
@@ -51384,7 +51737,7 @@ var PATCHWORK_LAYOUT_ENGINE = {
|
|
|
51384
51737
|
// src/gvc/edge-labels.ts
|
|
51385
51738
|
function renderEdgeLabels(e, renderer, job) {
|
|
51386
51739
|
const obj = job.obj;
|
|
51387
|
-
const spl =
|
|
51740
|
+
const spl = mapbool(e.attrs.get("decorate") ?? "false") ? e.info.spl : void 0;
|
|
51388
51741
|
if (obj === null) {
|
|
51389
51742
|
renderOneLabel(e.info.label, renderer, job);
|
|
51390
51743
|
if (spl) emitAttachment(e.info.label, spl, renderer, job);
|
|
@@ -52068,7 +52421,7 @@ var PlainExtRenderer = class {
|
|
|
52068
52421
|
}
|
|
52069
52422
|
};
|
|
52070
52423
|
function mapGraphName(g) {
|
|
52071
|
-
return g
|
|
52424
|
+
return agNameOf(g);
|
|
52072
52425
|
}
|
|
52073
52426
|
function graphAttr2(g, key) {
|
|
52074
52427
|
for (let s = g; s !== null; s = s.parent) {
|
|
@@ -52084,7 +52437,7 @@ function graphMapUrl(g) {
|
|
|
52084
52437
|
function buildMapCtx(g, job, mapPolygon) {
|
|
52085
52438
|
const drawingDpi = lateDouble(g.attrs.get("dpi"), lateDouble(g.attrs.get("resolution"), 0, 0), 0);
|
|
52086
52439
|
const mapDpi = drawingDpi > 0 ? drawingDpi : 96;
|
|
52087
|
-
const devscale = mapDpi /
|
|
52440
|
+
const devscale = mapDpi / POINTS_PER_INCH2;
|
|
52088
52441
|
const z = initJobViewportZoom(job.bb, parseDrawingSize(g.attrs.get("size")), job.pad);
|
|
52089
52442
|
const marginOff = { x: job.margin.x * devscale, y: job.margin.y * devscale };
|
|
52090
52443
|
return { bb: job.bb, pad: job.pad, scale: z * devscale, marginOff, mapPolygon };
|
|
@@ -52570,8 +52923,8 @@ function graphLabelAttrs(g) {
|
|
|
52570
52923
|
}
|
|
52571
52924
|
return [
|
|
52572
52925
|
'lp="' + lpStr(label.pos) + '"',
|
|
52573
|
-
"lwidth=" + gfmt2(label.dimen.x /
|
|
52574
|
-
"lheight=" + gfmt2(label.dimen.y /
|
|
52926
|
+
"lwidth=" + gfmt2(label.dimen.x / POINTS_PER_INCH2),
|
|
52927
|
+
"lheight=" + gfmt2(label.dimen.y / POINTS_PER_INCH2)
|
|
52575
52928
|
];
|
|
52576
52929
|
}
|
|
52577
52930
|
function edgePosRaw(e) {
|
|
@@ -53397,6 +53750,18 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
53397
53750
|
const buf = this.getBuf(job);
|
|
53398
53751
|
buf.push(this.styleOp(job), this.penOp(job), xdotPoints("L", pts));
|
|
53399
53752
|
}
|
|
53753
|
+
/**
|
|
53754
|
+
* The `I` op: `x y w h` of the box, then the image name as an xdot string.
|
|
53755
|
+
* @see plugin/core/gvrender_core_dot.c:core_loadimage_xdot
|
|
53756
|
+
*/
|
|
53757
|
+
usershape(src, b, job) {
|
|
53758
|
+
this.getBuf(job).push(
|
|
53759
|
+
"I ",
|
|
53760
|
+
xdotPoint(b.ll),
|
|
53761
|
+
xdotNum(b.ur.x - b.ll.x) + " " + xdotNum(b.ur.y - b.ll.y) + " ",
|
|
53762
|
+
xdotStrOp("", src)
|
|
53763
|
+
);
|
|
53764
|
+
}
|
|
53400
53765
|
// --- graphics-state ops ------------------------------------------------
|
|
53401
53766
|
/** Pen color op from the resolved graphics state (default black). */
|
|
53402
53767
|
penOp(job) {
|
|
@@ -53484,6 +53849,9 @@ var DotRenderer = class extends XdotRenderer {
|
|
|
53484
53849
|
}
|
|
53485
53850
|
polyline(_pts, _job) {
|
|
53486
53851
|
}
|
|
53852
|
+
/** No loadimage engine for "dot" (only "<type>:xdot"). */
|
|
53853
|
+
usershape(_src, _b, _job) {
|
|
53854
|
+
}
|
|
53487
53855
|
};
|
|
53488
53856
|
function createDotRenderer() {
|
|
53489
53857
|
return new DotRenderer();
|
|
@@ -58603,8 +58971,8 @@ function latin1Reencode(s) {
|
|
|
58603
58971
|
for (const b of bytes) out += String.fromCharCode(b);
|
|
58604
58972
|
return out;
|
|
58605
58973
|
}
|
|
58606
|
-
function buildJson(g, doXDot) {
|
|
58607
|
-
const draws = doXDot ? collectDrawLookup(g) : void 0;
|
|
58974
|
+
function buildJson(g, doXDot, preDraws) {
|
|
58975
|
+
const draws = doXDot ? preDraws ?? collectDrawLookup(g) : void 0;
|
|
58608
58976
|
const ctx = assignIds(g, doXDot, draws);
|
|
58609
58977
|
const root = buildGraphObject(g, true, ctx);
|
|
58610
58978
|
return JSON.stringify(root, null, 2) + "\n";
|
|
@@ -58641,10 +59009,15 @@ var JsonRenderer = class {
|
|
|
58641
59009
|
type = "json";
|
|
58642
59010
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
58643
59011
|
quality = 0;
|
|
58644
|
-
|
|
59012
|
+
draws;
|
|
59013
|
+
// set by beginGraph, cleared by endGraph
|
|
59014
|
+
/** @see plugin/core/gvrender_core_json.c:json_begin_graph */
|
|
59015
|
+
beginGraph(g, _job) {
|
|
59016
|
+
this.draws = collectDrawLookup(g);
|
|
58645
59017
|
}
|
|
58646
59018
|
endGraph(g, job) {
|
|
58647
|
-
job.write(buildJson(g, true));
|
|
59019
|
+
job.write(buildJson(g, true, this.draws));
|
|
59020
|
+
this.draws = void 0;
|
|
58648
59021
|
}
|
|
58649
59022
|
beginNode(_n, _job) {
|
|
58650
59023
|
}
|