models

package
v0.0.0-...-1815555 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anchor

type Anchor struct {
	// contains filtered or unexported fields
}

Anchor 锚点 详情所在页

type ClanBookPrinter

type ClanBookPrinter struct {

	// perStatusHeight float64
	// MinStyle minimal font style
	MinStyle *FontStyle
	// NorStyle normal font style
	NorStyle *FontStyle
	// MaxStyle max font style
	MaxStyle *FontStyle

	FontSizeForNum int //用于打印页码

	// offsetStatus    int32   //代数偏移
	WifeNamesIndent float64 //配偶姓名缩进
	LineHeight      float64 //竖线长度

	Padding Padding //内间距

	PagePadding Padding //页面内边距,同时用于族谱块内边距
	// contains filtered or unexported fields
}

ClanBookPrinter 族谱书籍打印

func NewClanBook

func NewClanBook(fromStatus int32, statusName string, startPageNum int, fontPath string) *ClanBookPrinter

NewClanBook create new clan book

func (*ClanBookPrinter) DrawHorizontalLine

func (cbp *ClanBookPrinter) DrawHorizontalLine(currentX, currentY, toX float64)

DrawHorizontalLine 画横线

func (*ClanBookPrinter) DrawLongitudeLine

func (cbp *ClanBookPrinter) DrawLongitudeLine(currentX, currentY float64)

DrawLongitudeLine 往回画竖线

func (*ClanBookPrinter) MemberConv

func (cbp *ClanBookPrinter) MemberConv(member *Member, offsetStatus int32, p *PrintProgress) *PdfMember

MemberConv convert member to pdf's member

func (*ClanBookPrinter) PrintMember

func (cbp *ClanBookPrinter) PrintMember(pm *PdfMember, currentX, currentY float64, pageIndex int, statusHeight map[int32]float64, stopStatus int32, typ StyleType)

PrintMember 打印设计好的族人信息

func (*ClanBookPrinter) Write

func (cbp *ClanBookPrinter) Write(path string, member *Member) error

func (*ClanBookPrinter) WriteWithProgress

func (cbp *ClanBookPrinter) WriteWithProgress(path string, pm *PdfMember, p *PrintProgress) error

WriteWithProgress 附带进度提示

type FontStyle

type FontStyle struct {
	FontSize          int
	FontSizeForWife   int
	FontSizeForStatus int
}

FontStyle font style for print clan

type Member

type Member struct {
	ID       int64
	Name     string
	Surname  string
	Status   int32
	Spouse   *MemberRelationship
	Spouses  []*MemberRelationship
	Children []*Member
}

type 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"` //婚姻形式
}

MemberRelationship 成员关系

type Padding

type Padding struct {
	Top, Right, Buttom, Left float64
}

Padding for name

type PdfMember

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
}

func (*PdfMember) PrintWidth

func (pm *PdfMember) PrintWidth(stopStatus int32, ft StyleType) float64

type 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"`
}

Person 人 一些与族谱有关的人

type PrintProgress

type PrintProgress struct {
	Total int

	Message chan ProgressMessage
	// contains filtered or unexported fields
}

PrintProgress 打印进度

func CreatePrintProgress

func CreatePrintProgress() *PrintProgress

CreatePrintProgress for clan book making

func (*PrintProgress) Cancel

func (pp *PrintProgress) Cancel()

Cancel making clan book

func (*PrintProgress) Done

func (pp *PrintProgress) Done() <-chan struct{}

type ProgressMessage

type ProgressMessage struct {
	Step    uint //步骤
	Message string
	Index   int
}

type Size

type Size struct {
	Width, Height float64
}

type StyleType

type StyleType int

StyleType font style type

const (

	// FNor normal font style
	FNor StyleType
	// FMin minimal font style
	FMin
	// FMax max font style
	FMax
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL