Revision 16 org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsEditRouteCalibrationController.java
JLrsEditRouteCalibrationController.java | ||
---|---|---|
151 | 151 |
null); |
152 | 152 |
} |
153 | 153 |
|
154 |
if (!correctLayerFound(layer)) {
|
|
154 |
if (!JLrsUtilsController.isMlayerWithNonGeomField(layer)) {
|
|
155 | 155 |
logger.error("Impossible to find the layers needed"); |
156 | 156 |
throw new LrsNeededParameterException( |
157 | 157 |
"impossible_to_find_needed_layer", null); |
... | ... | |
608 | 608 |
} |
609 | 609 |
} |
610 | 610 |
|
611 |
/** |
|
612 |
* Tries to find one curve M-layer with at least one non-geometrical field |
|
613 |
* |
|
614 |
* @param FLayer |
|
615 |
* @return |
|
616 |
* @throws ReadException |
|
617 |
*/ |
|
618 |
private static boolean correctLayerFound(FLayer layer) { |
|
619 |
boolean correctLayerFound = false; |
|
620 |
// Validates is FLyrVect |
|
621 |
FLyrVect lyrVect = null; |
|
622 |
if (layer instanceof FLyrVect) { |
|
623 |
lyrVect = (FLyrVect) layer; |
|
624 |
} else |
|
625 |
return false; |
|
626 | 611 |
|
627 |
try { |
|
628 |
if (lyrVect != null && (lyrVect.getGeometryType() |
|
629 |
.isTypeOf(Geometry.TYPES.CURVE) |
|
630 |
|| lyrVect.getGeometryType().isTypeOf(Geometry.TYPES.MULTICURVE))) { |
|
631 |
//TODO M-geometry commented to test button |
|
632 |
// if (lyrVect.getGeometryType() |
|
633 |
// .isSubTypeOf(Geometry.SUBTYPES.GEOM2DM) || |
|
634 |
// lyrVect.getGeometryType() |
|
635 |
// .isSubTypeOf(Geometry.SUBTYPES.GEOM3DM)) { |
|
636 |
FeatureStore featureStore = lyrVect.getFeatureStore(); |
|
637 |
try { |
|
638 |
FeatureType type = featureStore.getDefaultFeatureType(); |
|
639 |
|
|
640 |
FeatureAttributeDescriptor[] attributeDescriptors = |
|
641 |
type.getAttributeDescriptors(); |
|
642 |
for (int i = 0; i < attributeDescriptors.length; i++) { |
|
643 |
FeatureAttributeDescriptor featureAttributeDescriptor = |
|
644 |
attributeDescriptors[i]; |
|
645 |
if (featureAttributeDescriptor.getDataType() |
|
646 |
.getType() != DataTypes.GEOMETRY) { |
|
647 |
logger.debug("Correct curve layer found"); |
|
648 |
return true; |
|
649 |
} |
|
650 |
} |
|
651 |
// type.getDefaultGeometryAttribute().getGeomType().isSubTypeOf(Geometry.SUBTYPES.GEOM2DM) |
|
652 |
|
|
653 |
} catch (DataException e1) { |
|
654 |
logger.warn(new StringBuilder() |
|
655 |
.append( |
|
656 |
"Error getting default feature type from layer ") |
|
657 |
.append(lyrVect.getName()).toString(), e1); |
|
658 |
} |
|
659 |
|
|
660 |
//} |
|
661 |
} |
|
662 |
} catch (Exception e) { |
|
663 |
logger.error("Can't get linear vector layers", e); |
|
664 |
} |
|
665 |
return correctLayerFound; |
|
666 |
} |
|
667 |
|
|
668 | 612 |
/** |
669 | 613 |
* Returns true if selectedIdRoute is contained in layer |
670 | 614 |
* @param layer |
Also available in: Unified diff