Revision 20101
branches/v10/extensions/extRasterTools/src/org/gvsig/rasterTools/saveRaster/ui/listener/SaveRasterListener.java | ||
---|---|---|
57 | 57 |
|
58 | 58 |
|
59 | 59 |
/** |
60 |
* Extensi?n de la clase SaveRasterListenerImpl de FMap para poder llamar a m?todos |
|
61 |
* de andami o de gvSIG. |
|
60 |
* <p>Listener for saving a rectangular area of a raster layer in the associated {@link MapControl MapControl} |
|
61 |
* object.</p> |
|
62 |
* |
|
63 |
* @see SaveRasterListenerImpl |
|
62 | 64 |
* |
63 | 65 |
* @author Nacho Brodin <brodin_ign@gva.es> |
64 | 66 |
*/ |
65 | 67 |
public class SaveRasterListener extends SaveRasterListenerImpl { |
66 |
|
|
68 |
/** |
|
69 |
* <p>Reference to the raster layer.</p> |
|
70 |
*/ |
|
67 | 71 |
FLyrRaster layer = null; |
68 |
|
|
72 |
|
|
73 |
/** |
|
74 |
* <p>Creates a new <code>SaveRasterListener</code> object.</p> |
|
75 |
* |
|
76 |
* @param mapCtrl the <code>MapControl</code> where is defined the rectangle |
|
77 |
*/ |
|
69 | 78 |
public SaveRasterListener(MapControl mapCtrl) { |
70 | 79 |
super(mapCtrl); |
71 | 80 |
} |
72 |
|
|
81 |
|
|
73 | 82 |
/** |
83 |
* <p>Sets the raster layer from where a rectangular area will be saved.</p> |
|
74 | 84 |
* |
75 |
* @param flyr |
|
85 |
* @param flyr layer with raster data
|
|
76 | 86 |
*/ |
77 | 87 |
public void setRasterLayer(FLyrRaster flyr){ |
78 | 88 |
layer = flyr; |
79 | 89 |
} |
80 |
|
|
90 |
|
|
91 |
/* |
|
92 |
* (non-Javadoc) |
|
93 |
* @see org.gvsig.rasterTools.saveRaster.tools.SaveRasterListenerImpl#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent) |
|
94 |
*/ |
|
81 | 95 |
public void rectangle(RectangleEvent event) { |
82 | 96 |
super.rectangle(event); |
83 | 97 |
|
branches/v10/extensions/extRasterTools/src/org/gvsig/rasterTools/saveRaster/tools/SaveRasterListenerImpl.java | ||
---|---|---|
56 | 56 |
|
57 | 57 |
|
58 | 58 |
/** |
59 |
* Implementaci?n de la interfaz RectangleListener como herramienta para
|
|
60 |
* realizar un Salvado a Raster.
|
|
61 |
* |
|
62 |
* @author Nacho Brodin <brodin_ign@gva.es> |
|
63 |
*/ |
|
59 |
* <p>Generic listener for saving a rectangular area of raster layers in the associated {@link MapControl MapControl}
|
|
60 |
* object. This version only stores the rectangle defined, in pixel and real coordinates, without saving any image.</p>
|
|
61 |
*
|
|
62 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
|
63 |
*/
|
|
64 | 64 |
public class SaveRasterListenerImpl implements RectangleListener { |
65 |
/** |
|
66 |
* The image to display when the cursor is active. |
|
67 |
*/ |
|
65 | 68 |
private final Image isaveraster = new ImageIcon(MapControl.class.getResource( |
66 | 69 |
"images/RectSelectCursor.gif")).getImage(); |
70 |
|
|
71 |
/** |
|
72 |
* The cursor used to work with this tool listener. |
|
73 |
* |
|
74 |
* @see #getCursor() |
|
75 |
*/ |
|
67 | 76 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(isaveraster, |
68 | 77 |
new Point(16, 16), ""); |
78 |
|
|
79 |
/** |
|
80 |
* Reference to the <code>MapControl</code> object that uses. |
|
81 |
*/ |
|
69 | 82 |
protected MapControl mapCtrl; |
70 |
|
|
83 |
|
|
84 |
/** |
|
85 |
* @see RectangleEvent#getWorldCoordRect() |
|
86 |
*/ |
|
71 | 87 |
protected Rectangle2D pixelRect = null; |
88 |
|
|
89 |
/** |
|
90 |
* @see RectangleEvent#getPixelCoordRect() |
|
91 |
*/ |
|
72 | 92 |
protected Rectangle2D rect = null; |
73 |
|
|
93 |
|
|
74 | 94 |
/** |
75 |
* Crea un nuevo RectangleListenerImpl.
|
|
76 |
* |
|
77 |
* @param mapCtrl MapControl.
|
|
95 |
* <p>Creates a new <code>SaveRasterListenerImpl</code> object.</p>
|
|
96 |
*
|
|
97 |
* @param mapCtrl the <code>MapControl</code> where is defined the rectangle
|
|
78 | 98 |
*/ |
79 | 99 |
public SaveRasterListenerImpl(MapControl mapCtrl) { |
80 | 100 |
this.mapCtrl = mapCtrl; |
81 | 101 |
} |
82 | 102 |
|
83 |
/** |
|
103 |
/* |
|
104 |
* (non-Javadoc) |
|
84 | 105 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent) |
85 | 106 |
*/ |
86 | 107 |
public void rectangle(RectangleEvent event) { |
... | ... | |
88 | 109 |
pixelRect = event.getPixelCoordRect(); |
89 | 110 |
} |
90 | 111 |
|
91 |
/** |
|
112 |
/* |
|
113 |
* (non-Javadoc) |
|
92 | 114 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor() |
93 | 115 |
*/ |
94 | 116 |
public Cursor getCursor() { |
95 | 117 |
return cur; |
96 | 118 |
} |
97 | 119 |
|
98 |
/** |
|
120 |
/* |
|
121 |
* (non-Javadoc) |
|
99 | 122 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing() |
100 | 123 |
*/ |
101 | 124 |
public boolean cancelDrawing() { |
branches/v10/extensions/extRasterTools/src/org/gvsig/rasterTools/exportToGeoRaster/ui/ExportToGeoRasterToolListener.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
|
17 | 17 |
/** |
18 |
* Listener del recorte de raster. Al seleccionar un ?rea sobre la vista debe cargar |
|
19 |
* el cuadro con los datos de coordenadas pixel, coordenadas reales, ancho y alto |
|
20 |
* del raster resultante, tama?o de celda. |
|
18 |
* <p>Listener for saving a rectangular area of the associated {@link MapControl MapControl} |
|
19 |
* object as a raster layer.</p> |
|
20 |
* |
|
21 |
* <p>User configures the parameters of the export via a dialog, before saving the data: |
|
22 |
* <ul> |
|
23 |
* <li>Real coordinates of the rectangular box: <i>upper-left</i> and <i>down-right</i> corners.</li> |
|
24 |
* <li>Bounds of the resultant image calculated from the selected area in pixels.</li> |
|
25 |
* <li>Path and name of the resultant file.</li> |
|
26 |
* </ul> |
|
27 |
* </p> |
|
28 |
* |
|
29 |
* @see SaveRasterListenerImpl |
|
30 |
* @see ExportToGeoRasterDialog |
|
21 | 31 |
*/ |
22 | 32 |
public class ExportToGeoRasterToolListener extends SaveRasterListenerImpl { |
33 |
/** |
|
34 |
* <p>Reference to the raster layer.</p> |
|
35 |
*/ |
|
23 | 36 |
private FLyrRaster layer = null; |
37 |
|
|
38 |
/** |
|
39 |
* Dialog to configure the parameters about export. |
|
40 |
*/ |
|
24 | 41 |
private ExportToGeoRasterDialog exportDialog; |
42 |
|
|
43 |
/** |
|
44 |
* Reference to the <code>MapControl</code> object that uses. |
|
45 |
*/ |
|
25 | 46 |
private MapControl mapCtrl = null; |
47 |
|
|
48 |
/** |
|
49 |
* Name of the tool used to interact with the associated <code>MapControl</code> object. |
|
50 |
*/ |
|
26 | 51 |
private String currentTool = null; |
27 | 52 |
|
28 | 53 |
/** |
29 |
* Constructor. |
|
30 |
* @param mapCtrl |
|
31 |
* @param exportDialog |
|
54 |
* <p>Creates a new <code>ExportToGeoRasterToolListener</code> object.</p> |
|
55 |
* |
|
56 |
* @param mapCtrl the <code>MapControl</code> instance where will be defined the rectangle |
|
57 |
* @param exportDialog the dialog with the configurable parameters to save the data inside the |
|
58 |
* rectangle defined, as a file with raster information |
|
32 | 59 |
*/ |
33 | 60 |
public ExportToGeoRasterToolListener(MapControl mapCtrl, ExportToGeoRasterDialog exportDialog) { |
34 | 61 |
super(mapCtrl); |
... | ... | |
39 | 66 |
} |
40 | 67 |
|
41 | 68 |
/** |
42 |
* Asigna la capa raster. |
|
43 |
* @param flyr Capa raster |
|
69 |
* <p>Sets the raster layer from where a rectangular area will be saved.</p> |
|
70 |
* |
|
71 |
* @param flyr layer with raster data |
|
44 | 72 |
*/ |
45 | 73 |
public void setRasterLayer(FLyrRaster flyr){ |
46 | 74 |
layer = flyr; |
47 | 75 |
} |
48 | 76 |
|
49 |
/**
|
|
50 |
* Realiza las acciones de selecci?n del ?rea de recorte por medio de un rectangulo
|
|
51 |
* sobre la vista.
|
|
77 |
/* |
|
78 |
* (non-Javadoc)
|
|
79 |
* @see com.iver.cit.gvsig.fmap.tools.SaveRasterListenerImpl#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent)
|
|
52 | 80 |
*/ |
53 | 81 |
public void rectangle(RectangleEvent event) { |
54 | 82 |
super.rectangle(event); |
Also available in: Unified diff