Table of Contents

Class Layout

Namespace
CADability
Assembly
CADability.dll

A Layout defines the placement of one or more patches on a paper. A patch is the projection of a model into the two dimensional space with respect to scaling, projection direction, visibility of layers etc. A Layout can be viewed with the LayoutView and can be printed.

public class Layout : ISerializable
Inheritance
Layout
Implements
Inherited Members

Constructors

Layout(Project)

Creates an empty Layout

public Layout(Project project)

Parameters

project Project

The Project containing the layout

Layout(SerializationInfo, StreamingContext)

Constructor for the legacy binary deserialization (ISerializable): restores the name, the patches, the paper size and the page settings. The project is set by the Project that contains the layout.

protected Layout(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The serialized data

context StreamingContext

The source of the deserialization

Fields

pageSettings

The printer settings. Not used by CADability any more and not saved; see PageSetup.

[Obsolete("Use PageSetup. The GDI+ PageSettings cannot be saved on .NET Core (issue #412).")]
public PageSettings pageSettings

Field Value

PageSettings

Properties

Name

Gets or sets the name of the layout.

public string Name { get; set; }

Property Value

string

PageSetup

The page settings of this layout for printing, saved with the layout. Null if the layout has none: then the page settings of the project (DefaultPageSetup) are used.

public PageSetup PageSetup { get; set; }

Property Value

PageSetup

PaperHeight

Gets or sets the height of the total layout area. When printing the layout this is assumed to be in mm

public double PaperHeight { get; set; }

Property Value

double

PaperWidth

Gets or sets the width of the total layout area. When printing the layout this is assumed to be in mm

public double PaperWidth { get; set; }

Property Value

double

PatchCount

Returns the number of the patches

public int PatchCount { get; }

Property Value

int

Methods

AddPatch(Model, Projection, Border)

Adds a "patch" to the layout. A patch is a a model with a certain projection placed on a section of the layout. The projection includes the placement of the model inside the section and the scaling.

public void AddPatch(Model model, Projection projection, Border area)

Parameters

model Model

The model for the patch

projection Projection

the projection for the model

area Border

The area on the layout

AddPatch(Model, Projection, Border, LayoutView)

Adds a patch to the layout like AddPatch(Model, Projection, Border) (all layers of the project visible) and connects it to a LayoutView that is currently showing this layout, so that the new patch appears in the property page of that view.

public void AddPatch(Model model, Projection projection, Border area, LayoutView layoutView)

Parameters

model Model

The model for the patch

projection Projection

The projection for the model, including the scaling and the placement on the paper

area Border

The area on the paper to which the patch is clipped, null for the whole paper

layoutView LayoutView

The view to connect the patch with, may be null

AddVisibleLayer(int, Layer)

Marks the given Layer as visible in the context of this ProjectedModel.

public void AddVisibleLayer(int index, Layer l)

Parameters

index int

Index of the patch in the list of patches of this layout

l Layer

The layer

CenterPatch(int, double, HorizontalCenter, VerticalCenter)

Centers the patch with the given index according to the horizontal and vertical center mode. If scale is 0.0 the current scaling remains unchanged.

public void CenterPatch(int index, double scale, Layout.HorizontalCenter hor, Layout.VerticalCenter ver)

Parameters

index int

index of the patch

scale double

scaling factor or 0.0

hor Layout.HorizontalCenter

horizontal position mode

ver Layout.VerticalCenter

vertical position mode

~Layout()

Finalizer without effect; the layout does not own unmanaged resources.

protected ~Layout()

GetPatch(int, out Model, out Projection, out Border)

Returns the data that describe the patch with the given index.

public void GetPatch(int index, out Model model, out Projection projection, out Border area)

Parameters

index int

Index of the patch

model Model

The model for the patch

projection Projection

the projection for the model

area Border

The area on the layout

IsLayerVisible(int, Layer)

Determins whether the given Layer is marked visible in the context of this ProjectedModel.

public bool IsLayerVisible(int index, Layer l)

Parameters

index int

Index of the patch in the list of patches of this layout

l Layer

The layer

Returns

bool

MovePatch(int, double, double)

Places the patch on the paper leaving the scalinfactor unchanged. The parameters specify the position of the model origin on the paper.

public void MovePatch(int index, double xPos, double yPos)

Parameters

index int

Index of the patch in the list of patches of this layout

xPos double

horizontal position of the origin

yPos double

vertical position of the origin

RemovePatch(int)

Removes the patch with the given index

public void RemovePatch(int index)

Parameters

index int

RemoveVisibleLayer(int, Layer)

Marks the given Layer as invisible in the context of this ProjectedModel.

public void RemoveVisibleLayer(int index, Layer l)

Parameters

index int

Index of the patch in the list of patches of this layout

l Layer

The layer

SetPatch(int, Model, Projection, Border)

Changes the data of the patch with the given index.

public void SetPatch(int index, Model model, Projection projection, Border area)

Parameters

index int

Index of the patch

model Model

The model for the patch

projection Projection

the projection for the model

area Border

The area on the layout