MultiLineString.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import Geometry from './Geometry'
  2. import Lineal from './Lineal'
  3. import GeometryCollection from './GeometryCollection'
  4. import UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException'
  5. import Dimension from './Dimension'
  6. export default class MultiLineString extends GeometryCollection {
  7. constructor() {
  8. super()
  9. MultiLineString.constructor_.apply(this, arguments)
  10. }
  11. static constructor_() {
  12. const lineStrings = arguments[0], factory = arguments[1]
  13. GeometryCollection.constructor_.call(this, lineStrings, factory)
  14. }
  15. copyInternal() {
  16. const lineStrings = new Array(this._geometries.length).fill(null)
  17. for (let i = 0; i < lineStrings.length; i++)
  18. lineStrings[i] = this._geometries[i].copy()
  19. return new MultiLineString(lineStrings, this._factory)
  20. }
  21. equalsExact() {
  22. if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {
  23. const other = arguments[0], tolerance = arguments[1]
  24. if (!this.isEquivalentClass(other))
  25. return false
  26. return super.equalsExact.call(this, other, tolerance)
  27. } else {
  28. return super.equalsExact.apply(this, arguments)
  29. }
  30. }
  31. getBoundaryDimension() {
  32. if (this.isClosed())
  33. return Dimension.FALSE
  34. return 0
  35. }
  36. isClosed() {
  37. if (this.isEmpty())
  38. return false
  39. for (let i = 0; i < this._geometries.length; i++)
  40. if (!this._geometries[i].isClosed())
  41. return false
  42. return true
  43. }
  44. getTypeCode() {
  45. return Geometry.TYPECODE_MULTILINESTRING
  46. }
  47. getDimension() {
  48. return 1
  49. }
  50. getBoundary() {
  51. throw new UnsupportedOperationException()
  52. }
  53. getGeometryType() {
  54. return Geometry.TYPENAME_MULTILINESTRING
  55. }
  56. get interfaces_() {
  57. return [Lineal]
  58. }
  59. }