entities

package
v0.0.0-...-e1e991c Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arc

type Arc struct {
	BaseEntity
	Thickness          float64
	Center             core.Point
	Radius             float64
	StartAngle         float64
	EndAngle           float64
	ExtrusionDirection core.Point
}

Arc Entity representation

func NewArc

func NewArc(tags core.TagSlice) (*Arc, error)

NewArc builds a new Arc from a slice of Tags.

func (Arc) Equals

func (a Arc) Equals(other core.DxfElement) bool

Equals tests equality against another Arc.

type BaseEntity

type BaseEntity struct {
	core.DxfParseable
	RegularEntity
	Handle        string
	Owner         string
	Space         Space
	LayoutTabName string
	LayerName     string
	LineTypeName  string
	On            bool
	Color         int
	LineWeight    int
	LineTypeScale float64
	Visible       bool
	TrueColor     core.TrueColor
	ColorName     string
	Transparency  int
	ShadowMode    ShadowMode
}

BaseEntity holds the common part for all Entity types. New Entity types should be composed by it.

func (BaseEntity) Equals

func (entity BaseEntity) Equals(other BaseEntity) bool

Equals compare two BaseEntity objects for equality. It does not implements DxfElement by design, meaning that the composed Entity structs should do.

func (*BaseEntity) InitBaseEntityParser

func (entity *BaseEntity) InitBaseEntityParser()

InitBaseEntityParser Inits the EntityParsers for the BaseEntity attributes.

type Circle

type Circle struct {
	BaseEntity
	Thickness          float64
	Center             core.Point
	Radius             float64
	ExtrusionDirection core.Point
}

Circle Entity representation

func NewCircle

func NewCircle(tags core.TagSlice) (*Circle, error)

NewCircle builds a new Circle from a slice of Tags.

func (Circle) Equals

func (c Circle) Equals(other core.DxfElement) bool

Equals tests equality against another Circle.

type Ellipse

type Ellipse struct {
	BaseEntity
	Center                core.Point
	MajorAxisEnd          core.Point
	ExtrusionDirection    core.Point
	MinorToMajorAxisRatio float64
	StartParameter        float64
	EndParameter          float64
}

Ellipse Entity representation

func NewEllipse

func NewEllipse(tags core.TagSlice) (*Ellipse, error)

NewEllipse builds a new Ellipse from a slice of Tags.

func (Ellipse) Equals

func (e Ellipse) Equals(other core.DxfElement) bool

Equals tests equality against another Ellipse.

type Entity

type Entity interface {
	core.DxfElement
	IsSeqEnd() bool
	HasNestedEntities() bool
	AddNestedEntities(entities EntitySlice)
}

Entity all entities should implement this interface.

type EntitySlice

type EntitySlice []Entity

EntitySlice a slice of Entity objects.

func (EntitySlice) Equals

func (e EntitySlice) Equals(other EntitySlice) bool

Equals compares the EntitySlice to the other for equality.

type HorizontalTextJustification

type HorizontalTextJustification int

HorizontalTextJustification Horizontal Text Justification type

const (
	HTEXT_LEFT HorizontalTextJustification = iota
	HTEXT_CENTER
	HTEXT_RIGHT
	HTEXT_ALIGNED
	HTEXT_MIDDLE
	HTEXT_FIT
)

type Insert

type Insert struct {
	BaseEntity
	BlockName          string
	InsertionPoint     core.Point
	ScaleFactorX       float64
	ScaleFactorY       float64
	ScaleFactorZ       float64
	RotationAngle      float64
	ColumnCount        int
	RowCount           int
	ColumnSpacing      float64
	RowSpacing         float64
	AttributesFollow   bool
	Entities           EntitySlice
	ExtrusionDirection core.Point
}

Insert Entity representation

func NewInsert

func NewInsert(tags core.TagSlice) (*Insert, error)

NewInsert builds a new Insert from a slice of Tags.

func (*Insert) AddNestedEntities

func (i *Insert) AddNestedEntities(entities EntitySlice)

AddNestedEntities Add a slice of Entities as nested Entities.

func (Insert) Equals

func (i Insert) Equals(other core.DxfElement) bool

Equals tests equality against another Insert.

func (Insert) HasNestedEntities

func (i Insert) HasNestedEntities() bool

