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

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


    super(ins, false, AddShape.class, KeyTyped.class);
  }

  @Override
  public void initAction() {
    final IPoint textPosition = instrument.relativePoint==null ? ShapeFactory.createPoint(instrument.textField.getX(),
                  instrument.textField.getY()+instrument.textField.getHeight()) : instrument.relativePoint;
    final IShape sh = instrument.pencil==null ? null : instrument.pencil.createShapeInstance();

    if(sh instanceof IText) {
      final IText text = (IText)sh;
      text.setPosition(textPosition.getX(), textPosition.getY());
      text.setText(instrument.textField.getText());
      action.setShape(text);
      action.setDrawing(instrument.pencil.canvas().getDrawing());
    }
  }
View Full Code Here


  }

  @Override
  public void initAction() {
    instrument.textField.setValid(true);
    final IPoint textPosition = instrument.relativePoint==null ? ShapeFactory.createPoint(instrument.textField.getX(),
                  instrument.textField.getY()+instrument.textField.getHeight()) : instrument.relativePoint;
    final IShape sh = instrument.pencil==null ? null : instrument.pencil.createShapeInstance();

    if(sh instanceof IPlot) {
      final IPlot plot = (IPlot)sh;
      plot.setPosition(textPosition.getX(), textPosition.getY());
      plot.setPlotEquation(instrument.textField.getText());
      action.setShape(plot);
      action.setDrawing(instrument.pencil.canvas().getDrawing());
    }
  }
View Full Code Here

    final SVGElement root = new SVGGElement(doc);
        SVGElement elt;
        root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_TRIANGLE);
    root.setAttribute(SVGAttributes.SVG_ID, getSVGID());
      final double gap     = getPositionGap()/2.;
      final IPoint pt1     = shape.getTopLeftPoint();
      final IPoint pt2     = shape.getBottomRightPoint();
    final IPoint p1     = ShapeFactory.createPoint((pt1.getX()+pt2.getX())/2., pt1.getY());
    final IPoint p2     = ShapeFactory.createPoint(pt2.getX(), pt2.getY());
    final IPoint p3     = ShapeFactory.createPoint(pt1.getX(), pt2.getY());
      final double p1x = p1.getX();
      final double p1y = p1.getY();
      final double p2x = p2.getX();
      final double p2y = p2.getY();
      final double p3x = p3.getX();
      double cornerGap1 = GLibUtilities.getCornerGap(ShapeFactory.createPoint(p1x, p2y), p1, p2, gap);
      double cornerGap2 = GLibUtilities.getCornerGap(shape.getGravityCentre(), p2, p3, gap);

      if(p2x>p3x)
        cornerGap2*=-1;
 
View Full Code Here

    switch(shape.getArcStyle()) {
      case ARC:
        start.append("\\psarc"); //$NON-NLS-1$
        break;
      case CHORD:
        final IPoint startPt= shape.getStartPoint();
        final IPoint endPt   = shape.getEndPoint();

        start.append("\\psarc"); //$NON-NLS-1$
        end.append(LResources.EOL).append("\\psline[").append(params).append(']').append('('); //$NON-NLS-1$
        end.append((float)LNumber.getCutNumber(startPt.getX()/ppc)).append(',');
        end.append((float)LNumber.getCutNumber(startPt.getY()/ppc)).append(')').append('(');
        end.append((float)LNumber.getCutNumber(endPt.getX()/ppc)).append(',');
        end.append((float)LNumber.getCutNumber(endPt.getY()/ppc)).append(')');
        break;
      case WEDGE:
        start.append("\\pswedge"); //$NON-NLS-1$
        break;
    }
View Full Code Here



  @Override
  public IPoint getBottomLeftPoint() {
    final IPoint tl = ShapeFactory.createPoint();
    final IPoint br = ShapeFactory.createPoint();
    getTopLeftBottomRightPoints(tl, br);
    return ShapeFactory.createPoint(tl.getX(), br.getY());
  }
View Full Code Here



  @Override
  public IPoint getBottomRightPoint() {
    final IPoint br = ShapeFactory.createPoint();
    getTopLeftBottomRightPoints(ShapeFactory.createPoint(), br);
    return br;
  }
View Full Code Here



  @Override
  public IPoint getTopLeftPoint() {
    final IPoint tl = ShapeFactory.createPoint();
    getTopLeftBottomRightPoints(tl, ShapeFactory.createPoint());
    return tl;
  }
View Full Code Here



  @Override
  public IPoint getTopRightPoint() {
    final IPoint tl = ShapeFactory.createPoint();
    final IPoint br = ShapeFactory.createPoint();
    getTopLeftBottomRightPoints(tl, br);
    return ShapeFactory.createPoint(br.getX(), tl.getY());
  }
View Full Code Here

   * @param br The bottom-right point to set. Must not be null.
   * @throws NullPointerException If tl or br is null.
   * @since 3.0
   */
  protected void getTopLeftBottomRightPoints(final IPoint tl, final IPoint br) {
    final IPoint centre = getPosition();
    final double x = centre.getX();
    final double y = centre.getY();
    final double tlx = x - radius;
    final double tly = y - radius;
    final double brx = x + radius;
    final double bry = y + radius;
    final double dec = 2. * radius / THICKNESS_O_STYLE_FACTOR;
View Full Code Here

  public SVGElement toSVG(final SVGDocument document) {
    if(document==null || document.getFirstChild().getDefs()==null)
      throw new IllegalArgumentException();

    final double gap = getPositionGap();
    final IPoint tl  = shape.getTopLeftPoint();
    final IPoint br  = shape.getBottomRightPoint();
    SVGElement elt;
        final SVGElement root = new SVGGElement(document);
        final double width  = Math.max(1, br.getX()-tl.getX()+gap);
        final double x    = tl.getX()-gap/2.;
        final double y    = tl.getY()-gap/2.;

    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_SQUARE);
        root.setAttribute(SVGAttributes.SVG_ID, getSVGID());
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.