📋
XDWorld_WebGL_Manual
  • 소개
    • XDWorld API
    • 시작하기
    • About EGIS
    • Release Note
      • 2.1x 버전 업데이트
      • 2.x 버전 업데이트
      • 1.6x 버전 업데이트
      • 1.5x 버전 업데이트
      • 1.4x 버전 업데이트
      • 1.3x 버전 업데이트
      • 이전 버전 업데이트
    • Tutorial
      • 카메라 설정
      • POI 생성하기
      • 폴리곤 생성하기
      • 라인 생성하기
      • 모델 추가하기
      • 레이어 설정
      • 배경 지도 설정
      • 거리 측정
      • 면적 측정
      • 높이 측정
      • 반경 측정
  • API
    • Module
    • Core
      • Collection
      • JSAABBox3D
      • JSColor
      • JSLine3D
      • JSSize2D
      • JSSize3D
      • JSVector2D
      • JSVector3D
      • JSVec2Array
      • JSVec3Array
      • JSDateTime
    • Analysis
      • JSAnalysis
      • JSAnalysisGridShadow
      • JSEarthquake
      • JSEditTerrain
      • JSFlood
      • JSGridAnal
      • JSSightAnalysis
      • JSSlope
      • JSTransparency
      • JSSolarManager
    • Camera
      • JSCamera
    • Layer
      • JSLayer
      • JSLayerList
      • JSImageryProvider
    • Map
      • JSMap
      • JSTerrain
      • JSIndexMap
    • Object
      • JSObject
      • JSAntenna
      • JSArrow
      • JSBarGraph
      • JSBarGraph3D
      • JSBillboard
      • JSColorGrid
      • JSColorGrid3D
      • JSColorPolygon
      • JSFigure
      • JSFlow
      • JSFlowPolygon
      • JSGhostSymbol
      • JSGhostSymbolMap
      • JSHTMLObject
      • JSIcon
      • JSInstanceObject
      • JSLineString
      • JSMultiCube
      • JSMultiPoint
      • JSPipe
      • JSPoint
      • JSPointGraph
      • JSPolygon
      • JSPolygonStyle
      • JSPolyLineStyle
      • JSReal3D
      • JSSurfaceGraph
      • JSSymbol
      • JSTimeSeriesObject
      • JSTraceTarget
      • JSTyphoon
      • JSVideoObject
      • JSViewFrustum
    • Option
      • JSControl
      • JSNavigationControl
      • JSOption
    • ETC
      • JSMath
      • JSProj
      • ~~JSProjection~~
      • SOPObject
      • EVENT
      • Type List
      • Tag List
Powered by GitBook
On this page
  • Function
  • getArea() → number
  • getBoundary() → JSAABBox3D
  • getCenter() → JSVector3D
  • getExtent() → number
  • getId() → string
  • loadFile(option) → boolean
  • loadTexture(id, url) → boolean
  • setCircle(position, radius, segment)
  • setFaceTexture(index, id) → boolean
  • setFireEffect(type) → boolean
  • setHeight(height) → boolean
  • setPartCoordinates(coordinates, parts) → boolean
  • setPartCoordinatesUV(coordinates, parts, uv, type) → boolean
  • createVerticalGrid(layername, lefttop, rightbottom, row, col) → boolean
  • Getter / Setter
  • getCoordinates(), setCoordinates(coordinates) → Collection
  • getDescription(), setDescription(desc) → string
  • getName(), setName(name) → string
  • getVisible(), setVisible(visible) → boolean
  • getStyle(), setStyle(style) → JSPolygonStyle
  • SetAnimationByID(id) → boolean
  • createWithFaces(parameter) → object
  • setHeightUV(uv, height) → boolean
  • setOverlayObject(options) → boolean
  • setUnionMode(bMode) → void
  • Type Definitions

Was this helpful?

  1. API
  2. Object

JSPolygon

지도 내 평면 객체를 생성 및 설정하기 위한 API 입니다.

PreviousJSPointGraphNextJSPolygonStyle

