Skip to content

API / geotoolkit / renderer / GraphicsPath / GraphicsPath

Class: GraphicsPath

renderer.GraphicsPath.GraphicsPath

Provides a container for connected lines, curves.

Table of contents

Constructors
  • [new GraphicsPath(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.renderer.graphicspath.graphicspath.md#new graphicspath(options))
Methods
Css Properties
Name Type Description
boundsRectBounds
bounds-heightnumberHeight
bounds-readonlybooleanReadonly
bounds-widthnumberWidth
bounds-xnumberLeft
bounds-ynumberTop

Contents

Constructors

new GraphicsPath(options)

• new GraphicsPath(options?)

Parameters

Name Type
Optional optionsOptions
Methods

arcTo

▸ arcTo(x1, y1, x2, y2, radius): GraphicsPath

Add command to draw an arc from the current position to specified point

Parameters

Name Type Description
x1numberx-coordinate of control point
y1numbery-coordinate of control point
x2numberThe x-coordinate of the destination point
y2numberThe y-coordinate of the destination point
radiusnumberThe radius of arc

Returns

GraphicsPath

this


bezierCurveTo

▸ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y): GraphicsPath

Draws a cubic Bezier curve from the current point to the point (x, y), with control points (cp1x, cp1y) and (cp2x, cp2y).

Parameters

Name Type Description
cp1xnumberthe x coordinate of the first control point
cp1ynumberthe y coordinate of the first control point
cp2xnumberthe x coordinate of the second control point
cp2ynumberthe y coordinate of the second control point
xnumberthe x coordinate of the end point
ynumberthe y coordinate of the end point

Returns

GraphicsPath

this


clear

▸ clear(): GraphicsPath

Remove all of this path's points.

Returns

GraphicsPath

this


clone

▸ clone(): GraphicsPath

Create a deep copy

Returns

GraphicsPath

clone


close

▸ close(): GraphicsPath

Close path

Returns

GraphicsPath

this


copy

▸ copy(src): GraphicsPath

Copy path from source

Parameters

Name Type Description
srcGraphicsPathsource path to copy from

Returns

GraphicsPath


copyConstructor

▸ Protected copyConstructor(src): void

Copy constructor

Parameters

Name Type Description
srcGraphicsPathinstance to create a copy from

Returns

void


getBounds

▸ getBounds(): Rect

Return bounds

Returns

Rect


getClassName

▸ getClassName(): string

Returns

string


getElement

▸ getElement(i): { type: LINETO | MOVETO ; x: number ; y: number } | { radius: number ; type: ARCTO ; x1: number ; x2: number ; y1: number ; y2: number } | { cp1x: number ; cp1y: number ; cp2x: number ; cp2y: number ; type: BEZIERCURVETO ; x: number ; y: number } | { type: CLOSE }

Returns the element at the given index in the painter path.

Parameters

Name Type Description
inumberindex of the element

Returns

{ type: LINETO | MOVETO ; x: number ; y: number } | { radius: number ; type: ARCTO ; x1: number ; x2: number ; y1: number ; y2: number } | { cp1x: number ; cp1y: number ; cp2x: number ; cp2y: number ; type: BEZIERCURVETO ; x: number ; y: number } | { type: CLOSE }


getElementCount

▸ getElementCount(): number

Returns the number of elements

Returns

number


getIndex

▸ getIndex(i): number

Returns a start index in the x and y for the current command.

Parameters

Name Type Description
inumberindex of the element

Returns

number


getLength

▸ getLength(): number

Returns the length of the current path.

Returns

number


getProperties

▸ getProperties(): Required<Options&gt;

Gets all the properties pertaining to this object

Returns

Required<Options&gt;

properties object


getTags

▸ getTags(): PointType[]

Returns an array of tags.

Returns

PointType[]


getX

▸ getX(): number[]

Returns an array of x coordinates.

Returns

number[]


getY

▸ getY(): number[]

Returns an array of y coordinates.

Returns

number[]


intersect

▸ intersect(rect): GraphicsPath

Makes the intersection of this path's fill area and rectangle. This method is experimental and work for bounds only.

Throws

if the rect is null

Parameters

Name Type Description
rectRectthe specified rectangle

Returns

GraphicsPath

this


isEmpty

▸ isEmpty(): boolean

Returns true if there are no elements in this path

Returns

boolean


lineTo

▸ lineTo(x, y): GraphicsPath

Add command to draw a line from the current position to specified point

Parameters

Name Type Description
xnumberThe x-coordinate of the destination point
ynumberThe y-coordinate of the destination point

Returns

GraphicsPath

this


moveTo

▸ moveTo(x, y): GraphicsPath

Add command to move the current position.

Parameters

Name Type Description
xnumberThe x-coordinate of the destination point
ynumberThe y-coordinate of the destination point

Returns

GraphicsPath


setProperties

▸ setProperties(properties?): GraphicsPath

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

GraphicsPath


toString

▸ toString(): string

Returns the path's string representation

Returns

string


transform

▸ transform(transformation): GraphicsPath

Transform path using the current transformation

Parameters

Name Type Description
transformationTransformationthe specified transformation

Returns

GraphicsPath


fromRect

▸ Static fromRect(rect): GraphicsPath

Returns a path shape which represents a rectangle

Parameters

Name Type Description
rectRectrectangle

Returns

GraphicsPath

instance


fromSVG

▸ Static fromSVG(str): GraphicsPath

Returns a path shape created from SVG formatted path string

Parameters

Name Type Description
strstringSVG formatted path

Returns

GraphicsPath


getClassName

▸ Static getClassName(): string

Returns

string