Revision 44207 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/symboltables/ProjectSymbolTable.java
ProjectSymbolTable.java | ||
---|---|---|
478 | 478 |
Geometry geom = getGeom(args, 0); |
479 | 479 |
switch( args.length ) { |
480 | 480 |
case 2: |
481 |
units = getUnits(args, 1); |
|
481 |
units = getUnitsArea(args, 1);
|
|
482 | 482 |
break; |
483 | 483 |
case 3: |
484 | 484 |
proj = getProjection(args, 1); |
485 |
units = getUnits(args, 2); |
|
485 |
units = getUnitsArea(args, 2);
|
|
486 | 486 |
break; |
487 | 487 |
} |
488 | 488 |
if (proj == null) { |
... | ... | |
519 | 519 |
Geometry geom = getGeom(args, 0); |
520 | 520 |
switch( args.length ) { |
521 | 521 |
case 2: |
522 |
units = getUnits(args, 1); |
|
522 |
units = getUnitsArea(args, 1);
|
|
523 | 523 |
break; |
524 | 524 |
case 3: |
525 | 525 |
proj = getProjection(args, 1); |
526 |
units = getUnits(args, 2); |
|
526 |
units = getUnitsArea(args, 2);
|
|
527 | 527 |
break; |
528 | 528 |
} |
529 | 529 |
if (proj == null) { |
... | ... | |
654 | 654 |
return CRSFactory.getCRS(code); |
655 | 655 |
} |
656 | 656 |
|
657 |
private int getUnits(Object[] args, int i) { |
|
657 |
private int getUnitsArea(Object[] args, int i) {
|
|
658 | 658 |
Object value = args[i]; |
659 | 659 |
if (value == null) { |
660 | 660 |
throw new IllegalArgumentException("Illegal unit value 'null'"); |
... | ... | |
678 | 678 |
throw new IllegalArgumentException("Illegal unit name '" + name + "'"); |
679 | 679 |
} |
680 | 680 |
|
681 |
private int getUnitsDistance(Object[] args, int i) { |
|
682 |
Object value = args[i]; |
|
683 |
if (value == null) { |
|
684 |
throw new IllegalArgumentException("Illegal unit value 'null'"); |
|
685 |
} |
|
686 |
if (value instanceof Number) { |
|
687 |
return ((Number) value).intValue(); |
|
688 |
} |
|
689 |
String name = value.toString(); |
|
690 |
String[] names = MapContext.getDistanceAbbr(); |
|
691 |
for (int j = 0; j < names.length; j++) { |
|
692 |
if (name.equalsIgnoreCase(names[j])) { |
|
693 |
return j; |
|
694 |
} |
|
695 |
} |
|
696 |
names = MapContext.getDistanceNames(); |
|
697 |
for (int j = 0; j < names.length; j++) { |
|
698 |
if (name.equalsIgnoreCase(names[j])) { |
|
699 |
return j; |
|
700 |
} |
|
701 |
} |
|
702 |
throw new IllegalArgumentException("Illegal unit name '" + name + "'"); |
|
703 |
} |
|
704 |
|
|
681 | 705 |
} |
Also available in: Unified diff