Class: Rectangle

SuperMap.Feature.ShapeParameters.Rectangle

The rectangle parameter object.

new SuperMap.Feature.ShapeParameters.Rectangle()

Rectangle.js, line 4

Extends

Members

clickableboolean

It is clickable or not.

dataInfoObject

The additional data with shape.

heightnumber

Height.

highlightStyleObject

The highlight style object can be set with the same style properties as the style's set style properties.

hoverableboolean

It is hoverable or not.

isHoverByRefDataIDboolean

Whether to highlight in accordance with refDataID. It is used to highlight all geometries with the same refDataID.

refDataHoverGroupstring

The group name of highlight geometries. It is valid only when refDataID is valid and isHoverByRefDataID is true. Once the property is set and is valid, geometries associated with the same data and has the same property can be highlighted.

refDataIDstring

Data ID associated with shape.(<SuperMap.Feature.Vector> ID)。

refOriginalPositionArray

Shape's reference original position, shape's reference center position. refOriginalPosition is an array, the first element represents x coordinate, and the second element represents y coordinate.

refOriginalPosition represents shape's reference center. In general, the origin of canvas is the reference position. But you can change the reference position by refOriginalPosition. e.g. refOriginalPosition = [80, 80], circle style.x = 20, style.y = 20, so the real position of the circle in canvas is [100, 100].

All position properties of shape is based on the reference center of refOriginalPosition. In other words, the position of shape in canvas is relative position on the basis of refOriginalPosition. Only when refOriginalPosition is [0, 0], the shape position is the absolute position of canvas.

The information of shape position has:style.pointList,style.x,style.y。

refOriginalPosition. The default value is [0, 0].

Default Value:
[0,0]

shapeParametersObject

Shape parameter object,<SuperMap.Feature.ShapeParameters> child class object. Optional.

styleObject

The style object of the shape.Set style properties in subclasses.

widthnumber

Width.

xnumber

Upper left x coordinate.

ynumber

Upper left y coordinate.

Methods

inherited Background(shapeFactory, box, setting){Object}

ShapeFactory.js, line 373

Create a shape object with rectangle background.

Name Type Description
shapeFactory SuperMap.Feature.ShapeFactory

Shape factory object. Required.

box Array.<number>

Box area. It is an array of length 4, pixel coordinates, [left, bottom, right, top]. Required.

setting Object

Shape configure parameter. Required.

Name Type Default Description
backgroundStyle Object

Background style whose object's available property: <SuperMap.Feature.ShapeParameters.Rectangle::style>.

backgroundRadius Array [0,0,0,0] optional

The rectangular rounded corners of the background box can be defined by 4 radius: upper left, upper right, lower right, lower left, i.e., [r1, r2, r3, r4].The default backgroundRadius is [0, 0, 0, 0].

Returns:
Type Description
Object Background box shape, which is a visible shape (rectangle) object.

constructor(x, y, width, height){SuperMap.Feature.ShapeParameters.Rectangle}

Rectangle.js, line 14

Create a rectangle parameter object.

Name Type Description
x number

x coordinate of the rectangle. Required.

y number

y coordinate of the rectangle. Required.

width number

width coordinates of the rectangle. Required.

height number

Height coordinates of the rectangle. Required.

Returns:
Type Description
SuperMap.Feature.ShapeParameters.Rectangle Rectangle parameter object.

inherited createShape(shapeParameters){Object}

ShapeFactory.js, line 66

Create a shape. The specific shape is determined by shapeParameters.

Name Type Description
shapeParameters Object

Shape parameter object,<SuperMap.Feature.ShapeParameters> child class object. Optional. If using the parameter which isn't null, shapeParameters will be assigned to the parameter value, and then use shapeParameters to create a shape; If not using this parameter, the createShape method will directly use shapeParameter to create the shape.

Returns:
Type Description
Object Shape object (or null - failed to create the shape)

destroy()

Rectangle.js, line 53

Destroy objects

inherited GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo){Array.<Object>}

ShapeFactory.js, line 411

Create a shape object array with graph axis.

Name Type Description
shapeFactory SuperMap.Feature.ShapeFactory

Shape factory object. Required.

dataViewBox Array.<number>

The data view box for the graph pattern. It is an array of length 4, pixel coordinates, [left, bottom, right, top]. Required.

setting Object

Shape configure parameter. Required.

Name Type Default Description
axisStyle Object

The shape object in the s direction has 2 properties:

axisUseArrow boolean false optional

Whether the axis uses arrow. The default is false, which means not using arrow.

axisYTick number 0 optional

y axis tick. Default is 0 which means tick isn't used.

axisYLabels Array.<string>

The label array contents on the y axis. The label order is listed equally interval from top to down along the left data view box. e.g.:["1000", "750", "500", "250", "0"].

axisYLabelsStyle Object

The label array style on the y axis. The style object's available property: <SuperMap.Feature.ShapeParameters.Label::style>.

axisYLabelsOffset Array.<number> [0,0] optional

