Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
3a4f9d8f
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3a4f9d8f
编写于
6月 12, 2021
作者:
S
Serge Rider
提交者:
GitHub
6月 12, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12826 from dbeaver/gis-presentation-save-srid-fix#12147
#12147 Persist SRID in presentation mode
上级
e7490eec
7179f66f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
25 deletion
+34
-25
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/GISBrowserViewer.java
.../src/org/jkiss/dbeaver/ui/gis/panel/GISBrowserViewer.java
+2
-1
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/GISLeafletViewer.java
.../src/org/jkiss/dbeaver/ui/gis/panel/GISLeafletViewer.java
+27
-23
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/presentation/GeometryPresentation.java
...iss/dbeaver/ui/gis/presentation/GeometryPresentation.java
+5
-1
未找到文件。
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/GISBrowserViewer.java
浏览文件 @
3a4f9d8f
...
...
@@ -30,6 +30,7 @@ import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import
org.jkiss.dbeaver.ui.controls.resultset.IResultSetController
;
import
org.jkiss.dbeaver.ui.controls.resultset.IResultSetSelection
;
import
org.jkiss.dbeaver.ui.controls.resultset.ResultSetRow
;
import
org.jkiss.dbeaver.ui.data.IAttributeController
;
import
org.jkiss.dbeaver.ui.data.IDataController
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.editors.BaseValueEditor
;
...
...
@@ -56,7 +57,7 @@ public class GISBrowserViewer extends BaseValueEditor<Browser> implements IGeome
{
leafletViewer
=
new
GISLeafletViewer
(
editPlaceholder
,
valueController
,
new
DBDAttributeBinding
[]{((
IAttributeController
)
valueController
).
getBinding
()}
,
GisTransformUtils
.
getSpatialDataProvider
(
valueController
.
getExecutionContext
().
getDataSource
()));
return
leafletViewer
.
getBrowser
();
}
...
...
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/GISLeafletViewer.java
浏览文件 @
3a4f9d8f
...
...
@@ -52,8 +52,6 @@ import org.jkiss.dbeaver.ui.UIIcon;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.css.CSSUtils
;
import
org.jkiss.dbeaver.ui.css.DBStyles
;
import
org.jkiss.dbeaver.ui.data.IAttributeController
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.dbeaver.ui.gis.GeometryDataUtils
;
import
org.jkiss.dbeaver.ui.gis.GeometryViewerConstants
;
...
...
@@ -70,10 +68,8 @@ import org.jkiss.utils.IOUtils;
import
org.locationtech.jts.geom.Geometry
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
public
class
GISLeafletViewer
implements
IGeometryValueEditor
{
private
static
final
Log
log
=
Log
.
getLog
(
GISLeafletViewer
.
class
);
...
...
@@ -88,7 +84,7 @@ public class GISLeafletViewer implements IGeometryValueEditor {
private
static
final
Gson
gson
=
new
GsonBuilder
()
.
registerTypeHierarchyAdapter
(
DBDContent
.
class
,
new
DBDContentAdapter
()).
create
();
private
final
IValueController
valueController
;
private
final
DBDAttributeBinding
[]
bindings
;
private
final
Browser
browser
;
private
DBGeometry
[]
lastValue
;
private
int
sourceSRID
;
// Explicitly set SRID
...
...
@@ -101,8 +97,8 @@ public class GISLeafletViewer implements IGeometryValueEditor {
private
boolean
flipCoordinates
=
false
;
private
final
Composite
composite
;
public
GISLeafletViewer
(
Composite
parent
,
IValueController
valueController
,
SpatialDataProvider
spatialDataProvider
)
{
this
.
valueController
=
valueController
;
public
GISLeafletViewer
(
Composite
parent
,
@NotNull
DBDAttributeBinding
[]
bindings
,
SpatialDataProvider
spatialDataProvider
)
{
this
.
bindings
=
bindings
;
this
.
flipCoordinates
=
spatialDataProvider
!=
null
&&
spatialDataProvider
.
isFlipCoordinates
();
...
...
@@ -139,17 +135,20 @@ public class GISLeafletViewer implements IGeometryValueEditor {
}
{
// TODO:
// Following code uses properties from very first attribute
// and ignores other attributes, if present. There's no clear
// vision of what we should do here instead.
// Check for save settings
if
(
valueController
instanceof
IAttributeController
)
{
DBDAttributeBinding
binding
=
((
IAttributeController
)
valueController
).
getBinding
();
if
(
binding
.
getEntityAttribute
()
!=
null
)
{
DBVEntity
vEntity
=
DBVUtils
.
getVirtualEntity
(
binding
,
false
);
if
(
vEntity
!=
null
)
{
DBVEntityAttribute
vAttr
=
vEntity
.
getVirtualAttribute
(
binding
,
false
);
if
(
vAttr
!=
null
)
{
this
.
flipCoordinates
=
CommonUtils
.
getBoolean
(
vAttr
.
getProperty
(
PROP_FLIP_COORDINATES
),
this
.
flipCoordinates
);
this
.
sourceSRID
=
CommonUtils
.
toInt
(
vAttr
.
getProperty
(
PROP_SRID
),
this
.
sourceSRID
);
}
DBDAttributeBinding
binding
=
bindings
[
0
];
if
(
binding
.
getEntityAttribute
()
!=
null
)
{
DBVEntity
vEntity
=
DBVUtils
.
getVirtualEntity
(
binding
,
false
);
if
(
vEntity
!=
null
)
{
DBVEntityAttribute
vAttr
=
vEntity
.
getVirtualAttribute
(
binding
,
false
);
if
(
vAttr
!=
null
)
{
this
.
flipCoordinates
=
CommonUtils
.
getBoolean
(
vAttr
.
getProperty
(
PROP_FLIP_COORDINATES
),
this
.
flipCoordinates
);
this
.
sourceSRID
=
CommonUtils
.
toInt
(
vAttr
.
getProperty
(
PROP_SRID
),
this
.
sourceSRID
);
}
}
}
...
...
@@ -248,9 +247,9 @@ public class GISLeafletViewer implements IGeometryValueEditor {
}
int
attributeSrid
=
GisConstants
.
SRID_SIMPLE
;
if
(
valueController
!=
null
&&
valueController
.
getValueTyp
e
()
instanceof
GisAttribute
)
{
if
(
bindings
[
0
].
getAttribut
e
()
instanceof
GisAttribute
)
{
try
{
attributeSrid
=
((
GisAttribute
)
valueController
.
getValueTyp
e
())
attributeSrid
=
((
GisAttribute
)
bindings
[
0
].
getAttribut
e
())
.
getAttributeGeometrySRID
(
new
VoidProgressMonitor
());
}
catch
(
DBCException
e
)
{
log
.
error
(
e
);
...
...
@@ -511,6 +510,12 @@ public class GISLeafletViewer implements IGeometryValueEditor {
Action
crsSelectorAction
=
new
SelectCRSAction
(
this
);
toolBarManager
.
add
(
ActionUtils
.
makeActionContribution
(
crsSelectorAction
,
true
));
if
(
Arrays
.
stream
(
lastValue
).
map
(
DBGeometry:
:
getSRID
).
distinct
().
count
()
>
1
)
{
// Disallow changing srid if geometries have different srid
// Maybe we should transform them into source srid first and then transmute into a desired one?
crsSelectorAction
.
setEnabled
(
false
);
}
Action
tilesSelectorAction
=
new
SelectTilesAction
(
this
);
toolBarManager
.
add
(
ActionUtils
.
makeActionContribution
(
tilesSelectorAction
,
true
));
...
...
@@ -562,8 +567,7 @@ public class GISLeafletViewer implements IGeometryValueEditor {
}
private
void
saveAttributeSettings
()
{
if
(
valueController
instanceof
IAttributeController
)
{
DBDAttributeBinding
binding
=
((
IAttributeController
)
valueController
).
getBinding
();
for
(
DBDAttributeBinding
binding
:
bindings
)
{
if
(
binding
.
getEntityAttribute
()
!=
null
)
{
DBVEntity
vEntity
=
DBVUtils
.
getVirtualEntity
(
binding
,
true
);
DBVEntityAttribute
vAttr
=
vEntity
.
getVirtualAttribute
(
binding
,
true
);
...
...
@@ -571,9 +575,9 @@ public class GISLeafletViewer implements IGeometryValueEditor {
vAttr
.
setProperty
(
PROP_FLIP_COORDINATES
,
String
.
valueOf
(
flipCoordinates
));
vAttr
.
setProperty
(
PROP_SRID
,
String
.
valueOf
(
getValueSRID
()));
}
valueController
.
getExecutionContext
().
getDataSource
().
getContainer
().
getRegistry
().
flushConfig
();
}
}
bindings
[
0
].
getDataSource
().
getContainer
().
getRegistry
().
flushConfig
();
}
private
void
updateControlsVisibility
()
{
...
...
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/presentation/GeometryPresentation.java
浏览文件 @
3a4f9d8f
...
...
@@ -57,9 +57,13 @@ public class GeometryPresentation extends AbstractPresentation {
public
void
createPresentation
(
@NotNull
final
IResultSetController
controller
,
@NotNull
Composite
parent
)
{
super
.
createPresentation
(
controller
,
parent
);
final
DBDAttributeBinding
[]
bindings
=
GeometryDataUtils
.
extractGeometryAttributes
(
getController
()).
stream
()
.
map
(
GeometryDataUtils
.
GeomAttrs
::
getGeomAttr
)
.
toArray
(
DBDAttributeBinding
[]::
new
);
leafletViewer
=
new
GISLeafletViewer
(
parent
,
null
,
bindings
,
GisTransformUtils
.
getSpatialDataProvider
(
controller
.
getDataContainer
().
getDataSource
()));
leafletViewer
.
getBrowserComposite
().
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录