Examples of SVGPoint


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

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

                AWTGVTFont awtGvtFont = (AWTGVTFont)gvtFont;
                if (awtGvtFont != null)
                  logger.debug("CharfontSize: " + awtGvtFont.getSize());

                //FIXME REMOVE, Not working always 0,0
                SVGPoint startPosOfChar = SVGTextContentSupport.getStartPositionOfChar(textElement, i);

                /////////////////////////////////////
                //Get the character information - font, colors
                String newFamilyName = new String(fontFamily);
                float newFontSize = fontSize;
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

       
        //Create Vertex[] from points
        SVGPointList pointList = polyLineElem.getPoints();
        Vertex[] vertices = new Vertex[pointList.getNumberOfItems()];
        for (int i = 0; i < pointList.getNumberOfItems(); i++) {
        SVGPoint p = pointList.getItem(i);
        vertices[i] = new Vertex(p.getX(), p.getY(),0);
        }
       
        //Create the shape
        AbstractShape comp = createPoly(vertices);
       
View Full Code Here

Examples of org.w3c.dom.svg.SVGPoint

   
    //Create Vertex array from points
      SVGPointList pointList = polyElem.getPoints();
      Vertex[] vertices = new Vertex[pointList.getNumberOfItems()];
      for (int i = 0; i < pointList.getNumberOfItems(); i++) {
      SVGPoint p = pointList.getItem(i);
      vertices[i] = new Vertex(p.getX(), p.getY(),0);
      }
     
      //If polygon isnt closed, close it with the first vertex
      if (!vertices[0].equalsVector(vertices[vertices.length-1])){
        Vertex[] closedVertices = new Vertex[vertices.length+1];
View Full Code Here

Examples of org.w3c.flex.forks.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.flex.forks.dom.svg.SVGPoint

    public static SVGPoint getPointAtLength(final SVGOMPathElement path,
                                            final float distance) {
        final SVGPathContext pathCtx = (SVGPathContext)path.getSVGContext();
        if (pathCtx == null) return null;

        return new SVGPoint() {
                public float getX() {
                    Point2D pt = pathCtx.getPointAtLength(distance);
                    return (float)pt.getX();
                }
                public float getY() {
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.