Name | Type | Description |
---|---|---|
viewer |
DitapViewer | 사용할 DitapViewer 인스턴스.The DitapViewer instance to use. |
apiKey |
String | 일조량 분석 API 키.API key for sunshine analysis. |
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,
},
});
// InteractionSunshine 생성
const interactionSunshine = new Ditap.InteractionSunshine(
viewer,
"6VfToXRgNMs9CnW9lKYLAUaWk%2FuHDT745Nf0HytWqOq5CE%2BbKGaaLn2%2FtI4Sx0Sh%2FZutrVvh4YQk9975%2FaQ5Xg%3D%3D"
);
const popup = new Ditap.PopupSunshineAnalysisController(
viewer,
"6VfToXRgNMs9CnW9lKYLAUaWk%2FuHDT745Nf0HytWqOq5CE%2BbKGaaLn2%2FtI4Sx0Sh%2FZutrVvh4YQk9975%2FaQ5Xg%3D%3D",
interactionSunshine
);
popup.open();
Members
핸들러 비/활성화 상태.
Handler enabled or disabled.
viewer : DitapViewer
사용할 Ditap Viewer 인스턴스.
The DitapViewer instance to use.
Methods
내부에서 마커 엔티티를 추가하고 ditapStorage에 등록합니다.
Adds a marker entity at the specified position and registers it in ditapStorage.
Name | Type | Description |
---|---|---|
position |
Cartesian3 | 분석 지점 좌표.Analysis point position. |
등록된 모든 마커 엔티티들을 ditapStorage에서 제거합니다.
Removes all registered marker entities from ditapStorage.
핸들러 종료.
End handler.
End handler.
일조량 분석 모드를 활성화하고 사용자 입력 이벤트 핸들러를 설정합니다.
Activates the sunshine analysis mode and sets up user input event handlers.