addSubelement( category, DIST_DESCRIPTION, dist.getDesc() );
if ( ( dist.getPoints() != null ) && ( dist.getPoints().size() > 0 ) ) {
final Point p0 = dist.getPoints().get( 0 );
- if ( p0 != null ) {
+ if ( ( p0 != null ) && !Point.isSeemsEmpty( p0 ) ) {
addSubelement( category, DIST_GEODETIC_DATUM, p0.getGeodeticDatum() );
addSubelement( category, DIST_LATITUDE, String.valueOf( p0.getLatitude() ) );
addSubelement( category, DIST_LONGITUDE, String.valueOf( p0.getLongitude() ) );
}
public boolean isEmpty() {
+ if ( ForesterUtil.isEmpty( _desc ) && ( ( getPoints() != null ) && ( getPoints().size() == 1 ) )
+ && ForesterUtil.isEmpty( _polygons ) ) {
+ if ( Point.isSeemsEmpty( getPoints().get( 0 ) ) ) {
+ return true;
+ }
+ }
return ForesterUtil.isEmpty( _desc ) && ForesterUtil.isEmpty( _points ) && ForesterUtil.isEmpty( _polygons );
}
int i = 0;
if ( getPoints() != null ) {
for( final Point point : getPoints() ) {
- if ( point != null ) {
+ if ( ( point != null ) && !Point.isSeemsEmpty( point ) ) {
sb.append( ForesterUtil.LINE_SEPARATOR );
sb.append( " Point " + i + ": " );
sb.append( point.asSimpleText() );
final String ind = indentation + PhylogenyWriter.PHYLO_XML_INTENDATION_BASE;
if ( getPoints() != null ) {
for( final Point point : getPoints() ) {
- point.toPhyloXML( writer, level, ind );
+ if ( ( point != null ) && !Point.isSeemsEmpty( point ) ) {
+ point.toPhyloXML( writer, level, ind );
+ }
}
}
if ( getPolygons() != null ) {
for( final Polygon polygon : getPolygons() ) {
- polygon.toPhyloXML( writer, level, ind );
+ if ( polygon != null ) {
+ polygon.toPhyloXML( writer, level, ind );
+ }
}
}
writer.write( ForesterUtil.LINE_SEPARATOR );
public String toString() {
return asSimpleText().toString();
}
+
+ static public final boolean isSeemsEmpty( final Point p ) {
+ return ( ( ( p.getAltitude() == null ) || ( p.getAltitude().compareTo( BigDecimal.ZERO ) <= 0 ) )
+ && ( ( p.getLongitude() == null ) || ( p.getLongitude().compareTo( BigDecimal.ZERO ) <= 0 ) )
+ && ( ( p.getLatitude() == null ) || ( p.getLatitude().compareTo( BigDecimal.ZERO ) <= 0 ) )
+ && ( ForesterUtil.isEmpty( p.getGeodeticDatum() ) || p.getGeodeticDatum()
+ .equalsIgnoreCase( UNKNOWN_GEODETIC_DATUM ) ) && ( ForesterUtil.isEmpty( p.getAltiudeUnit() ) || p
+ .getAltiudeUnit().equalsIgnoreCase( "?" ) ) );
+ }
}