Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
e0d40e77
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,发现更多精彩内容 >>
提交
e0d40e77
编写于
9月 14, 2019
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#6743 Object tooltips redesign
上级
c2775815
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
25 deletion
+60
-25
plugins/org.jkiss.dbeaver.data.gis.view/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.data.gis.view/META-INF/MANIFEST.MF
+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
+8
-14
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/presentation/GeometryPresentation.java
...iss/dbeaver/ui/gis/presentation/GeometryPresentation.java
+7
-4
plugins/org.jkiss.dbeaver.data.gis.view/web/view_template.html
...ns/org.jkiss.dbeaver.data.gis.view/web/view_template.html
+16
-6
plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/model/gis/DBGeometry.java
....data.gis/src/org/jkiss/dbeaver/model/gis/DBGeometry.java
+17
-0
plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/model/gis/GisExpressionFunctions.java
...c/org/jkiss/dbeaver/model/gis/GisExpressionFunctions.java
+10
-0
未找到文件。
plugins/org.jkiss.dbeaver.data.gis.view/META-INF/MANIFEST.MF
浏览文件 @
e0d40e77
...
...
@@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.ui.editors.base,
org.jkiss.dbeaver.ui.editors.data,
org.jkiss.bundle.gis
org.jkiss.bundle.gis,
com.google.gson
Bundle-ClassPath: .
Export-Package: org.jkiss.dbeaver.ui.gis
Automatic-Module-Name: org.jkiss.dbeaver.data.gis.view
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/GISLeafletViewer.java
浏览文件 @
e0d40e77
...
...
@@ -16,7 +16,11 @@
*/
package
org.jkiss.dbeaver.ui.gis.panel
;
import
org.eclipse.jface.action.*
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.Separator
;
import
org.eclipse.jface.action.ToolBarManager
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.browser.Browser
;
import
org.eclipse.swt.dnd.Clipboard
;
...
...
@@ -32,9 +36,7 @@ import org.jkiss.code.Nullable;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.DBValueFormatting
;
import
org.jkiss.dbeaver.model.data.DBDAttributeBinding
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.gis.*
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
...
...
@@ -65,7 +67,6 @@ import org.locationtech.jts.geom.Geometry;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
class
GISLeafletViewer
implements
IGeometryValueEditor
{
...
...
@@ -78,6 +79,8 @@ public class GISLeafletViewer implements IGeometryValueEditor {
private
static
final
String
PROP_FLIP_COORDINATES
=
"gis.flipCoords"
;
private
static
final
String
PROP_SRID
=
"gis.srid"
;
private
static
final
Gson
gson
=
new
GsonBuilder
().
create
();
private
final
IValueController
valueController
;
private
final
Browser
browser
;
private
DBGeometry
[]
lastValue
;
...
...
@@ -276,16 +279,7 @@ public class GISLeafletViewer implements IGeometryValueEditor {
if
(
CommonUtils
.
isEmpty
(
value
.
getProperties
()))
{
geomTipValues
.
add
(
"null"
);
}
else
{
StringBuilder
geomProps
=
new
StringBuilder
(
"{"
);
boolean
first
=
true
;
for
(
Map
.
Entry
<
String
,
Object
>
prop
:
value
.
getProperties
().
entrySet
())
{
if
(!
first
)
geomProps
.
append
(
","
);
first
=
false
;
geomProps
.
append
(
'"'
).
append
(
prop
.
getKey
().
replace
(
"\""
,
"\\\""
)).
append
(
"\":\""
)
.
append
(
CommonUtils
.
escapeJavaString
(
DBValueFormatting
.
getDefaultValueDisplayString
(
prop
.
getValue
(),
DBDDisplayFormat
.
UI
))).
append
(
"\""
);
}
geomProps
.
append
(
"}"
);
geomTipValues
.
add
(
geomProps
.
toString
());
geomTipValues
.
add
(
gson
.
toJson
(
value
.
getProperties
()));
}
}
if
(
actualSourceSRID
==
GisConstants
.
SRID_SIMPLE
)
{
...
...
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/presentation/GeometryPresentation.java
浏览文件 @
e0d40e77
...
...
@@ -136,16 +136,19 @@ public class GeometryPresentation extends AbstractPresentation {
geomAttrs
.
geomAttr
,
value
);
if
(
geometry
!=
null
)
{
if
(
geometry
!=
null
&&
!(
geometry
.
getSRID
()
!=
0
&&
geometry
.
isEmpty
())
)
{
geometries
.
add
(
geometry
);
// Now get description
Map
<
String
,
Object
>
properties
=
new
LinkedHashMap
<>();
properties
.
put
(
"Column"
,
DBUtils
.
getObjectFullName
(
geomAttrs
.
geomAttr
,
DBPEvaluationContext
.
UI
));
properties
.
put
(
"id"
,
DBUtils
.
getObjectFullName
(
geomAttrs
.
geomAttr
,
DBPEvaluationContext
.
UI
));
properties
.
put
(
"color"
,
"blue"
);
if
(!
geomAttrs
.
descAttrs
.
isEmpty
())
{
Map
<
String
,
Object
>
infoMap
=
new
LinkedHashMap
<>();
properties
.
put
(
"info"
,
infoMap
);
for
(
DBDAttributeBinding
da
:
geomAttrs
.
descAttrs
)
{
Object
descValue
=
model
.
getCellValue
(
da
,
row
);
if
(!
DBUtils
.
isNullValue
(
descValue
))
{
properties
.
put
(
da
.
getName
(),
descValue
);
if
(!
DBUtils
.
isNullValue
(
descValue
)
&&
!(
descValue
instanceof
String
&&
((
String
)
descValue
).
isEmpty
())
)
{
infoMap
.
put
(
da
.
getName
(),
descValue
);
}
}
}
...
...
plugins/org.jkiss.dbeaver.data.gis.view/web/view_template.html
浏览文件 @
e0d40e77
...
...
@@ -65,10 +65,10 @@
weight
:
3
,
};
const
popupOption
=
{
closeButton
:
fals
e
,
closeButton
:
tru
e
,
minWidth
:
260
,
maxWidth
:
3
00
,
maxHeight
:
3
00
,
maxWidth
:
8
00
,
maxHeight
:
5
00
,
};
var
lastClickCoordinates
=
""
;
...
...
@@ -76,10 +76,20 @@
var
tip
=
feature
.
tip
;
if
(
tip
!=
null
)
{
var
tipText
=
""
;
for
(
var
propName
in
tip
)
{
tipText
+=
propName
+
"
:
"
+
tip
[
propName
]
+
"
<br/>
"
;
if
(
tip
.
id
!=
null
)
{
var
color
=
tip
.
color
;
if
(
color
==
null
)
color
=
"
black
"
;
tipText
+=
"
<h3 style='color:
"
+
color
+
"
'>
"
+
tip
.
id
+
"
</h3>
"
;
}
layer
.
bindPopup
(
tipText
);
tipText
+=
"
<table>
"
;
var
objInfo
=
tip
.
info
;
if
(
objInfo
!=
null
)
{
for
(
var
propName
in
objInfo
)
{
tipText
+=
"
<tr><td>
"
+
propName
+
"
</td><td>
"
+
objInfo
[
propName
]
+
"
</td></tr>
"
;
}
}
tipText
+=
"
</table>
"
;
layer
.
bindPopup
(
tipText
,
popupOption
);
}
}
...
...
plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/model/gis/DBGeometry.java
浏览文件 @
e0d40e77
...
...
@@ -21,6 +21,7 @@ import org.jkiss.dbeaver.DBException;
import
org.jkiss.dbeaver.data.gis.handlers.GeometryConverter
;
import
org.jkiss.dbeaver.model.data.DBDValue
;
import
org.jkiss.utils.CommonUtils
;
import
org.locationtech.jts.geom.Coordinate
;
import
org.locationtech.jts.geom.Geometry
;
import
org.locationtech.jts.io.ParseException
;
import
org.locationtech.jts.io.WKTReader
;
...
...
@@ -128,4 +129,20 @@ public class DBGeometry implements DBDValue {
public
DBGeometry
copy
()
{
return
new
DBGeometry
(
this
);
}
/**
* @return true if all geometry points set to zero
*/
public
boolean
isEmpty
()
{
Geometry
geometry
=
getGeometry
();
if
(
geometry
==
null
)
{
return
false
;
}
for
(
Coordinate
coord
:
geometry
.
getCoordinates
())
{
if
(
coord
.
getX
()
!=
0
||
coord
.
getY
()
!=
0
||
coord
.
getZ
()
!=
0
)
{
return
false
;
}
}
return
true
;
}
}
plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/model/gis/GisExpressionFunctions.java
浏览文件 @
e0d40e77
...
...
@@ -16,6 +16,7 @@
*/
package
org.jkiss.dbeaver.model.gis
;
import
graphql.execution.nextgen.Common
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -31,6 +32,15 @@ public class GisExpressionFunctions {
}
public
static
Object
wktPoint
(
Object
longitude
,
Object
latitude
,
Object
srid
)
{
if
(
longitude
==
null
||
latitude
==
null
)
{
return
null
;
}
if
(
longitude
instanceof
Number
&&
((
Number
)
longitude
).
doubleValue
()
==
0.0
&&
latitude
instanceof
Number
&&
((
Number
)
latitude
).
doubleValue
()
==
0.0
)
{
// Zeroes
return
null
;
}
String
strValue
=
"POINT("
+
longitude
+
" "
+
latitude
+
")"
;
return
new
DBGeometry
(
strValue
,
CommonUtils
.
toInt
(
srid
,
GisConstants
.
SRID_4326
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录