HasNestedEntities a Insert will have nested entities if the AttributesFollow value is set.

type LWPolyLinePoint

type LWPolyLinePoint struct {
	Point         core.Point
	Id            int
	StartingWidth float64
	EndWidth      float64
	Bulge         float64
}

LWPolyLinePoint point and attributes in an LWPolyline.

func (LWPolyLinePoint) Equals

func (p LWPolyLinePoint) Equals(other LWPolyLinePoint) bool

Equals compares two LWPolyLinePoints for equality

type LWPolyLinePointSlice

type LWPolyLinePointSlice []LWPolyLinePoint

LWPolyLinePointSlice Slice of LWPolyLinePoint

func (LWPolyLinePointSlice) Equals

Equals Compares two LWPolyLinePointSlices for equality.

type LWPolyline

type LWPolyline struct {
	BaseEntity
	Closed             bool
	Plinegen           bool
	ConstantWidth      float64
	Elevation          float64
	Thickness          float64
	Points             LWPolyLinePointSlice
	ExtrusionDirection core.Point
}

LWPolyline Entity representation

func NewLWPolyline

func NewLWPolyline(tags core.TagSlice) (*LWPolyline, error)

NewLWPolyline builds a new LWPolyline from a slice of Tags.

func (LWPolyline) Equals

func (p LWPolyline) Equals(other core.DxfElement) bool

Equals tests equality against another LWPolyline.

type Line

type Line struct {
	BaseEntity
	Thickness          float64
	Start              core.Point
	End                core.Point
	ExtrusionDirection core.Point
}

Line Entity representation

func NewLine

func NewLine(tags core.TagSlice) (*Line, error)

NewLine builds a new Line from a slice of Tags.

func (Line) Equals

func (a Line) Equals(other core.DxfElement) bool

Equals tests equality against another Line.

type Point

type Point struct {
	BaseEntity
	Location           core.Point
	Thickness          float64
	ExtrusionDirection core.Point
	XAxisAngle         float64
}

Point Entity representation

func NewPoint

func NewPoint(tags core.TagSlice) (*Point, error)

NewPoint builds a new Point from a slice of Tags.

func (Point) Equals

func (c Point) Equals(other core.DxfElement) bool

Equals tests equality against another Point.

type Polyline

type Polyline struct {
	BaseEntity
	Elevation              float64
	Thickness              float64
	Closed                 bool
	CurveFitVerticesAdded  bool
	SplineFitVerticesAdded bool
	Is3dPolyline           bool
	Is3dPolygonMesh        bool
	PolygonMeshClosedNDir  bool
	IsPolyfaceMesh         bool
	LineTypeParentAround   bool
	DefaultStartWidth      float64
	DefaultEndWidth        float64
	VertexCountM           int
	VertexCountN           int
	SmoothDensityM         int
	SmoothDensityN         int
	SmoothSurface          SmoothSurfaceType
	ExtrusionDirection     core.Point
	Vertices               VertexSlice
}

Polyline Entity representation

func NewPolyline

func NewPolyline(tags core.TagSlice) (*Polyline, error)

NewPolyline builds a new Polyline from a slice of Tags (without vertices)

func (*Polyline) AddNestedEntities

func (p *Polyline) AddNestedEntities(entities EntitySlice)

AddNestedEntities a Polyline will contain only Vertex as nested entities, other types are simply ignored.

func (Polyline) Equals

func (p Polyline) Equals(other core.DxfElement) bool

Equals tests equality against another Polyline.

func (Polyline) HasNestedEntities

func (p Polyline) HasNestedEntities() bool

HasNestedEntities a Polyline will have nested entities.

type RegularEntity

type RegularEntity struct{}

RegularEntity most of the Entities will return the same values for those APIs, this creates a default implementation that will be added to the BaseEntity class so that only that classes that need a different implementation need to overwrite it.

func (RegularEntity) AddNestedEntities

func (r RegularEntity) AddNestedEntities(entities EntitySlice)

AddNestedEntities a default empty implementation just to implement the interface.

func (RegularEntity) HasNestedEntities

func (r RegularEntity) HasNestedEntities() bool

HasNestedEntities a RegularEntity has no NestedEntities.

func (RegularEntity) IsSeqEnd

func (r RegularEntity) IsSeqEnd() bool

