Task: Implement the PointWithMeasure class in /app/
Objective:
Create a browser-global class SuperMap.REST.PointWithMeasure that matches the expected API used by the tests. The class should support a default constructor, a parameterized constructor, a destroy method, and a static fromJson method.
Requirements:
File path: /app/PointWithMeasure.js
Namespace:
Ensure a global object SuperMap exists.
Ensure SuperMap.REST exists.
Define SuperMap.REST.PointWithMeasure.
Constructor behavior:
new SuperMap.REST.PointWithMeasure() should initialize:
this.measure = null
this.x = null
this.y = null
new SuperMap.REST.PointWithMeasure({ measure, x, y }) should set:
this.measure = measure
this.x = x
this.y = y
Methods:
destroy(): sets this.measure, this.x, this.y to null.
Static method:
SuperMap.REST.PointWithMeasure.fromJson(json)
If json is null/undefined, return null.
If json is provided, return a new PointWithMeasure with properties set from json:
measure: json.measure
x: json.x
y: json.y
Behavior should align with the tests:
Default constructor yields null properties.
Parameterized constructor assigns values.
destroy nullifies properties.
fromJson() with no argument returns null.
Example usage:
var p = new SuperMap.REST.PointWithMeasure({ measure: 5, x: 10, y: 20 });
Note:
Do not modify tests. The implementation should be pure JavaScript with no external dependencies and be compatible with the existing test environment.