Name | Type | Description |
---|---|---|
viewer |
DitapViewer | 사용할 DitapViewer 인스턴스.The DitapViewer instance to use. |
Example:
// base64 를 URL로 변환하는 함수
const getUrlFromBase64 = (base64Data) => {
const b64Data = base64Data;
const byteCharacters = window.atob(b64Data);
const byteNumbers = new Array(byteCharacters.length);
for (let i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
const blob = new Blob([byteArray], { type: "image/png" });
return URL.createObjectURL(blob);
};
const viewer = new Ditap.DitapViewer("ditapContainer", {
fullscreenButton: true,
baseLayerPicker: true,
// 지형(터레인 지정)
// 디폴트 지형 : Ditap Korea Terrain
terrainProviderViewModels: [
new Ditap.ProviderViewModel({
name: "Ditap Korea Terrain",
iconUrl: getUrlFromBase64(Ditap.ConstantUrl.DITAP_TERRAIN_IMG_URL),
tooltip: "WGS84 standard ellipsoid, also known as EPSG:4326",
category: "Ditap",
creationFunction: () => {
return Ditap.NationwideTerrainProvider.create();
},
}),
],
});
try {
const tileset = await Ditap.createOsmBuildingsAsync();
viewer.scene.primitives.add(tileset);
} catch (error) {
console.log(`Error loading tileset: ${error}`);
}
// 뷰어에 추가할 데이터 생성
// 모델 위치로 카메라 이동
viewer.camera.flyTo({
destination: Ditap.Cartesian3.fromDegrees(126.97968, 37.56363, 700),
duration: 1,
orientation: {
heading: Ditap.Math.toRadians(0),
pitch: Ditap.Math.toRadians(-50),
roll: 0,
},
});
// PopupAddStreetlamp 생성
const popup = new Ditap.PopupAddStreetlamp(viewer);
// PopupAddStreetlamp 실행 버튼
Sandcastle.addToolbarButton("Popup Add Streetlamp Open", async () => {
popup.open();
});
Members
핸들러 비/활성화 상태.
Handler enabled or disabled.
viewer : DitapViewer
사용할 Ditap Viewer 인스턴스.
The DitapViewer instance to use.
Methods
내부에서 마커 엔티티를 추가하고 ditapStorage에 등록합니다.
Adds a marker entity for a streetlamp at the specified position and registers it in ditapStorage.
Name | Type | Description |
---|---|---|
position |
Cartesian3 | 가로등 추가 위치. The position to add the streetlamp. |
등록된 모든 마커 엔티티들을 ditapStorage에서 제거합니다.
Removes all registered marker entities from ditapStorage.
핸들러 취소 (초기화 후 종료).
Cancel handler (exit after initialization).
Cancel handler (exit after initialization).
가로등 설정 취소를 수행하여 이전 상태로 복원합니다.
Cancels streetlamp configuration and restores the previous state.
가로등 반지름을 변경합니다.
Changes the streetlamp radius.
Name | Type | Description |
---|---|---|
streetlampRadius |
number | 가로등 반지름 (미터). Streetlamp radius in meters. |
선택된 가로등을 삭제합니다.
Deletes the selected streetlamp.
핸들러 종료.
End handler.
End handler.
가로등 추가 모드를 활성화하고 사용자 입력 이벤트 핸들러를 설정합니다.
Activates the streetlamp addition mode and sets up user input event handlers.
가로등 회전 설정을 적용합니다.
Applies rotation settings to the streetlamp.
Name | Type | Description |
---|---|---|
rotateHeading |
number | 회전 각도 (도). Rotation heading in degrees. |
rotatePitch |
number | 회전 피치 (도). Rotation pitch in degrees. |
가로등 이동, 회전, 크기 변경 등의 저장 작업을 수행합니다.
Saves the streetlamp configuration by applying movement, rotation, and radius changes.
Name | Type | Description |
---|---|---|
moveX |
number | 동서 방향 이동 거리 (미터). Movement in the east-west direction (meters). |
moveY |
number | 남북 방향 이동 거리 (미터). Movement in the north-south direction (meters). |
moveZ |
number | 수직 방향 이동 거리 (미터). Movement in the vertical direction (meters). |
rotateHeading |
number | 회전 각도 (도). Rotation angle in degrees. |
rotatePitch |
number | 회전 피치 (도). Rotation pitch in degrees. |
streetlampRadius |
number | 가로등 반지름 (미터). Streetlamp radius in meters. |