代码拉取完成,页面将自动刷新
package models
import "time"
import "fmt"
type Member struct {
ID int64
Name string
Surname string
Status int32
Spouse *MemberRelationship
Spouses []*MemberRelationship
Children []*Member
}
// Person 人
// 一些与族谱有关的人
type Person struct {
ID int64 `xorm:"not null pk autoincr INTEGER id" json:"id"`
Name string `xorm:"not null VARCHAR(16)" json:"name"`
Birthday *time.Time `xorm:"DATE" json:"birthday"`
BirthRecord string `xorm:"VARCHAR(64)" json:"birth_record"`
BirthPlace string `xorm:"VARCHAR(256)" json:"birthPlace"`
Brief string `xorm:"not null TEXT" json:"brief"`
}
// MemberRelationship 成员关系
type MemberRelationship struct {
ID int64 `xorm:"not null pk autoincr INTEGER id" json:"id"`
MemberID int64 `xorm:"not null unique(main) INTEGER member_id" json:"-"`
PersonID int64 `xorm:"not null unique(main) INTEGER person_id" json:"-"`
Person *Person `xorm:"-" json:"person"`
Main bool `xorm:"not null BOOL" json:"main"`
IsNormalForm bool `xorm:"not null default true BOOL" json:"isNormalForm"` //婚姻形式
}
type PdfMember struct {
Index int //用于进度设计
Name []rune
Status int32
WifeNames [][]rune
Surname string
MinSize Size
NorSize Size
MaxSize Size
WidthOfChildren float64
HeightOfChildren float64
Children []*PdfMember
Anchor *Anchor
}
type Size struct {
Width, Height float64
}
func (pm *PdfMember) PrintWidth(stopStatus int32, ft StyleType) float64 {
if pm.Status > stopStatus {
panic(fmt.Sprintf("%s's status is more than stop", string(pm.Name)))
}
width := 0.0
switch ft {
case FMin:
width = pm.MinSize.Width
case FMax:
width = pm.MaxSize.Width
default:
width = pm.NorSize.Width
}
if pm.Status == stopStatus {
return width
}
// width with children
wwc := 0.0
for _, child := range pm.Children {
wwc += child.PrintWidth(stopStatus, ft)
}
if width < wwc {
return wwc
}
return width
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。