MeasurementVolume

체적량 계산 및 영역 표시 클래스.
Volumetric Calculation and Region Display Class.

※ 주의사항(Note).
측정 범위가 cellSize^2 * 10000을 초과할 경우 기능 중단 가능성이 있음.
Please be aware that if the measurement range exceeds cellSize^2 * 10000, there is a possibility of functionality interruption.

new Ditap.MeasurementVolume(options)

Name Type Description
options object 각각 다음과 같은 속성을 가진 객체.
Object with the following properties:
Name Type Default Description
viewer DitapViewer 사용할 Ditap Viewer 인스턴스.
The DitapViewer instance to use.
entityColor Color Color.fromBytes(229, 30, 110, 255) optional 엔티티 색상.
Color of the entity.
positions Array.<Cartesian3> [] optional 측정 영역 좌표.
Positions
planHeight VolumePlanHeightType | number VolumePlanHeightType.AVERAGE optional 계획고 타입 [VolumePlanHeightType.MIN, VolumePlanHeightType.MAX, VolumePlanHeightType.AVERAGE] 또는 높이 값 (미터).
Plan height type [VolumePlanHeightType.MIN, VolumePlanHeightType.MAX, VolumePlanHeightType.AVERAGE] or plan height value (meters).
cellSize number 1 optional 셀 사이즈 (미터).
CellSize (meters).
showCell boolean false optional 셀 가시화.
Visualize the cell
fillingVolumeColor Color Color.fromBytes(85, 25, 220, 30) optional 성토 셀 색상.
FillVolume cell color
cuttingVolumeColor Color Color.fromBytes(220, 25, 105, 30) optional 절토 셀 색상.
CuttingVolume cell color
classification VolumeClassificationType VolumeClassificationType.TERRAIN optional 높이 추출 유형 [VolumeClassificationType.TERRIN, VolumeClassificationType.BOTH].
Height value extraction type [VolumeClassificationType.TERRIN, VolumeClassificationType.BOTH].
loading boolean true optional 계산 중 로딩창.
Loading page during calculation
callback function optional 계산 종료 후 콜백 함수.
Callback function after volume measurement
Example:
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", {
  baseLayerPicker: true,
  // 지형(터레인 지정)
  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: function () {
        return Ditap.NationwideTerrainProvider.create();
      },
    }),
  ],
});

const destination = Ditap.Cartesian3.fromDegrees(
  126.978275264,
  37.566642192,
  400
);

// 카메라 이동
viewer.scene.camera.flyTo({
  destination: destination,
});

//1. 지정된 영역 생성
const positions = [
  new Ditap.Cartesian3(-3044739.446567739, 4043823.403143691,3867463.012077135),
  new Ditap.Cartesian3(-3044747.714411474, 4043814.3380325786,3867466.015981707),
  new Ditap.Cartesian3(-3044752.780860346, 4043817.3342751344,3867458.802892699),
];
const options = {
  viewer: viewer,
  positions: positions,                                     // 영역 좌표
  // entityColor: Color.fromBytes(229, 30, 110, 255)         // 엔티티 색상
  // planHeight: Ditap.VolumePlanHeightType.AVERAGE,        // 계획고 타입
  // cellSize: 1,                                           // 분석 해상도
  // showCell: false,                                       // 셀 가시화 여부
  // fillingVolumeColor: Color.fromBytes(85, 25, 220, 35),     // 성토 셀 색상
  // cuttingVolumeColor: Color.fromBytes(220, 25, 105, 35), // 절토 셀 색상
  // planHeightVolumeColor: Color.GRAY.withAlpha(0.3),      // 0 셀 컬러
  // callback: () => {},                                    // 콜백 함수
  // classification: VolumeClassificationType.TERRAIN,      // 분석 타입
  // loading: true,                                         // 로딩 창 여부
};
const measurementVolume = new Ditap.MeasurementVolume(viewer, options);

//2. 체적 재측정
// measurementValume.calculateVolume(options);

