2017-12-21 17:18:29 +00:00
|
|
|
// Copyright 2015 The draw2d Authors. All rights reserved.
|
|
|
|
// created: 16/12/2017 by Drahoslav Bednář
|
2017-12-22 08:59:31 +00:00
|
|
|
|
2017-12-21 17:18:29 +00:00
|
|
|
package draw2dsvg
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
)
|
|
|
|
|
2017-12-22 21:40:56 +00:00
|
|
|
/* svg elements */
|
|
|
|
|
2017-12-21 17:18:29 +00:00
|
|
|
type Svg struct {
|
|
|
|
XMLName xml.Name `xml:"svg"`
|
2017-12-24 13:46:58 +00:00
|
|
|
Xmlns string `xml:"xmlns,attr"`
|
2017-12-26 18:38:19 +00:00
|
|
|
Groups []*Group `xml:"g"`
|
2017-12-24 14:31:09 +00:00
|
|
|
FillStroke
|
2017-12-21 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Group struct {
|
2017-12-22 21:40:56 +00:00
|
|
|
FillStroke
|
2017-12-26 18:38:19 +00:00
|
|
|
Transform string `xml:"transform,attr,omitempty"`
|
|
|
|
Groups []*Group `xml:"g"`
|
|
|
|
Paths []*Path `xml:"path"`
|
|
|
|
Texts []*Text `xml:"text"`
|
2017-12-21 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Path struct {
|
2017-12-22 21:40:56 +00:00
|
|
|
FillStroke
|
|
|
|
Desc string `xml:"d,attr"`
|
2017-12-21 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Text struct {
|
2017-12-22 21:40:56 +00:00
|
|
|
FillStroke
|
2017-12-26 18:38:19 +00:00
|
|
|
Position
|
2017-12-26 18:52:06 +00:00
|
|
|
FontSize float64 `xml:"font-size,attr,omitempty"`
|
|
|
|
FontFamily string `xml:"font-family,attr,omitempty"`
|
|
|
|
Text string `xml:",innerxml"`
|
|
|
|
Style string `xml:"style,attr,omitempty"`
|
2017-12-22 21:40:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* shared attrs */
|
|
|
|
|
2017-12-26 18:38:19 +00:00
|
|
|
type Position struct {
|
|
|
|
X float64 `xml:"x,attr,omitempty"`
|
|
|
|
Y float64 `xml:"y,attr,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-12-22 21:40:56 +00:00
|
|
|
type FillStroke struct {
|
2017-12-24 15:05:15 +00:00
|
|
|
Fill string `xml:"fill,attr,omitempty"`
|
|
|
|
FillRule string `xml:"fill-rule,attr,omitempty"`
|
|
|
|
|
2017-12-24 13:46:58 +00:00
|
|
|
Stroke string `xml:"stroke,attr,omitempty"`
|
|
|
|
StrokeWidth string `xml:"stroke-width,attr,omitempty"`
|
|
|
|
StrokeLinecap string `xml:"stroke-linecap,attr,omitempty"`
|
|
|
|
StrokeLinejoin string `xml:"stroke-linejoin,attr,omitempty"`
|
|
|
|
StrokeDasharray string `xml:"stroke-dasharray,attr,omitempty"`
|
|
|
|
StrokeDashoffset string `xml:"stroke-dashoffset,attr,omitempty"`
|
|
|
|
}
|