]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/SVGPassthruShape.java
G2DParentNode handles "undefined" child bounds separately
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / utils / SVGPassthruShape.java
1 package org.simantics.scenegraph.utils;
2
3 import java.awt.BasicStroke;
4 import java.awt.Color;
5 import java.awt.Font;
6 import java.awt.Graphics2D;
7 import java.awt.Rectangle;
8 import java.awt.Shape;
9 import java.awt.geom.AffineTransform;
10 import java.awt.geom.PathIterator;
11 import java.awt.geom.Point2D;
12 import java.awt.geom.Rectangle2D;
13
14 public class SVGPassthruShape implements Shape {
15
16         private String source;
17         public final static Font DEFAULT_FONT = Font.decode(null);
18         
19         public SVGPassthruShape(String source) {
20                 this.source = source;
21         }
22         
23         public String getSource() {
24                 return source;
25         }
26         
27         public static void resetG2D(Graphics2D g2d) {
28                 g2d.setColor(new Color(0, 0, 0));
29                 g2d.setBackground(new Color(0, 0, 0));
30                 g2d.setStroke(new BasicStroke());
31                 g2d.setFont(DEFAULT_FONT);
32                 QualityHints.HIGH_QUALITY_HINTS.setQuality(g2d);
33         }
34         
35         @Override
36         public Rectangle getBounds() {
37                 return new Rectangle();
38         }
39
40         @Override
41         public Rectangle2D getBounds2D() {
42                 return new Rectangle2D.Double();
43         }
44
45         @Override
46         public boolean contains(double x, double y) {
47                 return false;
48         }
49
50         @Override
51         public boolean contains(Point2D p) {
52                 return false;
53         }
54
55         @Override
56         public boolean intersects(double x, double y, double w, double h) {
57                 return false;
58         }
59
60         @Override
61         public boolean intersects(Rectangle2D r) {
62                 return false;
63         }
64
65         @Override
66         public boolean contains(double x, double y, double w, double h) {
67                 return false;
68         }
69
70         @Override
71         public boolean contains(Rectangle2D r) {
72                 return false;
73         }
74
75         @Override
76         public PathIterator getPathIterator(AffineTransform at) {
77                 return new EmptyPathIterator();
78         }
79         
80         @Override
81         public PathIterator getPathIterator(AffineTransform at, double flatness) {
82                 return new EmptyPathIterator();
83         }
84
85         private class EmptyPathIterator implements PathIterator {
86                 
87                 @Override
88                 public void next() {
89                         
90                 }
91                 
92                 @Override
93                 public boolean isDone() {
94                         return true;
95                 }
96                 
97                 @Override
98                 public int getWindingRule() {
99                         return 0;
100                 }
101                 
102                 @Override
103                 public int currentSegment(double[] coords) {
104                         return 0;
105                 }
106                 
107                 @Override
108                 public int currentSegment(float[] coords) {
109                         return 0;
110                 }
111         };
112
113 }