The label array offset on the y axis. It is an array of 2 length. The first element is the horizontal offset for the y label array, positive to left, default is 0;

axisXLabels Array.<string>

The label array contents on the x axis. The label order is listed equally interval from top to down along the bottom data view box. e.g.:["92", "95", "99"]. the second element is the vertical offset for the y label array, positive to down, default is 0.

axisXLabelsStyle Object

The label array style on the x axis. The style object's available property: <SuperMap.Feature.ShapeParameters.Label::style>.

axisXLabelsOffset Array.<number> [0,0] optional

The label array offset on the x axis. It is an array of 2 length. The first element is the horizontal offset for the x label array, positive to left, default is 0;

useXReferenceLine boolean

Whether to use horizontal reference line. If ture, it is valid when axisYTick is greater than 0. The horizontal reference line is an extended line in the data view box along the y axis scale.

xReferenceLineStyle Object

Horizontal reference line style style whose object's available property: <SuperMap.Feature.ShapeParameters.Line::style>.

axis3DParameter number 0 optional

3D coordinate parameter. This property is available only when the value is greater than or equal to 15. The default is 0.

xShapeInfo Object

The shape object in the s direction has 2 properties:

Name Type Description
xPositions Array.<number>

Represent pixel coordinates in x direction. If the shape has certain width in the x direction, the center point for the x direction for the shape will be regarded as the x coordinate value.

width number

Represent the shape width (Note that the width of the point is always 0, it isn't a radius).

Returns:
Type Description
Array.<Object> A shape object array with graph axis.

inherited ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value){Object}

ShapeFactory.js, line 756

A shape style tool. This tool helps to get the final merged style from the default style, common style, style by styleGroup and style by value.

Name Type Description
defaultStyle Object

Default style. The style object available property is based on shape type reference <SuperMap.Feature.ShapeParameters> child object style property.

style Object

Shape basic style. This parameter controls shape's basic style. The available property is based on shape type reference <SuperMap.Feature.ShapeParameters> child object style property. The priority is lower than styleGroup, styleByCodomain.

styleGroup Array.<Object>

Each element of the array is style object whos available property is based on shape type reference <SuperMap.Feature.ShapeParameters> child object style property. Style is obtained from styleGroup via index.

styleByCodomain Array.<Object>

Control data visible style according to the threshold range (parameter value). (start code) // styleByCodomain Each element is an object containing information and domain and range corresponding to the style information, the object has three properties (must): // start: range lower limit (included); // end: range upper limit (not included); // style: Data visualization graphics style, this style object can be set properties: <SuperMap.Feature.ShapeParameters.Polygon::style>. // dataStyleByCodomain array like: [ { start:0, end:250, style:{ fillColor:"#00CD00" } }, { start:250, end:500, style:{ fillColor:"#00EE00" } }, { start:500, end:750, style:{ fillColor:"#00FF7F" } }, { start:750, end:1500, style:{ fillColor:"#00FF00" } } ] (end)

index number

styleGroup index, which is used to get the style from styleGroup.

value number

Value, which is used to get the style from styleByCodomain.

Returns:
Type Description
Object The style object after merged.

inherited transformStyle(style){Object}

ShapeFactory.js, line 260

Transform the format of the user feature.style(the SVG style class) to the format standard (the CSS-Canvas class) of the levelRenderer

Name Type Description
style Object

user style.

Returns:
Type Description
Object the style conforming to the levelRenderer.

Type Definitions

SuperMap.Feature.ShapeParameters.Rectangle.styleObject

Properties:
Name Type Description
fill boolean

Whether or not to fill, if you don't need to fill it, set it to false, the default value is true. If fill and stroke are false at the same time, the layers will be rendered by the default values of fill and stroke.

fillColor string

Sixteen decimal fill color. The default value is"#000000".

fillOpacity number

fill opacity. The range is [0, 1], and the default value is 1.

stroke boolean

Whether stroke, if you don't need to stroke it, set it to false, the default value is false. If fill and stroke are false at the same time, the layers will be rendered by the default values of fill and stroke.

strokeColor string

Sixteen decimal stroke color. The default value is "#000000".

strokeWidth number

width of the line/width of the stroke, the default value is 1.

strokeLinecap string

Style of the line cap. StrokeLinecap have three format: "butt", "round", and "square"; the default is "butt".

strokeLineJoin string

Style of the line segment connection; strokeLineJoin have three format: "miter", "round", "bevel"; the default is "miter".

strokeDashstyle string

Type of dotted lines; strokeDashstyle have eight format: "dot","dash","dashot","longdash","longdashdot","solid", "dashed", "dotted". The default value is "solid". "Solid" representation of solid lines.

strokeOpacity number

stroke opacity. The range is [0, 1], and the default value is 1.

shadowBlur number

Shadow blur, (more than 0 is valid; default value is 0).

shadowColor number

Shadow color; The default value is '#000000'.

shadowOffsetX number

Shadow X direction offset value; The default value is 0.

shadowOffsetY number

Shadow Y direction offset value; The default value is 0.