UNPKG

vworld-react-3d

Version:

VWorld 3.0 API React Component - 한국 공공데이터 3D 지도 컴포넌트

486 lines (477 loc) 16.2 kB
import React$1 from 'react'; interface VWorldConfig { apiKey: string; } interface VWorldCoord { x: number; y: number; z: number; } interface VWorldDirection { heading: number; pitch: number; roll: number; } interface VWorldCameraPosition { coord: VWorldCoord; direction: VWorldDirection; } interface VWorldMapOptions { mapId?: string; initPosition?: VWorldCameraPosition; logo?: boolean; navigation?: boolean; autoRotate?: boolean; showGrid?: boolean; showAxis?: boolean; backgroundColor?: string; skyColor?: string; fogColor?: string; fogDensity?: number; terrain?: boolean; buildings?: boolean; roads?: boolean; water?: boolean; vegetation?: boolean; enableAntialiasing?: boolean; enableShadows?: boolean; enableFog?: boolean; maxFPS?: number; minDistance?: number; maxDistance?: number; enablePan?: boolean; enableZoom?: boolean; enableRotate?: boolean; animationDuration?: number; easingFunction?: string; } interface VWorldCameraChangeEvent { type: "camerachange"; camera: VWorldCameraPosition; } interface VWorldZoomChangeEvent { type: "zoomchange"; zoom: number; } interface VWorldClickEvent { type: "click"; coord: VWorldCoord; } interface VWorldDoubleClickEvent { type: "dblclick"; coord: VWorldCoord; } interface VWorldMouseMoveEvent { type: "mousemove"; coord: VWorldCoord; } interface VWorldWheelEvent { type: "wheel"; delta: number; } type VWorldMapEvent = VWorldCameraChangeEvent | VWorldZoomChangeEvent | VWorldClickEvent | VWorldDoubleClickEvent | VWorldMouseMoveEvent | VWorldWheelEvent; interface VWorldMapInstance { setOption(options: Partial<VWorldMapOptions>): void; start(): void; stop(): void; destroy(): void; resize(): void; getContainer(): HTMLElement; getSize(): { width: number; height: number; }; update(): void; getCurrentPosition(): VWorldCameraPosition; moveTo(position: VWorldCameraPosition, duration?: number): void; flyTo(position: VWorldCameraPosition, duration?: number): void; setCamera(position: VWorldCameraPosition): void; getCamera(): VWorldCameraPosition; lookAt(target: VWorldCoord, duration?: number): void; orbit(center: VWorldCoord, radius: number, duration?: number): void; pan(deltaX: number, deltaY: number, duration?: number): void; rotate(angle: number, duration?: number): void; tilt(angle: number, duration?: number): void; zoomTo(level: number, duration?: number): void; fitBounds(bounds: { min: VWorldCoord; max: VWorldCoord; }, duration?: number): void; zoomIn(level?: number): void; zoomOut(level?: number): void; setZoom(level: number): void; getZoom(): number; getMinZoom(): number; getMaxZoom(): number; setMinZoom(level: number): void; setMaxZoom(level: number): void; on(event: string, callback: (event: VWorldMapEvent) => void): void; off(event: string, callback?: (event: VWorldMapEvent) => void): void; once(event: string, callback: (event: VWorldMapEvent) => void): void; trigger(event: string, data?: unknown): void; addLayer(layer: VWorldLayer): void; removeLayer(layerId: string): void; getLayer(layerId: string): VWorldLayer | null; getLayers(): VWorldLayer[]; setLayerVisibility(layerId: string, visible: boolean): void; getLayerVisibility(layerId: string): boolean; setLayerOpacity(layerId: string, opacity: number): void; getLayerOpacity(layerId: string): number; setLayerOrder(layerId: string, order: number): void; getLayerOrder(layerId: string): number; clearLayers(): void; reloadLayer(layerId: string): void; addFeature(feature: VWorldFeature): void; removeFeature(featureId: string): void; getFeature(featureId: string): VWorldFeature | null; getFeatures(): VWorldFeature[]; setFeatureStyle(featureId: string, style: VWorldFeatureStyle): void; getFeatureStyle(featureId: string): VWorldFeatureStyle | null; setFeatureVisibility(featureId: string, visible: boolean): void; getFeatureVisibility(featureId: string): boolean; clearFeatures(): void; pickFeature(screenX: number, screenY: number): VWorldFeature | null; getBounds(): { min: VWorldCoord; max: VWorldCoord; }; getCenter(): VWorldCoord; getExtent(): { min: VWorldCoord; max: VWorldCoord; }; getProjection(): string; getScale(): number; getResolution(): number; getViewport(): { width: number; height: number; }; getPixelRatio(): number; animate(animation: VWorldAnimation): void; ease(easing: string, duration: number): void; interpolate(start: VWorldCameraPosition, end: VWorldCameraPosition, progress: number): VWorldCameraPosition; setAnimationDuration(duration: number): void; getAnimationDuration(): number; stopAnimation(): void; enableInteraction(): void; disableInteraction(): void; setInteractionMode(mode: string): void; getInteractionMode(): string; enablePan(): void; disablePan(): void; enableZoom(): void; disableZoom(): void; setRenderMode(mode: string): void; getRenderMode(): string; getFPS(): number; setQuality(quality: string): void; getQuality(): string; setMaxFPS(fps: number): void; loadData(url: string, options?: VWorldDataOptions): Promise<void>; loadTile(x: number, y: number, z: number): Promise<void>; loadTerrain(bounds: { min: VWorldCoord; max: VWorldCoord; }): Promise<void>; loadBuilding(buildingId: string): Promise<void>; loadPOI(poiId: string): Promise<void>; loadVectorData(url: string): Promise<void>; screenToWorld(screenX: number, screenY: number): VWorldCoord; worldToScreen(worldX: number, worldY: number, worldZ: number): { x: number; y: number; }; pixelToWorld(pixelX: number, pixelY: number): VWorldCoord; worldToPixel(worldX: number, worldY: number, worldZ: number): { x: number; y: number; }; coordinateToPixel(lon: number, lat: number, alt: number): { x: number; y: number; }; pixelToCoordinate(pixelX: number, pixelY: number): VWorldCoord; raycast(origin: VWorldCoord, direction: VWorldDirection): VWorldRaycastResult | null; getDistance(point1: VWorldCoord, point2: VWorldCoord): number; getBearing(point1: VWorldCoord, point2: VWorldCoord): number; getAltitude(lon: number, lat: number): Promise<number>; getSlope(point1: VWorldCoord, point2: VWorldCoord): number; getAspect(lon: number, lat: number): number; getVisibility(point1: VWorldCoord, point2: VWorldCoord): boolean; getSunPosition(date: Date): { azimuth: number; elevation: number; }; enableShadows(): void; disableShadows(): void; setShadowQuality(quality: string): void; enableFog(): void; disableFog(): void; setFogDensity(density: number): void; } interface VWorldLayer { id: string; name: string; type: string; visible: boolean; opacity: number; order: number; url?: string; data?: unknown; } interface VWorldFeature { id: string; type: string; geometry: { type: string; coordinates: number[] | number[][] | number[][][]; }; properties: Record<string, unknown>; style?: VWorldFeatureStyle; visible: boolean; } interface VWorldFeatureStyle { color?: string; opacity?: number; size?: number; symbol?: string; outlineColor?: string; outlineWidth?: number; } interface VWorldAnimation { type: string; duration: number; easing?: string; target: VWorldCameraPosition; } interface VWorldDataOptions { format?: string; projection?: string; bounds?: { min: VWorldCoord; max: VWorldCoord; }; } interface VWorldRaycastResult { point: VWorldCoord; distance: number; feature?: VWorldFeature; layer?: VWorldLayer; } interface VWorldMapProps { config: VWorldConfig; options?: Partial<VWorldMapOptions>; /** 최초 생성 카메라 위치 */ initCameraPosition?: VWorldCameraPosition; /** 동적 카메라 위치 제어 */ cameraPosition?: VWorldCameraPosition; /** 레벨 제어 */ zoom?: number; /** 최소 레벨 */ minZoom?: number; /** 최대 레벨 */ maxZoom?: number; /** 카메라 이동 이벤트 콜백 */ onCameraChange?: (position: VWorldCameraPosition) => void; /** 변경 이벤트 콜백 */ onZoomChange?: (zoom: number) => void; /** 클릭 이벤트 콜백 */ onMapClick?: (position: VWorldCoord) => void; /** 더블클릭 이벤트 콜백 */ onMapDoubleClick?: (position: VWorldCoord) => void; /** 마우스 이동 이벤트 콜백 */ onMouseMove?: (position: VWorldCoord) => void; /** 마우스 이벤트 콜백 */ onWheel?: (delta: number) => void; /** 준비 완료 콜백 */ onMapReady?: (map: VWorldMapInstance) => void; /** 로드 완료 콜백 */ onMapLoad?: () => void; /** 에러 발생 콜백 */ onError?: (error: string) => void; /** CSS 클래스명 */ className?: string; /** 인라인 스타일 */ style?: React.CSSProperties; /** 컨테이너 너비 */ width?: string | number; /** 컨테이너 높이 */ height?: string | number; } interface VWorldGlobal { vw?: { Map: new () => VWorldMapInstance; CameraPosition: new (coord: VWorldCoord, direction: VWorldDirection) => VWorldCameraPosition; CoordZ: new (x: number, y: number, z: number) => VWorldCoord; Direction: new (heading: number, pitch: number, roll: number) => VWorldDirection; }; v_protocol?: string; vworldUrl?: string; vworld2DCache?: string; vworldBaseMapUrl?: string; vworldStyledMapUrl?: string; vworldVectorKey?: string; vworldApiKey?: string; vworldNoCss?: string; vworldIsValid?: string; vworld3DUrl?: string; $?: JQueryStatic; vworldMapInstance?: VWorldMapInstance; } declare global { interface Window extends VWorldGlobal { } } declare const VWorldMap: React$1.FC<VWorldMapProps>; interface VWorldControlsProps { map: VWorldMapInstance | null; onCameraChange?: (position: VWorldCameraPosition) => void; className?: string; style?: React$1.CSSProperties; } declare const VWorldControls: React$1.FC<VWorldControlsProps>; interface VWorldInfoPanelProps { map: VWorldMapInstance | null; className?: string; style?: React$1.CSSProperties; } declare const VWorldInfoPanel: React$1.FC<VWorldInfoPanelProps>; interface VWorldLocationPickerProps { map: VWorldMapInstance | null; onLocationSelect?: (coord: VWorldCoord) => void; className?: string; style?: React$1.CSSProperties; } declare const VWorldLocationPicker: React$1.FC<VWorldLocationPickerProps>; interface VWorldTourProps { map: VWorldMapInstance | null; onTourComplete?: () => void; className?: string; style?: React$1.CSSProperties; } declare const VWorldTour: React$1.FC<VWorldTourProps>; /** * 좌표를 CameraPosition으로 변환 */ declare const createCameraPosition: (coord: VWorldCoord, direction: VWorldDirection) => VWorldCameraPosition; /** * 위도, 경도, 고도로 VWorldCoord 생성 */ declare const createCoord: (longitude: number, latitude: number, altitude: number) => VWorldCoord; /** * 방향 각도로 VWorldDirection 생성 */ declare const createDirection: (heading: number, pitch: number, roll: number) => VWorldDirection; /** * 광화문 중심의 카메라 위치 생성 */ declare const getGwanghwamunCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 서울시청 중심의 카메라 위치 생성 */ declare const getSeoulCityHallCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 부산시청 중심의 카메라 위치 생성 */ declare const getBusanCityHallCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 대구시청 중심의 카메라 위치 생성 */ declare const getDaeguCityHallCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 인천시청 중심의 카메라 위치 생성 */ declare const getIncheonCityHallCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 광주시청 중심의 카메라 위치 생성 */ declare const getGwangjuCityHallCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 대전시청 중심의 카메라 위치 생성 */ declare const getDaejeonCityHallCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 울산시청 중심의 카메라 위치 생성 */ declare const getUlsanCityHallCameraPosition: (altitude?: number) => VWorldCameraPosition; /** * 고도별 설명 */ declare const getAltitudeDescription: (altitude: number) => string; /** * 레벨을 고도로 변환 */ declare const zoomToAltitude: (zoomLevel: number) => number; /** * 고도를 레벨로 변환 */ declare const altitudeToZoom: (altitude: number) => number; /** * 레벨별 설명 */ declare const getZoomDescription: (zoomLevel: number) => string; /** * 좌표를 WGS84 형식으로 변환 */ declare const coordToWGS84: (coord: VWorldCoord) => string; /** * WGS84 문자열을 좌표로 변환 */ declare const wgs84ToCoord: (wgs84String: string) => VWorldCoord; /** * 고도 차이 계산 (미터 단위) */ declare const calculateAltitudeDifference: (coord1: VWorldCoord, coord2: VWorldCoord) => number; /** * 경사도 계산 (도 단위) */ declare const calculateSlope: (coord1: VWorldCoord, coord2: VWorldCoord) => number; /** * 좌표를 UTM 좌표계로 변환 */ declare const coordToUTM: (coord: VWorldCoord) => { zone: number; easting: number; northing: number; }; /** * UTM 좌표를 WGS84로 변환 */ declare const utmToCoord: (zone: number, easting: number, northing: number) => VWorldCoord; /** * 좌표를 TM 좌표계로 변환 (한국 중부원점) */ declare const coordToTM: (coord: VWorldCoord) => { x: number; y: number; }; /** * TM 좌표를 WGS84로 변환 */ declare const tmToCoord: (x: number, y: number) => VWorldCoord; /** * 애니메이션 이징 함수들 */ declare const easingFunctions: { linear: (t: number) => number; easeInQuad: (t: number) => number; easeOutQuad: (t: number) => number; easeInOutQuad: (t: number) => number; easeInCubic: (t: number) => number; easeOutCubic: (t: number) => number; easeInOutCubic: (t: number) => number; }; /** * 애니메이션 인터폴레이션 */ declare const interpolate: (start: number, end: number, progress: number, easing?: keyof typeof easingFunctions) => number; /** * 카메라 위치 애니메이션 */ declare const interpolateCameraPosition: (start: VWorldCameraPosition, end: VWorldCameraPosition, progress: number, easing?: keyof typeof easingFunctions) => VWorldCameraPosition; /** * 좌표 거리 계산 (미터 단위) */ declare const calculateDistance: (coord1: VWorldCoord, coord2: VWorldCoord) => number; export { VWorldAnimation, VWorldCameraPosition, VWorldConfig, VWorldControls, VWorldCoord, VWorldDataOptions, VWorldDirection, VWorldFeature, VWorldFeatureStyle, VWorldInfoPanel, VWorldLayer, VWorldLocationPicker, VWorldMap, VWorldMapEvent, VWorldMapInstance, VWorldMapOptions, VWorldMapProps, VWorldRaycastResult, VWorldTour, altitudeToZoom, calculateAltitudeDifference, calculateDistance, calculateSlope, coordToTM, coordToUTM, coordToWGS84, createCameraPosition, createCoord, createDirection, easingFunctions, getAltitudeDescription, getBusanCityHallCameraPosition, getDaeguCityHallCameraPosition, getDaejeonCityHallCameraPosition, getGwanghwamunCameraPosition, getGwangjuCityHallCameraPosition, getIncheonCityHallCameraPosition, getSeoulCityHallCameraPosition, getUlsanCityHallCameraPosition, getZoomDescription, interpolate, interpolateCameraPosition, tmToCoord, utmToCoord, wgs84ToCoord, zoomToAltitude };