Examples of IPoint


Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

    if(!GLibUtilities.isValidPoint(origin) || ppc<1)
      return ;

    emptyCache();

    final IPoint tl       = shape.getTopLeftPoint();
    final IPoint br       = shape.getBottomRightPoint();
    final double tlx       = tl.getX();
    final double tly       = tl.getY();
    final double brx       = br.getX();
    final double bry       = br.getY();
    final double xCenter       = (tlx+brx)/2. - origin.getX();
    final double yCenter     = origin.getY() - (tly+bry)/2.;
    final StringBuilder params   = getPropertiesCode(ppc);
    final double rotationAngle  = Math.toDegrees(shape.getRotationAngle())%360;
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

    return Math.sqrt(getX()*getX()+getY()*getY());
  }

  @Override
  public IPoint add(final IPoint pt) {
    final IPoint added = ShapeFactory.createPoint((IPoint)this);
    if(pt!=null)
      added.translate(pt.getX(), pt.getY());
    return added;
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

  protected boolean isFirstCtrlPt;


    @Override
  protected void doActionBody() {
    final IPoint pt = getPoint();
    tx += newCoord.getX() - pt.getX();
    ty += newCoord.getY() - pt.getY();
    redo();
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

  }


  @Override
  public void undo() {
    final IPoint pt = ShapeFactory.createPoint(getPoint());
    pt.translate(-tx, -ty);

    if(isFirstCtrlPt)
      move(pt, pt.centralSymmetry(shape.getPtAt(indexPt)));
    else
      move(pt.centralSymmetry(shape.getPtAt(indexPt)), pt);
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

        final int startY;
        final int endX;
        final int endY;
        final boolean isXLabelSouth = shape.isXLabelSouth();
    final boolean isYLabelWest  = shape.isYLabelWest();
    final IPoint position      = shape.getPosition();
    final StringBuilder start    = new StringBuilder();
    final StringBuilder end    = new StringBuilder();
    final StringBuilder rot    = getRotationHeaderCode(ppc, position);
    final StringBuilder coord    = new StringBuilder();
    final double unit        = shape.getUnit();
    final double gridStartx     = shape.getGridStartX();
    final double gridStarty     = shape.getGridStartY();
    final double gridEndx     = shape.getGridEndX();
    final double gridEndy     = shape.getGridEndY();

    if(isXLabelSouth) {
      startY = (int)gridStarty;
      endY   = (int)gridEndy;
    }
    else {
      startY = (int)gridEndy;
      endY   = (int)gridStarty;

    }

    if(isYLabelWest) {
      startX = (int)gridStartx;
      endX   = (int)gridEndx;
    }
    else {
      startX = (int)gridEndx;
      endX   = (int)gridStartx;
    }

    coord.append('(').append((int)shape.getOriginX()).append(',').append((int)shape.getOriginY()).append(')');
    coord.append('(').append(startX).append(',').append(startY).append(')');
    coord.append('(').append(endX).append(',').append(endY).append(')');

    if(!LNumber.equalsDouble(unit, PSTricksConstants.DEFAULT_UNIT))
      end.append("\n\\psset{unit=").append(PSTricksConstants.DEFAULT_UNIT).append(PSTricksConstants.TOKEN_CM).append('}');//$NON-NLS-1$

    if(!LNumber.equalsDouble(position.getX(), 0.) || !LNumber.equalsDouble(position.getY(), 0.)) {
      final float posX = (float)LNumber.getCutNumber((position.getX()-pt.getX())/ppc);
      final float posY = (float)LNumber.getCutNumber((pt.getY()-position.getY())/ppc);

      end.append('}');
      start.append("\\rput(").append(posX).append(',').append(posY).append(')').append('{');//$NON-NLS-1$
    }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

   */
  protected StringBuilder getPointsCode(final IPoint position, final float ppc) {
    if(!GLibUtilities.isValidPoint(position) || ppc<1)
      return null;

    IPoint p;
    int i;
    final int size         = shape.getNbPoints();
    final StringBuilder points   = new StringBuilder();

    for(i=0; i<size; i++) {
      p = shape.getPtAt(i);
      points.append('(').append((float)LNumber.getCutNumber((p.getX()-position.getX())/ppc));
      points.append(',').append((float)LNumber.getCutNumber((position.getY()-p.getY())/ppc)).append(')');
    }

    return points;
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

  protected IModifiablePointsShape shape;


    @Override
  protected void doActionBody() {
    final IPoint pt = shape.getPtAt(indexPt);
    tx += newCoord.getX() - pt.getX();
    ty += newCoord.getY() - pt.getY();
    redo();
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

  }


  @Override
  public void undo() {
    final IPoint pt = shape.getPtAt(indexPt);
    shape.setPoint(pt.getX()-tx, pt.getY()-ty, indexPt);
    shape.setModified(true);
  }
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

    if(!GLibUtilities.isValidPoint(origin) || ppc<1)
      return ;

    emptyCache();

    final IPoint tl  = shape.getTopLeftPoint();
    final IPoint br  = shape.getBottomRightPoint();
    final double tlx = tl.getX();
    final double brx = br.getX();
    final double bry = br.getY();
    final StringBuilder rot = getRotationHeaderCode(ppc, origin);

    if(rot!=null)
      cache.append(rot);
View Full Code Here

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

  public void addToRotationAngle(final IPoint gravCentre, final double angle) {
    if(GLibUtilities.isValidCoordinate(angle)) {
      setRotationAngle(getRotationAngle()+angle);

      if(gravCentre!=null) {
        final IPoint gravityCentre = getGravityCentre();
        final IPoint rotatedGC = gravityCentre.rotatePoint(gravCentre, angle);
        translate(rotatedGC.getX()-gravityCentre.getX(), rotatedGC.getY()-gravityCentre.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.