Revision 22760

View differences:

trunk/extensions/ext3Dgui/src/org/gvsig/gvsig3dgui/ProjectView3D.java
70 70

  
71 71
	private ProjectCamera projectCamera = null;
72 72

  
73
	private int m_planetType = Planet.CoordinateSystemType.GEOCENTRIC; // spheric
73
	private int m_planetType = Planet.CoordinateSystemType.PROJECTED; // spheric
74 74
																		// or
75 75
																		// plane
76 76

  
trunk/extensions/ext3Dgui/src/org/gvsig/gvsig3dgui/view/ViewProperties3D.java
43 43
import java.awt.Color;
44 44
import java.awt.Component;
45 45
import java.awt.Dimension;
46
import java.awt.GridBagConstraints;
47
import java.awt.GridBagLayout;
46 48
import java.awt.Insets;
47 49
import java.awt.event.ActionEvent;
48 50
import java.awt.event.ActionListener;
......
70 72

  
71 73
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps;
72 74
import com.iver.andami.PluginServices;
75
import com.iver.andami.ui.mdiManager.IWindow;
73 76
import com.iver.andami.ui.mdiManager.SingletonWindow;
74 77
import com.iver.andami.ui.mdiManager.WindowInfo;
75 78
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
......
77 80
import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
78 81
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel;
79 82
import com.iver.cit.gvsig.project.documents.view.IProjectView;
83
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
80 84

  
81 85
/**
82 86
 * Dialogo donde se muestran las propiedades de una vista
83 87
 * 
84
 * @author Fernando Gonz�lez Cort�s
88
 * @author 
85 89
 */
