This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
ParaViewPlot.java
115 lines (105 loc) · 3.18 KB
/
ParaViewPlot.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*******************************************************************************
* Copyright (c) 2015- UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation -
* Jordan Deyton
*******************************************************************************/
package org.eclipse.ice.viz.service.paraview;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.eclipse.ice.viz.service.MultiPlot;
import org.eclipse.ice.viz.service.PlotRender;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
/**
* This class is responsible for embedding ParaView-supported graphics inside
* client {@link Composite}s.
* <p>
* Instances of this class should not be created manually. Instead, a plot
* should be created via {@link ParaViewVizService#createPlot(URI)}.
* </p>
*
* @see ParaViewVizService
*
* @author Jordan Deyton
*
*/
public class ParaViewPlot extends MultiPlot {
/**
* The default constructor.
*
* @param service
* The visualization service responsible for this plot.
* @param file
* The data source, either a local or remote file.
*/
public ParaViewPlot(ParaViewVizService vizService, URI file) {
super(vizService, file);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.client.widgets.viz.service.IPlot#getPlotTypes()
*/
@Override
public Map<String, String[]> getPlotTypes() throws Exception {
return new HashMap<String, String[]>();
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.MultiPlot#createPlotRender(org.eclipse.swt
* .widgets.Composite)
*/
@Override
protected PlotRender createPlotRender(Composite parent) {
// TODO We need a custom PlotRender.
return new PlotRender(parent, this) {
@Override
protected Composite createPlotComposite(Composite parent, int style) {
return new Composite(parent, style);
}
@Override
protected void updatePlotComposite(Composite plotComposite)
throws Exception {
int seed = (getPlotCategory() + getPlotType()).hashCode();
Random r = new Random(seed);
plotComposite.setBackground(new Color(plotComposite
.getDisplay(), r.nextInt(255), r.nextInt(255), r
.nextInt(255)));
}
};
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.MultiPlot#updatePlotRender(org.eclipse.ice
* .viz.service.PlotRender)
*/
@Override
protected void updatePlotRender(PlotRender plotRender) {
// TODO We will need to update it in a custom way.
super.updatePlotRender(plotRender);
}
// /*
// * (non-Javadoc)
// *
// * @see
// *
// org.eclipse.ice.viz.service.connections.ConnectionPlot#getPreferenceNodeID
// * ()
// */
// @Override
// protected String getPreferenceNodeID() {
// return "org.eclipse.ice.viz.service.paraview.preferences";
// }
}