Package net.sf.latexdraw.glib.models.interfaces.shape

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


        @Override
    public void mouseMoved(final MouseEvent e) {
      boolean again = true;
      ToolTipable tooltipable;
      final IPoint pt = LCanvas.this.convertToOrigin(ShapeFactory.createPoint(e.getX(), e.getY()));
      final Point2D pos = LCanvas.this.getZoomedPoint(pt.getX(), pt.getY());
      final double x = pos.getX();
      final double y = pos.getY();

      for(int i=0, size=tooltipableView.size(); i<size && again; i++) {
        tooltipable = tooltipableView.get(i);
View Full Code Here


  }


  @Override
  public IPoint getBottomRightPoint() {
    final IPoint pos = getPtAt(0);
    return ShapeFactory.createPoint(pos.getX()+getWidth(), pos.getY()+getHeight());
  }
View Full Code Here

  @Override
  public void mirrorVertical(final IPoint origin) {
    if(origin==null) return ;

    final IPoint bl = points.get(0).verticalSymmetry(origin);
    final IPoint tl = getTopLeftPoint().verticalSymmetry(origin);

    points.get(0).setPoint(bl.getX(), bl.getY()>tl.getY() ? bl.getY() : tl.getY());
  }
View Full Code Here

  public void balance() {
    final int size = getNbPoints();

    if(size<3) return ;//Works only with more than 2 points.

    IPoint ptPrev;
    IPoint ptNext;

    // Balancing all the points except the first and the last one.
    for(int i=1; i<size-1; i++) {
      ptPrev = points.get(i-1);
      ptNext = points.get(i+1);
View Full Code Here

  }


  @Override
  public IPoint getFirstCtrlPtAt(final int position) {
    final IPoint point;

    if(firstCtrlPts.isEmpty() || position<-1 || position>=firstCtrlPts.size())
      point = null;
    else
      point = position==-1 ? firstCtrlPts.get(firstCtrlPts.size()-1) : firstCtrlPts.get(position);
View Full Code Here

  }


  @Override
  public IPoint getSecondCtrlPtAt(final int position) {
    final IPoint point;

    if(secondCtrlPts.isEmpty() || position<-1 || position>=secondCtrlPts.size())
      point = null;
    else
      point = position==-1 ? secondCtrlPts.get(secondCtrlPts.size()-1) : secondCtrlPts.get(position);
View Full Code Here

  }


  @Override
  public boolean setPoint(final double x, final double y, final int position) {
    final IPoint pt = getPtAt(position);

    if(pt==null || !GLibUtilities.isValidPoint(x, y))
      return false;

    final double tx = x - pt.getX();
    final double ty = y - pt.getY();
    super.setPoint(x, y, position);
    getFirstCtrlPtAt(position).translate(tx, ty);
    getSecondCtrlPtAt(position).translate(tx, ty);

    return true;
View Full Code Here

  @Override
  public void setRotationAngle(final double rotationAngle) {
    if(GLibUtilities.isValidCoordinate(rotationAngle)) {
      final double diff = rotationAngle-this.rotationAngle;
      final IPoint gc = getGravityCentre();

      super.setRotationAngle(rotationAngle);

      for(final IPoint pt : firstCtrlPts)
        pt.setPoint(pt.rotatePoint(gc, diff));
View Full Code Here

  }


  @Override
  public IPoint removePoint(final int position) {
    final IPoint deleted = super.removePoint(position);

    if(deleted!=null) {
      firstCtrlPts.remove(position==-1 ? firstCtrlPts.size()-1 : position);
      secondCtrlPts.remove(position==-1 ? secondCtrlPts.size()-1 : position);
    }
View Full Code Here

  public void addPoint(final IPoint pt, final int position) {
    super.addPoint(pt, position);

    // Adding the control points.
    if(GLibUtilities.isValidPoint(pt) && position>=-1 && position<points.size()) {
      final IPoint ctrlPt = ShapeFactory.createPoint(pt.getX(), pt.getY()+DEFAULT_POSITION_CTRL);
      if(position==-1) {
        firstCtrlPts.add(ctrlPt);
        secondCtrlPts.add(ctrlPt.centralSymmetry(pt));
      } else {
        firstCtrlPts.add(position, ctrlPt);
        secondCtrlPts.add(position, ctrlPt.centralSymmetry(pt));
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.glib.models.interfaces.shape.IPoint

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.