Revision 9956 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/gui/ViewProperties.java

View differences:

ViewProperties.java
49 49
import javax.swing.JColorChooser;
50 50
import javax.swing.JPanel;
51 51

  
52
import org.cresques.cts.IProjection;
52 53
import org.gvsig.gui.beans.AcceptCancelPanel;
53 54
import org.gvsig.gui.beans.swing.JButton;
54 55

  
......
277 278
		if (cmbMapUnits == null) {
278 279
			cmbMapUnits = new javax.swing.JComboBox(getUnitsNames());
279 280
			cmbMapUnits.setPreferredSize(new java.awt.Dimension(200, 20));
281
			IProjection proj=view.getProjection();
282
			if (!proj.isProjected()) {
283
				if (cmbMapUnits.getItemCount()==Attributes.NAMES.length) {
284
					cmbMapUnits.addItem(PluginServices.getText(this, Attributes.DEGREES));
285
				}
286
				cmbMapUnits.setSelectedItem(PluginServices.getText(this, Attributes.DEGREES));
287
				cmbMapUnits.setEnabled(false);
288
			}else {
289
				if (!(cmbMapUnits.getItemCount()==Attributes.NAMES.length)) {
290
					cmbMapUnits.removeItem(PluginServices.getText(this, Attributes.DEGREES));
291
				}
292
				cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
293
				cmbMapUnits.setEnabled(true);
294
			}
280 295
			cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
296

  
281 297
			cmbMapUnits.addActionListener(new java.awt.event.ActionListener() {
282 298
				public void actionPerformed(java.awt.event.ActionEvent e) {
283 299
					//view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex());
......
593 609
	 */
594 610
	private CRSSelectPanel getJPanelProj() {
595 611
		if (jPanelProj == null) {
596
			jPanelProj = CRSSelectPanel.getPanel(view.getProjection());
612
			IProjection proj=view.getProjection();
613
			jPanelProj = CRSSelectPanel.getPanel(proj);
597 614
			jPanelProj.setPreferredSize(new java.awt.Dimension(330,35));
598 615
			jPanelProj.addActionListener(new java.awt.event.ActionListener() {
599 616
				public void actionPerformed(java.awt.event.ActionEvent e) {
600 617
					if (jPanelProj.isOkPressed()) {
618
						if (!jPanelProj.getCurProj().isProjected()) {
619
							if (getCmbMapUnits().getItemCount()==Attributes.NAMES.length) {
620
								getCmbMapUnits().addItem(PluginServices.getText(this, Attributes.DEGREES));
621
							}
622
							getCmbMapUnits().setSelectedItem(PluginServices.getText(this, Attributes.DEGREES));
623
							getCmbMapUnits().setEnabled(false);
624
						}else {
625
							if (getCmbMapUnits().getSelectedItem().equals(PluginServices.getText(this, Attributes.DEGREES))) {
626
								getCmbMapUnits().setSelectedIndex(1);
627
								getCmbMapUnits().setEnabled(true);
628
							}
629
							if (!(getCmbMapUnits().getItemCount()==Attributes.NAMES.length)) {
630
								getCmbMapUnits().removeItem(PluginServices.getText(this, Attributes.DEGREES));
631
							}
632
						}
601 633
						view.setProjection(jPanelProj.getCurProj());
602 634
					}
603 635
				}
......
627 659
			ActionListener okAction, cancelAction;
628 660
			okAction = new java.awt.event.ActionListener() {
629 661
				public void actionPerformed(java.awt.event.ActionEvent e) {
630
					view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
631
					view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex());
632 662
					view.setName(txtName.getText());
633 663
					view.setCreationDate(txtDate.getText());
634 664
					view.setOwner(txtOwner.getText());
......
658 688
	private String[] getUnitsNames() {
659 689
		if (unitsNames == null) {
660 690
			unitsNames = new String[Attributes.NAMES.length];
661
			for (int i=0;i<Attributes.NAMES.length;i++) {
691
			int i=0;
692
			for (i=0;i<Attributes.NAMES.length;i++) {
662 693
				unitsNames[i]=PluginServices.getText(this, Attributes.NAMES[i]);
663 694
			}
695
			//unitsNames[i]=PluginServices.getText(this, Attributes.DEGREES);
664 696
		}
665 697
		return unitsNames;
666 698
	}

Also available in: Unified diff