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

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


   */
  protected LCircleArcSVGGenerator(final SVGGElement elt, final boolean withTransformation) {
    this(ShapeFactory.createCircleArc());

    final SVGElement elt2 = getLaTeXDrawElement(elt, null);
    final IArrow arr1  = shape.getArrowAt(0);
    final IArrow arr2  = shape.getArrowAt(-1);

    if(elt==null || !(elt2 instanceof SVGPathElement))
      throw new IllegalArgumentException();

    final SVGPathElement main = (SVGPathElement)elt2;
View Full Code Here


    final SVGPathElement main = (SVGPathElement)elt2;
    setPath(main.getSegList());
    setSVGParameters(main);
    setSVGShadowParameters(getLaTeXDrawElement(elt, LNamespace.XML_TYPE_SHADOW));
    setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LNamespace.XML_TYPE_DBLE_BORDERS));
    final IArrow arrow1 = shape.getArrowAt(0);
    final IArrow arrow2 = shape.getArrowAt(-1);
    setSVGArrow(arrow1, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_START), main, SVGAttributes.SVG_MARKER_START);
    setSVGArrow(arrow2, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_END), main, SVGAttributes.SVG_MARKER_END);
    homogeniseArrows(arrow1, arrow2);

    shape.setShowPts(getLaTeXDrawElement(elt, LNamespace.XML_TYPE_SHOW_PTS)!=null);
View Full Code Here

    final double whiteDash    = shape.getDashSepWhite();
    final boolean hasDble     = shape.hasDbleBord();
    final Color col           = shape.getLineColour();
    final boolean isClosed    = shape.isClosed();
    final SVGGElement showPts = new SVGGElement(doc);
    final IArrow arrow1     = shape.getArrowAt(0);
    final IArrow arrow2     = shape.getArrowAt(-1);
    final double doubleSep = shape.getDbleBordSep();
    final double thick = (hasDble ? shape.getDbleBordSep()+shape.getThickness()*2. : shape.getThickness())/2.;
    final double rad   = (PSTricksConstants.DEFAULT_ARROW_DOTSIZE_DIM*IShape.PPC + PSTricksConstants.DEFAULT_ARROW_DOTSIZE_NUM*thick*2.)/2.;
    int i;
        final int size = shape.getNbPoints();

        showPts.setAttribute(LNamespace.LATEXDRAW_NAMESPACE + ':' + LNamespace.XML_TYPE, LNamespace.XML_TYPE_SHOW_PTS);

    /* Plotting the lines. */
    for(i=3; i<size; i+=2) {
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getPtAt(i-1), shape.getSecondCtrlPtAt(i-1),
                blackDash, whiteDash, hasDble, 1., doubleSep));
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getSecondCtrlPtAt(i-1), shape.getFirstCtrlPtAt(i),
                  blackDash, whiteDash, hasDble, 1., doubleSep));
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getFirstCtrlPtAt(i), shape.getPtAt(i),
                  blackDash, whiteDash, hasDble, 1., doubleSep));
    }

    for(i=2; i<size; i+=2) {
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getPtAt(i-1), shape.getSecondCtrlPtAt(i-1),
                blackDash, whiteDash, hasDble, 1., doubleSep));
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getSecondCtrlPtAt(i-1), shape.getFirstCtrlPtAt(i),
                  blackDash, whiteDash, hasDble, 1., doubleSep));
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getFirstCtrlPtAt(i), shape.getPtAt(i),
                  blackDash, whiteDash, hasDble, 1., doubleSep));
    }

    if(isClosed) {
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getPtAt(-1), shape.getSecondCtrlPtAt(-1),
                blackDash, whiteDash, hasDble, 1., doubleSep));
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getSecondCtrlPtAt(-1), shape.getSecondCtrlPtAt(0),
                  blackDash, whiteDash, hasDble, 1., doubleSep));
      showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getSecondCtrlPtAt(0), shape.getPtAt(0),
                  blackDash, whiteDash, hasDble, 1., doubleSep));
    }

    showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getPtAt(0), shape.getFirstCtrlPtAt(0),
              blackDash, whiteDash, hasDble, 1., doubleSep));
    showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getFirstCtrlPtAt(0), shape.getFirstCtrlPtAt(1),
              blackDash, whiteDash, hasDble, 1., doubleSep));
    showPts.appendChild(getShowPointsLine(doc, thick, col, shape.getFirstCtrlPtAt(1), shape.getPtAt(1),
              blackDash, whiteDash, hasDble, 1., doubleSep));

    // Plotting the dots.
    if(!arrow1.hasStyle() || isClosed)
      showPts.appendChild(LShapeSVGGenerator.getShowPointsDot(doc, rad, shape.getPtAt(0), col));

    if(!arrow2.hasStyle() || isClosed)
      showPts.appendChild(LShapeSVGGenerator.getShowPointsDot(doc, rad, shape.getPtAt(-1), col));

    for(i=1; i<size-1; i++) {
      showPts.appendChild(LShapeSVGGenerator.getShowPointsDot(doc, rad, shape.getPtAt(i), col));
      showPts.appendChild(LShapeSVGGenerator.getShowPointsDot(doc, rad, shape.getSecondCtrlPtAt(i), col));
View Full Code Here

    setSVGParameters(elt2);
    setSVGLatexdrawParameters(elt);
    setSVGShadowParameters(getLaTeXDrawElement(elt, LNamespace.XML_TYPE_SHADOW));
    setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LNamespace.XML_TYPE_DBLE_BORDERS));
    final IArrow arrow1   = shape.getArrowAt(0);
    final IArrow arrow2   = shape.getArrowAt(-1);
    setSVGArrow(arrow1, elt2.getAttribute(elt2.getUsablePrefix()+SVGAttributes.SVG_MARKER_START), elt2, SVGAttributes.SVG_MARKER_START);
    setSVGArrow(arrow2, elt2.getAttribute(elt2.getUsablePrefix()+SVGAttributes.SVG_MARKER_END), elt2, SVGAttributes.SVG_MARKER_END);
    homogeniseArrows(arrow1, arrow2);

    if(withTransformation)
