Singleton constructor. Returns the active instance if already set.
The toggling/activation button for this measurement state.
Required/precondition states.
States that are deactivated when this state activates.
Name/identifier for the state.
States that should be restored when this state ends.
Activates polygon measure mode, initializes a new PolygonMeasurement, cancels unfinished measurements, binds cancel/cursor/UI events, and shows info window.
Sets up the main "cancel current measurement" event handler and disables camera change notifications.
The main application instance.
The active measurement instance.
Ends polygon measure mode, finalizes/cancels measurement, updates button/UI/events, adds to measurement list if completed, and closes the info window.
Always true.
Removes the right-click event handler for this state.
Installs right-click handler to terminate measurement when user clicks the right mouse button.
Ends the measurement state: removes button event listeners, clears global measurement flag, and resets camera-change flag after 1 second.
Always true on proper termination.
PolygonMeasurementState – Manages the application UI state for interactive polygon (area) measurements in a Cesium viewer.
Implements singleton logic: only one polygon measurement state can exist at a time. Handles UI events, tool lifecycle, modal window integration, and event handler setup/teardown. Ensures clean state removal, measurement cancellation/cleanup, and adds entries to a measurement result list when finished.
Param: button
UI button for toggling/activating this measurement.
Static
instance - Singleton state instance.
Example