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

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


    // If there exists an intersection point between the two lines created using control points and points,
    // where is a loop that must be removed by inverting the control points.
    // For the first point, the lines are created differently.
    final int posPrev = position==0 ? 1 : position - 1;
    final int posNext = position==0 ? points.size()-1 : position==points.size()-1 ? 0 : position + 1;
    final ILine line1 = ShapeFactory.createLine(getPtAt(posPrev), ctrlPts[0]);
    final ILine line2 = ShapeFactory.createLine(getPtAt(posNext), ctrlPts[1]);

    if(line1.getIntersectionSegment(line2)==null) {
      firstCtrlPts.get(position).setPoint(ctrlPts[0]);
      secondCtrlPts.get(position).setPoint(ctrlPts[1]);
    }else {
View Full Code Here



  @Override
  public void paint(final Graphics2D g, final Color fColour, final boolean asShadow) {
    if(!model.hasStyle()) return ;
    final ILine arrowLine   = model.getArrowLine();
    if(arrowLine==null) return;
    final IPoint pt1     = arrowLine.getPoint1();
    final double lineAngle  = arrowLine.getLineAngle();
    final double lineB      = arrowLine.getB();
    final double c2x;
        final double c2y;
        final double c3x;
        final double c3y;
View Full Code Here

   */
  @Override
  public void updatePath() {
    path.reset();

    final ILine arrowLine = model.getArrowLine();

    if(model.getArrowStyle()==ArrowStyle.NONE || arrowLine==null) return;
    final double xRot;
        final double yRot;
        final double lineAngle  = arrowLine.getLineAngle();
    final IPoint pt1     = arrowLine.getPoint1();
    final IPoint pt2     = arrowLine.getPoint2();
    final double lineB      = arrowLine.getB();

    if(LNumber.equalsDouble(Math.abs(lineAngle), Math.PI/2.) || LNumber.equalsDouble(Math.abs(lineAngle), 0.)) {
      xRot = pt1.getX();
      yRot = pt1.getY();
    } else {
View Full Code Here

                            pt1.setX(pt2.getX() - Point2D.distance(pt2.getX(), pt2.getY(), br.getX(), (tl.getY() + br.getY()) / 2.));

                        pt2.setX(tl.getX() + (br.getX() - tl.getX()) * gradMidPt);
                    } else {
                        final IPoint cg = shape.getGravityCentre();
                        final ILine l2;
                        final ILine l;

                        pt1 = pt1.rotatePoint(cg, -angle);
                        pt2 = pt2.rotatePoint(cg, -angle);
                        l = ShapeFactory.createLine(pt1, pt2);

                        if (angle >= 0. && angle < Math.PI / 2.)
                            l2 = l.getPerpendicularLine(tl);
                        else
                            l2 = l.getPerpendicularLine(ShapeFactory.createPoint(tl.getX(), br.getY()));

                        pt1 = l.getIntersection(l2);
                        final double distance = Point2D.distance(cg.getX(), cg.getY(), pt1.getX(), pt1.getY());
                        l.setX1(pt1.getX());
                        l.setY1(pt1.getY());
                        final IPoint[] pts = l.findPoints(pt1, 2 * distance * gradMidPt);
                        pt2 = pts[0];

                        if (gradMidPt < 0.5)
                            pt1 = pt1.rotatePoint(shape.getGravityCentre(), Math.PI);
                    }
View Full Code Here

  protected static double[] updatePoint4Arrows(final double x, final double y, final IArrow arr) {
    final double[] coords = {x, y};

    if(arr.getArrowStyle().isReducingShape()) {
      final ILine line = arr.getArrowLine();

      if(line!=null) {
        final IPoint[] ps = line.findPoints(line.getPoint1(), arr.getArrowShapeLength()/2.);
        if(ps!=null) {
          if(line.isInSegment(ps[0])) {
            coords[0] = ps[0].getX();
            coords[1] = ps[0].getY();
          }else {
            coords[0] = ps[1].getX();
            coords[1] = ps[1].getY();
View Full Code Here

TOP

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

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.