Examples of Coordinates


Examples of net.sf.mrailsim.shared.Coordinates

  /**
   * Draws this track into the specified graphics context.
   * @param g  The graphics context
   */
  public void draw( Graphics g ) {
    Coordinates coord1 = junction.getPosition( 0 ).getNodeConnectorList().get( 0 ).getNode( 0 ).getCoordinates();
    Coordinates coord2 = junction.getPosition( 0 ).getNodeConnectorList().get( 0 ).getNode( 1 ).getCoordinates();
    Coordinates coord3 = junction.getPosition( 0 ).getNodeConnectorList().get( 1 ).getNode( 0 ).getCoordinates();
    Coordinates coord4 = junction.getPosition( 0 ).getNodeConnectorList().get( 1 ).getNode( 1 ).getCoordinates();
   
    // Draw both track elements
    if ( coord1 != null && coord2 != null && coord3 != null && coord4 != null ) {
      Graphics2D g2 = (Graphics2D) g;

      g.setColor( Color.BLACK );
      g2.setStroke( new BasicStroke( 8 ) );

      g2.drawLine( coord1.getX(), coord1.getY(), coord2.getX(), coord2.getY() );
      g2.drawLine( coord3.getX(), coord3.getY(), coord4.getX(), coord4.getY() );
    }
  }
View Full Code Here

Examples of net.sf.mrailsim.shared.Coordinates

    int x = Integer.parseInt( matcher.group( 2 ) );
    int y = Integer.parseInt( matcher.group( 3 ) );

    Node node = getNode( id );
    if ( node != null ) {
      node.setCoordinates( new Coordinates( x, y ) );
    } else {
      // TODO: Handle better
      System.err.println( "setCoordinates(String): Node #" + id + " does not exist." );
    }
  }
View Full Code Here

Examples of net.sf.mrailsim.shared.Coordinates

  /**
   * Draws this track into the specified graphics context.
   * @param g  The graphics context
   */
  public void draw( Graphics g ) {
    Coordinates coord1 = junction.getPosition( 0 ).getNodeConnectorList().get( 0 ).getNode( 0 ).getCoordinates();
    Coordinates coord2 = junction.getPosition( 0 ).getNodeConnectorList().get( 0 ).getNode( 1 ).getCoordinates();
    Coordinates coord3 = junction.getPosition( 1 ).getNodeConnectorList().get( 0 ).getNode( 1 ).getCoordinates();
    Coordinates coord4 = junction.getPosition( 2 ).getNodeConnectorList().get( 0 ).getNode( 1 ).getCoordinates();
   
    // Draw both track elements
    if ( coord1 != null && coord2 != null && coord3 != null && coord4 != null ) {
      Graphics2D g2 = (Graphics2D) g;

      g.setColor( Color.BLACK );
      g2.setStroke( new BasicStroke( 8 ) );

      g2.drawLine( coord1.getX(), coord1.getY(), coord2.getX(), coord2.getY() );
      g2.drawLine( coord1.getX(), coord1.getY(), coord3.getX(), coord3.getY() );
      g2.drawLine( coord1.getX(), coord1.getY(), coord4.getX(), coord4.getY() );
    }
   
    // Draw current position
    Coordinates currentcoord1 = junction.getCurrentPosition().getNodeConnectorList().get( 0 ).getNode( 0 ).getCoordinates();
    Coordinates currentcoord2 = junction.getCurrentPosition().getNodeConnectorList().get( 0 ).getNode( 1 ).getCoordinates();

    if ( currentcoord1 != null && currentcoord2 != null ) {
      Graphics2D g2 = (Graphics2D) g;

      float[] dashs1 = { 2.0f, 5.0f };
      g.setColor( Color.LIGHT_GRAY );
      g2.setStroke( new BasicStroke( 3.0f, BasicStroke.CAP_BUTT,
          BasicStroke.JOIN_MITER, 1.0f, dashs1, 0.0f ) );
      g2.drawLine( currentcoord1.getX(), currentcoord1.getY(), currentcoord2.getX(), currentcoord2.getY() );

      if ( isOccupied() ) {
        float[] dashs2 = { 20.0f, 15.0f };
        g.setColor( Color.RED );
        g2.setStroke( new BasicStroke( 3.0f, BasicStroke.CAP_BUTT,
            BasicStroke.JOIN_MITER, 1.0f, dashs2, 0.0f ) );
        g2.drawLine( currentcoord1.getX(), currentcoord1.getY(), currentcoord2.getX(), currentcoord2.getY() );
      }
    }

  }
