Search in sources :

Example 16 with ConverterException

use of ch.ehi.ili2db.converter.ConverterException in project ili2db by claeis.

the class GpkgColumnConverter method toIomMultiCoord.

@Override
public IomObject toIomMultiCoord(Object geomobj, String sqlAttrName, boolean is3D) throws SQLException, ConverterException {
    byte[] bv = (byte[]) geomobj;
    Gpkg2iox conv = new Gpkg2iox();
    try {
        return conv.read(bv);
    } catch (ParseException e) {
        throw new ConverterException(e);
    }
}
Also used : ConverterException(ch.ehi.ili2db.converter.ConverterException) ParseException(com.vividsolutions.jts.io.ParseException)

Example 17 with ConverterException

use of ch.ehi.ili2db.converter.ConverterException in project ili2db by claeis.

the class GpkgColumnConverter method toIomSurface.

@Override
public IomObject toIomSurface(Object geomobj, String sqlAttrName, boolean is3D) throws SQLException, ConverterException {
    byte[] bv = (byte[]) geomobj;
    Gpkg2iox conv = new Gpkg2iox();
    try {
        return conv.read(bv);
    } catch (ParseException e) {
        throw new ConverterException(e);
    }
}
Also used : ConverterException(ch.ehi.ili2db.converter.ConverterException) ParseException(com.vividsolutions.jts.io.ParseException)

Example 18 with ConverterException

use of ch.ehi.ili2db.converter.ConverterException in project ili2db by claeis.

the class GpkgColumnConverter method toIomMultiSurface.

@Override
public IomObject toIomMultiSurface(Object geomobj, String sqlAttrName, boolean is3D) throws SQLException, ConverterException {
    byte[] bv = (byte[]) geomobj;
    Gpkg2iox conv = new Gpkg2iox();
    try {
        return conv.read(bv);
    } catch (ParseException e) {
        throw new ConverterException(e);
    }
}
Also used : ConverterException(ch.ehi.ili2db.converter.ConverterException) ParseException(com.vividsolutions.jts.io.ParseException)

Example 19 with ConverterException

use of ch.ehi.ili2db.converter.ConverterException in project ili2db by claeis.

the class GpkgColumnConverter method toIomCoord.

@Override
public IomObject toIomCoord(Object geomobj, String sqlAttrName, boolean is3D) throws SQLException, ConverterException {
    byte[] bv = (byte[]) geomobj;
    Gpkg2iox conv = new Gpkg2iox();
    try {
        return conv.read(bv);
    } catch (ParseException e) {
        throw new ConverterException(e);
    }
}
Also used : ConverterException(ch.ehi.ili2db.converter.ConverterException) ParseException(com.vividsolutions.jts.io.ParseException)

Example 20 with ConverterException

use of ch.ehi.ili2db.converter.ConverterException in project ili2db by claeis.

the class OracleColumnConverter method toIomCoord.

@Override
public IomObject toIomCoord(Object geomobj, String sqlAttrName, boolean is3D) throws java.sql.SQLException, ConverterException {
    JGeometry geometry = JGeometry.load((oracle.sql.STRUCT) geomobj);
    if (geometry.getType() != JGeometry.GTYPE_POINT) {
        throw new ConverterException("unexpected GTYPE (" + OracleUtility.gtype2str(geometry.getType()) + ")");
    } else {
        int dim = geometry.getDimensions();
        boolean isCurrentValue3D = (dim == 3);
        if (isCurrentValue3D != is3D) {
            throw new ConverterException("unexpected dimension (" + Integer.toString(dim) + ")");
        } else {
            double[] valuev = geometry.getFirstPoint();
            IomObject coord = new Iom_jObject("COORD", null);
            coord.setattrvalue("C1", Double.toString(valuev[0]));
            coord.setattrvalue("C2", Double.toString(valuev[1]));
            if (dim == 3) {
                coord.setattrvalue("C3", Double.toString(valuev[2]));
            }
            return coord;
        }
    }
}
Also used : ConverterException(ch.ehi.ili2db.converter.ConverterException) IomObject(ch.interlis.iom.IomObject) JGeometry(oracle.spatial.geometry.JGeometry) Iom_jObject(ch.interlis.iom_j.Iom_jObject)

Aggregations

ConverterException (ch.ehi.ili2db.converter.ConverterException)32 ParseException (com.vividsolutions.jts.io.ParseException)17 IomObject (ch.interlis.iom.IomObject)8 IoxException (ch.interlis.iox.IoxException)8 Wkb2iox (ch.interlis.iox_j.wkb.Wkb2iox)6 SQLException (java.sql.SQLException)6 Iom_jObject (ch.interlis.iom_j.Iom_jObject)5 AttributeDef (ch.interlis.ili2c.metamodel.AttributeDef)3 BlackboxType (ch.interlis.ili2c.metamodel.BlackboxType)3 CoordType (ch.interlis.ili2c.metamodel.CoordType)3 EnumerationType (ch.interlis.ili2c.metamodel.EnumerationType)3 SurfaceOrAreaType (ch.interlis.ili2c.metamodel.SurfaceOrAreaType)3 SurfaceType (ch.interlis.ili2c.metamodel.SurfaceType)3 Viewable (ch.interlis.ili2c.metamodel.Viewable)3 JGeometry (oracle.spatial.geometry.JGeometry)3 ArrayMapping (ch.ehi.ili2db.mapping.ArrayMapping)2 MultiLineMapping (ch.ehi.ili2db.mapping.MultiLineMapping)2 MultiPointMapping (ch.ehi.ili2db.mapping.MultiPointMapping)2 MultiSurfaceMapping (ch.ehi.ili2db.mapping.MultiSurfaceMapping)2 AbstractClassDef (ch.interlis.ili2c.metamodel.AbstractClassDef)2