Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
dce590d7
提交
dce590d7
authored
3月 22, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Copy also SRID in ValueGeometry.getGeometry()
上级
baa0fa44
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
5 行删除
+19
-5
ValueGeometry.java
h2/src/main/org/h2/value/ValueGeometry.java
+14
-1
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+5
-4
没有找到文件。
h2/src/main/org/h2/value/ValueGeometry.java
浏览文件 @
dce590d7
...
@@ -141,7 +141,20 @@ public class ValueGeometry extends Value {
...
@@ -141,7 +141,20 @@ public class ValueGeometry extends Value {
* @return a copy of the geometry object
* @return a copy of the geometry object
*/
*/
public
Geometry
getGeometry
()
{
public
Geometry
getGeometry
()
{
return
getGeometryNoCopy
().
copy
();
Geometry
geometry
=
getGeometryNoCopy
();
Geometry
copy
=
geometry
.
copy
();
/*
* Geometry factory is not preserved in WKB format, but SRID is preserved.
*
* We use a new factory to read geometries from WKB with default SRID value of
* 0.
*
* Geometry.copy() copies the geometry factory and copied value has SRID form
* the factory instead of original SRID value. So we need to copy SRID here with
* non-recommended (but not deprecated) setSRID() method.
*/
copy
.
setSRID
(
geometry
.
getSRID
());
return
copy
;
}
}
public
Geometry
getGeometryNoCopy
()
{
public
Geometry
getGeometryNoCopy
()
{
...
...
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
dce590d7
...
@@ -648,13 +648,14 @@ public class TestSpatial extends TestBase {
...
@@ -648,13 +648,14 @@ public class TestSpatial extends TestBase {
GeometryFactory
geometryFactory
=
new
GeometryFactory
();
GeometryFactory
geometryFactory
=
new
GeometryFactory
();
Geometry
geometry
=
geometryFactory
.
createPoint
(
new
Coordinate
(
0
,
0
));
Geometry
geometry
=
geometryFactory
.
createPoint
(
new
Coordinate
(
0
,
0
));
geometry
.
setSRID
(
27572
);
geometry
.
setSRID
(
27572
);
ValueGeometry
valueGeometry
=
ValueGeometry
valueGeometry
=
ValueGeometry
.
getFromGeometry
(
geometry
);
ValueGeometry
.
getFromGeometry
(
geometry
);
Geometry
geometry2
=
geometryFactory
.
createPoint
(
new
Coordinate
(
0
,
0
));
Geometry
geometry2
=
geometryFactory
.
createPoint
(
new
Coordinate
(
0
,
0
));
geometry2
.
setSRID
(
5326
);
geometry2
.
setSRID
(
5326
);
ValueGeometry
valueGeometry2
=
ValueGeometry
valueGeometry2
=
ValueGeometry
.
getFromGeometry
(
geometry2
);
ValueGeometry
.
getFromGeometry
(
geometry2
);
assertFalse
(
valueGeometry
.
equals
(
valueGeometry2
));
assertFalse
(
valueGeometry
.
equals
(
valueGeometry2
));
ValueGeometry
valueGeometry3
=
ValueGeometry
.
getFromGeometry
(
geometry
);
assertEquals
(
valueGeometry
,
valueGeometry3
);
assertEquals
(
geometry
.
getSRID
(),
valueGeometry3
.
getGeometry
().
getSRID
());
// Check illegal geometry (no WKB representation)
// Check illegal geometry (no WKB representation)
try
{
try
{
ValueGeometry
.
get
(
"POINT EMPTY"
);
ValueGeometry
.
get
(
"POINT EMPTY"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论