JSColorGrid

API for creating and modifying 2D grid objects.

Create a API with Module.createColorGrid.

var colorGrid = Module.createColorGrid("ID");

Function

getId() → string

Returns the Key of the object.

  • Return

    • string: Successful return of the object's Key string.

    • null: If the object is null.

SetGridPosition(leftTop, rightTop, rightBottom, leftBottom, altitude, row, col) → number

Creates a 2D grid object based on four longitude and latitude coordinates.

Name
Type
Description

leftTop

Top left longitude and latitude coordinate.

rightTop

Top right longitude and latitude coordinate.

rightBottom

Bottom right longitude and latitude coordinate.

leftBottom

Bottom left longitude and latitude coordinate.

altitude

number

Object height.

row

number

Number of horizontal grid cells.

col

number

Number of vertical grid cells.

  • Return

    • Total number of grid cells.

  • Sample

SetGridPositionByCellOptions(leftTop, altitude, width, height, row, col) → number

Creates a 2D grid object from the top left position.

Name
Type
Description

leftTop

Top left longitude and latitude coordinate.

altitude

number

Object height.

width

number

Width of the grid.

height

number

Height of the grid.

row

number

Number of horizontal grid cells.

col

number

Number of vertical grid cells.

  • Return

    • Total number of grid cells.

SetGridPositionByCellSize(leftTop, rightBottom, altitude, width, height) → number

Creates a 2D grid object based on minimum and maximum longitude and latitude coordinates.

Name
Type
Description

leftTop

Top left longitude and latitude coordinate.

rightBottom

Bottom right longitude and latitude coordinate.

altitude

number

Object height.

width

number

Width of the grid.

height

number

Height of the grid.

  • Return

    • Total number of grid cells.

SetGridCellDefaultColor(color) → boolean

Sets the default color value for the grid.

Name
Type
Description

color

Grid color value.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

  • Sample

SetGridCellColor(row, column, color) → boolean

Sets the color value for the cell at the specified horizontal and vertical index.

Name
Type
Description

row

number

Cell horizontal index.

column

number

Cell vertical index.

color

Cell color value.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

    • Failure conditions.

      • If the specified horizontal or vertical index exceeds the range.

  • Sample

SetLeftToRightSlopeAngle(angle) → boolean

Sets the slope angle along the x-axis.

Name
Type
Description

angle

number

Angle(in degrees).

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetLeftToRightSlopeAngleByAltitude(left, right) → boolean

Sets the slope based on altitude values for the left and right sides.

Name
Type
Description

left

number

Altitude on the left side.

right

number

Altitude on the right side.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetFrontToBackSlopeAngle(angle) → boolean

Sets the slope angle along the y-axis.

Name
Type
Description

angle

number

Angle(in degrees).

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetFrontToBackSlopeAngleByAltitude(top, bottom) → boolean

Sets the slope based on altitude values for the top and bottom.

Name
Type
Description

top

number

Altitude at the top.

bottom

number

Altitude at the bottom.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetDirectionAngle(angle) → boolean

Sets the direction of the 2D grid object.

The rotation information based on the angle input

  • 0, 360: North.

  • 90: East.

  • 180: South.

  • 270: West.

Name
Type
Description

angle

number

Direction angle.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetTerrainUnion(union) → boolean

Sets whether the 2D grid object is combined with the terrain.

Name
Type
Description

union

boolean

true for terrain union, false for object-based positioning.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetTerrainUnionGap(altitude) → boolean

Sets the height value after combining the 2D grid object with the terrain.

Name
Type
Description

altitude

number

Height from the terrain.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetDrawLine(type) → boolean

Sets the creation of the border for the 2D grid object.

The initial setting for border creation is false.

Name
Type
Description

type

boolean

true for creating a border. false for not creating a border.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

SetGridLineColor(color) → boolean

Sets the border color of the 2D grid object.

Name
Type
Description

color

Border color.

  • Return

    • true: Object option setting successful.

    • false: Object option setting failed.

    • Failure conditions.

      • If the 2D grid border is not created.

  • Sample

GetGridLeftTopPosition() → JSVector3D

Returns the top left longitude and latitude coordinate of the 2D grid object.

  • Return

    • JSVector3D: Returns the top left coordinates (longitude, latitude, altitude) of the object successfully.

    • null: Coordinate return failed.

GetGridRightTopPosition() → JSVector3D

Returns the top right longitude and latitude coordinate of the 2D grid object.

  • Return

    • JSVector3D: Returns the top right coordinates (longitude, latitude, altitude) of the object successfully.

    • null: Coordinate return failed.

GetGridLeftBottomPosition() → JSVector3D

Returns the bottom left longitude and latitude coordinate of the 2D grid object.

  • Return

    • JSVector3D: Returns the bottom left coordinates (longitude, latitude, altitude) of the object successfully.

    • null: Coordinate return failed.

GetGridRightBottomPosition() → JSVector3D

Returns the bottom right longitude and latitude coordinate of the 2D grid object.

  • Return

    • JSVector3D: Returns the bottom right coordinates (longitude, latitude, altitude) of the object successfully.

    • null: Coordinate return failed.

GetGridCellPosition(row, column) → JSVector3D

Returns the central longitude and latitude coordinate of the cell at the specified horizontal and vertical index.

Name
Type
Description

row

number

Cell horizontal index.

column

number

Cell vertical index.

  • Return

    • JSVector3D: Returns the centroid coordinates (longitude, latitude, altitude) of the object successfully.

    • null: Coordinate return failed.

GetGridCellRect(row, column) → JSVec3Array

Returns the coordinates of each point (4 points) of the cell at the specified horizontal and vertical index.

Name
Type
Description

row

number

Cell horizontal index.

column

number

Cell vertical index.

  • Return

    • JSVec3Array: Successfully returns the coordinates of each point.

    • null: Coordinate return failed.

GetGridCellIndexByPosition(position) → string

Returns the cell index corresponding to the longitude and latitude coordinate.

Name
Type
Description

position

Cell location coordinates (longitude, latitude, altitude).

  • Return

    • string: Successfully returns the cell index number.

    • null: If the object is null.

GetGridEdgeLinePosition(type, value) → JSVec3Array

Returns the start and end longitude and latitude coordinates of the edge of the 2D grid object.

Coordinates returned based on the type input.

  • 0: top.

  • 1: right.

  • 2: bottom.

  • 3: left.

Name
Type
Description

type

string

Edge setting value.

value

number

Edge margin.

  • Return

    • JSVec3Array: Successfully returns the start and end points of the edge.

    • null: Coordinate return failed.

    • Failure conditions.

      • If a value greater than 4 is set for type.

Create() → boolean

Creates the 2D grid object based on the set options.

  • Return

    • true: Object creation successful.

    • false: Object creation failed.

    • Failure conditions.

      • If no coordinates are entered.

      • If the specified horizontal or vertical index exceeds the range.

  • Sample

Getter / Setter

getDescription(), setDescription(desc) → string

Set a description for the object.

Name
Type
Description

desc

string

Object description string.

  • Return

    • string: Successful return of the object's description string.

    • null: If the object is null.

getName(), setName(name) → string

Sets the name of the object.

Name
Type
Description

name

string

The name to set for the object.

  • Return

    • string: Successful return of the object's name.

    • null: If the object is null.

getVisible(), setVisible(visible) → boolean

Sets the visibility state of an object.

Name
Type
Description

visible

boolean

true: Make the object visible. false: Hide the object.

  • Return

    • true: Object visible state.

    • false: Object hidden state.

Last updated