PolygonHierarchy.js 840 B

12345678910111213141516171819202122232425
  1. import defined from "./defined.js";
  2. /**
  3. * An hierarchy of linear rings which define a polygon and its holes.
  4. * The holes themselves may also have holes which nest inner polygons.
  5. * @alias PolygonHierarchy
  6. * @constructor
  7. *
  8. * @param {Cartesian3[]} [positions] A linear ring defining the outer boundary of the polygon or hole.
  9. * @param {PolygonHierarchy[]} [holes] An array of polygon hierarchies defining holes in the polygon.
  10. */
  11. function PolygonHierarchy(positions, holes) {
  12. /**
  13. * A linear ring defining the outer boundary of the polygon or hole.
  14. * @type {Cartesian3[]}
  15. */
  16. this.positions = defined(positions) ? positions : [];
  17. /**
  18. * An array of polygon hierarchies defining holes in the polygon.
  19. * @type {PolygonHierarchy[]}
  20. */
  21. this.holes = defined(holes) ? holes : [];
  22. }
  23. export default PolygonHierarchy;