/** * @param s definition of the polygon in PostgreSQL's syntax. * @throws SQLException on conversion failure */ public PGpolygon(String s) throws SQLException { this(); setValue(s); }
/** * Required by the driver. */ public PGpolygon() { setType("polygon"); }
return new PGpolygon(rawValue.asString()); } catch (final SQLException e) { LOGGER.error("Failed to parse point {}, {}", rawValue.asString(), e);
@Override protected Polygon toObject(PGpolygon value) { Polygon obj=new Polygon(); obj.setValue(value.getValue()); return obj; }
@Override protected PGpolygon newInstance() { return new PGpolygon(); }
private PGpolygon makePGpolygon(final ArrayList al_points) { final PGpoint[] pol = new PGpoint[al_points.size()]; for (int i=0; i<pol.length; i++) { Point p = (Point)al_points.get(i); pol[i] = new PGpoint(p.x, p.y); } return new PGpolygon(pol); }
/** * @param s definition of the polygon in PostgreSQL's syntax. * @exception SQLException on conversion failure */ public PGpolygon(String s) throws SQLException { this(); setValue(s); }
/** * Required by the driver */ public PGpolygon() { setType("polygon"); }
@Override protected Polygon toObjectFromString(String value) { String val=(String)value; try { PGpolygon pgObject=new PGpolygon(val); return toObject(pgObject); } catch(SQLException e) { throw new RuntimeException(e); } }
/** * @param s definition of the polygon in PostgreSQL's syntax. * @exception SQLException on conversion failure */ public PGpolygon(String s) throws SQLException { this(); setValue(s); }
/** * Required by the driver */ public PGpolygon() { setType("polygon"); }
@Override public void nullSafeSet(PreparedStatement preparedStatement, Object value, int i, SharedSessionContractImplementor sessionImplementor) throws HibernateException, SQLException { Polygon polygon = (Polygon) value; if (value == null) { preparedStatement.setNull(i, java.sql.Types.OTHER); } else { preparedStatement.setObject(i, new PGpolygon(convert(polygon.getPoints()))); } }
/** * @param s definition of the polygon in PostgreSQL's syntax. * @exception SQLException on conversion failure */ public PGpolygon(String s) throws SQLException { this(); setValue(s); }
/** * Required by the driver */ public PGpolygon() { setType("polygon"); }
/** * Generate a PGpolygon that straddles the x-axis and represents the interval. * * @param val value to transform, may be null * @return simple 4-point polygon or null */ public PGpolygon generatePolygon2D(Interval val) { if (val == null) return null; List<PGpoint> verts = new ArrayList<PGpoint>(); // draw a 2D polygon that looks like a tooth-up-comb with each tooth having x-range that // corresponds to one (sub) interval... it is a simple box for an Interval with no sub-samples // full-span line at y1 verts.add(new PGpoint(val.getLower().doubleValue(), y1)); verts.add(new PGpoint(val.getUpper().doubleValue(), y1)); // just the basic bounds interval verts.add(new PGpoint(val.getUpper().doubleValue(), y2)); verts.add(new PGpoint(val.getLower().doubleValue(), y2)); return new PGpolygon(verts.toArray(new PGpoint[verts.size()])); }
@Override protected void setValue(PGpolygon obj, String value) throws SQLException { obj.setValue(value); }
private PGpolygon makePGpolygon(final double[][][] bezarr) { final PGpoint[] points = new PGpoint[bezarr[0][0].length * 3]; final double[][] p_l = bezarr[0]; final double[][] p = bezarr[1]; final double[][] p_r = bezarr[2]; for (int i=0, j=0; i<points.length; i+=3, j++) { points[i] = new PGpoint(p_l[0][j], p_l[1][j]); points[i+1] = new PGpoint(p[0][j], p[1][j]); points[i+2] = new PGpoint(p_r[0][j], p_r[1][j]); } return new PGpolygon(points); }
return new PGpolygon(verts.toArray(new PGpoint[verts.size()]));
return new PGpolygon(rawValue.asString()); } catch (final SQLException e) { LOGGER.error("Failed to parse point {}, {}", rawValue.asString(), e);