org.locationtech.jts.io.ParseException.getMessage()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.locationtech.jts.io.ParseException.getMessage()方法的一些代码示例,展示了ParseException.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ParseException.getMessage()方法的具体详情如下:
包路径:org.locationtech.jts.io.ParseException
类名称:ParseException
方法名:getMessage

ParseException.getMessage介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

@Override
protected Envelope getEnvelopeFromResultSet(ResultSet r) throws SQLException {
  byte[] bytes = r.getBytes(2);
  WKBReader reader = new WKBReader();
  Geometry bbox = null;
  try {
    bbox = reader.read(bytes);
  } catch (ParseException e) {
    LOGGER.log(Level.SEVERE, e.getMessage(), e);
    throw new SQLException(e.getMessage());
  }
  return bbox.getEnvelopeInternal();
}

代码示例来源:origin: geotools/geotools

@Override
protected Envelope getEnvelopeFromResultSet(ResultSet r) throws SQLException {
  byte[] bytes = r.getBytes(2);
  WKBReader reader = new WKBReader();
  Geometry bbox = null;
  try {
    bbox = reader.read(bytes);
  } catch (ParseException e) {
    LOGGER.log(Level.SEVERE, e.getMessage(), e);
    throw new SQLException(e.getMessage());
  }
  return bbox.getEnvelopeInternal();
}

代码示例来源:origin: geotools/geotools

@Override
protected Envelope getExtent(ImageLevelInfo li, Connection con)
    throws SQLException, IOException {
  String extentSelect = getExtentSelectStatment(li);
  String statementString =
      MessageFormat.format(extentSelect, new Object[] {li.getSpatialTableName()});
  Envelope extent = null;
  PreparedStatement s = con.prepareStatement(statementString);
  ResultSet r = s.executeQuery();
  WKBReader reader = new WKBReader();
  while (r.next()) {
    byte[] bytes = r.getBytes(1);
    Geometry g;
    try {
      g = reader.read(bytes);
    } catch (ParseException e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      throw new IOException(e);
    }
    if (extent == null) {
      extent = g.getEnvelopeInternal();
    } else {
      extent.expandToInclude(g.getEnvelopeInternal());
    }
  }
  r.close();
  s.close();
  return extent;
}

代码示例来源:origin: geotools/geotools

g = reader.read(envBytes);
} catch (ParseException e) {
  LOGGER.log(Level.SEVERE, e.getMessage(), e);
  throw new IOException(e);

代码示例来源:origin: geotools/geotools

g = reader.read(bytes);
} catch (ParseException e) {
  LOGGER.log(Level.SEVERE, e.getMessage(), e);
  throw new IOException(e);

代码示例来源:origin: geotools/geotools

/**
 * Builds geometry
 *
 * @param geometry
 * @return a geometry
 * @throws CQLException
 */
public Literal buildGeometry(final IToken geometry) throws CQLException {
  try {
    String wktGeom = scanExpression(geometry);
    // transforms wkt to vividsolution geometry
    String vividGeom = transformWKTGeometry(wktGeom);
    WKTReader reader = new WKTReader();
    Geometry g = reader.read(vividGeom);
    Literal literal = filterFactory.literal(g);
    return literal;
  } catch (org.locationtech.jts.io.ParseException e) {
    throw new CQLException(e.getMessage(), geometry, e, this.cqlSource);
  } catch (Exception e) {
    throw new CQLException(
        "Error building WKT Geometry: " + e.getMessage(), geometry, e, this.cqlSource);
  }
}

代码示例来源:origin: geotools/geotools

geom = reader.read(w);
} catch (ParseException e) {
  fail(e.getMessage());

代码示例来源:origin: locationtech/jts

public static Geometry read(WKTReader reader, String wkt) {
 try {
  return reader.read(wkt);
 } catch (ParseException e) {
  throw new RuntimeException(e.getMessage());
 }
}
protected List readList(String[] wkt) {

代码示例来源:origin: org.geoserver.web/gs-web-core

@Override
public Object convertToObject(String value, Locale locale) {
  try {
    return reader.read(value);
  } catch (ParseException e) {
    try {
      String[] values = value.split("\\s+");
      if (values.length > 0 && values.length < 3) {
        Coordinate c = new Coordinate();
        c.x = Double.parseDouble(values[0]);
        c.y = Double.parseDouble(values[1]);
        return gf.createPoint(c);
      }
    } catch (NumberFormatException nfe) {
      // fall through
    }
    ConversionException ce = new ConversionException(e.getMessage());
    ce.setResourceKey(GeometryTextArea.class.getSimpleName() + ".parseError");
    throw ce;
  }
}

代码示例来源:origin: locationtech/jts

private void checkEqual(KMLWriter kmlWriter, String wkt, String expectedKML) {
 try {
  Geometry geom = rdr.read(wkt);
  checkEqual(kmlWriter, geom, expectedKML);
 } catch (ParseException e) {
  throw new RuntimeException("ParseException: " + e.getMessage());
 }
}

代码示例来源:origin: locationtech/jts

private void readBad(String wkt)
   throws IOException
 {
  boolean threwParseEx = false;
  try {
   Geometry g = rdr.read(wkt);
  }
  catch (ParseException ex) {
   System.out.println(ex.getMessage());
   threwParseEx = true;
  }
  assertTrue(threwParseEx);
 }
}

代码示例来源:origin: locationtech/jts

private void readBad(String wkt)
   throws IOException
 {
  boolean threwParseEx = false;
  try {
   Geometry g = rdr.read(wkt);
  }
  catch (ParseException ex) {
   System.out.println(ex.getMessage());
   threwParseEx = true;
  }
  assertTrue(threwParseEx);
 }
}