Last updated 1 month ago

Was this helpful?

Module.createPolygon() API를 생성합니다.

var object = Module.createPolygon("ID");

Function

getArea() → number

평면 객체의 면적을 반환합니다.

평면 객체의 면적은 지형 곡면률을 고려하지 않는 단순 면적값을 계산합니다.

RTT 가시화 중인 평면 객체의 면적과 3D 가시화 평면 객체의 면적은 서로 상이 할 수 있습니다.

  • Return

    • number > 0: 반환 성공.

    • number == 0: 반환 실패.

var area = object.getArea();

getBoundary() →

평면 객체의 공간 영역 좌표(경도, 위도, 고도)를 반환합니다.

  • Return

    • : 반환 성공.

    • null: 반환 실패.

var boundary = object.getBoundary();
var boundary_min = boundary.min;
var boundary_max = boundary.max;

객체의 중심 좌표(경도, 위도, 고도)를 반환합니다.

  • Return

    • null: 반환 실패.

var vCenter = object.getCenter();
var dCenterLon = vCenter.Longitude;
var dCenterLat = vCenter.Latitude;
var dCenterAlt = vCenter.Altitude;

getExtent() → number

평면 객체의 공간 영역의 장축 거리를 반환합니다.

  • Return

    • number: 거리 반환 성공.

var bExtends = object.getExtent();

getId() → string

객체의 고유 명칭을 반환 합니다.

  • Return

    • string: 객체 설명 문자열이 성공적으로 반환.

    • null: 객체가 null인 경우.

var strKey = object.getId();

loadFile(option) → boolean

3ds 포맷 파일 정보를 기반으로 평면 객체를 생성합니다.

Name
Type
Description

option

속성 정보.

  • Return

    • true: 생성 성공.

    • false: 생성 실패.

    • 실패 조건

      • positionmode=true 일 때 projectioncode가 설정되지 않은 경우

      • positionmode=false 일 때 position이 지정되지 않은 경우

  • Sample

    • the load3DS function 참조.

loadTexture(id, url) → boolean

평면 객체에 사용할 이미지를 설정합니다.

Name
Type
Description

id

string

고유 명칭.

url

string

이미지 url.

  • Return

    • true: 생성 성공.

    • false: 생성 실패.

    • 실패 조건

      • If there is already a texture with the same name.

      • If name, url are empty strings.

  • Sample

    • the init function 참조.

setCircle(position, radius, segment)

중심 좌표(경도, 위도, 고도)를 기준으로 원 객체를 생성합니다.

입력 변수값(radius)으로 크기를 설정합니다.

입력 변수값(radius)은 0보다 큰값, 입력 변수값(segment)은 3보다 큰값이 설정됩니다.

Name
Type
Description

position

중심 좌표 (경도, 위도, 고도).

radius

number

반지름 (in meter).

segment

number

단면의 다각수.

  • Sample

    • the createCirclePolygon function 참조.

setFaceTexture(index, id) → boolean

평면 객체를 구성하는 face에 이미지를 설정합니다.

Name
Type
Description

index

number

face 인덱스.

id

string

고유 명칭.

  • Return

    • true: 생성 성공.

    • false: 생성 실패.

    • 실패 조건

      • 등록한 이미지 고유 명칭이 없는 경우.

      • 입력 변수값(index)이 평면 객체 face 갯수를 초과 또는 음수값이 설정된 경우.

  • Sample

    • the init function 참조.

setFireEffect(type) → boolean

평면 객체에 불 효과를 설정합니다.

Name
Type
Description

type

boolean

true: 불 효과 가시화(RTT). false: 기본 가시화.

  • Return

    • true: 설정 성공.

    • false: 설정 실패.

    • 실패 조건

      • 평면 객체 생성 실패한 경우.

  • Sample

    • the createBurnEffectPolygon function 참조.

setHeight(height) → boolean

평면 객체 생성 시 높이값을 가진 3d 객체를 생성합니다.