IsSeqEnd a RegularEntity is not a SeqEnd entity.

type SeqEnd

type SeqEnd struct {
	BaseEntity
}

SeqEnd Entity representation

func NewSeqEnd

func NewSeqEnd(tags core.TagSlice) (*SeqEnd, error)

NewSeqEnd builds a new SeqEnd from a slice of Tags.

func (SeqEnd) Equals

func (c SeqEnd) Equals(other core.DxfElement) bool

Equals tests equality against another SeqEnd.

func (SeqEnd) IsSeqEnd

func (c SeqEnd) IsSeqEnd() bool

IsSeqEnd should return true only for this type.

type ShadowMode

type ShadowMode int

ShadowMode for the Entity. How should shadows be handled for this Entity.

const (
	CASTS_AND_RECEIVE ShadowMode = iota
	CASTS
	RECEIVES
	IGNORES
)

type SmoothSurfaceType

type SmoothSurfaceType int

SmoothSurfaceType representation

const (
	NO_SMOOTH_SURFACE_FITTED SmoothSurfaceType = 0
	QUADRATIC_BSPLINE        SmoothSurfaceType = 5
	CUBIC_BSPLINE            SmoothSurfaceType = 6
	BEZIER                   SmoothSurfaceType = 8
)

type Space

type Space int

Space the Entity Space

const (
	MODEL Space = iota
	PAPER
)

type Spline

type Spline struct {
	BaseEntity
	NormalVector          core.Point
	Closed                bool
	Periodic              bool
	Rational              bool
	Planar                bool
	Linear                bool
	Degree                int
	KnotTolerance         float64
	ControlPointTolerance float64
	FitTolerance          float64
	StartTangent          core.Point
	EndTangent            core.Point
	KnotValues            []float64
	Weights               []float64
	ControlPoints         core.PointSlice
	FitPoints             core.PointSlice
}

Spline Entity representation

func NewSpline

func NewSpline(tags core.TagSlice) (*Spline, error)

NewSpline builds a new Spline from a slice of Tags.

func (Spline) Equals

func (s Spline) Equals(other core.DxfElement) bool

Equals tests equality against another Spline.

type Text

type Text struct {
	BaseEntity
	Thickness               float64
	FirstAlignmentPoint     core.Point
	Height                  float64
	Value                   string
	Rotation                float64
	RelativeXScale          float64
	ObliqueAngle            float64
	StyleName               string
	MirroredX               bool
	MirroredY               bool
	HorizontalJustification HorizontalTextJustification
	SecondAlignmentPoint    core.Point
	ExtrusionDirection      core.Point
	VerticalJustification   VerticalTextJustification
}

Text Entity representation

func NewText

func NewText(tags core.TagSlice) (*Text, error)

NewText builds a new Text from a slice of Tags.

func (Text) Equals

func (e Text) Equals(other core.DxfElement) bool

Equals tests equality against another Text.

type Vertex

type Vertex struct {
	BaseEntity
	Location                 core.Point
	StartingWidth            float64
	EndWidth                 float64
	Bulge                    float64
	CreatedByCurveFitting    bool
	CurveFitTangentDefined   bool
	SplineVertex             bool
	SplineFrameCtrlPoint     bool
	Is3dPolylineVertex       bool
	Is3dPolylineMesh         bool
	IsPolyfaceMeshVertex     bool
	CurveFitTangentDirection float64
	Id                       int
}

Vertex Entity representation

func NewVertex

func NewVertex(tags core.TagSlice) (*Vertex, error)

NewVertex builds a new Vertex from a slice of Tags.

func (Vertex) Equals

func (c Vertex) Equals(other core.DxfElement) bool

Equals tests equality against another Vertex.

type VertexSlice

type VertexSlice []*Vertex

VertexSlice a slice of Vertex objects.

func (VertexSlice) Equals

func (v VertexSlice) Equals(other VertexSlice) bool

Equals Compares two Vertices for equality.

type VerticalTextJustification

type VerticalTextJustification int

VerticalTextJustification Vertical Text Justification type

const (
	VTEXT_BASELINE VerticalTextJustification = iota
	VTEXT_BOTTOM
	VTEXT_MIDDLE
	VTEXT_TOP
)

Jump to

Keyboard shortcuts

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