entity

package
v0.0.0-...-5a6d1e8 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

ENTITIES section

Index

Constants

View Source
const (
	LEFT_BASE = iota
	CENTER_BASE
	RIGHT_BASE
	LEFT_BOTTOM
	CENTER_BOTTOM
	RIGHT_BOTTOM
	LEFT_CENTER
	CENTER_CENTER
	RIGHT_CENTER
	LEFT_TOP
	CENTER_TOP
	RIGHT_TOP
)

Text Anchor

Variables

This section is empty.

Functions

func EntityTypeString

func EntityTypeString(t EntityType) string

EntityTypeString converts EntityType to string. If EntityType is out of range, it returns empty string.

func NewEntity

func NewEntity(t EntityType) *entity

NewEntity creates a new entity.

Types

type Arc

type Arc struct {
	*Circle
	Angle []float64 // 50, 51 (Degree)
}

func NewArc

func NewArc(c *Circle) *Arc

NewArc creates a new Arc.

func (*Arc) Format

func (a *Arc) Format(f format.Formatter)

Format writes data to formatter.

func (Arc) Handle

func (e Arc) Handle() int

Handle returns a handle value of TABLE.

func (*Arc) IsEntity

func (a *Arc) IsEntity() bool

IsEntity is for Entity interface.

func (Arc) Layer

func (e Arc) Layer() *table.Layer

Layer returns entity's Layer.

func (Arc) SetBlockRecord

func (e Arc) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (Arc) SetEntityType

func (e Arc) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (Arc) SetHandle

func (e Arc) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (Arc) SetLayer

func (e Arc) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Arc) SetLtscale

func (e Arc) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Arc) SetOwner

func (e Arc) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Arc) String

func (a *Arc) String() string

String write out the String representation

type Circle

type Circle struct {
	Center    []float64 // 10, 20, 30
	Radius    float64   // 40
	Direction []float64 // 210, 220, 230
	// contains filtered or unexported fields
}

Circle represents CIRCLE Entity.

func NewCircle

func NewCircle() *Circle

NewCircle creates a new Circle.

func (*Circle) BBox

func (c *Circle) BBox() ([]float64, []float64)

func (*Circle) CurrentCoord

func (c *Circle) CurrentCoord() []float64

CurrentCoord returns center point coord.

func (*Circle) CurrentDirection

func (c *Circle) CurrentDirection() []float64

CurrentDirection returns extrusion direction.

func (*Circle) Format

func (c *Circle) Format(f format.Formatter)

Format writes data to formatter.

func (*Circle) FormatString

func (c *Circle) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (Circle) Handle

func (e Circle) Handle() int

Handle returns a handle value of TABLE.

func (*Circle) IsEntity

func (c *Circle) IsEntity() bool

IsEntity is for Entity interface.

func (Circle) Layer

func (e Circle) Layer() *table.Layer

Layer returns entity's Layer.

func (Circle) SetBlockRecord

func (e Circle) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (*Circle) SetCoord

func (c *Circle) SetCoord(co []float64)

SetCoord sets new center point coord.

func (*Circle) SetDirection

func (c *Circle) SetDirection(d []float64)

SetDirection sets new extrusion direction.

func (Circle) SetEntityType

func (e Circle) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (Circle) SetHandle

func (e Circle) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (Circle) SetLayer

func (e Circle) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Circle) SetLtscale

func (e Circle) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Circle) SetOwner

func (e Circle) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Circle) String

func (c *Circle) String() string

String outputs data using default formatter.

type Entities

type Entities []Entity

Entities represents ENTITIES section.

func New

func New() Entities

New creates a new Entities.

func (Entities) Add

func (es Entities) Add(e Entity) Entities

Add adds a new entity to ENTITIES section.

func (Entities) Format

func (es Entities) Format(f format.Formatter)

Format writes ENTITIES data to formatter.

func (Entities) SetHandle

func (es Entities) SetHandle(v *int)

SetHandle sets handles to each entity.

type Entity

type Entity interface {
	IsEntity() bool
	Format(format.Formatter)
	Handle() int
	SetHandle(*int)
	SetBlockRecord(handle.Handler)
	Layer() *table.Layer
	SetLayer(*table.Layer)
	SetLtscale(float64)
	BBox() ([]float64, []float64)
}

