OSPP 2024 Project: Frontend technology based OpenStreetMap PT relation editor — Biweekly Report #2
Sett inn af OSMChina 12. ágúst 2024 á English.It’s been over two weeks since the last progress report, and it’s time to update on the current status.
Project Progress
The core modules of the project have now been largely finalized, allowing us to enter the latter stage of development. The upcoming work will mainly involve adding new features within the existing framework.
Render
Firstly, the rendering part has been set up, though there are still some details that need polishment, such as styles and elements controlling the rendering. These will be adjusted in sync with the subsequent feature development to ensure that the styling aligns with the editing logic.
API call and XML obj
I’ve developed an OSM API module that wraps some of OSM’s interfaces using Promises and parses the returned XML into a JavaScript object for easier manipulation within the program.
Editor’s status management
Following that is the editing module, which primarily includes the operation logic and global data management.
For the operation logic in map editing, I’ve introduced a state machine, which manages the current state of the editor by listening to mouse and keyboard events. The state machine, referred to as “stateMachine.js” in the code, handles state transitions and data maintenance based on the functions and state relationships provided in the state diagram. Depending on the current state, it determines which actions to trigger and the new state to transition into. The state machine provides hooks that allow other components, such as mouse events in Pixi.js, to track events. Editing operations are carried out during state transitions.