Révision 1709
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swing/SVGPanel.java (revision 1709) | ||
---|---|---|
28 | 28 |
package org.txm.chartsengine.svgbatik.rcp.swing; |
29 | 29 |
|
30 | 30 |
|
31 |
import java.awt.BorderLayout; |
|
32 | 31 |
import java.awt.event.InputEvent; |
33 | 32 |
import java.awt.event.MouseEvent; |
34 | 33 |
import java.awt.event.MouseWheelEvent; |
... | ... | |
36 | 35 |
import java.awt.geom.AffineTransform; |
37 | 36 |
import java.util.List; |
38 | 37 |
|
39 |
import javax.swing.JPanel; |
|
40 |
|
|
41 | 38 |
import org.apache.batik.swing.JSVGCanvas; |
42 | 39 |
import org.apache.batik.swing.gvt.AbstractImageZoomInteractor; |
43 | 40 |
import org.apache.batik.swing.gvt.AbstractPanInteractor; |
... | ... | |
48 | 45 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
49 | 46 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
50 | 47 |
import org.txm.chartsengine.rcp.events.ChartKeyListener; |
51 |
import org.w3c.dom.svg.SVGDocument; |
|
52 | 48 |
|
53 | 49 |
/** |
54 | 50 |
* SVG Batik SVG canvas swing panel. |
55 | 51 |
*/ |
56 | 52 |
public class SVGPanel extends JSVGCanvas implements IChartComponent { |
57 | 53 |
|
58 |
protected boolean squareOffEnabled; |
|
59 |
|
|
60 | 54 |
/** |
61 | 55 |
* The linked editor. |
62 | 56 |
*/ |
... | ... | |
68 | 62 |
private static final long serialVersionUID = -4381954167495751486L; |
69 | 63 |
|
70 | 64 |
/** |
71 |
* The Batik SVG canvas. |
|
72 |
*/ |
|
73 |
//protected JSVGCanvas svgCanvas; |
|
74 |
|
|
75 |
|
|
76 |
/** |
|
77 | 65 |
* Current zoom value. |
78 | 66 |
*/ |
79 | 67 |
int zoom = 0; |
... | ... | |
213 | 201 |
|
214 | 202 |
} |
215 | 203 |
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
// |
|
221 |
// |
|
222 |
// /** |
|
223 |
// * Loads SVG document from the specified URL. |
|
224 |
// * |
|
225 |
// * @param url the url |
|
226 |
// */ |
|
227 |
// public void loadSVGDocument(String url) { |
|
228 |
// this.svgCanvas.loadSVGDocument(url); |
|
229 |
// } |
|
230 |
// |
|
231 |
// |
|
232 |
// /** |
|
233 |
// * Returns the SVG document. |
|
234 |
// * @return |
|
235 |
// */ |
|
236 |
// public SVGDocument getSVGDocument() { |
|
237 |
// return this.svgCanvas.getSVGDocument(); |
|
238 |
// } |
|
239 |
|
|
240 |
|
|
241 | 204 |
// ---------------------------------------------------------------------- |
242 | 205 |
// Interactors |
243 | 206 |
// ---------------------------------------------------------------------- |
... | ... | |
303 | 266 |
} |
304 | 267 |
}; |
305 | 268 |
|
306 |
|
|
307 |
// /** |
|
308 |
// * @return the svgCanvas |
|
309 |
// */ |
|
310 |
// public JSVGCanvas getSVGCanvas() { |
|
311 |
// return svgCanvas; |
|
312 |
// } |
|
313 |
// |
|
314 |
|
|
315 |
|
|
316 |
|
|
317 | 269 |
/** |
318 | 270 |
* Resets pan and zoom. |
319 | 271 |
*/ |
... | ... | |
322 | 274 |
AffineTransform trans = AffineTransform.getTranslateInstance(0, 0); |
323 | 275 |
trans.scale(1, 1); |
324 | 276 |
this.setRenderingTransform(trans); |
325 |
|
|
326 |
// Square unit axis ratio constraint |
|
327 |
if(this.squareOffEnabled) { |
|
328 |
this.squareOff(); |
|
329 |
} |
|
330 | 277 |
} |
331 | 278 |
|
332 | 279 |
|
... | ... | |
420 | 367 |
|
421 | 368 |
} |
422 | 369 |
|
423 |
|
|
424 |
// @Override |
|
425 |
// public void setSquareOffEnabled(boolean enabled) { |
|
426 |
// this.squareOffEnabled = enabled; |
|
427 |
// } |
|
428 |
|
|
429 |
|
|
430 | 370 |
@Override |
431 | 371 |
public void squareOff() { |
432 | 372 |
// not needed in this implementation |
Formats disponibles : Unified diff