Entity is interface for DXF Entities.

type EntityType

type EntityType int

EntityType represents Entity names (code 2)

const (
	LINE EntityType = iota
	THREEDFACE
	LWPOLYLINE
	CIRCLE
	POLYLINE
	VERTEX
	POINT
	ARC
	TEXT
	SPLINE
)

Entity name: code 2

func EntityTypeValue

func EntityTypeValue(t string) EntityType

EntityTypeValue converts string to EntityType. If string is unknown EntityType, it returns -1.

type Line

type Line struct {
	Start []float64 // 10, 20, 30
	End   []float64 // 11, 21, 31
	// contains filtered or unexported fields
}

Line represents LINE Entity.

func NewLine

func NewLine() *Line

NewLine creates a new Line.

func (*Line) BBox

func (l *Line) BBox() ([]float64, []float64)

func (*Line) Direction

func (l *Line) Direction(normalize bool) []float64

func (*Line) Format

func (l *Line) Format(f format.Formatter)

Format writes data to formatter.

func (*Line) FormatString

func (l *Line) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (Line) Handle

func (e Line) Handle() int

Handle returns a handle value of TABLE.

func (*Line) IsEntity

func (l *Line) IsEntity() bool

IsEntity is for Entity interface.

func (Line) Layer

func (e Line) Layer() *table.Layer

Layer returns entity's Layer.

func (*Line) Length

func (l *Line) Length() float64

func (*Line) Move

func (l *Line) Move(x, y, z float64)

func (Line) SetBlockRecord

func (e Line) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (Line) SetEntityType

func (e Line) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (Line) SetHandle

func (e Line) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (Line) SetLayer

func (e Line) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Line) SetLtscale

func (e Line) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Line) SetOwner

func (e Line) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Line) String

func (l *Line) String() string

String outputs data using default formatter.

type LwPolyline

type LwPolyline struct {
	Num      int // 90
	Closed   bool
	Vertices [][]float64
	// contains filtered or unexported fields
}

LwPolyline represents LWPOLYLINE Entity.

func NewLwPolyline

func NewLwPolyline(size int) *LwPolyline

NewLwPolyline creates a new LwPolyline.

func (*LwPolyline) BBox

func (l *LwPolyline) BBox() ([]float64, []float64)

func (*LwPolyline) Close

func (l *LwPolyline) Close()

Close closes LwPolyline.

func (*LwPolyline) Format

func (l *LwPolyline) Format(f format.Formatter)

Format writes data to formatter.

func (*LwPolyline) FormatString

func (l *LwPolyline) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (LwPolyline) Handle

func (e LwPolyline) Handle() int

Handle returns a handle value of TABLE.

func (*LwPolyline) IsEntity

func (l *LwPolyline) IsEntity() bool

IsEntity is for Entity interface.

func (LwPolyline) Layer

func (e LwPolyline) Layer() *table.Layer

Layer returns entity's Layer.

func (LwPolyline) SetBlockRecord

func (e LwPolyline) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (LwPolyline) SetEntityType

func (e LwPolyline) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (LwPolyline) SetHandle

func (e LwPolyline) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (LwPolyline) SetLayer

func (e LwPolyline) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (LwPolyline) SetLtscale

func (e LwPolyline) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (LwPolyline) SetOwner

func (e LwPolyline) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*LwPolyline) String

func (l *LwPolyline) String() string

String outputs data using default formatter.

type Point

type Point struct {
	Coord []float64 // 10, 20, 30
	// contains filtered or unexported fields
}

Point represents POINT Entity.

func NewPoint

func NewPoint(coord ...float64) *Point

NewPoint creates a new Point.

func (*Point) BBox

func (p *Point) BBox() ([]float64, []float64)

func (*Point) Format

func (p *Point) Format(f format.Formatter)

Format writes data to formatter.

func (*Point) FormatString

func (p *Point) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (Point) Handle

func (e Point) Handle() int

Handle returns a handle value of TABLE.

func (*Point) IsEntity

func (p *Point) IsEntity() bool

IsEntity is for Entity interface.

func (Point) Layer

func (e Point) Layer() *table.Layer

Layer returns entity's Layer.

func (Point) SetBlockRecord

