The IlvInformixDataSource class is an
IlvMapDataSource for reading georeferenced objects from an Informix® spatial datablade. It wraps
up all operations (connecting to database, reading features,
rendering them to graphic objects) in a convenient way.
To read a map stored in an Informix
spatial datablade:
-
Create a connection to the Informix Spatial datablade:
IlvInformixConnectionInfo cx = new IlvInformixConnectionInfo(); cx.setHostName("server_hostname"); cx.setHostPort("9088"); cx.setUser("an_informix_user"); cx.setServer("informix_server_name"); cx.setPassword("password"); cx.setDatabaseName("database_name");
-
Create a data source with this connection as a parameter:
// we want to fetch layer "AN_INFORMIX_USER.WORLD.GEOM.SRID=0" String layerName="AN_INFORMIX_USER.WORLD.GEOM.SRID=0"; IlvInformixDataSource dataSource=new IlvInformixDataSource(cx, layerName);
To obtain a list of layers, see Getting a list of layers -
Set parameters on this data source to use load-on-demand, if needed:
boolean useTiling = true; int rowCount = 5; int columnCount = 5; dataSource.setTilingParameters(useTiling, rowCount, columnCount);
-
Connect this data source to the manager of the view:
dataSource.setManager(getView().getManager());
-
Insert the data source map layer into the layer tree: You first need to retrieve the layer model from the property of the manager:
IlvMapLayerTreeModel mltm = IlvMapLayerTreeProperty.GetMapLayerTreeModel(v.getManager()); mltm.addChild(null, dataSource.getInsertionLayer());
-
Insert the data source into the data source tree. You first need to retrieve the data source model from the property of the manager:
IlvMapDataSourceModel dataSourceModel = IlvMapDataSourceProperty.GetMapDataSourceModel(manager); dataSourceModel.insert(dataSource);
-
Finally, start the data source (or the whole model, if you have more than one data source):
IlvDBConnectionInfo cx=…; String[] layersList = cx.getSpatiallyEnabledTableNames();