refactor: reorganize project structure by migrating engine and geometry utilities into a structured map directory
This commit is contained in:
@@ -22,22 +22,22 @@ import {
|
|||||||
Feature,
|
Feature,
|
||||||
Geometry,
|
Geometry,
|
||||||
useEditorState,
|
useEditorState,
|
||||||
} from "@/uhm/lib/useEditorState";
|
} from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import { GEO_TYPE_KEYS, geoTypeCodeToTypeKey } from "@/uhm/lib/geoTypeMap";
|
import { GEO_TYPE_KEYS, geoTypeCodeToTypeKey } from "@/uhm/lib/map/geo/geoTypeMap";
|
||||||
import {
|
import {
|
||||||
BackgroundLayerId,
|
BackgroundLayerId,
|
||||||
BackgroundLayerVisibility,
|
BackgroundLayerVisibility,
|
||||||
DEFAULT_BACKGROUND_LAYER_VISIBILITY,
|
DEFAULT_BACKGROUND_LAYER_VISIBILITY,
|
||||||
HIDDEN_BACKGROUND_LAYER_VISIBILITY,
|
HIDDEN_BACKGROUND_LAYER_VISIBILITY,
|
||||||
} from "@/uhm/lib/backgroundLayers";
|
} from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
import {
|
import {
|
||||||
ENTITY_TYPE_OPTIONS,
|
ENTITY_TYPE_OPTIONS,
|
||||||
} from "@/uhm/lib/entityTypeOptions";
|
} from "@/uhm/lib/utils/entityTypeOptions";
|
||||||
import {
|
import {
|
||||||
EntityFormState,
|
EntityFormState,
|
||||||
GeometryMetaFormState,
|
GeometryMetaFormState,
|
||||||
useEditorSessionState,
|
useEditorSessionState,
|
||||||
} from "@/uhm/lib/useEditorSessionState";
|
} from "@/uhm/lib/editor/state/useEditorSessionState";
|
||||||
import {
|
import {
|
||||||
getDefaultTypeIdForFeature,
|
getDefaultTypeIdForFeature,
|
||||||
normalizeFeatureBindingIds,
|
normalizeFeatureBindingIds,
|
||||||
@@ -58,8 +58,8 @@ import {
|
|||||||
persistBackgroundLayerVisibility,
|
persistBackgroundLayerVisibility,
|
||||||
} from "@/uhm/lib/editor/background/backgroundVisibilityStorage";
|
} from "@/uhm/lib/editor/background/backgroundVisibilityStorage";
|
||||||
import { useSectionCommands } from "@/uhm/lib/editor/section/useSectionCommands";
|
import { useSectionCommands } from "@/uhm/lib/editor/section/useSectionCommands";
|
||||||
import { EMPTY_FEATURE_COLLECTION } from "@/uhm/lib/geo/constants";
|
import { EMPTY_FEATURE_COLLECTION } from "@/uhm/lib/map/geo/constants";
|
||||||
import { FIXED_TIMELINE_RANGE, clampYearToFixedRange } from "@/uhm/lib/timeline";
|
import { FIXED_TIMELINE_RANGE, clampYearToFixedRange } from "@/uhm/lib/utils/timeline";
|
||||||
import { useFeatureCommands } from "./featureCommands";
|
import { useFeatureCommands } from "./featureCommands";
|
||||||
import { deleteSubmission } from "@/uhm/api/sections";
|
import { deleteSubmission } from "@/uhm/api/sections";
|
||||||
import type { WikiSnapshot } from "@/uhm/types/wiki";
|
import type { WikiSnapshot } from "@/uhm/types/wiki";
|
||||||
|
|||||||
+4
-4
@@ -15,14 +15,14 @@ import {
|
|||||||
type BackgroundLayerVisibility,
|
type BackgroundLayerVisibility,
|
||||||
DEFAULT_BACKGROUND_LAYER_VISIBILITY,
|
DEFAULT_BACKGROUND_LAYER_VISIBILITY,
|
||||||
HIDDEN_BACKGROUND_LAYER_VISIBILITY,
|
HIDDEN_BACKGROUND_LAYER_VISIBILITY,
|
||||||
} from "@/uhm/lib/backgroundLayers";
|
} from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
import {
|
import {
|
||||||
loadBackgroundLayerVisibilityFromStorage,
|
loadBackgroundLayerVisibilityFromStorage,
|
||||||
persistBackgroundLayerVisibility,
|
persistBackgroundLayerVisibility,
|
||||||
} from "@/uhm/lib/editor/background/backgroundVisibilityStorage";
|
} from "@/uhm/lib/editor/background/backgroundVisibilityStorage";
|
||||||
import { EMPTY_FEATURE_COLLECTION, WORLD_BBOX } from "@/uhm/lib/geo/constants";
|
import { EMPTY_FEATURE_COLLECTION, WORLD_BBOX } from "@/uhm/lib/map/geo/constants";
|
||||||
import { GEO_TYPE_KEYS } from "@/uhm/lib/geoTypeMap";
|
import { GEO_TYPE_KEYS } from "@/uhm/lib/map/geo/geoTypeMap";
|
||||||
import { clampYearToFixedRange, TIMELINE_DEBOUNCE_MS } from "@/uhm/lib/timeline";
|
import { clampYearToFixedRange, TIMELINE_DEBOUNCE_MS } from "@/uhm/lib/utils/timeline";
|
||||||
import type { FeatureCollection } from "@/uhm/types/geo";
|
import type { FeatureCollection } from "@/uhm/types/geo";
|
||||||
|
|
||||||
const CURRENT_YEAR = new Date().getUTCFullYear();
|
const CURRENT_YEAR = new Date().getUTCFullYear();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import "yet-another-react-lightbox/styles.css";
|
|||||||
import "yet-another-react-lightbox/plugins/captions.css";
|
import "yet-another-react-lightbox/plugins/captions.css";
|
||||||
import { createHistorianCV } from "@/service/historianService";
|
import { createHistorianCV } from "@/service/historianService";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { newId } from "@/uhm/lib/id";
|
import { newId } from "@/uhm/lib/utils/id";
|
||||||
import Swal from "sweetalert2";
|
import Swal from "sweetalert2";
|
||||||
import { PresignedUrlResponse } from "@/interface/media";
|
import { PresignedUrlResponse } from "@/interface/media";
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from "@fullcalendar/core";
|
} from "@fullcalendar/core";
|
||||||
import { useModal } from "@/hooks/useModal";
|
import { useModal } from "@/hooks/useModal";
|
||||||
import { Modal } from "@/components/ui/modal";
|
import { Modal } from "@/components/ui/modal";
|
||||||
import { newId } from "@/uhm/lib/id";
|
import { newId } from "@/uhm/lib/utils/id";
|
||||||
|
|
||||||
interface CalendarEvent extends EventInput {
|
interface CalendarEvent extends EventInput {
|
||||||
extendedProps: {
|
extendedProps: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { API_ENDPOINTS } from "@/uhm/api/config";
|
|||||||
import { requestJson } from "@/uhm/api/http";
|
import { requestJson } from "@/uhm/api/http";
|
||||||
import type { GeometriesBBoxQuery } from "@/uhm/types/api";
|
import type { GeometriesBBoxQuery } from "@/uhm/types/api";
|
||||||
import type { Feature, FeatureCollection, FeatureProperties, Geometry } from "@/uhm/types/geo";
|
import type { Feature, FeatureCollection, FeatureProperties, Geometry } from "@/uhm/types/geo";
|
||||||
import { geoTypeCodeToTypeKey } from "@/uhm/lib/geoTypeMap";
|
import { geoTypeCodeToTypeKey } from "@/uhm/lib/map/geo/geoTypeMap";
|
||||||
|
|
||||||
export type { GeometriesBBoxQuery } from "@/uhm/types/api";
|
export type { GeometriesBBoxQuery } from "@/uhm/types/api";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import type { UndoAction } from "@/uhm/lib/useEditorState";
|
import type { UndoAction } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import type { EditorMode } from "@/uhm/lib/editor/session/sessionTypes";
|
import type { EditorMode } from "@/uhm/lib/editor/session/sessionTypes";
|
||||||
|
|
||||||
import { ProjectPanel } from "./editor/ProjectPanel";
|
import { ProjectPanel } from "./editor/ProjectPanel";
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
import { type CSSProperties, useEffect, useRef } from "react";
|
import { type CSSProperties, useEffect, useRef } from "react";
|
||||||
import "maplibre-gl/dist/maplibre-gl.css";
|
import "maplibre-gl/dist/maplibre-gl.css";
|
||||||
|
|
||||||
import { Feature, FeatureCollection, Geometry } from "@/uhm/lib/useEditorState";
|
import { Feature, FeatureCollection, Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import { BackgroundLayerVisibility } from "@/uhm/lib/backgroundLayers";
|
import { BackgroundLayerVisibility } from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
import type { EditorMode } from "@/uhm/lib/editor/session/sessionTypes";
|
import type { EditorMode } from "@/uhm/lib/editor/session/sessionTypes";
|
||||||
|
|
||||||
import { useMapInstance } from "./map/useMapInstance";
|
import { useMapInstance } from "./map/useMapInstance";
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import {
|
|||||||
BACKGROUND_LAYER_OPTIONS,
|
BACKGROUND_LAYER_OPTIONS,
|
||||||
BackgroundLayerId,
|
BackgroundLayerId,
|
||||||
BackgroundLayerVisibility,
|
BackgroundLayerVisibility,
|
||||||
} from "@/uhm/lib/backgroundLayers";
|
} from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
import { GEO_TYPE_KEYS } from "@/uhm/lib/geoTypeMap";
|
import { GEO_TYPE_KEYS } from "@/uhm/lib/map/geo/geoTypeMap";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
visibility: BackgroundLayerVisibility;
|
visibility: BackgroundLayerVisibility;
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
import { type CSSProperties, useMemo, useState } from "react";
|
import { type CSSProperties, useMemo, useState } from "react";
|
||||||
import { Entity } from "@/uhm/api/entities";
|
import { Entity } from "@/uhm/api/entities";
|
||||||
import { Feature } from "@/uhm/lib/useEditorState";
|
import { Feature } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import {
|
import {
|
||||||
EntityGeometryPreset,
|
EntityGeometryPreset,
|
||||||
EntityTypeGroupId,
|
EntityTypeGroupId,
|
||||||
EntityTypeOption,
|
EntityTypeOption,
|
||||||
findEntityTypeOption,
|
findEntityTypeOption,
|
||||||
groupEntityTypeOptions,
|
groupEntityTypeOptions,
|
||||||
} from "@/uhm/lib/entityTypeOptions";
|
} from "@/uhm/lib/utils/entityTypeOptions";
|
||||||
import type { GeometryMetaFormState } from "@/uhm/lib/editor/session/sessionTypes";
|
import type { GeometryMetaFormState } from "@/uhm/lib/editor/session/sessionTypes";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { UndoAction } from "@/uhm/lib/useEditorState";
|
import type { UndoAction } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import { Panel } from "./Panel";
|
import { Panel } from "./Panel";
|
||||||
|
|
||||||
type UndoListPanelProps = {
|
type UndoListPanelProps = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { BACKGROUND_LAYER_OPTIONS, BackgroundLayerVisibility } from "@/uhm/lib/backgroundLayers";
|
import { BACKGROUND_LAYER_OPTIONS, BackgroundLayerVisibility } from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
import { Feature, FeatureCollection, Geometry } from "@/uhm/lib/useEditorState";
|
import { Feature, FeatureCollection, Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import {
|
import {
|
||||||
DEFAULT_POINT_ICON_ID,
|
DEFAULT_POINT_ICON_ID,
|
||||||
FEATURE_STATE_SOURCE_IDS,
|
FEATURE_STATE_SOURCE_IDS,
|
||||||
@@ -10,9 +10,9 @@ import {
|
|||||||
RASTER_BASE_LAYER_ID,
|
RASTER_BASE_LAYER_ID,
|
||||||
RASTER_BASE_SOURCE_ID,
|
RASTER_BASE_SOURCE_ID,
|
||||||
} from "@/uhm/lib/map/constants";
|
} from "@/uhm/lib/map/constants";
|
||||||
import { PATH_RENDER_BY_TYPE } from "@/uhm/lib/map/style";
|
import { PATH_RENDER_BY_TYPE } from "@/uhm/lib/map/styles/style";
|
||||||
import { getRasterTileTemplateUrl } from "@/uhm/api/tiles";
|
import { getRasterTileTemplateUrl } from "@/uhm/api/tiles";
|
||||||
import { newId } from "@/uhm/lib/id";
|
import { newId } from "@/uhm/lib/utils/id";
|
||||||
|
|
||||||
export function applyBackgroundLayerVisibility(
|
export function applyBackgroundLayerVisibility(
|
||||||
map: maplibregl.Map,
|
map: maplibregl.Map,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { initDrawing } from "@/uhm/lib/engine/drawingEngine";
|
import { initDrawing } from "@/uhm/lib/map/engines/drawingEngine";
|
||||||
import { initSelect } from "@/uhm/lib/engine/selectingEngine";
|
import { initSelect } from "@/uhm/lib/map/engines/selectingEngine";
|
||||||
import { initPoint } from "@/uhm/lib/engine/pointEngine";
|
import { initPoint } from "@/uhm/lib/map/engines/pointEngine";
|
||||||
import { initLine } from "@/uhm/lib/engine/lineEngine";
|
import { initLine } from "@/uhm/lib/map/engines/lineEngine";
|
||||||
import { initPath } from "@/uhm/lib/engine/pathEngine";
|
import { initPath } from "@/uhm/lib/map/engines/pathEngine";
|
||||||
import { initCircle } from "@/uhm/lib/engine/circleEngine";
|
import { initCircle } from "@/uhm/lib/map/engines/circleEngine";
|
||||||
import { createEditingEngine } from "@/uhm/lib/engine/editingEngine";
|
import { createEditingEngine } from "@/uhm/lib/map/engines/editingEngine";
|
||||||
import { Feature, FeatureCollection, Geometry } from "@/uhm/lib/useEditorState";
|
import { Feature, FeatureCollection, Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import { EditorMode } from "@/uhm/lib/editor/session/sessionTypes";
|
import { EditorMode } from "@/uhm/lib/editor/session/sessionTypes";
|
||||||
import { buildClientFeatureId, getSelectableLayers } from "./mapUtils";
|
import { buildClientFeatureId, getSelectableLayers } from "./mapUtils";
|
||||||
import { MapHoverPayload } from "../Map";
|
import { MapHoverPayload } from "../Map";
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
POLYGON_FILL_BY_TYPE,
|
POLYGON_FILL_BY_TYPE,
|
||||||
POLYGON_OPACITY_BY_TYPE,
|
POLYGON_OPACITY_BY_TYPE,
|
||||||
POLYGON_STROKE_BY_TYPE,
|
POLYGON_STROKE_BY_TYPE,
|
||||||
} from "@/uhm/lib/map/style";
|
} from "@/uhm/lib/map/styles/style";
|
||||||
import { EMPTY_FEATURE_COLLECTION } from "@/uhm/lib/geo/constants";
|
import { EMPTY_FEATURE_COLLECTION } from "@/uhm/lib/map/geo/constants";
|
||||||
import { PATH_ARROW_ICON_ID, PATH_ARROW_SOURCE_ID } from "@/uhm/lib/map/constants";
|
import { PATH_ARROW_ICON_ID, PATH_ARROW_SOURCE_ID } from "@/uhm/lib/map/constants";
|
||||||
import {
|
import {
|
||||||
addPointSymbolLayer,
|
addPointSymbolLayer,
|
||||||
@@ -17,8 +17,8 @@ import {
|
|||||||
buildTypeMatchExpression,
|
buildTypeMatchExpression,
|
||||||
ensurePathArrowIcon,
|
ensurePathArrowIcon,
|
||||||
} from "./mapUtils";
|
} from "./mapUtils";
|
||||||
import { BackgroundLayerVisibility } from "@/uhm/lib/backgroundLayers";
|
import { BackgroundLayerVisibility } from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
import { FeatureCollection } from "@/uhm/lib/useEditorState";
|
import { FeatureCollection } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
|
|
||||||
export function getBaseMapStyle(): maplibregl.StyleSpecification {
|
export function getBaseMapStyle(): maplibregl.StyleSpecification {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useCallback, useEffect, useRef } from "react";
|
import { useCallback, useEffect, useRef } from "react";
|
||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { FeatureCollection } from "@/uhm/lib/useEditorState";
|
import { FeatureCollection } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import { BackgroundLayerVisibility } from "@/uhm/lib/backgroundLayers";
|
import { BackgroundLayerVisibility } from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
import { EMPTY_FEATURE_COLLECTION } from "@/uhm/lib/geo/constants";
|
import { EMPTY_FEATURE_COLLECTION } from "@/uhm/lib/map/geo/constants";
|
||||||
import { FEATURE_STATE_SOURCE_IDS, PATH_ARROW_SOURCE_ID } from "@/uhm/lib/map/constants";
|
import { FEATURE_STATE_SOURCE_IDS, PATH_ARROW_SOURCE_ID } from "@/uhm/lib/map/constants";
|
||||||
import {
|
import {
|
||||||
applyBackgroundLayerVisibility,
|
applyBackgroundLayerVisibility,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { FIXED_TIMELINE_END_YEAR, FIXED_TIMELINE_START_YEAR, clampYearValue } from "@/uhm/lib/timeline";
|
import { FIXED_TIMELINE_END_YEAR, FIXED_TIMELINE_START_YEAR, clampYearValue } from "@/uhm/lib/utils/timeline";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
year: number;
|
year: number;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Button from "@/components/ui/button/Button";
|
|||||||
import Label from "@/components/form/Label";
|
import Label from "@/components/form/Label";
|
||||||
|
|
||||||
import type { WikiSnapshot } from "@/uhm/types/wiki";
|
import type { WikiSnapshot } from "@/uhm/types/wiki";
|
||||||
import { newId } from "@/uhm/lib/id";
|
import { newId } from "@/uhm/lib/utils/id";
|
||||||
import type ReactQuill from "react-quill-new";
|
import type ReactQuill from "react-quill-new";
|
||||||
import { checkWikiSlugExists, fetchWikiBySlug, searchWikisByTitle, type Wiki } from "@/uhm/api/wikis";
|
import { checkWikiSlugExists, fetchWikiBySlug, searchWikisByTitle, type Wiki } from "@/uhm/api/wikis";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
BACKGROUND_LAYER_OPTIONS,
|
BACKGROUND_LAYER_OPTIONS,
|
||||||
BackgroundLayerVisibility,
|
BackgroundLayerVisibility,
|
||||||
DEFAULT_BACKGROUND_LAYER_VISIBILITY,
|
DEFAULT_BACKGROUND_LAYER_VISIBILITY,
|
||||||
} from "@/uhm/lib/backgroundLayers";
|
} from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
|
|
||||||
const BACKGROUND_LAYER_VISIBILITY_STORAGE_KEY = "uhm.backgroundLayerVisibility.v1";
|
const BACKGROUND_LAYER_VISIBILITY_STORAGE_KEY = "uhm.backgroundLayerVisibility.v1";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { Entity } from "@/uhm/types/entities";
|
import type { Entity } from "@/uhm/types/entities";
|
||||||
import type { Feature, FeatureProperties } from "@/uhm/types/geo";
|
import type { Feature, FeatureProperties } from "@/uhm/types/geo";
|
||||||
import { normalizeFeatureEntityIds } from "@/uhm/lib/editor/snapshot/editorSnapshot";
|
import { normalizeFeatureEntityIds } from "@/uhm/lib/editor/snapshot/editorSnapshot";
|
||||||
import { newId } from "@/uhm/lib/id";
|
import { newId } from "@/uhm/lib/utils/id";
|
||||||
|
|
||||||
export function mergeEntitySearchResults(
|
export function mergeEntitySearchResults(
|
||||||
remoteRows: Entity[],
|
remoteRows: Entity[],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { EntityGeometryPreset } from "@/uhm/lib/entityTypeOptions";
|
import type { EntityGeometryPreset } from "@/uhm/lib/utils/entityTypeOptions";
|
||||||
|
|
||||||
export type EditorMode =
|
export type EditorMode =
|
||||||
| "idle"
|
| "idle"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useState } from "react";
|
|||||||
import {
|
import {
|
||||||
BackgroundLayerVisibility,
|
BackgroundLayerVisibility,
|
||||||
HIDDEN_BACKGROUND_LAYER_VISIBILITY,
|
HIDDEN_BACKGROUND_LAYER_VISIBILITY,
|
||||||
} from "@/uhm/lib/backgroundLayers";
|
} from "@/uhm/lib/map/styles/backgroundLayers";
|
||||||
|
|
||||||
export function useBackgroundSessionState() {
|
export function useBackgroundSessionState() {
|
||||||
// Trạng thái bật/tắt layer nền (khởi tạo default hidden; sẽ load từ storage ở page).
|
// Trạng thái bật/tắt layer nền (khởi tạo default hidden; sẽ load từ storage ở page).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import type { TimelineRange } from "@/uhm/lib/editor/session/sessionTypes";
|
import type { TimelineRange } from "@/uhm/lib/editor/session/sessionTypes";
|
||||||
import { clampYearValue } from "@/uhm/lib/timeline";
|
import { clampYearValue } from "@/uhm/lib/utils/timeline";
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
currentYear: number;
|
currentYear: number;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DEFAULT_ENTITY_TYPE_ID } from "@/uhm/lib/entityTypeOptions";
|
import { DEFAULT_ENTITY_TYPE_ID } from "@/uhm/lib/utils/entityTypeOptions";
|
||||||
import { geoTypeCodeToTypeKey, typeKeyToGeoTypeCode } from "@/uhm/lib/geoTypeMap";
|
import { geoTypeCodeToTypeKey, typeKeyToGeoTypeCode } from "@/uhm/lib/map/geo/geoTypeMap";
|
||||||
import type { Change } from "@/uhm/lib/editor/draft/editorTypes";
|
import type { Change } from "@/uhm/lib/editor/draft/editorTypes";
|
||||||
import type { EntitySnapshot } from "@/uhm/types/entities";
|
import type { EntitySnapshot } from "@/uhm/types/entities";
|
||||||
import type { EntitySnapshotOperation } from "@/uhm/types/entities";
|
import type { EntitySnapshotOperation } from "@/uhm/types/entities";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { Geometry } from "@/uhm/lib/useEditorState";
|
import { Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import type { ModeGetter } from "@/uhm/lib/engine/engineTypes";
|
import type { ModeGetter } from "@/uhm/lib/map/engines/engineTypes";
|
||||||
|
|
||||||
const EARTH_RADIUS_METERS = 6371008.8;
|
const EARTH_RADIUS_METERS = 6371008.8;
|
||||||
const CIRCLE_SEGMENTS = 72;
|
const CIRCLE_SEGMENTS = 72;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { Geometry } from "@/uhm/lib/useEditorState";
|
import { Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import type { ModeGetter } from "@/uhm/lib/engine/engineTypes";
|
import type { ModeGetter } from "@/uhm/lib/map/engines/engineTypes";
|
||||||
import { snapToNearestGeometry } from "@/uhm/lib/engine/snapUtils";
|
import { snapToNearestGeometry } from "@/uhm/lib/map/engines/snapUtils";
|
||||||
|
|
||||||
// Khởi tạo engine vẽ polygon tự do theo chuỗi click.
|
// Khởi tạo engine vẽ polygon tự do theo chuỗi click.
|
||||||
export function initDrawing(
|
export function initDrawing(
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { Geometry } from "@/uhm/lib/useEditorState";
|
import { Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
|
|
||||||
export type EditingHandle = {
|
export type EditingHandle = {
|
||||||
id: string | number;
|
id: string | number;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { Geometry } from "@/uhm/lib/useEditorState";
|
import { Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import type { ModeGetter } from "@/uhm/lib/engine/engineTypes";
|
import type { ModeGetter } from "@/uhm/lib/map/engines/engineTypes";
|
||||||
|
|
||||||
const EMPTY_PREVIEW: GeoJSON.FeatureCollection = {
|
const EMPTY_PREVIEW: GeoJSON.FeatureCollection = {
|
||||||
type: "FeatureCollection",
|
type: "FeatureCollection",
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { Geometry } from "@/uhm/lib/useEditorState";
|
import { Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import type { ModeGetter } from "@/uhm/lib/engine/engineTypes";
|
import type { ModeGetter } from "@/uhm/lib/map/engines/engineTypes";
|
||||||
|
|
||||||
const EMPTY_PREVIEW: GeoJSON.FeatureCollection = {
|
const EMPTY_PREVIEW: GeoJSON.FeatureCollection = {
|
||||||
type: "FeatureCollection",
|
type: "FeatureCollection",
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import { Geometry } from "@/uhm/lib/useEditorState";
|
import { Geometry } from "@/uhm/lib/editor/state/useEditorState";
|
||||||
import type { ModeGetter } from "@/uhm/lib/engine/engineTypes";
|
import type { ModeGetter } from "@/uhm/lib/map/engines/engineTypes";
|
||||||
|
|
||||||
// Khởi tạo engine thêm point bằng click đơn.
|
// Khởi tạo engine thêm point bằng click đơn.
|
||||||
export function initPoint(
|
export function initPoint(
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import maplibregl from "maplibre-gl";
|
import maplibregl from "maplibre-gl";
|
||||||
import type { ModeGetter } from "@/uhm/lib/engine/engineTypes";
|
import type { ModeGetter } from "@/uhm/lib/map/engines/engineTypes";
|
||||||
|
|
||||||
// Khởi tạo engine chọn feature và context menu edit/delete.
|
// Khởi tạo engine chọn feature và context menu edit/delete.
|
||||||
export function initSelect(
|
export function initSelect(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import rows from "@/uhm/lib/geoTypeMap.json";
|
import rows from "@/uhm/lib/map/geo/geoTypeMap.json";
|
||||||
|
|
||||||
export type GeoTypeMapRow = {
|
export type GeoTypeMapRow = {
|
||||||
type_key: string;
|
type_key: string;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { EntityGeometryPreset } from "@/uhm/lib/entityTypeOptions";
|
import type { EntityGeometryPreset } from "@/uhm/lib/utils/entityTypeOptions";
|
||||||
|
|
||||||
export type Geometry =
|
export type Geometry =
|
||||||
| { type: "Point"; coordinates: [number, number] }
|
| { type: "Point"; coordinates: [number, number] }
|
||||||
|
|||||||
Reference in New Issue
Block a user