Examples of Coordinates


Examples of jsky.coords.Coordinates

        // we have world coordinages: find the bounding box of the objects in the table
        double ra0 = 0., ra1 = 0., dec0 = 0., dec1 = 0.;
        boolean firstTime = true;
        for (int row = 1; row < nrows; row++) {
            Vector rowVec = (Vector) dataVec.get(row);
            Coordinates pos = rowCoords.getCoordinates(rowVec);
            if (pos == null) {
                continue;
            }
            if (firstTime) {
                firstTime = false;
                ra0 = pos.getX();
                ra1 = ra0;
                dec0 = pos.getY();
                dec1 = dec0;
            } else {
                double ra = pos.getX(), dec = pos.getY();
                ra0 = Math.min(ra0, ra);
                ra1 = Math.max(ra1, ra);
                dec0 = Math.min(dec0, dec);
                dec1 = Math.max(dec1, dec);
            }
View Full Code Here

Examples of jsky.coords.Coordinates

                        Vector dataVec = tli.table.getDataVector();
                        _imageEquinox = _coordinateConverter.getEquinox();
                        Vector rowVec = (Vector) dataVec.get(fli.row);

                        // get the world coordinates
                        Coordinates cpos = rowCoords.getCoordinates(rowVec);
                        if (cpos == null) {
                            return null;
                        }
                        WorldCoords pos = (WorldCoords) cpos;
View Full Code Here

Examples of jsky.coords.Coordinates

     *
     * @param queryArgs (in/out) describes the query arguments
     * @param region (in) describes the query region (center and radius range)
     */
    public void setRegionArgs(QueryArgs queryArgs, CoordinateRadius region) {
        Coordinates coords = region.getCenterPosition();
        String equinoxStr = (String) queryArgs.getParamValue(EQUINOX);
        double equinox = _getEquinox(queryArgs);
        WorldCoords pos = (WorldCoords) coords;
        String[] radec = pos.format(equinox);
        queryArgs.setParamValue(RA, radec[0]);
View Full Code Here

Examples of jsky.coords.Coordinates

    private WorldCoords _resolveObjectName(String objectName, Catalog cat) throws IOException {
        QueryArgs queryArgs = new BasicQueryArgs(cat);
        queryArgs.setId(objectName);
        QueryResult r = cat.query(queryArgs);
        if (r instanceof TableQueryResult) {
            Coordinates coords = ((TableQueryResult) r).getCoordinates(0);
            if (coords instanceof WorldCoords) {
                return (WorldCoords) coords;
            }
        }
        throw new RuntimeException("Unexpected result from " + cat.toString());
View Full Code Here

Examples of jsky.science.Coordinates

            return null;
        }
    }

    public void setCoordinates(Coordinates position) {
        Coordinates old = getCoordinates();

        firePropertyChange(COORDINATES_PROPERTY, old, position);

        fOldPosition = position;
View Full Code Here

Examples of jsky.science.Coordinates

        }
    }

    public void setCoordinates(String ra, String dec) {
        try {
            Coordinates newPosition = Coordinates.valueOf(ra, dec);

            firePropertyChange(COORDINATES_PROPERTY, fOldPosition, newPosition);

            fOldPosition = newPosition;
View Full Code Here

Examples of jsky.science.Coordinates

    }

    public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand() == RA_NOTIFY
                || e.getActionCommand() == DEC_NOTIFY) {
            Coordinates newPosition = null;
            try {
                newPosition = Coordinates.valueOf(fRaField.getText(), fDecField.getText());

                firePropertyChange(COORDINATES_PROPERTY, fOldPosition, newPosition);
View Full Code Here

Examples of jsky.science.Coordinates

            setCoordinates(fOldPosition);
        }
    }

    public static void main(String[] args) {
        Coordinates offset = new Coordinates(5., 5.);
        CoordinatesPanel panel = new CoordinatesPanel();
        panel.setCoordinates(offset);
        panel.setEquinoxShown(true);
        panel.setOrientation(VERTICAL);
        JOptionPane.showConfirmDialog(null, panel);
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( 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() );
      g2.drawLine( coord1.getX(), coord1.getY(), coord3.getX(), coord3.getY() );
      g2.drawLine( coord2.getX(), coord2.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();
    Coordinates currentcoord3 = junction.getCurrentPosition().getNodeConnectorList().get( 1 ).getNode( 0 ).getCoordinates();
    Coordinates currentcoord4 = junction.getCurrentPosition().getNodeConnectorList().get( 1 ).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() );
      g2.drawLine( currentcoord3.getX(), currentcoord3.getY(), currentcoord4.getX(), currentcoord4.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() );
        g2.drawLine( currentcoord3.getX(), currentcoord3.getY(), currentcoord4.getX(), currentcoord4.getY() );
      }
    }

  }
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();
   
    // Draw both track elements
    if ( coord1 != null && coord2 != null && coord3 != 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() );
    }
   
    // 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
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.