代码示例来源:origin: locationtech/jts

/**
 * Reads a {@link Geometry} from a WKT string using a custom {@link GeometryFactory}.
 *  
 * @param geomFactory the custom factory to use
 * @param wkt the WKT string
 * @return the geometry read
 */
protected static Geometry read(GeometryFactory geomFactory, String wkt) {
 WKTReader reader = new WKTReader(geomFactory);
 try {
   return reader.read(wkt);
 } catch (ParseException e) {
  throw new RuntimeException(e.getMessage());
 }
}

代码示例来源:origin: geoserver/geofence

throw new ApplicationException(e.getMessage(), e);
} catch (ParseException e) {
  logger.error(e.getMessage(), e);
  throw new ApplicationException(e.getMessage(), e);

代码示例来源:origin: geoserver/geofence

throw new ApplicationException(e.getMessage(), e);
} catch (ParseException e) {
  logger.error(e.getMessage(), e);
  throw new ApplicationException(e.getMessage(), e);

代码示例来源:origin: geoserver/geofence

detailsOld.setArea((MultiPolygon) g);
} catch (ParseException ex) {
  throw new BadRequestRestEx("Error parsing WKT:" + ex.getMessage());

代码示例来源:origin: geoserver/geofence

protected LayerDetails detailsFromInput(RESTInputRule in) {
  RESTLayerConstraints constraints = in.getConstraints();
  if (constraints != null) {
    LayerDetails details = new LayerDetails();
    if (constraints.getAllowedStyles() != null) {
      details.setAllowedStyles(new HashSet(constraints.getAllowedStyles()));
    }
    if (constraints.getAttributes() != null) {
      details.setAttributes(new HashSet(constraints.getAttributes()));
    }
    details.setCqlFilterRead(constraints.getCqlFilterRead());
    details.setCqlFilterWrite(constraints.getCqlFilterWrite());
    details.setDefaultStyle(constraints.getDefaultStyle());
    if (constraints.getRestrictedAreaWkt() != null) {
      WKTReader reader = new WKTReader();
      Geometry g;
      try {
        g = reader.read(constraints.getRestrictedAreaWkt());
      } catch (ParseException ex) {
        throw new BadRequestRestEx("Error parsing WKT:" + ex.getMessage());
      }
      details.setArea((MultiPolygon) g);
    }
    details.setType(constraints.getType());
    return details;
  } else {
    return null;
  }
}
// ==========================================================================

相关文章