Revision 41873 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/utils/SHPFile2.java

View differences:

SHPFile2.java
43 43
import org.gvsig.fmap.geom.Geometry.TYPES;
44 44
import org.gvsig.fmap.geom.GeometryLocator;
45 45
import org.gvsig.fmap.geom.GeometryManager;
46
import org.gvsig.fmap.geom.aggregate.Aggregate;
47
import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
46
import org.gvsig.fmap.geom.aggregate.MultiPoint;
48 47
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
49 48
import org.gvsig.fmap.geom.exception.CreateGeometryException;
49
import org.gvsig.fmap.geom.primitive.Curve;
50 50
import org.gvsig.fmap.geom.primitive.Envelope;
51 51
import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
52 52
import org.gvsig.fmap.geom.primitive.Point;
......
59 59

  
60 60
/**
61 61
 * @author jmvivo
62
 *
62
 * 
63 63
 */
64 64
public class SHPFile2 implements ISHPFile {
65 65

  
......
80 80

  
81 81
    private int[] supportedGeometryTypes;
82 82
    private final GeometryManager gManager = GeometryLocator
83
            .getGeometryManager();
83
        .getGeometryManager();
84 84

  
85 85
    private GeometryType gtypeNull;
86 86
    private PointGeometryType gtypePoint2D;
......
89 89
    private GeometryType gtypeMultiPoint2D;
90 90

  
91 91
    private boolean useNullGeometry = false;
92

  
92
    
93 93
    private boolean allowInconsistenciesInGeometryTypeWarningShow = false;
94 94
    
95 95
    public SHPFile2(SHPStoreParameters params) {
......
98 98
            gtypeNull = gManager.getGeometryType(TYPES.NULL, SUBTYPES.GEOM2D);
99 99
            gtypePoint2D
100 100
                    = (PointGeometryType) gManager.getGeometryType(TYPES.POINT,
101
                            SUBTYPES.GEOM2D);
101
                    SUBTYPES.GEOM2D);
102 102
            gtypeCurve2D
103 103
                    = gManager.getGeometryType(TYPES.CURVE, SUBTYPES.GEOM2D);
104 104
            gtypeSurface2D
......
108 108

  
109 109
        } catch (GeometryTypeNotSupportedException e) {
110 110
            throw new RuntimeException(
111
                    "Unable to get the 2D geometry types to use", e);
111
                "Unable to get the 2D geometry types to use", e);
112 112
        } catch (GeometryTypeNotValidException e) {
113 113
            throw new RuntimeException(
114
                    "Unable to get the 2D geometry types to use", e);
114
                "Unable to get the 2D geometry types to use", e);
115 115
        }
116 116
    }
117 117

  
118 118
    public void setUseNullGeometry(boolean useNullGeometry) {
119 119
        this.useNullGeometry = useNullGeometry;
120 120
    }
121

  
121
    
