|
GDAL
|
Public Member Functions | |
| OGRWarpedLayer (OGRLayer *poDecoratedLayer, int iGeomField, int bTakeOwnership, OGRCoordinateTransformation *poCT, OGRCoordinateTransformation *poReversedCT) | |
| void | SetExtent (double dfXMin, double dfYMin, double dfXMax, double dfYMax) |
| virtual void | SetSpatialFilter (OGRGeometry *) |
| Set a new spatial filter. | |
| virtual void | SetSpatialFilterRect (double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) |
| Set a new rectangular spatial filter. | |
| virtual void | SetSpatialFilter (int iGeomField, OGRGeometry *) |
| Set a new spatial filter. | |
| virtual void | SetSpatialFilterRect (int iGeomField, double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) |
| Set a new rectangular spatial filter. | |
| virtual OGRFeature * | GetNextFeature () |
| Fetch the next available feature from this layer. | |
| virtual OGRFeature * | GetFeature (GIntBig nFID) |
| Fetch a feature by its identifier. | |
| virtual OGRErr | ISetFeature (OGRFeature *poFeature) |
| Rewrite an existing feature. | |
| virtual OGRErr | ICreateFeature (OGRFeature *poFeature) |
| Create and write a new feature within a layer. | |
| virtual OGRFeatureDefn * | GetLayerDefn () |
| Fetch the schema information for this layer. | |
| virtual OGRSpatialReference * | GetSpatialRef () |
| Fetch the spatial reference system for this layer. | |
| virtual GIntBig | GetFeatureCount (int bForce=TRUE) |
| Fetch the feature count in this layer. | |
| virtual OGRErr | GetExtent (int iGeomField, OGREnvelope *psExtent, int bForce=TRUE) |
| Fetch the extent of this layer, on the specified geometry field. | |
| virtual OGRErr | GetExtent (OGREnvelope *psExtent, int bForce=TRUE) |
| Fetch the extent of this layer. | |
| virtual int | TestCapability (const char *) |
| Test if capability is available. | |
Protected Member Functions | |
| OGRFeature * | SrcFeatureToWarpedFeature (OGRFeature *poFeature) |
| OGRFeature * | WarpedFeatureToSrcFeature (OGRFeature *poFeature) |
Static Protected Member Functions | |
| static int | ReprojectEnvelope (OGREnvelope *psEnvelope, OGRCoordinateTransformation *poCT) |
Protected Attributes | |
| OGRFeatureDefn * | m_poFeatureDefn |
| int | m_iGeomField |
| OGRCoordinateTransformation * | m_poCT |
| OGRCoordinateTransformation * | m_poReversedCT |
| OGRSpatialReference * | m_poSRS |
| OGREnvelope | sStaticEnvelope |
| OGRErr OGRWarpedLayer::GetExtent | ( | int | iGeomField, |
| OGREnvelope * | psExtent, | ||
| int | bForce = TRUE |
||
| ) | [virtual] |
Fetch the extent of this layer, on the specified geometry field.
Returns the extent (MBR) of the data in the layer. If bForce is FALSE, and it would be expensive to establish the extent then OGRERR_FAILURE will be returned indicating that the extent isn't know. If bForce is TRUE then some implementations will actually scan the entire layer once to compute the MBR of all the features in the layer.
Depending on the drivers, the returned extent may or may not take the spatial filter into account. So it is safer to call GetExtent() without setting a spatial filter.
Layers without any geometry may return OGRERR_FAILURE just indicating that no meaningful extents could be collected.
Note that some implementations of this method may alter the read cursor of the layer.
Note to driver implementators: if you implement GetExtent(int,OGREnvelope*,int), you must also implement GetExtent(OGREnvelope*, int) to make it call GetExtent(0,OGREnvelope*,int).
This method is the same as the C function OGR_L_GetExtentEx().
| iGeomField | the index of the geometry field on which to compute the extent. |
| psExtent | the structure in which the extent value will be returned. |
| bForce | Flag indicating whether the extent should be computed even if it is expensive. |
Reimplemented from OGRLayerDecorator.
| OGRErr OGRWarpedLayer::GetExtent | ( | OGREnvelope * | psExtent, |
| int | bForce = TRUE |
||
| ) | [virtual] |
Fetch the extent of this layer.
Returns the extent (MBR) of the data in the layer. If bForce is FALSE, and it would be expensive to establish the extent then OGRERR_FAILURE will be returned indicating that the extent isn't know. If bForce is TRUE then some implementations will actually scan the entire layer once to compute the MBR of all the features in the layer.
Depending on the drivers, the returned extent may or may not take the spatial filter into account. So it is safer to call GetExtent() without setting a spatial filter.
Layers without any geometry may return OGRERR_FAILURE just indicating that no meaningful extents could be collected.
Note that some implementations of this method may alter the read cursor of the layer.
This method is the same as the C function OGR_L_GetExtent().
| psExtent | the structure in which the extent value will be returned. |
| bForce | Flag indicating whether the extent should be computed even if it is expensive. |
Reimplemented from OGRLayerDecorator.
| OGRFeature * OGRWarpedLayer::GetFeature | ( | GIntBig | nFID | ) | [virtual] |
Fetch a feature by its identifier.
This function will attempt to read the identified feature. The nFID value cannot be OGRNullFID. Success or failure of this operation is unaffected by the spatial or attribute filters (and specialized implementations in drivers should make sure that they do not take into account spatial or attribute filters).
If this method returns a non-NULL feature, it is guaranteed that its feature id (OGRFeature::GetFID()) will be the same as nFID.
Use OGRLayer::TestCapability(OLCRandomRead) to establish if this layer supports efficient random access reading via GetFeature(); however, the call should always work if the feature exists as a fallback implementation just scans all the features in the layer looking for the desired feature.
Sequential reads (with GetNextFeature()) are generally considered interrupted by a GetFeature() call.
The returned feature should be free with OGRFeature::DestroyFeature().
This method is the same as the C function OGR_L_GetFeature().
| nFID | the feature id of the feature to read. |
Reimplemented from OGRLayerDecorator.
| GIntBig OGRWarpedLayer::GetFeatureCount | ( | int | bForce = TRUE | ) | [virtual] |
Fetch the feature count in this layer.
Returns the number of features in the layer. For dynamic databases the count may not be exact. If bForce is FALSE, and it would be expensive to establish the feature count a value of -1 may be returned indicating that the count isn't know. If bForce is TRUE some implementations will actually scan the entire layer once to count objects.
The returned count takes the spatial filter into account.
Note that some implementations of this method may alter the read cursor of the layer.
This method is the same as the C function OGR_L_GetFeatureCount().
Note: since GDAL 2.0, this method returns a GIntBig (previously a int)
| bForce | Flag indicating whether the count should be computed even if it is expensive. |
Reimplemented from OGRLayerDecorator.
| OGRFeatureDefn * OGRWarpedLayer::GetLayerDefn | ( | ) | [virtual] |
Fetch the schema information for this layer.
The returned OGRFeatureDefn is owned by the OGRLayer, and should not be modified or freed by the application. It encapsulates the attribute schema of the features of the layer.
This method is the same as the C function OGR_L_GetLayerDefn().
Reimplemented from OGRLayerDecorator.
| OGRFeature * OGRWarpedLayer::GetNextFeature | ( | ) | [virtual] |
Fetch the next available feature from this layer.
The returned feature becomes the responsiblity of the caller to delete with OGRFeature::DestroyFeature(). It is critical that all features associated with an OGRLayer (more specifically an OGRFeatureDefn) be deleted before that layer/datasource is deleted.
Only features matching the current spatial filter (set with SetSpatialFilter()) will be returned.
This method implements sequential access to the features of a layer. The ResetReading() method can be used to start at the beginning again.
Features returned by GetNextFeature() may or may not be affected by concurrent modifications depending on drivers. A guaranteed way of seing modifications in effect is to call ResetReading() on layers where GetNextFeature() has been called, before reading again. Structural changes in layers (field addition, deletion, ...) when a read is in progress may or may not be possible depending on drivers. If a transaction is committed/aborted, the current sequential reading may or may not be valid after that operation and a call to ResetReading() might be needed.
This method is the same as the C function OGR_L_GetNextFeature().
Reimplemented from OGRLayerDecorator.
| OGRSpatialReference * OGRWarpedLayer::GetSpatialRef | ( | ) | [virtual] |
Fetch the spatial reference system for this layer.
The returned object is owned by the OGRLayer and should not be modified or freed by the application.
Starting with OGR 1.11, several geometry fields can be associated to a feature definition. Each geometry field can have its own spatial reference system, which is returned by OGRGeomFieldDefn::GetSpatialRef(). OGRLayer::GetSpatialRef() is equivalent to GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(0)->GetSpatialRef()
This method is the same as the C function OGR_L_GetSpatialRef().
Reimplemented from OGRLayerDecorator.
| OGRErr OGRWarpedLayer::ICreateFeature | ( | OGRFeature * | poFeature | ) | [virtual] |
Create and write a new feature within a layer.
This method is implemented by drivers and not called directly. User code should use CreateFeature() instead.
The passed feature is written to the layer as a new feature, rather than overwriting an existing one. If the feature has a feature id other than OGRNullFID, then the native implementation may use that as the feature id of the new feature, but not necessarily. Upon successful return the passed feature will have been updated with the new feature id.
| poFeature | the feature to write to disk. |
Reimplemented from OGRLayerDecorator.
| OGRErr OGRWarpedLayer::ISetFeature | ( | OGRFeature * | poFeature | ) | [virtual] |
Rewrite an existing feature.
This method is implemented by drivers and not called directly. User code should use SetFeature() instead.
This method will write a feature to the layer, based on the feature id within the OGRFeature.
| poFeature | the feature to write. |
Reimplemented from OGRLayerDecorator.
| void OGRWarpedLayer::SetSpatialFilter | ( | OGRGeometry * | poFilter | ) | [virtual] |
Set a new spatial filter.
This method set the geometry to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the filter geometry will be returned.
Currently this test is may be inaccurately implemented, but it is guaranteed that all features who's envelope (as returned by OGRGeometry::getEnvelope()) overlaps the envelope of the spatial filter will be returned. This can result in more shapes being returned that should strictly be the case.
This method makes an internal copy of the passed geometry. The passed geometry remains the responsibility of the caller, and may be safely destroyed.
For the time being the passed filter geometry should be in the same SRS as the layer (as returned by OGRLayer::GetSpatialRef()). In the future this may be generalized.
This method is the same as the C function OGR_L_SetSpatialFilter().
| poFilter | the geometry to use as a filtering region. NULL may be passed indicating that the current spatial filter should be cleared, but no new one instituted. |
Reimplemented from OGRLayerDecorator.
| void OGRWarpedLayer::SetSpatialFilter | ( | int | iGeomField, |
| OGRGeometry * | poFilter | ||
| ) | [virtual] |
Set a new spatial filter.
This method set the geometry to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the filter geometry will be returned.
Currently this test is may be inaccurately implemented, but it is guaranteed that all features who's envelope (as returned by OGRGeometry::getEnvelope()) overlaps the envelope of the spatial filter will be returned. This can result in more shapes being returned that should strictly be the case.
This method makes an internal copy of the passed geometry. The passed geometry remains the responsibility of the caller, and may be safely destroyed.
For the time being the passed filter geometry should be in the same SRS as the geometry field definition it corresponds to (as returned by GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(iGeomField)->GetSpatialRef()). In the future this may be generalized.
Note that only the last spatial filter set is applied, even if several successive calls are done with different iGeomField values.
Note to driver implementators: if you implement SetSpatialFilter(int,OGRGeometry*), you must also implement SetSpatialFilter(OGRGeometry*) to make it call SetSpatialFilter(0,OGRGeometry*).
This method is the same as the C function OGR_L_SetSpatialFilterEx().
| iGeomField | index of the geometry field on which the spatial filter operates. |
| poFilter | the geometry to use as a filtering region. NULL may be passed indicating that the current spatial filter should be cleared, but no new one instituted. |
Reimplemented from OGRLayerDecorator.
| void OGRWarpedLayer::SetSpatialFilterRect | ( | int | iGeomField, |
| double | dfMinX, | ||
| double | dfMinY, | ||
| double | dfMaxX, | ||
| double | dfMaxY | ||
| ) | [virtual] |
Set a new rectangular spatial filter.
This method set rectangle to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the given rectangle will be returned.
The x/y values should be in the same coordinate system as as the geometry field definition it corresponds to (as returned by GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(iGeomField)->GetSpatialRef()). Internally this method is normally implemented as creating a 5 vertex closed rectangular polygon and passing it to OGRLayer::SetSpatialFilter(). It exists as a convenience.
The only way to clear a spatial filter set with this method is to call OGRLayer::SetSpatialFilter(NULL).
This method is the same as the C function OGR_L_SetSpatialFilterRectEx().
| iGeomField | index of the geometry field on which the spatial filter operates. |
| dfMinX | the minimum X coordinate for the rectangular region. |
| dfMinY | the minimum Y coordinate for the rectangular region. |
| dfMaxX | the maximum X coordinate for the rectangular region. |
| dfMaxY | the maximum Y coordinate for the rectangular region. |
Reimplemented from OGRLayerDecorator.
| void OGRWarpedLayer::SetSpatialFilterRect | ( | double | dfMinX, |
| double | dfMinY, | ||
| double | dfMaxX, | ||
| double | dfMaxY | ||
| ) | [virtual] |
Set a new rectangular spatial filter.
This method set rectangle to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the given rectangle will be returned.
The x/y values should be in the same coordinate system as the layer as a whole (as returned by OGRLayer::GetSpatialRef()). Internally this method is normally implemented as creating a 5 vertex closed rectangular polygon and passing it to OGRLayer::SetSpatialFilter(). It exists as a convenience.
The only way to clear a spatial filter set with this method is to call OGRLayer::SetSpatialFilter(NULL).
This method is the same as the C function OGR_L_SetSpatialFilterRect().
| dfMinX | the minimum X coordinate for the rectangular region. |
| dfMinY | the minimum Y coordinate for the rectangular region. |
| dfMaxX | the maximum X coordinate for the rectangular region. |
| dfMaxY | the maximum Y coordinate for the rectangular region. |
Reimplemented from OGRLayerDecorator.
| int OGRWarpedLayer::TestCapability | ( | const char * | pszCapability | ) | [virtual] |
Test if capability is available.
One of the following dataset capability names can be passed into this method, and a TRUE or FALSE value will be returned indicating whether or not the capability is available for this object.
ODsCCreateLayer: True if this datasource can create new layers.
ODsCDeleteLayer: True if this datasource can delete existing layers.
ODsCCreateGeomFieldAfterCreateLayer: True if the layers of this datasource support CreateGeomField() just after layer creation.
ODsCCurveGeometries: True if this datasource supports curve geometries.
ODsCTransactions: True if this datasource supports (efficient) transactions.
ODsCEmulatedTransactions: True if this datasource supports transactions through emulation.
The #define macro forms of the capability names should be used in preference to the strings themselves to avoid mispelling.
This method is the same as the C function GDALDatasetTestCapability() and the deprecated OGR_DS_TestCapability().
In GDAL 1.X, this method used to be in the OGRDataSource class.
| pszCapability | the capability to test. |
Reimplemented from OGRLayerDecorator.
1.7.3.