Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Sep 18, 2024
1 parent 48e5f64 commit 62fd3fd
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- `GeometryArrayTrait` renamed to `NativeArray`.
- `GeometryArrayRef` renamed to `NativeArrayRef`.
- `GeometryArrayTrait` renamed to `NativeScalar`.
- `GeometryArrayDyn` renamed to `NativeArrayDyn`.

## [0.3.0] - 2024-09-07

Expand Down
4 changes: 2 additions & 2 deletions python/geoarrow-compute/src/algorithm/polylabel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use crate::ffi::from_python::AnyGeometryInput;
use geoarrow::algorithm::polylabel::Polylabel;
use geoarrow::array::GeometryArrayDyn;
use geoarrow::array::NativeArrayDyn;
use pyo3::prelude::*;
use pyo3_geoarrow::PyGeoArrowResult;
use pyo3_geoarrow::{PyChunkedGeometryArray, PyGeometryArray};
Expand All @@ -16,7 +16,7 @@ pub fn polylabel(
match input {
AnyGeometryInput::Array(arr) => {
let out = arr.as_ref().polylabel(tolerance)?;
Ok(PyGeometryArray::new(GeometryArrayDyn::new(Arc::new(out))).into_py(py))
Ok(PyGeometryArray::new(NativeArrayDyn::new(Arc::new(out))).into_py(py))
}
AnyGeometryInput::Chunked(chunked) => {
let out = chunked.as_ref().polylabel(tolerance)?;
Expand Down
4 changes: 2 additions & 2 deletions python/geoarrow-compute/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use geoarrow::array::GeometryArrayDyn;
use geoarrow::array::NativeArrayDyn;
use geoarrow::chunked_array::ChunkedGeometryArrayTrait;
use geoarrow::error::GeoArrowError;
use geoarrow::NativeArray;
Expand All @@ -22,7 +22,7 @@ pub(crate) fn return_geometry_array(
py: Python,
arr: Arc<dyn NativeArray>,
) -> PyGeoArrowResult<PyObject> {
Ok(PyGeometryArray::new(GeometryArrayDyn::new(arr))
Ok(PyGeometryArray::new(NativeArrayDyn::new(arr))
.to_geoarrow(py)?
.to_object(py))
}
Expand Down
4 changes: 2 additions & 2 deletions python/geoarrow-core/src/ffi/to_python/array.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use geoarrow::array::GeometryArrayDyn;
use geoarrow::array::NativeArrayDyn;
use geoarrow::chunked_array::ChunkedGeometryArrayTrait;
use geoarrow::NativeArray;
use pyo3::prelude::*;
Expand All @@ -12,7 +12,7 @@ pub fn geometry_array_to_pyobject(
py: Python,
arr: Arc<dyn NativeArray>,
) -> PyGeoArrowResult<PyObject> {
Ok(PyGeometryArray::new(GeometryArrayDyn::new(arr)).into_py(py))
Ok(PyGeometryArray::new(NativeArrayDyn::new(arr)).into_py(py))
}

pub fn chunked_geometry_array_to_pyobject(
Expand Down
4 changes: 2 additions & 2 deletions python/geoarrow-core/src/interop/wkb.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use geoarrow::array::{AsChunkedGeometryArray, AsGeometryArray, GeometryArrayDyn};
use geoarrow::array::{AsChunkedGeometryArray, AsGeometryArray, NativeArrayDyn};
use geoarrow::chunked_array::ChunkedGeometryArrayTrait;
use geoarrow::datatypes::GeoDataType;
use geoarrow::error::GeoArrowError;
Expand Down Expand Up @@ -59,7 +59,7 @@ pub fn from_wkb(
#[pyfunction]
pub fn to_wkb(py: Python, input: AnyGeometryInput) -> PyGeoArrowResult<PyObject> {
match input {
AnyGeometryInput::Array(arr) => Ok(PyGeometryArray::new(GeometryArrayDyn::new(Arc::new(
AnyGeometryInput::Array(arr) => Ok(PyGeometryArray::new(NativeArrayDyn::new(Arc::new(
_to_wkb::<i32>(arr.as_ref()),
)))
.into_py(py)),
Expand Down
16 changes: 8 additions & 8 deletions python/pyo3-geoarrow/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::error::{PyGeoArrowError, PyGeoArrowResult};
use crate::{PyGeometry, PyGeometryType};
use arrow::datatypes::Schema;
use arrow_array::RecordBatch;
use geoarrow::array::{from_arrow_array, GeometryArrayDyn};
use geoarrow::array::{from_arrow_array, NativeArrayDyn};

use geoarrow::error::GeoArrowError;
use geoarrow::scalar::GeometryScalar;
Expand All @@ -19,10 +19,10 @@ use pyo3_arrow::ffi::to_array_pycapsules;
use pyo3_arrow::PyArray;

#[pyclass(module = "geoarrow.rust.core._rust", name = "GeometryArray", subclass)]
pub struct PyGeometryArray(pub(crate) GeometryArrayDyn);
pub struct PyGeometryArray(pub(crate) NativeArrayDyn);

impl PyGeometryArray {
pub fn new(array: GeometryArrayDyn) -> Self {
pub fn new(array: NativeArrayDyn) -> Self {
Self(array)
}

Expand All @@ -39,7 +39,7 @@ impl PyGeometryArray {
self.0.as_ref()
}

pub fn into_inner(self) -> GeometryArrayDyn {
pub fn into_inner(self) -> NativeArrayDyn {
self.0
}

Expand Down Expand Up @@ -147,19 +147,19 @@ impl PyGeometryArray {
}
}

impl From<GeometryArrayDyn> for PyGeometryArray {
fn from(value: GeometryArrayDyn) -> Self {
impl From<NativeArrayDyn> for PyGeometryArray {
fn from(value: NativeArrayDyn) -> Self {
Self(value)
}
}

impl From<NativeArrayRef> for PyGeometryArray {
fn from(value: NativeArrayRef) -> Self {
Self(GeometryArrayDyn::new(value))
Self(NativeArrayDyn::new(value))
}
}

impl From<PyGeometryArray> for GeometryArrayDyn {
impl From<PyGeometryArray> for NativeArrayDyn {
fn from(value: PyGeometryArray) -> Self {
value.0
}
Expand Down
16 changes: 8 additions & 8 deletions src/array/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use crate::NativeArray;

#[derive(Debug, Clone)]
#[repr(transparent)]
pub struct GeometryArrayDyn(pub(crate) Arc<dyn NativeArray>);
pub struct NativeArrayDyn(pub(crate) Arc<dyn NativeArray>);

impl GeometryArrayDyn {
impl NativeArrayDyn {
pub fn new(array: Arc<dyn NativeArray>) -> Self {
Self(array)
}
Expand All @@ -29,19 +29,19 @@ impl GeometryArrayDyn {
}
}

impl From<NativeArrayRef> for GeometryArrayDyn {
impl From<NativeArrayRef> for NativeArrayDyn {
fn from(value: NativeArrayRef) -> Self {
Self(value)
}
}

impl From<GeometryArrayDyn> for NativeArrayRef {
fn from(value: GeometryArrayDyn) -> Self {
impl From<NativeArrayDyn> for NativeArrayRef {
fn from(value: NativeArrayDyn) -> Self {
value.0
}
}

impl NativeArray for GeometryArrayDyn {
impl NativeArray for NativeArrayDyn {
fn as_any(&self) -> &dyn std::any::Any {
self.0.as_any()
}
Expand Down Expand Up @@ -108,8 +108,8 @@ impl NativeArray for GeometryArrayDyn {
}
}

impl Display for GeometryArrayDyn {
impl Display for NativeArrayDyn {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "GeometryArrayDyn")
write!(f, "NativeArrayDyn")
}
}
2 changes: 1 addition & 1 deletion src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use coord::{
CoordBuffer, CoordBufferBuilder, CoordType, InterleavedCoordBuffer,
InterleavedCoordBufferBuilder, SeparatedCoordBuffer, SeparatedCoordBufferBuilder,
};
pub use dynamic::GeometryArrayDyn;
pub use dynamic::NativeArrayDyn;
pub use geometrycollection::{
GeometryCollectionArray, GeometryCollectionBuilder, GeometryCollectionCapacity,
};
Expand Down
6 changes: 3 additions & 3 deletions src/io/geozero/array/dynamic.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use geozero::{GeomProcessor, GeozeroGeometry};

use crate::array::dynamic::GeometryArrayDyn;
use crate::array::dynamic::NativeArrayDyn;
use crate::array::AsGeometryArray;
use crate::datatypes::{Dimension, GeoDataType};

impl GeozeroGeometry for GeometryArrayDyn {
impl GeozeroGeometry for NativeArrayDyn {
fn process_geom<P: GeomProcessor>(&self, processor: &mut P) -> geozero::error::Result<()>
where
Self: Sized,
Expand Down Expand Up @@ -97,7 +97,7 @@ mod test {
#[test]
fn test() {
let arr = point::point_array();
let geom_arr = GeometryArrayDyn(Arc::new(arr));
let geom_arr = NativeArrayDyn(Arc::new(arr));
let test = geom_arr.as_any().downcast_ref::<PointArray<2>>().unwrap();
dbg!(geom_arr.to_geo().unwrap());
dbg!(test);
Expand Down

0 comments on commit 62fd3fd

Please sign in to comment.