입력 변수값(height)은 0보다 큰값이 설정됩니다.

Name
Type
Description

height

number

객체 높이(in meter).

  • Return

    • true: 설정 성공.

    • false: 설정 실패.

    • 실패 조건

      • 평면 객체 생성 실패한 경우.

  • Sample

    • the createPolygon function 참조.

setPartCoordinates(coordinates, parts) → boolean

평면 객체 생성에 필요한 정점 좌표 목록을 설정합니다.

Name
Type
Description

coordinates

정점 좌표 목록 (경도, 위도, 경도).

parts

평면을 구성하는 coordinates 개수 목록.

  • Return

    • true: 생성 성공.

    • false: 생성 실패.

    • 실패 조건

      • 입력 변수값(coordinates) 구성요소가 없거나 정점 개수가 3개 이하인 경우.

      • 입력 변수값(parts) 구성요소가 없거나 입력 배열이 1개 이하인 경우.

  • Sample

    • the createPolygon function 참조.

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

평면 객체를 생성합니다.

입력 변수값(uv)로 평면에 이미지 표현 좌표를 설정합니다.

Name
Type
Description

coordinates

정점 좌표 목록 (경도, 위도, 경도).

parts

평면을 구성하는 coordinates 개수 목록.

uv

cordinates에 입력된 좌표 목록에 해당되는 uv 좌표 목록.

type

boolean

true: 지형 결합 가시화(RTT). false: 기본 가시화.

  • Return

    • true: 생성 성공.

    • false: 생성 실패.

    • 실패 조건

      • 입력 변수값(coordinates) 구성요소가 없거나 정점 개수가 3개 이하인 경우.

      • 입력 변수값(parts) 구성요소가 없거나 입력 배열이 1개 이하인 경우.

      • 입력 변수값(uv) 구성요소가 없거나 입력 배열이 3개 이하인 경우.

      • coordinates, uv 개수가 동일하지 않는 경우.

  • Sample

    • the init function 참조.

createVerticalGrid(layername, lefttop, rightbottom, row, col) → boolean

평면 그리드 객체를 생성합니다.

Name
Type
Description

layername

string

레이어 이름.

lefttop

좌측 상단 좌표.

rightbottom

우측 하단 좌표.

row

number

새로 개수.

col

number

가로 개수.

  • Return

    • true : 생성 성공.

    • false : 생성된 객체가 없을 경우.

  • Sample

    • function createVerticalPlane 참조.

Getter / Setter

평면 객체를 구성하는 좌표 목록을 설정합니다.

입력 변수값(coordinates)은 최소 3개 이상의 배열로 구성합니다.

Name
Type
Description

coordinates

정점 좌표 목록 (경도, 위도, 경도).

  • Return

var coorList = object.getCoordinates();
// ... or ...
var vertexList = Module.getMap().getInputPointList();
var object = Module.createPolygon("polygon");
object.setCoordinates(vertexList);

getDescription(), setDescription(desc) → string

객체에 대한 설명을 설정합니다.

Name
Type
Description

desc

string

설명 문자열.

  • Return

    • string: 객체 설명 문자열이 성공적으로 반환.

    • null: 객체가 null인 경우.

var strDesc = object.getDescription();
// ... or ...
object.setDescription("First Object.");

getName(), setName(name) → string

객체 이름을 설정합니다.

Name
Type
Description

name

string

객체 이름.

  • Return

    • string: 객체 이름을 성공적을 반환

    • null: 객체가 null인 경우.

var objName = object.getName();
// ... or ...
object.setName("MyObject");

getVisible(), setVisible(visible) → boolean

객체의 가시화 유무를 설정합니다.

Name
Type
Description

visible

boolean

true: 객체 가시화. false: 객체 비가시화.

  • Return

    • true: 객체 가시화 상태.

    • false: 객체 비가시화 상태.

var objName = object.getName();
// ... or ...
object.setVisible(true);

평면 객체의 색상, 투명도, 외각선 등을 설정합니다.

Name
Type
Description

style

