entities

package
v0.0.0-...-1022a47 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(typeName string, factory EntityFactory)

Register 允许以后动态扩展新的实体类型

Types

type Attrib

type Attrib struct {
	BaseEntity
	Location core.Point
	Tag      string // 属性标签,如 "序号"
	Text     string // 属性值
	Height   float64
}

func (*Attrib) BBox

func (a *Attrib) BBox() core.BBox

func (*Attrib) Parse

func (a *Attrib) Parse(scanner *core.Scanner) error

type BaseEntity

type BaseEntity struct {
	TypeName  string
	LayerName string
	Handle    string
}

BaseEntity 存放所有实体通用的属性(如 Layer, Color, Handle)

func (*BaseEntity) Layer

func (b *BaseEntity) Layer() string

func (*BaseEntity) Type

func (b *BaseEntity) Type() string

type Dimension

type Dimension struct {
	BaseEntity
	DimType           int        // 组码 70 (关键:区分标注类型)
	StyleName         string     // 组码 3 (标注样式名称,用于关联 TABLES)
	ActualMeasurement float64    // 组码 42
	Text              string     // 组码 1
	Angle             float64    // 组码 50
	TextMidPoint      core.Point // 组码 11 (中间的点)
	DefPoint          core.Point // 组码 10 (标注线起点)
	MeasureStart      core.Point // 组码 13 (被测量的起点)
	MeasureEnd        core.Point // 组码 14 (被测量的终点)
}

func (*Dimension) BBox

func (d *Dimension) BBox() core.BBox

BBox 覆盖:为了通用库的严谨性,标注的 BBox 应该包含所有定义点

func (*Dimension) BBox2

func (d *Dimension) BBox2(exe, exo float64) core.BBox

BBox2 实现“完美矩形”包围盒 exe 代表标注线超出延伸线的长度 (DIMEXE)

func (*Dimension) GetCleanVal

func (d *Dimension) GetCleanVal() float64

GetCleanVal 正则提取数值

func (*Dimension) GetExtensionPoints

func (d *Dimension) GetExtensionPoints() (p13Corner, p14Corner core.Point)

GetExtensionPoints 计算标注线上的两个转角点 返回:对应 P13 的转角点, 对应 P14 的转角点

func (*Dimension) Parse

func (d *Dimension) Parse(scanner *core.Scanner) error

type Entity

type Entity interface {
	Parse(scanner *core.Scanner) error
	Type() string
	Layer() string
	BBox() core.BBox
}

Entity 是一切几何实体的接口

func CreateEntity

func CreateEntity(typeName string) Entity

CreateEntity 根据实体名称生产对应的结构体

type EntityFactory

type EntityFactory func() Entity

EntityFactory 定义了如何从标签流中创建一个实体

type Insert

type Insert struct {
	BaseEntity
	BlockName      string
	InsertionPoint core.Point
	Scale          core.Point
	Rotation       float64
	Attributes     []*Attrib
}

func (*Insert) BBox

func (i *Insert) BBox() core.BBox

func (*Insert) Parse

func (i *Insert) Parse(scanner *core.Scanner) error

type LWPolyline

type LWPolyline struct {
	BaseEntity
	Vertices []core.Point
}

func (*LWPolyline) BBox

func (l *LWPolyline) BBox() core.BBox

func (*LWPolyline) Parse

func (l *LWPolyline) Parse(s *core.Scanner) error

type Line

type Line struct {
	BaseEntity
	Start, End core.Point
}

func (*Line) BBox

func (l *Line) BBox() core.BBox

func (*Line) Parse

func (l *Line) Parse(s *core.Scanner) error

type MText

type MText struct {
	BaseEntity
	Value string
	Point core.Point
	Layer string
}

func (*MText) Parse

func (m *MText) Parse(scanner *core.Scanner)

type Text

type Text struct {
	BaseEntity // 假设你有一个基础实体包含图层等信息
	Value      string
	Point      core.Point // 插入点
	Height     float64
	Layer      string
}

func (*Text) Parse

func (t *Text) Parse(scanner *core.Scanner)

Jump to

Keyboard shortcuts

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