objectmodel
package
handle both georeferenced and nongeoreferenced data.IlvMapFeature
Objects.IlvObjectSDOLayer
.IlvSDOConnection connection = new IlvSDOConnection(url, userName, password); connection.createConnection(); IlvObjectSDOFeatureIterator iterator = new IlvObjectSDOFeatureIterator(connection.getConnection(), "select * from ROADS", // The name of the geometry column. "GEOMETRY", // No key ID. null, // Name of the x-ordinates column. "X", // Name of the y-ordinates column. "Y");
load()
method
of each covered tile fully loads the large geometry.IlvObjectSDOLayerMetaData
class
corresponds to the data contained in each row of the (XXX_)SDO_GEOM_METADATA
view.
This view contains information, called metadata,
about Spatial layers. Each Spatial user has the following views available
in the schema associated with that user (in Oracle 8.1.6+): USER_SDO_GEOM_METADATA
close()
method
of IlvObjectSDOWriter
updates this view. ALL_SDO_GEOM_METADATA
DBA_SDO_GEOM_METADATA
TABLE_NAME VARCHAR2(32), COLUMN_NAME VARCHAR2(32), DIMINFO MDSYS.SDO_DIM_ARRAY, SRID NUMBER
ALL_SDO_GEOM_METADATA
and DBA_SDO_GEOM_METADATA
views
have an OWNER
column identifying the schema
that owns the table specified in TABLE_NAME
.ROADS
,
then you can retrieve its metadata as follows: IlvObjectSDOLayerMetaData metadata = IlvObjectSDOUtil.GetLayerMetaData(connection.getConnection() "ROADS", // You can pass the geometry column name as null: the first // metadata row that matches the layer name “ROADS” is then // returned. null, // You can pass the metadata view name as null: the default // is "(USER_)SDO_GEOM_METADATA". null, // You can pass the owner name as null: the name of the // current user is then taken as the owner name. null);
IlvObjectSDOLayerMetaData
class
is then composed of the following elements that match the (XXX_)SDO_GEOM_METADATA
view:
the table name (the name of the Spatial layer), the geometry column
name (called COLUMN_NAME
in the view, the
name of the column of type MDSYS.SDO_GEOMETRY
),
the owner name, the optional SRID if the Spatial layer is georeferenced,
and an array of IlvObjectSDODimElement
(called DIMINFO
in
the view).IlvObjectSDODimElement
corresponds
to the MDSYS.SDO_DIM_ELEMENT
data type.
The MDSYS.SDO_DIM_ELEMENT
data type is
defined in Oracle as: Create Type SDO_DIM_ELEMENT as OBJECT ( SDO_DIMNAME VARCHAR2(64), SDO_LB NUMBER, SDO_UB NUMBER, SDO_TOLERANCE NUMBER);
DIM
element data type
describes, for each Spatial Layer, its extent for each dimension.
For instance, for typical two-dimensional geometries, the DIM
element
array of the metadata table has two entries. The first entry describes
the first dimension (x, longitude), the second one describes the second
dimension (y, latitude). DIM
element array of
the metadata table, the elements are supposed to be ordered. For example,
the first element of the array is considered as the first dimension
of the layer, and so on. ResultSet
using
the extractKey(java.sql.ResultSet)
method.
The object returned can be extracted from one Table column or multiple
columns as soon as it constitutes a unique object. load
method of the tile (2,
2) is called, it loads the rectangle. When the load
method
of the tile (2, 3) is called, the rectangle is loaded again as soon
as it intersects with this tile too, and the tile loader has no way
to know that this geometry has already been loaded. You can avoid
this by using the IlvObjectSDOKeyExtractor
class.GEOMETRY MDSYS.SDO_GEOMETRY, ID NUMBER
IlvDefaultObjectSDOKeyExtractor
used
with this layer can be easily obtained in the following way: IlvDefaultObjectSDOKeyExtractor extractor = new IlvDefaultObjectSDOKeyExtractor("ID");
IlvObjectSDOLayer
,
or an IlvDefaultObjectSDOTileLoader
. IlvObjectSDOLayer layer = new IlvObjectSDOLayer(connection, IlvObjectSDOUtil.GetLayerMetaData(...), 1000, 1000, "X", "Y", extractor, // used here null);
IlvSDOConnection connection = new IlvSDOConnection(url, userName, password); connection.createConnection(); IlvObjectSDOLayer layer = new IlvObjectSDOLayer(connection, // The name of the SDO layer. "ROADS", // Width of a tile in the database // coordinate system. 1500, // Height of a tile in the database // coordinate system. 1500, // Special handling of ID. null //Is not required. ); manager.addLayer(layer,-1);
IlvObjectSDOLayer
.
It has some optimizations. n
tiles
to load each time you want to load on demand, you should use setTileGroupingCount(n)
,
where all the n queries are grouped into one unique query that is
sent to the database once. IlvMapFeature
retrieved
in load-on-demand with the IlvObjectSDOLayer
layer,
you have to subclass the IlvDefaultObjectSDOTileLoader
in
order to override the getFeatureIterator
method.
In this method, you have to return an instance of a subclass of IlvObjectSDOFeatureIterator
where
you have overridden the getNextFeature
method
(inside which you can perform your specific operations on each IlvMapFeature
returned
by the layer). Finally, you have to set your subclass of IlvDefaultObjectSDOTileLoader
as
the tile loader of the layer. querytype=window
mask=anyinteract
". This way, the setClippingRequest()
is
not needed anymore so that all the retrieved geometries are the ones
that intersect with the red rectangle, for example the point, the
triangle, and the line in Tiles. IlvObjectSDOWriter
can
write any IlvMapFeature or any IlvMapFeatureIterator whose features have a geometry supported by Oracle
Spatial 8i (vectorial geometries) and write them to the database as
in the following example: IlvSDOConnection connection = new IlvSDOConnection(url, userName, password); connection.createConnection(); IlvObjectSDOWriter writer = new IlvObjectSDOWriter(connection.getConnection(), "MyLayer", // Layer name. "GEOMETRY", // Geometry column. "X", // X ordinate name. "Y", // Y ordinate name. true // Create table. ); IlvShapeFileReader reader = new IlvShapeFileReader("foo.shp",null); int saved_objects_count = writer.writeFeatureIterator(reader, false, // No attributes null );// No SRID writer.close(0.0, // Tolerance null );// No SRID
(USER_)SDO_GEOM_METADATA
view,
need to be updated. It is very important to call the method IlvObjectSDOWriter.close()
once
the data has been written through the write()
method,
so that the database is kept up-to-date. IlvObjectSDOWriter
can
also write the attributes of the feature.true
to
save the attributes of the specified map feature. This requires that
the map feature has an IlvAttributeInfoProperty correctly
set, describing the attributes that match the Oracle Spatial layer
column names. This also requires that map feature has an IlvFeatureAttributeProperty IlvFeatureAttributeProperty that fits its IlvAttributeInfoProperty and
has correct values. Name |
Null? |
Type |
GEOMETRY |
MDSYS.SDO_GEOMETRY |
|
TYPE_DESC |
VARCHAR2(512) |
writeFeature()
method
allows you to set the SDO_SRID value of the written SDO_GEOMETRY.
The value of the SDO_SRID is exactly one of the SRID values of the
MDSYS.CS_SRS table, and it represents the corresponding coordinate
system for the written geometry.IlvSDOConnection connection = new IlvSDOConnection(url, userName, password); connection.createConnection(); IlvObjectSDOWriter writer = new IlvObjectSDOWriter(connection.getConnection(), "myLayer", "GEOMETRY", "X", "Y", false); java.lang.String[] names = new String[1]; names[0] = "ATTRIBUTE_NAME"; java.lang.Class[] classes = new Class[1]; classes[0] = java.lang.String.class; boolean[] nullable = new boolean[1]; nullable[0] = true; // Creates the attribute info. IlvAttributeInfoProperty info = new IlvAttributeInfoProperty(names, classes, nullable); // Sets the attribute to feature. IlvFeatureAttribute[] attributes = new IlvFeatureAttribute[1]; attributes[0] = new IlvStringAttribute("MY FOO TYPE"); IlvFeatureAttributeProperty prop = new IlvFeatureAttributeProperty(info,attributes); feature.setAttributeInfo(info); feature.setAttributes(prop); // Writes the feature. try { writer.writeFeature(feature,true, null); // no SRID } catch (java.sql.SQLException e) { // Error. e.printStackTrace(); } writer.close(0.0, null); // no SRID
attributeToUpdate
passed as argument)
given a key attribute. IlvMapGeometry
except IlvMapText
, IlvMapImage
,
and IlvMapRaster
are supported by the object
model writer.