57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package geagle
|
|
|
|
// An abstract Point
|
|
type Point struct {
|
|
X float32 `xml:"x,attr"`
|
|
Y float32 `xml:"y,attr"`
|
|
}
|
|
|
|
// An abstract line
|
|
type Line struct {
|
|
X1 float32 `xml:"x1,attr"`
|
|
X2 float32 `xml:"x2,attr"`
|
|
Y1 float32 `xml:"y1,attr"`
|
|
Y2 float32 `xml:"y2,attr"`
|
|
}
|
|
|
|
// A Wire (line with thickness)
|
|
type Wire struct {
|
|
Line
|
|
Width float32 `xml:"width,attr"`
|
|
Layer int `xml:"layer,attr"`
|
|
Curve float64 `xml:"curve,attr,omitempty"`
|
|
Cap string `xml:"cap,attr,omitempty"`
|
|
}
|
|
|
|
// A text field
|
|
type Text struct {
|
|
Point
|
|
Size float32 `xml:"size,attr"`
|
|
Layer int `xml:"layer,attr"`
|
|
Alignment string `xml:"align,attr,omitempty"`
|
|
Ratio int `xml:"ratio,attr,omitempty"`
|
|
Text string `xml:",innerxml"`
|
|
}
|
|
|
|
// A circle
|
|
type Circle struct {
|
|
Point
|
|
Radius float32 `xml:"radius,attr"`
|
|
Width float32 `xml:"width,attr"`
|
|
Layer int `xml:"layer,attr"`
|
|
}
|
|
|
|
// A rectangle with two corner-points
|
|
type Rectangle struct {
|
|
Line
|
|
Layer int `xml:"layer,attr"`
|
|
}
|
|
|
|
// bundles all geometry shapes
|
|
type Primitives struct {
|
|
Wires []Wire `xml:"wire"`
|
|
Circles []Circle `xml:"circle"`
|
|
Texts []Text `xml:"text"`
|
|
Rectangle []Rectangle `xml:"rectangle"`
|
|
}
|