Merge commit '4ee673204552110924d8c9652cb752d10310cf1b' into iipbs/wr/hasuReg
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import React, { useContext, useState } from 'react';
|
||||
import { Button } from "@common/components";
|
||||
import { GisContext } from './Gis';
|
||||
import GisApp from './lib/gis.core';
|
||||
|
||||
export default React.memo(function MapToggleBtn() {
|
||||
const { gisCore } = useContext(GisContext);
|
||||
const [activeMap, setActiveMap] = useState({ label: '일반', type: 'base' }); // 기본 선택값
|
||||
|
||||
const handleSelect = mapObj => {
|
||||
setActiveMap(mapObj);
|
||||
gisCore.changeBaseLayer(mapObj.type);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mapbtn">
|
||||
<button className="sprite_gis viewer" title="지도선택">지도 선택</button>
|
||||
<ul className="choice_map">
|
||||
<li className={activeMap.type === 'base' ? 'on' : ''}>
|
||||
<button className="map1" id="base" title="일반지도" onClick={() => handleSelect({ label: '일반', type: 'base' })}>
|
||||
<div>일반지도</div>
|
||||
</button>
|
||||
</li>
|
||||
<li className={activeMap.type === 'satellite' ? 'on' : ''}>
|
||||
<button className="map2" id="satelite" title="위성지도" onClick={() => handleSelect({ label: '위성', type: 'satellite' })}>
|
||||
<div>위성지도</div>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
export default function GisSearch() {
|
||||
return (
|
||||
<div className="p-2">
|
||||
<p>범례 영역입니다 (향후 컴포넌트로 교체 가능)</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -6,32 +6,37 @@ import { GisContext } from './Gis';
|
||||
export default React.memo(function GisSelect({ onFeatureSelect }) {
|
||||
|
||||
const { gisMap } = useContext(GisContext);
|
||||
|
||||
|
||||
// useEffect(() => {
|
||||
// if (!gisMap) return; // 아직 초기화 안 됐으면 아무것도 안 함
|
||||
|
||||
// const select = new GisOlSelect(gisMap);
|
||||
// GisApp.Module.select = select;
|
||||
|
||||
// select.getSelectedInfo(function (features) {
|
||||
// if (features?.[0]) {
|
||||
// // onFeatureClick?.(features[0]); // props로 넘긴 함수 실행
|
||||
// onFeatureSelect(layer.getProperties()); //피쳐 속성데이터 상위컴포넌트로 전달
|
||||
// }
|
||||
// });
|
||||
// }, [gisMap, onFeatureSelect]);
|
||||
|
||||
const select = new GisOlSelect(gisMap);
|
||||
GisApp.Module.select = select;
|
||||
|
||||
select.getSelectedInfo(function (features) {
|
||||
//clickFeature(features[0]);
|
||||
if(features.length > 0) {
|
||||
const layer = features[0];
|
||||
onFeatureSelect(layer); //피쳐 속성데이터 상위컴포넌트로 전달
|
||||
useEffect(() => {
|
||||
if (!gisMap) return; // 아직 초기화 안 됐으면 아무것도 안 함
|
||||
|
||||
// 이미 select가 있으면 재생성하지 않음
|
||||
if (!GisApp.Module.select) {
|
||||
const select = new GisOlSelect(gisMap);
|
||||
GisApp.Module.select = select;
|
||||
|
||||
// 피처 선택 시 콜백 등록
|
||||
select.getSelectedInfo(function (features) {
|
||||
if (features?.[0]) {
|
||||
console.log('GisSelect features', features);
|
||||
onFeatureSelect(features[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}, [gisMap, onFeatureSelect]);
|
||||
|
||||
// const select = new GisOlSelect(gisMap);
|
||||
// GisApp.Module.select = select;
|
||||
|
||||
// select.getSelectedInfo(function (features) {
|
||||
// //clickFeature(features[0]);
|
||||
// if(features.length > 0) {
|
||||
// const layer = features[0];
|
||||
// // console.log('GisSelect layer', layer);
|
||||
// onFeatureSelect(layer); //피쳐 속성데이터 상위컴포넌트로 전달
|
||||
// }
|
||||
// });
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,81 +1,85 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Tabs, TabsList, TabsTrigger } from '@common/components/ui/tabs';
|
||||
import GisTree from './GisTree';
|
||||
import GisSearch from './GisSearch';
|
||||
import { ChevronLeft, ChevronRight, Search } from 'lucide-react';
|
||||
import SearchModal from '@/map/SearchModal';
|
||||
// import React, { useState } from 'react';
|
||||
// import { Tabs, TabsList, TabsTrigger } from '@common/components/ui/tabs';
|
||||
// import GisTree from './GisTree';
|
||||
// import GisSearch from './GisSearch';
|
||||
// import { ChevronLeft, ChevronRight, Search } from 'lucide-react';
|
||||
// import SearchModal from '@/map/SearchModal';
|
||||
|
||||
|
||||
function GisTab({ visible, setVisible, isSearch, isSearchModalOpen, setIsSearchModalOpen }) {
|
||||
const [activeTab, setActiveTab] = useState('layers');
|
||||
// function GisTab({ visible, setVisible, isSearch, isSearchModalOpen, setIsSearchModalOpen, onFeatureSelect }) {
|
||||
// const [activeTab, setActiveTab] = useState('layers');
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={`absolute top-0 left-0 w-[250px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-40
|
||||
${visible ? 'translate-x-0 opacity-100' : '-translate-x-full opacity-0 pointer-events-none'}`}
|
||||
>
|
||||
<Tabs value={activeTab} onValueChange={setActiveTab} className="flex-1 flex flex-col overflow-hidden">
|
||||
<TabsList className="flex-none mt-4 border-none rounded-none">
|
||||
<TabsTrigger value="layers" className="flex-1 h-10">레이어</TabsTrigger>
|
||||
{isSearch && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsSearchModalOpen(true)}
|
||||
className="h-10 w-10 flex items-center justify-center px-0"
|
||||
>
|
||||
<Search size={18} className="text-gray-700" />
|
||||
</button>
|
||||
// <TabsTrigger value="search" className="flex-1 h-10 flex items-center justify-center">
|
||||
// <Search size={18} />
|
||||
// </TabsTrigger>
|
||||
)}
|
||||
</TabsList>
|
||||
// return (
|
||||
// <>
|
||||
// <div
|
||||
// className={`absolute top-0 left-0 w-[250px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-40
|
||||
// ${visible ? 'translate-x-0 opacity-100' : '-translate-x-full opacity-0 pointer-events-none'}`}
|
||||
// >
|
||||
// <Tabs value={activeTab} onValueChange={setActiveTab} className="flex-1 flex flex-col overflow-hidden">
|
||||
// <TabsList className="flex-none mt-4 border-none rounded-none">
|
||||
// <TabsTrigger value="layers" className="flex-1 h-10">레이어</TabsTrigger>
|
||||
// {/* {isSearch && (
|
||||
// <button
|
||||
// type="button"
|
||||
// onClick={() => setIsSearchModalOpen(true)}
|
||||
// className="h-10 w-10 flex items-center justify-center px-0"
|
||||
// >
|
||||
// <Search size={18} className="text-gray-700" />
|
||||
// </button>
|
||||
// // <TabsTrigger value="search" className="flex-1 h-10 flex items-center justify-center">
|
||||
// // <Search size={18} />
|
||||
// // </TabsTrigger>
|
||||
// )} */}
|
||||
// </TabsList>
|
||||
|
||||
{/* GisTree는 항상 마운트되며, 탭 상태에 따라 보여주기만 함 */}
|
||||
<div
|
||||
className={`grow overflow-y-auto p-2 pt-0 border-none shadow-none ${activeTab === 'layers' ? 'block' : 'hidden'
|
||||
}`}
|
||||
>
|
||||
<GisTree />
|
||||
</div>
|
||||
// {/* GisTree는 항상 마운트되며, 탭 상태에 따라 보여주기만 함 */}
|
||||
// <div
|
||||
// className={`grow overflow-y-auto p-2 pt-0 border-none shadow-none ${activeTab === 'layers' ? 'block' : 'hidden'
|
||||
// }`}
|
||||
// >
|
||||
// <GisTree />
|
||||
// </div>
|
||||
|
||||
{/* GisSearch도 동일하게 처리 */}
|
||||
{/* {isSearch && (
|
||||
<div
|
||||
className={`grow overflow-y-auto p-2 pt-0 border-none shadow-none ${
|
||||
activeTab === 'search' ? 'block' : 'hidden'
|
||||
}`}
|
||||
>
|
||||
<GisSearch />
|
||||
</div>
|
||||
)} */}
|
||||
// {/* GisSearch도 동일하게 처리 */}
|
||||
// {/* {isSearch && (
|
||||
// <div
|
||||
// className={`grow overflow-y-auto p-2 pt-0 border-none shadow-none ${
|
||||
// activeTab === 'search' ? 'block' : 'hidden'
|
||||
// }`}
|
||||
// >
|
||||
// <GisSearch />
|
||||
// </div>
|
||||
// )} */}
|
||||
|
||||
|
||||
{/* 🔍 검색 모달 */}
|
||||
<SearchModal open={isSearchModalOpen} onOpenChange={setIsSearchModalOpen} />
|
||||
</Tabs>
|
||||
// {/* 🔍 검색 모달 */}
|
||||
// {/* <SearchModal
|
||||
// open={isSearchModalOpen}
|
||||
// onOpenChange={setIsSearchModalOpen}
|
||||
// onFeatureSelect={onFeatureSelect}
|
||||
// /> */}
|
||||
// </Tabs>
|
||||
|
||||
{/* 접기 버튼 */}
|
||||
<button
|
||||
onClick={() => setVisible(false)}
|
||||
className="absolute top-1/2 right-[-3px] transform -translate-y-1/2 z-50 bg-white border border-l border-gray-300 rounded-l-none rounded-r px-1 py-2 shadow-sm"
|
||||
>
|
||||
<ChevronLeft size={16} />
|
||||
</button>
|
||||
</div>
|
||||
// {/* 접기 버튼 */}
|
||||
// <button
|
||||
// onClick={() => setVisible(false)}
|
||||
// className="absolute top-1/2 right-[-3px] transform -translate-y-1/2 z-50 bg-white border border-l border-gray-300 rounded-l-none rounded-r px-1 py-2 shadow-sm"
|
||||
// >
|
||||
// <ChevronLeft size={16} />
|
||||
// </button>
|
||||
// </div>
|
||||
|
||||
{/* 열기 버튼 */}
|
||||
{!visible && (
|
||||
<button
|
||||
onClick={() => setVisible(true)}
|
||||
className="absolute top-1/2 left-[-3px] transform -translate-y-1/2 z-50 bg-white border border-r border-gray-300 rounded-r px-1 py-2 shadow-sm"
|
||||
>
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
// {/* 열기 버튼 */}
|
||||
// {!visible && (
|
||||
// <button
|
||||
// onClick={() => setVisible(true)}
|
||||
// className="absolute top-1/2 left-[-3px] transform -translate-y-1/2 z-50 bg-white border border-r border-gray-300 rounded-r px-1 py-2 shadow-sm"
|
||||
// >
|
||||
// <ChevronRight size={16} />
|
||||
// </button>
|
||||
// )}
|
||||
// </>
|
||||
// );
|
||||
// }
|
||||
|
||||
export default React.memo(GisTab);
|
||||
// export default React.memo(GisTab);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import GisApp from './lib/gis.core';
|
||||
import { util } from './lib/util';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useGisContext } from './Gis';
|
||||
import { DndProvider } from "react-dnd";
|
||||
@@ -8,14 +7,14 @@ import {
|
||||
MultiBackend,
|
||||
getBackendOptions
|
||||
} from "@minoru/react-dnd-treeview";
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components/ui/tabs";
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
|
||||
export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => {} }) {
|
||||
export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible }) {
|
||||
const { gisCore, treeData } = useGisContext();
|
||||
const [checked, setChecked] = useState([]);
|
||||
const [expanded, setExpanded] = useState([]);
|
||||
const [nodes, setNodes] = useState([]);
|
||||
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
|
||||
const [activeTab, setActiveTab] = useState('layers');
|
||||
|
||||
useEffect(() => {
|
||||
if (treeData && treeData.length > 0) {
|
||||
@@ -115,7 +114,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
};
|
||||
|
||||
const makeLegendSrc = layerinfo => {
|
||||
if(!layerinfo.gobjTy) return null;
|
||||
if (!layerinfo.gobjTy) return null;
|
||||
|
||||
let src;
|
||||
if (layerinfo.iconNm) {
|
||||
@@ -176,34 +175,61 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
|
||||
return (
|
||||
<>
|
||||
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
|
||||
<Tree
|
||||
tree={nodes}
|
||||
rootId={null}
|
||||
initialOpen={expanded}
|
||||
onOpenChange={setExpanded}
|
||||
render={(node, { depth, isOpen, onToggle }) => (
|
||||
<div
|
||||
className="flex items-center gap-2 py-1 px-2 hover:bg-gray-100 rounded"
|
||||
style={{ marginInlineStart: depth * 16 + (!node.droppable ? 16 : 0) }}
|
||||
>
|
||||
{node.droppable && (
|
||||
<i onClick={onToggle} className={`diveicon di-arrow-forward mr-2 text-base text-label ${isOpen ? 'rotate-90' : ''}`}
|
||||
title={isOpen ? '닫기' : '열기'}>
|
||||
</i>
|
||||
)}
|
||||
<input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer"/>
|
||||
{node.icon && <span>{node.icon}</span>}
|
||||
<span className="text-[1.3rem] font-medium text-label">{node.text}</span>
|
||||
</div>
|
||||
)}
|
||||
sort={(a, b) => {
|
||||
const aOrder = parseInt(a.data?.sortOrdr ?? '0');
|
||||
const bOrder = parseInt(b.data?.sortOrdr ?? '0');
|
||||
return aOrder - bOrder;
|
||||
}}
|
||||
/>
|
||||
</DndProvider>
|
||||
<div
|
||||
className={`absolute top-0 left-0 w-[250px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-40
|
||||
${visible ? 'translate-x-0 opacity-100' : '-translate-x-full opacity-0 pointer-events-none'}`}
|
||||
>
|
||||
<div
|
||||
className={`grow overflow-y-auto p-2 pt-0 border-none shadow-none ${activeTab === 'layers' ? 'block' : 'hidden'}`}
|
||||
>
|
||||
<h3 className="text-3xl text-gray-600 text-bold font-bold mx-2 my-4 ">레이어</h3>
|
||||
<hr className="mb-4" />
|
||||
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
|
||||
<Tree
|
||||
tree={nodes}
|
||||
rootId={null}
|
||||
initialOpen={expanded}
|
||||
onOpenChange={setExpanded}
|
||||
render={(node, { depth, isOpen, onToggle }) => (
|
||||
<div
|
||||
className="flex items-center gap-2 py-1 px-2 hover:bg-gray-100 rounded"
|
||||
style={{ marginInlineStart: depth * 16 + (!node.droppable ? 16 : 0) }}
|
||||
>
|
||||
{node.droppable && (
|
||||
<i onClick={onToggle} className={`diveicon di-arrow-forward mr-2 text-base text-label ${isOpen ? 'rotate-90' : ''}`}
|
||||
title={isOpen ? '닫기' : '열기'}>
|
||||
</i>
|
||||
)}
|
||||
<input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer" />
|
||||
{node.icon && <span>{node.icon}</span>}
|
||||
<span className="text-[1.3rem] font-medium text-label">{node.text}</span>
|
||||
</div>
|
||||
)}
|
||||
sort={(a, b) => {
|
||||
const aOrder = parseInt(a.data?.sortOrdr ?? '0');
|
||||
const bOrder = parseInt(b.data?.sortOrdr ?? '0');
|
||||
return aOrder - bOrder;
|
||||
}}
|
||||
/>
|
||||
</DndProvider>
|
||||
</div>
|
||||
{/* 접기 버튼 */}
|
||||
<button
|
||||
onClick={() => setVisible(false)}
|
||||
className="absolute top-1/2 right-[-3px] transform -translate-y-1/2 z-50 bg-white border border-l border-gray-300 rounded-l-none rounded-r px-1 py-2 shadow-sm"
|
||||
>
|
||||
<ChevronLeft size={16} />
|
||||
</button>
|
||||
</div>
|
||||
{/* 열기 버튼 */}
|
||||
{!visible && (
|
||||
<button
|
||||
onClick={() => setVisible(true)}
|
||||
className="absolute top-1/2 left-[-3px] transform -translate-y-1/2 z-50 bg-white border border-r border-gray-300 rounded-r px-1 py-2 shadow-sm"
|
||||
>
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import OLCesium from 'olcs/OLCesium';
|
||||
import olView from 'ol/View.js';
|
||||
import olSourceImageWMS from 'ol/source/ImageWMS.js';
|
||||
import olSourceOSM from 'ol/source/OSM.js';
|
||||
import olLayerImage from 'ol/layer/Image.js';
|
||||
import olLayerTile from 'ol/layer/Tile.js';
|
||||
import olMap from 'ol/Map.js';
|
||||
import { GLOBAL } from '../../js/consts/global';
|
||||
|
||||
const Google3DMap = () => {
|
||||
const mapRef = useRef(null);
|
||||
const [ol3d, setOl3d] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!mapRef.current) return;
|
||||
|
||||
const customProjSource = new olSourceImageWMS({
|
||||
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">National parks / geo.admin.ch</a>',
|
||||
crossOrigin: 'anonymous',
|
||||
params: { LAYERS: 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung' },
|
||||
projection: 'EPSG:21781',
|
||||
url: 'https://wms.geo.admin.ch/',
|
||||
});
|
||||
|
||||
const { Cesium } = window;
|
||||
Cesium.Ion.defaultAccessToken = GLOBAL.CESIUM_ION_TOKEN;
|
||||
|
||||
const ol2d = new olMap({
|
||||
layers: [new olLayerTile({ source: new olSourceOSM() }), new olLayerImage({ source: customProjSource })],
|
||||
target: mapRef.current,
|
||||
view: new olView({
|
||||
center: [860434.6266531206, 6029479.0044273855],
|
||||
zoom: 6,
|
||||
}),
|
||||
});
|
||||
|
||||
const ol3dInstance = new OLCesium({
|
||||
map: ol2d,
|
||||
time: () => Cesium.JulianDate.now(),
|
||||
});
|
||||
|
||||
const scene = ol3dInstance.getCesiumScene();
|
||||
Cesium.createWorldTerrainAsync().then(tp => {
|
||||
scene.terrainProvider = tp;
|
||||
});
|
||||
|
||||
ol3dInstance.setEnabled(true);
|
||||
setOl3d(ol3dInstance);
|
||||
|
||||
return () => {
|
||||
ol3dInstance.setEnabled(false);
|
||||
ol2d.setTarget(null);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return <div ref={mapRef} style={{ width: '100%', height: '100vh' }} />;
|
||||
};
|
||||
|
||||
export default Google3DMap;
|
||||
@@ -1,32 +0,0 @@
|
||||
import React, { useContext, useState } from 'react';
|
||||
import { Button } from "@common/components";
|
||||
import { GisContext } from './Gis';
|
||||
import GisApp from './lib/gis.core';
|
||||
|
||||
export default React.memo(function MapToggleBtn() {
|
||||
const { gisCore } = useContext(GisContext);
|
||||
const [activeMap, setActiveMap] = useState({ label: '일반', type: 'base' }); // 기본 선택값
|
||||
|
||||
const handleSelect = mapObj => {
|
||||
setActiveMap(mapObj);
|
||||
gisCore.changeBaseLayer(mapObj.type);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mapbtn" style={{ zIndex: 101 }}>
|
||||
<button className="sprite_gis viewer" title="지도선택">지도 선택</button>
|
||||
<ul className="choice_map">
|
||||
<li className={activeMap.type === 'base' ? 'on' : ''}>
|
||||
<button className="map1" id="base" title="일반지도" onClick={() => handleSelect({ label: '일반', type: 'base' })}>
|
||||
<div>일반지도</div>
|
||||
</button>
|
||||
</li>
|
||||
<li className={activeMap.type === 'satellite' ? 'on' : ''}>
|
||||
<button className="map2" id="satelite" title="위성지도" onClick={() => handleSelect({ label: '위성', type: 'satellite' })}>
|
||||
<div>위성지도</div>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -9,6 +9,7 @@
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 20px;
|
||||
z-index: 2;
|
||||
}
|
||||
.mapbtn h3 {
|
||||
overflow: hidden;
|
||||
@@ -304,7 +305,7 @@
|
||||
bottom: 40px;
|
||||
right: 200px;
|
||||
display: inline-block;
|
||||
z-index: 101;
|
||||
z-index: 2;
|
||||
list-style: none;
|
||||
}
|
||||
.map-scale-area li {
|
||||
@@ -1003,7 +1004,7 @@ table.board-table tbody th td {
|
||||
.gis-content .evl-legends{
|
||||
bottom: -20px !important;
|
||||
left: 1350px;
|
||||
z-index: 101;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,12 @@ import { Fill, Stroke, Style } from 'ol/style';
|
||||
import CircleStyle from 'ol/style/Circle';
|
||||
import VectorLayer from 'ol/layer/Vector';
|
||||
import { Point } from 'ol/geom';
|
||||
import { boundingExtent } from 'ol/extent';
|
||||
import { getTopLeft } from 'ol/extent';
|
||||
import TileWMTS from 'ol/source/WMTS';
|
||||
import WMTSTileGrid from 'ol/tilegrid/WMTS';
|
||||
// import { get as getProjection } from 'ol/proj';
|
||||
import proj4 from 'proj4';
|
||||
import { register } from 'ol/proj/proj4';
|
||||
import olSourceImageWMS from 'ol/source/ImageWMS';
|
||||
import { GeoJSON } from 'ol/format';
|
||||
import GisOlEditLayer from './gis.edit';
|
||||
@@ -28,26 +33,33 @@ GisApp.layerInfos = [];
|
||||
//기본정보
|
||||
//GisApp.GEOSERVER_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/ows';
|
||||
//GisApp.GEOSERVER_WMS_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/wms';
|
||||
GisApp.GEOSERVER_URL = '/sn/geoserver/hasudo/ows';
|
||||
GisApp.GEOSERVER_WMS_URL = '/sn/geoserver/hasudo/wms';
|
||||
GisApp.GEOSERVER_URL = '/geoserver/hasudo/ows';
|
||||
GisApp.SN_GEOSERVER_URL = '/sewerage-service/api/v1/map/geometry';
|
||||
GisApp.GEOSERVER_WMS_URL = '/geoserver/hasudo/wms';
|
||||
|
||||
//맵 정보
|
||||
GisApp.EMAP_URL = '/emap/';
|
||||
GisApp.EMAP_SATELLITE_URL = '/emap/satellite/';
|
||||
GisApp.VWORLD_URL = 'https://xdworld.vworld.kr/2d/Base/service/{z}/{x}/{y}.png';
|
||||
GisApp.VWORLD_SATELLITE_URL = 'https://xdworld.vworld.kr/2d/Satellite/service/{z}/{x}/{y}.jpeg';
|
||||
GisApp.GOOGLE_API_KEY = 'AIzaSyCf1sgeELFalfPuqlykRKBMj6X9u_DQH6M';
|
||||
GisApp.GOOGLE_ROADMAP_URL = `https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=${GisApp.GOOGLE_API_KEY}`;
|
||||
GisApp.GOOGLE_SATELLITE_URL = `https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}&key=${GisApp.GOOGLE_API_KEY}`;
|
||||
GisApp.GOOGLE_HYBRID_URL = `https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}&key=${GisApp.GOOGLE_API_KEY}`;
|
||||
GisApp.GOOGLE_3D_URL = `https://tile.googleapis.com/v1/3dtiles/root.json?key=${GisApp.GOOGLE_API_KEY}`;
|
||||
|
||||
// TODO: NGII 정보
|
||||
GisApp.NGII_API_KEY = '04trYP9_xwLAfALjwZ-B8g'; // NGII에서 발급받은 API 키
|
||||
GisApp.NGII_WMTS_URL = `https://map.ngii.go.kr/openapi/Gettile.do?apikey=${GisApp.NGII_API_KEY}`;
|
||||
|
||||
GisApp.EMAP_URL = '/emap/';
|
||||
GisApp.EMAP_SATELLITE_URL = '/emap/satellite/';
|
||||
GisApp.VWORLD_URL = 'https://xdworld.vworld.kr/2d/Base/service/{z}/{x}/{y}.png';
|
||||
GisApp.VWORLD_SATELLITE_URL = 'https://xdworld.vworld.kr/2d/Satellite/service/{z}/{x}/{y}.jpeg';
|
||||
GisApp.OPENSTREET_URL = '//tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
GisApp.BASE_MAP_TYPES = [];
|
||||
|
||||
GisApp.FROM_PROJ = 'EPSG:4326';
|
||||
GisApp.TO_PROJ = 'EPSG:3857';
|
||||
// GisApp.TO_PROJ = 'EPSG:3857';
|
||||
GisApp.TO_PROJ = 'EPSG:5179'; //ngii 좌표계
|
||||
GisApp.TO_DATA_PROJ = 'EPSG:4326';
|
||||
GisApp.CONTEXT_LAYER_PATH = '/sn/images/map/layericon/';
|
||||
GisApp.CONTEXT_LAYER_PATH = '/images/map/layericon/';
|
||||
GisApp.layerCode = {};
|
||||
GisApp.hlLayerId = 'LightFeatureList';
|
||||
GisApp.hLayerId = 'highLightFeature';
|
||||
@@ -82,10 +94,11 @@ GisApp.core.prototype = {
|
||||
target: '',
|
||||
centerX: 37.2806094,
|
||||
centerY: 127.0032502,
|
||||
zoom: 11,
|
||||
minZoom: 5,
|
||||
maxZoom: 22,
|
||||
zoom: 12,
|
||||
minZoom: 6,
|
||||
maxZoom: 20,
|
||||
},
|
||||
|
||||
options: {
|
||||
/*1: { zoom: 16, minZoom: 10, maxZoom: 22, centerX: 35.3227711, centerY: 129.1836202, dataProj: 'EPSG:5186' },
|
||||
4: { zoom: 16, minZoom: 10, maxZoom: 22, centerX: 35.0140499, centerY: 126.7110757, dataProj: 'EPSG:5186' },
|
||||
@@ -109,11 +122,14 @@ GisApp.core.prototype = {
|
||||
GisApp.Module.core = this;
|
||||
GisApp.Module.layer = new GisOlLayer(this.defaults);
|
||||
GisApp.Module.edit = new GisOlEditLayer(this.defaults);
|
||||
|
||||
this.baseMiniMapLayers['base'] = this.getBaseMap('minimap-base');
|
||||
this.baseLayers['base'] = this.getBaseMap('base');
|
||||
this.baseLayers['satellite'] = this.getBaseMap('satellite');
|
||||
this.baseLayers['3d'] = this.getBaseMap('3d');
|
||||
// TODO: vworld layer 정보 (getNGIIbaseMap)활성화 하면 ngii base map으로 변경됨
|
||||
// this.baseMiniMapLayers['base'] = this.getBaseMap('minimap-base');
|
||||
// this.baseLayers['base'] = this.getBaseMap('base');
|
||||
// this.baseLayers['satellite'] = this.getBaseMap('satellite');
|
||||
// this.baseLayers['3d'] = this.getBaseMap('3d');
|
||||
this.baseLayers['base'] = this.getNGIIBaseMap('base','korean_map');
|
||||
this.baseLayers['satellite'] = this.getNGIIBaseMap('satellite','satellite_map');
|
||||
this.baseMiniMapLayers['base'] = this.getNGIIBaseMap('minimap-base','korean_map');
|
||||
},
|
||||
layerType: {
|
||||
point: 'POINT',
|
||||
@@ -126,6 +142,45 @@ GisApp.core.prototype = {
|
||||
this.setCenter(Number(this.defaults.centerX), Number(this.defaults.centerY));
|
||||
this.setZoom(15);
|
||||
},
|
||||
// NGII Base Map
|
||||
getNGIIBaseMap: function (_id, _layer) {
|
||||
// EPSG:5179 정의 및 등록이 필요함 (아래에 설명 추가)
|
||||
proj4.defs([['EPSG:5179','+proj=tmerc +lat_0=38 +lon_0=127.5 +k=0.9996 +x_0=1000000 +y_0=2000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',],]);
|
||||
register(proj4);
|
||||
const projection = olProj.get('EPSG:5179');
|
||||
projection.setExtent([-200000.0, -28024123.62, 31824123.62, 4000000.0]);
|
||||
|
||||
// const resolutions = [2088.96, 1044.48, 522.24, 261.12, 130.56, 65.28, 32.64, 16.32, 8.16, 4.08, 2.04, 1.02, 0.51, 0.255];
|
||||
// const matrixIds = ["L05", "L06", "L07", "L08", "L09", "L10", "L11", "L12", "L13", "L14", "L15", "L16", "L17", "L18"];
|
||||
const resolutions = [1044.48, 522.24, 261.12, 130.56, 65.28, 32.64, 16.32, 8.16, 4.08, 2.04, 1.02, 0.51, 0.255];
|
||||
const matrixIds = ["L06", "L07", "L08", "L09", "L10", "L11", "L12", "L13", "L14", "L15", "L16", "L17", "L18"];
|
||||
|
||||
const wmtsSource = new TileWMTS({
|
||||
url: GisApp.NGII_WMTS_URL,
|
||||
layer: _layer,
|
||||
matrixSet: 'EPSG:5179',
|
||||
format: 'image/png',
|
||||
projection: projection,
|
||||
style: 'korean',
|
||||
tileGrid: new WMTSTileGrid({
|
||||
origin: getTopLeft(projection.getExtent()),
|
||||
resolutions: resolutions,
|
||||
matrixIds: matrixIds,
|
||||
tileSize: [256, 256]
|
||||
}),
|
||||
requestEncoding: 'KVP',
|
||||
crossOrigin: 'anonymous'
|
||||
});
|
||||
|
||||
let baseMap = new TileLayer({
|
||||
id: _id,
|
||||
visible: true,
|
||||
type: 'base',
|
||||
source: wmtsSource,
|
||||
zIndex: 0
|
||||
});
|
||||
return baseMap;
|
||||
},
|
||||
getBaseMap: function (_id) {
|
||||
let url = GisApp.VWORLD_URL;
|
||||
if (_id === 'satellite') {
|
||||
@@ -182,7 +237,7 @@ GisApp.core.prototype = {
|
||||
setCenter: function (x, y, transYn) {
|
||||
if (!x || !y) return;
|
||||
let view = this.map.getView();
|
||||
|
||||
|
||||
if (!transYn) {
|
||||
// 값이 없으면
|
||||
let center = olProj.transform([Number(y), Number(x)], GisApp.FROM_PROJ, GisApp.TO_PROJ);
|
||||
@@ -553,7 +608,7 @@ GisApp.core.prototype = {
|
||||
*/
|
||||
convertLayerInfosToLayerCode: function (array, key, parentName) {
|
||||
let initialValue = {};
|
||||
|
||||
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let item = {};
|
||||
Object.assign(item, array[i]);
|
||||
|
||||
@@ -72,11 +72,18 @@ GisOlLayer.prototype = {
|
||||
* [사용]WFS 벡터 소스 반환
|
||||
*/
|
||||
getVectorSourceGeoserver: function (options) {
|
||||
const url = GisApp.GEOSERVER_URL;
|
||||
const toProj = GisApp.TO_PROJ;
|
||||
const lyrTyNm = options.lyrTyNm;
|
||||
let url = GisApp.GEOSERVER_URL;
|
||||
let toProj = GisApp.TO_PROJ;
|
||||
let lyrTyNm = options.lyrTyNm;
|
||||
let typename = this.storageNm + lyrTyNm;
|
||||
|
||||
if(options.lyrTyNm == "om_dt_untrt_swg_rain"){ //중점우수토실실
|
||||
url = GisApp.SN_GEOSERVER_URL;
|
||||
typename = lyrTyNm;
|
||||
}
|
||||
|
||||
const params = {};
|
||||
params['TYPENAME'] = this.storageNm + lyrTyNm;
|
||||
params['TYPENAME'] = typename;
|
||||
params['SERVICE'] = 'WFS';
|
||||
params['VERSION'] = '1.1.0';
|
||||
params['REQUEST'] = 'GetFeature';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import GisApp from './gis.core';
|
||||
import _ from 'lodash';
|
||||
import Style from 'ol/style/Style.js';
|
||||
import { click, mouseOnly, never } from 'ol/events/condition';
|
||||
import DragBox from 'ol/interaction/DragBox.js';
|
||||
@@ -11,7 +10,6 @@ import VectorSource from 'ol/source/Vector.js';
|
||||
import CircleStyle from 'ol/style/Circle.js';
|
||||
import Fill from 'ol/style/Fill.js';
|
||||
import Stroke from 'ol/style/Stroke.js';
|
||||
//import DOMPurify from 'dompurify';
|
||||
|
||||
const GisOlSelect = function (map, options) {
|
||||
GisApp.select = {};
|
||||
@@ -34,7 +32,7 @@ GisOlSelect.prototype = {
|
||||
selectFeatureFlag: false,
|
||||
initialize: function (map, options) {
|
||||
this.map = map;
|
||||
_.extend(this.defaults, options);
|
||||
Object.assign(this.defaults, options);
|
||||
this.setInteraction();
|
||||
this.pointerMoveEventHandler();
|
||||
},
|
||||
|
||||
@@ -8,8 +8,6 @@ import Text from 'ol/style/Text.js';
|
||||
import Point from 'ol/geom/Point.js';
|
||||
import RegularShape from 'ol/style/RegularShape.js';
|
||||
import Overlay from 'ol/Overlay';
|
||||
import _ from 'lodash';
|
||||
//import DOMPurify from 'dompurify';
|
||||
import { createPortal } from 'react-dom';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import React from 'react';
|
||||
@@ -90,13 +88,13 @@ GisOlStyle.prototype = {
|
||||
}
|
||||
|
||||
let baseResolution = 20;
|
||||
let minScale = 0.3;
|
||||
let minScale = 0.4;
|
||||
let maxScale = 1.5;
|
||||
let scale = baseResolution / resolution > maxScale ? maxScale : baseResolution / resolution;
|
||||
scale = Math.max(minScale, Math.min(maxScale, scale));
|
||||
image.setScale(scale);
|
||||
style.setImage(image);
|
||||
_.extend(style, options);
|
||||
Object.assign(style, options);
|
||||
return style;
|
||||
},
|
||||
line: function (layer, options, feature, resolution) {
|
||||
@@ -125,7 +123,7 @@ GisOlStyle.prototype = {
|
||||
color,
|
||||
});
|
||||
style.setFill(fill);
|
||||
_.extend(style, options);
|
||||
Object.assign(style, options);
|
||||
return style;
|
||||
},
|
||||
lineLabelPoligon: function (layer, options, feature, resolution) {
|
||||
@@ -152,7 +150,7 @@ GisOlStyle.prototype = {
|
||||
}
|
||||
style.setFill(fill);
|
||||
style.setStroke(stroke);
|
||||
_.extend(style, options);
|
||||
Object.assign(style, options);
|
||||
return style;
|
||||
},
|
||||
imagePoligon: function (layer, options, feature, resolution) {
|
||||
@@ -169,8 +167,7 @@ GisOlStyle.prototype = {
|
||||
image.setScale(1);
|
||||
style.setGeometry(retGeom);
|
||||
style.setImage(image);
|
||||
|
||||
_.extend(style, options);
|
||||
Object.assign(style, options);
|
||||
return style;
|
||||
},
|
||||
setOverlay: function (layer, feature, overlayHtml) {
|
||||
@@ -267,7 +264,7 @@ GisOlStyle.prototype = {
|
||||
style.setStroke(null);
|
||||
style.setFill(null);
|
||||
style.setText(text);
|
||||
_.extend(style, options);
|
||||
Object.assign(style, options);
|
||||
|
||||
return style;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user