122 122
    /*
123 123
     * (non-Javadoc)
124 124
     * 
......
217 217
        max[1] = myHeader.myYmax;
218 218

  
219 219
        try {
220
            extent
221
                    = gManager.createEnvelope(min[0], min[1], max[0], max[1],
222
                            SUBTYPES.GEOM2D);
220
            extent =
221
                gManager.createEnvelope(min[0], min[1], max[0], max[1],
222
                    SUBTYPES.GEOM2D);
223 223
        } catch (CreateEnvelopeException e1) {
224 224
            logger.warn("Error creating the envelope", e1);
225 225
        }
......
280 280

  
281 281
    public boolean isEditable() {
282 282
        return this.params.getDBFFile().canWrite()
283
                && this.params.getSHPFile().canWrite()
284
                && this.params.getSHXFile().canWrite();
283
            && this.params.getSHPFile().canWrite()
284
            && this.params.getSHXFile().canWrite();
285 285
    }
286 286

  
287 287
    public int getGeometryType() throws ReadException {
288 288
        int auxType = 0;
289 289

  
290 290
        switch (type) {
291
            case (SHP.POINT2D):
292
            case (SHP.POINT3D):
293
                auxType = auxType | Geometry.TYPES.POINT;
291
        case (SHP.POINT2D):
292
        case (SHP.POINT3D):
293
            auxType = auxType | Geometry.TYPES.POINT;
294 294

  
295
                break;
295
            break;
296 296

  
297
            case (SHP.POLYLINE2D):
298
            case (SHP.POLYLINE3D):
299
                auxType = auxType | Geometry.TYPES.MULTICURVE;
297
        case (SHP.POLYLINE2D):
298
        case (SHP.POLYLINE3D):
299
            auxType = auxType | Geometry.TYPES.MULTICURVE;
300 300

  
301
                break;
301
            break;
302 302

  
303
            case (SHP.POLYGON2D):
304
            case (SHP.POLYGON3D):
305
                auxType = auxType | Geometry.TYPES.MULTISURFACE;
303
        case (SHP.POLYGON2D):
304
        case (SHP.POLYGON3D):
305
            auxType = auxType | Geometry.TYPES.MULTISURFACE;
306 306

  
307
                break;
308
            case (SHP.MULTIPOINT2D):
309
            case (SHP.MULTIPOINT3D):
310
                auxType = auxType | Geometry.TYPES.MULTIPOINT;
307
            break;
308
        case (SHP.MULTIPOINT2D):
309
        case (SHP.MULTIPOINT3D):
310
            auxType = auxType | Geometry.TYPES.MULTIPOINT;
311 311

  
312
                break;
312
            break;
313 313
        }
314 314

  
315 315
        return auxType;
......
317 317

  
318 318
    public int getGeometrySubType() throws ReadException {
319 319
        switch (type) {
320
            case (SHP.POINT2D):
321
            case (SHP.POLYLINE2D):
322
            case (SHP.POLYGON2D):
323
            case (SHP.MULTIPOINT2D):
324
                return SUBTYPES.GEOM2D;
325
            case (SHP.POINT3D):
326
            case (SHP.POLYLINE3D):
327
            case (SHP.POLYGON3D):
328
            case (SHP.MULTIPOINT3D):
329
                return SUBTYPES.GEOM3D;
330
            case (SHP.POINTM):
331
            case (SHP.POLYLINEM):
332
            case (SHP.POLYGONM):
333
            case (SHP.MULTIPOINTM):
334
                return SUBTYPES.GEOM2DM;
320
        case (SHP.POINT2D):
321
        case (SHP.POLYLINE2D):
322
        case (SHP.POLYGON2D):
323
        case (SHP.MULTIPOINT2D):
324
            return SUBTYPES.GEOM2D;
325
        case (SHP.POINT3D):
326
        case (SHP.POLYLINE3D):
327
        case (SHP.POLYGON3D):
328
        case (SHP.MULTIPOINT3D):
329
            return SUBTYPES.GEOM3D;
330
        case (SHP.POINTM):
331
        case (SHP.POLYLINEM):
332
        case (SHP.POLYGONM):
333
        case (SHP.MULTIPOINTM):
334
            return SUBTYPES.GEOM2DM;
335 335
        }
336 336

  
337 337
        return SUBTYPES.UNKNOWN;
......
343 343
        }
344 344
        return null;
345 345
    }
346

  
346
    
347 347
    /**
348 348
     * Gets the geometry with the index provided. Set to synchronized to prevent
349 349
     * concurrent threads issue (?)
350
     *
350
     * 
351 351
     * @param position
352 352
     * @return
353 353
     * @throws ReadException
354 354
     * @throws CreateGeometryException
355 355
     */
356 356
    public synchronized Geometry getGeometry(long position)
