MapProjection.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import DeveloperError from "./DeveloperError.js";
  2. /**
  3. * Defines how geodetic ellipsoid coordinates ({@link Cartographic}) project to a
  4. * flat map like Cesium's 2D and Columbus View modes.
  5. *
  6. * @alias MapProjection
  7. * @constructor
  8. * @abstract
  9. *
  10. * @see GeographicProjection
  11. * @see WebMercatorProjection
  12. */
  13. function MapProjection() {
  14. DeveloperError.throwInstantiationError();
  15. }
  16. Object.defineProperties(MapProjection.prototype, {
  17. /**
  18. * Gets the {@link Ellipsoid}.
  19. *
  20. * @memberof MapProjection.prototype
  21. *
  22. * @type {Ellipsoid}
  23. * @readonly
  24. */
  25. ellipsoid: {
  26. get: DeveloperError.throwInstantiationError,
  27. },
  28. });
  29. /**
  30. * Projects {@link Cartographic} coordinates, in radians, to projection-specific map coordinates, in meters.
  31. *
  32. * @memberof MapProjection
  33. * @function
  34. *
  35. * @param {Cartographic} cartographic The coordinates to project.
  36. * @param {Cartesian3} [result] An instance into which to copy the result. If this parameter is
  37. * undefined, a new instance is created and returned.
  38. * @returns {Cartesian3} The projected coordinates. If the result parameter is not undefined, the
  39. * coordinates are copied there and that instance is returned. Otherwise, a new instance is
  40. * created and returned.
  41. */
  42. MapProjection.prototype.project = DeveloperError.throwInstantiationError;
  43. /**
  44. * Unprojects projection-specific map {@link Cartesian3} coordinates, in meters, to {@link Cartographic}
  45. * coordinates, in radians.
  46. *
  47. * @memberof MapProjection
  48. * @function
  49. *
  50. * @param {Cartesian3} cartesian The Cartesian position to unproject with height (z) in meters.
  51. * @param {Cartographic} [result] An instance into which to copy the result. If this parameter is
  52. * undefined, a new instance is created and returned.
  53. * @returns {Cartographic} The unprojected coordinates. If the result parameter is not undefined, the
  54. * coordinates are copied there and that instance is returned. Otherwise, a new instance is
  55. * created and returned.
  56. */
  57. MapProjection.prototype.unproject = DeveloperError.throwInstantiationError;
  58. export default MapProjection;