bamaer commented on code in PR #9489:
URL: https://github.com/apache/hop/pull/9489#discussion_r4573970080
##########
engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java:
##########
@@ -78,11 +83,36 @@ public static final String generatePipelineSvg(
false,
null,
new HashMap<>());
- pipelinePainter.setMagnification(magnification);
+ pipelinePainter.setMagnification(mag);
+
+ SvgExportCanvas.Bounds bounds = new SvgExportCanvas.Bounds();
+ for (TransformMeta transform : pipelineMeta.getTransforms()) {
+ SvgExportCanvas.includeNode(
+ bounds,
+ gc,
+ transform.getLocation(),
+ transform.getName(),
+ !Utils.isEmpty(transform.getDescription()),
+ SvgExportCanvas.ICON_SIZE);
Review Comment:
**Blocker:** `PipelinePainter.drawTransform` paints two things outside the
icon and label that these bounds don't include:
- the partitioning box and the schema name under it, 1.5 icons left of the
icon and 2 icons above it
- the `xN` copies label, just above and to the left of the icon
With a partitioned transform in the top row, the export shows only the
magenta connector line; main shows the `Px2` / schema box. The copies label
ends up right on the top edge.
Including both in the bounds fixes it (tried locally; the new tests still
pass):
```java
Point loc = transform.getLocation() == null ? new Point(50, 50) :
transform.getLocation();
int icon = SvgExportCanvas.ICON_SIZE;
gc.setFont(IGc.EFont.GRAPH);
PartitionSchema schema =
transform.isPartitioned() ?
transform.getTransformPartitioningMeta().getPartitionSchema() : null;
if (schema != null) {
String count =
schema.isDynamicallyDefined()
? Const.NVL(schema.getNumberOfPartitions(), "?")
: String.valueOf(schema.getPartitionIDs().size());
Point box = gc.textExtent("Px" + count);
Point name = gc.textExtent(Const.NVL(schema.getName(), "<no partition
name>"));
bounds.include(
loc.x - icon - icon / 2, loc.y - 2 * icon, Math.max(box.x + 2,
name.x), box.y + 5 + name.y);
} else if (!"1".equals(transform.getCopiesString())) {
Point copies = gc.textExtent("x" + transform.getCopiesString());
bounds.include(loc.x - copies.x + 1, loc.y - copies.y - 4, copies.x,
copies.y);
}
```
A partitioned transform in `SvgDiagramExportTest` would cover it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]