geopackage-sdk/src/main/java/mil/nga/geopackage/features/user/FeatureRow.java
@Override
    public void setValue(int index, Object value) {
        if (index == getGeometryColumnIndex() && value instanceof byte[]) {
            byte[] bytes = (byte[]) value;
            value = new GeoPackageGeometryData(bytes);
        }
        super.setValue(index, value);
    }

    /**
     * Get the geometry
     *
     * @return geometry data
     */
    public GeoPackageGeometryData getGeometry() {
        GeoPackageGeometryData geometryData = null;
        Object value = getValue(getGeometryColumnIndex());
        if (value != null) {
            geometryData = (GeoPackageGeometryData) value;
        }
        return geometryData;
    }

    /**
     * Set the geometry data
     *
     * @param geometryData geometry data
     */
    public void setGeometry(GeoPackageGeometryData geometryData) {
        setValue(getGeometryColumnIndex(), geometryData);
    }

    /**
     * Get the simple features geometry value
     *
     * @return geometry
     * @since 3.1.0
     */
    public Geometry getGeometryValue() {
        GeoPackageGeometryData data = getGeometry();
        Geometry geometry = null;
        if (data != null) {
            geometry = data.getGeometry();
        }
        return geometry;
    }

    /**
     * Get the simple features geometry type
     *
     * @return geometry type
     * @since 3.2.0
     */
    public GeometryType getGeometryType() {
        Geometry geometry = getGeometryValue();
        GeometryType geometryType = null;
        if (geometry != null) {
            geometryType = geometry.getGeometryType();
        }
        return geometryType;
    }

    /**
     * Get the geometry envelope
     *
     * @return geometry envelope
     * @since 3.1.0
     */
    public GeometryEnvelope getGeometryEnvelope() {
        GeoPackageGeometryData data = getGeometry();
        GeometryEnvelope envelope = null;
        if (data != null) {
            envelope = data.getOrBuildEnvelope();
        }
        return envelope;
    }

    /**
     * Copy the row
     *
     * @return row copy
     * @since 3.0.1
     */
    public FeatureRow copy() {
        return new FeatureRow(this);
    }

    /**
     * {@inheritDoc}
     * Handles geometry columns
     */
    @Override
    protected Object copyValue(FeatureColumn column, Object value) {

        Object copyValue = null;

        if (column.isGeometry() && value instanceof GeoPackageGeometryData) {

            GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
            try {
                byte[] bytes = geometryData.toBytes();
                byte[] copyBytes = Arrays.copyOf(bytes, bytes.length);
                copyValue = new GeoPackageGeometryData(copyBytes);
            } catch (IOException e) {
                throw new GeoPackageException(
                        "Failed to copy Geometry Data bytes. column: "
                                + column.getName(), e);
            }

        } else {
            copyValue = super.copyValue(column, value);
        }

        return copyValue;
    }
@Override
    public void setValue(int index, Object value) {
        if (index == getGeometryColumnIndex() && value instanceof byte[]) {
            byte[] bytes = (byte[]) value;
            value = new GeoPackageGeometryData(bytes);
        }
        super.setValue(index, value);
    }

    /**
     * Get the geometry
     *
     * @return geometry data
     */
    public GeoPackageGeometryData getGeometry() {
        GeoPackageGeometryData geometryData = null;
        Object value = getValue(getGeometryColumnIndex());
        if (value != null) {
            geometryData = (GeoPackageGeometryData) value;
        }
        return geometryData;
    }

    /**
     * Set the geometry data
     *
     * @param geometryData geometry data
     */
    public void setGeometry(GeoPackageGeometryData geometryData) {
        setValue(getGeometryColumnIndex(), geometryData);
    }

    /**
     * Get the simple features geometry value
     *
     * @return geometry
     * @since 3.1.0
     */
    public Geometry getGeometryValue() {
        GeoPackageGeometryData data = getGeometry();
        Geometry geometry = null;
        if (data != null) {
            geometry = data.getGeometry();
        }
        return geometry;
    }

    /**
     * Get the simple features geometry type
     *
     * @return geometry type
     * @since 3.2.0
     */
    public GeometryType getGeometryType() {
        Geometry geometry = getGeometryValue();
        GeometryType geometryType = null;
        if (geometry != null) {
            geometryType = geometry.getGeometryType();
        }
        return geometryType;
    }

    /**
     * Get the geometry envelope
     *
     * @return geometry envelope
     * @since 3.1.0
     */
    public GeometryEnvelope getGeometryEnvelope() {
        GeoPackageGeometryData data = getGeometry();
        GeometryEnvelope envelope = null;
        if (data != null) {
            envelope = data.getOrBuildEnvelope();
        }
        return envelope;
    }

    /**
     * Copy the row
     *
     * @return row copy
     * @since 3.0.1
     */
    public FeatureRow copy() {
        return new FeatureRow(this);
    }

    /**
     * {@inheritDoc}
     * Handles geometry columns
     */
    @Override
    protected Object copyValue(FeatureColumn column, Object value) {

        Object copyValue = null;

        if (column.isGeometry() && value instanceof GeoPackageGeometryData) {

            GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
            try {
                byte[] bytes = geometryData.toBytes();
                byte[] copyBytes = Arrays.copyOf(bytes, bytes.length);
                copyValue = new GeoPackageGeometryData(copyBytes);
            } catch (IOException e) {
                throw new GeoPackageException(
                        "Failed to copy Geometry Data bytes. column: "
                                + column.getName(), e);
            }

        } else {
            copyValue = super.copyValue(column, value);
        }

        return copyValue;
    }
