Utils

도형·라벨 생성, 위치 계산, 기기·화면 판별, Base64 이미지 URL 변환 등 DiTAP 전반에서 사용하는 유틸리티 함수 모음.
General utility functions used throughout DiTAP, such as creating shapes and labels, computing positions, detecting the device and screen size, and converting Base64 images to URLs.

Members

static Ditap.Utils.detectDeviceType

모바일/PC 기기 구분

static Ditap.Utils.getProtocol

프로토콜 조회.
Protocol query.

static Ditap.Utils.isBodyWidthLessThan600

body요소의 width가 600 이하인지 구분

static Ditap.Utils.isBodyWidthLessThan1200

body요소의 width가 1200 이하인지 구분

Methods

static Ditap.Utils.calculateArea(positions) → object

좌표 배열의 면적 계산.
Calculate the area of the coordinate array.
Name Type Description
positions Array.<Cartesian3> 계산될 좌표 배열.
Cartesian arrangement to calculate the area.
Returns:
계산된 면적 object.
Calculated area object.

static Ditap.Utils.changePointColor(pointEntities, pointColor)

포인트 엔티티 색상 변경.
Change the color of the point entities.
Name Type Description
pointEntities Array.<Entity> 색상 변경할 포인트 엔티티 배열.
Array of point entities to change the color.
pointColor Color 변경할 색상.
The color to change to.

static Ditap.Utils.changePolygonPrimitiveColor(polygonEntities, polygonColor)

폴리곤 엔티티 색상 변경.
Change the color of the polygon entities.
Name Type Description
polygonEntities Array.<Entity> 색상 변경할 폴리곤 엔티티 배열.
Array of polygon entities to change the color.
polygonColor Color 변경할 색상.
The color to change to.

static Ditap.Utils.changePolylineColor(polylineEntities, polylineColor)

폴리라인 엔티티 색상 변경.
Change the color of the polyline entities.
Name Type Description
polylineEntities Array.<Entity> 색상 변경할 폴리라인 엔티티 배열.
Array of polyline entities to change the color.
polylineColor Color | MaterialProperty 변경할 색상.
The color to change to.

static Ditap.Utils.computeMinMaxCartesian(catesians) → Array.<Cartesian3>

Cartesian min, max 계산
Name Type Description
catesians Array.<Cartesian3>
Returns:
catesians [minimum, maximum]

static Ditap.Utils.createPoint(pointOption) → Entity

포인트 엔티티 생성
Name Type Description
pointOption object 포인트 옵션.
Name Type Description
viewer DitapViewer 사용할 Ditap Viewer 인스턴스
id string 아이디.
position Cartesian3 좌표 배열.
color Color 포인트 색상.
outlineColor Color 포인트 아웃라인 색상.
displayCondition Number 가시화 거리.
scale Property | number 포인트 사이즈
changedCallback function 포인트 값 변경 콜백
show boolean 포인트 값 변경 콜백
Returns:
point 포인트 엔티티.

static Ditap.Utils.createPolygon(polygonOption) → Entity

폴리곤 엔티티 생성
Name Type Description
polygonOption object 폴리곤 옵션.
Name Type Description
id string 아이디.
viewer DitapViewer 사용할 Ditap Viewer 인스턴스
positions Array.<Cartesian3> 좌표 배열.
material MaterialProperty | Color 폴리곤 재질.
Returns:
polygon 폴리곤 엔티티.

static Ditap.Utils.createPolygonPrimitive(viewer, id, displayCondition, positions, material, depthFailMaterial, show, asynchronous) → Entity

DitapViewer에 PolygonPrimitive생성.
Create a PolygonPrimitive in the viewer container.
Name Type Default Description
viewer DitapViewer 사용할 Ditap Viewer 인스턴스.
The DitapViewer instance to use.
id String PolygonPrimitive의 Id.
The ID of the PolygonPrimitive.
displayCondition number PolygonPrimitive을 표시할 거리 조건.
Distance condition for displaying PolygonPrimitive.
positions Array.<Cartesian3> PolygonPrimitive 좌표 배열.
Cartesians of PolygonPrimitive.
material MaterialProperty | Color PolygonPrimitive의 색상 또는 재질.
A Property specifying the material used to draw the PolygonPrimitive.
depthFailMaterial MaterialProperty | Color PolygonPrimitive의 depthFail 색상 또는 재질.
A Property specifying the material used to draw the PolygonPrimitive.
show boolean true optional PolygonPrimitive의 가시화 여부.
Whether PolygonPrimitive is visible or not.
asynchronous boolean true optional 비동기 동작 여부.
Returns:
생성된 PolygonPrimivie.
Created PolygonPrimivie.

static Ditap.Utils.createPolyline(polylineOption) → Entity

라인 엔티티 생성
Name Type Description
polylineOption object 라인 옵션.
Name Type Description
viewer DitapViewer 사용할 Ditap Viewer 인스턴스
id string 아이디.
positions Array.<Cartesian3> 좌표 배열.
material GridMaterialProperty | Color 라인 재질.
displayCondition Number 가시화 거리.
show boolean 가시화 여부.
Returns:
polyline 라인 엔티티.

static Ditap.Utils.createPolylinePrimitive(viewer, id, positions, width, material, depthFailMaterial, show, asynchronous) → Primitive

