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.

getBoundary() → JSAABBox3D

Returns the object's boundary.

  • Return

    • JSAABBox3D: The function successfully returns the object's bounds.

    • null: Object bounds return failed.

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.

getExtent() → number

Returns the distance between Min-Max of the object boundary Box.

  • Return

    • number: Distance between Min-Max of the object boundary Box.

getId() → string

Returns the ID of the object.

  • Return

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

    • null: If the object is null.

loadFile(option) → boolean

Loads a 3ds file and creates a polygon object.

The object is set using the argument variable.

Name
Type
Description

option

Initialization option properties.

  • 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

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
Type
Description

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

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.

Name
Type
Description

position

Polygon location coordinates (longitude, latitude, altitude).

radius

number

Radius.

segment

number

Number of vertices.

setFaceTexture(index, name) → boolean

Sets the face texture that makes up the polygon object.

Name
Type
Description

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

setFireEffect(type) → boolean

Sets a fire effect on the surface of the polygon.

Name
Type
Description

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

setHeight(height) → boolean

Creates a 3D polygon with height from a planar polygon.

Must set height input value > 0 (in meters).

Name
Type
Description

height

number

Polygon height.

  • Return

    • true: Object setting successful.

    • false: Object setting failed.

    • Failure conditions.

      • If the polygon coordinates are not set.

  • Sample

setPartCoordinates(coordinates, parts) → boolean

Create polygons based on input data (vertex, part).

Name
Type
Description

coordinates

List of longitude, latitude, altitude coordinates.

parts

List of point counts composing the face.

  • 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

setPartCoordinatesUV(coordinates, parts, uv, type) → boolean

Create polygons based on input data (vertex, part, uv).

Name
Type
Description

coordinates

List of longitude, latitude, altitude coordinates.

parts

List of point counts composing the face.

uv

List of UV coordinates for the face.

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

Getter / Setter

getCoordinates(), setCoordinates(coordinates) → Collection

Sets the list of coordinates for the polygon object.

Must set the number of components in coordinates > 3.

Name
Type
Description

coordinates

List of longitude, latitude, altitude coordinates.

  • Return

    • Collection: List of longitude, latitude, altitude coordinates.

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.

getStyle(), setStyle(style) → JSPolygonStyle

Changes the object style with options applied in JSPolygonStyle.

Sets the color, thickness, and transparency.

Name
Type
Description

style

Object style

  • Return

    • A valid object style (JSPolygonStyle): If the object style is successfully returned.

    • A simply initialized object style (JSPolygonStyle): If the object is null.

Type Definitions

JSPolygon.loadFileOption

Options for creating a polygon object after loading a 3ds file.

Name
Type
Attributes
Default
Description

position

Polygon location coordinates (longitude, latitude, altitude).

url

string

URL address of the 3D modeling object to be visualized.

align

string

Alignment.

Last updated