57 |
57 |
import javax.swing.JOptionPane;
|
58 |
58 |
import javax.swing.JPanel;
|
59 |
59 |
import javax.swing.filechooser.FileFilter;
|
|
60 |
import javax.swing.table.JTableHeader;
|
60 |
61 |
|
61 |
62 |
import org.cresques.cts.IProjection;
|
62 |
63 |
import org.cresques.io.GeoRasterFile;
|
63 |
|
import org.cresques.io.raster.RasterFilter;
|
64 |
64 |
import org.cresques.io.raster.RasterFilterStackManager;
|
65 |
65 |
import org.cresques.px.Extent;
|
66 |
66 |
import org.cresques.ui.raster.BandSetupPanel;
|
... | ... | |
172 |
172 |
* @param status Estado
|
173 |
173 |
*/
|
174 |
174 |
public void restoreStatus(PropertiesRasterDialog props){
|
|
175 |
//Devolvemos la pila de filtros al estado inicial
|
|
176 |
//if(stackManager != null)
|
|
177 |
// stackManager.deleteTempFilters();
|
|
178 |
|
175 |
179 |
//Devolvemos el alpha al estado inicial
|
176 |
180 |
int opac = Integer.parseInt(status.inicAlpha);
|
177 |
181 |
opac = (int)((opac*255)/100);
|
... | ... | |
189 |
193 |
rasterStatus.bandG = status.bandG;
|
190 |
194 |
rasterStatus.bandB = status.bandB;
|
191 |
195 |
}
|
192 |
|
|
|
196 |
|
|
197 |
BandSetupPanel bandSetup = ((FilterRasterDialogPanel)props.getContentPane()).getBandSetup();
|
|
198 |
|
193 |
199 |
//Los que han sido a?adidos los quitamos
|
194 |
200 |
for(int i=0;i<filesAdd.size();i++)
|
195 |
201 |
fLayer.delFile((String)this.filesAdd.get(i));
|
... | ... | |
200 |
206 |
|
201 |
207 |
//Restauramos los filtros
|
202 |
208 |
if(filters!=null)
|
203 |
|
stackManager.createStackFromStrings(filters, ((FLyrRaster)fLayer).getSource().getFiles());
|
|
209 |
stackManager.createStackFromStrings(filters);
|
204 |
210 |
|
205 |
211 |
fLayer.getFMap().invalidate();
|
|
212 |
//this.show();
|
206 |
213 |
}
|
207 |
214 |
|
208 |
215 |
public void show(){
|
... | ... | |
304 |
311 |
this.getAcceptButton().setText(PluginServices.getText(this,"Aceptar"));
|
305 |
312 |
this.getApplyButton().setText(PluginServices.getText(this,"Aplicar"));
|
306 |
313 |
this.getCancelButton().setText(PluginServices.getText(this,"Cancelar"));
|
307 |
|
|
308 |
|
this.getSharpeningPanel().getCbActiveSharpening().setText(PluginServices.getText(this,"onSharpening"));
|
309 |
|
this.getSharpeningPanel().getPSharpNorth().setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"selectBandaRefinado"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
|
310 |
314 |
}
|
311 |
315 |
|
312 |
316 |
/**
|
... | ... | |
520 |
524 |
* @return true si estaba seleccionado el panel de bandas y se ha procesado la
|
521 |
525 |
* acci?n y false si no lo estaba.
|
522 |
526 |
*/
|
523 |
|
public void processBandPanel(){
|
|
527 |
public boolean processBandPanel(){
|
524 |
528 |
//if(this.getTab().getSelectedComponent() == this.getBandSetup()){
|
525 |
529 |
fLayer.getSource().setBand(GeoRasterFile.RED_BAND,
|
526 |
530 |
getAssignedBand(GeoRasterFile.RED_BAND));
|
... | ... | |
545 |
549 |
stackManager.addRemoveBands(sb.toString());
|
546 |
550 |
else
|
547 |
551 |
stackManager.removeFilter(stackManager.getTypeFilter("removebands"));
|
548 |
|
|
549 |
|
//Al reasignar las bandas tenemos que tenerlo en cuenta en el sharpening
|
550 |
|
RasterFilter sharp = stackManager.getFilter("sharpening");
|
551 |
|
if(sharp != null){
|
552 |
|
int[] order = {getAssignedBand(GeoRasterFile.RED_BAND),getAssignedBand(GeoRasterFile.GREEN_BAND),getAssignedBand(GeoRasterFile.BLUE_BAND)};
|
553 |
|
sharp.removeParam("order");
|
554 |
|
sharp.addParam("order", order);
|
555 |
|
}
|
556 |
552 |
fLayer.getFMap().invalidate();
|
|
553 |
return true;
|
557 |
554 |
}
|
558 |
555 |
|
559 |
556 |
/**
|
... | ... | |
562 |
559 |
* @return true si estaba seleccionado el panel de transparencias y se ha procesado la
|
563 |
560 |
* acci?n y false si no lo estaba.
|
564 |
561 |
*/
|
565 |
|
public void processTransparencyPanel(){
|
|
562 |
public boolean processTransparencyPanel(){
|
566 |
563 |
//OPACIDAD
|
567 |
564 |
String sOpac = this.getTransparencyPanel().getOpacityText().getText();
|
568 |
565 |
if(!sOpac.equals("") && this.getTransparencyPanel().getOpacityCheck().isSelected()){
|
... | ... | |
590 |
587 |
}else{
|
591 |
588 |
fLayer.getSource().getFilterStack().removeFilter(stackManager.getTypeFilter("transparency"));
|
592 |
589 |
}
|
593 |
|
|
|
590 |
|
|
591 |
return true;
|
594 |
592 |
}
|
595 |
593 |
|
596 |
594 |
/**
|
... | ... | |
599 |
597 |
* @return true si estaba seleccionado el panel de realce y se ha procesado la
|
600 |
598 |
* acci?n y false si no lo estaba.
|
601 |
599 |
*/
|
602 |
|
public void processEnhancedPanel(){
|
|
600 |
public boolean processEnhancedPanel(){
|
603 |
601 |
//Filtro lineal seleccionado
|
604 |
602 |
if( this.getEnhancedPanel().getLinealDirectoRadioButton().isSelected()){
|
605 |
603 |
if( this.getEnhancedPanel().getRemoveCheck().isSelected() &&
|
... | ... | |
629 |
627 |
stackManager.removeFilter(stackManager.getTypeFilter("enhanced"));
|
630 |
628 |
}
|
631 |
629 |
fLayer.getFMap().invalidate();
|
632 |
|
}
|
633 |
|
|
634 |
|
/**
|
635 |
|
* Pulsar aceptar hace que se procesen los valores introducidos en el panel de
|
636 |
|
* sharpening.
|
637 |
|
* @return true
|
638 |
|
*/
|
639 |
|
public void processSharpeningPanel(){
|
640 |
|
if(this.getSharpeningPanel().getCbActiveSharpening().isSelected()){
|
641 |
|
String pancr = null;
|
642 |
630 |
|
643 |
|
//Obtenemos el nombre de la banda seleccionada
|
644 |
|
for(int i=0;i<(getSharpeningPanel().getRGBTable()).getRowCount();i++){
|
645 |
|
if(((Boolean) (getSharpeningPanel().getRGBTable()).getValueAt(i, 0)).booleanValue())
|
646 |
|
pancr = ((String) (getSharpeningPanel().getRGBTable()).getValueAt(i, 1));
|
647 |
|
}
|
648 |
|
|
649 |
|
//Buscamos el GeoRasterFile que corresponde a la capa y a?adimos el filtro con el
|
650 |
|
if(pancr!=null){
|
651 |
|
pancr = pancr.substring(pancr.lastIndexOf("] ") + 2, pancr.length());
|
652 |
|
for(int i=0; i<fLayer.getSource().getFiles().length;i++){
|
653 |
|
if(fLayer.getSource().getFiles()[i].getName().endsWith(File.separator+pancr)){
|
654 |
|
int[] order = {getAssignedBand(GeoRasterFile.RED_BAND),getAssignedBand(GeoRasterFile.GREEN_BAND),getAssignedBand(GeoRasterFile.BLUE_BAND)};
|
655 |
|
|
656 |
|
int opac = Integer.parseInt(this.getTransparencyPanel().getOpacityText().getText());
|
657 |
|
opac = (int)((opac*255)/100);
|
658 |
|
|
659 |
|
String method = "brovey";
|
660 |
|
if(getSharpeningPanel().getRbHSL().isSelected())
|
661 |
|
method = "hsl";
|
662 |
|
|
663 |
|
double coef = 0D;
|
664 |
|
if(getSharpeningPanel().getRbHSL().isSelected())
|
665 |
|
coef = Double.parseDouble(pSharp.getJTextField().getText());
|
666 |
|
|
667 |
|
int coefBrovey = 0;
|
668 |
|
if(getSharpeningPanel().getRbBrovey().isSelected())
|
669 |
|
coefBrovey = Integer.parseInt(pSharp.getJTextField1().getText());
|
670 |
|
|
671 |
|
stackManager.addSharpeningFilter(fLayer.getSource().getFiles(), i, order, opac, method, coef, coefBrovey);
|
672 |
|
}
|
673 |
|
}
|
674 |
|
|
675 |
|
}
|
676 |
|
}else{
|
677 |
|
stackManager.removeFilter(stackManager.getTypeFilter("sharpening"));
|
678 |
|
}
|
679 |
|
fLayer.getFMap().invalidate();
|
|
631 |
return true;
|
680 |
632 |
}
|
681 |
633 |
|
682 |
634 |
/**
|
... | ... | |
687 |
639 |
private void acceptButtonActionPerformed(ActionEvent e) {
|
688 |
640 |
this.processBandPanel();
|
689 |
641 |
this.processTransparencyPanel();
|
690 |
|
this.processEnhancedPanel();
|
691 |
|
this.processSharpeningPanel();
|
|
642 |
this.processEnhancedPanel();
|
692 |
643 |
}
|
693 |
644 |
|
694 |
645 |
/**
|
... | ... | |
799 |
750 |
v.add(fLayer.getSource().getFiles()[i]);
|
800 |
751 |
}
|
801 |
752 |
|
802 |
|
grf = new GeoRasterFile[v.size()];
|
|
753 |
GeoRasterFile[] grf = new GeoRasterFile[v.size()];
|
803 |
754 |
for(int i=0;i<grf.length;i++){
|
804 |
755 |
grf[i] = (GeoRasterFile)v.get(i);
|
805 |
756 |
}
|
806 |
|
this.addFiles(grf);
|
|
757 |
bandSetup.addFiles(grf);
|
807 |
758 |
}
|
808 |
759 |
}
|
809 |
760 |
|
810 |
761 |
/**
|
811 |
|
* Asigna la lista de GeoRasterFile
|
812 |
|
* @return
|
813 |
|
*/
|
814 |
|
public void setGeoRasterFile(GeoRasterFile[] grf){
|
815 |
|
this.grf = grf;
|
816 |
|
}
|
817 |
|
|
818 |
|
/**
|
819 |
762 |
* Elimina una banda del raster. Si queda solo un fichero o no se ha
|
820 |
763 |
* seleccionado ninguna banda no hace nada.
|
821 |
764 |
* @param e
|
... | ... | |
831 |
774 |
fLayer.delFile(pathName);
|
832 |
775 |
String file = pathName.substring(pathName.lastIndexOf("/")+1);
|
833 |
776 |
file = file.substring(file.lastIndexOf("\\")+1);
|
834 |
|
this.removeFile(file);
|
|
777 |
bandSetup.removeFile(file);
|
835 |
778 |
|
836 |
779 |
//Mantiene la lista de ficheros eliminados por si se cancela
|
837 |
780 |
status.removeFile(pathName);
|