Hi,
Don't know if you still want to work inside OpenJUMP wokbench or not,
but here is a very simple example I just picked up from the JTS
discussion list :
String layer = "data/tigerline/2009_us_state/tl_2009_us_state.shp";
ShapefileReader reader = new ShapefileReader();
FeatureCollection fc = reader.read(new DriverProperties(layer));
List<Feature> fs = fc.getFeatures();
Is that what you're looking for ?
Michaël
Stefan Steiniger a écrit :
> does it help you too look into this class:
>
> com.vividsolutions.jump.workbench.datasource.AbstractLoadDatasetPlugIn
>
> I think it is not used anymore...
>
> stefan
>
> Hernan Arellano wrote:
>
>> Hi all! i'm working on a project, with OpenJump 1.3.1, that it needs to
>> load a set of ESRI Shapefiles from a path to any category of the map.
>>
>> I`ve seen the following code to load a shapefile, of the method "open"
>> from DataSourceFileLayerLoader class. The problem is that this uses a
>> monitor of a dialog that i haven´t, and i tried use this code but i
>> couldn`t make the dataset.
>>
>> **************
>> Connection connection = dataSourceQuery.getDataSource().getConnection();
>> try {
>> FeatureCollection dataset =
>> dataSourceQuery.getDataSource().installCoordinateSystem(
>> connection.executeQuery(dataSourceQuery.getQuery(),
>> exceptions, monitor),
>>
>> CoordinateSystemRegistry.instance(workbenchContext.getBlackboard()));
>> if (dataset != null) {
>> LayerManager layerManager = workbenchContext.getLayerManager();
>> Layer layer = new Layer(layerName,
>> layerManager.generateLayerFillColor(), dataset, layerManager);
>> Category category =
>> TaskUtil.getSelectedCategoryName(workbenchContext);
>> layerManager.addLayerable(category.getName(), layer);
>> layer.setName(layerName);
>> layer.setDataSourceQuery(dataSourceQuery);
>> *****************
>>
>> ¿ How can i load a shapefile by code in a simple way without an
>> OpenFileWizard ? .
>>
>> Thanks in advance!
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Jump-pilot-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Jump-pilot-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
------------------------------------------------------------------------------
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel