Revision 45309
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.dbf/src/main/java/org/gvsig/fmap/dal/store/dbf/utils/FieldFormatter.java | ||
---|---|---|
197 | 197 |
public String format(BigDecimal n, int size) { |
198 | 198 |
String s = n.toPlainString(); |
199 | 199 |
if (s.length() > size) { |
200 |
throw new BufferOverflowException(); |
|
200 |
int index = s.indexOf('.'); |
|
201 |
if(index < 0 || index >= size ) { |
|
202 |
throw new BufferOverflowException(); |
|
203 |
} |
|
204 |
s = s.substring(0, size); |
|
201 | 205 |
} |
202 | 206 |
return s; |
203 | 207 |
} |
... | ... | |
205 | 209 |
public String format(double n, int size, int scale) { |
206 | 210 |
String s = Double.toString(n); |
207 | 211 |
if (s.length() > size) { |
208 |
throw new BufferOverflowException(); |
|
212 |
if(s.indexOf('E') >= 0){ |
|
213 |
//FIXME: |
|
214 |
throw new BufferOverflowException(); |
|
215 |
} |
|
216 |
int index = s.indexOf('.'); |
|
217 |
if(index < 0 || index >= size ) { |
|
218 |
throw new BufferOverflowException(); |
|
219 |
} |
|
220 |
s = s.substring(0, size); |
|
221 |
|
|
209 | 222 |
} |
210 | 223 |
return s; |
211 | 224 |
} |
... | ... | |
213 | 226 |
public String format(float n, int size, int scale) { |
214 | 227 |
String s = Float.toString(n); |
215 | 228 |
if (s.length() > size) { |
216 |
throw new BufferOverflowException(); |
|
229 |
if(s.indexOf('E') >= 0){ |
|
230 |
//FIXME: |
|
231 |
throw new BufferOverflowException(); |
|
232 |
} |
|
233 |
int index = s.indexOf('.'); |
|
234 |
if(index < 0 || index >= size ) { |
|
235 |
throw new BufferOverflowException(); |
|
236 |
} |
|
237 |
|
|
238 |
s = s.substring(0, size); |
|
217 | 239 |
} |
218 | 240 |
return s; |
219 | 241 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geometrymeasurement.app/org.gvsig.geometrymeasurement.app.mainplugin/src/main/java/org/gvsig/geometrymeasurement/app/extension/utils/Operations.java | ||
---|---|---|
56 | 56 |
|
57 | 57 |
private static final Logger LOG = LoggerFactory.getLogger(Operations.class); |
58 | 58 |
|
59 |
private static final int NUM_DECIMALS = 5; |
|
60 |
|
|
61 | 59 |
public void addDoubleFieldFromOperation(FeatureStore featureStore, |
62 | 60 |
String fieldName, String operationName) throws DataException, |
63 | 61 |
GeometryOperationNotSupportedException, GeometryOperationException { |
Also available in: Unified diff