DitapViewer에 PolylinePrimitive생성.
Create a PolylinePrimitive in the viewer container.
Name Type Default Description
viewer DitapViewer 사용할 Ditap Viewer 인스턴스.
The DitapViewer instance to use.
id String PolylinePrimitive Id.
The ID of the PolylinePrimitive.
positions Array.<Cartesian3> PolylinePrimitive 좌표 배열.
Cartesians of PolylinePrimitive.
width number PolylinePrimitive 두께.
material MaterialProperty | Color PolylinePrimitive 색상 또는 재질.
A Property specifying the material used to draw the PolylinePrimitive.
depthFailMaterial MaterialProperty | Color PolygonPrimitive의 depthFail 색상 또는 재질.
A Property specifying the material used to draw the PolygonPrimitive.
show boolean true optional PolygonPrimitive의 가시화 여부.
Whether PolygonPrimitive is visible or not.
asynchronous boolean true optional 비동기 동작 여부.
Returns:
생성된 PolygonPrimivie.
Created PolylinePrimitive.

static Ditap.Utils.createPositionPropertyDescriptor(name) → object

PositionProperty 생성 함수
Name Type Description
name string
Returns:
{ configurable: () => any, get: () => any, set: set }

static Ditap.Utils.createWallPrimitive(viewer, id, displayCondition, positions, maximumHeights, minimumHeights, material, depthFailMaterial, show, asynchronous) → Entity

DitapViewer에 PolygonPrimitive생성.
Create a PolygonPrimitive in the viewer container.
Name Type Default Description
viewer DitapViewer 사용할 Ditap Viewer 인스턴스.
The DitapViewer instance to use.
id String PolygonPrimitive의 Id.
The ID of the PolygonPrimitive.
displayCondition number PolygonPrimitive을 표시할 거리 조건.
Distance condition for displaying PolygonPrimitive.
positions Array.<Cartesian3> PolygonPrimitive 좌표 배열.
Cartesians of PolygonPrimitive.
maximumHeights Array.<number> PolygonPrimitive 좌표 배열.
Cartesians of PolygonPrimitive.
minimumHeights Array.<number> PolygonPrimitive 좌표 배열.
Cartesians of PolygonPrimitive.
material Material PolygonPrimitive의 색상 또는 재질.
A Property specifying the material used to draw the PolygonPrimitive.
depthFailMaterial Material PolygonPrimitive의 depthFail 색상 또는 재질.
A Property specifying the material used to draw the PolygonPrimitive.
show boolean true optional PolygonPrimitive의 가시화 여부.
Whether PolygonPrimitive is visible or not.
asynchronous boolean true optional 비동기 동작 여부.
Returns:
생성된 PolygonPrimivie.
Created PolygonPrimivie.

static Ditap.Utils.getBodyWidth() → number

body요소의 width반환.
Returns:
body요소의 width

static Ditap.Utils.getDistanceDisplayCondition(positions) → number

Cartesian 배열로 bbox를 가져와 distanceDisplayCondition값 반환.
Get bbox with Cartesian array and return distanceDisplaycondition value
Name Type Description
positions Array.<Cartesian3> bbox를 구할 Cartesian 배열.
Cartesian array to find a bbox
Returns:
distanceDisplaycondition 값.
distanceDisplaycondition value

static Ditap.Utils.getFormattedTime(date) → string

Date 객체를 입력받아 "YYYYMMDDHHmm" 형식의 문자열로 변환.
Converts a Date object to a string in "YYYYMMDDHHmm" format.
Name Type Description
date Date 포맷팅할 Javascript Date 객체.
Javascript Date object to format.
Returns:
포맷팅된 날짜 문자열 (예: "202512041109").
Formatted date string (e.g., "202512041109").

static Ditap.Utils.getUrlFromBase64(base64Data) → URL

base64Data 이미지를 Url로 변환.
Convert base64Data image to url.
Name Type Description
base64Data string 변환 시킬 base64Data 이미지.
The image to convert.
Returns:
변환된 url.
The image url.

static Ditap.Utils.isEqualPosition(position, position2) → boolean

두 좌표가 동일한지 비교(5mm 이하인 경우 같다고 판단).
Compare if two coordinates are the same (considered the same if within 5mm).
Name Type Description
position Cartesian3 동일 여부를 판단할 첫 번째 위치.
The first position to determine if they are the same.
position2 Cartesian3 동일 여부를 판단할 두 번째 위치.
The second position to determine if they are the same.
Returns:
좌표 동일 여부.
Whether the two coordinates are identical.

static Ditap.Utils.isTouchDevice() → boolean

디바이스가 터치가 되는지 확인
Returns:
터치 여부

static Ditap.Utils.popupAvailableMobile(popup) → boolean

모바일때 띄워질 수 있는 팝업 체크. 각 팝업 클래스의 DitapPopup#availableOnMobile 값을 따릅니다.
Name Type Description
popup * 팝업 인스턴스
Returns:
모바일때 띄워질 수 있는 팝업 여부

static Ditap.Utils.printCommaSeparator(numberParam) → number

숫자에 세 자리마다 콤마(,) 입력해서 반환
Name Type Description
numberParam number ',' 입력할 숫자.
"," Enter the number to input.
Returns:
',' 입력된 숫자.
The entered number.