shape

package
v0.0.0-...-e815181 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQUARE_TYPE        = "Square"
	REAL_SQUARE_TYPE   = "RealSquare"
	PARALLELOGRAM_TYPE = "Parallelogram"
	DOCUMENT_TYPE      = "Document"
	CYLINDER_TYPE      = "Cylinder"
	QUEUE_TYPE         = "Queue"
	PAGE_TYPE          = "Page"
	PACKAGE_TYPE       = "Package"
	STEP_TYPE          = "Step"
	CALLOUT_TYPE       = "Callout"
	STORED_DATA_TYPE   = "StoredData"
	PERSON_TYPE        = "Person"
	DIAMOND_TYPE       = "Diamond"
	OVAL_TYPE          = "Oval"
	CIRCLE_TYPE        = "Circle"
	HEXAGON_TYPE       = "Hexagon"
	CLOUD_TYPE         = "Cloud"

	TABLE_TYPE = "Table"
	CLASS_TYPE = "Class"
	TEXT_TYPE  = "Text"
	CODE_TYPE  = "Code"
	IMAGE_TYPE = "Image"
)
View Source
const CLOUD_SQUARE_INNER_HEIGHT = 0.663
View Source
const CLOUD_SQUARE_INNER_WIDTH = 0.663
View Source
const CLOUD_SQUARE_INNER_X = 0.167

The percentage values of the cloud's square inner box

View Source
const CLOUD_SQUARE_INNER_Y = 0.335
View Source
const CLOUD_TALL_ASPECT_BOUNDARY = (1 + CLOUD_TALL_INNER_WIDTH/CLOUD_TALL_INNER_HEIGHT) / 2
View Source
const CLOUD_TALL_INNER_HEIGHT = 0.820
View Source
const CLOUD_TALL_INNER_WIDTH = 0.549
View Source
const CLOUD_TALL_INNER_X = 0.228

The percentage values of the cloud's tall inner box

View Source
const CLOUD_TALL_INNER_Y = 0.179
View Source
const CLOUD_WIDE_ASPECT_BOUNDARY = (1 + CLOUD_WIDE_INNER_WIDTH/CLOUD_WIDE_INNER_HEIGHT) / 2
View Source
const CLOUD_WIDE_INNER_HEIGHT = 0.548
View Source
const CLOUD_WIDE_INNER_WIDTH = 0.819
View Source
const CLOUD_WIDE_INNER_X = 0.085

The percentage values of the cloud's wide inner box

View Source
const CLOUD_WIDE_INNER_Y = 0.409
View Source
const OVAL_AR_LIMIT = 3.
View Source
const (
	PERSON_AR_LIMIT = 1.5
)
View Source
const STEP_WEDGE_WIDTH = 35.0

Variables

This section is empty.

Functions

func LimitAR

func LimitAR(width, height, aspectRatio float64) (float64, float64)

func TraceToShapeBorder

func TraceToShapeBorder(shape Shape, rectBorderPoint, prevPoint *geo.Point) *geo.Point

TraceToShapeBorder takes the point on the rectangular border r here is the point on rectangular border p is the prev point (used to calculate slope) s is the point on the actual shape border that'll be returned

. p . │ . │ . ▼ . ┌────r─────────────────────────┐ . │ │ . │ │ │ . │ │ xxxxxxxx │ . │ ▼ xxxxx xxxx │ . │ sxxx xx │ . │ x xx │ . │ xx xx │ . │ x xx │ . │ xx xxx │ . │ xxxx xxxx │ . └──────xxxxxxxxxxxxxx──────────┘

Types

type Shape

type Shape interface {
	Is(shape string) bool
	GetType() string

	AspectRatio1() bool
	IsRectangular() bool

	GetBox() *geo.Box
	GetInnerBox() *geo.Box

	// placing a rectangle of the given size and padding inside the shape, return the position relative to the shape's TopLeft
	GetInsidePlacement(width, height, paddingX, paddingY float64) geo.Point

	GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64)
	GetDefaultPadding() (paddingX, paddingY float64)

	// Perimeter returns a slice of geo.Intersectables that together constitute the shape border
	Perimeter() []geo.Intersectable

	GetSVGPathData() []string
}

func NewCallout

func NewCallout(box *geo.Box) Shape

func NewCircle

func NewCircle(box *geo.Box) Shape

func NewClass

func NewClass(box *geo.Box) Shape

func NewCloud

func NewCloud(box *geo.Box) Shape

func NewCode

func NewCode(box *geo.Box) Shape

func NewCylinder

func NewCylinder(box *geo.Box) Shape

func NewDiamond

func NewDiamond(box *geo.Box) Shape

func NewDocument

func NewDocument(box *geo.Box) Shape

func NewHexagon

func NewHexagon(box *geo.Box) Shape

func NewImage

func NewImage(box *geo.Box) Shape

func NewOval

func NewOval(box *geo.Box) Shape

func NewPackage

func NewPackage(box *geo.Box) Shape

func NewPage

func NewPage(box *geo.Box) Shape

func NewParallelogram

func NewParallelogram(box *geo.Box) Shape

func NewPerson

func NewPerson(box *geo.Box) Shape

func NewQueue

func NewQueue(box *geo.Box) Shape

func NewRealSquare

func NewRealSquare(box *geo.Box) Shape

func NewShape

func NewShape(shapeType string, box *geo.Box) Shape

func NewSquare

func NewSquare(box *geo.Box) Shape

func NewStep

func NewStep(box *geo.Box) Shape

func NewStoredData

func NewStoredData(box *geo.Box) Shape

func NewTable

func NewTable(box *geo.Box) Shape

func NewText

func NewText(box *geo.Box) Shape

Jump to

Keyboard shortcuts

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