MapProjection.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. *
  9. * @see GeographicProjection
  10. * @see WebMercatorProjection
  11. */
  12. function MapProjection() {
  13. DeveloperError.throwInstantiationError();
  14. }
  15. Object.defineProperties(MapProjection.prototype, {
  16. /**
  17. * Gets the {@link Ellipsoid}.
  18. *
  19. * @memberof MapProjection.prototype
  20. *
  21. * @type {Ellipsoid}
  22. * @readonly
  23. */
  24. ellipsoid: {
  25. get: DeveloperError.throwInstantiationError,
  26. },
  27. });
  28. /**
  29. * Projects {@link Cartographic} coordinates, in radians, to projection-specific map coordinates, in meters.
  30. *
  31. * @memberof MapProjection
  32. * @function
  33. *
  34. * @param {Cartographic} cartographic The coordinates to project.
  35. * @param {Cartesian3} [result] An instance into which to copy the result. If this parameter is
  36. * undefined, a new instance is created and returned.
  37. * @returns {Cartesian3} The projected coordinates. If the result parameter is not undefined, the
  38. * coordinates are copied there and that instance is returned. Otherwise, a new instance is
  39. * created and returned.
  40. */
  41. MapProjection.prototype.project = DeveloperError.throwInstantiationError;
  42. /**
  43. * Unprojects projection-specific map {@link Cartesian3} coordinates, in meters, to {@link Cartographic}
  44. * coordinates, in radians.
  45. *
  46. * @memberof MapProjection
  47. * @function
  48. *
  49. * @param {Cartesian3} cartesian The Cartesian position to unproject with height (z) in meters.
  50. * @param {Cartographic} [result] An instance into which to copy the result. If this parameter is
  51. * undefined, a new instance is created and returned.
  52. * @returns {Cartographic} The unprojected coordinates. If the result parameter is not undefined, the
  53. * coordinates are copied there and that instance is returned. Otherwise, a new instance is
  54. * created and returned.
  55. */
  56. MapProjection.prototype.unproject = DeveloperError.throwInstantiationError;
  57. export default MapProjection;