Revision 45941 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/DefaultEnvelope.java

View differences:

DefaultEnvelope.java
440 440
    public void setProjection(IProjection projection) {
441 441
        this.projection = projection;
442 442
    }
443

  
444
    @Override
445
    public boolean isCollapsed() {
446
        switch(this.getDimension()) {
447
            case 3:
448
                return this.isCollapsed(Geometry.SUBTYPES.GEOM3D);
449
            default:
450
            case 2:
451
                return this.isCollapsed(Geometry.SUBTYPES.GEOM2D);
452
        }
453
    }
443 454
    
455
    @Override
456
    public boolean isCollapsed(int subtype) {
457
        if( this.isEmpty ) {
458
            return true;
459
        }
460
        switch(subtype) {
461
            case Geometry.SUBTYPES.GEOM3DM:
462
                int m = this.getDimension()-1;
463
                if( this.getLength(m)!=0 ) {
464
                    return false;
465
                }
466
            case Geometry.SUBTYPES.GEOM2DM:
467
            case Geometry.SUBTYPES.GEOM3D:
468
                if( this.getLength(DIMENSIONS.Z)!=0 ) {
469
                    return false;
470
                }
471
            default:
472
            case Geometry.SUBTYPES.GEOM2D:
473
                if( this.getLength(DIMENSIONS.X)!=0 ) {
474
                    return false;
475
                }
476
                if( this.getLength(DIMENSIONS.Y)!=0 ) {
477
                    return false;
478
                }
479
                return true;
480
        }
481
    }
482

  
444 483
}

Also available in: Unified diff