Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sanbo_xyz
Gephi
提交
20d6a1d1
G
Gephi
项目概览
sanbo_xyz
/
Gephi
10 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gephi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
20d6a1d1
编写于
1月 07, 2023
作者:
M
Mathieu Bastian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Decouple canvas initialization from instances initialization
上级
ef1f9546
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
39 deletion
+43
-39
modules/VisualizationImpl/src/main/java/org/gephi/visualization/screenshot/OffscreenCanvas.java
...a/org/gephi/visualization/screenshot/OffscreenCanvas.java
+5
-0
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GLAbstractListener.java
...ava/org/gephi/visualization/swing/GLAbstractListener.java
+18
-8
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GraphCanvas.java
.../main/java/org/gephi/visualization/swing/GraphCanvas.java
+7
-13
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/NewtGraphCanvas.java
...n/java/org/gephi/visualization/swing/NewtGraphCanvas.java
+11
-14
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/StandardGraphIO.java
...n/java/org/gephi/visualization/swing/StandardGraphIO.java
+2
-4
未找到文件。
modules/VisualizationImpl/src/main/java/org/gephi/visualization/screenshot/OffscreenCanvas.java
浏览文件 @
20d6a1d1
...
...
@@ -83,6 +83,11 @@ public class OffscreenCanvas extends GLAbstractListener implements TileRendererB
this
.
transparentBackground
=
transparentBackground
;
}
@Override
protected
GLAutoDrawable
initDrawable
()
{
return
drawable
;
}
@Override
public
void
init
(
GLAutoDrawable
drawable
)
{
GL2
gl
=
drawable
.
getGL
().
getGL2
();
...
...
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GLAbstractListener.java
浏览文件 @
20d6a1d1
...
...
@@ -49,6 +49,7 @@ import com.jogamp.newt.opengl.GLWindow;
import
com.jogamp.opengl.GL2
;
import
com.jogamp.opengl.GLAutoDrawable
;
import
com.jogamp.opengl.GLCapabilities
;
import
com.jogamp.opengl.GLDrawable
;
import
com.jogamp.opengl.GLEventListener
;
import
com.jogamp.opengl.GLProfile
;
import
com.jogamp.opengl.glu.GLU
;
...
...
@@ -59,6 +60,8 @@ import java.nio.FloatBuffer;
import
java.nio.IntBuffer
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.swing.JPopupMenu
;
import
javax.swing.ToolTipManager
;
import
org.gephi.lib.gleem.linalg.Vec3f
;
import
org.gephi.visualization.VizArchitecture
;
import
org.gephi.visualization.VizController
;
...
...
@@ -82,7 +85,7 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec
public
final
float
viewField
=
30.0f
;
public
final
float
nearDistance
=
1.0f
;
public
final
float
farDistance
=
150000
f
;
p
ublic
Component
graphComponent
;
p
rotected
Component
graphComponent
;
//Architecture
protected
GLAutoDrawable
drawable
;
protected
VizController
vizController
;
...
...
@@ -116,10 +119,7 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec
this
.
vizController
=
VizController
.
getInstance
();
}
protected
void
initDrawable
(
GLAutoDrawable
drawable
)
{
this
.
drawable
=
drawable
;
drawable
.
addGLEventListener
(
this
);
}
protected
abstract
GLAutoDrawable
initDrawable
();
@Override
public
void
initArchitecture
()
{
...
...
@@ -129,8 +129,6 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec
cameraLocation
=
vizController
.
getVizConfig
().
getDefaultCameraPosition
();
cameraTarget
=
vizController
.
getVizConfig
().
getDefaultCameraTarget
();
initMouseEvents
();
}
@Override
...
...
@@ -544,7 +542,19 @@ public abstract class GLAbstractListener implements GLEventListener, VizArchitec
}
@Override
public
Component
getGraphComponent
()
{
public
synchronized
Component
getGraphComponent
()
{
if
(
this
.
drawable
==
null
)
{
// Also expected to init the graphComponent
this
.
drawable
=
initDrawable
();
//False lets the components appear on top of the canvas
JPopupMenu
.
setDefaultLightWeightPopupEnabled
(
false
);
ToolTipManager
.
sharedInstance
().
setLightWeightPopupEnabled
(
false
);
drawable
.
addGLEventListener
(
this
);
initMouseEvents
();
}
return
graphComponent
;
}
...
...
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/GraphCanvas.java
浏览文件 @
20d6a1d1
...
...
@@ -43,6 +43,7 @@
package
org.gephi.visualization.swing
;
import
com.jogamp.opengl.GL2
;
import
com.jogamp.opengl.GLAutoDrawable
;
import
com.jogamp.opengl.awt.GLCanvas
;
import
com.jogamp.opengl.glu.GLU
;
import
com.jogamp.opengl.util.gl2.GLUT
;
...
...
@@ -58,28 +59,21 @@ import org.gephi.ui.utils.UIUtils;
*/
public
class
GraphCanvas
extends
GLAbstractListener
{
private
final
GLCanvas
glCanvas
;
private
final
GLUT
glut
=
new
GLUT
();
public
GraphCanvas
()
{
super
();
glCanvas
=
new
GLCanvas
(
getCaps
());
super
.
initDrawable
(
glCanvas
);
@Override
protected
GLAutoDrawable
initDrawable
()
{
GLCanvas
glCanvas
=
new
GLCanvas
(
getCaps
());
// glCanvas.setMinimumSize(new Dimension(0, 0)); //Fix Canvas resize Issue
//Basic init
graphComponent
=
(
Component
)
glCanvas
;
// graphComponent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
graphComponent
=
glCanvas
;
//False lets the components appear on top of the canvas
JPopupMenu
.
setDefaultLightWeightPopupEnabled
(
false
);
ToolTipManager
.
sharedInstance
().
setLightWeightPopupEnabled
(
false
);
return
glCanvas
;
}
@Override
protected
void
init
(
GL2
gl
)
{
globalScale
=
glCanvas
.
getCurrentSurfaceScale
(
new
float
[
2
])[
0
];
globalScale
=
((
GLCanvas
)
drawable
)
.
getCurrentSurfaceScale
(
new
float
[
2
])[
0
];
engine
.
startDisplay
();
}
...
...
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/NewtGraphCanvas.java
浏览文件 @
20d6a1d1
...
...
@@ -45,6 +45,7 @@ package org.gephi.visualization.swing;
import
com.jogamp.newt.awt.NewtCanvasAWT
;
import
com.jogamp.newt.opengl.GLWindow
;
import
com.jogamp.opengl.GL2
;
import
com.jogamp.opengl.GLAutoDrawable
;
import
com.jogamp.opengl.glu.GLU
;
import
com.jogamp.opengl.util.gl2.GLUT
;
...
...
@@ -58,18 +59,15 @@ import org.gephi.ui.utils.UIUtils;
*/
public
class
NewtGraphCanvas
extends
GLAbstractListener
{
private
final
NewtCanvasAWT
glCanvas
;
private
final
GLWindow
glWindow
;
private
final
GLUT
glut
=
new
GLUT
();
public
NewtGraphCanvas
()
{
super
();
glWindow
=
GLWindow
.
create
(
getCaps
());
@Override
protected
GLAutoDrawable
initDrawable
()
{
GLWindow
glWindow
=
GLWindow
.
create
(
getCaps
());
// glWindow.setSurfaceScale(new float[]{ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE});
glCanvas
=
new
HighDPIFixCanvas
(
glWindow
);
NewtCanvasAWT
glCanvas
=
new
HighDPIFixCanvas
(
glWindow
);
// glCanvas = new NewtCanvasAWT(glWindow);
super
.
initDrawable
(
glWindow
);
// glCanvas.setFocusable(true);
// glCanvas.setIgnoreRepaint(true);
// glCanvas.setMinimumSize(new Dimension(0, 0)); //Fix Canvas resize Issue
...
...
@@ -80,15 +78,13 @@ public class NewtGraphCanvas extends GLAbstractListener {
window
=
glWindow
;
// graphComponent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//False lets the components appear on top of the canvas
JPopupMenu
.
setDefaultLightWeightPopupEnabled
(
false
);
ToolTipManager
.
sharedInstance
().
setLightWeightPopupEnabled
(
false
);
return
glWindow
;
}
@Override
protected
void
init
(
GL2
gl
)
{
// globalScale = glWindow.getCurrentSurfaceScale(new float[2])[0];
globalScale
=
(
float
)
glCanvas
.
getGraphicsConfiguration
().
getDefaultTransform
().
getScaleX
();
globalScale
=
(
float
)
((
NewtCanvasAWT
)
drawable
)
.
getGraphicsConfiguration
().
getDefaultTransform
().
getScaleX
();
engine
.
startDisplay
();
}
...
...
@@ -97,8 +93,9 @@ public class NewtGraphCanvas extends GLAbstractListener {
if
(
UIUtils
.
isAquaLookAndFeel
())
{
// Only used when collapse panel is set visible
// Workaround for JOGL bug 1274
glCanvas
.
setNEWTChild
(
null
);
glCanvas
.
setNEWTChild
(
glWindow
);
// glCanvas.setNEWTChild(null);
// glCanvas.setNEWTChild(glWindow);
}
else
{
// Fix issue when closing the collapse panel
Container
c
=
graphComponent
.
getParent
();
...
...
@@ -145,7 +142,7 @@ public class NewtGraphCanvas extends GLAbstractListener {
@Override
public
void
destroy
()
{
super
.
destroy
();
glCanvas
.
getNEWTChild
().
destroy
();
((
NewtCanvasAWT
)
drawable
)
.
getNEWTChild
().
destroy
();
}
public
class
HighDPIFixCanvas
extends
NewtCanvasAWT
{
...
...
modules/VisualizationImpl/src/main/java/org/gephi/visualization/swing/StandardGraphIO.java
浏览文件 @
20d6a1d1
...
...
@@ -69,7 +69,6 @@ public class StandardGraphIO implements GraphIO, VizArchitecture {
//Architecture
protected
GLAbstractListener
graphDrawable
;
protected
Component
graphComponent
;
protected
AbstractEngine
engine
;
protected
VizEventManager
vizEventManager
;
protected
VizController
vizController
;
...
...
@@ -92,7 +91,6 @@ public class StandardGraphIO implements GraphIO, VizArchitecture {
@Override
public
void
initArchitecture
()
{
this
.
graphDrawable
=
(
GLAbstractListener
)
VizController
.
getInstance
().
getDrawable
();
this
.
graphComponent
=
graphDrawable
.
graphComponent
;
this
.
engine
=
VizController
.
getInstance
().
getEngine
();
this
.
vizEventManager
=
VizController
.
getInstance
().
getVizEventManager
();
this
.
vizController
=
VizController
.
getInstance
();
...
...
@@ -133,7 +131,7 @@ public class StandardGraphIO implements GraphIO, VizArchitecture {
rightButtonMoving
[
1
]
=
y
;
//Change cursor
graph
Component
.
setCursor
(
Cursor
.
getPredefinedCursor
(
Cursor
.
MOVE_CURSOR
));
graph
Drawable
.
getGraphComponent
()
.
setCursor
(
Cursor
.
getPredefinedCursor
(
Cursor
.
MOVE_CURSOR
));
}
//Dispatch event
...
...
@@ -179,7 +177,7 @@ public class StandardGraphIO implements GraphIO, VizArchitecture {
vizEventManager
.
stopDrag
();
}
else
{
//Set default cursor
graph
Component
.
setCursor
(
Cursor
.
getDefaultCursor
());
graph
Drawable
.
getGraphComponent
()
.
setCursor
(
Cursor
.
getDefaultCursor
());
}
//Dispatch event
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录