Views
Maps Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvSDOWriter Class Reference

This class can write the content of an IlvMapFeatureIterator to an Oracle SDO layer. More...

#include <ilviews/maps/format/oracle/sdowrite.h>

Public Member Functions

 IlvSDOWriter (IldDbms *dbms, const char *layerName, IlInt firstGidValue)
 Initializes a new IlvSDOWriter to write data to an existing SDO layer. More...
 
 IlvSDOWriter (IldDbms *dbms, const char *layerName, IlInt sdoGeomCoordinatesCount, const IlvCoordinate &upperLeftBound, const IlvCoordinate &lowerRightBound)
 Initializes a new IlvSDOWriter that creates an SDO layer. More...
 
IldDbms * getDbms () const
 Returns the current database connection of the writer. More...
 
virtual IlvMapsError getInitStatus () const
 Returns the init status of the writer. More...
 
const char * getLayerName () const
 Returns the current layer name of the writer. More...
 
virtual IlvMapsError populateIndexes (IlUShort tilingLevel)
 Creates (if necessary) and populates the spatial index table using a specified tiling level. More...
 
virtual IlvMapsError writeFeature (const IlvMapFeature *feature)
 Puts the map feature passed as argument in the [layerName]_SDOGEOM table. More...
 
virtual IlvMapsError writeFeatureIterator (IlvMapFeatureIterator *reader, IlInt &count)
 Writes the iterator map features, passed as its argument, into the Oracle SDO database. More...
 

Detailed Description

This class can write the content of an IlvMapFeatureIterator to an Oracle SDO layer.

Library: ilvdbmaps

The supported map feature geometries are

The following example shows how to use this class to create a SDO layer in an Oracle database, fill it with map features coming from an IlvFeatureIterator, and create a spatial indexation.

IlvMapsError error;
IlvSDOWriter* writer = new IlvSDOWriter(dbms,
                                        "MyLayer",
                                        16,
                                        IlvCoordinate(-360, 90),
                                        IlvCoordinate(360, -90));
error = writer->getInitStatus(); // you should handle error case here
// creating a source feature iterator
IlvShapeFileReader* reader = new IlvShapeFileReader(...);
// dumping its content to the Oracle layer
IlInt geomCount;
error = writer->writeFeatureIterator(reader, geomCount); // you should handle error case here
// Creating an SDO spatial indexation
error = writer->populateIndexes(IlvSDOUtil::EstimateTilingLevel(dbms,
                                                                "MyLayer",
                                                                IlvSDOUtil::ALL_GID_EXTENT,
                                                                10000,
                                                                error)); // you should handle error case here

Constructor & Destructor Documentation

◆ IlvSDOWriter() [1/2]

IlvSDOWriter::IlvSDOWriter ( IldDbms *  dbms,
const char *  layerName,
IlInt  firstGidValue 
)

Initializes a new IlvSDOWriter to write data to an existing SDO layer.

Parameters
dbmsThe connection to the Oracle database.
layerNameThe name of the SDO layer to which the geometries will be appended. It can contain the owner name of the table: "OwnerName.LayerName". Otherwise, the user name of the IldDbms parameter is considered as the owner name.
firstGidValueThe first value for the GID of the first geometry that will be saved in the database. The writer will then increment this value for the following GID values.

◆ IlvSDOWriter() [2/2]

IlvSDOWriter::IlvSDOWriter ( IldDbms *  dbms,
const char *  layerName,
IlInt  sdoGeomCoordinatesCount,
const IlvCoordinate upperLeftBound,
const IlvCoordinate lowerRightBound 
)

Initializes a new IlvSDOWriter that creates an SDO layer.

The IlvSDOWriter object can then fill the layer with one or more IlvMapFeatureIterator objects.

Parameters
dbmsThe connection to the Oracle database.
layerNameThe SDO layer name for the writer.
sdoGeomCoordinatesCountThe number of coordinate columns in the [layerName]_SDOGEOM table. For example, setting this parameter to 8 will create the [layerName]_SDOGEOM table with the following columns: SDO_GID, SDO_ESEQ, SDO_ETYPE, SDO_SEQ, SDO_X1, SDO_Y1, ..., SDO_X8, SDO_Y8.
upperLeftBoundSet to the upper-left corner of the bounding box of the SDO layer.
lowerRightBoundSet to the lower-right corner of the bounding box of the SDO layer.

Member Function Documentation

◆ getDbms()

IldDbms* IlvSDOWriter::getDbms ( ) const

Returns the current database connection of the writer.

Returns
The current connection of the writer.

◆ getInitStatus()

virtual IlvMapsError IlvSDOWriter::getInitStatus ( ) const
virtual

Returns the init status of the writer.

It will return an error if there has been one (SQL Error, ...) in the constructor.

Returns
The init status of the writer.

◆ getLayerName()

const char* IlvSDOWriter::getLayerName ( ) const

Returns the current layer name of the writer.

Returns
The current layer name of the writer.

◆ populateIndexes()

virtual IlvMapsError IlvSDOWriter::populateIndexes ( IlUShort  tilingLevel)
virtual

Creates (if necessary) and populates the spatial index table using a specified tiling level.

Creating a spatial index is mandatory for the use of an IlvSDOLayer.

Parameters
tilingLevelThe SDO layer tiling level value.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.

◆ writeFeature()

virtual IlvMapsError IlvSDOWriter::writeFeature ( const IlvMapFeature feature)
virtual

Puts the map feature passed as argument in the [layerName]_SDOGEOM table.

Parameters
featureThe map feature to be written in the database.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.

◆ writeFeatureIterator()

virtual IlvMapsError IlvSDOWriter::writeFeatureIterator ( IlvMapFeatureIterator reader,
IlInt count 
)
virtual

Writes the iterator map features, passed as its argument, into the Oracle SDO database.

Parameters
readerThe IlvMapFeatureIterator instance.
countThe number of saved features.
Returns
A maps error if any error occurs, or IlvMaps::NoError() otherwise.