マップの境界を JSON オブジェクトに保存したいと思います。コード補完のために、JSDoc を使用してオブジェクトを宣言しました。
/**
* @name MapBounds
* @class MapBounds
* This class represents a map boundary definition.
*
* @property {number} minLat Specifies the minimum latitude of the boundary.
* @property {number} minLon Specifies the minimum longitude of the boundary.
* @property {number} maxLat Specifies the maximum latitude of the boundary.
* @property {number} maxLon Specifies the maximum longitude of the boundary.
*/
MapBounds オブジェクトを作成する段階になると、私のコードは次のようになります (この例には実際の緯度/経度の値はありません)。
var newMapBounds = MapBounds( {minLat: 50, minLon: 50, maxLat: 100, maxLon: 100} );
JSON を使用してオブジェクトを指定し、必要な型にキャストしています。これを行うより良い方法はありますか?
ありがとう。