Thanks for the help guys!   I`ve solved it by the following code:
(maybe there are some things no needed, like options, but it works!!)

****************
DataSource dataSource = 
(DataSource)LangUtil.newInstance(StandardReaderWriterFileDataSource.Shapefile.class);
Map<String, Object> options = new HashMap<String, Object>();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(DataSource.FILE_KEY, "c://roads.shp");
properties.putAll(options);
dataSource.setProperties(properties);

DataSourceQuery dataSourceQuery = new DataSourceQuery(dataSource, null, 
"roads");
ArrayList exceptions = new ArrayList();
String layerName = dataSourceQuery.toString();

Connection connection = dataSourceQuery.getDataSource().getConnection();
   try 
    {
      FeatureCollection dataset = 
dataSourceQuery.getDataSource().installCoordinateSystem(
         connection.executeQuery(dataSourceQuery.getQuery(), exceptions, null),
              
CoordinateSystemRegistry.instance(context.getWorkbenchContext().getBlackboard()));
          if (dataset != null) 
          {                         
            LayerManager layerManager = 
context.getWorkbenchContext().getLayerManager();
            Layer layer = new Layer(layerName, 
layerManager.generateLayerFillColor(), dataset, layerManager);
            layerManager.addLayerable("categoryName", (Layerable) layer);
        layer.setDataSourceQuery(dataSourceQuery);
            layer.setFeatureCollectionModified(false);
            layer.setVisible(true);                        
          }
        } finally {
        connection.close();
        }
******************
                                          
_________________________________________________________________

------------------------------------------------------------------------------

_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to