LineMergeDirectedEdge.js 853 B

12345678910111213141516171819202122
  1. import DirectedEdge from '../../planargraph/DirectedEdge'
  2. import Assert from '../../util/Assert'
  3. export default class LineMergeDirectedEdge extends DirectedEdge {
  4. constructor() {
  5. super()
  6. LineMergeDirectedEdge.constructor_.apply(this, arguments)
  7. }
  8. static constructor_() {
  9. const from = arguments[0], to = arguments[1], directionPt = arguments[2], edgeDirection = arguments[3]
  10. DirectedEdge.constructor_.call(this, from, to, directionPt, edgeDirection)
  11. }
  12. getNext() {
  13. if (this.getToNode().getDegree() !== 2)
  14. return null
  15. if (this.getToNode().getOutEdges().getEdges().get(0) === this.getSym())
  16. return this.getToNode().getOutEdges().getEdges().get(1)
  17. Assert.isTrue(this.getToNode().getOutEdges().getEdges().get(1) === this.getSym())
  18. return this.getToNode().getOutEdges().getEdges().get(0)
  19. }
  20. }