Revision 42001 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/SHPFile.java

View differences:

SHPFile.java
60 60

  
61 61
/**
62 62
 * @author jmvivo
63
 * 
63
 *
64 64
 */
65 65
public class SHPFile implements ISHPFile {
66 66

  
......
90 90
    private GeometryType gtypeMultiPoint2D;
91 91

  
92 92
    private boolean useNullGeometry = false;
93
    
93

  
94 94
    public SHPFile(SHPStoreParameters params) {
95 95
        this.params = params;
96 96
        try {
......
114 114
        }
115 115
    }
116 116

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

  
122 121
    /*
123 122
     * (non-Javadoc)
124
     * 
123
     *
125 124
     * @see org.gvsig.fmap.dal.Resource#doClose()
126 125
     */
127
    @Override
128 126
    public void close() throws CloseException {
129 127
        CloseException ret = null;
130 128

  
......
155 153
        srsParameters = null;
156 154
    }
157 155

  
158
    @Override
159 156
    public boolean isOpen() {
160 157
        return this.fin != null;
161 158
    }
162 159

  
163
    @Override
164 160
    public synchronized void open() throws DataException {
165 161
        try {
166 162
            fin = new FileInputStream(this.params.getSHPFile());
......
277 273
        }
278 274
    }
279 275

  
280
    @Override
281 276
    public Envelope getFullExtent() throws ReadException {
282 277
        return this.extent;
283 278
    }
284 279

  
285
    @Override
286 280
    public boolean isEditable() {
287 281
        return this.params.getDBFFile().canWrite()
288 282
            && this.params.getSHPFile().canWrite()
289 283
            && this.params.getSHXFile().canWrite();
290 284
    }
291 285

  
292
    @Override
293 286
    public int getGeometryType() throws ReadException {
294 287
        int auxType = 0;
295 288

  
......
321 314
        return auxType;
322 315
    }
323 316

  
324
    @Override
325 317
    public int getGeometrySubType() throws ReadException {
326 318
        switch (type) {
327 319
        case (SHP.POINT2D):
......
350 342
        }
351 343
        return null;
352 344
    }
353
    
345

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

  
......
368 359
        bb.position(getPositionForRecord(position));
369 360
        bb.order(ByteOrder.LITTLE_ENDIAN);
370 361
        shapeType = bb.getInt();
371
        
362

  
372 363
        // el shape tal con tema tal y n?mro tal es null
373 364
        if (shapeType == SHP.NULL) {
374 365
            return getNullGeometry();
375 366
        }
376
        
367

  
377 368
        /*
378 369
         * Inconsistency: this particular shape is not
379 370
         * of the expected type. This can be because the SHP file
......
542 533
            }
543 534
        }
544 535
    }
545
    
536

  
546 537
    private void fillSurface(Surface surface)
547 538
        throws CreateGeometryException, ReadException {
548 539
        Point p = null;
......
607 598

  
608 599
    /**
609 600
     * Reads the Point from the shape file.
610
     * 
601
     *
611 602
     * @param in
612 603
     *            ByteBuffer.
613
     * 
604
     *
614 605
     * @return Point2D.
615 606
     * @throws ReadException
616 607
     * @throws CreateGeometryException
......
629 620

  
630 621
    /**
631 622
     * Lee un rect?ngulo del fichero.
632
     * 
623
     *
633 624
     * @param in
634 625
     *            ByteBuffer.
635
     * 
626
     *
636 627
     * @return Rect?ngulo.
637 628
     * @throws CreateEnvelopeException
638
     * 
629
     *
639 630
     * @throws IOException
640 631
     */
641 632
    private Envelope readRectangle(BigByteBuffer2 in)
......
665 656
    /**
666 657
     * Gets the geometry bbox with the index provided.
667 658
     * Set to synchronized to prevent concurrent threads issue (?)
668
     * 
659
     *
669 660
     * @param featureIndex
670 661
     * @return
671 662
     * @throws ReadException
672 663
     * @throws CreateEnvelopeException
673 664
     * @throws CreateGeometryException
674 665
     */
675
    @Override
676 666
    public synchronized Envelope getBoundingBox(long featureIndex)
677 667
        throws ReadException, CreateEnvelopeException, CreateGeometryException {
678 668
        Point p = null;
......
728 718
    /**
729 719
     * @return
730 720
     */
731
    @Override
732 721
    public String getSRSParameters() {
733 722
        return this.srsParameters;
734 723
    }
......
762 751
        }
763 752
    }
764 753

  
765
    @Override
766 754
    public boolean canWriteGeometry(int gvSIGgeometryType) {
767 755
        for (int i = 0; i < supportedGeometryTypes.length; i++) {
768 756
            if (gvSIGgeometryType == supportedGeometryTypes[i]) {

Also available in: Unified diff