Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5012fd1377 |
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "worldwideview",
|
"name": "worldwideview",
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "node scripts/setup.mjs",
|
"setup": "node scripts/setup.mjs",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@worldwideview/wwv-plugin-conflict-zones",
|
"name": "@worldwideview/wwv-plugin-conflict-zones",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"description": "WorldWideView plugin — Active conflict zones and geopolitical hotspots worldwide.",
|
"description": "WorldWideView plugin — Active conflict zones and geopolitical hotspots worldwide.",
|
||||||
"main": "src/index.tsx",
|
"main": "src/index.tsx",
|
||||||
"types": "src/index.tsx",
|
"types": "src/index.tsx",
|
||||||
|
|||||||
@@ -17,6 +17,36 @@ function severityToColor(score: number): string {
|
|||||||
return "#fbbf24"; // Monitoring — yellow
|
return "#fbbf24"; // Monitoring — yellow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attach _wwvEntity to a Resium Entity ref so InteractionHandler can pick it. */
|
||||||
|
function bindWwvEntity(ref: any, geoEntity: GeoEntity): void {
|
||||||
|
const cesiumEntity = ref?.cesiumElement;
|
||||||
|
if (cesiumEntity && !cesiumEntity._wwvEntity) {
|
||||||
|
cesiumEntity._wwvEntity = geoEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Build a synthetic GeoEntity from a static ConflictZone definition. */
|
||||||
|
function zoneToGeoEntity(zone: typeof CONFLICT_ZONES[number]): GeoEntity {
|
||||||
|
return {
|
||||||
|
id: zone.id,
|
||||||
|
pluginId: "conflict-zones",
|
||||||
|
latitude: zone.lat,
|
||||||
|
longitude: zone.lon,
|
||||||
|
altitude: 0,
|
||||||
|
timestamp: new Date(),
|
||||||
|
properties: {
|
||||||
|
name: zone.name,
|
||||||
|
description: zone.description,
|
||||||
|
type: zone.subtext || "N/A",
|
||||||
|
status: zone.status,
|
||||||
|
escalationScore: zone.escalationScore,
|
||||||
|
escalationTrend: zone.escalationTrend,
|
||||||
|
whyItMatters: zone.whyItMatters,
|
||||||
|
radiusKm: zone.radiusKm,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const ConflictZonesRenderer: React.FC<{ viewer: Cesium.Viewer | null; enabled: boolean }> = ({ enabled }) => {
|
const ConflictZonesRenderer: React.FC<{ viewer: Cesium.Viewer | null; enabled: boolean }> = ({ enabled }) => {
|
||||||
if (!enabled) return null;
|
if (!enabled) return null;
|
||||||
|
|
||||||
@@ -28,24 +58,14 @@ const ConflictZonesRenderer: React.FC<{ viewer: Cesium.Viewer | null; enabled: b
|
|||||||
const fillColor = Cesium.Color.fromCssColorString(colorHex).withAlpha(0.25);
|
const fillColor = Cesium.Color.fromCssColorString(colorHex).withAlpha(0.25);
|
||||||
const outlineColor = Cesium.Color.fromCssColorString(colorHex).withAlpha(0.8);
|
const outlineColor = Cesium.Color.fromCssColorString(colorHex).withAlpha(0.8);
|
||||||
const radiusMeters = zone.radiusKm * 1000;
|
const radiusMeters = zone.radiusKm * 1000;
|
||||||
|
const geoEntity = zoneToGeoEntity(zone);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Entity
|
<Entity
|
||||||
key={zone.id}
|
key={zone.id}
|
||||||
position={position}
|
position={position}
|
||||||
name={zone.name}
|
name={zone.name}
|
||||||
description={`
|
ref={(ref: any) => bindWwvEntity(ref, geoEntity)}
|
||||||
<table class="cesium-infoBox-defaultTable">
|
|
||||||
<tbody>
|
|
||||||
<tr><th>Overview</th><td>${zone.description}</td></tr>
|
|
||||||
<tr><th>Type</th><td>${zone.subtext || "N/A"}</td></tr>
|
|
||||||
<tr><th>Status</th><td>${zone.status}</td></tr>
|
|
||||||
<tr><th>Escalation Score</th><td>${zone.escalationScore} / 5</td></tr>
|
|
||||||
<tr><th>Trend</th><td>${zone.escalationTrend}</td></tr>
|
|
||||||
<tr><th>Why It Matters</th><td>${zone.whyItMatters}</td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
`}
|
|
||||||
>
|
>
|
||||||
<EllipseGraphics
|
<EllipseGraphics
|
||||||
semiMajorAxis={radiusMeters}
|
semiMajorAxis={radiusMeters}
|
||||||
@@ -118,3 +138,4 @@ export class ConflictZonesPlugin implements WorldPlugin {
|
|||||||
return ConflictZonesRenderer;
|
return ConflictZonesRenderer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@worldwideview/wwv-plugin-international-sanctions",
|
"name": "@worldwideview/wwv-plugin-international-sanctions",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"main": "src/index.tsx",
|
"main": "src/index.tsx",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lucide-react": "^0.364.0"
|
"lucide-react": "^0.364.0"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, useMemo } from "react";
|
import React, { useEffect, useState, useMemo, useCallback } from "react";
|
||||||
import { Scale } from "lucide-react";
|
import { Scale } from "lucide-react";
|
||||||
import { Color, PolygonHierarchy, GeoJsonDataSource, JulianDate } from "cesium";
|
import { Color, PolygonHierarchy, GeoJsonDataSource, JulianDate } from "cesium";
|
||||||
import { Entity, PolygonGraphics } from "resium";
|
import { Entity, PolygonGraphics } from "resium";
|
||||||
@@ -20,6 +20,14 @@ const LEVEL_COLORS: Record<string, string> = {
|
|||||||
"high": "#ef4444", // Red
|
"high": "#ef4444", // Red
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Attach _wwvEntity to a Resium Entity ref so InteractionHandler can pick it. */
|
||||||
|
function bindWwvEntity(ref: any, geoEntity: GeoEntity): void {
|
||||||
|
const cesiumEntity = ref?.cesiumElement;
|
||||||
|
if (cesiumEntity && !cesiumEntity._wwvEntity) {
|
||||||
|
cesiumEntity._wwvEntity = geoEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class InternationalSanctionsPlugin implements WorldPlugin {
|
export class InternationalSanctionsPlugin implements WorldPlugin {
|
||||||
id = "international-sanctions";
|
id = "international-sanctions";
|
||||||
name = "International Sanctions";
|
name = "International Sanctions";
|
||||||
@@ -164,10 +172,13 @@ export class InternationalSanctionsPlugin implements WorldPlugin {
|
|||||||
|
|
||||||
const elements = useMemo(() => {
|
const elements = useMemo(() => {
|
||||||
if (!enabled || Object.keys(countryPolygons).length === 0 || this.data.length === 0) return [];
|
if (!enabled || Object.keys(countryPolygons).length === 0 || this.data.length === 0) return [];
|
||||||
const results = [];
|
const results: Array<{
|
||||||
|
id: string; name: string; geoEntity: GeoEntity;
|
||||||
|
color: Color; outlineColor: Color; height: number;
|
||||||
|
hierarchies: PolygonHierarchy[];
|
||||||
|
}> = [];
|
||||||
for (const entity of this.data) {
|
for (const entity of this.data) {
|
||||||
const code = entity.properties.countryCode as string;
|
const code = entity.properties.countryCode as string;
|
||||||
const count = entity.properties.count as number;
|
|
||||||
const level = (entity.properties.level as string) || "low";
|
const level = (entity.properties.level as string) || "low";
|
||||||
const hexStr = LEVEL_COLORS[level] || LEVEL_COLORS["low"];
|
const hexStr = LEVEL_COLORS[level] || LEVEL_COLORS["low"];
|
||||||
const color = Color.fromCssColorString(hexStr).withAlpha(0.65);
|
const color = Color.fromCssColorString(hexStr).withAlpha(0.65);
|
||||||
@@ -180,13 +191,7 @@ export class InternationalSanctionsPlugin implements WorldPlugin {
|
|||||||
results.push({
|
results.push({
|
||||||
id: entity.id,
|
id: entity.id,
|
||||||
name: `Sanctioned Country: ${code}`,
|
name: `Sanctioned Country: ${code}`,
|
||||||
description: `
|
geoEntity: entity,
|
||||||
<div class="p-3">
|
|
||||||
<div class="mb-2"><span class="font-semibold text-gray-300">Target Area:</span> ${code}</div>
|
|
||||||
<div class="mb-2"><span class="font-semibold text-gray-300">Level:</span> <span style="color: ${hexStr}">${level.toUpperCase()}</span></div>
|
|
||||||
<div class="mb-2"><span class="font-semibold text-gray-300">Active OFAC Sanctions:</span> ${count}</div>
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
color,
|
color,
|
||||||
outlineColor,
|
outlineColor,
|
||||||
height,
|
height,
|
||||||
@@ -205,7 +210,7 @@ export class InternationalSanctionsPlugin implements WorldPlugin {
|
|||||||
<Entity
|
<Entity
|
||||||
key={`${rc.id}-${idx}`}
|
key={`${rc.id}-${idx}`}
|
||||||
name={rc.name}
|
name={rc.name}
|
||||||
description={rc.description}
|
ref={(ref: any) => bindWwvEntity(ref, rc.geoEntity)}
|
||||||
>
|
>
|
||||||
<PolygonGraphics
|
<PolygonGraphics
|
||||||
hierarchy={hier}
|
hierarchy={hier}
|
||||||
|
|||||||
@@ -11,6 +11,14 @@ const OFFSET_X = 16;
|
|||||||
const OFFSET_Y = 16;
|
const OFFSET_Y = 16;
|
||||||
const EDGE_PADDING = 12;
|
const EDGE_PADDING = 12;
|
||||||
|
|
||||||
|
const LEVEL_COLORS: Record<string, string> = {
|
||||||
|
low: "#facc15", medium: "#f97316", high: "#ef4444",
|
||||||
|
};
|
||||||
|
|
||||||
|
const SEVERITY_LABELS: Record<number, string> = {
|
||||||
|
5: "Critical", 4: "High", 3: "Elevated", 2: "Watchlist",
|
||||||
|
};
|
||||||
|
|
||||||
export function EntityInfoCard() {
|
export function EntityInfoCard() {
|
||||||
const hoveredEntity = useStore((s) => s.hoveredEntity);
|
const hoveredEntity = useStore((s) => s.hoveredEntity);
|
||||||
const screenPos = useStore((s) => s.hoveredScreenPosition);
|
const screenPos = useStore((s) => s.hoveredScreenPosition);
|
||||||
@@ -67,6 +75,18 @@ export function EntityInfoCard() {
|
|||||||
const casualtiesDisplay =
|
const casualtiesDisplay =
|
||||||
hoveredEntity.properties?.casualties !== undefined ? String(hoveredEntity.properties.casualties) : null;
|
hoveredEntity.properties?.casualties !== undefined ? String(hoveredEntity.properties.casualties) : null;
|
||||||
|
|
||||||
|
// Sanctions-specific fields
|
||||||
|
const sanctionLevel = hoveredEntity.properties?.level as string | undefined;
|
||||||
|
const sanctionCount = hoveredEntity.properties?.count as number | undefined;
|
||||||
|
const countryCode = hoveredEntity.properties?.countryCode as string | undefined;
|
||||||
|
const isSanctions = hoveredEntity.pluginId === "international-sanctions";
|
||||||
|
|
||||||
|
// Conflict zone-specific fields
|
||||||
|
const escalationScore = hoveredEntity.properties?.escalationScore as number | undefined;
|
||||||
|
const zoneStatus = hoveredEntity.properties?.status as string | undefined;
|
||||||
|
const escalationTrend = hoveredEntity.properties?.escalationTrend as string | undefined;
|
||||||
|
const isConflictZone = hoveredEntity.pluginId === "conflict-zones";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="entity-info-card"
|
className="entity-info-card"
|
||||||
@@ -149,6 +169,50 @@ export function EntityInfoCard() {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Sanctions-specific hover intel */}
|
||||||
|
{isSanctions && countryCode && (
|
||||||
|
<div className="entity-info-card__prop">
|
||||||
|
<span className="entity-info-card__prop-key">Country</span>
|
||||||
|
<span className="entity-info-card__prop-value">{countryCode}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isSanctions && sanctionLevel && (
|
||||||
|
<div className="entity-info-card__prop">
|
||||||
|
<span className="entity-info-card__prop-key">Severity</span>
|
||||||
|
<span className="entity-info-card__prop-value" style={{ color: LEVEL_COLORS[sanctionLevel] || "inherit" }}>
|
||||||
|
{sanctionLevel.toUpperCase()}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isSanctions && sanctionCount !== undefined && (
|
||||||
|
<div className="entity-info-card__prop">
|
||||||
|
<span className="entity-info-card__prop-key">OFAC Sanctions</span>
|
||||||
|
<span className="entity-info-card__prop-value">{sanctionCount}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Conflict zone-specific hover intel */}
|
||||||
|
{isConflictZone && escalationScore !== undefined && (
|
||||||
|
<div className="entity-info-card__prop">
|
||||||
|
<span className="entity-info-card__prop-key">Escalation</span>
|
||||||
|
<span className="entity-info-card__prop-value" style={{ color: escalationScore >= 5 ? "#991b1b" : escalationScore >= 4 ? "#ef4444" : escalationScore >= 3 ? "#f97316" : "#fbbf24" }}>
|
||||||
|
{SEVERITY_LABELS[escalationScore] || escalationScore} / 5
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isConflictZone && zoneStatus && (
|
||||||
|
<div className="entity-info-card__prop">
|
||||||
|
<span className="entity-info-card__prop-key">Status</span>
|
||||||
|
<span className="entity-info-card__prop-value">{zoneStatus}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isConflictZone && escalationTrend && (
|
||||||
|
<div className="entity-info-card__prop">
|
||||||
|
<span className="entity-info-card__prop-key">Trend</span>
|
||||||
|
<span className="entity-info-card__prop-value">{escalationTrend}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Footer hint */}
|
{/* Footer hint */}
|
||||||
@@ -156,3 +220,4 @@ export function EntityInfoCard() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user