Examples of mxLine


Examples of com.mxgraph.util.mxLine

    canvas.getGraphics().setColor(color);

    double absSize = size * canvas.getScale();

    List<mxPoint> points = state.getAbsolutePoints();
    mxLine markerVector = getMarkerVector(points, source, absSize);
    mxPoint p0 = new mxPoint(markerVector.getX(), markerVector.getY());
    mxPoint pe = markerVector.getEndPoint();

    mxPoint offset = null;

    // Computes the norm and the inverse norm
    double dx = pe.getX() - p0.getX();
View Full Code Here

Examples of com.mxgraph.util.mxLine

  protected mxLine getMarkerVector(List<mxPoint> points, boolean source,
      double markerSize)
  {
    if (source)
    {
      return new mxLine(points.get(1), points.get(0));
    }
    else
    {
      int pointCount = points.size();
     
      return new mxLine(points.get(pointCount - 2),
          points.get(pointCount - 1));
    }
  }
View Full Code Here

Examples of com.mxgraph.util.mxLine

      markerRatio = 1.0;
    }
   
    if (source)
    {
      mxLine sourceVector = curve.getCurveParallel(mxCurve.CORE_CURVE, markerRatio);
      return new mxLine(new mxPoint(sourceVector.getX(), sourceVector.getY()), points.get(0));
    }
    else
    {
      mxLine targetVector = curve.getCurveParallel(mxCurve.CORE_CURVE, 1.0 - markerRatio);
      int pointCount = points.size();
      return new mxLine(new mxPoint(targetVector.getX(), targetVector.getY()), points.get(pointCount - 1));
    }
  }
View Full Code Here

Examples of com.mxgraph.util.mxLine

      g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
          RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

      for (int j = 0; j < text.length(); j++)
      {
        mxLine parallel = labelGlyphs[j].glyphVector;
        double rotation = (Math.atan(parallel.getEndPoint().getY()
            / parallel.getEndPoint().getX()));

        final AffineTransform old = g.getTransform();
        g.translate(parallel.getX(), parallel.getY());
        g.rotate(rotation);
        g.drawString(text.substring(j, j + 1), 0f, 0f);
        g.setTransform(old);
      }
View Full Code Here

Examples of com.mxgraph.util.mxLine

    // the curve shapes listen to curve events
    // !lastPoints.equals(curve.getGuidePoints())
    
    for (int j = 0; j < label.length(); j++)
    {
      mxLine parallel = curve.getCurveParallel(mxCurve.LABEL_CURVE,
          currentPos);
      labelGlyphs[j].glyphVector = parallel;
      labelGlyphs[j].labelGlyphBounds.setX(parallel.getX());
      labelGlyphs[j].labelGlyphBounds.setY(parallel.getY());

      // Hook for sub-classers
      postprocessGlyph(curve, j, currentPos);

      currentPos += (labelGlyphs[j].labelGlyphBounds.getWidth() + labelPosition.defaultInterGlyphSpace)
          / curveLength;

      if (overallLabelBounds == null)
      {
        overallLabelBounds = (mxRectangle) labelGlyphs[j].labelGlyphBounds
            .clone();
      }
      else
      {
        overallLabelBounds.add(labelGlyphs[j].labelGlyphBounds);
      }
    }

    if (overallLabelBounds == null)
    {
      // Return a small rectangle in the center of the label curve
      // Null label bounds causes NPE when editing
      mxLine labelCenter = curve.getCurveParallel(mxCurve.LABEL_CURVE,
          0.5);
      overallLabelBounds = new mxRectangle(labelCenter.getX(),
          labelCenter.getY(), 1, 1);
    }

    this.labelBounds = overallLabelBounds;
    return overallLabelBounds;
  }
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.