Revision 28857

View differences:

branches/v2_0_0_prep/extensions/extEditing/src/com/iver/cit/gvsig/gui/cad/tools/split/SplitGraph.java
1 1
/* Spatial Operations & Editing Tools for uDig
2
 * 
3
 * Axios Engineering under a funding contract with: 
4
 *      Diputación Foral de Gipuzkoa, Ordenación Territorial 
5 2
 *
3
 * Axios Engineering under a funding contract with:
4
 *      Diputación Foral de Gipuzkoa, Ordenación Territorial
5
 *
6 6
 *      http://b5m.gipuzkoa.net
7
 *      http://www.axios.es 
7
 *      http://www.axios.es
8 8
 *
9
 * (C) 2006, Diputación Foral de Gipuzkoa, Ordenación Territorial (DFG-OT). 
9
 * (C) 2006, Diputación Foral de Gipuzkoa, Ordenación Territorial (DFG-OT).
10 10
 * DFG-OT agrees to licence under Lesser General Public License (LGPL).
11
 * 
12
 * You can redistribute it and/or modify it under the terms of the 
13
 * GNU Lesser General Public License as published by the Free Software 
11
 *
12
 * You can redistribute it and/or modify it under the terms of the
13
 * GNU Lesser General Public License as published by the Free Software
14 14
 * Foundation; version 2.1 of the License.
15 15
 *
16 16
 * This library is distributed in the hope that it will be useful,
......
23 23
import java.util.ArrayList;
24 24
import java.util.List;
25 25

  
26
import org.slf4j.Logger;
27
import org.slf4j.LoggerFactory;
28

  
26 29
import com.vividsolutions.jts.geom.Coordinate;
27 30
import com.vividsolutions.jts.geom.CoordinateArrays;
28 31
import com.vividsolutions.jts.geom.Geometry;
......
58 61
 * which is called in order to ensure propper orientation of the shell and holes.
59 62
 * </p>
60 63
 * </p>
61
 * 
64
 *
62 65
 * @author Gabriel Roldán, Axios Engineering
63 66
 * @author Mauricio Pazos, Axios Engineering
64 67
 * @since 1.1.0
......
108 111

  
109 112
    /**
110 113
     * Removes the given edge and its related {@link DirectedEdge}'s from this graph
111
     * 
114
     *
112 115
     * @param edge the edge to remove
113 116
     * @throws IllegalArgumentException if no enclosing DirectedEdge is found for <code>edge</code>
114 117
     * @see #remove(DirectedEdge)
......
124 127
    /**
125 128
     * Removes a DirectedEdge, its sym and its {@link SplitEdge} from this graph. May lead to the
126 129
     * graph containing dangling nodes.
127
     * 
130
     *
128 131
     * @param edgeEnd
129 132
     */
130 133
    public void remove( final DirectedEdge edgeEnd ) {
......
150 153

  
151 154
    /**
152 155
     * Builds a linestrnig from splitter such that it contains no endpoints lying inside the polygon
153
     * 
156
     *
154 157
     * @param polygon
155 158
     * @param splitter
156 159
     * @return
......
188 191
    /**
189 192
     * <pre>
190 193
     * <code>
191
     *                             
194
     *
192 195
     *                  +----------o-----------+
193 196
     *                  |          |           |
194 197
     *                  |          |           |
......
199 202
     *                  |    o__\__o_____|     |
200 203
     *                  |       /  |           |
201 204
     *                 /|\        /|\          |
202
     *                  o__________o___________| 
203
     *                                        
204
     *                             
205
     *                  o__________o___________|
206
     *
207
     *
205 208
     * </code>
206 209
     * </pre>
207
     * 
210
     *
208 211
     * @throws Exception
209 212
     */
210 213
    private void buildGraph() {
......
239 242
        for( int i = 0; i < nParts; i++ ) {
240 243
            currGeom = linearGeom.getGeometryN(i);
241 244
            coords = currGeom.getCoordinates();
245
            if (coords.length<2)
246
            	continue;
242 247
            Label label = new Label(onLoc, leftLoc, rightLoc);
243 248
            Edge edge = new SplitEdge(coords, label);
244 249
            edges.add(edge);
245 250
        }
246 251
        // for each edge in the list, adds two DirectedEdge, one reflecting
247 252
        // the given edge and other the opposite
248
        super.addEdges(edges);
253
        try{
254
        	super.addEdges(edges);
255
        }catch (Exception e) {
256
			LoggerFactory.getLogger(this.getClass()).error(e.getLocalizedMessage(),e);
257
		}
249 258
    }
250 259

  
251 260
}

Also available in: Unified diff