@ Override public void setValue ( int index , Object value ) { if ( index == getGeometryColumnIndex ( ) && value instanceof byte [ ] ) { byte [ ] bytes = ( byte [ ] ) value ; value = new GeoPackageGeometryData ( bytes ) ; } super . setValue ( index , value ) ; } /**
     * Get the geometry
     *
     * @return geometry data
     */ public GeoPackageGeometryData getGeometry ( ) { GeoPackageGeometryData geometryData = null ; Object value = getValue ( getGeometryColumnIndex ( ) ) ; if ( value != null ) { geometryData = ( GeoPackageGeometryData ) value ; } return geometryData ; } /**
     * Set the geometry data
     *
     * @param geometryData geometry data
     */ public void setGeometry ( GeoPackageGeometryData geometryData ) { setValue ( getGeometryColumnIndex ( ) , geometryData ) ; } /**
     * Get the simple features geometry value
     *
     * @return geometry
     * @since 3.1.0
     */ public Geometry getGeometryValue ( ) { GeoPackageGeometryData data = getGeometry ( ) ; Geometry geometry = null ; if ( data != null ) { geometry = data . getGeometry ( ) ; } return geometry ; } /**
     * Get the simple features geometry type
     *
     * @return geometry type
     * @since 3.2.0
     */ public GeometryType getGeometryType ( ) { Geometry geometry = getGeometryValue ( ) ; GeometryType geometryType = null ; if ( geometry != null ) { geometryType = geometry . getGeometryType ( ) ; } return geometryType ; } /**
     * Get the geometry envelope
     *
     * @return geometry envelope
     * @since 3.1.0
     */ public GeometryEnvelope getGeometryEnvelope ( ) { GeoPackageGeometryData data = getGeometry ( ) ; GeometryEnvelope envelope = null ; if ( data != null ) { envelope = data . getOrBuildEnvelope ( ) ; } return envelope ; } /**
     * Copy the row
     *
     * @return row copy
     * @since 3.0.1
     */ public FeatureRow copy ( ) { return new FeatureRow ( this ) ; } /**
     * {@inheritDoc}
     * Handles geometry columns
     */ @ Override protected Object copyValue ( FeatureColumn column , Object value ) { Object copyValue = null ; if ( column . isGeometry ( ) && value instanceof GeoPackageGeometryData ) { GeoPackageGeometryData geometryData = ( GeoPackageGeometryData ) value ; try { byte [ ] bytes = geometryData . toBytes ( ) ; byte [ ] copyBytes = Arrays . copyOf ( bytes , bytes . length ) ; copyValue = new GeoPackageGeometryData ( copyBytes ) ; } catch ( IOException e ) { throw new GeoPackageException ( "Failed to copy Geometry Data bytes. column: " + column . getName ( ) , e ) ; } } else { copyValue = super . copyValue ( column , value ) ; } return copyValue ; }
{@inheritDoc}
Handles geometry columns
{