func (e Point) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (Point) SetEntityType

func (e Point) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (Point) SetHandle

func (e Point) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (Point) SetLayer

func (e Point) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Point) SetLtscale

func (e Point) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Point) SetOwner

func (e Point) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Point) String

func (p *Point) String() string

String outputs data using default formatter.

type Polyline

type Polyline struct {
	Flag int

	Vertices []*Vertex
	// contains filtered or unexported fields
}

Polyline represents POLYLINE Entity.

func NewPolyline

func NewPolyline() *Polyline

NewPolyline creates a new Polyline.

func (*Polyline) AddVertex

func (p *Polyline) AddVertex(x, y, z float64) *Vertex

AddVertex adds a new vertex to Polyline.

func (*Polyline) BBox

func (p *Polyline) BBox() ([]float64, []float64)

func (*Polyline) Close

func (p *Polyline) Close()

Close closes Polyline.

func (*Polyline) Format

func (p *Polyline) Format(f format.Formatter)

Format writes data to formatter.

func (*Polyline) FormatString

func (p *Polyline) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (Polyline) Handle

func (e Polyline) Handle() int

Handle returns a handle value of TABLE.

func (*Polyline) IsEntity

func (p *Polyline) IsEntity() bool

IsEntity is for Entity interface.

func (Polyline) Layer

func (e Polyline) Layer() *table.Layer

Layer returns entity's Layer.

func (Polyline) SetBlockRecord

func (e Polyline) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (Polyline) SetEntityType

func (e Polyline) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (*Polyline) SetHandle

func (p *Polyline) SetHandle(h *int)

SetHandle sets handles to itself and its vertices.

func (Polyline) SetLayer

func (e Polyline) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Polyline) SetLtscale

func (e Polyline) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Polyline) SetOwner

func (e Polyline) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Polyline) String

func (p *Polyline) String() string

String outputs data using default formatter.

type Spline

type Spline struct {
	Normal    []float64   // 210, 220, 230
	Flag      int         // 70
	Degree    int         // 71
	Knots     []float64   // 72, 40
	Controls  [][]float64 // 73, 10, 20, 30
	Fits      [][]float64 // 74, 11, 21, 31
	Tolerance []float64   // 42, 43, 44
	// contains filtered or unexported fields
}

Spline represents LINE Entity.

func NewSpline

func NewSpline() *Spline

NewSpline creates a new Spline.

func (*Spline) Format

func (s *Spline) Format(f format.Formatter)

Format writes data to formatter.

func (*Spline) FormatString

func (s *Spline) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (Spline) Handle

func (e Spline) Handle() int

Handle returns a handle value of TABLE.

func (*Spline) IsEntity

func (l *Spline) IsEntity() bool

IsEntity is for Entity interface.

func (Spline) Layer

func (e Spline) Layer() *table.Layer

Layer returns entity's Layer.

func (Spline) SetBlockRecord

func (e Spline) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (Spline) SetEntityType

func (e Spline) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (Spline) SetHandle

func (e Spline) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (Spline) SetLayer

func (e Spline) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Spline) SetLtscale

func (e Spline) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Spline) SetOwner

func (e Spline) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Spline) String

func (s *Spline) String() string

String outputs data using default formatter.

type Text

type Text struct {
	Coord1         []float64    // 10, 20, 30
	Coord2         []float64    // 11, 21, 31
	Height         float64      // 40
	Rotation       float64      // 50
	WidthFactor    float64      // 41
	ObliqueAngle   float64      // 51
	Value          string       // 1
	Style          *table.Style // 7
	GenFlag        int          // 71
	HorizontalFlag int          // 72
	VerticalFlag   int          // 73
	// contains filtered or unexported fields
}

Text represents TEXT Entity.

func NewText

func NewText() *Text

NewText creates a new Text.

func (*Text) Anchor

func (t *Text) Anchor(pos int)

Anchor sets anchor point flags.

func (*Text) BBox

func (t *Text) BBox() ([]float64, []float64)

func (*Text) FlipHorizontal

func (t *Text) FlipHorizontal()

FlipHorizontal flips Text horizontally.

func (*Text) FlipVertical

func (t *Text) FlipVertical()

FlipVertical flips Text vertically.

