Skip to content

feat: support nested map source categories - #12

Open
LonghiTW wants to merge 3 commits into
BuildTheEarth:mainfrom
LonghiTW:feature/nested-map-source-categories
Open

feat: support nested map source categories#12
LonghiTW wants to merge 3 commits into
BuildTheEarth:mainfrom
LonghiTW:feature/nested-map-source-categories

Conversation

@LonghiTW

Copy link
Copy Markdown

Add support for multi-level category hierarchy in map source selection, enabling city-level subcategories under countries (e.g. Taiwan > Taipei).

  • Add subcategories field to Category class with recursive forEach
  • Update CategoryMap to use String[] path for get/set/forEach operations
  • Update CategoryMap deserializer/serializer for recursive JSON/YAML
  • Update CategoryMapMergeStrategy to work with category paths
  • Add getMapServiceCategoryPath/setMapServiceCategoryPath to config
  • Update MapRenderingOptionsSidebar to use category path selection
  • Update loaders (LoaderRegistry, TileMapServiceStateLoader, TileMapServiceLoader) for path-based access
  • Move Taipei map entries under Taiwan -> Taipei subcategory in default_maps.yml

Add support for multi-level category hierarchy in map source selection,
enabling city-level subcategories under countries (e.g. Taiwan > Taipei).

- Add subcategories field to Category class with recursive forEach
- Update CategoryMap to use String[] path for get/set/forEach operations
- Update CategoryMap deserializer/serializer for recursive JSON/YAML
- Update CategoryMapMergeStrategy to work with category paths
- Add getMapServiceCategoryPath/setMapServiceCategoryPath to config
- Update MapRenderingOptionsSidebar to use category path selection
- Update loaders (LoaderRegistry, TileMapServiceStateLoader, TileMapServiceLoader) for path-based access
- Move Taipei map entries under Taiwan -> Taipei subcategory in default_maps.yml
@Zoriot
Zoriot requested a review from Amrsatrio July 28, 2026 17:30
@Amrsatrio

Amrsatrio commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator
image

Works, but I have some notes.

Props for being not vibe-coded like what I've been seeing recently in the projects I maintain. 🎉

@Amrsatrio Amrsatrio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The new subcategory is better named in English.
  2. The subcategory when opened for the first time results in a 1-second hitch.
  3. No logo for the subcategory items even though specified in the yml. (Not really important, cosmetic only)

Otherwise, looks good.

projection: webmercator
max_thread: 2
default_zoom: 21
臺北:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be named in English, I think.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, so everyone can understand

if (isLeafNode(childNode)) {
category.put(key, ctxt.readTreeAsValue(childNode, this.valueType));
} else {
category.getSubcategories().put(key, deserializeCategory(childNode, ctxt));

@Amrsatrio Amrsatrio Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Add max recursion depth like 3 or 4 depending on how deep this should realistically support. Because without it, it feels like code smell. Same for the serializer.

@Amrsatrio

Copy link
Copy Markdown
Collaborator

Commits must have verified signatures.

Please enable commit signing for future commits as that's a requirement in here.

Add support for multi-level category hierarchy in map source selection,
enabling city-level subcategories under countries (e.g. Taiwan > Taipei).

- Add subcategories field to Category class with recursive forEach
- Update CategoryMap to use String[] path for get/set/forEach operations
- Update CategoryMap deserializer/serializer for recursive JSON/YAML
- Update CategoryMapMergeStrategy to work with category paths
- Add getMapServiceCategoryPath/setMapServiceCategoryPath to config
- Update MapRenderingOptionsSidebar to use category path selection
- Update loaders (LoaderRegistry, TileMapServiceStateLoader, TileMapServiceLoader) for path-based access
- Move Taipei map entries under Taiwan -> Taipei subcategory in default_maps.yml
@LonghiTW

LonghiTW commented Aug 5, 2026

Copy link
Copy Markdown
Author

Thanks for the review! I've addressed the feedback and pushed a new signed commit.

Changes in the latest update:

  1. Renamed the Taiwan subcategory from 臺北 to Taipei.
  2. Added height caching to McFXDropdown to avoid repeated recursive height calculations when rendering nested categories, which should address the initial hitch when opening a subcategory.
  3. Investigated the missing logo issue. The icon URLs are still present in the map source entries, and nested item lookup resolves through CategoryMap.getItem([Taiwan, Taipei], id). I wasn't able to identify the cause yet, so I haven't made any changes for this in the current update.
  4. Added a maximum recursion depth of 4 to both CategoryMapSerializer and CategoryMapDeserializer.

Commit signing has also been enabled using SSH signing, and the latest pushed commit is signed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants