Skip to content

Add programmatic creation support for MSDL Environment elements#104

Merged
kjellmf merged 7 commits intomainfrom
copilot/fix-8e99571e-3420-461e-8470-31f0a283b54b
Oct 6, 2025
Merged

Add programmatic creation support for MSDL Environment elements#104
kjellmf merged 7 commits intomainfrom
copilot/fix-8e99571e-3420-461e-8470-31f0a283b54b

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 4, 2025

Add support for MSDL Environment element ✅

Completed Implementation:

  • ScenarioTime support (parsing, getter, setter)
  • AreaOfInterest support (parsing, getter, setter)
  • Environment.create() factory method
  • RectangleArea.create() factory method
  • Comprehensive test coverage (16 tests total)
  • All 419 tests passing
  • Code formatted and CI checks passing
  • Changeset file added for release preparation

Changes Made:

Environment Class (src/lib/environment.ts)

  1. Added Environment.create(): Static factory method for creating new Environment elements programmatically
  2. Added areaOfInterest getter: Lazy-loading getter with caching for AreaOfInterest
  3. Added areaOfInterest setter: Allows setting/removing AreaOfInterest with proper XML element management
  4. Made areaOfInterest a private field: Changed to #areaOfInterest following existing pattern

RectangleArea Class (src/lib/environment.ts)

  1. Added RectangleArea.create(): Static factory method that properly clones coordinates with correct tag names ("UpperRight" and "LowerLeft")

Tests (src/test/environment.test.ts)

Added 7 comprehensive tests:

  • Environment creation from scratch
  • Setting scenarioTime programmatically
  • Setting areaOfInterest programmatically
  • Removing areaOfInterest programmatically
  • RectangleArea creation with coordinates
  • Setting name on created RectangleArea
  • Bounding box computation for created RectangleArea

Changeset (.changeset/environment-creation-support.md)

  • Added changeset file for minor version bump
  • Documents the new programmatic creation capabilities

Usage Example:

import { Environment, RectangleArea, MsdlCoordinates } from '@orbat-mapper/msdllib';

// Create new Environment
const env = Environment.create();
env.scenarioTime = "2025-12-31T23:59:59Z";

// Create area of interest
const upperRight = MsdlCoordinates.createGDCLocation([10, 20, 0]);
const lowerLeft = MsdlCoordinates.createGDCLocation([5, 15, 0]);
const area = RectangleArea.create(upperRight, lowerLeft);
area.name = "Test Area";

env.areaOfInterest = area;

Code Quality:

  • ✅ All 419 tests passing
  • ✅ Code formatted with Prettier
  • ✅ Follows existing codebase patterns
  • ✅ Minimal changes (~80 lines added)
  • ✅ CI checks passing
  • ✅ Ready for release with changeset file
Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for MSDL Environment element</issue_title>
<issue_description>Limit support to:

  • ScenarioTime
  • AreaOfInterest

</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #28

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 4, 2025

🦋 Changeset detected

Latest commit: daa409d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@orbat-mapper/msdllib Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI and others added 2 commits October 4, 2025 11:14
Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
… tests

Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for MSDL Environment element Add programmatic creation support for MSDL Environment elements Oct 4, 2025
Copilot AI requested a review from kjellmf October 4, 2025 11:25
Copy link
Copy Markdown
Collaborator

@kjellmf kjellmf left a comment

Choose a reason for hiding this comment

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

@copilot Add a changeset file to update the changelog and prepare for release.

@kjellmf kjellmf removed their assignment Oct 5, 2025
@kjellmf kjellmf marked this pull request as ready for review October 5, 2025 05:13
@kjellmf kjellmf marked this pull request as draft October 5, 2025 05:14
@kjellmf
Copy link
Copy Markdown
Collaborator

kjellmf commented Oct 5, 2025

@copilot Add changeset file

Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 5, 2025

@copilot Add changeset file

Added changeset file in commit {{ commit_hash }}. The changeset is configured as a minor version bump since this adds new public API methods (Environment.create(), RectangleArea.create(), and the areaOfInterest setter).

Copilot AI requested a review from kjellmf October 5, 2025 05:19
@kjellmf kjellmf marked this pull request as ready for review October 6, 2025 17:55
@kjellmf kjellmf merged commit fe5a9d7 into main Oct 6, 2025
1 check passed
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.

Add support for MSDL Environment element

2 participants