Package com.sencha.gxt.core.client.util

Examples of com.sencha.gxt.core.client.util.PrecisePoint


   * @param event the mouse event
   */
  @Override
  public void onMouseDown(Event event) {
    super.onMouseDown(event);
    PrecisePoint point = getEventXY(event);
    if (legend != null && legend.getBBox().contains(point)) {
      legend.onMouseDown(point, event);
    }
    if (lastSeries != null) {
      lastSeries.onMouseDown(point, event);
View Full Code Here


   * @param event the mouse event
   */
  @Override
  public void onMouseMove(Event event) {
    super.onMouseMove(event);
    PrecisePoint point = getEventXY(event);
    if (legend != null && legend.getBBox().contains(point)) {
      lastLegend = legend.onMouseMove(point, event);
    } else if (lastLegend != -1) {
      legend.onMouseOut(lastLegend, event);
      lastLegend = -1;
View Full Code Here

    }

    PathSprite sprite = this.copy().toCurve();

    for (PathCommand command : sprite.getCommands()) {
      PrecisePoint point;
      if (command instanceof MoveTo) {
        MoveTo move = (MoveTo) command;
        point = matrix.pointMultiply(new PrecisePoint(move.getX(), move.getY()));
        move.setX(point.getX());
        move.setY(point.getY());
      } else if (command instanceof CurveTo) {
        CurveTo curve = (CurveTo) command;
        point = matrix.pointMultiply(new PrecisePoint(curve.getX1(), curve.getY1()));
        curve.setX1(point.getX());
        curve.setY1(point.getY());
        point = matrix.pointMultiply(new PrecisePoint(curve.getX2(), curve.getY2()));
        curve.setX2(point.getX());
        curve.setY2(point.getY());
        point = matrix.pointMultiply(new PrecisePoint(curve.getX(), curve.getY()));
        curve.setX(point.getX());
        curve.setY(point.getY());
      }
    }

    return sprite;
  }
View Full Code Here

   */
  @Override
  public void onMouseOut(Event event) {
    super.onMouseOut(event);
    if (!getElement().getBounds().contains(event.getClientX(), event.getClientY())) {
      PrecisePoint point = getEventXY(event);
      for (int i = 0; i < series.size(); i++) {
        series.get(i).onMouseOut(point, event);
        series.get(i).hideToolTip();
      }
    }
View Full Code Here

   */
  public PathSprite toAbsolute() {
    if (this.size() < 1 || this.isAbsolute()) {
      return this;
    }
    PrecisePoint reference = new PrecisePoint();
    PrecisePoint move = new PrecisePoint();
    int start = 0;
    PathCommand command;

    command = this.getCommand(0);
    if (command instanceof MoveTo) {
View Full Code Here

  public PathSprite toCurve() {
    if (this.size() < 1 || this.isCurved()) {
      return this;
    }
    PathCommand command = null;
    PrecisePoint currentPoint = new PrecisePoint();
    PrecisePoint movePoint = new PrecisePoint();
    PrecisePoint curvePoint = new PrecisePoint();
    PrecisePoint quadraticPoint = new PrecisePoint();
    this.toAbsolute();
    int total = this.size();
    for (int i = 0; i < total; i++) {
      // Convert the command to a curve
      List<PathCommand> commands = this.getCommand(i).toCurve(currentPoint, movePoint, curvePoint, quadraticPoint);
View Full Code Here

        newp.addCommand(new MoveTo(mx, my));
        beg = newp.size();
        continue;
      }

      PrecisePoint point = commandEnd(command);
      if (point.getX() == mx && point.getY() == my && (commandP == null || commandP instanceof MoveTo)) {
        PathCommand commandBeg = newp.getCommand(beg);
        PrecisePoint pointM = commandEnd(commandM);
        PrecisePoint pointBeg = commandEnd(commandBeg);
        points = getAnchors(new CurveTo(pointM.getX(), pointM.getY(), mx, my, pointBeg.getX(), pointBeg.getY()),
            subsections);
        commandEndSet(new PrecisePoint(points[1].getX(), points[1].getY()), commandBeg);
      } else if (commandP == null || commandP instanceof MoveTo) {
        points[0] = commandEnd(command);
        points[1] = new PrecisePoint(Double.NaN, Double.NaN);
      } else {
        point = commandEnd(command);
        PrecisePoint pointM = commandEnd(commandM);
        PrecisePoint pointP = commandEnd(commandP);
        points = getAnchors(
            new CurveTo(pointM.getX(), pointM.getY(), point.getX(), point.getY(), pointP.getX(), pointP.getY()),
            subsections);
      }
      point = commandEnd(command);
      newp.addCommand(new CurveTo(x, y, points[0].getX(), points[0].getY(), point.getX(), point.getY()));
      x = points[1].getX();
View Full Code Here

   * @param start the starting point of the curve
   * @param curve the curve to have its dimensions calculated
   * @return the dimensions of the curve
   */
  protected PreciseRectangle curveDimensions(PrecisePoint start, CurveTo curve) {
    PrecisePoint min = new PrecisePoint(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
    PrecisePoint max = new PrecisePoint(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
    PrecisePoint dot;
    // solve the quadratic
    double a = (curve.getX2() - 2.0 * curve.getX1() + start.getX())
        - (curve.getX() - 2.0 * curve.getX2() + curve.getX1());
    double b = 2.0 * (curve.getX1() - start.getX()) - 2.0 * (curve.getX1() - curve.getX1());
    double c = start.getX() - curve.getX1();
    double t1 = (-b + Math.sqrt(b * b - 4.0 * a * c)) / 2.0 / a;
    double t2 = (-b - Math.sqrt(b * b - 4.0 * a * c)) / 2.0 / a;
    ArrayList<PrecisePoint> points = new ArrayList<PrecisePoint>();
    points.add(new PrecisePoint(start));
    points.add(new PrecisePoint(curve.getX(), curve.getY()));

    if (Math.abs(t1) > 1e12) {
      t1 = 0.5;
    }
    if (Math.abs(t2) > 1e12) {
View Full Code Here

   *
   * @param command the command to have its end point found
   * @return the end point
   */
  private PrecisePoint commandEnd(PathCommand command) {
    PrecisePoint end = null;

    if (command instanceof MoveTo) {
      MoveTo move = (MoveTo) command;
      end = new PrecisePoint(move.getX(), move.getY());
    } else if (command instanceof LineTo) {
      LineTo line = (LineTo) command;
      end = new PrecisePoint(line.getX(), line.getY());
    } else if (command instanceof CurveTo) {
      CurveTo curve = (CurveTo) command;
      end = new PrecisePoint(curve.getX(), curve.getY());
    } else if (command instanceof EllipticalArc) {
      EllipticalArc arc = (EllipticalArc) command;
      end = new PrecisePoint(arc.getX(), arc.getY());
    }

    return end;
  }
View Full Code Here

    double t1 = 1.0 - t;
    double x = Math.pow(t1, 3) * start.getX() + Math.pow(t1, 2) * 3 * t * curve.getX1() + t1 * 3 * t * t
        * curve.getX2() + Math.pow(t, 3) * curve.getX();
    double y = Math.pow(t1, 3) * start.getY() + Math.pow(t1, 2) * 3 * t * curve.getY1() + t1 * 3 * t * t
        * curve.getY2() + Math.pow(t, 3) * curve.getY();
    return new PrecisePoint(x, y);
  }
View Full Code Here

TOP

Related Classes of com.sencha.gxt.core.client.util.PrecisePoint

Copyright © 2018 www.massapicom. 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.