缩放 PlantUML 图的一部分



缩放由scale关键字控制。 我很好奇是否可以以某种方式或至少缩放 PlantUML 图的一部分:缩放图表部分的字体大小。

似乎scale的范围可能不仅限于图表的一部分(而且我没有找到任何表明这是可能的示例(。 可以想象,它可能以下列方式使用,但此示例缩放了整个图像:

@startuml
package "Some Group" {
scale 0.5
HTTP - [First Component]
[Another Component]
}
node "Other Groups" {
FTP - [Second Component]
[First Component] --> FTP
} 
@enduml

我认为目前没有办法实现它。从 PlantUMLscale命令的源代码中:

protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
double scale = Double.parseDouble(arg.get("SCALE", 0));
if (scale == 0) {
return CommandExecutionResult.error("Scale cannot be zero");
}
if (arg.get("DIV", 0) != null) {
final double div = Double.parseDouble(arg.get("DIV", 0));
if (div == 0) {
return CommandExecutionResult.error("Scale cannot be zero");
}
scale /= div;
}
diagram.setScale(new ScaleSimple(scale));
return CommandExecutionResult.ok();
}

不使用scale的位置,PlantUML 只是通过diagram.setScale(new ScaleSimple(scale))设置图表的scale

您可以通过以下方式验证此类操作:

@startuml

package "Some Group" {
scale 0.5
HTTP - [First Component]
[Another Component]
}
node "Other Groups" {
scale 5
FTP - [Second Component]
[First Component] --> FTP
}
@enduml

scale 0.5scale 5命令覆盖。

最新更新