JSPolygon
API for creating and modifying polygon objects.
Create a API with Module.createPolygon.
var object = Module.createPolygon("ID");Function
getArea() → number
Returns the area value of the object.
The returned area value is calculated based on a simple planar object without considering the terrain.
Therefore, there may be some differences in the visible area for planes rendered with terrain RTT.
- Return - number(> 0): Successful return of the object's area. 
- number(0): If the object is null. 
 
var area = object.getArea();getBoundary() → JSAABBox3D
Returns the object's boundary.
- Return - JSAABBox3D: The function successfully returns the object's bounds. 
- null: Object bounds return failed. 
 
var boundary = object.getBoundary();
var boundary_min = boundary.min;
var boundary_max = boundary.max;getCenter() → JSVector3D
Returns the center point of the object.
- Return - JSVector3D: Returns the centroid coordinates (longitude, latitude, altitude) of the object successfully. 
- null: Coordinate return failed. 
 
var vCenter = object.getCenter();
var dCenterLon = vCenter.Longitude;
var dCenterLat = vCenter.Latitude;
var dCenterAlt = vCenter.Altitude;getExtent() → number
Returns the distance between Min-Max of the object boundary Box.
- Return - number: Distance between Min-Max of the object boundary Box. 
 
var bExtends = object.getExtent();getId() → string
Returns the ID of the object.
- Return - string: Successful return of the object's Key string. 
- null: If the object is null. 
 
lat strKey = object.getId();loadFile(option) → boolean
Loads a 3ds file and creates a polygon object.
The object is set using the argument variable.
- Return - true: Object creation successful. 
- false: Object creation failed. 
- Failure conditions. - When positionmode=true and projectioncode is not set 
- When positionmode=false and position is not specified 
 
 
- Sample - Refer to the load3DS function. 
 
loadTexture(name, url) → boolean
Registers a texture image to be used for the polygon.
The name is used to distinguish the texture when applying the texture with the setFaceTexture API.
name
string
Texture registration name.
url
string
Texture image URL.
- Return - true: Object creation successful. 
- false: Object creation failed. 
- Failure conditions. - If there is already a texture with the same name. 
- If name, url are empty strings. 
 
 
- Sample - Refer to the init function. 
 
setCircle(position, radius, segment)
Creates a circular planar object based on the center coordinates.
Must set radius input value > 0.
Must set segment input value > 3.
radius
number
Radius.
segment
number
Number of vertices.
- Sample - Refer to the createCirclePolygon function. 
 
setFaceTexture(index, name) → boolean
Sets the face texture that makes up the polygon object.
index
number
Polygon face index where the texture will be used
name
string
Texture name specified with the loadTexture API
- Return - true: Object creation successful. 
- false: Object creation failed 
- Failure conditions. - If the specified texture name does not exist 
- If the polygon face with the specified index does not exist 
 
 
- Sample - Refer to the init function. 
 
setFireEffect(type) → boolean
Sets a fire effect on the surface of the polygon.
type
boolean
true for fire effect visualization(RTT). false for default visualization.
- Return - true: Object setting successful. 
- false: Object setting failed. 
- Failure conditions. - If the polygon coordinates are not set. 
 
 
- Sample - Refer to the createBurnEffectPolygon function. 
 
setHeight(height) → boolean
Creates a 3D polygon with height from a planar polygon.
Must set height input value > 0 (in meters).
height
number
Polygon height.
- Return - true: Object setting successful. 
- false: Object setting failed. 
- Failure conditions. - If the polygon coordinates are not set. 
 
 
- Sample - Refer to the createPolygon function. 
 
setPartCoordinates(coordinates, parts) → boolean
Create polygons based on input data (vertex, part).
- Return - true: Object creation successful. 
- false: Object creation failed. 
- Failure conditions - If there are no components entered for coordinates or if the number of vertices is less than 3. 
- If there are no components entered for parts or if there is less than 1 part. 
 
 
- Sample - Refer to the createPolygon function. 
 
setPartCoordinatesUV(coordinates, parts, uv, type) → boolean
Create polygons based on input data (vertex, part, uv).
type
boolean
true for terrain combined visualization(RTT). false for default visualization.
- Return - true: Object creation successful. 
- false: Object creation failed 
- Failure conditions - If there are no components entered for coordinates or if the number of vertices is less than 3. 
- If there are no components entered for parts or if there is less than 1 part. 
- If there are no components entered for uv or if there are less than 3 uv coordinates. 
- If the number of coordinates and uv do not match. 
 
 
- Sample - Refer to the init function. 
 
Getter / Setter
getCoordinates(), setCoordinates(coordinates) → Collection
Sets the list of coordinates for the polygon object.
Must set the number of components in coordinates > 3.
- Return - Collection: List of longitude, latitude, altitude coordinates. 
 
var coorList = object.getCoordinates();
// ... or ...
var vertexList = Module.getMap().getInputPointList();
var object = Module.createPolygon("polygon");
object.setCoordinates(vertexList);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);getStyle(), setStyle(style) → JSPolygonStyle
Changes the object style with options applied in JSPolygonStyle.
Sets the color, thickness, and transparency.
- Return - A valid object style (JSPolygonStyle): If the object style is successfully returned. 
- A simply initialized object style (JSPolygonStyle): If the object is null. 
 
var objectStyle = polyLine.getStyle();Type Definitions
JSPolygon.loadFileOption
Options for creating a polygon object after loading a 3ds file.
url
string
URL address of the 3D modeling object to be visualized.
align
string
Alignment.
Last updated
