Examples of ImmutableSegment2D


Examples of org.gbcpainter.geom.ImmutableSegment2D

    }

    final SimpleGraph<Junction, Pipe> pipeGrid = new SimpleGraph<>( new EdgeFactory<Junction, Pipe>() {
      @Override
      public E createEdge( final Junction sourceVertex, final Junction targetVertex ) {
        return factory.createEdge( new ImmutableSegment2D( sourceVertex.getPosition(), targetVertex.getPosition() ) );
      }
    } );

    final Map<Point, Junction> pointToJunction = new HashMap<>( levelMap.vertexSet().size() );
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

    }
  }

  @Test
  public void testPipeColoring() throws Exception {
    Pipe pipe = new PipeImpl( new ImmutableSegment2D( 0, 0, 0, 10 ) );

    assertFalse( pipe.isColored() );
    pipe.setColored( new Point( 0, 1 ), true );

    assertFalse( pipe.isColored() );
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

    assertFalse( junction.isColored() );
  }

  @Test
  public void pipeHitTest() throws Exception {
    Pipe pipe = new PipeImpl( new ImmutableSegment2D( 0, 0, 0, 10 ) );

    assertTrue( pipe.contains( new Point( 0, 1 ) ) );
    assertFalse( pipe.contains( new Point( 0, 0 ) ) );
    assertFalse( pipe.contains( new Point( 0, 10 ) ) );
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

                                                                                                                                                                  IllegalArgumentException {
    if ( ! pathAnimation.isStarted() ) {
      throw new IllegalArgumentException();
    }
    this.pathAnimation = pathAnimation;
    this.originalSegment = new ImmutableSegment2D( pathSegment );
    this.direction = pathAnimation.getDirection( pathSegment );
    this.coloring = coloring;
    this.pipeSegment = new Line2D.Double( mathPipeSegment.getA(), mathPipeSegment.getB() );
    makeHalfUnitLonger( this.pipeSegment, this.originalSegment, this.direction );
  }
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

  @Override
  public Segment startNewPart( @NotNull final PERPENDICULAR_DIRECTION direction ) throws IllegalStateException {
    this.checkNotStarted();

    if ( currentSegment != null ) {
      segmentsList.put( new ImmutableSegment2D( (Segment) currentSegment ), currentDirection );
      currentSegment = new MutableSegment2D( currentSegment.getXB(), currentSegment.getYB(), currentSegment.getXB(), currentSegment.getYB() );
      totalLength += currentLength;
    } else {
      currentSegment = new MutableSegment2D( 0, 0, 0, 0 );
    }
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

  @Override
  public void startAnimation( final long millisStart, final long millisEnd ) throws IllegalStateException {
    this.checkNotStarted();

    if ( this.currentSegment != null ) {
      this.segmentsList.put( new ImmutableSegment2D( (Segment) this.currentSegment ), this.currentDirection );
      this.totalLength += this.currentLength;
      this.currentSegment = null;
    } else {
      if ( this.segmentsList.isEmpty() ) {
        throw new IllegalStateException( "Empty path" );
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

  @Override
  @Nullable
  public Line2D getDoneAnimation( @NotNull Segment originalSegment ) throws IllegalArgumentException, IllegalStateException {
    this.checkStarted();
    this.checkExists( new ImmutableSegment2D( originalSegment ) );
    final long millisTime = System.currentTimeMillis();
    if ( this.isTerminated() ) {
      return originalSegment.getLine2D();
    }
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

  }

  @NotNull
  @Override
  public PERPENDICULAR_DIRECTION getDirection( @NotNull final Segment originalSegment ) throws IllegalArgumentException {
    ImmutableSegment2D immutableCopy = new ImmutableSegment2D( originalSegment );
    this.checkExists( immutableCopy );

    return this.segmentsList.get( immutableCopy );
  }
View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

    if ( isVertical( segment ) ) {
      this.vertical = true;
      if(segment.getMinY() == (segment.getMaxY()-1)) {
        this.voidPipe = true;
        this.segment = new ImmutableSegment2D( segment.getXA(), segment.getYA(),
                                               segment.getXB(), segment.getYB());
      } else {
        this.voidPipe = false;
        this.segment = new ImmutableSegment2D( segment.getXA(), segment.getMinY() + 1,
                                               segment.getXA(), segment.getMaxY() - 1 );
      }

    } else {
      this.vertical = false;
      if(segment.getMinX() == (segment.getMaxX()-1)) {
        this.voidPipe = true;
        this.segment = new ImmutableSegment2D( segment.getXA(), segment.getYA(),
                                               segment.getXB(), segment.getYB());
      } else {
        this.voidPipe = false;
        this.segment = new ImmutableSegment2D( segment.getMinX() + 1, segment.getYA(),
                                               segment.getMaxX() - 1, segment.getYA() );
      }
    }

View Full Code Here

Examples of org.gbcpainter.geom.ImmutableSegment2D

   * @return The position of the pipe
   */
  @NotNull
  @Override
  public Segment getSegment() {
    return new ImmutableSegment2D( this.segment );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.