Revision 15782
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/clipping/panels/ClippingSelectionPanel.java | ||
---|---|---|
32 | 32 |
import com.iver.andami.PluginServices; |
33 | 33 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
34 | 34 |
/** |
35 |
* Panel de seleccion de que bandas. Permite seleccionar que bandas se van a |
|
36 |
* guardar y especificar su orden. |
|
35 | 37 |
* |
36 | 38 |
* @version 25/09/2007 |
37 | 39 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
... | ... | |
59 | 61 |
*/ |
60 | 62 |
public TableContainer getTableContainer() { |
61 | 63 |
if (tableContainer == null) { |
62 |
String[] columnNames = {PluginServices.getText(this, "bandas"), PluginServices.getText(this, "nombre")}; |
|
63 |
int[] columnWidths = {75, 305};
|
|
64 |
String[] columnNames = {PluginServices.getText(this, "bandas"), PluginServices.getText(this, "nombre"), ""};
|
|
65 |
int[] columnWidths = {55, 305, 0};
|
|
64 | 66 |
tableContainer = new TableContainer(columnNames, columnWidths); |
65 | 67 |
tableContainer.setModel("CheckBoxModel"); |
66 | 68 |
tableContainer.initialize(); |
67 | 69 |
tableContainer.setControlVisible(false); |
68 | 70 |
tableContainer.setMoveRowsButtonsVisible(true); |
71 |
|
|
72 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(2).setMinWidth(0); |
|
73 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(2).setMaxWidth(0); |
|
74 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(0).setMinWidth(55); |
|
75 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(0).setMaxWidth(55); |
|
76 |
|
|
69 | 77 |
} |
70 | 78 |
|
71 | 79 |
return tableContainer; |
... | ... | |
78 | 86 |
public void setLayer(FLayer fLayer) { |
79 | 87 |
// Rellenar el arbol de bandas |
80 | 88 |
IRasterDataSource mDataset = ((FLyrRasterSE) fLayer).getDataSource(); |
89 |
int cont = 0; |
|
81 | 90 |
for (int i = 0; i < mDataset.getDatasetCount(); i++) { |
82 | 91 |
String fName = mDataset.getDataset(i)[0].getFName(); |
83 | 92 |
String bandName = new File(fName).getName(); |
84 | 93 |
|
85 | 94 |
if (mDataset.getDataset(i)[0].getBandCount() > 1) { |
86 | 95 |
for (int b = 0; b < mDataset.getDataset(i)[0].getBandCount(); b++) { |
87 |
Object row[] = { new Boolean(true), new String("B" + (b + 1) + " - " + bandName) };
|
|
96 |
Object row[] = { new Boolean(true), new String("B" + (b + 1) + " - " + bandName), new Integer(cont++)};
|
|
88 | 97 |
try { |
89 | 98 |
getTableContainer().addRow(row); |
90 | 99 |
} catch (NotInitializeException e) { |
... | ... | |
92 | 101 |
} |
93 | 102 |
} |
94 | 103 |
} else { |
95 |
Object row[] = { new Boolean(true), new String("B - " + bandName) };
|
|
104 |
Object row[] = { new Boolean(true), new String("B - " + bandName), new Integer(cont++)};
|
|
96 | 105 |
try { |
97 | 106 |
getTableContainer().addRow(row); |
98 | 107 |
} catch (NotInitializeException e) { |
... | ... | |
101 | 110 |
} |
102 | 111 |
} |
103 | 112 |
} |
104 |
}
|
|
113 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/clipping/ClippingProcess.java | ||
---|---|---|
52 | 52 |
import org.gvsig.raster.util.RasterUtilities; |
53 | 53 |
import org.gvsig.rastertools.IProcessActions; |
54 | 54 |
import org.gvsig.rastertools.RasterModule; |
55 |
import org.gvsig.rastertools.saveraster.ui.info.EndInfoDialog; |
|
56 |
|
|
57 |
import com.iver.andami.PluginServices; |
|
58 | 55 |
/** |
59 | 56 |
* <code>ClippingProcess</code> es un proceso que usa un <code>Thread</code> |
60 | 57 |
* para calcular el recorte de una capa. |
... | ... | |
63 | 60 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
64 | 61 |
*/ |
65 | 62 |
public class ClippingProcess implements IncrementableListener, Runnable { |
66 |
private String fileName = "";
|
|
67 |
private IncrementableTask incrementableTask = null;
|
|
68 |
private volatile Thread blinker = null;
|
|
69 |
private WriterBufferServer writerBufferServer = null;
|
|
70 |
private FLyrRasterSE rasterSE = null;
|
|
71 |
private AffineTransform affineTransform = new AffineTransform();
|
|
72 |
private boolean oneLayerPerBand = false;
|
|
73 |
private int[] drawableBands = { 0, 1, 2 };
|
|
74 |
private int[] dValues = null;
|
|
75 |
private GeoRasterWriter grw = null;
|
|
76 |
private int interpolationMethod = BufferInterpolation.INTERPOLATION_Undefined;
|
|
77 |
private boolean loadedInToc = true;
|
|
78 |
private String viewName = "";
|
|
79 |
private Params params = null;
|
|
80 |
private RasterTask rasterTask = new RasterTask(this);
|
|
81 |
private IProcessActions externalActions = null;
|
|
63 |
private String fileName = ""; |
|
64 |
private IncrementableTask incrementableTask = null; |
|
65 |
private volatile Thread blinker = null; |
|
66 |
private WriterBufferServer writerBufferServer = null; |
|
67 |
private FLyrRasterSE rasterSE = null; |
|
68 |
private AffineTransform affineTransform = new AffineTransform(); |
|
69 |
private boolean oneLayerPerBand = false; |
|
70 |
private int[] drawableBands = { 0, 1, 2 }; |
|
71 |
private int[] dValues = null; |
|
72 |
private GeoRasterWriter grw = null; |
|
73 |
private int interpolationMethod = BufferInterpolation.INTERPOLATION_Undefined; |
|
74 |
private boolean loadedInToc = true; |
|
75 |
private String viewName = ""; |
|
76 |
private Params params = null; |
|
77 |
private RasterTask rasterTask = new RasterTask(this); |
|
78 |
private IProcessActions externalActions = null;
|
|
82 | 79 |
|
83 | 80 |
/** |
84 | 81 |
* Variables de la resoluci?n de salida |
85 | 82 |
*/ |
86 |
private int resolutionWidth = 0, resolutionHeight = 0; |
|
83 |
private int resolutionWidth = 0; |
|
84 |
private int resolutionHeight = 0; |
|
87 | 85 |
|
88 | 86 |
/** |
89 | 87 |
* Crea un <code>ClippingProcess</code> para generar un recorte |
... | ... | |
162 | 160 |
public void run() { |
163 | 161 |
try { |
164 | 162 |
RasterTaskQueue.register(rasterTask); |
165 |
|
|
163 |
|
|
166 | 164 |
long t2; |
167 |
long t1 = new java.util.Date().getTime();
|
|
165 |
long t1 = new java.util.Date().getTime();
|
|
168 | 166 |
|
169 | 167 |
IRasterDataSource d = rasterSE.getDataSource().copy(); |
170 | 168 |
BufferFactory bufferFactory = new BufferFactory(d); |
... | ... | |
189 | 187 |
Logger.getLogger(this.getClass().getName()).debug("No se ha podido asignar la vista al inicial el proceso de recorte.", e); |
190 | 188 |
} |
191 | 189 |
} |
192 |
//TODO: FUNCIONALIDAD: Poner los gerWriter con la proyecci?n del fichero fuente
|
|
190 |
//TODO: FUNCIONALIDAD: Poner los getWriter con la proyecci?n del fichero fuente
|
|
193 | 191 |
String finalFileName = ""; |
194 | 192 |
if (isOneLayerPerBand()) { |
195 | 193 |
for (int i = 0; i < drawableBands.length; i++) { |
... | ... | |
241 | 239 |
RasterTaskQueue.remove(rasterTask); |
242 | 240 |
if (incrementableTask != null) |
243 | 241 |
incrementableTask.processFinalize(); |
244 |
if(externalActions != null) |
|
242 |
if (externalActions != null)
|
|
245 | 243 |
externalActions.interrupted(); |
246 | 244 |
} |
247 | 245 |
} |
... | ... | |
276 | 274 |
*/ |
277 | 275 |
public void actionSuspended(IncrementableEvent e) { |
278 | 276 |
} |
279 |
|
|
280 |
/** |
|
281 |
* Lanza la ventana de informaci?n cuando acaba el proceso de |
|
282 |
* guardado |
|
283 |
* @param fName Nombre del archivo |
|
284 |
* @param milis Tiempo que ha tardado el proceso en milisegundos |
|
285 |
*/ |
|
286 |
private void setEndInfo(String fName, long milis){ |
|
287 |
EndInfoDialog info = new EndInfoDialog(); |
|
288 |
info.setFileName(fName); |
|
289 |
File f = new File(fName); |
|
290 |
info.setSize(RasterUtilities.formatFileSize(f.length())); |
|
291 |
info.setTime(RasterUtilities.formatTime(milis)); |
|
292 |
if (fName.endsWith("ecw") || |
|
293 |
fName.endsWith("jp2") || |
|
294 |
fName.endsWith("jpg") || |
|
295 |
fName.endsWith("jpeg")) |
|
296 |
info.setCompression(true); |
|
297 |
else |
|
298 |
info.setCompression(false); |
|
299 |
PluginServices.getMDIManager().addWindow(info); |
|
300 |
} |
|
301 | 277 |
|
302 | 278 |
/** |
303 | 279 |
* Acciones que se realizan al finalizar de crear los recortes de imagen. |
... | ... | |
306 | 282 |
private void cutFinalize(String fileName, long milis) { |
307 | 283 |
if (!isLoadedInToc()) { |
308 | 284 |
externalActions.end(new Object[]{fileName, new Long(milis)}); |
309 |
setEndInfo(fileName, milis); |
|
310 | 285 |
return; |
311 | 286 |
} |
312 | 287 |
if (!new File(fileName).exists()) |
... | ... | |
320 | 295 |
if (externalActions != null) { |
321 | 296 |
RasterModule.layerCount++; |
322 | 297 |
externalActions.end(new Object[]{fileName, new Long(milis)}); |
323 |
setEndInfo(fileName, milis); |
|
324 | 298 |
} |
325 | 299 |
} |
326 | 300 |
|
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/clipping/ui/listener/ClippingPanelListener.java | ||
---|---|---|
53 | 53 |
import org.gvsig.rastertools.clipping.panels.ClippingResolutionPanel; |
54 | 54 |
import org.gvsig.rastertools.clipping.panels.ClippingSelectionPanel; |
55 | 55 |
import org.gvsig.rastertools.clipping.ui.ClippingPanel; |
56 |
import org.gvsig.rastertools.saveraster.ui.info.EndInfoDialog; |
|
56 | 57 |
|
57 | 58 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
58 | 59 |
import com.iver.andami.PluginServices; |
... | ... | |
569 | 570 |
int[] drawableBands = new int[countBands]; |
570 | 571 |
int i = 0; |
571 | 572 |
for (int iRow = 0; iRow < rowCount; iRow++) { |
572 |
if ((((Boolean) ((CheckBoxModel) getSelectionPanel().getTableContainer().getModel()).getValueAt(iRow, 0))).booleanValue()) |
|
573 |
drawableBands[i++] = iRow; |
|
573 |
if ((((Boolean) ((CheckBoxModel) getSelectionPanel().getTableContainer().getModel()).getValueAt(iRow, 0))).booleanValue()) { |
|
574 |
int row = ((Integer) ((CheckBoxModel) getSelectionPanel().getTableContainer().getModel()).getValueAt(iRow, 2)).intValue(); |
|
575 |
drawableBands[i++] = row; |
|
576 |
} |
|
574 | 577 |
} |
575 | 578 |
|
576 | 579 |
/** |
... | ... | |
746 | 749 |
enableValueChangedEvent = true; |
747 | 750 |
} |
748 | 751 |
|
752 |
/** |
|
753 |
* Lanza la ventana de informaci?n cuando acaba el proceso de |
|
754 |
* guardado |
|
755 |
* @param fName Nombre del archivo |
|
756 |
* @param milis Tiempo que ha tardado el proceso en milisegundos |
|
757 |
*/ |
|
758 |
private void setEndInfo(String fName, long milis) { |
|
759 |
EndInfoDialog info = new EndInfoDialog(); |
|
760 |
info.setFileName(fName); |
|
761 |
File f = new File(fName); |
|
762 |
info.setSize(RasterUtilities.formatFileSize(f.length())); |
|
763 |
info.setTime(RasterUtilities.formatTime(milis)); |
|
764 |
if (fName.endsWith("ecw") || |
|
765 |
fName.endsWith("jp2") || |
|
766 |
fName.endsWith("jpg") || |
|
767 |
fName.endsWith("jpeg")) |
|
768 |
info.setCompression(true); |
|
769 |
else |
|
770 |
info.setCompression(false); |
|
771 |
PluginServices.getMDIManager().addWindow(info); |
|
772 |
} |
|
773 |
|
|
749 | 774 |
/* |
750 | 775 |
* (non-Javadoc) |
751 | 776 |
* @see org.gvsig.rastertools.IProcessActions#end() |
... | ... | |
753 | 778 |
public void end(Object params) { |
754 | 779 |
if (getClippingPanel() != null) |
755 | 780 |
getOptionsPanel().setNewLayerText(); |
781 |
|
|
782 |
if (params instanceof Object[] && |
|
783 |
((Object[]) params).length == 2 && |
|
784 |
((Object[]) params)[0] instanceof String && |
|
785 |
((Object[]) params)[1] instanceof Long) { |
|
786 |
|
|
787 |
String fName = (String) ((Object[]) params)[0]; |
|
788 |
long milis = ((Long) ((Object[]) params)[1]).longValue(); |
|
789 |
|
|
790 |
setEndInfo(fName, milis); |
|
791 |
} |
|
756 | 792 |
} |
757 | 793 |
|
758 | 794 |
public void rectangle(RectangleEvent event) throws BehaviorException {} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/saveraster/operations/SaveRasterProcess.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
import com.iver.andami.PluginServices; |
48 | 48 |
import com.iver.cit.gvsig.fmap.ViewPort; |
49 |
|
|
50 | 49 |
/** |
51 |
* Thread que se encarga de llamar a los writer para realizar la tarea |
|
52 |
* de salvado y/p compresi?n |
|
53 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
50 |
* Thread que se encarga de llamar a los writer para realizar la tarea de |
|
51 |
* salvado y/p compresi?n |
|
52 |
* |
|
53 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
54 | 54 |
*/ |
55 | 55 |
public class SaveRasterProcess implements Runnable, IncrementableListener { |
56 |
|
|
57 |
private GeoRasterWriter writer = null; |
|
58 |
private ViewPort vp = null; |
|
59 |
private Dimension dimension = null; |
|
60 |
private RasterizerLayer rasterizer = null; |
|
61 |
private String fName = ""; |
|
62 |
private Params params = null; |
|
63 |
private IncrementableTask incrementableTask = null; |
|
64 |
private volatile Thread blinker = null; |
|
65 |
private RasterTask rasterTask = new RasterTask(this); |
|
66 |
private IProcessActions externalActions = null; |
|
56 |
private GeoRasterWriter writer = null; |
|
57 |
private ViewPort vp = null; |
|
58 |
private Dimension dimension = null; |
|
59 |
private RasterizerLayer rasterizer = null; |
|
60 |
private String fName = ""; |
|
61 |
private Params params = null; |
|
62 |
private IncrementableTask incrementableTask = null; |
|
63 |
private volatile Thread blinker = null; |
|
64 |
private RasterTask rasterTask = new RasterTask(this); |
|
65 |
private IProcessActions externalActions = null; |
|
67 | 66 |
|
68 | 67 |
/** |
69 | 68 |
* Constructor |
... | ... | |
231 | 230 |
} |
232 | 231 |
|
233 | 232 |
/** |
234 |
* Acciones que se realizan al finalizar de salvar a raster. |
|
235 |
* @param fileName Nombre del fichero |
|
236 |
* @param milis Tiempo que ha tardado en ejecutarse |
|
237 |
*/ |
|
238 |
private void saveRasterFinalize(String fileName, long milis) { |
|
239 |
externalActions.end(new Object[]{fileName, new Long(milis)}); |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 | 233 |
* Obtiene el objeto para ejecutar acciones externar. |
244 | 234 |
* @param IProcessActions |
245 | 235 |
*/ |
... | ... | |
254 | 244 |
public void setActions(IProcessActions actions) { |
255 | 245 |
this.externalActions = actions; |
256 | 246 |
} |
257 |
} |
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
|
247 |
} |
Also available in: Unified diff