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. 
 
var strKey = object.getId();SetGridPosition(leftTop, rightTop, rightBottom, leftBottom, altitude, row, col) → number
Creates a 2D grid object based on four longitude and latitude coordinates.
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 - Refer to function showGrid. 
 
var colorGrid2D = Module.createColorGrid("COLOR_GRID_2D");
var gridCellNum = colorGrid2D.SetGridPosition(new Module.JSVector2D(124.2, 39), new Module.JSVector2D(130.5, 39), new Module.JSVector2D(130.5, 34.5), new Module.JSVector2D(124.2, 34.5), 100000.0, 100, 100);SetGridPositionByCellOptions(leftTop, altitude, width, height, row, col) → number
Creates a 2D grid object from the top left position.
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. 
 
var colorGrid2D = Module.createColorGrid("COLOR_GRID_2D");
var gridCellNum = colorGrid2D.SetGridPositionByCellOptions(new Module.JSVector2D(124.2, 39), 100000.0, 1000, 1000, 100, 100);SetGridPositionByCellSize(leftTop, rightBottom, altitude, width, height) → number
Creates a 2D grid object based on minimum and maximum longitude and latitude coordinates.
altitude
number
Object height.
width
number
Width of the grid.
height
number
Height of the grid.
- Return - Total number of grid cells. 
 
var colorGrid2D = Module.createColorGrid("COLOR_GRID_2D");
var gridCellNum = colorGrid2D.SetGridPositionByCellSize(new Module.JSVector2D(124.2, 39), new Module.JSVector2D(130.5, 34.5), 100000.0, 1000, 1000);SetGridCellDefaultColor(color) → boolean
Sets the default color value for the grid.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
- Sample - Refer to function showGrid. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetGridCellDefaultColor(new Module.JSColor(255, 255, 255, 0));SetGridCellColor(row, column, color) → boolean
Sets the color value for the cell at the specified horizontal and vertical index.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
- Failure conditions. - If the specified horizontal or vertical index exceeds the range. 
 
 
- Sample - Refer to function showGrid. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetGridCellColor(0, 0, new Module.JSColor(255, 255, 0, 0));SetLeftToRightSlopeAngle(angle) → boolean
Sets the slope angle along the x-axis.
angle
number
Angle(in degrees).
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetLeftToRightSlopeAngle(30);SetLeftToRightSlopeAngleByAltitude(left, right) → boolean
Sets the slope based on altitude values for the left and right sides.
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. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetLeftToRightSlopeAngleByAltitude(100000, 150000);SetFrontToBackSlopeAngle(angle) → boolean
Sets the slope angle along the y-axis.
angle
number
Angle(in degrees).
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetFrontToBackSlopeAngle(30);SetFrontToBackSlopeAngleByAltitude(top, bottom) → boolean
Sets the slope based on altitude values for the top and bottom.
top
number
Altitude at the top.
bottom
number
Altitude at the bottom.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetFrontToBackSlopeAngleByAltitude(100000, 150000);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.
angle
number
Direction angle.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetDirectionAngle(0);SetTerrainUnion(union) → boolean
Sets whether the 2D grid object is combined with the terrain.
union
boolean
true for terrain union, false for object-based positioning.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetTerrainUnion(true);SetTerrainUnionGap(altitude) → boolean
Sets the height value after combining the 2D grid object with the terrain.
altitude
number
Height from the terrain.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetTerrainUnion(true);
colorGrid2D.SetTerrainUnionGap(100);SetDrawLine(type) → boolean
Sets the creation of the border for the 2D grid object.
The initial setting for border creation is false.
type
boolean
true for creating a border. false for not creating a border.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetDrawLine(true);SetGridLineColor(color) → boolean
Sets the border color of the 2D grid object.
- Return - true: Object option setting successful. 
- false: Object option setting failed. 
- Failure conditions. - If the 2D grid border is not created. 
 
 
- Sample - Refer to function showGrid. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.SetGridLineColor(new Module.JSColor(255, 255, 0, 0));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. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();
var position = colorGrid2D.GetGridLeftTopPosition();
var lon = position.Longitude;
var lat = position.Latitude;
var alt = position.Altitude;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. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();
var position = colorGrid2D.GetGridRightTopPosition();
var lon = position.Longitude;
var lat = position.Latitude;
var alt = position.Altitude;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. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
//...set grid object options...
colorGrid2D.Create();
var position = colorGrid2D.GetGridLeftBottomPosition();
var lon = position.Longitude;
var lat = position.Latitude;
var alt = position.Altitude;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. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();
var position = colorGrid2D.GetGridRightBottomPosition();
var lon = position.Longitude;
var lat = position.Latitude;
var alt = position.Altitude;GetGridCellPosition(row, column) → JSVector3D
Returns the central longitude and latitude coordinate of the cell at the specified horizontal and vertical index.
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. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();
var position = colorGrid2D.GetGridCellPosition(0, 0);
var lon = position.Longitude;
var lat = position.Latitude;
var alt = position.Altitude;GetGridCellRect(row, column) → JSVec3Array
Returns the coordinates of each point (4 points) of the cell at the specified horizontal and vertical index.
row
number
Cell horizontal index.
column
number
Cell vertical index.
- Return - JSVec3Array: Successfully returns the coordinates of each point. 
- null: Coordinate return failed. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();
var position = colorGrid2D.GetGridCellRect(0, 0);
var leftTop = position.get(0);
var rightTop = position.get(1);
var rightbottom = position.get(2);
var leftbottom = position.get(3);
var lon = leftTop.Longitude;
var lat = leftTop.Latitude;
var alt = leftTop.Altitude;GetGridCellIndexByPosition(position) → string
Returns the cell index corresponding to the longitude and latitude coordinate.
- Return - string: Successfully returns the cell index number. 
- null: If the object is null. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();
var Index = colorGrid2D.GetGridCellIndexByPosition(new Module.JSVector2D(124.2, 39.5, 100));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.
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. 
 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();
var linelist = colorGrid2D.GetGridEdgeLinePosition(0, 0);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 - Refer to function showGrid. 
 
var colorGrid2D = Module.createColorGrid2D("COLOR_GRID_2D");
colorGrid2D.Create();Getter / Setter
getDescription(), setDescription(desc) → string
Set a description for the object.
desc
string
Object description string.
- Return - string: Successful return of the object's description string. 
- null: If the object is null. 
 
var strDesc = object.getDescription();
// ... or ...
object.setDescription("First Object.");getName(), setName(name) → string
Sets the name of the object.
name
string
The name to set for the object.
- Return - string: Successful return of the object's name. 
- null: If the object is null. 
 
var objName = object.getName();
// ... or ...
object.setName("MyObject");getVisible(), setVisible(visible) → boolean
Sets the visibility state of an object.
visible
boolean
true: Make the object visible. false: Hide the object.
- Return - true: Object visible state. 
- false: Object hidden state. 
 
var objName = object.getName();
// ... or ...
object.setVisible(true);Last updated
