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
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
infoSerializationInfoThe serialized data
contextStreamingContextThe 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
Properties
Name
Gets or sets the name of the layout.
public string Name { get; set; }
Property Value
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
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
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
PatchCount
Returns the number of the patches
public int PatchCount { get; }
Property Value
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
modelModelThe model for the patch
projectionProjectionthe projection for the model
areaBorderThe 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
modelModelThe model for the patch
projectionProjectionThe projection for the model, including the scaling and the placement on the paper
areaBorderThe area on the paper to which the patch is clipped, null for the whole paper
layoutViewLayoutViewThe 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
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
indexintindex of the patch
scaledoublescaling factor or 0.0
horLayout.HorizontalCenterhorizontal position mode
verLayout.VerticalCentervertical 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
indexintIndex of the patch
modelModelThe model for the patch
projectionProjectionthe projection for the model
areaBorderThe 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
Returns
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
indexintIndex of the patch in the list of patches of this layout
xPosdoublehorizontal position of the origin
yPosdoublevertical position of the origin
RemovePatch(int)
Removes the patch with the given index
public void RemovePatch(int index)
Parameters
indexint
RemoveVisibleLayer(int, Layer)
Marks the given Layer as invisible in the context of this ProjectedModel.
public void RemoveVisibleLayer(int index, Layer l)
Parameters
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
indexintIndex of the patch
modelModelThe model for the patch
projectionProjectionthe projection for the model
areaBorderThe area on the layout