Revision 38891 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/impl/DrawGeneralPathXIterator.java

View differences:

DrawGeneralPathXIterator.java
83 83
        if (numTypes > 0) {
84 84
            currentType = path.getTypeAt(typeIdx);
85 85
            readCurrentSegmentCoordsAsInt();
86
            previousType = currentType;
87
            previousPointCoords[0] = currentPointCoords[0];
88
            previousPointCoords[1] = currentPointCoords[1];
86 89
        }
87 90
    }
88 91

  
......
91 94
    }
92 95

  
93 96
    public boolean isDone() {
94
        return typeIdx >= numTypes || pointIdx >= numPoints;
97
        return typeIdx >= numTypes;
95 98
    }
96 99

  
97 100
    public void next() {
98
        typeIdx++;
99
        pointIdx += curvesize[currentType];
100
        if (!isDone()) {
101
            currentType = path.getTypeAt(typeIdx);
102
            if (SEG_CLOSE != currentType) {
103
                readCurrentSegmentCoordsAsInt();
104
                if (isSameSegment()) {
105
                    next();
106
                } else {
107
                    previousType = currentType;
108
                    previousPointCoords[0] = currentPointCoords[0];
109
                    previousPointCoords[1] = currentPointCoords[1];
101
        do {
102
            typeIdx++;
103
            pointIdx += curvesize[currentType];
104
            if (typeIdx < numTypes) {
105
                currentType = path.getTypeAt(typeIdx);
106
                if (SEG_CLOSE != currentType) {
107
                    readCurrentSegmentCoordsAsInt();
110 108
                }
109
            } else {
110
                // We have reached past the last segment
111
                return;
111 112
            }
112
        }
113
        } while (isSameSegment());
114

  
115
        previousType = currentType;
116
        previousPointCoords[0] = currentPointCoords[0];
117
        previousPointCoords[1] = currentPointCoords[1];
113 118
    }
114 119

  
115
    private boolean isSameSegment() {
120
    private final boolean isSameSegment() {
116 121
        return SEG_LINETO == currentType
117 122
            && (SEG_LINETO == previousType || SEG_MOVETO == previousType)
118 123
            && currentPointCoords[0] == previousPointCoords[0]

Also available in: Unified diff