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" )
const CLOUD_SQUARE_INNER_HEIGHT = 0.663
const CLOUD_SQUARE_INNER_WIDTH = 0.663
The percentage values of the cloud's square inner box
const CLOUD_SQUARE_INNER_X = 0.167
const CLOUD_SQUARE_INNER_Y = 0.335
const CLOUD_TALL_ASPECT_BOUNDARY = (1 + CLOUD_TALL_INNER_WIDTH/CLOUD_TALL_INNER_HEIGHT) / 2
const CLOUD_TALL_INNER_HEIGHT = 0.820
const CLOUD_TALL_INNER_WIDTH = 0.549
The percentage values of the cloud's tall inner box
const CLOUD_TALL_INNER_X = 0.228
const CLOUD_TALL_INNER_Y = 0.179
const CLOUD_WIDE_ASPECT_BOUNDARY = (1 + CLOUD_WIDE_INNER_WIDTH/CLOUD_WIDE_INNER_HEIGHT) / 2
const CLOUD_WIDE_INNER_HEIGHT = 0.548
const CLOUD_WIDE_INNER_WIDTH = 0.819
The percentage values of the cloud's wide inner box
const CLOUD_WIDE_INNER_X = 0.085
const CLOUD_WIDE_INNER_Y = 0.409
const OVAL_AR_LIMIT = 3.
const (
PERSON_AR_LIMIT = 1.5
)
const STEP_WEDGE_WIDTH = 35.0
func LimitAR(width, height, aspectRatio float64) (float64, float64)
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──────────┘
type Shape interface { Is(shape string) bool GetType() string AspectRatio1() bool IsRectangular() bool GetBox() *geo.Box GetInnerBox() *geo.Box // cloud shape has different innerBoxes depending on content's aspect ratio GetInnerBoxForContent(width, height float64) *geo.Box SetInnerBoxAspectRatio(aspectRatio float64) // 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(box *geo.Box) Shape
func NewCircle(box *geo.Box) Shape
func NewClass(box *geo.Box) Shape
func NewCloud(box *geo.Box) Shape
func NewCode(box *geo.Box) Shape
func NewCylinder(box *geo.Box) Shape
func NewDiamond(box *geo.Box) Shape
func NewDocument(box *geo.Box) Shape
func NewHexagon(box *geo.Box) Shape
func NewImage(box *geo.Box) Shape
func NewOval(box *geo.Box) Shape
func NewPackage(box *geo.Box) Shape
func NewPage(box *geo.Box) Shape
func NewParallelogram(box *geo.Box) Shape
func NewPerson(box *geo.Box) Shape
func NewQueue(box *geo.Box) Shape
func NewRealSquare(box *geo.Box) Shape
func NewShape(shapeType string, box *geo.Box) Shape
func NewSquare(box *geo.Box) Shape
func NewStep(box *geo.Box) Shape
func NewStoredData(box *geo.Box) Shape
func NewTable(box *geo.Box) Shape
func NewText(box *geo.Box) Shape