Commit 60fbe89d authored by lafabregue's avatar lafabregue

small fixes (OGR export, Iterative interface fix)

parent 226b3694
...@@ -1148,8 +1148,9 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen ...@@ -1148,8 +1148,9 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
//<< //<<
if (classification instanceof HybridClassification) { if (classification instanceof HybridClassification) {
FileWriter fw3 = null; FileWriter fw3 = null;
String concordenceFilePath = "concordence.log";
try { try {
fw3 = new FileWriter("_concordence.log", true); fw3 = new FileWriter(concordenceFilePath, true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -1161,6 +1162,8 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen ...@@ -1161,6 +1162,8 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
eval.calGamma(((HybridClassification) classification).getAgents(), eval.calGamma(((HybridClassification) classification).getAgents(),
((HybridClassification) classification).getConfig(), null); ((HybridClassification) classification).getConfig(), null);
out3.println(Arrays.deepToString(eval.omega)); out3.println(Arrays.deepToString(eval.omega));
File concoredenceFile = new File(concordenceFilePath);
Packager.zipFile(out, name + "/"+concordenceFilePath, concoredenceFile);
} }
//>> //>>
......
...@@ -357,13 +357,14 @@ public class HybridClassificationSubParametersPanel extends JPanel { ...@@ -357,13 +357,14 @@ public class HybridClassificationSubParametersPanel extends JPanel {
*/ */
private void initToClassification() { private void initToClassification() {
if (samarah != null) { if (samarah != null) {
if (samarah.config.nInf < 0 || samarah.config.nSup < 0) { if (samarah.config.nInf <= 0 && samarah.config.nSup <= 0) {
jCheckBoxNbClasses.setSelected(false); jCheckBoxNbClasses.setSelected(false);
jTextFieldNInf.setEnabled(false); jTextFieldNInf.setEnabled(false);
jTextFieldNSup.setEnabled(false); jTextFieldNSup.setEnabled(false);
jTextFieldNInf.setText(""); jTextFieldNInf.setText("");
jTextFieldNSup.setText(""); jTextFieldNSup.setText("");
} else { } else {
nbClass = true;
jCheckBoxNbClasses.setSelected(true); jCheckBoxNbClasses.setSelected(true);
jTextFieldNInf.setEnabled(true); jTextFieldNInf.setEnabled(true);
jTextFieldNSup.setEnabled(true); jTextFieldNSup.setEnabled(true);
......
...@@ -71,10 +71,12 @@ public class DataOGRExchange { ...@@ -71,10 +71,12 @@ public class DataOGRExchange {
for (int i = 0 ; i < data.getOneDataObject().getAttributes().length ; i++ ) { for (int i = 0 ; i < data.getOneDataObject().getAttributes().length ; i++ ) {
Attribute attr = data.getOneDataObject().getAttribute(0); Attribute attr = data.getOneDataObject().getAttribute(0);
if (attr instanceof AttributeNumerical) { if (attr instanceof AttributeNumerical) {
layer.CreateField(new FieldDefn("band_"+i, ogr.OFTReal)); //$NON-NLS-1$ layer.CreateField(new FieldDefn("band"+i, ogr.OFTReal)); //$NON-NLS-1$
} else if (attr instanceof AttributeMultiDimSequence) { } else if (attr instanceof AttributeMultiDimSequence) {
for (int j = 0 ; j < ((AttributeMultiDimSequence) attr).getSequence().length ; j++) { for (int j = 0 ; j < ((AttributeMultiDimSequence) attr).getSequence().length ; j++) {
layer.CreateField(new FieldDefn("band_"+i+"im_"+j, ogr.OFTReal)); //$NON-NLS-1$ //$NON-NLS-2$ for (int k = 0 ; k < ((AttributeMultiDimSequence) attr).getSequence()[j].length ; k++) {
layer.CreateField(new FieldDefn(i+"band"+k+"im"+j, ogr.OFTReal)); //$NON-NLS-1$ //$NON-NLS-2$
}
} }
} }
} }
...@@ -119,6 +121,7 @@ public class DataOGRExchange { ...@@ -119,6 +121,7 @@ public class DataOGRExchange {
int width = dataset.GetRasterXSize(); int width = dataset.GetRasterXSize();
int x = k % width; int x = k % width;
int y = k / width; int y = k / width;
dataset.delete();
return (geoTransform[0] + x*geoTransform[1] + y*geoTransform[2]) + " " + //$NON-NLS-1$ return (geoTransform[0] + x*geoTransform[1] + y*geoTransform[2]) + " " + //$NON-NLS-1$
(geoTransform[3] + x*geoTransform[4] + y*geoTransform[5]); (geoTransform[3] + x*geoTransform[4] + y*geoTransform[5]);
} }
...@@ -135,11 +138,11 @@ public class DataOGRExchange { ...@@ -135,11 +138,11 @@ public class DataOGRExchange {
private static void setField(Feature feature, Attribute attr, int i) { private static void setField(Feature feature, Attribute attr, int i) {
if (attr instanceof AttributeNumerical) { if (attr instanceof AttributeNumerical) {
feature.SetField("band_"+i, attr.getValue()); //$NON-NLS-1$ feature.SetField("band"+i, attr.getValue()); //$NON-NLS-1$
} else if (attr instanceof AttributeMultiDimSequence) { } else if (attr instanceof AttributeMultiDimSequence) {
for (int j = 0 ; j < ((AttributeMultiDimSequence) attr).getSequence().length ; j++) { for (int j = 0 ; j < ((AttributeMultiDimSequence) attr).getSequence().length ; j++) {
for (int k = 0 ; k < ((AttributeMultiDimSequence) attr).getSequence()[j].length ; k++) { for (int k = 0 ; k < ((AttributeMultiDimSequence) attr).getSequence()[j].length ; k++) {
feature.SetField("band_"+i+"im_"+j, ((AttributeMultiDimSequence) attr).getSequence()[j][k]); //$NON-NLS-1$ //$NON-NLS-2$ feature.SetField(i+"band"+k+"im"+j, ((AttributeMultiDimSequence) attr).getSequence()[j][k]); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment