Skip to main content

Skyline Analysis

DMap3D.analysis.skyline is used to analyze the skyline contour in the scene.

Import

import DMap3D from 'dmap3d'
import * as Cesium from 'cesium'

Basic Usage

const viewer = new Cesium.Viewer('cesiumContainer')

// Create skyline analysis tool
const skyline = new DMap3D.analysis.skyline(viewer)

// Initialize post-processing effect
skyline.init()

// Get 2D skyline data
const result = await skyline.getSkyline2D()
console.log('Skyline pixel points:', result.pixelPoints.length)

Constructor

new DMap3D.analysis.skyline(viewer, options?)

Parameters:

  • viewer - Cesium.Viewer instance
  • options? - Optional configuration

Options:

interface SkylineOptions {
color?: string // Skyline color, default '#FF0000'
}

Methods

init()

Initialize the skyline post-processing effect, displaying the skyline contour in the scene.

skyline.init()

getSkyline2D()

Get 2D skyline data (asynchronous).

const result = await skyline.getSkyline2D()

// result.pixelPoints: Skyline pixel point array
result.pixelPoints.forEach((point) => {
console.log(`Position: (${point.x}, ${point.y}), Color: ${point.color}`)
})

// result.groundHeights: Corresponding ground height array
console.log('Ground heights:', result.groundHeights)

destroy()

Destroy the tool and release resources.

skyline.destroy()

Analysis Result

interface SkylineResult {
pixelPoints: Array<{
x: number // Screen pixel X coordinate
y: number // Screen pixel Y coordinate
color: string // Color value
}>
groundHeights: number[] // Ground height array
}