Example usage for org.hibernate.spatial.dialect.postgis PGGeometryTypeDescriptor toGeometry

List of usage examples for org.hibernate.spatial.dialect.postgis PGGeometryTypeDescriptor toGeometry

Introduction

In this page you can find the example usage for org.hibernate.spatial.dialect.postgis PGGeometryTypeDescriptor toGeometry.

Prototype

public static Geometry<?> toGeometry(Object object) 

Source Link

Usage

From source file:org.openremote.manager.server.asset.ServerAsset.java

License:Open Source License

@SuppressWarnings("unchecked")
public ServerAsset(boolean filterProtectedAttributes, String id, long version, Date createdOn, String name,
        String type, String parentId, String parentName, String parentType, String realmId, String tenantRealm,
        String tenantDisplayName, Object location, Array path, String attributes) throws SQLException {
    super(filterProtectedAttributes, id, version, createdOn, name, type, parentId, parentName, parentType,
            realmId, tenantRealm, tenantDisplayName, path != null ? (String[]) path.getArray() : null,
            attributes != null && attributes.length() > 0
                    ? Values.instance().<ObjectValue>parse(attributes).orElse(null)
                    : null);/*from w ww .  j a v  a  2s  .c  o m*/

    Point position = null;

    if (location != null) {
        Geometry geomPoint = PGGeometryTypeDescriptor.toGeometry(location);
        if (geomPoint instanceof org.geolatte.geom.Point) {
            position = (Point) JTS.to(geomPoint);
        }
    }

    setLocation(position);
}