You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "angrysnail (JIRA)" <ji...@apache.org> on 2013/07/10 09:47:48 UTC

[jira] [Updated] (BATIK-1050) really puzzling problem, the use element is not rendered

     [ https://issues.apache.org/jira/browse/BATIK-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

angrysnail updated BATIK-1050:
------------------------------

    Attachment: erere.png

all the blue node are part of the graph of svg, I usr the folloing code to paint it on this JPanel, when I select the node on this JPanel, I will use updateManager to change the fill attribute of the use element, but sometimes, the use element will lost the background just like the attach file

the code used to get the node graph of svg:
public void paintIcon(Component c, Graphics g, int x, int y) {
			try {
				Graphics2D g2d = (Graphics2D) g;
				super.paintIcon(c, g, x, y);
				// BufferedImage image = new BufferedImage(123, 62, BufferedImage.TYPE_INT_RGB);
				Element ele = SecondarySVGService.getInstance().getDocument().getElementById(SVGUtils.getGroupIdFromIedId(id));
				Element ele_bubble = SecondarySVGService.getInstance().getDocument().getElementById(id + "_bubble1");
				GraphicsNode gNode = SecondarySVGService.getInstance().getCanvas().getBContext().getGraphicsNode(ele);
				GraphicsNode gNode_bubble = SecondarySVGService.getInstance().getCanvas().getBContext()
				        .getGraphicsNode(ele_bubble);
				if (gNode != null) {
					Graphics2D g2d1 = (Graphics2D) g2d.create();
					AffineTransform viewTransform = JungLoader.getCurrentViewer().getViewer().getRenderContext()
					        .getMultiLayerTransformer().getTransformer(Layer.VIEW).getTransform();
					AffineTransform viewTransform1 = (AffineTransform) viewTransform.clone();
					// 将指定位置转为窗口的位置
					Point2D.Double p = new Point2D.Double(x, y);
					viewTransform1.transform(p, p);
					if (gNode.getBounds() == null) {
						return;
					}
					// SVG的窗口位置
					Double cx = gNode.getBounds().getCenterX();
					Double cy = gNode.getBounds().getCenterY();
					Point2D.Double sp = new Point2D.Double(cx, cy);
					viewTransform1.transform(sp, sp);
					// 为满足单个移动时的处理
					AffineTransform at = AffineTransform.getTranslateInstance(p.x - sp.x, p.y - sp.y);
					viewTransform1.preConcatenate(at);
					vertexTransformMap.put(id, viewTransform1);
					// 切不可在gnode上添加transform,会影响svg处
					g2d1.setTransform(viewTransform1);
					gNode.paint(g2d1);
					if (gNode_bubble != null) {
						gNode_bubble.paint(g2d1);
					}
					g2d1.dispose();
				}
			} catch (Exception e) {
				logger.error("something wrong when paint the IED layer:", e);
			}
		}
                
> really puzzling problem, the use element is not rendered
> --------------------------------------------------------
>
>                 Key: BATIK-1050
>                 URL: https://issues.apache.org/jira/browse/BATIK-1050
>             Project: Batik
>          Issue Type: Bug
>          Components: GVT
>    Affects Versions: 1.7
>         Environment: ubuntu12.04   jdk1.7.10   
>            Reporter: angrysnail
>         Attachments: erere.png
>
>
> I want to use the rendered graph of svg file ,so I create a jsvgCanvas on a tab pane, in another tab, I create a JPane which use the graph of the jsvgCanvas, in the tab ,I make some action listener, just like make the node(part of the graph) selected (the background color changed when selected). but the svg tab will lost the background.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org