속성 정보.

  • Return

var objectStyle = polyLine.getStyle();

SetAnimationByID(id) → boolean

GLTF 객체의 애니메이션을 ID 기준으로 설정합니다. 평면 객체 타입이 GLTF 형식일 경우에만 동작합니다.

Name
Type
Description

id

number

애니메이션 ID (정수 값).

  • Return

    • true: 설정 성공.

    • false: 설정 실패.

      • 객체가 null이거나 GLTF 객체가 아닌 경우.

      • 입력된 ID와 일치하는 애니메이션이 없는 경우.

var gltfObject = Module.createPolygon("GLTF_OBJECT");
gltfObject.SetAnimationByID(0);

createWithFaces(parameter) → object

Face 정보를 기반으로 평면 객체를 생성합니다. 다각형을 Face 단위로 정의하고, 위치, 색상, 텍스처 좌표 등 세부 속성을 지정하여 생성할 수 있습니다.

Name
Type
Description

parameter

object

Face 기반 객체 정의 속성 정보.

  • Return

    • object

      • result: 1 → 생성 성공 / 0 → 실패

      • name: "JSPolygon.createWithFaces"

      • return: 메시지

  • 필수 속성

    • position: [longitude, latitude, altitude] 중심 좌표.

    • faceInfo: Face 배열. 각 Face는 다음과 같은 속성 포함:

      • vertex: [x, y, z, ...] 정점 배열.

      • indexVertex: [ [a, b, c], ... ] 정점 인덱스 배열.

      • indexUV: [ [a, b, c], ... ] 텍스처 좌표 인덱스 배열.

      • uv: [u, v, u, v, ...] 텍스처 좌표 배열.

      • normal: [x, y, z] 노멀 벡터.

      • color: 색상 (JSColor 형식).

      • matrix: 4x4 행렬 형식의 변환 매트릭스 (선택 사항).

  • 선택 속성

    • upVector: "y" 또는 "z" (기본값: "z").

    • cullMode: "none", "cw", "ccw" (기본값: "ccw").

    • moveOffset: [x, y, z] 오프셋(meter 단위).

    • vertexCombined: boolean.

const parameter = {
  position: [127.0, 37.5, 0],
  upVector: "z",
  cullMode: "ccw",
  faceInfo: [
    {
      vertex: [0, 0, 0, 1, 0, 0, 0, 1, 0],
      indexVertex: [[0, 1, 2]],
      indexUV: [[0, 1, 2]],
      uv: [0, 0, 1, 0, 0, 1],
      normal: [0, 0, 1],
      color: new Module.JSColor(255, 0, 0, 255),
      matrix: [
        1, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 1, 0,
        0, 0, 0, 1
      ]
    }
  ]
};

const result = Module.createPolygon("F_POLY").createWithFaces(parameter);
console.log(result);

setHeightUV(uv, height) → boolean

평면 객체의 높이를 설정하고, 정점에 해당하는 텍스처 좌표(UV)를 지정하여 텍스처를 입힐 수 있는 3D 객체를 생성합니다. 이 API는 기존에 setPartCoordinates() 또는 setCoordinates()로 정의된 객체에만 적용 가능합니다.

Name
Type
Description

uv

정점 텍스처 좌표 목록 (UV 좌표계).

height

number

객체 높이 (단위: meter, > 0).

  • Return

    • true : 생성 성공.

    • false : 객체가 없거나 정점 정보가 없을 경우 실패.

  • 제약 조건

    • 객체에 setPartCoordinates() 또는 setCoordinates()로 정점 정보가 먼저 설정되어 있어야 합니다.

    • uv.get(i) 는 i번째 정점에 대응됩니다.

const uvList = new Module.JSVec2Array();
uvList.push(new Module.JSVector2D(0, 0));
uvList.push(new Module.JSVector2D(1, 0));
uvList.push(new Module.JSVector2D(0, 1));

const polygon = Module.createPolygon("TEX_POLY");
polygon.setCoordinates(vertexList);
polygon.setHeightUV(uvList, 20);

