-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.go
More file actions
213 lines (190 loc) · 10.9 KB
/
Copy pathmodels.go
File metadata and controls
213 lines (190 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package main
// --- Template Structs ---
// Added: Global layout configurations
type LayoutOptions struct {
Padding float64 `json:"padding"` // Overall padding around the timeline content
EntrySpacing float64 `json:"entry_spacing"` // Default spacing between entry centers
ConnectorLength float64 `json:"connector_length"` // Default connector length
// Add other global layout defaults here if needed
}
// JunctionMarkerStyle defines the marker between timeline segments
type JunctionMarkerStyle struct {
Shape string `json:"shape"` // "diamond", "arrow", "none"
Size float64 `json:"size"` // Size of the marker (e.g., width/height)
// Color is typically derived from the next segment, but can be overridden
Color *string `json:"color,omitempty"`
}
// TitleLineStyle defines the decorative line above comment titles
type TitleLineStyle struct {
Visible bool `json:"visible"` // Default false? Or based on width/length? Let's default true if width/length > 0
Color string `json:"color"` // Defaults to segment/connector color
Width float64 `json:"width"` // Thickness
Length float64 `json:"length"` // Length
Margin float64 `json:"margin"` // Space below the line, above the title
}
// FontStyle defines common font properties
type FontStyle struct {
FontFamily string `json:"font_family,omitempty"`
FontSize int `json:"font_size,omitempty"` // Use int for pixels initially
FontWeight string `json:"font_weight,omitempty"` // e.g., "normal", "bold", "400", "700"
FontStyle string `json:"font_style,omitempty"` // "normal", "italic"
}
type Template struct {
CenterLine CenterLine `json:"center_line"`
Layout LayoutOptions `json:"layout"`
GlobalFont *FontStyle `json:"global_font,omitempty"` // Added Global Font Defaults (pointer)
PeriodDefaults PeriodStyle `json:"period_defaults"`
}
type CenterLine struct {
Width int `json:"width"`
Type string `json:"type"`
Orientation string `json:"orientation"`
Angle *float64 `json:"angle,omitempty"` // Added: Optional angle in degrees
Color string `json:"color"`
RoundedCaps bool `json:"rounded_caps"` // Added for rounded ends
}
type PeriodStyle struct {
YearText YearTextStyle `json:"year_text"`
Connector ConnectorStyle `json:"connector"` // Still needed for line style/color
CommentText CommentTextStyle `json:"comment_text"`
CenterlineProjection CenterlineProjectionStyle `json:"centerline_projection"`
JunctionMarker JunctionMarkerStyle `json:"junction_marker"` // Added Junction Marker default
}
type YearTextStyle struct {
Position string `json:"position,omitempty"` // Optional placement override
MainAxisOffset float64 `json:"main_axis_offset,omitempty"` // Added back
CrossAxisOffset float64 `json:"cross_axis_offset,omitempty"` // Added back
TextColor string `json:"text_color,omitempty"`
Font FontStyle `json:"font,omitempty"`
Shape string `json:"shape,omitempty"`
FillColor string `json:"fill_color,omitempty"`
BorderColor string `json:"border_color,omitempty"`
BorderWidth float64 `json:"border_width,omitempty"`
}
type ConnectorStyle struct {
DrawToPeriod *bool `json:"draw_to_period,omitempty"`
DrawToComment *bool `json:"draw_to_comment,omitempty"`
Width int `json:"width,omitempty"`
Color string `json:"color,omitempty"`
LineType string `json:"line_type,omitempty"`
Side string `json:"side,omitempty"` // Added
Dot DotStyle `json:"dot,omitempty"`
}
type DotStyle struct {
Size int `json:"size"` // diameter
Color string `json:"color"`
Shape string `json:"shape"` // "circle", "arrow", "square", "none"
Visible bool `json:"visible"`
OffsetMain int `json:"offset_main"` // Offset along the connector line
OffsetCross int `json:"offset_cross"` // Offset perpendicular to the connector line
StopAtDot bool `json:"stop_at_dot"` // Added: Control if line stops at dot
}
type CommentTextStyle struct {
Position string `json:"position"`
MainAxisOffset float64 `json:"main_axis_offset,omitempty"` // Added back
CrossAxisOffset float64 `json:"cross_axis_offset,omitempty"`
Font FontStyle `json:"font"` // Font for the body text
TitleFont FontStyle `json:"title_font"` // Added: Specific font style for the title
TitleLine TitleLineStyle `json:"title_line"` // Added: Decorative line above title
TitleColor string `json:"title_color"` // Added: Specific color for the title text
Shape string `json:"shape"` // "rectangle", "none" - determines background/border for body
FillColor string `json:"fill_color"`
TextColor string `json:"text_color"` // Color for the body text
Padding string `json:"padding"` // Changed: Padding string (e.g., "10", "10 20", "10 20 30 40")
BlockWidth *float64 `json:"block_width,omitempty"` // Added: Optional fixed width
BorderColor string `json:"border_color"`
BorderWidth int `json:"border_width"`
BorderStyle string `json:"border_style"`
TextAlign string `json:"text_align"` // Added: Alignment for text within comment block ('left', 'center', 'right')
}
// Added: Style for the segment on the main center line corresponding to a period
type CenterlineProjectionStyle struct {
Color string `json:"color"`
// Percentage float64 `json:"percentage"` // Deferring variable length percentage, assume equal spacing for now
}
// --- Data Structs ---
type TimelineData struct {
Entries []TimelineEntry `json:"entries"`
}
type TimelineEntry struct {
Period string `json:"period"` // Used as year text if no shape, or inside shape
TitleText string `json:"title_text,omitempty"` // Optional Title for comment section
CommentText string `json:"comment_text,omitempty"` // Body text for comment section
CommentImage string `json:"comment_image,omitempty"`
Link string `json:"link,omitempty"` // Applied to Period/Year element
EntrySpacingOverride *float64 `json:"entry_spacing_override,omitempty"`
OrientationOverride *string `json:"orientation_override,omitempty"` // Added
AngleOverride *float64 `json:"angle_override,omitempty"` // Added: Optional angle override in degrees
ConnectorOverride *ConnectorStyleOverride `json:"connector_override,omitempty"`
CommentTextOverride *CommentTextStyleOverride `json:"comment_text_override,omitempty"`
YearTextOverride *YearTextStyleOverride `json:"year_text_override,omitempty"`
CenterlineProjectionOverride *CenterlineProjectionStyle `json:"centerline_projection_override,omitempty"`
JunctionMarkerOverride *JunctionMarkerOverride `json:"junction_marker_override,omitempty"`
}
// FontStyleOverride allows overriding individual font properties
type FontStyleOverride struct {
FontFamily *string `json:"font_family,omitempty"`
FontSize *int `json:"font_size,omitempty"`
FontWeight *string `json:"font_weight,omitempty"`
FontStyle *string `json:"font_style,omitempty"`
}
type YearTextStyleOverride struct {
Position *string `json:"position,omitempty"`
MainAxisOffset *float64 `json:"main_axis_offset,omitempty"` // Added back
CrossAxisOffset *float64 `json:"cross_axis_offset,omitempty"` // Added back
Font *FontStyleOverride `json:"font,omitempty"`
TextColor *string `json:"text_color,omitempty"`
Shape *string `json:"shape,omitempty"` // Added
FillColor *string `json:"fill_color,omitempty"` // Added
BorderColor *string `json:"border_color,omitempty"` // Added
BorderWidth *float64 `json:"border_width,omitempty"` // Added
}
type CommentTextStyleOverride struct {
Position *string `json:"position,omitempty"`
MainAxisOffset *float64 `json:"main_axis_offset,omitempty"` // Added back
CrossAxisOffset *float64 `json:"cross_axis_offset,omitempty"`
Font *FontStyleOverride `json:"font,omitempty"` // Body font
TitleFont *FontStyleOverride `json:"title_font,omitempty"` // Title font override
TitleLine *TitleLineStyleOverride `json:"title_line,omitempty"` // Title line override
TitleColor *string `json:"title_color,omitempty"` // Title text color override
Shape *string `json:"shape,omitempty"`
FillColor *string `json:"fill_color,omitempty"`
TextColor *string `json:"text_color,omitempty"` // Body text color
Padding *string `json:"padding,omitempty"` // Changed: Padding string override
BlockWidth *float64 `json:"block_width,omitempty"` // Added
BorderColor *string `json:"border_color,omitempty"`
BorderWidth *int `json:"border_width,omitempty"`
BorderStyle *string `json:"border_style,omitempty"`
TextAlign *string `json:"text_align,omitempty"` // Added
}
type JunctionMarkerOverride struct { // New Override Struct
Shape *string `json:"shape,omitempty"`
Size *float64 `json:"size,omitempty"`
Color *string `json:"color,omitempty"`
}
type TitleLineStyleOverride struct { // New Override Struct
Visible *bool `json:"visible,omitempty"`
Color *string `json:"color,omitempty"`
Width *float64 `json:"width,omitempty"`
Length *float64 `json:"length,omitempty"`
Margin *float64 `json:"margin,omitempty"`
}
// Added: Override struct for ConnectorStyle to handle pointers
type ConnectorStyleOverride struct {
Color *string `json:"color,omitempty"`
LineType *string `json:"line_type,omitempty"`
Width *int `json:"width,omitempty"`
DrawToPeriod *bool `json:"draw_to_period,omitempty"`
DrawToComment *bool `json:"draw_to_comment,omitempty"`
Dot *DotStyleOverride `json:"dot,omitempty"` // Added missing Dot field
}
// Added: Override struct for DotStyle
type DotStyleOverride struct {
Size *int `json:"size,omitempty"`
Color *string `json:"color,omitempty"`
Shape *string `json:"shape,omitempty"`
Visible *bool `json:"visible,omitempty"`
OffsetMain *int `json:"offset_main,omitempty"`
OffsetCross *int `json:"offset_cross,omitempty"`
StopAtDot *bool `json:"stop_at_dot,omitempty"` // Added override
}