86 90
public class ViewProperties3D extends GridBagLayoutPanel implements
87 91
		SingletonWindow {
......
133 137
	private JPanel jPanelSelectProjectionView;
134 138
	
135 139
	private IProjection  proj;
140
	
141
	private boolean projectEditable = false;
136 142

  
137 143
	/**
138 144
	 * This is the default constructor
......
143 149
	 *            Vista que se representa
144 150
	 */
145 151
	public ViewProperties3D(IProjectView v, boolean edit) {
152
		projectEditable = edit;
146 153
		view3D = (ProjectView3D) v;
147 154
		proj = view3D.getProjection();
148
		view3D.getMapContext().setProjection(proj);
149 155
		setEditable(edit);
150 156
		initialize();
151 157
	}
152 158

  
159
	private void addComponentGridBag(String label, Component component, int position) {
160
		if (label == null) {
161
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
162
	        gridBagConstraints.gridx = 0;
163
	        gridBagConstraints.gridy = position;
164
	        gridBagConstraints.anchor = GridBagConstraints.EAST;
165
	        gridBagConstraints.gridwidth = 2;
166
	        gridBagConstraints.insets = new Insets(2, 5, 2, 5);
167
	        this.add(component, gridBagConstraints);
168
		} else {
169
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
170
	        gridBagConstraints.gridx = 0;
171
	        gridBagConstraints.gridy = position;
172
	        gridBagConstraints.anchor = GridBagConstraints.WEST;
173
	        gridBagConstraints.insets = new Insets(2, 5, 2, 5);
174
	        this.add(new JLabel(label), gridBagConstraints);
175
	        
176
			gridBagConstraints = new GridBagConstraints();
177
	        gridBagConstraints.gridx = 1;
178
	        gridBagConstraints.gridy = position;
179
	        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
180
	        gridBagConstraints.weightx = 1.0;
181
	        gridBagConstraints.insets = new Insets(2, 5, 2, 5);
182
	        this.add(component, gridBagConstraints);
183
		}
184
	}
185
	
153 186
	/**
154 187
	 * This method initializes this
155 188
	 */
156 189
	private void initialize() {
190
		this.setLayout(new GridBagLayout());
191
		
157 192
		// Inicialize component
158 193
		setName(PluginServices.getText(this, "view_3D_properties"));
159 194
		// Introducing the margin 
......
165 200
		// ADDING COMPONENTS
166 201
		
167 202
		// Name Component
168
		this.addComponent(PluginServices.getText(this, "Name"), getTxtName(), new Insets(0,10,2,10));
203
		addComponentGridBag(PluginServices.getText(this, "Name"), getTxtName(), 0);
204

  
169 205
		// Date component
170
		this.addComponent(PluginServices.getText(this, "Creation_Date"), getTxtDate(), new Insets(2,10,2,10));
206
		addComponentGridBag(PluginServices.getText(this, "Creation_Date"), getTxtDate(), 1);
207

  
171 208
		// Owner component
172
		this.addComponent(PluginServices.getText(this, "Owner"), getTxtOwner(), new Insets(2,10,2,10));
209
		
210
		this.addComponentGridBag(PluginServices.getText(this, "Owner"), getTxtOwner(), 2);
173 211
		// Projection selector (Radio buton group)
174
		this.addComponent(PluginServices.getText(this, "Proyection_Select"),
175
				getJPanelSelectProjection(), new Insets(2,10,2,10));
212
		this.addComponentGridBag(PluginServices.getText(this, "Proyection_Select"), getJPanelSelectProjection(), 3);
176 213
//		this.addComponent(PluginServices.getText(this, "Proyection_Select"),
177 214
//				getJPanelSelectProjectionView(), new Insets(2,10,2,10));
178
//		this.addComponent(getJPanelProj());
215
		this.addComponentGridBag(null, getJPanelProj(), 4);
216
		
217
		// Description component
218
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
219
        gridBagConstraints.gridx = 0;
220
        gridBagConstraints.gridy = 5;
221
        gridBagConstraints.insets = new Insets(2, 5, 2, 5);
222
        gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
223
        this.add(new JLabel(PluginServices.getText(this, "Commentaries")), gridBagConstraints);
224
        
225
		gridBagConstraints = new GridBagConstraints();
226
        gridBagConstraints.gridx = 1;
227
        gridBagConstraints.gridy = 5;
228
        gridBagConstraints.fill = GridBagConstraints.BOTH;
229
        gridBagConstraints.weightx = 1.0;
230
        gridBagConstraints.weighty = 1.0;
231
        gridBagConstraints.insets = new Insets(2, 5, 2, 5);
232
        this.add(getJScrollPane(), gridBagConstraints);
179 233

  
180
		// Description component
181
		GridBagLayoutPanel aux = new GridBagLayoutPanel();
182
		aux.add(getJScrollPane());
183
		addComponent(new JLabel(PluginServices.getText(this, "Commentaries")),new Insets(2,6,2,6));
184
		addComponent(aux,new Insets(2,6,2,6));
185
		
186 234
		// Vertical exaggeration
187
		this.addComponent(PluginServices.getText(this, "Vertical_Exageration"), getVerEx(),new Insets(2,10,2,10));
235
		this.addComponentGridBag(PluginServices.getText(this, "Vertical_Exageration"), getVerEx(), 6);
188 236
		
189 237
		// Color Panel
190 238
		panelColor = new GridBagLayoutPanel();
191 239
		panelColor.add(getLblColor());
192 240
		panelColor.add(getBtnColor());
193
		this.addComponent(PluginServices.getText(this, "Background_Color"), panelColor,new Insets(5,6,5,6));
241
		this.addComponentGridBag(PluginServices.getText(this, "Background_Color"), panelColor, 7);
194 242
		
195
		
196 243
		// Accept buton
197
		this.addComponent(getOkCancelPanel(),new Insets(2,150,2,0));
244
		this.addComponentGridBag(null, getOkCancelPanel(), 8);
198 245
		
199 246
		// Inicialicing default values
200 247
		this.txtName.setText(PluginServices.getText(this, "Creation_Date"));
......
304 351
				// if the radio button was selected programmatically
305 352
				public void actionPerformed(ActionEvent evt) {
306 353
					view3D.setPlanetType(Planet.CoordinateSystemType.GEOCENTRIC);
354
					proj= CRSFactory.getCRS("EPSG:4326");
355
					setComponentProjection(proj);
307 356
					
308
					isNotEnable();// Projection options disabled in spherical view.
309
					
310 357
				}
311 358
			};
312 359
			Action flatAction = new AbstractAction("flat") {
313 360
				// See above
314 361
				public void actionPerformed(ActionEvent evt) {
315 362
					view3D.setPlanetType(Planet.CoordinateSystemType.PROJECTED);
363
					proj = view3D.getProjection();
364
					setComponentProjection(proj);
316 365
					
317
					isEnable();// Projection options enabled in flat view.
318
					
319 366
				}
320 367
			};
321 368
			Action orthoAction = new AbstractAction("ortho") {
......
339 386
			ortho.setName("ortho");
340 387
			ortho.setText(PluginServices.getText(this, "Ortho"));
341 388

  
342
			if (view3D.getPlanetType()== Planet.CoordinateSystemType.GEOCENTRIC)
389
			if (view3D.getPlanetType()== Planet.CoordinateSystemType.GEOCENTRIC) {
343 390
				spherical.setSelected(true);
391
				//jPanelProj.setEnabled(false);
392
			}
344 393
			else
345 394
				flat.setSelected(true);
346 395

  
......
348 397
			radioButtonGroupTypePlanet = new ButtonGroup();
349 398
			radioButtonGroupTypePlanet.add(spherical);
350 399
			radioButtonGroupTypePlanet.add(flat);
400
			
401
			
402
	//		}
351 403
//			radioButtonGroupTypePlanet.add(ortho);
352 404
		}
353 405

  
354 406
		return radioButtonGroupTypePlanet;
355 407
	}
