Revision 2348 org.gvsig.raster/branches/org.gvsig.raster_dataaccess_refactoring/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/grid/filter/convolution/ConvolutionListManager.java
ConvolutionListManager.java | ||
---|---|---|
91 | 91 |
} |
92 | 92 |
} |
93 | 93 |
|
94 |
/*public List<String> getStringsFromFilterList(List<String> filterList, RasterFilter rf) { |
|
95 |
if (rf instanceof ConvolutionFilter) { |
|
96 |
filterList.add("filter.convolution.active=true"); |
|
97 |
ConvolutionFilter convolutionFilter = (ConvolutionFilter) rf; |
|
98 |
switch (convolutionFilter.ladoVentana) { |
|
99 |
case 0: |
|
100 |
filterList.add("filter.convolution.ladoVentana=3"); |
|
101 |
break; |
|
102 |
case 1: |
|
103 |
filterList.add("filter.convolution.ladoVentana=5"); |
|
104 |
break; |
|
105 |
case 2: |
|
106 |
filterList.add("filter.convolution.ladoVentana=7"); |
|
107 |
break; |
|
108 |
} |
|
109 |
|
|
110 |
filterList.add("filter.convolution.filterName=" + convolutionFilter.getName()); |
|
111 |
if (convolutionFilter.getName().equals("personalizado")) { |
|
112 |
double[][] listDouble = convolutionFilter.kernel.kernel; |
|
113 |
String listString = ""; |
|
114 |
for (int i = 0; i < listDouble.length; i++) |
|
115 |
for (int j = 0; j < listDouble[0].length; j++) |
|
116 |
listString = listString + listDouble[i][j] + " "; |
|
117 |
|
|
118 |
listString = listString.trim(); |
|
119 |
filterList.add("filter.convolution.kernel=" + listString); |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
return filterList; |
|
124 |
}*/ |
|
125 |
|
|
126 |
/*public int createFilterListFromStrings(List<String> filters, String fil, int filteri) throws FilterTypeException { |
|
127 |
if ((fil.startsWith("filter.convolution.active")) && (RasterFilterListManagerImpl.getValue(fil).equals("true"))) { |
|
128 |
int ladoVentana = 0; |
|
129 |
double agudeza = 0; |
|
130 |
String name = ""; |
|
131 |
Kernel kernel = null; |
|
132 |
filters.remove(0); |
|
133 |
for (int prop = 0; prop < filters.size(); prop++) { |
|
134 |
String elem = (String) filters.get(prop); |
|
135 |
if (elem.startsWith("filter.convolution.ladoVentana")) { |
|
136 |
ladoVentana = Integer.parseInt(RasterFilterListManagerImpl.getValue(elem)); |
|
137 |
ladoVentana = (ladoVentana == 7) ? 2 : (ladoVentana == 5) ? 1 : 0; |
|
138 |
filters.remove(prop); |
|
139 |
prop--; |
|
140 |
} |
|
141 |
if (elem.startsWith("filter.convolution.filterName")) { |
|
142 |
name = RasterFilterListManagerImpl.getValue(elem); |
|
143 |
filters.remove(prop); |
|
144 |
prop--; |
|
145 |
} |
|
146 |
if (elem.startsWith("filter.convolution.kernel")) { |
|
147 |
String k = RasterFilterListManagerImpl.getValue(elem); |
|
148 |
String[] listString = k.split(" "); |
|
149 |
if (listString != null) { |
|
150 |
int lado = (ladoVentana == 0) ? 3 : (ladoVentana == 1) ? 5 : 7; |
|
151 |
double[][] listDouble = new double[lado][lado]; |
|
152 |
int cont = 0; |
|
153 |
for (int i = 0; i < lado; i++) { |
|
154 |
for (int j = 0; j < lado; j++) { |
|
155 |
try { |
|
156 |
listDouble[i][j] = Double.parseDouble(listString[cont]); |
|
157 |
cont++; |
|
158 |
} catch (NumberFormatException e) { |
|
159 |
} |
|
160 |
} |
|
161 |
} |
|
162 |
kernel = new Kernel(listDouble); |
|
163 |
} |
|
164 |
filters.remove(prop); |
|
165 |
prop--; |
|
166 |
} |
|
167 |
if (elem.startsWith("filter.convolution.agudeza")) { |
|
168 |
agudeza = Double.parseDouble(RasterFilterListManagerImpl.getValue(elem)); |
|
169 |
filters.remove(prop); |
|
170 |
prop--; |
|
171 |
} |
|
172 |
} |
|
173 |
addConvolutionFilter(name, ladoVentana, agudeza, kernel); |
|
174 |
} |
|
175 |
return filteri; |
|
176 |
}*/ |
|
177 |
|
|
178 | 94 |
public void addFilter(Class<?> classFilter, Params params) throws FilterTypeException { |
179 | 95 |
if (ConvolutionFilter.class.isAssignableFrom(classFilter)) { |
180 | 96 |
int ladoVentana = 0; |
Also available in: Unified diff