The Geometry class is used to define the "shape" of a Shape. A Geometry can be simple straight lines, rectangles, or ellipses. A Geometry can also be an arbitrarily complex path, consisting of a list of PathFigures. A Geometry must not be modified once it has been used by a Shape. However, a Geometry may be shared by multiple Shapes.
Construct an empty Geometry. The geometry type must be one of the following values: Geometry#Line, Geometry#Ellipse, Geometry#Rectangle, Geometry#Path.
If not supplied, the default Geometry type is Geometry#Path.
For drawing an ellipse fitting within a rectangle; a value for Geometry#type.
For drawing a simple straight line; a value for Geometry#type.
For drawing a complex path made of a list of PathFigures; a value for Geometry#type.
For drawing a rectangle; a value for Geometry#type.
Gets a rectangle that contains all points within the Geometry.
Gets or sets the ending X coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.
Gets or sets the ending Y coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.
Gets or sets the List of PathFigures that describes the content of the path for Geometries of type #Path.
Gets or sets the spot to use when the Shape#spot1 value is Spot#Default.
Gets or sets the spot to use when the Shape#spot2 value is Spot#Default.
Gets or sets the starting X coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.
Gets or sets the starting Y coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.
Gets or sets the type of the Geometry.
Computes the Geometry's bounds without adding an origin point, and returns those bounds as a rect.
Create a copy of this Geometry, with the same values and figures.
Given a SVG or GoJS path string, returns a congruent path string with each PathFigure filled. For instance, "M0 0 L22 22 L33 0" would become "F M0 0 L22 22 L33 0".
string
Normalizes the Geometry points in place by ensuring the top-left bounds of the geometry lines up with (0, 0), returning the Point (x, y) amount it was shifted.
Offsets the Geometry in place by a given (x, y) amount
The x-axis offset factor.
The y-axis offset factor.
any
Produce a Geometry from a string that uses an SVG-like compact path geometry syntax.
whether figures should be filled. If true, all PathFigures in the string will be filled regardless of the presence of an "F" command or not. If false, all PathFigures will determine their own filled state by the presence of an "F" command or not. Default is false.
Rotates the Geometry in place by a given angle, with optional x and y values to rotate the geometry about. If no x and y value are giving, (0, 0) is used as the rotation point.
The angle to rotate by.
The optional X point to rotate the geometry about. If no point is given, this value is 0.
The optional Y point to rotate the geometry about. If no point is given, this value is 0.
any
Scales the Geometry in place by a given (x, y) scale factor
The x-axis scale factor.
The y-axis scale factor.
any
This static method can be used to write out a Geometry as a string that can be read by Geometry.parse. The string produced by this method is a superset of the SVG path string rules that contains some additional GoJS-specific tokens. See the Introduction page on Geometry Parsing for more details.
string