func (*Text) Format

func (t *Text) Format(f format.Formatter)

Format writes data to formatter.

func (*Text) FormatString

func (t *Text) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (Text) Handle

func (e Text) Handle() int

Handle returns a handle value of TABLE.

func (*Text) IsEntity

func (t *Text) IsEntity() bool

IsEntity is for Entity interface.

func (Text) Layer

func (e Text) Layer() *table.Layer

Layer returns entity's Layer.

func (Text) SetBlockRecord

func (e Text) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (Text) SetEntityType

func (e Text) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (Text) SetHandle

func (e Text) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (Text) SetLayer

func (e Text) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Text) SetLtscale

func (e Text) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Text) SetOwner

func (e Text) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Text) String

func (t *Text) String() string

String outputs data using default formatter.

type ThreeDFace

type ThreeDFace struct {
	Points [][]float64
	Flag   int // 70
	// contains filtered or unexported fields
}

ThreeDFace represents 3DFACE Entity.

func New3DFace

func New3DFace() *ThreeDFace

New3DFace creates a new ThreeDFace.

func (*ThreeDFace) BBox

func (f *ThreeDFace) BBox() ([]float64, []float64)

func (*ThreeDFace) Format

func (f *ThreeDFace) Format(fm format.Formatter)

Format writes data to formatter.

func (*ThreeDFace) FormatString

func (f *ThreeDFace) FormatString(fm format.Formatter) string

FormatString outputs data using given formatter.

func (ThreeDFace) Handle

func (e ThreeDFace) Handle() int

Handle returns a handle value of TABLE.

func (*ThreeDFace) IsEntity

func (f *ThreeDFace) IsEntity() bool

IsEntity is for Entity interface.

func (ThreeDFace) Layer

func (e ThreeDFace) Layer() *table.Layer

Layer returns entity's Layer.

func (ThreeDFace) SetBlockRecord

func (e ThreeDFace) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (ThreeDFace) SetEntityType

func (e ThreeDFace) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (ThreeDFace) SetHandle

func (e ThreeDFace) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (ThreeDFace) SetLayer

func (e ThreeDFace) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (ThreeDFace) SetLtscale

func (e ThreeDFace) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (ThreeDFace) SetOwner

func (e ThreeDFace) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*ThreeDFace) String

func (f *ThreeDFace) String() string

String outputs data using default formatter.

type Vertex

type Vertex struct {
	Flag  int
	Coord []float64
	// contains filtered or unexported fields
}

Vertex represents VERTEX Entity.

func NewVertex

func NewVertex(x, y, z float64) *Vertex

NewVertex creates a new Vertex.

func (*Vertex) BBox

func (v *Vertex) BBox() ([]float64, []float64)

func (*Vertex) Format

func (v *Vertex) Format(f format.Formatter)

Format writes data to formatter.

func (*Vertex) FormatString

func (v *Vertex) FormatString(f format.Formatter) string

FormatString outputs data using given formatter.

func (Vertex) Handle

func (e Vertex) Handle() int

Handle returns a handle value of TABLE.

func (*Vertex) IsEntity

func (v *Vertex) IsEntity() bool

IsEntity is for Entity interface.

func (Vertex) Layer

func (e Vertex) Layer() *table.Layer

Layer returns entity's Layer.

func (Vertex) SetBlockRecord

func (e Vertex) SetBlockRecord(h handle.Handler)

SetBlockRecord sets BLOCK_RECORD to entity (code 330).

func (Vertex) SetEntityType

func (e Vertex) SetEntityType(t EntityType)

SetEntityType sets entity type.

func (Vertex) SetHandle

func (e Vertex) SetHandle(v *int)

SetHandle sets handles to TABLE itself and each SymbolTable.

func (Vertex) SetLayer

func (e Vertex) SetLayer(l *table.Layer)

SetLayer sets Layer to entity.

func (Vertex) SetLtscale

func (e Vertex) SetLtscale(v float64)

SetLtscale sets Layer to entity.

func (Vertex) SetOwner

func (e Vertex) SetOwner(h handle.Handler)

SetOwner sets an owner.

func (*Vertex) String

func (v *Vertex) String() string

String outputs data using default formatter.

Jump to

Keyboard shortcuts

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