setOverlayObject(options) → boolean

오버레이 객체를 지도에 생성합니다. 주어진 정점 정보와 스타일 옵션에 따라 평면 또는 선형 오버레이를 생성합니다.

Name
Type
Description

options

object

오버레이 객체 옵션. 아래 속성 참고.

options 구조

Name
Type
Required
Description

coordinate

✔

객체를 구성하는 좌표 목록 (경도, 위도, 고도). 최소 3개 이상 필요.

style

string

✔

스타일 설정. "polygon" 또는 "line" 중 하나.

color

객체 색상. (기본값: 빨간색 rgba(255, 0, 0, 1))

  • Return

    • true : 오버레이 생성 성공.

    • false : 생성 실패 (좌표 부족, 잘못된 타입, 내부 오류 등).

  • 제한 사항

    • style이 "polygon" 또는 "line"이 아닌 경우 무시됩니다.

    • coordinate는 최소 3개 이상의 점이 필요합니다.

const coords = new Module.JSVec3Array();
coords.push(new Module.JSVector3D(127.0, 37.5, 0));
coords.push(new Module.JSVector3D(127.1, 37.5, 0));
coords.push(new Module.JSVector3D(127.1, 37.6, 0));

const poly = Module.createPolygon("OVERLAY_POLYGON");
poly.setOverlayObject({
    coordinate: coords,
    style: "polygon",
    color: new Module.JSColor(255, 255, 0, 0)
});

setUnionMode(bMode) → void

폴리곤 객체의 연산 모드를 설정합니다.

Name
Type
Description

bMode

boolean

true: 평면 연산 모드(EOT_PLANE), false: 입체 연산 모드(EOT_POLYHEDRON)

  • Return

    • 없음 (void)

  • Description

    • 폴리곤 객체의 연산 방식을 설정합니다.

    • true로 설정하면 내부 객체 타입이 EOT_PLANE으로 설정되어 평면 병합 연산을 수행하며, false로 설정하면 EOT_POLYHEDRON으로 처리되어 입체 병합 연산이 가능합니다.

    • 설정 이후 RTT(렌더 타겟 텍스처) 갱신 플래그가 활성화됩니다.

var API = {
    JSPolygon : Module.getPolygon()
};

// 평면 병합 연산 모드 설정
API.JSPolygon.setUnionMode(true);

// 입체 병합 연산 모드 설정
API.JSPolygon.setUnionMode(false);

Type Definitions

JSPolygon.loadFileOption

3ds 포맷 파일을 이용하여 평면 객체를 생성합니다.

Name
Type
Attributes
Default
Description

position

생성 중심 좌표 (경도, 위도, 고도).

url

string

3ds 요청 url.

align

string

정렬 옵션.

getCenter() →

: 반환 성공.

입력 변수값(id)은 API로 텍스쳐를 적용할 때 텍스쳐를 구분하는 용도로 사용합니다.

입력 변수값(id)은 API에 입력된 고유명칭 입니다.

getCoordinates(), setCoordinates(coordinates) →

: 반환 성공.

getStyle(), setStyle(style) →

으로 적용된 스타일을 평면 객체에 설정합니다.

: 반환 성공.

JSAABBox3D
JSAABBox3D
JSVector3D
JSVector3D
Sandbox_3DS
Sandbox_Polygon RTT
Sandbox_Circle Polygon
Sandbox_Polygon RTT
Sandbox_Fire Effect
Sandbox_Polygon Height
Sandbox_Polygon Height
Sandbox_Polygon RTT
Sandbox_Vertical_grid
Collection
Collection
JSPolygonStyle
JSPolygonStyle
JSPolygonStyle
setFaceTexture
loadTexture
JSVector3D
JSVec3Array
Collection
JSVec3Array
Collection
JSVec2Array
JSVector3D
JSVector3D
Collection
JSPolygonStyle
JSVec2Array
JSVec3Array
JSColor
JSVector3D
JSPolygon.loadFileOption