Example usage for java.awt Point getX

List of usage examples for java.awt Point getX

Introduction

In this page you can find the example usage for java.awt Point getX.

Prototype

public double getX() 

Source Link

Usage

From source file:org.jtrfp.trcl.flow.Mission.java

private int pointToHash(Point point) {
    final int key = (int) point.getX() + (int) point.getY() * 65536;
    return key;/*from  w w  w.  j  av a 2 s.  c o m*/
}

From source file:org.nekorp.workflow.desktop.servicio.reporte.orden.servicio.OrdenServicioDataFactory.java

private void generaSVGImagenDamage(ShapeView fondo, List<DamageDetailsVB> danios, File outputfile, int width,
        int height) {
    // Get a DOMImplementation.
    DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();

    // Create an instance of org.w3c.dom.Document.
    String svgNS = "http://www.w3.org/2000/svg";
    Document document = domImpl.createDocument(svgNS, "svg", null);

    // Create an instance of the SVG Generator.
    SVGGraphics2D g2 = new SVGGraphics2D(document);
    // pintar.//w  w w .java2s .  c  om
    g2.setSVGCanvasSize(new java.awt.Dimension(width, height));
    Point contexto = new Point((width - fondo.getShapeWidth()) / 2, (height - fondo.getShapeHeight()) / 2);
    g2.setColor(Color.WHITE);
    g2.fillRect(0, 0, width, height);
    AffineTransform saveXform = g2.getTransform();
    AffineTransform toCenterAt = new AffineTransform();
    toCenterAt.translate(contexto.getX(), contexto.getY());
    g2.transform(toCenterAt);
    fondo.paint(g2);
    g2.setTransform(saveXform);
    for (DamageDetailsVB x : danios) {
        DamageDetailGraphicsView obj = new DamageDetailGraphicsView();
        obj.setFontSize(esquemaFontSize);
        obj.setPosicion(new Point(x.getX(), x.getY()));
        obj.setContexto(contexto);
        if (x.getX() <= fondo.getShapeWidth() / 2) {
            if (x.getY() <= fondo.getShapeHeight() / 2) {
                obj.setOrientacion(DamageDetailGraphicsView.SuperiorIzquierda);
                //obj.setOrientacion(DamageDetailGraphicsView.SuperiorDerecha);
            } else {
                obj.setOrientacion(DamageDetailGraphicsView.InferiorIzquierda);
                //obj.setOrientacion(DamageDetailGraphicsView.InferiorDerecha);
            }
        } else {
            if (x.getY() <= fondo.getShapeHeight() / 2) {
                obj.setOrientacion(DamageDetailGraphicsView.SuperiorDerecha);
                //obj.setOrientacion(DamageDetailGraphicsView.SuperiorIzquierda);
            } else {
                obj.setOrientacion(DamageDetailGraphicsView.InferiorDerecha);
                //obj.setOrientacion(DamageDetailGraphicsView.InferiorIzquierda);
            }
        }
        obj.setCategoria(x.getCategoria());
        obj.setCaracteristica(x.getCaracteristica());
        obj.paint(g2);
    }
    try {
        g2.stream(outputfile.getCanonicalPath());
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}

From source file:net.chaosserver.timelord.swingui.Timelord.java

/**
 * Saves the current location of the applicatioFrame.
 *///from  w  w w.  j a  v a 2 s.c o  m
protected void saveFrameLocation() {
    if (applicationFrame != null) {
        Point frameLocation = applicationFrame.getLocation();

        Preferences preferences = Preferences.userNodeForPackage(this.getClass());
        preferences.putDouble(FRAME_X_LOCATION, frameLocation.getX());
        preferences.putDouble(FRAME_Y_LOCATION, frameLocation.getY());
    }
}

From source file:it.unibo.alchemist.boundary.monitors.Generic2DDisplay.java

private Shape convertObstacle(final Obstacle2D o) {
    final Rectangle2D r = o.getBounds2D();
    final Position[] points = new Position[] { new Continuous2DEuclidean(r.getX(), r.getY()),
            new Continuous2DEuclidean(r.getX() + r.getWidth(), r.getY()),
            new Continuous2DEuclidean(r.getX() + r.getWidth(), r.getY() + r.getHeight()),
            new Continuous2DEuclidean(r.getX(), r.getY() + r.getHeight()) };
    final Path2D path = new GeneralPath();
    for (int i = 0; i < points.length; i++) {
        final Point pt = wormhole.getViewPoint(points[i]);
        if (i == 0) {
            path.moveTo(pt.getX(), pt.getY());
        }/*from   w  w  w.  ja  v a 2  s.co  m*/
        path.lineTo(pt.getX(), pt.getY());
    }
    path.closePath();
    return path;
}

From source file:org.nekorp.workflow.desktop.servicio.reporte.orden.servicio.OrdenServicioDataFactory.java

private void generaImagenDamage(ShapeView fondo, List<DamageDetailsVB> danios, File outputfile, int width,
        int height) {
    try {// ww  w  .ja v a 2  s .  c o  m
        Point contexto = new Point((width - fondo.getShapeWidth()) / 2, (height - fondo.getShapeHeight()) / 2);
        BufferedImage off_Image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = off_Image.createGraphics();
        g2.setColor(Color.WHITE);
        g2.fillRect(0, 0, width, height);
        AffineTransform saveXform = g2.getTransform();
        AffineTransform toCenterAt = new AffineTransform();
        toCenterAt.translate(contexto.getX(), contexto.getY());
        g2.transform(toCenterAt);
        fondo.paint(g2);
        g2.setTransform(saveXform);
        for (DamageDetailsVB x : danios) {
            DamageDetailGraphicsView obj = new DamageDetailGraphicsView();
            obj.setPosicion(new Point(x.getX(), x.getY()));
            obj.setContexto(contexto);
            if (x.getX() <= fondo.getShapeWidth() / 2) {
                if (x.getY() <= fondo.getShapeHeight() / 2) {
                    obj.setOrientacion(DamageDetailGraphicsView.SuperiorIzquierda);
                } else {
                    obj.setOrientacion(DamageDetailGraphicsView.InferiorIzquierda);
                }
            } else {
                if (x.getY() <= fondo.getShapeHeight() / 2) {
                    obj.setOrientacion(DamageDetailGraphicsView.SuperiorDerecha);
                } else {
                    obj.setOrientacion(DamageDetailGraphicsView.InferiorDerecha);
                }
            }
            obj.setCategoria(x.getCategoria());
            obj.setCaracteristica(x.getCaracteristica());
            obj.paint(g2);
        }
        saveJPG(off_Image, outputfile);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:business.ImageManager.java

private void doDrawPath(Graphics2D big, Point ori, Point dest, Color color) {
    //setup para os rastros
    big.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    big.setStroke(new BasicStroke(0.75f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1f,
            new float[] { 3f, 5f, 7f, 5f, 11f, 5f, 15f, 5f, 21f, 5f, 27f, 5f, 33f, 5f }, 0f));
    big.setColor(color);//from w w w . j  a va 2  s.  com
    //draw path
    Path2D.Double path = new Path2D.Double();
    path.moveTo(ori.getX(), ori.getY());
    path.lineTo(dest.getX(), dest.getY());

    //draw on graph
    big.draw(path);
}

From source file:business.ImageManager.java

private void doDrawPathOrdem(Graphics2D big, Point ori, Point dest, Color color) {
    //setup para os rastros
    big.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    big.setStroke(new BasicStroke(1.75f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1f,
            new float[] { 3f, 5f, 7f, 5f, 11f, 5f, 15f, 5f, 21f, 5f, 27f, 5f, 33f, 5f }, 0f));
    big.setColor(color);//from  w  w w.ja  va 2  s  .  c om
    //draw path
    Path2D.Double path = new Path2D.Double();
    path.moveTo(ori.getX(), ori.getY());
    path.curveTo(dest.getX() - 20, dest.getY() + 20, dest.getX() + 20, dest.getY() - 20, dest.getX() + 12,
            dest.getY());
    //path.lineTo(dest.getX(), dest.getY());

    //draw on graph
    big.draw(path);
}

From source file:org.martus.client.swingui.PureFxMainWindow.java

@Override
public void restoreWindowSizeAndState() {
    Dimension appDimension = getUiState().getCurrentAppDimension();
    Point appPosition = getUiState().getCurrentAppPosition();
    boolean showMaximized = getUiState().isCurrentAppMaximized();

    if (appDimension.getHeight() == 0 || appDimension.getWidth() == 0) {
        showMaximized = true;/*from   w ww  . j a  va2  s.c  o  m*/
    } else {
        realStage.setWidth(appDimension.getWidth());
        realStage.setHeight(getNonFullScreenHeight(appDimension.getHeight()));
    }

    realStage.setX(appPosition.getX());
    realStage.setY(appPosition.getY());
    realStage.setMaximized(showMaximized);

    getUiState().setCurrentAppDimension(getMainWindowSize());
}

From source file:business.ImageManager.java

private void doDrawPathOrdemArmy(Graphics2D big, Point ori, Point dest, Color color) {
    //setup para os rastros
    big.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    big.setComposite(alcom);//  w w  w .  j  a  va  2s . c  o m
    big.setStroke(new BasicStroke(3f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1f,
            new float[] { 3f, 5f, 7f, 5f, 11f, 5f, 15f, 5f, 21f, 5f, 27f, 5f, 33f, 5f }, 0f));
    big.setColor(color);
    //draw path
    Path2D.Double path = new Path2D.Double();
    path.moveTo(ori.getX(), ori.getY());
    path.curveTo(dest.getX() + 10, dest.getY() - 10, dest.getX() - 10, dest.getY() + 10, dest.getX(),
            dest.getY());

    //draw on graph
    big.draw(path);
}

From source file:com.projity.pm.graphic.spreadsheet.SpreadSheet.java

public boolean isOnIcon(MouseEvent e) {
    Point p = e.getPoint();
    int row = rowAtPoint(p);
    int col = columnAtPoint(p);
    Rectangle bounds = getCellRect(row, col, false);
    SpreadSheetModel model = (SpreadSheetModel) getModel();
    GraphicNode node = model.getNode(row);
    return NameCellComponent.isOnIcon(
            new Point((int) (p.getX() - bounds.getX()), (int) (p.getY() - bounds.getY())), bounds.getSize(),
            model.getCache().getLevel(node));
}