View Full Code Here

Examples of net.sf.mrailsim.shared.Coordinates

  TrackStraight( long id, int length, Junction j ) {
    super( id, length, j );
  }

  public void draw( Graphics g ) {
    Coordinates coord1 = junction.getCurrentPosition().getNodeConnectorList().get( 0 ).getNode( 0 ).getCoordinates();
    Coordinates coord2 = junction.getCurrentPosition().getNodeConnectorList().get( 0 ).getNode( 1 ).getCoordinates();
   
    if ( coord1 != null && coord2 != null ) {
      Graphics2D g2 = (Graphics2D) g;
     
      g2.setColor( Color.BLACK );
      g2.setStroke( new BasicStroke( 8 ) );
      g2.drawLine( coord1.getX(), coord1.getY(), coord2.getX(), coord2.getY() );

      if ( isOccupied() ) {
        float[] dashs = { 20.0f, 15.0f };
        g.setColor( Color.RED );
        g2.setStroke( new BasicStroke( 3.0f, BasicStroke.CAP_BUTT,
            BasicStroke.JOIN_MITER, 1.0f, dashs, 0.0f ) );
        g2.drawLine( coord1.getX(), coord1.getY(), coord2.getX(), coord2.getY() );
      }
    }
  }
View Full Code Here

Examples of net.sf.mrailsim.shared.Coordinates

    int x = Integer.parseInt( matcher.group( 2 ) );
    int y = Integer.parseInt( matcher.group( 3 ) );

    Signal signal = getSignal( id );
    if ( signal != null ) {
      signal.setCoordinates( new Coordinates( x, y ) );
    } else {
      // TODO: Handle better
      System.err.println( "setSignalCoordinates(String): Signal #" + id + " does not exist." );
    }
  }
View Full Code Here

Examples of org.hibernate.search.spatial.Coordinates

  public void testSpatialQueries() {
    Transaction transaction = fullTextSession.beginTransaction();
    final QueryBuilder builder = fullTextSession.getSearchFactory()
        .buildQueryBuilder().forEntity( POI.class ).get();

    Coordinates coordinates = Point.fromDegrees( 24d, 31.5d );
    Query query = builder
        .spatial()
          .onCoordinates( "location" )
          .within( 51, Unit.KM )
            .ofCoordinates( coordinates )
View Full Code Here

Examples of org.hibernate.search.spatial.Coordinates

  double longitude;

  @Spatial
  @Embedded
  public Coordinates getLocation() {
    return new Coordinates() {
      @Override
      public Double getLatitude() {
        return latitude;
      }
View Full Code Here

Examples of org.openqa.selenium.interactions.internal.Coordinates

        // There is some bug in Selenium. Can't move window using header
        // need use footer instead.
        WebElement wnd1Footer = wnd
                .findElement(By.className("v-window-footer"));
        Point startLoc = wnd.getLocation();
        Coordinates footerCoordinates = ((Locatable) wnd1Footer)
                .getCoordinates();
        Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
        mouse.mouseDown(footerCoordinates);
        mouse.mouseMove(footerCoordinates, 200, 200);
        mouse.mouseUp(footerCoordinates);
View Full Code Here

Examples of org.openqa.selenium.interactions.internal.Coordinates

    }

    @Test
    public void tooltipsHaveQuickOpenDelay() throws InterruptedException {
        openTestURL();
        Coordinates button0Coordinates = getButtonCoordinates("Button 0");
        Coordinates button1Coordinates = getButtonCoordinates("Button 1");

        Mouse mouse = getMouse();
        mouse.mouseMove(button0Coordinates, 10, 10);
        sleep(1000);
        assertThat(getTooltipElement().getLocation().x, is(greaterThan(0)));

        mouse.mouseMove(button1Coordinates, 10, 10);
        assertThat(getTooltipElement().getLocation().x, is(lessThan(-1000)));

        sleep(1000);
        assertThat(getTooltipElement().getLocation().x,
                is(greaterThan(button1Coordinates.onPage().x)));
    }
View Full Code Here

Examples of org.openqa.selenium.interactions.internal.Coordinates

    private ButtonElement getButtonElement() {
        return $(ButtonElement.class).first();
    }

    private void moveMouseToButtonBottomRightCorner(Mouse mouse) {
        Coordinates buttonCoordinates = getButtonCoordinates();
        Dimension buttonDimensions = getButtonDimensions();

        mouse.mouseMove(buttonCoordinates, buttonDimensions.getWidth() - 1,
                buttonDimensions.getHeight() - 1);
    }
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.