本文整理汇总了Java中com.vividsolutions.jts.geom.Envelope.isNull方法的典型用法代码示例。如果您正苦于以下问题:Java Envelope.isNull方法的具体用法?Java Envelope.isNull怎么用?Java Envelope.isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.Envelope
的用法示例。
在下文中一共展示了Envelope.isNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: diagonalSize
import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
public static double diagonalSize(Envelope env) {
if (env.isNull()) {
return 0.0;
}
double width = env.getWidth();
double hgt = env.getHeight();
return Math.sqrt(width * width + hgt * hgt);
}
示例2: insert
import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
/**
* Inserts an item having the given bounds into the tree.
*/
@Override
public void insert(Envelope itemEnv, Object item) {
if (itemEnv.isNull()) {
return;
}
super.insert(itemEnv, item);
}
示例3: publish
import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
public void publish(DmlEvent event) {
String metadata = extractMetadata(event);
String changedTableSchema = event.getSchemaName();
String changedTableName = event.getTableName();
String type = event.getType().toString();
Long transactionId = event.getTransactionId();
PGobject timestamp = getTimestamp(event);
PGobject oldjson = getJsonOldValues(event);
PGobject newjson = getJsonNewValues(event);
Object[] params;
String sql;
int[] types;
Envelope envelope = event.getEnvelope();
if (! envelope.isNull()) {
//expand if necessasry
if (envelope.getHeight() < minSize && envelope.getWidth() < minSize) {
envelope.expandBy(bufferSize);
}
//Transform Bounding Box of the change into WKB
GeometryFactory geomFactory = new GeometryFactory(new PrecisionModel(), epsgCode);
WKBWriter wkbWriter = new WKBWriter(2, true);
byte[] wkb = wkbWriter.write(geomFactory.toGeometry(envelope));
params = new Object[]{wkb, type, changedTableSchema, changedTableName, transactionId, timestamp, metadata, oldjson, newjson};
types = new int[] {Types.BINARY, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BIGINT, Types.OTHER, Types.VARCHAR, Types.OTHER, Types.OTHER};
sql = "INSERT INTO "+schemaname + "." + tableName + "("+regionColumnName
+", "+transactionTypeColumnName + ", "+schemaColumnName+", "+tableColumnName+", "+txIdColumnName
+", "+commitTimestampColumnName+", "+metadataColumnName+", "+jsonOldValuesColumnName+", "+jsonNewValuesColumName
+") VALUES (?,?,?,?,?,?,?,?,?)";
}
else {
//geometry is null, do not include it in SQL insert statement
params = new Object[]{type, changedTableSchema, changedTableName, transactionId, timestamp, metadata, oldjson, newjson};
types = new int[] {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BIGINT, Types.OTHER, Types.VARCHAR, Types.OTHER, Types.OTHER};
sql = "INSERT INTO "+schemaname + "." + tableName + "("
+transactionTypeColumnName + ", "+schemaColumnName+", "+tableColumnName+", "+txIdColumnName
+", "+commitTimestampColumnName+", "+metadataColumnName+", "+jsonOldValuesColumnName+", "+jsonNewValuesColumName
+") VALUES (?,?,?,?,?,?,?,?)";
}
template.update(sql, params,types);
}