语境
我正在尝试将 DGML 图转换为 SVG。我正在使用 Javascript使用 Jquery读取和解析 DGML节点和链接。我使用 Visual Studio 2017 创建了一个 DGML 图(它有一个交互式内置编辑器)。本质上,我需要在 DGML 图上的节点位置和生成的 SVG 之间创建映射。我已经设法对节点和链接的每个属性进行转换,除了一个名为Bounds的属性
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="Node1" Background="#FF000000" Bounds="289.142857142857,-914.285714285714,56.9200000000001,25.96" Label="node 1" UseManualLocation="True" />
<Node Id="Node2" Bounds="-99.1466388157435,-813.468571428572,56.9200000000001,25.96" Label="node 2" UseManualLocation="True" />
<Node Id="Node3" Bounds="165.353095238095,-821.948571428572,56.9200000000001,25.96" Label="node 3" UseManualLocation="True" />
<Node Id="Node4" Bounds="231.884895804269,-672.637129778181,56.92,25.96" Label="node 4" UseManualLocation="True" />
<Node Id="Node5" Bounds="126.293653230212,-514.368957318116,56.9200000000001,25.96" Label="node 5" UseManualLocation="True" />
<Node Id="Node6" Bounds="513.21231765747,-699.551714460973,56.9200000000001,25.96" Label="node 6" UseManualLocation="True" />
</Nodes>
<Links>
<Link Source="Node1" Target="Node2" Bounds="-33.5154810441621,-893.916239433358,322.658338187019,83.7763765262094" />
<Link Source="Node1" Target="Node3" Bounds="218.428553771979,-888.325714285714,81.7729515442388,60.9960031621974" />
<Link Source="Node2" Target="Node4" Bounds="-42.8686314368827,-788.653915128306,267.113829712029,113.638782142621" />
<Link Source="Node2" Target="Node5" Bounds="-60.9032254171191,-787.508586425781,200.456326731834,265.952512098603" />
<Link Source="Node3" Target="Node4" Bounds="199.596870550233,-795.988597412109,51.3011424145167,115.130629087374" />
<Link Source="Node4" Target="Node5" Bounds="168.40836594804,-646.677165527344,83.2767077301747,124.821483021298" />
<Link Source="Node4" Target="Node6" Bounds="288.80489440918,-682.991837277453,215.448314485295,20.6119078319973" />
<Link Source="Node6" Target="Node1" Bounds="337.645038336076,-882.098554229514,190.482965266866,182.54683792092" />
</Links>
<Properties>
<Property Id="Background" Label="Background" Description="The background color" DataType="System.Windows.Media.Brush" />
<Property Id="Bounds" DataType="System.Windows.Rect" />
<Property Id="Label" Label="Label" Description="Displayable label of an Annotatable object" DataType="System.String" />
<Property Id="UseManualLocation" DataType="System.Boolean" />
</Properties>
</DirectedGraph>
我在“Bounds”的属性标记中看到数据类型System.Windows.Rect
具有构造函数Rect(Double, Double, Double, Double)
- 初始化具有指定 x 坐标、y 坐标、宽度和高度的 Rect 结构的新实例。
https://msdn.microsoft.com/en-us/library/system.windows.rect(v=vs.110).aspx
由于所有节点的大小都相同,因此假设最后两个参数是宽度和高度并没有错。
问题
DGML的图形坐标系是如何定位的?例如,一个 SVG 图形像大多数 CG 坐标一样开始,左上角原点;正 X 向右,正 Y 向下。我在 DGML 参考资料上找不到任何相关信息
https://docs.microsoft.com/en-us/visualstudio/modeling/directed-graph-markup-language-dgml-reference