[Gvsig_desarrolladores] Error al ejecutar codigo de SEXTANTE
raisel
rcastellanos en habana.geocuba.cu
Mar Oct 12 19:42:08 CEST 2010
Hola a todos
Estoy tratando de ejecutar el siguiente codigo que utiliza a un algoritmo de
SEXTANTE:
public class ExtForesta extends Extension{
private static FLayer l;
private static GTOutputFactory m_OutputFactory = new GTOutputFactory ();
public void initialize() {
}
@SuppressWarnings({ "deprecation", "deprecation", "deprecation",
"deprecation", "deprecation", "deprecation" })
public void execute(String actionCommand) {
if (actionCommand.compareTo("Foresta") == 0)
{
Sextante.initialize();
try {
doProcessing(); //metodo declarado mas abajo
} catch (GeoAlgorithmExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
public boolean isEnabled() {
return true;
}
public boolean isVisible() {
return true;
}
private static void doProcessing() throws GeoAlgorithmExecutionException,
IOException
{
DataStore ds = openShapefile("C:/Documents and
Settings/Raisel/Desktop/hidlineal.shp");
GTVectorLayer layer = GTVectorLayer.createLayer(ds, ds.getTypeNames()[0]);
LinesToEquispacedPointsAlgorithm alg = new
LinesToEquispacedPointsAlgorithm();
ParametersSet params = alg.getParameters();
params.getParameter(LinesToEquispacedPointsAlgorithm.LINES).setParameterValue(layer);
params.getParameter(LinesToEquispacedPointsAlgorithm.DISTANCE).setParameterValue(new
Double(5000));
OutputObjectsSet outputs = alg.getOutputObjects();
Output out = outputs.getOutput(LinesToEquispacedPointsAlgorithm.RESULT);
out.setOutputChannel(new FileOutputChannel("D:/points.shp"));
alg.execute(null, m_OutputFactory);
IVectorLayer result = (IVectorLayer) out.getOutputObject();
System.out.println("This layer contains " +
Integer.toString(result.getShapesCount()) + " points.");
}
private static DataStore openShapefile(String sFile) throws IOException {
File file = new File( sFile );
Map connect = new HashMap();
connect.put( "url", file.toURL() );
DataStore dataStore = DataStoreFinder.getDataStore( connect );
return dataStore;
}
}
Y me sale el siguiente error al ejecutarlo :
java.lang.AbstractMethodError:
org.geotools.data.DefaultQuery.getFilter()Lorg/geotools/filter/Filter;
at
org.geotools.data.AbstractFeatureSource.getCount(AbstractFeatureSource.java:217)
at
org.geotools.data.DefaultFeatureResults.getCount(DefaultFeatureResults.java:233)
at
org.geotools.data.store.DataFeatureCollection.size(DataFeatureCollection.java:220)
at es.unex.sextante.geotools.GTVectorLayer.create(GTVectorLayer.java:134)
at
es.unex.sextante.geotools.GTVectorLayer.createLayer(GTVectorLayer.java:63)
at
es.unex.sextante.geotools.GTVectorLayer.createLayer(GTVectorLayer.java:87)
at
es.unex.sextante.geotools.GTVectorLayer.createLayer(GTVectorLayer.java:118)
at
org.gvsig.foresta.extensions.ExtForesta.doProcessing(ExtForesta.java:124)
at org.gvsig.foresta.extensions.ExtForesta.execute(ExtForesta.java:48)
at
com.iver.andami.plugins.ExtensionDecorator.execute(ExtensionDecorator.java:89)
at com.iver.andami.ui.mdiFrame.MDIFrame.actionPerformed(MDIFrame.java:673)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at
com.iver.andami.ui.AndamiEventQueue.dispatchEvent(AndamiEventQueue.java:58)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Si alguien puede ayudarme lo agradecere
Saludos, Raisel
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Error-al-ejecutar-codigo-de-SEXTANTE-tp5627751p5627751.html
Sent from the gvSIG desarrolladores mailing list archive at Nabble.com.
Más información sobre la lista de distribución gvSIG_desarrolladores