356 408
	
357
	// Projection options enabled in flat view.
358
	protected void isEnable() {
359
		Component[] cs=jPanelProj.getComponents();
360
		if (cs != null)
361
			for (int i = 0; i < cs.length; i++) {
362
				if((cs[i] instanceof JLabel) && (i == 1)){
363
				    ((JLabel)cs[i]).setText("EPSG:23030");
364
				    IProjection proj= CRSFactory.getCRS("EPSG:23030");	
365
					view3D.setProjection(proj);
366
				}
367
				cs[i].setEnabled(true);
368
			}
369
	}
370
	
371
	
372
	// Projection options disabled in spherical view.
373
	protected void isNotEnable() {	
374
		Component[] cs=jPanelProj.getComponents();
375
		if (cs != null)
376
			for (int i = 0; i < cs.length; i++) {
377
				if((cs[i] instanceof JLabel) && (i == 1)){
378
				    ((JLabel)cs[i]).setText("EPSG:4326");
379
				    IProjection proj= CRSFactory.getCRS("EPSG:4326");	
380
					view3D.setProjection(proj);
381
				}
382
				cs[i].setEnabled(false);
383
			}
384
	}
385 409

  
386 410
	/**
387 411
	 * Method to inicialize the radio button group
......
480 504
	private javax.swing.JScrollPane getJScrollPane() {
481 505
		if (jScrollPane == null) {
482 506
			jScrollPane = new javax.swing.JScrollPane();
483
			//jScrollPane.setSize(new java.awt.Dimension(340, 70));
484 507
			jScrollPane.setViewportView(getTxtComments());
485 508
			jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70));
486 509
		}
......
512 535
					// TODO: poner la exageracion vertical
513 536
//					view3D.set)
514 537
//					setVerticalExaggeration();
538
					
539
					proj = jPanelProj.getCurProj();
515 540
					setVerticalEx(Float.parseFloat(verEx.getText()));
516 541
					view3D.setVerticalExaggeration(Float.parseFloat(verEx.getText()));
542
					view3D.setProjection(proj);
517 543
					PluginServices.getMDIManager().closeWindow(ViewProperties3D.this);
518 544
				}
519 545
			};
......
585 611
	}
586 612
	
587 613
	private CRSSelectPanel getJPanelProj() {
588
	//	IProjection  proj;
589
	//if (bole == true) {
590
 		if( this.editable){
591
			proj= CRSFactory.getCRS("EPSG:4326");
592
			view3D.setProjection(proj);
593
 		}
594
		else
595
			proj = view3D.getProjection(); 
596 614
 		
615
		IProjection projectionAux = null;
616
		IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow();
617
		if (activeWindow instanceof View3D) {
618
			BaseView activeView = (View3D)activeWindow;
619
			projectionAux = activeView.getProjection();
620
			activeView.setProjection(proj);
621
		}
622

  
623
		jPanelProj = CRSSelectPanel.getPanel(proj);
624

  
625
		if (activeWindow instanceof View3D) {
626
			BaseView activeView = (View3D)activeWindow;
627
			activeView.setProjection(projectionAux);
628
		}
629

  
597 630
		
598
		jPanelProj = CRSSelectPanel.getPanel(proj);
599 631
		jPanelProj.setPreferredSize(new java.awt.Dimension(330,35));
600 632
		
601 633
		
......
627 659
		});
628 660
		
629 661
		Component[] cs=jPanelProj.getComponents();
630
		// Projection options disabled in spherical view.
662
	//	 Projection options disabled in spherical view.
631 663
		if(view3D.getPlanetType() == Planet.CoordinateSystemType.GEOCENTRIC){
664
			proj= CRSFactory.getCRS("EPSG:4326");
632 665
			for (int i = 0; i < cs.length; i++) {
633 666
				cs[i].setEnabled(false);
634 667
			}
635 668
		}
636 669
		// Projection options disabled in flat view.
637
		else
638
			for (int i = 0; i < cs.length; i++) {
639
				cs[i].setEnabled(false);
640
				if((cs[i] instanceof JLabel) && (i == 1)){
641
					IProjection projectionSelected = jPanelProj.getCurProj();
642
				    ((JLabel)cs[i]).setText(projectionSelected.getAbrev());
643
				  
644
				    
670
		else{
671
			if(!projectEditable) {
672
				proj = view3D.getProjection();
673
				for (int i = 0; i < cs.length; i++) {
674
						cs[i].setEnabled(false);
675
					}
645 676
				}
646 677
			}
647 678
		
679
		
648 680
		return jPanelProj;
649 681
	}
650

  
682
	
683
	private void setComponentProjection(IProjection projection) {
684
		proj = projection;
685
		this.remove(jPanelProj);
686
		jPanelProj = null;
687
		
688
		this.addComponentGridBag(null, getJPanelProj(), 4);
689
		this.validate();
690
		
691
	}
651 692
}
trunk/extensions/ext3Dgui/src/org/gvsig/gvsig3dgui/view/View3D.java
101 101
			projection = CRSFactory.getCRS("EPSG:4326");
102 102
			extend = new Rectangle2D.Double(-180.0, 90.0, 180.0, -90.0);
103 103
		} else {
104
			projection = CRSFactory.getCRS("EPSG:23030"); // test
104
			if ((fmap != null) && (fmap.getProjection() != null))
105
				projection = fmap.getProjection();
106
			else
107
				projection = CRSFactory.getCRS("EPSG:23030"); // test
105 108
			// projection = CRSFactory.getCRS("EPSG:4326"); // test
106 109
			// extend = new Rectangle2D.Double(-20000000.0, 10000000.0,
107 110
			// 40000000.0, 20000000.0);
trunk/extensions/ext3Dgui/config/text.properties
23 23
view_3D_properties=Propiedades de la vista 3D
24 24
Name=Nombre:
25 25
Creation_Date=Fecha de creacion:
26
Owner=Propietario
26
Owner=Propietario:
27 27
Proyection_Select=Seleccione tipo:
28 28
Commentaries=Comentarios:
29 29
Vertical_Exageration=Exageraci?n vertical:
30
Background_Color=Color de fondo
30
Background_Color=Color de fondo:
31 31
Spherical=Esferica
32 32
Flat=Plana
33 33
Select_Color=Seleccion de color

Also available in: Unified diff