Help us shape the future of Go! Take the 2026 Go Developer Survey

pattern

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pattern 按 OFD 底纹属性计算平铺范围及图块变换。 本包只依赖模型与几何,不绘制 CellContent,也不持有文档资源或绘制预算。

Index

Constants

View Source
const MaxTiles = 100000

MaxTiles 限制一次平铺计划的图块数,防止无界展开。

Variables

This section is empty.

Functions

func New

func New(pattern *models.CtPattern, object models.CTGraphicUnit, pb models.StBox, bounds geom.Rect, parentCTM *models.CTM) (Plan, Status)

New 按 GB/T 33190—2016 §8.3.3 表28 计算底纹步长、原点、镜像与 CTM。 bounds 使用画布 Y 向上坐标;图块矩阵使用 OFD Y 向下坐标。

Types

type Plan

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

Plan 是只读平铺计划;Columns 与 Rows 方法也用于数量超限时的诊断。 零值与未就绪的计划不提供图块变换。

func (Plan) Columns

func (p Plan) Columns() int

Columns 返回平铺计划的列数。

func (Plan) Rows

func (p Plan) Rows() int

Rows 返回平铺计划的行数。

func (*Plan) Tile

func (p *Plan) Tile(column, row int) (models.CTM, bool)

Tile 返回相对计划起点的某列某行的变换。未就绪计划、负数或越界索引, 以及逐图块平移溢出时返回 false。

type Status

type Status uint8

Status 区分有效计划、无效几何与图块数量超限。

const (
	// Invalid 表示无法构造有效的坐标变换。
	Invalid Status = iota
	// Ready 表示计划可以用于平铺。
	Ready
	// LimitExceeded 表示索引或数量超限,调用方可记录预算诊断。
	LimitExceeded
)

Jump to

Keyboard shortcuts

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