디버깅용 console.log 삭제

This commit is contained in:
dohyeons
2025-11-17 16:32:50 +09:00
parent fb9bc268a0
commit 8006255bbf
2 changed files with 2 additions and 61 deletions

View File

@@ -74,12 +74,6 @@ export default function CustomMetricTestWidget({ element }: CustomMetricTestWidg
const config = element?.customMetricConfig;
console.log("📊 [CustomMetricTestWidget] 렌더링:", {
element,
config,
dataSource: element?.dataSource,
});
useEffect(() => {
loadData();
@@ -207,7 +201,6 @@ export default function CustomMetricTestWidget({ element }: CustomMetricTestWidg
}
}
} catch (err) {
console.error("데이터 로드 실패:", err);
setError(err instanceof Error ? err.message : "데이터를 불러올 수 없습니다");
} finally {
setLoading(false);

View File

@@ -128,7 +128,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
return { markers: [], polygons: [] };
} catch (err: any) {
console.error(`❌ 데이터 소스 "${source.name || source.id}" 로딩 실패:`, err);
return { markers: [], polygons: [] };
}
}),
@@ -151,8 +150,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
if (value.polygons && Array.isArray(value.polygons)) {
allPolygons.push(...value.polygons);
}
} else if (result.status === "rejected") {
console.error(`❌ 데이터 소스 ${index} 실패:`, result.reason);
}
});
@@ -160,22 +157,9 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
const markersWithHeading = allMarkers.map((marker) => {
const prevMarker = prevMarkersRef.current.find((pm) => pm.id === marker.id);
console.log("🔍 마커 비교:", {
id: marker.id,
: `[${marker.lat}, ${marker.lng}]`,
이전위치: prevMarker ? `[${prevMarker.lat}, ${prevMarker.lng}]` : "없음",
같은지: prevMarker ? prevMarker.lat === marker.lat && prevMarker.lng === marker.lng : "N/A",
});
if (prevMarker && (prevMarker.lat !== marker.lat || prevMarker.lng !== marker.lng)) {
// 이동했으면 방향 계산
const heading = calculateHeading(prevMarker.lat, prevMarker.lng, marker.lat, marker.lng);
console.log("🧭 방향 계산:", {
id: marker.id,
from: `[${prevMarker.lat.toFixed(4)}, ${prevMarker.lng.toFixed(4)}]`,
to: `[${marker.lat.toFixed(4)}, ${marker.lng.toFixed(4)}]`,
heading: `${heading.toFixed(1)}°`,
});
return {
...marker,
heading,
@@ -185,7 +169,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
}
// 이동하지 않았거나 이전 데이터가 없으면 기존 heading 유지 (또는 0)
console.log("⏸️ 이동 없음:", { id: marker.id, heading: marker.heading || prevMarker?.heading || 0 });
return {
...marker,
heading: marker.heading || prevMarker?.heading || 0,
@@ -197,7 +180,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
setPolygons(allPolygons);
setLastRefreshTime(new Date());
} catch (err: any) {
console.error("❌ 데이터 로딩 중 오류:", err);
setError(err.message);
} finally {
setLoading(false);
@@ -359,7 +341,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
return results;
} catch (error) {
console.error(" ❌ XML 파싱 실패:", error);
return [];
}
};
@@ -404,13 +385,11 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
obj.name = obj.subRegion || obj.region || obj.code;
result.push(obj);
// console.log(` ✅ 파싱 성공:`, obj);
}
}
return result;
} catch (error) {
console.error(" ❌ 텍스트 파싱 오류:", error);
return [];
}
};
@@ -444,7 +423,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
// coordinates가 [lat, lng] 배열의 배열인지 확인
const firstCoord = row.coordinates[0];
if (Array.isArray(firstCoord) && firstCoord.length === 2) {
// console.log(` → 폴리곤으로 처리:`, row.name);
polygons.push({
id: row.id || row.code || `polygon-${index}`,
name: row.name || row.title || `영역 ${index + 1}`,
@@ -487,7 +465,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
if (coords) {
lat = coords.lat;
lng = coords.lng;
// console.log(` → 변환 성공: (${lat}, ${lng})`);
}
}
@@ -498,7 +475,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
if (coords) {
lat = coords.lat;
lng = coords.lng;
// console.log(` → 변환 성공: (${lat}, ${lng})`);
}
}
@@ -506,7 +482,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
if (mapDisplayType === "polygon") {
const regionName = row.name || row.subRegion || row.region || row.area;
if (regionName) {
// console.log(` 🔷 강제 폴리곤 모드: ${regionName} → 폴리곤으로 추가 (GeoJSON 매칭)`);
polygons.push({
id: `${sourceName}-polygon-${index}-${row.code || row.id || Date.now()}`, // 고유 ID 생성
name: regionName,
@@ -516,8 +491,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
source: sourceName,
color: dataSource?.polygonColor || getColorByStatus(row.status || row.level),
});
} else {
// console.log(` ⚠️ 강제 폴리곤 모드지만 지역명 없음 - 스킵`);
}
return; // 폴리곤으로 처리했으므로 마커로는 추가하지 않음
}
@@ -540,7 +513,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
// 위도/경도가 없는 육지 지역 → 폴리곤으로 추가 (GeoJSON 매칭용)
const regionName = row.name || row.subRegion || row.region || row.area;
if (regionName) {
// console.log(` 📍 위도/경도 없지만 지역명 있음: ${regionName} → 폴리곤으로 추가 (GeoJSON 매칭)`);
polygons.push({
id: `${sourceName}-polygon-${index}-${row.code || row.id || Date.now()}`, // 고유 ID 생성
name: regionName,
@@ -550,9 +522,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
source: sourceName,
color: dataSource?.polygonColor || getColorByStatus(row.status || row.level),
});
} else {
// console.log(` ⚠️ 위도/경도 없고 지역명도 없음 - 스킵`);
// console.log(` 데이터:`, row);
}
}
});
@@ -938,7 +907,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
const nameColumn = columns.find((col) => /^(name|title|이름|명칭|location)$/i.test(col));
if (!latColumn || !lngColumn) {
console.warn("⚠️ 위도/경도 컬럼을 찾을 수 없습니다.");
return [];
}
@@ -974,7 +942,7 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
const data = await response.json();
setGeoJsonData(data);
} catch (err) {
console.error("❌ GeoJSON 로드 실패:", err);
// GeoJSON 로드 실패 처리
}
};
loadGeoJsonData();
@@ -1073,14 +1041,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
{/* 폴리곤 렌더링 */}
{/* GeoJSON 렌더링 (육지 지역 경계선) */}
{(() => {
// console.log(`🗺️ GeoJSON 렌더링 조건 체크:`, {
// geoJsonData: !!geoJsonData,
// polygonsLength: polygons.length,
// polygonNames: polygons.map(p => p.name),
// });
return null;
})()}
{geoJsonData && polygons.length > 0 ? (
<GeoJSON
key={JSON.stringify(polygons.map((p) => p.id))} // 폴리곤 변경 시 재렌더링
@@ -1095,31 +1055,25 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
// 정확한 매칭
if (p.name === sigName) {
// console.log(`✅ 정확 매칭: ${p.name} === ${sigName}`);
return true;
}
if (p.name === ctpName) {
// console.log(`✅ 정확 매칭: ${p.name} === ${ctpName}`);
return true;
}
// 부분 매칭 (GeoJSON 지역명에 폴리곤 이름이 포함되는지)
if (sigName && sigName.includes(p.name)) {
// console.log(`✅ 부분 매칭: ${sigName} includes ${p.name}`);
return true;
}
if (ctpName && ctpName.includes(p.name)) {
// console.log(`✅ 부분 매칭: ${ctpName} includes ${p.name}`);
return true;
}
// 역방향 매칭 (폴리곤 이름에 GeoJSON 지역명이 포함되는지)
if (sigName && p.name.includes(sigName)) {
// console.log(`✅ 역방향 매칭: ${p.name} includes ${sigName}`);
return true;
}
if (ctpName && p.name.includes(ctpName)) {
// console.log(`✅ 역방향 매칭: ${p.name} includes ${ctpName}`);
return true;
}
@@ -1209,11 +1163,7 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
}
}}
/>
) : (
<>
{/* console.log(`⚠️ GeoJSON 렌더링 안 됨: geoJsonData=${!!geoJsonData}, polygons=${polygons.length}`) */}
</>
)}
) : null}
{/* 폴리곤 렌더링 (해상 구역만) */}
{polygons
@@ -1315,8 +1265,6 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
const L = require("leaflet");
const heading = marker.heading || 0;
console.log("🎨 마커 렌더링:", { id: marker.id, heading: `${heading.toFixed(1)}°`, type: markerType });
if (markerType === "arrow") {
// 화살표 마커
markerIcon = L.divIcon({