## Improvements not contained in the new concept

"New layout" templates and wizards. (instead of defaulting to 4x4 8-layer)

Ability to hook into layer exporters (i.e. thindraw as a HID)

Also, trim polygons against "outline" layer. Fix polygons in general.

# New concept proposal

## Old concept

There are "Layer groups" which contain "conductive layers". One "Layer group" is actually one "physical layer". There is max 10 layer groups. Number of layers is 16 + 2 silk screen layers. Layers have no "type".

`Layer group:
Number
Numbers of layers contained
Layer:
Name
Contained lines, arcs, polygons,...
Rtree of contained ^^^^
Visibility flag
Color
Selected color
Attributes
`

## New concept

In the next part terms "physical layer" and "layer" are used. It can be changed to better names. Having just "layer" for "physical layer" and something else for "layer" will be great. Would "surface" go? Layer for one layer on PCB and surface for one drawing surface.

Layers are contained in a linked list, so there is no bounds on the number of them. "Physical layers" should probably be also in a linked list.

The Z-order of "physical layers" and "layers" is determined by the order in linked list and in layout file.

Active "layer" of each type is represented as pointer in "physical layer". There is an array of size "number of layer types", pointer on right place is the active layer. There is no need to have an active layer of each type.

One "physical layer" can be marked as "top" and one as "bottom", so new footprints have some default layers assignment. This marks are useful just for footprint importing, there is no other use for them.

When adding anything (components, lines, polygons), all parts goes to the active layer of the right type for current "physical layer". So line is added to active "conductive layer", its mask to active "mask layer",.... If there is no such layer, nothing happens. If the current layer is not conductive, something else can happen. Like adding polygon to "mask layer" will just mask/unmask that part....

There are two types of colors. The ones defined in application preferences and the ones defined in layout file. User can select to see any of the sets.

Colors in preferences are assigned to layer names, not layer numbers.

There is no concept of "layer number" everything is referred by name or pointer.

Each "physical layer" has Dimension property and can also have an Outline layer. The difference is, that NOTHING can be drawn out of dimension. The Outline is just hint how to manufactor the board. The Dimension is just one rectangle, Outline can have any shape. This Dimension property should replace the "Board dimension" currently defined in preferences.

Gerber output names will contain "physical layer" name.

The "Show Pin/Pads/Vias" flags in "Physical layer" is just inspecting and printing use. It doesn't hurt to have and can aid documentation generation.

`Physical layer:
Name <- this will be used in gerber export
Dimentions <- layer doesn't have to be across whole board
Attributes <- we can come up with a list of "expected attributes" like "permittivity, thickness,.."
Flags <- some "physical layer" wide flags
Layers <- linked list of layers in this "physical layer"
Pointer to layers <- linked list of all layers in this physical layer
Array of pointers to "active layers"
Layer:
Name
Placement list <- Contained lines, arcs, polygons,...
Rtree of contained ^^^^
Flag <- flags described below
Type <- type list below
Color
Attributes
Pointer for linked list of "layers"
Pointer for linked list contained in "physical layer"
Layer types:
Conductive <- the only conductive layer
Mechanical <- some additional non-conductive stuff
Outline <- outline of board
Silk <- Texts, component oulines,...
Mask <- mask on the board
Paste <- solder paste definition
Countryard <- component spacing definition
Rat
Physical layer flags:
Show Pin/Via/Pads <- Show/Hide Pin/Via/Pads, 3 separate flags -- NOT SAVED, the one in "Layer" is saved
Layer flags:
Visible <- Show/Hide this layer -- just temporal use, NOT SAVED
Show Pin/Via/Pads <- 3 separate flags, On some layers for special purpose it make sense to not include Via/Pin/Pads
Negativness <- Layer is negative layer
`

## Object & Placements

Each object is composed of 2 parts. One is 'description of the object'. This is specific for the type of the object.

The other is 'placement of the object'. This is common to all object.

It is possible to have more than one placement of single object.

There are 'shared copy' and 'copy on write' possibilities.

`Placement object:
Coordinates
Layer
Flags
ReferenceCounter
Pointer to the object
Pointer to composite <- when I am at some composite
Pointer to next object <- next object in the composite
Placement flags:
Orientation
CopyOnWrite
`

## Composite objects

Composite is an object composed of multiple other object. Composite can be an element of another composite.

Footprints, sub-layouts and vias are just composite objects.

All elements of composite object has placement relative to the origin of the composite.

`Composite object:
Type <- type list below
Attributes
Linked list of placement objects
Composite types:
Footprint
Via
SubCircut
Other
`

### Via

Via is a composite object of type 'via'.

There is a copper object around the hole on each 'physical layer' it intersects.

The hole is represented as an object on 'outline' layer on each 'physical layer' it intersects.

### Footprint

Footprint is a composite object of type 'footprint'.

It has attributes Name and Sourcefile.

Expected properties:

1. Footprint contains layers with predefined names: Conductive, Silkscreen, Paste, Mask, Countryard
2. Footprint can contain more conductive layers, each grouped with Paste and Mask layers <- useful for 2 sides mounting connectors
3. Any connected element on conductive layer can be marked as Pin/Pad
4. Footprint can contain Outline layer

## Named attributes

This is just my personal "To look at" section. -- Martin Kupec
Refdefs should be distinguishable from the rest of Silk so they can be put on different Silk Layer.