시설 상세

This commit is contained in:
yschoi
2025-05-02 17:36:23 +09:00
parent e443c93061
commit 20fa32cc58
3 changed files with 16 additions and 20 deletions
@@ -10,11 +10,7 @@ import proj4 from 'proj4';
import { register } from 'ol/proj/proj4';
import GisApp from './lib/gis.core';
import GisContent from './GisContent';
import GisLonLat from './GisLonLat';
import GisToolBar from './GisToolBar';
import GisSelect from './GisSelect';
import GisTab from './GisTab';
import MapToggleBtn from './MapToggleBtn';
import FeatureClickEventPopup from '@/map/featureClickEventPopup';
export const GisContext = createContext({gisCore: null, gisMap: null, treeData:null});
@@ -140,19 +136,15 @@ function Gis({ treeData = [], isSearch = false }) {
<>
<GisContext.Provider value={{gisCore, gisMap, treeData}}>
<div className="h-[calc(100vh-10rem)] flex relative">
<GisTab visible={tabVisible} setVisible={setTabVisible} isSearch={isSearch} />
<GisContent onFeatureSelect={handleFeatureSelect}/>
{isOpen && featureData && (
<FeatureClickEventPopup
<FeatureClickEventPopup
featureData={featureData}
onClose={closePopup} // 닫기 콜백 전달
/>
)}
/>
)}
<div ref={mapRef} className="gis-map flex-1 relative" style={{ height: '100%', padding: 0 }} />
<GisLonLat/>
<GisToolBar/>
<MapToggleBtn/>
<GisSelect onFeatureClick = {handleFeatureClick} />
<GisContent onFeatureSelect={handleFeatureSelect} />
<GisTab visible={tabVisible} setVisible={setTabVisible} isSearch={isSearch} />
</div>
</GisContext.Provider>
</>
@@ -8,7 +8,7 @@ import './lib/css/gis.edit.css';
import MapToggleBtn from './MapToggleBtn';
import GisEdit from './GisEdit';
export default function GisContent({ edit = false,onFeatureSelect }) {
export default function GisContent({ edit = false, onFeatureSelect }) {
const { gisMap, gisCore } = useGisContext();
const [visibleComponents, setVisibleComponents] = useState({});
const addressResultLayer = useRef(null);
@@ -51,11 +51,10 @@ export default function GisContent({ edit = false,onFeatureSelect }) {
return (
<>
{/*<GisTree />*/}
{/* <MapToggleBtn useCesium={useCesium} /> */}
{/* { <GisLonLat /> */}
{/* <GisSelect clickFeature={clickFeature} /> */}
<MapToggleBtn />
<GisLonLat />
<GisToolBar />
<GisSelect onFeatureSelect={onFeatureSelect}/>
{/* {edit && <GisEdit />} */}
</>
);
}
@@ -7,6 +7,7 @@ export default React.memo(function GisSelect({ onFeatureSelect }) {
const { gisMap } = useContext(GisContext);
// useEffect(() => {
// if (!gisMap) return; // 아직 초기화 안 됐으면 아무것도 안 함
@@ -15,10 +16,14 @@ export default React.memo(function GisSelect({ onFeatureSelect }) {
// select.getSelectedInfo(function (features) {
// if (features?.[0]) {
// onFeatureClick?.(features[0]); // props로 넘긴 함수 실행
// // onFeatureClick?.(features[0]); // props로 넘긴 함수 실행
// onFeatureSelect(layer.getProperties()); //피쳐 속성데이터 상위컴포넌트로 전달
// }
// });
// }, [gisMap, onFeatureClick]);
// }, [gisMap, onFeatureSelect]);
const select = new GisOlSelect(gisMap);
GisApp.Module.select = select;
select.getSelectedInfo(function (features) {
//clickFeature(features[0]);