View Full Code Here

  private void createArrows(final SVGElement elt, final SVGDocument document) {
    if(shape.getAxesStyle().supportsArrows() && shape.getNbArrows()==4) {
      final double posX = shape.getPosition().getX();
      final double posY = shape.getPosition().getY();
      final IArrow arr0 = shape.getArrowAt(1);
      final IArrow arr1 = shape.getArrowAt(3);
      final double arr0Reduction = arr0.getArrowStyle().needsLineReduction() ? arr0.getArrowShapedWidth() : 0.;
      final double arr1Reduction = arr1.getArrowStyle().needsLineReduction() ? arr1.getArrowShapedWidth() : 0.;
      final IPolyline xLine = ShapeFactory.createPolyline();
      final IPolyline yLine = ShapeFactory.createPolyline();

      xLine.addPoint(ShapeFactory.createPoint(posX+shape.getGridStartX()*IShape.PPC + arr0Reduction, posY));
      xLine.addPoint(ShapeFactory.createPoint(posX+shape.getGridEndX()*IShape.PPC - arr1Reduction, posY));
View Full Code Here


  @Override
  protected void update(final IGroup shape) {
    if(shape.isTypeOf(IArrowableShape.class)) {
      final IArrow arr1 = shape.getArrowAt(0);
      final IArrow arr2 = shape.getArrowAt(-1);
      final ArrowStyle arrStyle1 = arr1.getArrowStyle();
      final ArrowStyle arrStyle2 = arr2.getArrowStyle();

      //TODO this code suppose that if arrowable, there are 2 arrows.
      arrowLeftCB.setSelectedItemSafely(arrStyle1.name());
      arrowRightCB.setSelectedItemSafely(arrStyle2.name());
View Full Code Here

    final double h2 = Math.max(1., height);
    double sAngle = startAngle;
    double eAngle = endAngle;

    if(shape.getArcStyle().supportArrow()) {
      IArrow arr = shape.getArrowAt(-1);
      if(arr.getArrowStyle().isReducingShape())
        eAngle-=Math.atan(arr.getArrowShapeLength()/w2);
      arr = shape.getArrowAt(0);
      if(arr.getArrowStyle().isReducingShape())
        sAngle+=Math.atan(arr.getArrowShapeLength()/w2);
    }

    sAngle = Math.toDegrees(sAngle%(Math.PI*2.));
    eAngle = Math.toDegrees(eAngle%(Math.PI*2.));

 
View Full Code Here

   * Updates the general path of the view by drawing the axis of the shape.
   */
  protected void updatePathAxes() {
    final double posX = shape.getPosition().getX();
    final double posY = shape.getPosition().getY();
    final IArrow arr0 = shape.getArrowAt(1);
    final IArrow arr1 = shape.getArrowAt(3);
    final double arr0Reduction = arr0.getArrowStyle().needsLineReduction() ? arr0.getArrowShapedWidth() : 0.;
    final double arr1Reduction = arr1.getArrowStyle().needsLineReduction() ? arr1.getArrowShapedWidth() : 0.;

    path.moveTo(posX+shape.getGridStartX()*IShape.PPC + arr0Reduction, posY);
    path.lineTo(posX+shape.getGridEndX()*IShape.PPC - arr1Reduction, posY);
    path.moveTo(posX, posY-shape.getGridStartY()*IShape.PPC - arr0Reduction);
    path.lineTo(posX, posY-shape.getGridEndY()*IShape.PPC + arr1Reduction);
View Full Code Here


  @Override
  public void paintShowPointsDots(final Graphics2D g) {//FIXME to add into the path not into the graphics
    final boolean isClosed    = shape.isClosed();
    final IArrow arr1      = shape.getArrowAt(0);
    final boolean arrow1Drawable     = arr1.hasStyle() && shape.getNbPoints()>1;
    final boolean arrow2Drawable     = shape.getArrowAt(-1).hasStyle() && shape.getNbPoints()>1 && !isClosed;
    final int size         = shape.getNbPoints();
    final List<IPoint> pts     = shape.getPoints();
    final List<IPoint> ctrlPts1 = shape.getFirstCtrlPts();
    final List<IPoint> ctrlPts2 = shape.getSecondCtrlPts();
    final double width       = arr1.getDotSizeDim() + arr1.getDotSizeNum()*shape.getThickness();
    final Ellipse2D.Double d       = new Ellipse2D.Double(0, 0, width, width);
    int i;

    g.setColor(shape.getLineColour());

View Full Code Here

TOP

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

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.