Revision 42558

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/style/SVGStyle.java
67 67
    public static final String SVG_STYLE_PERSISTENCE_DEFINITION_NAME =
68 68
        "SVGStyle";
69 69
    private static final String SOURCE = "source";
70
    private GVTBuilder gvtBuilder = new GVTBuilder();
71
    private UserAgentAdapter userAgent;
72
    private DocumentLoader loader;
73
    private StaticRenderer renderer = new StaticRenderer();
70
    private final GVTBuilder gvtBuilder = new GVTBuilder();
71
    private final UserAgentAdapter userAgent;
72
    private final DocumentLoader loader;
73
    private final StaticRenderer renderer = new StaticRenderer();
74 74
    private GraphicsNode gvtRoot;
75
    private BridgeContext ctx;
75
    private final BridgeContext ctx;
76 76
    private Element elt;
77 77

  
78
    protected static RenderingHints defaultRenderingHints;
78
    protected static final RenderingHints defaultRenderingHints;
79 79
    static {
80 80
        defaultRenderingHints = new RenderingHints(null);
81 81
        defaultRenderingHints.put(RenderingHints.KEY_ANTIALIASING,
......
96 96
        renderer.setDoubleBuffered(true);
97 97
    }
98 98

  
99
    @Override
99 100
    public void drawInsideRectangle(Graphics2D g,
100 101
        Rectangle rect,
101 102
        boolean keepAspectRatio) throws SymbolDrawingException {
......
147 148
        }
148 149
    }
149 150

  
151
    @Override
150 152
    public boolean isSuitableFor(ISymbol symbol) {
151 153
        return true;
152 154
    }
153 155

  
156
    @Override
154 157
    public void setSource(URL url) throws IOException {
155 158

  
156 159
    	source = url;
......
158 161
    	try {
159 162
    		svgDoc = loader.loadDocument(url.toURI().toString());
160 163
    	} catch (URISyntaxException e) {
161
            IOException ioex = new IOException();
162
            ioex.initCause(e);
163
            throw ioex;
164
            throw new IOException(e);
164 165
    	}
165 166
    	gvtRoot = gvtBuilder.build(ctx, svgDoc);
166 167
    	renderer.setTree(gvtRoot);
167 168
    	elt = ((SVGOMDocument) svgDoc).getRootElement();
168 169
    }
169 170

  
171
    @Override
170 172
    public Rectangle getBounds() {
171 173
        try {
172 174
            Rectangle2D r = gvtRoot.getBounds();
......
179 181
        }
180 182
    }
181 183

  
184
    @Override
182 185
    public void drawOutline(Graphics2D g, Rectangle r) throws SymbolDrawingException {
183 186
        drawInsideRectangle(g, r);
184 187
    }
185 188

  
186 189
    
190
    @Override
187 191
    public void loadFromState(PersistentState state) throws PersistenceException {
188 192
    	try {
189 193
    		String sourceSymbolInLibrary = state.getString(SOURCE_SYMBOL_IN_LIBRARY);
......
197 201
    	}
198 202
    }
199 203

  
204
    @Override
200 205
    public void saveToState(PersistentState state) throws PersistenceException {
201 206
    	if (isLibrarySymbol()){
202 207
    		state.set(SOURCE_SYMBOL_IN_LIBRARY, getSourceSymbolInLibrary());
......
208 213

  
209 214
    public static class RegisterPersistence implements Callable {
210 215

  
216
        @Override
211 217
        public Object call() throws Exception {
212 218
            PersistenceManager manager = ToolsLocator.getPersistenceManager();
213 219
            if (manager.getDefinition(SVG_STYLE_PERSISTENCE_DEFINITION_NAME) == null) {

Also available in: Unified diff