357
            throws ReadException, CreateGeometryException {
357
        throws ReadException, CreateGeometryException {
358 358

  
359 359
        int shapeType;
360 360
        bb.position(getPositionForRecord(position));
361 361
        bb.order(ByteOrder.LITTLE_ENDIAN);
362 362
        shapeType = bb.getInt();
363

  
363
        
364 364
        if (shapeType == SHP.NULL) {
365 365
            return getNullGeometry();
366 366
        }
367

  
367
        
368 368
        /*
369 369
         * Inconsistency: this particular shape is not
370 370
         * of the expected type. This can be because the SHP file
......
382 382
            }
383 383
        }
384 384

  
385
        Geometry geometry;
386
        Point point;
385
        // retrieve that shape.
386
        // tempRecord.setShape(readShape(tempShapeType, tempContentLength, in));
387 387
        switch (type) {
388
            case (SHP.POINT2D):
389
                point = readPoint(bb);
390
                return point;
388
        case (SHP.POINT2D):
389
        case (SHP.POINT3D):
390
        case (SHP.POINTM):
391
            Point point = readPoint(bb);
392
            fillPoint(point);
393
            return point;
391 394

  
392
            case (SHP.POINT3D):
393
                point = readPoint(bb);
394
                point.setCoordinateAt(
395
                        Geometry.DIMENSIONS.Z,
396
                        bb.getDouble()
397
                );
398
                return point;
395
        case (SHP.POLYLINE2D):
396
            Curve curve = (Curve) gtypeCurve2D.create();
397
            fillCurve(curve);
398
            if( curve.getNumVertices()==0 ) {
399
                return getNullGeometry();
400
            }
401
            return curve;
399 402

  
400
            case (SHP.POINTM):
401
                point = readPoint(bb);
402
                point.setCoordinateAt(2, bb.getDouble());
403
                return point;
403
        case (SHP.POLYGON2D):
404
            Surface surface = (Surface) gtypeSurface2D.create();
405
            fillSurface(surface);
406
            if( surface.getNumVertices()==0 ) {
407
                return getNullGeometry();
408
            }
409
            return surface;
404 410

  
405
            case (SHP.POLYLINE2D):
406
                geometry = readGeometry(
407
                        Geometry.TYPES.CURVE,
408
                        Geometry.TYPES.MULTICURVE,
409
                        Geometry.SUBTYPES.GEOM2D);
410
                if (geometry == null) {
411
                    return getNullGeometry();
412
                }
413
                return geometry;
411
        case (SHP.POLYLINE3D):
412
            Curve curve3D =
413
                (Curve) gManager.create(TYPES.CURVE, SUBTYPES.GEOM3D);
414
            fillCurve(curve3D);
415
            fillZ(curve3D);
416
            if( curve3D.getNumVertices()==0 ) {
417
                return getNullGeometry();
418
            }
419
            return curve3D;
414 420

  
415
            case (SHP.POLYGON2D):
416
                geometry = readGeometry(
417
                        Geometry.TYPES.SURFACE,
418
                        Geometry.TYPES.MULTISURFACE,
419
                        Geometry.SUBTYPES.GEOM2D);
420
                if (geometry == null) {
421
                    return getNullGeometry();
422
                }
423
                return geometry;
421
        case (SHP.POLYGON3D):
422
            Surface surface3D =
423
                (Surface) gManager.create(TYPES.SURFACE, SUBTYPES.GEOM3D);
424
            fillSurface(surface3D);
425
            fillZ(surface3D);
426
            if( surface3D.getNumVertices()==0 ) {
427
                return getNullGeometry();
428
            }
429
            return surface3D;
424 430

  
425
            case (SHP.POLYLINE3D):
426
                geometry = readGeometry(
427
                        Geometry.TYPES.CURVE,
428
                        Geometry.TYPES.MULTICURVE,
429
                        Geometry.SUBTYPES.GEOM3D);
430
                if (geometry == null) {
431
                    return getNullGeometry();
432
                }
433
                return geometry;
431
        case (SHP.MULTIPOINT2D):
434 432

  
435
            case (SHP.POLYGON3D):
436
                geometry = readGeometry(
437
                        Geometry.TYPES.SURFACE,
438
                        Geometry.TYPES.MULTISURFACE,
439
                        Geometry.SUBTYPES.GEOM3D);
440
                if (geometry == null) {
441
                    return getNullGeometry();
442
                }
443
                return geometry;
433
            Point p = null;
434
            int numPoints;
435
            int i;
436
            int j;
437
            bb.position(bb.position() + 32);
438
            numPoints = bb.getInt();
444 439

  
445
            case (SHP.MULTIPOINT2D):
446
                geometry = readMultiPoint(SUBTYPES.GEOM2D);
447
                if (geometry == null) {
448
                    return getNullGeometry();
449
                }
450
                return geometry;
440
            Point[] points = new Point[numPoints];
451 441

  
452
            case (SHP.MULTIPOINT3D):
453
                geometry = readMultiPoint(SUBTYPES.GEOM3D);
454
                if (geometry == null) {
455
                    return getNullGeometry();
456
                }
457
                return geometry;
442
            for (i = 0; i < numPoints; i++) {
443
                points[i] =
444
                    (Point) gManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
445
                points[i].setX(bb.getDouble());
446
                points[i].setY(bb.getDouble());
447
            }
448

  
449
            MultiPoint multipoint = (MultiPoint) gtypeMultiPoint2D.create();
450
            // MultiPoint multipoint =
451
            // (MultiPoint)GeometryLocator.getGeometryManager().create(TYPES.MULTIPOINT,
452
            // SUBTYPES.GEOM2D);
453
            for (int k = 0; k < points.length; k++) {
454
                multipoint.addPoint(points[k]);
455
            }
456

  
457
            if( multipoint.getPrimitivesNumber()==0 ) {
458
                return getNullGeometry();
459
            }
460
            return multipoint;
461

  
462
        case (SHP.MULTIPOINT3D):
463
            bb.position(bb.position() + 32);
464
            numPoints = bb.getInt();
465

  
466
            double[] temX = new double[numPoints];
467
            double[] temY = new double[numPoints];
468
            double[] temZ = new double[numPoints];
469

  
470
            for (i = 0; i < numPoints; i++) {
471
                temX[i] = bb.getDouble();
472
                temY[i] = bb.getDouble();
473
                // temZ[i] = bb.getDouble();
474
            }
475

  
476
            for (i = 0; i < numPoints; i++) {
477
                temZ[i] = bb.getDouble();
478
            }
479

  
480
            MultiPoint multipoint3D =
481
                (MultiPoint) gManager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM3D);
482
            for (int k = 0; k < temX.length; k++) {
483
                Point pointAux =
484
                    (Point) gManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
485
                pointAux.setX(temX[k]);
486
                pointAux.setY(temY[k]);
487
                pointAux.setCoordinateAt(2, temZ[k]);
488
                multipoint3D.addPoint(pointAux);
489
            }
490
            if( multipoint3D.getPrimitivesNumber()==0 ) {
491
                return getNullGeometry();
492
            }
493
            return multipoint3D;
458 494
        }
459 495

  
460 496
        return null;
461 497
    }
462 498

  
463
    private Geometry readMultiPoint(int subtype) throws CreateGeometryException, ReadException {
464
        Point point;
499
    private void fillPoint(Point point) throws ReadException {
500
        if (subType == Geometry.SUBTYPES.GEOM3D) {
501
            point.setCoordinateAt(Geometry.DIMENSIONS.Z, bb.getDouble());
502
        } else
503
            if (subType == Geometry.SUBTYPES.GEOM2DM) {
504
                point.setCoordinateAt(2, bb.getDouble());
505
            }
506
    }
465 507

  
508
    private void fillCurve(Curve curve)
509
        throws CreateGeometryException, ReadException {
510
        Point p = null;
511
        int numParts;
512
        int numPoints;
513
        int i;
514
        int j;
515

  
466 516
        bb.position(bb.position() + 32);
467
        int numPoints = bb.getInt();
468
        
469
        if( numPoints < 1 ) {
470
            return null;
517
        numParts = bb.getInt();
518
        numPoints = bb.getInt();
519

  
520
        int[] tempParts = new int[numParts];
521

  
522
        for (i = 0; i < numParts; i++) {
523
            tempParts[i] = bb.getInt();
471 524
        }
472 525

  
473
//        Point[] points = new Point[numPoints];
526
        j = 0;
474 527

  
475
        MultiPrimitive multi = (MultiPrimitive) gManager.create(Geometry.TYPES.MULTIPOINT, subtype);
476
        multi.ensureCapacity(numPoints);
528
        for (i = 0; i < numPoints; i++) {
529
            p = readPoint(bb);
477 530

  
478
        for (int i = 0; i < numPoints; i++) {
479
            point = (Point) gManager.create(TYPES.POINT, subtype);
480
            point.setX(bb.getDouble());
481
            point.setY(bb.getDouble());
482
            multi.addPrimitive(point);
483
        }
531
            if (i == tempParts[j]) {
532
                curve.addMoveToVertex(p);
484 533

  
485
        if (subtype == Geometry.SUBTYPES.GEOM3D) {
486
            for (int i = 0; i < numPoints; i++) {
487
                double z = bb.getDouble();
488
                point = (Point) multi.getPrimitiveAt(i);
489
                point.setCoordinateAt(Geometry.DIMENSIONS.Z, z);
534
                if (j < (numParts - 1)) {
535
                    j++;
536
                }
537
            } else {
538
                curve.addVertex(p);
490 539
            }
491 540
        }
492
        if (multi.getPrimitivesNumber() == 0) {
493
            return null;
494
        }
495
        return multi;
496 541
    }
542
    
543
    private void fillSurface(Surface surface)
544
        throws CreateGeometryException, ReadException {
545
        Point p = null;
546
        int numParts;
547
        int numPoints;
548
        int i;
549
        int partIndex;
497 550

  
498
    private Geometry readGeometry(int type, int typemulti, int subtype)
499
            throws CreateGeometryException, ReadException {
500

  
501 551
        bb.position(bb.position() + 32);
552
        numParts = bb.getInt();
553
        numPoints = bb.getInt();
502 554

  
503
        int numberOfMultis = bb.getInt();
504
        int numberOfPoints = bb.getInt();
505
        
506
        if( numberOfPoints<1  ) {
507
            return null;
508
        }
509
        if( numberOfMultis<1 ) {
510
            numberOfMultis=0;
511
        }
555
        int[] tempParts = new int[numParts];
512 556

  
513
        int[] indexOfPointsOfMulti = new int[numberOfMultis+1];
514
        for (int i = 0; i < numberOfMultis; i++) {
515
            indexOfPointsOfMulti[i] = bb.getInt();
557
        for (i = 0; i < numParts; i++) {
558
            tempParts[i] = bb.getInt();
516 559
        }
517
        indexOfPointsOfMulti[numberOfMultis] = -1;
518
                
519
        MultiPrimitive multi = null;
520
        if (numberOfMultis > 1) {
521
            multi = (MultiPrimitive) gManager.create(typemulti, subtype);
522
        }
523
        OrientablePrimitive primitive = null;
524 560

  
525
        int nextSurface = 0;
561
        partIndex = 0;
526 562

  
527
        for (int i = 0; i < numberOfPoints; i++) {
528
            Point p = readPoint(subtype, bb);
529
            if (i == indexOfPointsOfMulti[nextSurface]) {
530
                // Cambiamos de poligono
531
                if( primitive != null ) {
532
                    if( multi != null ) {
533
                        multi.addPrimitive(primitive);
534
                    }
563
        for (i = 0; i < numPoints; i++) {
564
            p = readPoint(bb);
565

  
566
            if (i == tempParts[partIndex]) {
567
                surface.addMoveToVertex(p);
568
                if (partIndex < (numParts - 1)) {
569
                    partIndex++;
535 570
                }
536
                primitive = (OrientablePrimitive) gManager.create(type, subtype);
537
                primitive.addVertex(p);
538
                nextSurface++;
539 571
            } else {
540
                primitive.addVertex(p);
572
                if ((i == tempParts[partIndex] - 1) || (i == numPoints - 1)) {
573
                    surface.closePrimitive();
574
                } else {
575
                    surface.addVertex(p);
576
                }
541 577
            }
542 578
        }
543
        if (multi != null) {
544
            multi.addPrimitive(primitive);
545
            if (subtype == Geometry.SUBTYPES.GEOM3D) {
546
                fillZ(multi);
547
            }
548
            return multi;
549
        }
550
        if (primitive==null || primitive.getNumVertices() < 1) {
551
            return null;
552
        }
553
        if (subtype == Geometry.SUBTYPES.GEOM3D) {
554
            fillZ(primitive);
555
        }
556
        return primitive;
557 579
    }
558 580

  
559
    private void fillZ(Geometry geometry)
560
            throws CreateGeometryException, ReadException {
581
    private void fillZ(OrientablePrimitive orientablePrimitive)
582
        throws CreateGeometryException, ReadException {
561 583
        double[] boxZ = new double[2];
562 584
        boxZ[0] = bb.getDouble();
563 585
        boxZ[1] = bb.getDouble();
564 586

  
565
        if (geometry == null) {
566
            return;
587
        for (int i = 0; i < orientablePrimitive.getNumVertices(); i++) {
588
            orientablePrimitive.setCoordinateAt(i, 2, bb.getDouble());
567 589
        }
568
        if (geometry instanceof Aggregate) {
569
            Aggregate multi = (Aggregate) geometry;
570
            for (int i = 0; i < multi.getPrimitivesNumber(); i++) {
571
                OrientablePrimitive primitive = (OrientablePrimitive) geometry;
572
                for (int p = 0; p < primitive.getNumVertices(); p++) {
573
                    primitive.setCoordinateAt(p, 2, bb.getDouble());
574
                }
575
            }
576
        } else if (geometry instanceof OrientablePrimitive) {
577
            OrientablePrimitive primitive = (OrientablePrimitive) geometry;
578
            for (int p = 0; p < primitive.getNumVertices(); p++) {
579
                primitive.setCoordinateAt(p, 2, bb.getDouble());
580
            }
581
        } else {
582
            logger.warn("Geoemtry type '" + geometry.getClass().getName() + "'unexpected ");
583
        }
584 590
    }
585 591

  
586 592
    private long getPositionForRecord(long numRec) {
......
598 604

  
599 605
    /**
600 606
     * Reads the Point from the shape file.
601
     *
607
     * 
602 608
     * @param in ByteBuffer.
603
     *
609
     * 
604 610
     * @return Point2D.
605 611
     * @throws ReadException
606 612
     * @throws CreateGeometryException
607 613
     */
608 614
    private Point readPoint(BigByteBuffer2 in)
609
            throws CreateGeometryException, ReadException {
615
        throws CreateGeometryException, ReadException {
610 616
        return readPoint(subType, in);
611 617
    }
612 618

  
......
623 629

  
624 630
    /**
625 631
     * Lee un rect?ngulo del fichero.
626
     *
632
     * 
627 633
     * @param in ByteBuffer.
628
     *
634
     * 
629 635
     * @return Rect?ngulo.
630 636
     * @throws CreateEnvelopeException
631
     *
637
     * 
632 638
     * @throws IOException
633 639
     */
634 640
    private Envelope readRectangle(BigByteBuffer2 in)
635
            throws CreateEnvelopeException {
641
        throws CreateEnvelopeException {
636 642
        in.order(ByteOrder.LITTLE_ENDIAN);
637 643
        double x = in.getDouble();
638 644
        double y = in.getDouble();
......
658 664
    /**
659 665
     * Gets the geometry bbox with the index provided. Set to synchronized to
660 666
     * prevent concurrent threads issue (?)
661
     *
667
     * 
662 668
     * @param featureIndex
663 669
     * @return
664 670
     * @throws ReadException
......
666 672
     * @throws CreateGeometryException
667 673
     */
668 674
    public synchronized Envelope getBoundingBox(long featureIndex)
669
            throws ReadException, CreateEnvelopeException, CreateGeometryException {
675
        throws ReadException, CreateEnvelopeException, CreateGeometryException {
670 676
        Point p;
671 677
        Envelope BoundingBox = null;
672 678
        try {
......
688 694
        // retrieve that shape.
689 695
        // tempRecord.setShape(readShape(tempShapeType, tempContentLength, in));
690 696
        switch (tipoShape) {
691
            case (SHP.POINT2D):
692
            case (SHP.POINT3D):
693
                p = readPoint(bb);
697
        case (SHP.POINT2D):
698
        case (SHP.POINT3D):
699
            p = readPoint(bb);
694 700
                BoundingBox
695 701
                        = gManager.createEnvelope(p.getX() - 0.1, p.getY() - 0.1,
696
                                p.getX() + 0.2, p.getY() + 0.2, SUBTYPES.GEOM2D);
697
                // new Rectangle2D.Double(p.getX() - 0.1,
698
                // p.getY() - 0.1, 0.2, 0.2);
702
                    p.getX() + 0.2, p.getY() + 0.2, SUBTYPES.GEOM2D);
703
            // new Rectangle2D.Double(p.getX() - 0.1,
704
            // p.getY() - 0.1, 0.2, 0.2);
699 705

  
700
                break;
706
            break;
701 707

  
702
            case (SHP.POLYLINE2D):
703
            case (SHP.POLYGON2D):
704
            case (SHP.MULTIPOINT2D):
705
            case (SHP.POLYLINE3D):
706
            case (SHP.POLYGON3D):
707
            case (SHP.MULTIPOINT3D):
708
        case (SHP.POLYLINE2D):
709
        case (SHP.POLYGON2D):
710
        case (SHP.MULTIPOINT2D):
711
        case (SHP.POLYLINE3D):
712
        case (SHP.POLYGON3D):
713
        case (SHP.MULTIPOINT3D):
708 714

  
709
                // BoundingBox
710
                BoundingBox = readRectangle(bb);
715
            // BoundingBox
716
            BoundingBox = readRectangle(bb);
711 717

  
712
                break;
718
            break;
713 719
        }
714 720

  
715 721
        return BoundingBox;
......
724 730

  
725 731
    private void initSupportedGeometryTypes() throws ReadException {
726 732
        switch (this.getGeometryType()) {
727
            case Geometry.TYPES.POINT:
733
        case Geometry.TYPES.POINT:
728 734
                supportedGeometryTypes
729 735
                        = new int[]{Geometry.TYPES.POINT, Geometry.TYPES.NULL};
730
                break;
731
            case Geometry.TYPES.MULTIPOINT:
736
            break;
737
        case Geometry.TYPES.MULTIPOINT:
732 738
                supportedGeometryTypes
733 739
                        = new int[]{Geometry.TYPES.MULTIPOINT, Geometry.TYPES.NULL};
734
                break;
735
            case Geometry.TYPES.MULTICURVE:
740
            break;
741
        case Geometry.TYPES.MULTICURVE:
736 742
                supportedGeometryTypes
737 743
                        = new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.ELLIPSE,
738
                            Geometry.TYPES.ARC, Geometry.TYPES.CIRCLE,
739
                            Geometry.TYPES.SURFACE, Geometry.TYPES.NULL,
744
                    Geometry.TYPES.ARC, Geometry.TYPES.CIRCLE,
745
                    Geometry.TYPES.SURFACE, Geometry.TYPES.NULL,
740 746
                            Geometry.TYPES.MULTICURVE};
741
                break;
742
            case Geometry.TYPES.MULTISURFACE:
747
            break;
748
        case Geometry.TYPES.MULTISURFACE:
743 749
                supportedGeometryTypes
744 750
                        = new int[]{Geometry.TYPES.ELLIPSE, Geometry.TYPES.CIRCLE,
745
                            Geometry.TYPES.SURFACE, Geometry.TYPES.NULL,
751
                    Geometry.TYPES.SURFACE, Geometry.TYPES.NULL,
746 752
                            Geometry.TYPES.MULTISURFACE};
747
                break;
753
            break;
748 754

  
749
            default:
755
        default:
750 756
                supportedGeometryTypes = new int[]{};
751 757
        }
752 758
    }

Also available in: Unified diff