Update DxfRenderer.IProjectExporter.cs
This commit is contained in:
Родитель
9464b8982e
Коммит
237f225c11
|
@ -17,6 +17,11 @@ internal class DxfExportPresenter : IContainerPresenter
|
|||
{
|
||||
public void Render(object? dc, IShapeRenderer? renderer, ISelection? selection, FrameContainerViewModel? container, double dx, double dy)
|
||||
{
|
||||
if (dc is null || renderer?.State is null || container is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var flags = renderer.State.DrawShapeState;
|
||||
|
||||
renderer.State.DrawShapeState = ShapeStateFlags.Printable;
|
||||
|
@ -28,10 +33,11 @@ internal class DxfExportPresenter : IContainerPresenter
|
|||
}
|
||||
|
||||
DrawContainer(dc, renderer, selection, container);
|
||||
|
||||
renderer.State.DrawShapeState = flags;
|
||||
}
|
||||
|
||||
private void DrawContainer(object dc, IShapeRenderer renderer, ISelection selection, FrameContainerViewModel container)
|
||||
private void DrawContainer(object dc, IShapeRenderer renderer, ISelection? selection, FrameContainerViewModel container)
|
||||
{
|
||||
if (dc is not DXF.DxfDocument dxf)
|
||||
{
|
||||
|
@ -56,8 +62,13 @@ internal class DxfExportPresenter : IContainerPresenter
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawLayer(object dc, IShapeRenderer renderer, ISelection selection, LayerContainerViewModel layer)
|
||||
private void DrawLayer(object dc, IShapeRenderer renderer, ISelection? selection, LayerContainerViewModel layer)
|
||||
{
|
||||
if (renderer.State is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var shape in layer.Shapes)
|
||||
{
|
||||
if (shape.State.HasFlag(renderer.State.DrawShapeState))
|
||||
|
@ -145,10 +156,13 @@ public partial class DxfRenderer : IProjectExporter
|
|||
{
|
||||
var dataFlow = ServiceProvider.GetService<DataFlow>();
|
||||
var db = (object)container.Properties;
|
||||
var record = (object)container.Record;
|
||||
var record = (object?)container.Record;
|
||||
|
||||
dataFlow.Bind(container.Template, db, record);
|
||||
dataFlow.Bind(container, db, record);
|
||||
if (dataFlow is { })
|
||||
{
|
||||
dataFlow.Bind(container.Template, db, record);
|
||||
dataFlow.Bind(container, db, record);
|
||||
}
|
||||
|
||||
if (container.Template is { })
|
||||
{
|
||||
|
@ -168,18 +182,29 @@ public partial class DxfRenderer : IProjectExporter
|
|||
{
|
||||
foreach (var page in document.Pages)
|
||||
{
|
||||
if (page.Template is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var name = page.Template.Name;
|
||||
var width = page.Template.Width;
|
||||
var height = page.Template.Height;
|
||||
|
||||
var layout = new DXFO.Layout(page.Name)
|
||||
{
|
||||
PlotSettings = new DXFO.PlotSettings()
|
||||
|
||||
PlotSettings = new DXFO.PlotSettings
|
||||
{
|
||||
PaperSizeName = $"{page.Template.Name}_({page.Template.Width}_x_{page.Template.Height}_MM)",
|
||||
PaperSizeName = $"{name}_({width}_x_{height}_MM)",
|
||||
PaperMargin = new DXFO.PaperMargin(0, 0, 0, 0),
|
||||
PaperSize = new DXF.Vector2(page.Template.Width, page.Template.Height),
|
||||
PaperSize = new DXF.Vector2(width, height),
|
||||
Origin = new DXF.Vector2(0.0, 0.0),
|
||||
PaperUnits = DXFO.PlotPaperUnits.Milimeters,
|
||||
PaperRotation = DXFO.PlotRotation.NoRotation
|
||||
}
|
||||
};
|
||||
|
||||
dxf.Layouts.Add(layout);
|
||||
dxf.ActiveLayout = layout.Name;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче