Examples of SVGPoint


Examples of org.w3c.dom.svg.SVGPoint

        context.setScreenTransform(scrnTrans);
    }

    public SVGPoint getCurrentTranslate( ) {
        final SVGOMElement svgelt  = this;
        return new SVGPoint() {
                AffineTransform getScreenTransform() {
                    SVGContext context = svgelt.getSVGContext();
                    return context.getScreenTransform();
                }
                   
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

    /**
     */
    protected SVGItem createSVGItem(Object newItem){
       
        SVGPoint point= (SVGPoint)newItem;

        return new SVGPointItem(point.getX(), point.getY());
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

        context.setScreenTransform(scrnTrans);
    }

    public SVGPoint getCurrentTranslate( ) {
        final SVGOMElement svgelt  = this;
        return new SVGPoint() {
                AffineTransform getScreenTransform() {
                    SVGContext context = svgelt.getSVGContext();
                    return context.getScreenTransform();
                }
                   
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

            } else {
                AWTPolygonProducer app = new AWTPolygonProducer();
                app.setWindingRule(CSSUtilities.convertFillRule(e));
                app.startPoints();
                for (int i = 0; i < size; i++) {
                    SVGPoint p = pl.getItem(i);
                    app.point(p.getX(), p.getY());
                }
                app.endPoints();
                shapeNode.setShape(app.getShape());
            }
        } catch (LiveAttributeException ex) {
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

    public AnimatableValue getUnderlyingValue(AnimationTarget target) {
        SVGPointList pl = getPoints();
        int n = pl.getNumberOfItems();
        float[] points = new float[n * 2];
        for (int i = 0; i < n; i++) {
            SVGPoint p = pl.getItem(i);
            points[i * 2] = p.getX();
            points[i * 2 + 1] = p.getY();
        }
        return new AnimatablePointListValue(target, points);
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

            } else {
                AWTPolylineProducer app = new AWTPolylineProducer();
                app.setWindingRule(CSSUtilities.convertFillRule(e));
                app.startPoints();
                for (int i = 0; i < size; i++) {
                    SVGPoint p = pl.getItem(i);
                    app.point(p.getX(), p.getY());
                }
                app.endPoints();
                shapeNode.setShape(app.getShape());
            }
        } catch (LiveAttributeException ex) {
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

    /**
     * <b>DOM</b>: Implements {@link SVGSVGElement#getCurrentTranslate()}.
     */
    public SVGPoint getCurrentTranslate() {
        return new SVGPoint() {
            protected AffineTransform getScreenTransform() {
                SVGContext context = getSVGContext();
                return context.getScreenTransform();
            }
            public float getX() {
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

    if(evt instanceof DOMMouseEvent && reference instanceof SVGLocatable && reference instanceof SVGElement) {
      // Get the screen (pixel!) coordinates
      DOMMouseEvent gnme = (DOMMouseEvent) evt;
      SVGMatrix mat = ((SVGLocatable) reference).getScreenCTM();
      SVGMatrix imat = mat.inverse();
      SVGPoint cPt = ((SVGElement) reference).getOwnerSVGElement().createSVGPoint();
      cPt.setX(gnme.getClientX());
      cPt.setY(gnme.getClientY());
      // Have Batik transform the screen (pixel!) coordinates into SVG element
      // coordinates
      cPt = cPt.matrixTransform(imat);

      return new double[] { cPt.getX(), cPt.getY() };
    }
    return null;
  }
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

  }

  @Override
  public void handleEvent(Event evt) {
    if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEDOWN)) {
      SVGPoint dragPoint = getCoordinates(evt);
      if(startDrag(dragPoint, evt)) {
        // LoggingUtil.warning("Starting drag: "+dragPoint);
        startDragPoint = dragPoint;
        enableStop();
      }
    }
    else if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEMOVE)) {
      if(startDragPoint != null) {
        SVGPoint dragPoint = getCoordinates(evt);
        if(!duringDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
          // cancel the drag operation
          startDragPoint = null;
          disableStop();
        }
      }
    }
    else if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEUP)) {
      if(startDragPoint != null) {
        SVGPoint dragPoint = getCoordinates(evt);
        if(endDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
          // LoggingUtil.warning("Drag completed: "+dragPoint);
          startDragPoint = null;
          disableStop();
        }
      }
    }
    else if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEOUT)) {
      // When leaving the document with the mouse!
      if(startDragPoint != null && evt.getTarget() == evt.getCurrentTarget()) {
        // LoggingUtil.warning("Mouseout: "+evt.getTarget().toString());
        SVGPoint dragPoint = getCoordinates(evt);
        if(endDrag(startDragPoint, dragPoint, evt, false)) {
          // LoggingUtil.warning("Drag completed: "+dragPoint);
          startDragPoint = null;
          disableStop();
        }
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

  public static SVGPoint elementCoordinatesFromEvent(Document doc, Element tag, Event evt) {
    try {
      DOMMouseEvent gnme = (DOMMouseEvent) evt;
      SVGMatrix mat = ((SVGLocatable) tag).getScreenCTM();
      SVGMatrix imat = mat.inverse();
      SVGPoint cPt = ((SVGDocument) doc).getRootElement().createSVGPoint();
      cPt.setX(gnme.getClientX());
      cPt.setY(gnme.getClientY());
      return cPt.matrixTransform(imat);
    }
    catch(Exception e) {
      LoggingUtil.warning("Error getting coordinates from SVG event.", e);
      return null;
    }
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.