Skip to content

Commit

Permalink
Remove stale pre-GDAL 3 feature gates
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Nov 28, 2024
1 parent b448b08 commit 48933e8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 24 deletions.
2 changes: 0 additions & 2 deletions src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ impl Dataset {
Ok(())
}

#[cfg(major_ge_3)]
/// Get the spatial reference system for this dataset.
pub fn spatial_ref(&self) -> Result<SpatialRef> {
unsafe {
Expand All @@ -234,7 +233,6 @@ impl Dataset {
}
}

#[cfg(major_ge_3)]
/// Set the spatial reference system for this dataset.
pub fn set_spatial_ref(&mut self, spatial_ref: &SpatialRef) -> Result<()> {
let rv = unsafe { gdal_sys::GDALSetSpatialRef(self.c_dataset, spatial_ref.to_c_hsrs()) };
Expand Down
13 changes: 0 additions & 13 deletions src/spatial_ref/srs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ impl SpatialRef {
}
}

#[cfg(major_ge_3)]
pub fn name(&self) -> Result<String> {
let c_ptr = unsafe { gdal_sys::OSRGetName(self.0) };
if c_ptr.is_null() {
Expand Down Expand Up @@ -402,7 +401,6 @@ impl SpatialRef {
unsafe { gdal_sys::OSRGetAxesCount(self.0) }
}

#[cfg(major_ge_3)]
/// Set the data axis to CRS axis mapping strategy.
///
/// # Notes
Expand All @@ -420,7 +418,6 @@ impl SpatialRef {
}
}

#[cfg(major_ge_3)]
/// Return the data axis to CRS axis mapping strategy.
///
/// See: [`OSRGetAxisMappingStrategy`](https://gdal.org/api/ogrspatialref.html#_CPPv4NK19OGRSpatialReference22GetAxisMappingStrategyEv)
Expand All @@ -429,7 +426,6 @@ impl SpatialRef {
id.try_into().expect("valid enumeration ordinal from GDAL")
}

#[cfg(major_ge_3)]
/// Get the valid use bounding area for this `SpatialRef`.
///
/// See: [`OSRGetAreaOfUse`](https://gdal.org/api/ogr_srs_api.html#_CPPv415OSRGetAreaOfUse20OGRSpatialReferenceHPdPdPdPdPPKc)
Expand Down Expand Up @@ -615,7 +611,6 @@ pub struct AreaOfUse {
pub name: String,
}

#[cfg(major_ge_3)]
/// Data axis to CRS axis mapping strategy.
///
/// See: [`OSRGetAxisMappingStrategy`](https://gdal.org/api/ogrspatialref.html#_CPPv4NK19OGRSpatialReference22GetAxisMappingStrategyEv)
Expand Down Expand Up @@ -694,9 +689,6 @@ mod tests {
let spatial_ref = SpatialRef::from_epsg(4326).unwrap();
let wkt = spatial_ref.to_wkt().unwrap();
// TODO: handle proj changes on lib level
#[cfg(not(major_ge_3))]
assert_eq!("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]", wkt);
#[cfg(major_ge_3)]
assert_eq!("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]", wkt);
let proj4string = spatial_ref.to_proj4().unwrap();
assert_eq!("+proj=longlat +datum=WGS84 +no_defs", proj4string.trim());
Expand Down Expand Up @@ -794,7 +786,6 @@ mod tests {
assert_eq!(spatial_ref.auth_code().unwrap(), 32632);
}

#[cfg(major_ge_3)]
#[test]
fn axis_mapping_strategy() {
let mut spatial_ref = SpatialRef::from_epsg(4326).unwrap();
Expand All @@ -809,7 +800,6 @@ mod tests {
);
}

#[cfg(major_ge_3)]
#[test]
fn area_of_use() {
let spatial_ref = SpatialRef::from_epsg(4326).unwrap();
Expand All @@ -820,7 +810,6 @@ mod tests {
assert_almost_eq(area_of_use.north_lat_degree, 90.0);
}

#[cfg(major_ge_3)]
#[test]
fn get_name() {
let spatial_ref = SpatialRef::from_epsg(4326).unwrap();
Expand Down Expand Up @@ -870,8 +859,6 @@ mod tests {
assert!(!spatial_ref_2154.is_derived_geographic());
}

//XXX Gdal 2 implementation is partial
#[cfg(major_ge_3)]
#[test]
fn crs_axis() {
let spatial_ref = SpatialRef::from_epsg(4326).unwrap();
Expand Down
8 changes: 0 additions & 8 deletions src/spatial_ref/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@ mod tests {
let mut spatial_ref2 = SpatialRef::from_epsg(3035).unwrap();

// TODO: handle axis order in tests
#[cfg(major_ge_3)]
spatial_ref1.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);
#[cfg(major_ge_3)]
spatial_ref2.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);

let transform = CoordTransform::new(&spatial_ref1, &spatial_ref2).unwrap();
Expand Down Expand Up @@ -307,9 +305,7 @@ mod tests {
let mut spatial_ref2 = SpatialRef::from_wkt("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",7030]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",6326]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]],UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",4326]]").unwrap();

// TODO: handle axis order in tests
#[cfg(major_ge_3)]
spatial_ref1.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);
#[cfg(major_ge_3)]
spatial_ref2.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);

let htransform = CoordTransform::new(&spatial_ref2, &spatial_ref1).unwrap();
Expand All @@ -323,9 +319,7 @@ mod tests {
let mut dhd_2 = SpatialRef::from_epsg(31462).unwrap();

// TODO: handle axis order in tests
#[cfg(major_ge_3)]
wgs84.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);
#[cfg(major_ge_3)]
dhd_2.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);

let mut x = [1979105.06, 0.0];
Expand All @@ -340,9 +334,7 @@ mod tests {
let mut webmercator = SpatialRef::from_epsg(3857).unwrap();

// TODO: handle axis order in tests
#[cfg(major_ge_3)]
wgs84.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);
#[cfg(major_ge_3)]
webmercator.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);

let mut x = [1000000.0];
Expand Down
1 change: 0 additions & 1 deletion src/vector/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,6 @@ mod tests {

let geom_field = layer.defn().geom_fields().next().unwrap();
let mut spatial_ref2 = SpatialRef::from_epsg(4326).unwrap();
#[cfg(major_ge_3)]
spatial_ref2.set_axis_mapping_strategy(AxisMappingStrategy::TraditionalGisOrder);

assert_eq!(geom_field.spatial_ref().unwrap(), spatial_ref2);
Expand Down

0 comments on commit 48933e8

Please sign in to comment.