//3. 마우스로 영역 지정 후 측정
const measurementVolume = new Ditap.MeasurementVolume({viewer: viewer});
const interactionVolume = new Ditap.InteractionVolume(viewer);
interactionVolume.measurementVolume = measurementVolume;
interactionVolume.on();

Members

readonly callback : function|undefined

계산 종료 후 콜백 함수.
Callback function after volume measurement

cellPrimitive : Array.<Primitive>

측정 영역 셀 Primitive.
Volume area cell primitive.

readonly cellSize : number

셀 사이즈.
Volume cell size.

readonly centerPosition : Cartesian3

측정 영역 중심점.
Volume area center position.

readonly classification : number

높이 추출 유형.
Height value extraction type.

readonly cuttingVolume : string

절토량.
Cutting volume.

readonly cuttingVolumeColor : Color

절토량 셀 색상.
Cutting volume cell color.

entityColor

엔티티 색상.
Color of the entity.

readonly fillingVolume : string

성토량.
Fill volume.

readonly fillingVolumeColor : Color

성토량 셀 색상.
Fill volume cell color.

readonly id : string

측정 객체 ID.
ID to assign to the measurement object.

readonly isReady : boolean

계산 완료 여부.
Check that the volume calculation is complete.

readonly loading : boolean

계산 중 로딩창.
Loading page during calculation.

readonly planHeight : string

계획고.
Volume plan height.

readonly planHeightType : string

계획고 타입.
Plane hegith type.

pointEntities : Array.<Entity>

측정 영역 포인트 엔티티.
Volume area point entity.

polygonPrimitive : Primitive

측정 영역 polygon primitive.
Volume area polygon primitive.

polylineEntity : Entity

측정 영역 폴리라인 엔티티.
Volume area polyline entity.

readonly positions : Array.<Cartesian3>

측정 영역 좌표.
Measurement area coordinates

readonly showCell : boolean

셀 가시화.
Visualize volume cell

readonly totalVolume : string

성토량과 절토량의 합.
Sum of cut and fill volume.

viewer : DitapViewer

사용할 Ditap Viewer 인스턴스.
The DitapViewer instance to use.

Methods

async calculateVolume(options)Array.<string>

체적량 계산.
Calculate volume.
Name Type Description
options object 각각 다음과 같은 속성을 가진 객체.
Object with the following properties:
Name Type Default Description
positions Array.<Cartesian3> 영역 좌표.
Volume position.
planHeight VolumePlanHeightType | number VolumePlanHeightType.AVERAGE optional 계획고 타입 [VolumePlanHeightType.MIN, VolumePlanHeightType.MAX, VolumePlanHeightType.AVERAGE] 또는 높이 값 (미터).
Plan height type [VolumePlanHeightType.MIN, VolumePlanHeightType.MAX, VolumePlanHeightType.AVERAGE] or plan height value (meters).
cellSize number 1 optional 셀 사이즈 (미터).
Cell size (meters).
showCell boolean false optional 셀 가시화.
Visualize the cell
fillingVolumeColor Color Color.fromBytes(85, 25, 220, 30) optional 성토량 셀 색상.
FillVolume cell color
cuttingVolumeColor Color Color.fromBytes(220, 25, 105, 30) optional 절토량 셀 색상.
CuttingVolume cell color
classification VolumeClassificationType VolumeClassificationType.TERRAIN optional 높이 추출 유형 [VolumeClassificationType.TERRIN, VolumeClassificationType.BOTH].
Height value extraction type
loading boolean true optional 계산 중 로딩창.
Loading page during calculation
callback function optional 계산 종료 후 콜백 함수.
Callback function after volume measurement.
Returns:
[성토량, 절토량, 합계].
[Fill volume, Cutting volume, Total Volume]

clear()

초기화.
Initializing volume values and entities.

destroy()

인스턴스 제거.
Destroys the instance.

zoomToVolume()

측정 영역으로 카메라 이동.
Move camera to volume area.