Revision 328
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/SymbolSelector3D.java | ||
---|---|---|
1 | 1 |
package org.gvsig.gvsig3d.app.gui.styling; |
2 | 2 |
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.FlowLayout; |
|
5 |
import java.awt.GridBagConstraints; |
|
6 |
import java.awt.GridBagLayout; |
|
7 |
import java.awt.Insets; |
|
3 | 8 |
import java.awt.event.ActionEvent; |
4 | 9 |
import java.awt.event.ActionListener; |
10 |
import java.awt.event.ItemEvent; |
|
11 |
import java.awt.event.ItemListener; |
|
5 | 12 |
|
13 |
import javax.swing.DefaultComboBoxModel; |
|
14 |
import javax.swing.JButton; |
|
15 |
import javax.swing.JComboBox; |
|
6 | 16 |
import javax.swing.JPanel; |
17 |
import javax.swing.SwingConstants; |
|
18 |
import javax.swing.border.TitledBorder; |
|
7 | 19 |
|
20 |
import org.gvsig.andami.PluginServices; |
|
8 | 21 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
22 |
import org.gvsig.app.gui.styling.SymbolSelector; |
|
9 | 23 |
import org.gvsig.app.project.documents.view.legend.gui.ISymbolSelector; |
10 | 24 |
import org.gvsig.fmap.geom.type.GeometryType; |
11 | 25 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
12 | 26 |
import org.gvsig.i18n.Messages; |
13 | 27 |
|
14 | 28 |
public class SymbolSelector3D extends JPanel implements ISymbolSelector, |
15 |
ActionListener{
|
|
29 |
ActionListener {
|
|
16 | 30 |
/** |
17 | 31 |
* |
18 | 32 |
*/ |
19 | 33 |
private static final long serialVersionUID = 7378124199631050961L; |
20 | 34 |
private WindowInfo wi; |
35 |
private JPanel _tabsPane; |
|
36 |
private JComboBox comboBox; |
|
37 |
private SimpleSymbolTab _ssTab; |
|
38 |
private PictureSymbolTab _psTab; |
|
39 |
private Object3DSymbolTab _obTab; |
|
40 |
|
|
41 |
private ISymbol _symbol; |
|
42 |
private JPanel panel; |
|
43 |
private JButton btnNewButton; |
|
44 |
private JButton btnNewButton_1; |
|
45 |
private ISymbol _newSymbol; |
|
21 | 46 |
|
22 |
public SymbolSelector3D() |
|
23 |
{ |
|
47 |
private ISymbolSelectorTab _activeTab; |
|
48 |
|
|
49 |
public SymbolSelector3D() { |
|
24 | 50 |
super(); |
25 |
System.out.println("I'M a CHAMPION"); |
|
51 |
|
|
52 |
initComponents(); |
|
53 |
_tabsPane.setLayout(new BorderLayout(0, 0)); |
|
54 |
_ssTab = new SimpleSymbolTab(this); |
|
55 |
_psTab = new PictureSymbolTab(this); |
|
56 |
_obTab = new Object3DSymbolTab(this); |
|
57 |
_tabsPane.add(_ssTab); |
|
58 |
_activeTab = _ssTab; |
|
59 |
addAcceptCancelButtons(); |
|
60 |
|
|
26 | 61 |
} |
27 |
public SymbolSelector3D(ISymbol symbol) |
|
28 |
{ |
|
62 |
|
|
63 |
public SymbolSelector3D(ISymbol symbol) {
|
|
29 | 64 |
super(); |
65 |
_symbol = symbol; |
|
30 | 66 |
System.out.println("I'M a CHAMPION"); |
31 | 67 |
} |
32 |
|
|
33 |
|
|
68 |
|
|
34 | 69 |
public SymbolSelector3D(ISymbol symbol, GeometryType shapeType) { |
35 | 70 |
super(); |
71 |
_symbol = symbol; |
|
72 |
initComponents(); |
|
73 |
SimpleSymbolTab ssTab = new SimpleSymbolTab(this); |
|
74 |
_tabsPane.add(ssTab); |
|
75 |
addAcceptCancelButtons(); |
|
76 |
|
|
36 | 77 |
System.out.println("I'M a CHAMPION"); |
37 | 78 |
} |
79 |
|
|
38 | 80 |
public SymbolSelector3D(String domain, ISymbol symbol, Integer shapeType) { |
39 | 81 |
super(); |
40 |
System.out.println("I'M a CHAMPION"); |
|
82 |
_symbol = symbol; |
|
83 |
_ssTab = new SimpleSymbolTab(this); |
|
84 |
_psTab = new PictureSymbolTab(this); |
|
85 |
_obTab = new Object3DSymbolTab(this); |
|
86 |
initComponents(); |
|
87 |
_tabsPane.add(_ssTab); |
|
88 |
_activeTab = _ssTab; |
|
89 |
addAcceptCancelButtons(); |
|
90 |
|
|
41 | 91 |
} |
92 |
|
|
93 |
private void initComponents() { |
|
94 |
setBorder(new TitledBorder(null, "Marker Symbols", |
|
95 |
TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
96 |
GridBagLayout gridBagLayout = new GridBagLayout(); |
|
97 |
gridBagLayout.columnWidths = new int[] { 0, 0 }; |
|
98 |
gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0 }; |
|
99 |
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; |
|
100 |
gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 1.0, |
|
101 |
Double.MIN_VALUE }; |
|
102 |
setLayout(gridBagLayout); |
|
103 |
|
|
104 |
comboBox = new JComboBox(); |
|
105 |
comboBox.addItemListener(new ItemListener() { |
|
106 |
public void itemStateChanged(ItemEvent arg0) { |
|
107 |
int which = comboBox.getSelectedIndex(); |
|
108 |
System.out.println("Case: " + which); |
|
109 |
switch (which) { |
|
110 |
case 0: |
|
111 |
_tabsPane.removeAll(); |
|
112 |
System.out.println("A?ado panel 1"); |
|
113 |
_tabsPane.add(_ssTab); |
|
114 |
_activeTab = _ssTab; |
|
115 |
_tabsPane.repaint(); |
|
116 |
_tabsPane.validate(); |
|
117 |
break; |
|
118 |
|
|
119 |
case 1: |
|
120 |
_tabsPane.removeAll(); |
|
121 |
System.out.println("A?ado panel 2"); |
|
122 |
_tabsPane.add(_psTab); |
|
123 |
_activeTab = _psTab; |
|
124 |
_tabsPane.repaint(); |
|
125 |
_tabsPane.validate(); |
|
126 |
break; |
|
127 |
|
|
128 |
case 2: |
|
129 |
_tabsPane.removeAll(); |
|
130 |
System.out.println("A?ado panel 3"); |
|
131 |
_tabsPane.add(_obTab); |
|
132 |
_activeTab = _obTab; |
|
133 |
_tabsPane.repaint(); |
|
134 |
_tabsPane.validate(); |
|
135 |
break; |
|
136 |
default: |
|
137 |
break; |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
} |
|
142 |
}); |
|
143 |
comboBox.setModel(new DefaultComboBoxModel(new String[] { "Simple ", |
|
144 |
"Picture", "3D Object " })); |
|
145 |
GridBagConstraints gbc_comboBox = new GridBagConstraints(); |
|
146 |
gbc_comboBox.insets = new Insets(0, 0, 5, 0); |
|
147 |
gbc_comboBox.weightx = 0.3; |
|
148 |
gbc_comboBox.ipadx = 10; |
|
149 |
gbc_comboBox.anchor = GridBagConstraints.WEST; |
|
150 |
gbc_comboBox.gridx = 0; |
|
151 |
gbc_comboBox.gridy = 0; |
|
152 |
add(comboBox, gbc_comboBox); |
|
153 |
|
|
154 |
_tabsPane = new JPanel(); |
|
155 |
GridBagConstraints gbc_tabbedPane = new GridBagConstraints(); |
|
156 |
gbc_tabbedPane.weighty = 0.8; |
|
157 |
gbc_tabbedPane.weightx = 0.8; |
|
158 |
gbc_tabbedPane.insets = new Insets(0, 0, 5, 0); |
|
159 |
gbc_tabbedPane.fill = GridBagConstraints.BOTH; |
|
160 |
gbc_tabbedPane.gridx = 0; |
|
161 |
gbc_tabbedPane.gridy = 1; |
|
162 |
add(_tabsPane, gbc_tabbedPane); |
|
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
private void addAcceptCancelButtons() { |
|
167 |
|
|
168 |
panel = new JPanel(); |
|
169 |
GridBagConstraints gbc_panel = new GridBagConstraints(); |
|
170 |
gbc_panel.anchor = GridBagConstraints.NORTHEAST; |
|
171 |
gbc_panel.weighty = 0.2; |
|
172 |
gbc_panel.weightx = 0.2; |
|
173 |
gbc_panel.gridx = 0; |
|
174 |
gbc_panel.gridy = 2; |
|
175 |
add(panel, gbc_panel); |
|
176 |
panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); |
|
177 |
|
|
178 |
btnNewButton = new JButton("Cancel"); |
|
179 |
panel.add(btnNewButton); |
|
180 |
|
|
181 |
btnNewButton_1 = new JButton("Accept"); |
|
182 |
btnNewButton_1.addActionListener(new ActionListener() { |
|
183 |
public void actionPerformed(ActionEvent arg0) { |
|
184 |
_symbol = _activeTab.getNewSymbol(); |
|
185 |
setSymbol(_symbol); |
|
186 |
PluginServices.getMDIManager().closeWindow(SymbolSelector3D.this); |
|
187 |
} |
|
188 |
}); |
|
189 |
btnNewButton_1.setHorizontalAlignment(SwingConstants.RIGHT); |
|
190 |
panel.add(btnNewButton_1); |
|
191 |
|
|
192 |
} |
|
193 |
|
|
194 |
public ISymbol getSymbol() { |
|
195 |
|
|
196 |
return _symbol; |
|
197 |
|
|
198 |
} |
|
199 |
|
|
42 | 200 |
public WindowInfo getWindowInfo() { |
43 |
|
|
201 |
|
|
44 | 202 |
if (wi == null) { |
45 | 203 |
wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE); |
46 |
wi.setWidth(706);
|
|
47 |
wi.setHeight(500);
|
|
204 |
wi.setWidth(600);
|
|
205 |
wi.setHeight(400);
|
|
48 | 206 |
wi.setTitle(Messages.getText("symbol_selector")); |
49 | 207 |
} |
50 | 208 |
return wi; |
... | ... | |
56 | 214 |
|
57 | 215 |
public void actionPerformed(ActionEvent e) { |
58 | 216 |
// TODO Auto-generated method stub |
59 |
|
|
217 |
|
|
60 | 218 |
} |
61 | 219 |
|
62 | 220 |
public Object getSelectedObject() { |
63 |
// TODO Auto-generated method stub |
|
64 |
return null; |
|
221 |
return _newSymbol; |
|
65 | 222 |
} |
66 | 223 |
|
67 | 224 |
public void setSymbol(Object symbol) { |
68 |
// TODO Auto-generated method stub
|
|
69 |
|
|
225 |
_newSymbol = (ISymbol) symbol;
|
|
226 |
|
|
70 | 227 |
} |
71 | 228 |
|
72 |
|
|
73 | 229 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/ParticleSymbolTab.java | ||
---|---|---|
1 |
package org.gvsig.gvsig3d.app.gui.styling; |
|
2 |
|
|
3 |
import javax.swing.JPanel; |
|
4 |
import javax.swing.JTabbedPane; |
|
5 |
import java.awt.BorderLayout; |
|
6 |
import java.awt.Component; |
|
7 |
|
|
8 |
public class ParticleSymbolTab extends JPanel { |
|
9 |
|
|
10 |
/** |
|
11 |
* Create the panel. |
|
12 |
*/ |
|
13 |
public ParticleSymbolTab(Component parent) { |
|
14 |
setLayout(new BorderLayout(0, 0)); |
|
15 |
|
|
16 |
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); |
|
17 |
add(tabbedPane); |
|
18 |
|
|
19 |
JPanel panel = new JPanel(); |
|
20 |
tabbedPane.addTab("Particle Symbol", null, panel, null); |
|
21 |
|
|
22 |
} |
|
23 |
|
|
24 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/ISymbolSelectorTab.java | ||
---|---|---|
1 |
package org.gvsig.gvsig3d.app.gui.styling; |
|
2 |
|
|
3 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
|
4 |
|
|
5 |
public interface ISymbolSelectorTab { |
|
6 |
|
|
7 |
public I3DSymbol getNewSymbol(); |
|
8 |
|
|
9 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/SimpleSymbolTab.java | ||
---|---|---|
1 |
package org.gvsig.gvsig3d.app.gui.styling; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Color; |
|
5 |
import java.awt.Component; |
|
6 |
import java.awt.FlowLayout; |
|
7 |
import java.awt.GridBagConstraints; |
|
8 |
import java.awt.GridBagLayout; |
|
9 |
import java.awt.GridLayout; |
|
10 |
import java.awt.Insets; |
|
11 |
import java.awt.event.ActionEvent; |
|
12 |
import java.awt.event.ActionListener; |
|
13 |
|
|
14 |
import javax.swing.JButton; |
|
15 |
import javax.swing.JColorChooser; |
|
16 |
import javax.swing.JComboBox; |
|
17 |
import javax.swing.JLabel; |
|
18 |
import javax.swing.JPanel; |
|
19 |
import javax.swing.JSlider; |
|
20 |
import javax.swing.JSpinner; |
|
21 |
import javax.swing.JTabbedPane; |
|
22 |
import javax.swing.SpinnerNumberModel; |
|
23 |
import javax.swing.border.TitledBorder; |
|
24 |
|
|
25 |
import org.gvsig.app.gui.styling.SymbolPreviewer; |
|
26 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
|
27 |
import org.gvsig.gvsig3d.symbology3d.marker.ISimpleMarker3DSymbol; |
|
28 |
import javax.swing.event.ChangeListener; |
|
29 |
import javax.swing.event.ChangeEvent; |
|
30 |
|
|
31 |
|
|
32 |
public class SimpleSymbolTab extends JPanel implements ISymbolSelectorTab { |
|
33 |
|
|
34 |
/** |
|
35 |
* |
|
36 |
*/ |
|
37 |
private static final long serialVersionUID = 3229652368059568464L; |
|
38 |
|
|
39 |
private ISimpleMarker3DSymbol _symbol; |
|
40 |
|
|
41 |
private JPanel _colorPanel; |
|
42 |
|
|
43 |
private Component _parent; |
|
44 |
|
|
45 |
private JSlider slider; |
|
46 |
|
|
47 |
private JSpinner sizeSpinner; |
|
48 |
|
|
49 |
private JPanel symbolPreviewPanel; |
|
50 |
|
|
51 |
/** |
|
52 |
* Create the panel. |
|
53 |
*/ |
|
54 |
public SimpleSymbolTab(Component parent) { |
|
55 |
setLayout(new BorderLayout(0, 0)); |
|
56 |
|
|
57 |
_parent = parent; |
|
58 |
_symbol = (ISimpleMarker3DSymbol) ((SymbolSelector3D) parent) |
|
59 |
.getSymbol(); |
|
60 |
|
|
61 |
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); |
|
62 |
add(tabbedPane, BorderLayout.CENTER); |
|
63 |
|
|
64 |
JPanel panel = new JPanel(); |
|
65 |
tabbedPane.addTab("Properties", null, panel, null); |
|
66 |
GridBagLayout gbl_panel = new GridBagLayout(); |
|
67 |
gbl_panel.columnWidths = new int[] { 352, 0, 84 }; |
|
68 |
gbl_panel.rowHeights = new int[] { 124, 0, 0 }; |
|
69 |
gbl_panel.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; |
|
70 |
gbl_panel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; |
|
71 |
panel.setLayout(gbl_panel); |
|
72 |
|
|
73 |
JPanel optionsPanel = new JPanel(); |
|
74 |
optionsPanel.setBorder(new TitledBorder(null, "Properties", |
|
75 |
TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
76 |
GridBagConstraints gbc_optionsPanel = new GridBagConstraints(); |
|
77 |
gbc_optionsPanel.anchor = GridBagConstraints.NORTHWEST; |
|
78 |
gbc_optionsPanel.insets = new Insets(0, 0, 5, 5); |
|
79 |
gbc_optionsPanel.gridx = 0; |
|
80 |
gbc_optionsPanel.gridy = 0; |
|
81 |
panel.add(optionsPanel, gbc_optionsPanel); |
|
82 |
optionsPanel.setLayout(new GridLayout(0, 3, 5, 0)); |
|
83 |
|
|
84 |
JLabel colorLabel = new JLabel("Color:"); |
|
85 |
optionsPanel.add(colorLabel); |
|
86 |
|
|
87 |
_colorPanel = new JPanel(); |
|
88 |
_colorPanel.setBackground(_symbol.getColor()); |
|
89 |
optionsPanel.add(_colorPanel); |
|
90 |
|
|
91 |
JButton colorButton = new JButton("..."); |
|
92 |
colorButton.addActionListener(new ActionListener() { |
|
93 |
public void actionPerformed(ActionEvent arg0) { |
|
94 |
|
|
95 |
Color newColor = JColorChooser.showDialog(SimpleSymbolTab.this, |
|
96 |
"Select Color", _symbol.getColor()); |
|
97 |
|
|
98 |
_symbol.setColor(newColor); |
|
99 |
_colorPanel.setBackground(newColor); |
|
100 |
_colorPanel.repaint(); |
|
101 |
symbolPreviewPanel.repaint(); |
|
102 |
|
|
103 |
|
|
104 |
} |
|
105 |
}); |
|
106 |
optionsPanel.add(colorButton); |
|
107 |
|
|
108 |
JLabel sizeLabel = new JLabel("Size:"); |
|
109 |
optionsPanel.add(sizeLabel); |
|
110 |
|
|
111 |
slider = new JSlider(); |
|
112 |
slider.setMinimum(1); |
|
113 |
slider.setValue((int) _symbol.getSize()); |
|
114 |
optionsPanel.add(slider); |
|
115 |
|
|
116 |
sizeSpinner = new JSpinner(); |
|
117 |
sizeSpinner.setModel(new SpinnerNumberModel(new Integer((int) _symbol |
|
118 |
.getSize()), new Integer(1), null, new Integer(1))); |
|
119 |
optionsPanel.add(sizeSpinner); |
|
120 |
|
|
121 |
slider.addChangeListener(new ChangeListener() { |
|
122 |
public void stateChanged(ChangeEvent arg0) { |
|
123 |
|
|
124 |
sizeSpinner.setValue(slider.getValue()); |
|
125 |
_symbol.setSize(slider.getValue()); |
|
126 |
symbolPreviewPanel.repaint(); |
|
127 |
|
|
128 |
|
|
129 |
} |
|
130 |
}); |
|
131 |
|
|
132 |
sizeSpinner.addChangeListener(new ChangeListener() { |
|
133 |
public void stateChanged(ChangeEvent arg0) { |
|
134 |
|
|
135 |
slider.setValue((Integer) sizeSpinner.getValue()); |
|
136 |
_symbol.setSize(slider.getValue()); |
|
137 |
symbolPreviewPanel.repaint(); |
|
138 |
|
|
139 |
|
|
140 |
} |
|
141 |
}); |
|
142 |
|
|
143 |
JLabel lblUnits = new JLabel("Units"); |
|
144 |
//optionsPanel.add(lblUnits); |
|
145 |
|
|
146 |
JComboBox unitsCombo = new JComboBox(); |
|
147 |
//optionsPanel.add(unitsCombo); |
|
148 |
|
|
149 |
symbolPreviewPanel = new JPanel(); |
|
150 |
symbolPreviewPanel.setBorder(new TitledBorder(null, "Preview", |
|
151 |
TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
152 |
GridBagConstraints gbc_symbolPreviewPanel = new GridBagConstraints(); |
|
153 |
gbc_symbolPreviewPanel.gridwidth = 3; |
|
154 |
gbc_symbolPreviewPanel.fill = GridBagConstraints.BOTH; |
|
155 |
gbc_symbolPreviewPanel.anchor = GridBagConstraints.NORTH; |
|
156 |
gbc_symbolPreviewPanel.insets = new Insets(0, 0, 5, 0); |
|
157 |
gbc_symbolPreviewPanel.gridx = 2; |
|
158 |
gbc_symbolPreviewPanel.gridy = 0; |
|
159 |
panel.add(symbolPreviewPanel, gbc_symbolPreviewPanel); |
|
160 |
symbolPreviewPanel.setLayout(new BorderLayout(0, 0)); |
|
161 |
SymbolPreviewer sp = new SymbolPreviewer(); |
|
162 |
sp.setSymbol(_symbol); |
|
163 |
symbolPreviewPanel.add(sp); |
|
164 |
sp.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); |
|
165 |
|
|
166 |
} |
|
167 |
|
|
168 |
public I3DSymbol getNewSymbol() { |
|
169 |
// TODO Auto-generated method stub |
|
170 |
return _symbol; |
|
171 |
} |
|
172 |
|
|
173 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/PictureSymbolTab.java | ||
---|---|---|
1 |
package org.gvsig.gvsig3d.app.gui.styling; |
|
2 |
|
|
3 |
import java.awt.Component; |
|
4 |
import java.awt.FlowLayout; |
|
5 |
import java.awt.GridBagConstraints; |
|
6 |
import java.awt.GridBagLayout; |
|
7 |
import java.awt.GridLayout; |
|
8 |
import java.awt.Insets; |
|
9 |
|
|
10 |
import javax.swing.JButton; |
|
11 |
import javax.swing.JComboBox; |
|
12 |
import javax.swing.JInternalFrame; |
|
13 |
import javax.swing.JLabel; |
|
14 |
import javax.swing.JPanel; |
|
15 |
import javax.swing.JRadioButton; |
|
16 |
import javax.swing.JSpinner; |
|
17 |
import javax.swing.JTabbedPane; |
|
18 |
import javax.swing.JTextField; |
|
19 |
import javax.swing.border.TitledBorder; |
|
20 |
|
|
21 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
|
22 |
|
|
23 |
public class PictureSymbolTab extends JPanel implements ISymbolSelectorTab{ |
|
24 |
/** |
|
25 |
* |
|
26 |
*/ |
|
27 |
private static final long serialVersionUID = -967291574626881727L; |
|
28 |
private JTextField textField; |
|
29 |
|
|
30 |
private I3DSymbol _symbol; |
|
31 |
|
|
32 |
/** |
|
33 |
* Create the panel. |
|
34 |
*/ |
|
35 |
public PictureSymbolTab(Component parent) { |
|
36 |
FlowLayout flowLayout_1 = (FlowLayout) getLayout(); |
|
37 |
|
|
38 |
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); |
|
39 |
add(tabbedPane); |
|
40 |
|
|
41 |
JPanel panel = new JPanel(); |
|
42 |
tabbedPane.addTab("Properties", null, panel, null); |
|
43 |
GridBagLayout gbl_panel = new GridBagLayout(); |
|
44 |
gbl_panel.columnWidths = new int[]{352, 84, 0}; |
|
45 |
gbl_panel.rowHeights = new int[]{100, 0}; |
|
46 |
gbl_panel.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE}; |
|
47 |
gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE}; |
|
48 |
panel.setLayout(gbl_panel); |
|
49 |
|
|
50 |
JPanel panel_1 = new JPanel(); |
|
51 |
panel_1.setBorder(new TitledBorder(null, "Properties", TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
52 |
GridBagConstraints gbc_panel_1 = new GridBagConstraints(); |
|
53 |
gbc_panel_1.anchor = GridBagConstraints.NORTHWEST; |
|
54 |
gbc_panel_1.insets = new Insets(0, 0, 0, 5); |
|
55 |
gbc_panel_1.gridx = 0; |
|
56 |
gbc_panel_1.gridy = 0; |
|
57 |
panel.add(panel_1, gbc_panel_1); |
|
58 |
panel_1.setLayout(new GridLayout(0, 3, 0, 0)); |
|
59 |
|
|
60 |
JLabel lblNewLabel_1 = new JLabel("Ruta:"); |
|
61 |
panel_1.add(lblNewLabel_1); |
|
62 |
|
|
63 |
textField = new JTextField(); |
|
64 |
textField.setEditable(false); |
|
65 |
panel_1.add(textField); |
|
66 |
textField.setColumns(10); |
|
67 |
|
|
68 |
JButton btnBrowse = new JButton("Browse"); |
|
69 |
panel_1.add(btnBrowse); |
|
70 |
|
|
71 |
JLabel lblSize = new JLabel("Size:"); |
|
72 |
panel_1.add(lblSize); |
|
73 |
|
|
74 |
JSpinner spinner = new JSpinner(); |
|
75 |
panel_1.add(spinner); |
|
76 |
|
|
77 |
JPanel panel_3 = new JPanel(); |
|
78 |
panel_1.add(panel_3); |
|
79 |
|
|
80 |
JLabel lblUnits = new JLabel("Units"); |
|
81 |
panel_1.add(lblUnits); |
|
82 |
|
|
83 |
JComboBox comboBox = new JComboBox(); |
|
84 |
panel_1.add(comboBox); |
|
85 |
|
|
86 |
JComboBox comboBox_1 = new JComboBox(); |
|
87 |
panel_1.add(comboBox_1); |
|
88 |
|
|
89 |
JPanel panel_2 = new JPanel(); |
|
90 |
FlowLayout flowLayout = (FlowLayout) panel_2.getLayout(); |
|
91 |
panel_2.setBorder(new TitledBorder(null, "Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
92 |
GridBagConstraints gbc_panel_2 = new GridBagConstraints(); |
|
93 |
gbc_panel_2.anchor = GridBagConstraints.WEST; |
|
94 |
gbc_panel_2.gridx = 1; |
|
95 |
gbc_panel_2.gridy = 0; |
|
96 |
panel.add(panel_2, gbc_panel_2); |
|
97 |
|
|
98 |
JInternalFrame internalFrame_1 = new JInternalFrame("New JInternalFrame"); |
|
99 |
panel_2.add(internalFrame_1); |
|
100 |
|
|
101 |
JPanel panel_4 = new JPanel(); |
|
102 |
tabbedPane.addTab("Collection", null, panel_4, null); |
|
103 |
panel_4.setLayout(new GridLayout(3, 4, 0, 0)); |
|
104 |
|
|
105 |
JRadioButton rdbtnNewRadioButton = new JRadioButton("New radio button"); |
|
106 |
panel_4.add(rdbtnNewRadioButton); |
|
107 |
|
|
108 |
JPanel panel_5 = new JPanel(); |
|
109 |
panel_4.add(panel_5); |
|
110 |
|
|
111 |
JRadioButton rdbtnNewRadioButton_1 = new JRadioButton("New radio button"); |
|
112 |
panel_4.add(rdbtnNewRadioButton_1); |
|
113 |
|
|
114 |
JPanel panel_6 = new JPanel(); |
|
115 |
panel_4.add(panel_6); |
|
116 |
|
|
117 |
JRadioButton rdbtnNewRadioButton_2 = new JRadioButton("New radio button"); |
|
118 |
panel_4.add(rdbtnNewRadioButton_2); |
|
119 |
|
|
120 |
JPanel panel_7 = new JPanel(); |
|
121 |
panel_4.add(panel_7); |
|
122 |
|
|
123 |
internalFrame_1.setVisible(true); |
|
124 |
|
|
125 |
} |
|
126 |
|
|
127 |
public I3DSymbol getNewSymbol() { |
|
128 |
// TODO Auto-generated method stub |
|
129 |
return _symbol; |
|
130 |
} |
|
131 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/gui/styling/Object3DSymbolTab.java | ||
---|---|---|
1 |
package org.gvsig.gvsig3d.app.gui.styling; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Component; |
|
5 |
import java.awt.Dimension; |
|
6 |
import java.awt.GridBagConstraints; |
|
7 |
import java.awt.GridBagLayout; |
|
8 |
import java.awt.GridLayout; |
|
9 |
import java.awt.Insets; |
|
10 |
import java.io.File; |
|
11 |
import java.io.FileNotFoundException; |
|
12 |
|
|
13 |
import javax.swing.JButton; |
|
14 |
import javax.swing.JComboBox; |
|
15 |
import javax.swing.JFileChooser; |
|
16 |
import javax.swing.JInternalFrame; |
|
17 |
import javax.swing.JLabel; |
|
18 |
import javax.swing.JPanel; |
|
19 |
import javax.swing.JRadioButton; |
|
20 |
import javax.swing.JSpinner; |
|
21 |
import javax.swing.JTabbedPane; |
|
22 |
import javax.swing.JTextField; |
|
23 |
import javax.swing.border.TitledBorder; |
|
24 |
|
|
25 |
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.NodeMarker3DSymbol; |
|
26 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
|
27 |
import org.gvsig.gvsig3d.symbology3d.marker.ISimpleMarker3DSymbol; |
|
28 |
import org.gvsig.osgvp.core.osg.Group; |
|
29 |
import org.gvsig.osgvp.core.osg.Node; |
|
30 |
import org.gvsig.osgvp.core.osgdb.osgDB; |
|
31 |
import org.gvsig.osgvp.exceptions.node.LoadNodeException; |
|
32 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
|
33 |
import org.gvsig.osgvp.viewer.ViewerFactory; |
|
34 |
import java.awt.event.ActionListener; |
|
35 |
import java.awt.event.ActionEvent; |
|
36 |
|
|
37 |
public class Object3DSymbolTab extends JPanel implements ISymbolSelectorTab{ |
|
38 |
|
|
39 |
private JTextField textField; |
|
40 |
|
|
41 |
private IViewerContainer _canvas3d; |
|
42 |
|
|
43 |
private ISimpleMarker3DSymbol _symbol; |
|
44 |
private String _nodeURL; |
|
45 |
|
|
46 |
/** |
|
47 |
* Create the panel. |
|
48 |
*/ |
|
49 |
public Object3DSymbolTab(Component parent) { |
|
50 |
setLayout(new BorderLayout(0, 0)); |
|
51 |
|
|
52 |
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); |
|
53 |
add(tabbedPane); |
|
54 |
|
|
55 |
JPanel panel = new JPanel(); |
|
56 |
tabbedPane.addTab("Properties", null, panel, null); |
|
57 |
GridBagLayout gbl_panel = new GridBagLayout(); |
|
58 |
gbl_panel.columnWidths = new int[] { 352, 84, 0 }; |
|
59 |
gbl_panel.rowHeights = new int[] { 100, 0 }; |
|
60 |
gbl_panel.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; |
|
61 |
gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE }; |
|
62 |
panel.setLayout(gbl_panel); |
|
63 |
|
|
64 |
JPanel propertiesPanel = new JPanel(); |
|
65 |
propertiesPanel.setBorder(new TitledBorder(null, "Properties", |
|
66 |
TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
67 |
GridBagConstraints gbc_propertiesPanel = new GridBagConstraints(); |
|
68 |
gbc_propertiesPanel.anchor = GridBagConstraints.NORTHWEST; |
|
69 |
gbc_propertiesPanel.insets = new Insets(0, 0, 0, 5); |
|
70 |
gbc_propertiesPanel.gridx = 0; |
|
71 |
gbc_propertiesPanel.gridy = 0; |
|
72 |
panel.add(propertiesPanel, gbc_propertiesPanel); |
|
73 |
propertiesPanel.setLayout(new GridLayout(0, 3, 15, 0)); |
|
74 |
|
|
75 |
JLabel lblNewLabel_1 = new JLabel("Ruta:"); |
|
76 |
propertiesPanel.add(lblNewLabel_1); |
|
77 |
|
|
78 |
textField = new JTextField(); |
|
79 |
textField.setEditable(false); |
|
80 |
propertiesPanel.add(textField); |
|
81 |
textField.setColumns(10); |
|
82 |
|
|
83 |
JButton btnBrowse = new JButton("Browse"); |
|
84 |
btnBrowse.addActionListener(new ActionListener() { |
|
85 |
public void actionPerformed(ActionEvent e) { |
|
86 |
|
|
87 |
JFileChooser fc = new JFileChooser(); |
|
88 |
|
|
89 |
int returnVal = fc.showDialog(Object3DSymbolTab.this, |
|
90 |
"Select Color"); |
|
91 |
|
|
92 |
if (returnVal == JFileChooser.APPROVE_OPTION) { |
|
93 |
File file = fc.getSelectedFile(); |
|
94 |
_nodeURL = file.getAbsolutePath(); |
|
95 |
try { |
|
96 |
Node node = osgDB.readNodeFile(_nodeURL); |
|
97 |
_canvas3d.getOSGViewer().setSceneData(node); |
|
98 |
} catch (LoadNodeException e1) { |
|
99 |
// TODO Auto-generated catch block |
|
100 |
e1.printStackTrace(); |
|
101 |
} catch (FileNotFoundException e1) { |
|
102 |
// TODO Auto-generated catch block |
|
103 |
e1.printStackTrace(); |
|
104 |
} |
|
105 |
// this is where a real application would open the file. |
|
106 |
|
|
107 |
} else { |
|
108 |
|
|
109 |
} |
|
110 |
|
|
111 |
// _symbol.setColor(newColor); |
|
112 |
// _colorPanel.setBackground(newColor); |
|
113 |
// _colorPanel.repaint(); |
|
114 |
// symbolPreviewPanel.repaint(); |
|
115 |
// ((SymbolSelector3D) _parent).setSymbol(_symbol); |
|
116 |
|
|
117 |
} |
|
118 |
}); |
|
119 |
propertiesPanel.add(btnBrowse); |
|
120 |
|
|
121 |
JLabel lblSize = new JLabel("Scale Factor:"); |
|
122 |
propertiesPanel.add(lblSize); |
|
123 |
|
|
124 |
JSpinner spinner = new JSpinner(); |
|
125 |
propertiesPanel.add(spinner); |
|
126 |
|
|
127 |
JPanel panel_3 = new JPanel(); |
|
128 |
propertiesPanel.add(panel_3); |
|
129 |
|
|
130 |
JLabel lblUnits = new JLabel("Units"); |
|
131 |
propertiesPanel.add(lblUnits); |
|
132 |
|
|
133 |
JComboBox comboBox = new JComboBox(); |
|
134 |
propertiesPanel.add(comboBox); |
|
135 |
|
|
136 |
JComboBox comboBox_1 = new JComboBox(); |
|
137 |
propertiesPanel.add(comboBox_1); |
|
138 |
|
|
139 |
JPanel panel_2 = new JPanel(); |
|
140 |
panel_2.setBorder(new TitledBorder(null, "Preview", |
|
141 |
TitledBorder.LEADING, TitledBorder.TOP, null, null)); |
|
142 |
GridBagConstraints gbc_panel_2 = new GridBagConstraints(); |
|
143 |
gbc_panel_2.fill = GridBagConstraints.BOTH; |
|
144 |
gbc_panel_2.anchor = GridBagConstraints.WEST; |
|
145 |
gbc_panel_2.gridx = 1; |
|
146 |
gbc_panel_2.gridy = 0; |
|
147 |
panel.add(panel_2, gbc_panel_2); |
|
148 |
panel_2.setLayout(new BorderLayout(0, 0)); |
|
149 |
|
|
150 |
JPanel panel_8 = getOsgPanel(); |
|
151 |
panel_2.add(panel_8, BorderLayout.CENTER); |
|
152 |
|
|
153 |
JPanel panel_4 = new JPanel(); |
|
154 |
tabbedPane.addTab("Collection", null, panel_4, null); |
|
155 |
GridBagLayout gbl_panel_4 = new GridBagLayout(); |
|
156 |
gbl_panel_4.columnWidths = new int[] { 220, 220, 0 }; |
|
157 |
gbl_panel_4.rowHeights = new int[] { 33, 33, 33, 0 }; |
|
158 |
gbl_panel_4.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; |
|
159 |
gbl_panel_4.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; |
|
160 |
panel_4.setLayout(gbl_panel_4); |
|
161 |
|
|
162 |
JRadioButton rdbtnNewRadioButton = new JRadioButton(""); |
|
163 |
GridBagConstraints gbc_rdbtnNewRadioButton = new GridBagConstraints(); |
|
164 |
gbc_rdbtnNewRadioButton.anchor = GridBagConstraints.WEST; |
|
165 |
gbc_rdbtnNewRadioButton.insets = new Insets(0, 0, 5, 5); |
|
166 |
gbc_rdbtnNewRadioButton.gridx = 0; |
|
167 |
gbc_rdbtnNewRadioButton.gridy = 0; |
|
168 |
panel_4.add(rdbtnNewRadioButton, gbc_rdbtnNewRadioButton); |
|
169 |
|
|
170 |
JPanel panel_5 = new JPanel(); |
|
171 |
GridBagConstraints gbc_panel_5 = new GridBagConstraints(); |
|
172 |
gbc_panel_5.fill = GridBagConstraints.BOTH; |
|
173 |
gbc_panel_5.insets = new Insets(0, 0, 5, 0); |
|
174 |
gbc_panel_5.gridx = 1; |
|
175 |
gbc_panel_5.gridy = 0; |
|
176 |
panel_4.add(panel_5, gbc_panel_5); |
|
177 |
|
|
178 |
JRadioButton rdbtnNewRadioButton_1 = new JRadioButton(""); |
|
179 |
GridBagConstraints gbc_rdbtnNewRadioButton_1 = new GridBagConstraints(); |
|
180 |
gbc_rdbtnNewRadioButton_1.fill = GridBagConstraints.BOTH; |
|
181 |
gbc_rdbtnNewRadioButton_1.insets = new Insets(0, 0, 5, 5); |
|
182 |
gbc_rdbtnNewRadioButton_1.gridx = 0; |
|
183 |
gbc_rdbtnNewRadioButton_1.gridy = 1; |
|
184 |
panel_4.add(rdbtnNewRadioButton_1, gbc_rdbtnNewRadioButton_1); |
|
185 |
|
|
186 |
JPanel panel_6 = new JPanel(); |
|
187 |
GridBagConstraints gbc_panel_6 = new GridBagConstraints(); |
|
188 |
gbc_panel_6.fill = GridBagConstraints.BOTH; |
|
189 |
gbc_panel_6.insets = new Insets(0, 0, 5, 0); |
|
190 |
gbc_panel_6.gridx = 1; |
|
191 |
gbc_panel_6.gridy = 1; |
|
192 |
panel_4.add(panel_6, gbc_panel_6); |
|
193 |
|
|
194 |
JRadioButton rdbtnNewRadioButton_2 = new JRadioButton(""); |
|
195 |
GridBagConstraints gbc_rdbtnNewRadioButton_2 = new GridBagConstraints(); |
|
196 |
gbc_rdbtnNewRadioButton_2.fill = GridBagConstraints.BOTH; |
|
197 |
gbc_rdbtnNewRadioButton_2.insets = new Insets(0, 0, 0, 5); |
|
198 |
gbc_rdbtnNewRadioButton_2.gridx = 0; |
|
199 |
gbc_rdbtnNewRadioButton_2.gridy = 2; |
|
200 |
panel_4.add(rdbtnNewRadioButton_2, gbc_rdbtnNewRadioButton_2); |
|
201 |
|
|
202 |
JPanel panel_7 = new JPanel(); |
|
203 |
GridBagConstraints gbc_panel_7 = new GridBagConstraints(); |
|
204 |
gbc_panel_7.fill = GridBagConstraints.BOTH; |
|
205 |
gbc_panel_7.gridx = 1; |
|
206 |
gbc_panel_7.gridy = 2; |
|
207 |
panel_4.add(panel_7, gbc_panel_7); |
|
208 |
|
|
209 |
} |
|
210 |
|
|
211 |
private JPanel getOsgPanel() { |
|
212 |
|
|
213 |
int size = 150; |
|
214 |
JPanel aux3 = new JPanel(); |
|
215 |
aux3.setPreferredSize(new Dimension(size, size)); |
|
216 |
if (_canvas3d == null) { |
|
217 |
_canvas3d = ViewerFactory.getInstance().createViewer( |
|
218 |
ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, null); |
|
219 |
_canvas3d.setSize(size, size); |
|
220 |
//_canvas3d.getOSGViewer().setClearColor(1.0, 1.0, 1.0, 0.0); |
|
221 |
ViewerFactory.getInstance().startAnimator(); |
|
222 |
} |
|
223 |
|
|
224 |
loadFile(); |
|
225 |
|
|
226 |
aux3.add((Component) _canvas3d); |
|
227 |
|
|
228 |
return aux3; |
|
229 |
} |
|
230 |
|
|
231 |
private void loadFile() { |
|
232 |
Node node = null; |
|
233 |
// if (this.getFilePath() == "") { |
|
234 |
node = new Group(); |
|
235 |
// } else { |
|
236 |
// node = osgDB.readNodeFile(filePath); |
|
237 |
// } |
|
238 |
|
|
239 |
_canvas3d.getOSGViewer().setSceneData(node); |
|
240 |
} |
|
241 |
|
|
242 |
public I3DSymbol getNewSymbol() { |
|
243 |
// TODO Auto-generated method stub |
|
244 |
_symbol = new NodeMarker3DSymbol(); |
|
245 |
((NodeMarker3DSymbol) _symbol).setNodeFileURL(_nodeURL); |
|
246 |
|
|
247 |
return _symbol; |
|
248 |
} |
|
249 |
|
|
250 |
} |
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/tocmenu/TocTransparencyPanel.java | ||
---|---|---|
9 | 9 |
import org.gvsig.fmap.mapcontext.MapContext; |
10 | 10 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
11 | 11 |
import org.gvsig.gvsig3d.app.extension.DefaultView3DPanel; |
12 |
import org.gvsig.gvsig3d.app.gui.styling.SymbolSelector3D; |
|
12 | 13 |
import org.gvsig.gvsig3d.app.layer.TransparencyPanel; |
13 | 14 |
import org.gvsig.gvsig3d.map3d.Layer3DProps; |
14 | 15 |
|
... | ... | |
108 | 109 |
|
109 | 110 |
// Generating transparency panel |
110 | 111 |
TransparencyPanel transparencyPanel = new TransparencyPanel(model); |
112 |
|
|
111 | 113 |
// Showing it |
112 | 114 |
PluginServices.getMDIManager().addWindow(transparencyPanel); |
115 |
|
|
113 | 116 |
|
114 | 117 |
} |
115 | 118 |
|
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/tocmenu/TocRefreshLayer.java | ||
---|---|---|
97 | 97 |
for (int i = 0; i < selectedItems.length; i++) { |
98 | 98 |
// System.out.println("Recargando capa :" + i); |
99 | 99 |
Object propsObj = selectedItems[i].getProperty("3DLayerExtension"); |
100 |
((MapContext3D) model.getMapContext()).refreshLayerInTerrain( |
|
100 |
((MapContext3D) model.getMapContext()).refreshLayerInTerrain(selectedItems[i],
|
|
101 | 101 |
(Layer3DProps) propsObj, true); |
102 | 102 |
} |
103 | 103 |
|
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/src/main/java/org/gvsig/gvsig3d/app/extension/View3DManager.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.gvsig3d.app.extension; |
23 | 23 |
|
24 |
import java.text.DateFormat; |
|
24 |
import java.text.DateFormat;
|
|
25 | 25 |
import java.util.Date; |
26 | 26 |
|
27 | 27 |
import javax.swing.ImageIcon; |
... | ... | |
95 | 95 |
|
96 | 96 |
String viewName = "View3D"; |
97 | 97 |
String aux = PluginServices.getText(this, "untitled"); |
98 |
int numViews = ProjectManager.getInstance().getCurrentProject() |
|
98 |
int numViews = ProjectManager.getInstance().getCurrentProject()
|
|
99 | 99 |
.getDocuments(TYPENAME).size(); |
100 | 100 |
viewName = aux + " - " + numViews++; |
101 | 101 |
|
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/pom.xml | ||
---|---|---|
46 | 46 |
<dependency> |
47 | 47 |
<groupId>org.gvsig</groupId> |
48 | 48 |
<artifactId>org.gvsig.gvsig3d.lib.impl</artifactId> |
49 |
<scope>runtime</scope> |
|
50 | 49 |
</dependency> |
51 | 50 |
<dependency> |
52 | 51 |
<groupId>org.gvsig</groupId> |
2.0/trunk/org.gvsig.gvsig3d.app/pom.xml | ||
---|---|---|
81 | 81 |
<groupId>org.gvsig</groupId> |
82 | 82 |
<artifactId>org.gvsig.gvsig3d.lib.impl</artifactId> |
83 | 83 |
<version>1.0.0-SNAPSHOT</version> |
84 |
<scope>runtime</scope> |
|
85 | 84 |
</dependency> |
86 | 85 |
<dependency> |
87 | 86 |
<groupId>org.gvsig</groupId> |
2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.api/src/main/java/org/gvsig/gvsig3d/map3d/MapContext3D.java | ||
---|---|---|
91 | 91 |
|
92 | 92 |
public abstract void setLoading(boolean bLoading); |
93 | 93 |
|
94 |
public abstract void refreshLayerInTerrain(Layer3DProps props, |
|
94 |
public abstract void refreshLayerInTerrain(FLayer layer, Layer3DProps props,
|
|
95 | 95 |
boolean bRemoveCache); |
96 | 96 |
|
97 | 97 |
public abstract void addCurrentLayers(); |
2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.impl/src/main/java/org/gvsig/gvsig3d/impl/map3d/MapContext3DImpl.java | ||
---|---|---|
66 | 66 |
import org.gvsig.fmap.mapcontext.layers.operations.Classifiable; |
67 | 67 |
import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer; |
68 | 68 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
69 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
69 | 70 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
70 | 71 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent; |
71 | 72 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent; |
72 | 73 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent; |
73 | 74 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener; |
74 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
75 | 75 |
import org.gvsig.gvsig3d.impl.symbology3d.Symbol3DFactory; |
76 | 76 |
import org.gvsig.gvsig3d.impl.symbology3d.fill.impl.SimpleFill3DSymbol; |
77 | 77 |
import org.gvsig.gvsig3d.impl.symbology3d.line.impl.SimpleLine3DSymbol; |
... | ... | |
82 | 82 |
import org.gvsig.gvsig3d.map3d.Layer3DProps; |
83 | 83 |
import org.gvsig.gvsig3d.map3d.MapContext3D; |
84 | 84 |
import org.gvsig.gvsig3d.map3d.layers.FLayers3D; |
85 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
|
85 | 86 |
import org.gvsig.osgvp.core.osg.Image; |
86 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol; |
|
87 | 87 |
import org.gvsig.osgvp.core.osg.Matrix; |
88 | 88 |
import org.gvsig.osgvp.core.osg.Node; |
89 | 89 |
import org.gvsig.osgvp.core.osg.Vec2; |
... | ... | |
92 | 92 |
import org.gvsig.osgvp.exceptions.image.ImageConversionException; |
93 | 93 |
import org.gvsig.osgvp.exceptions.node.ChildIndexOutOfBoundsExceptions; |
94 | 94 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
95 |
import org.gvsig.osgvp.geometry.GeoPointArray3D; |
|
96 | 95 |
import org.gvsig.osgvp.symbology.ISymbol3D; |
97 |
import org.gvsig.osgvp.symbology.marker.SimpleMarker; |
|
98 |
import org.gvsig.osgvp.symbology.fill.SimpleFill; |
|
99 |
import org.gvsig.osgvp.symbology.line.SimpleLine; |
|
100 | 96 |
import org.gvsig.osgvp.terrain.Extent; |
101 | 97 |
import org.gvsig.osgvp.terrain.HeightfieldLayer; |
102 | 98 |
import org.gvsig.osgvp.terrain.JavaDataDriver; |
... | ... | |
119 | 115 |
import org.gvsig.raster.cache.tile.provider.CacheStruct; |
120 | 116 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
121 | 117 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider; |
122 |
import org.gvsig.raster.impl.provider.tile.FileTileServer; |
|
123 | 118 |
import org.gvsig.raster.netcdf.io.NetCDFDataParameters; |
124 | 119 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
125 | 120 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
... | ... | |
456 | 451 |
if (props.getType() == Layer3DPropsImpl.layer3DVector) { |
457 | 452 |
// if (layer instanceof FLyrVect) { |
458 | 453 |
// Set a 3D Legend |
459 |
try { |
|
460 |
((FLyrVect) layer).setLegend((IVectorLegend) MapContextLocator |
|
461 |
.getMapContextManager().getLegend( |
|
462 |
((FLyrVect) layer).getDataStore(), |
|
463 |
"project.document.view3d")); |
|
464 |
} catch (LegendLayerException e) { |
|
465 |
// TODO Auto-generated catch block |
|
466 |
e.printStackTrace(); |
|
467 |
} catch (LocatorException e) { |
|
468 |
// TODO Auto-generated catch block |
|
469 |
e.printStackTrace(); |
|
454 |
|
|
455 |
if (!(((FLyrVect) layer).getLegend().getDefaultSymbol() instanceof I3DSymbol)) { |
|
456 |
try { |
|
457 |
((FLyrVect) layer) |
|
458 |
.setLegend((IVectorLegend) MapContextLocator |
|
459 |
.getMapContextManager().getLegend( |
|
460 |
((FLyrVect) layer).getDataStore(), |
|
461 |
"project.document.view3d")); |
|
462 |
} catch (LegendLayerException e) { |
|
463 |
// TODO Auto-generated catch block |
|
464 |
e.printStackTrace(); |
|
465 |
} catch (LocatorException e) { |
|
466 |
// TODO Auto-generated catch block |
|
467 |
e.printStackTrace(); |
|
468 |
} |
|
470 | 469 |
} |
471 | 470 |
|
472 | 471 |
VectorLayer vlayer = new VectorLayer(); |
... | ... | |
497 | 496 |
hLayer.setDataDriver(_terrainDataManager); |
498 | 497 |
hLayer.setMaxLevel(100); |
499 | 498 |
hLayer.setMaxResolution(100); |
500 |
// Esto esta hardcodeado |
|
501 | 499 |
hLayer.setScaleFactor(props.getVerticalEx()); |
502 | 500 |
|
503 | 501 |
hLayer.setValidDataValues(new Vec2(-9999, 9999)); |
... | ... | |
766 | 764 |
// work |
767 | 765 |
((DefaultFLyrRaster) layer).init(); |
768 | 766 |
props3D.setType(Layer3DProps.layer3DImage); |
769 |
} catch (LoadLayerException e) {
|
|
767 |
} catch (LoadLayerException e) { |
|
770 | 768 |
// TODO Auto-generated catch block |
771 | 769 |
e.printStackTrace(); |
772 | 770 |
} catch (FilePaletteException e) { |
... | ... | |
886 | 884 |
} |
887 | 885 |
|
888 | 886 |
Layer3DProps props3D = getLayer3DProps(layer); |
889 |
refreshLayerInTerrain(props3D, false); |
|
887 |
refreshLayerInTerrain(layer, props3D, false);
|
|
890 | 888 |
|
891 | 889 |
int type = props3D.getType(); |
892 | 890 |
|
... | ... | |
992 | 990 |
Layer3DProps vectProps = getLayer3DProps(lyrVect); |
993 | 991 |
if ((newDrawVersion - props3D.getDrawVersion()) >= 1) { |
994 | 992 |
props3D.setDrawVersion(lyrVect.getDrawVersion()); |
995 |
refreshLayerInTerrain(vectProps, true); |
|
993 |
// refreshLayerInTerrain(lyrVect, vectProps, true); |
|
994 |
removeLayerToTerrain(lyr); |
|
995 |
addLayerToTerrain(lyr, true); |
|
996 | 996 |
refreshLayerVectorsVisibility(lyrVect); |
997 | 997 |
_bListenToLegend = false; |
998 | 998 |
// props3D.VerifyLegend(_terrain.getTerrainName()); |
... | ... | |
1067 | 1067 |
if (rde.getLayer().getLayerType() == Layer.LayerType.TEXTURELAYER) |
1068 | 1068 |
ude = loadRasterData(layer, envelope, rde); |
1069 | 1069 |
|
1070 |
|
|
1070 | 1071 |
if (rde.getLayer().getLayerType() == Layer.LayerType.VECTORLAYER) |
1071 | 1072 |
{ |
1072 | 1073 |
// GeometryMarker3DSymbol n = new GeometryMarker3DSymbol(); |
1073 | 1074 |
// n.setPictureFileURL("/home/jtorres/.depman/share/osgVP/resources/marker.png"); |
1074 | 1075 |
// n.setSize(25.0f); |
1075 | 1076 |
ude = loadVectorData(layer, envelope, rde, null); |
1076 |
}
|
|
1077 |
} |
|
1077 | 1078 |
if (rde.getLayer().getLayerType() == Layer.LayerType.HEIGHTFIELDLAYER) |
1078 | 1079 |
ude = loadElevationData(layer, envelope, rde); |
1079 | 1080 |
|
... | ... | |
1117 | 1118 |
|
1118 | 1119 |
// query.setAreaOfInterest(extent, 512, 512); |
1119 | 1120 |
|
1120 |
// System.out.println("Tile Parameters:");
|
|
1121 |
// System.out.println("TileLevel: " + rde.getTileLevel());
|
|
1122 |
// System.out.println("TileX = " + rde.getTileX());
|
|
1123 |
// System.out.println("TileY = " + rde.getTileY());
|
|
1124 |
// System.out.println("Extent = " + extent.getULX() + " "
|
|
1125 |
// + extent.getULY() + " " + extent.getLRX() + " "
|
|
1126 |
// + extent.getLRY());
|
|
1121 |
// System.out.println("Tile Parameters:");
|
|
1122 |
// System.out.println("TileLevel: " + rde.getTileLevel());
|
|
1123 |
// System.out.println("TileX = " + rde.getTileX());
|
|
1124 |
// System.out.println("TileY = " + rde.getTileY());
|
|
1125 |
// System.out.println("Extent = " + extent.getULX() + " "
|
|
1126 |
// + extent.getULY() + " " + extent.getLRX() + " "
|
|
1127 |
// + extent.getLRY());
|
|
1127 | 1128 |
|
1128 | 1129 |
try { |
1129 | 1130 |
Object[] result = rLayer.getDataStore().queryArray(query); |
... | ... | |
1147 | 1148 |
ColorInterpretation cInt = rLayer.getDataStore() |
1148 | 1149 |
.getColorInterpretation(); |
1149 | 1150 |
|
1150 |
int rgba[] = {0,1,2,3};
|
|
1151 |
|
|
1151 |
int rgba[] = { 0, 1, 2, 3 };
|
|
1152 |
|
|
1152 | 1153 |
rgba = setBandsInColors(cInt); |
1153 | 1154 |
|
1154 | 1155 |
int pixelFormat = convertPixelFormat(numBands); |
... | ... | |
1162 | 1163 |
case Buffer.TYPE_BYTE: |
1163 | 1164 |
ude.setRasterData( |
1164 | 1165 |
buildByteBuffer(ude, rBuff, transparencyBuffer, |
1165 |
numBands,rgba), rBuff.getWidth(), rBuff
|
|
1166 |
.getHeight(), numBands, pixelFormat,
|
|
1166 |
numBands, rgba), rBuff.getWidth(),
|
|
1167 |
rBuff.getHeight(), numBands, pixelFormat,
|
|
1167 | 1168 |
Image.DataType.GL_UNSIGNED_BYTE); |
1168 | 1169 |
break; |
1169 | 1170 |
case Buffer.TYPE_SHORT: |
... | ... | |
1211 | 1212 |
e.printStackTrace(); |
1212 | 1213 |
} catch (RasterDriverException e) { |
1213 | 1214 |
System.out.println("QueryArray failed"); |
1214 |
//e.printStackTrace(); |
|
1215 |
// e.printStackTrace();
|
|
1215 | 1216 |
} catch (InvalidSetViewException e) { |
1216 | 1217 |
// TODO Auto-generated catch block |
1217 | 1218 |
e.printStackTrace(); |
... | ... | |
1244 | 1245 |
|
1245 | 1246 |
private UpdateDataEvent loadVectorData(FLayer layer, Envelope envelope, |
1246 | 1247 |
RequestDataEvent rde, I3DSymbol sy) { |
1247 |
|
|
1248 |
|
|
1248 | 1249 |
System.out.println("vector data"); |
1249 | 1250 |
UpdateDataEvent ude = new UpdateDataEvent(); |
1250 | 1251 |
ude.copyDataFromRequest(rde); |
1251 | 1252 |
|
1252 |
|
|
1253 | 1253 |
// Convenience casting, create a default 3D symbol |
1254 | 1254 |
IVectorLegend legend = (IVectorLegend) ((FLyrVect) layer).getLegend(); |
1255 |
|
|
1255 | 1256 |
if(sy==null) sy = (I3DSymbol) legend.getDefaultSymbol(); |
1256 | 1257 |
else legend.setDefaultSymbol(sy); |
1257 | 1258 |
|
... | ... | |
1259 | 1260 |
//till gvSIG architects solve geometries problem |
1260 | 1261 |
if (sy instanceof IFillSymbol || sy instanceof ILineSymbol) |
1261 | 1262 |
{ |
1263 |
|
|
1262 | 1264 |
removeLayerToTerrain(layer); |
1263 | 1265 |
getLayer3DProps(layer).setType(Layer3DPropsImpl.layer3DImage); |
1264 | 1266 |
addLayerToTerrain(layer, true); |
1265 | 1267 |
return null; |
1266 |
}//End hack |
|
1268 |
}// End hack
|
|
1267 | 1269 |
Layer3DProps layerprops = getLayer3DProps(layer); |
1268 |
|
|
1269 |
if (layerprops.isZEnable()==false)
|
|
1270 |
|
|
1271 |
if (layerprops.isZEnable() == false)
|
|
1270 | 1272 |
sy.setFixedHeight(layerprops.getHeight()); |
1271 |
|
|
1272 |
|
|
1273 |
|
|
1273 | 1274 |
ViewPort vp = new ViewPort(_viewProjection); |
1274 | 1275 |
vp.setEnvelope(envelope); // the real extent of the tile |
1275 | 1276 |
vp.setAdjustable(false); |
1276 | 1277 |
vp.setImageSize(new Dimension(256, 256)); |
1277 | 1278 |
vp.setDist1pixel(0.000000001); |
1278 | 1279 |
double scale = 0.5 * (layer.getMaxScale() + layer.getMinScale()); |
1279 |
|
|
1280 |
|
|
1280 | 1281 |
try { |
1281 | 1282 |
layer.draw(null, null, vp, new MyCancel(), scale); |
1282 | 1283 |
} catch (ReadException e) { |
... | ... | |
1298 | 1299 |
System.out.println("OSG Layer added"); |
1299 | 1300 |
} |
1300 | 1301 |
// Vectorial layers |
1301 |
else {
|
|
1302 |
else { |
|
1302 | 1303 |
ISymbol3D sym = null; |
1303 | 1304 |
try { |
1304 | 1305 |
sym = Symbol3DFactory.getSymbol3D(sy); |
... | ... | |
1306 | 1307 |
// TODO Auto-generated catch block |
1307 | 1308 |
e.printStackTrace(); |
1308 | 1309 |
} |
1309 |
//sm.setPointSize((float) sy.getSize()); |
|
1310 |
// sm.setPointSize((float) sy.getSize());
|
|
1310 | 1311 |
n = sym.buildSceneGraph(sy.getGeometry()); |
1311 | 1312 |
} |
1312 | 1313 |
|
... | ... | |
1351 | 1352 |
envelope.getLowerCorner().getY()); |
1352 | 1353 |
|
1353 | 1354 |
query.setTileParameters(rde.getTileLevel(), rde.getTileX(), |
1354 |
rde.getTileY(), extent, cacheStruct);
|
|
1355 |
rde.getTileY(), extent, null);
|
|
1355 | 1356 |
|
1356 | 1357 |
// query.setAreaOfInterest(extent, 512, 512); |
1357 | 1358 |
|
... | ... | |
1501 | 1502 |
data[cont] = (byte) 0; |
1502 | 1503 |
else |
1503 | 1504 |
data[cont] = (byte) 255; |
1504 |
//data[cont] = transparencyBuffer.getElemByte(i, j, 0); |
|
1505 |
// data[cont] = transparencyBuffer.getElemByte(i, j, 0);
|
|
1505 | 1506 |
|
1506 | 1507 |
cont++; |
1507 | 1508 |
|
... | ... | |
1650 | 1651 |
} |
1651 | 1652 |
|
1652 | 1653 |
protected int[] setBandsInColors(ColorInterpretation cInt) { |
1653 |
|
|
1654 |
|
|
1654 | 1655 |
int rgba[] = new int[4]; |
1655 |
|
|
1656 |
|
|
1656 | 1657 |
rgba[0] = cInt.getBand(ColorInterpretation.RED_BAND); |
1657 |
if(rgba[0]==-1) rgba[0]=0; |
|
1658 |
if (rgba[0] == -1) |
|
1659 |
rgba[0] = 0; |
|
1658 | 1660 |
rgba[1] = cInt.getBand(ColorInterpretation.GREEN_BAND); |
1659 |
if(rgba[1]==-1) rgba[1]=1; |
|
1661 |
if (rgba[1] == -1) |
|
1662 |
rgba[1] = 1; |
|
1660 | 1663 |
rgba[2] = cInt.getBand(ColorInterpretation.BLUE_BAND); |
1661 |
if(rgba[2]==-1) rgba[2]=2; |
|
1664 |
if (rgba[2] == -1) |
|
1665 |
rgba[2] = 2; |
|
1662 | 1666 |
rgba[3] = cInt.getBand(ColorInterpretation.ALPHA_BAND); |
1663 |
if(rgba[3]==-1) rgba[3]=3; |
|
1664 |
|
|
1667 |
if (rgba[3] == -1) |
|
1668 |
rgba[3] = 3; |
|
1669 |
|
|
1665 | 1670 |
return rgba; |
1666 |
|
|
1671 |
|
|
1667 | 1672 |
} |
1668 | 1673 |
|
1669 | 1674 |
protected class MyCancel implements Cancellable { |
... | ... | |
1718 | 1723 |
|
1719 | 1724 |
} |
1720 | 1725 |
|
1721 |
public void refreshLayerInTerrain(Layer3DProps props, boolean bRemoveCache) { |
|
1726 |
public void refreshLayerInTerrain(FLayer layer, Layer3DProps props, |
|
1727 |
boolean bRemoveCache) { |
|
1722 | 1728 |
|
1723 | 1729 |
System.out.println("Refresh"); |
1724 | 1730 |
if (props == null) |
... | ... | |
1742 | 1748 |
e.printStackTrace(); |
1743 | 1749 |
} |
1744 | 1750 |
} else if (type == Layer3DProps.layer3DVector) { |
1745 |
invalidateVectorLayer(props); |
|
1751 |
// ILegend legend = ((FLyrVect) layer).getLegend(); |
|
1752 |
// |
|
1753 |
// try { |
|
1754 |
// RequestDataEvent rde = new RequestDataEvent(); |
|
1755 |
// loadVectorData(layer, layer.getFullEnvelope(), |
|
1756 |
// new RequestDataEvent(), (I3DSymbol) legend.getDefaultSymbol()); |
|
1757 |
// } catch (ReadException e) { |
|
1758 |
// // TODO Auto-generated catch block |
|
1759 |
// e.printStackTrace(); |
|
1760 |
// } |
|
1761 |
|
|
1746 | 1762 |
} |
1747 | 1763 |
|
1748 | 1764 |
} |
Also available in: Unified diff