Class: Rectangle

Rectangle

Represents a Rectangle geometry.

new Rectangle(coordinates, width, height, optionsopt) [source]

var rectangle = new Rectangle([100, 0], 1000, 500, {
    id : 'rectangle0'
});
Parameter Type Default Description
coordinates Coordinate northwest of the rectangle
width Number width of the rectangle, in meter
height Number height of the rectangle, in meter
options opt Object null options defined in Rectangle
Extends:

Members

  • (constant) options

  • Inherited From:
    Properties:
    Name Type Description
    options Object configuration options
    Properties
    Name Type Default Description
    smoothness opt String 0 line smoothing by quad bezier interporating, 0 by default
    symbol Object Path's default symbol
    id opt Boolean null id of the geometry
    visible opt Boolean true whether the geometry is visible.
    editable opt Boolean true whether the geometry can be edited.
    cursor opt String null cursor style when mouseover the geometry, same as the definition in CSS.
    measure opt String EPSG:4326 the measure code for the geometry, defines measureGeometry how it can be measured.
    draggable opt Boolean false whether the geometry can be dragged.
    dragShadow opt Boolean false if true, during geometry dragging, a shadow will be dragged before geometry was moved.
    dragOnAxis opt Boolean null if set, geometry can only be dragged along the specified axis, possible values: x, y
    Inherited From:
    Source:

    Methods

  • getCoordinates() [source]

  • Get coordinates of rectangle's northwest
    Returns:
    Coordinate:
  • setCoordinates(nw) [source]

  • Set a new coordinate for northwest of the rectangle
    Parameter Type Description
    nw Coordinate coordinates of new northwest
    Fires:
    Returns:
    Rectangle: this
  • getWidth() [source]

  • Get rectangle's width
    Returns:
    Number:
  • setWidth(width) [source]

  • Set new width to the rectangle
    Parameter Type Description
    width Number new width
    Fires:
    Returns:
    Rectangle: this
  • getHeight() [source]

  • Get rectangle's height
    Returns:
    Number:
  • setHeight(height) [source]

  • Set new height to rectangle
    Parameter Type Description
    height Number new height
    Fires:
    Returns:
    Rectangle: this
  • getShell() [source]

  • Gets the shell of the rectangle as a polygon
    Returns:
    Array.<Coordinate>: - shell coordinates
  • getHoles() [source]

  • Rectangle won't have any holes, always returns null
    Returns:
    Array.<Object>: an empty array
  • (inherited) getCenterInExtent(extent) [source]

  • Get center of linestring's intersection with give extent
    const extent = map.getExtent();
     const center = line.getCenterInExtent(extent);
    Parameter Type Description
    extent Extent
    Inherited From:
    Returns:
    Coordinate: center, null if line doesn't intersect with extent
  • (inherited) hasHoles() [source]

  • Whether the polygon has any holes inside.
    Inherited From:
    Returns:
    Boolean:
  • (inherited) animateShow(optionsopt, cbopt) [source]

  • Show the linestring with animation
    line.animateShow({
       duration : 2000,
       easing : 'linear'
     }, function (frame, currentCoord) {
       //frame is the animation frame
       //currentCoord is current coordinate of animation
     });
    Parameter Type Default Description
    options opt Object null animation options
    Properties
    Parameter Type Default Description
    duration opt Number 1000 duration
    easing opt String out animation easing
    cb opt function null callback function in animation, function parameters: frame, currentCoord
    Returns:
    LineString: this