public void output(ContentHandler handler, Map svgContext) throws SAXException { if (dim.getDimensionBlock().length() > 0) { AttributesImpl attr = new AttributesImpl(); StringBuffer buf = new StringBuffer(); buf.append("translate("); buf.append((dim.getInsertPoint().getX())); buf.append(" "); buf.append((dim.getInsertPoint().getY())); buf.append(")"); SVGUtils.addAttribute(attr, "transform", buf.toString()); setCommonAttributes(attr, svgContext, dim); SVGUtils.startElement(handler, SVGConstants.SVG_GROUP, attr); attr = new AttributesImpl(); attr.addAttribute( SVGConstants.XMLNS_NAMESPACE, "xlink", "xmlns:xlink", "CDATA", SVGConstants.XLINK_NAMESPACE); attr.addAttribute( SVGConstants.XLINK_NAMESPACE, "href", "xlink:href", "CDATA", "#" + SVGUtils.validateID(dim.getDimensionBlock())); SVGUtils.emptyElement(handler, SVGConstants.SVG_USE, attr); SVGUtils.endElement(handler, SVGConstants.SVG_GROUP); } }
protected void showHandle(Event e, Element el) { // MouseEvent mevt = (MouseEvent) e; // SVGDocument doc = ((SVGDocument)this.labelID // .getOwnerDocument()); // SVGMatrix screen = doc.getRootElement().getScreenCTM(); // SVGMatrix matrix = doc.getRootElement().getScreenCTM() // .inverse(); // double startX = matrix.getA() * mevt.getClientX() // + matrix.getC() * mevt.getClientY() + matrix.getE(); // double startY = matrix.getB() * mevt.getClientX() // + matrix.getD() * mevt.getClientY() + matrix.getF(); // this.labelID.setAttributeNS(null, "x", ""+startX); // this.labelID.setAttributeNS(null, "y", ""+startY); // String s = doc.getDocumentElement().getAttribute("viewBox"); // System.out.println("s="+s); // String[] data = s.split("\\s+"); // double w = Double.parseDouble(data[2]); // // float width = (float) (screen.getA() * w + screen.getC() * 0 // + screen.getE()); // String handle = SVGUtils.reverseID(el.getAttribute("id")); DXFEntity entity = this.dxfDocument.getDXFEntityByID(handle); System.out.println("Selected Entity=" + handle); if (entity != null) { System.out.println("Selected Entity-type=" + entity.getType()); } else { System.out.println("No entity found for handle=" + handle); } // // this.labelID.setAttributeNS(null, "visibility", "visible"); // this.labelID.setTextContent("Handle="+handle); }