@@ -273,10 +273,25 @@ public void addPointOnGeometry(boolean isA, int locTarget, int dimTarget, Coordi
273
273
throw new IllegalStateException ("Unknown target dimension: " + dimTarget );
274
274
}
275
275
276
+ /**
277
+ * Add topology for a line end.
278
+ * The line end point must be "significant";
279
+ * i.e. not contained in an area if the source is a mixed-dimension GC.
280
+ *
281
+ * @param isLineA the input containing the line end
282
+ * @param locLineEnd the location of the line end (Interior or Boundary)
283
+ * @param locTarget the location on the target geometry
284
+ * @param dimTarget the dimension of the interacting target geometry element,
285
+ * (if any), or the dimension of the target
286
+ * @param pt the line end coordinate
287
+ */
276
288
public void addLineEndOnGeometry (boolean isLineA , int locLineEnd , int locTarget , int dimTarget , Coordinate pt ) {
289
+ //-- record topology at line end point
290
+ updateDim (isLineA , locLineEnd , locTarget , Dimension .P );
291
+
292
+ //-- Line and Area targets may have additional topology
277
293
switch (dimTarget ) {
278
294
case Dimension .P :
279
- addLineEndOnPoint (isLineA , locLineEnd , locTarget , pt );
280
295
return ;
281
296
case Dimension .L :
282
297
addLineEndOnLine (isLineA , locLineEnd , locTarget , pt );
@@ -287,32 +302,30 @@ public void addLineEndOnGeometry(boolean isLineA, int locLineEnd, int locTarget,
287
302
}
288
303
throw new IllegalStateException ("Unknown target dimension: " + dimTarget );
289
304
}
290
-
291
- private void addLineEndOnPoint (boolean isLineA , int locLineEnd , int locPoint , Coordinate pt ) {
292
- updateDim (isLineA , locLineEnd , locPoint , Dimension .P );
293
- }
294
305
295
306
private void addLineEndOnLine (boolean isLineA , int locLineEnd , int locLine , Coordinate pt ) {
296
- updateDim (isLineA , locLineEnd , locLine , Dimension .P );
297
307
/**
298
- * When a line end is in the exterior, some length of the line interior
299
- * must also be in the exterior.
308
+ * When a line end is in the EXTERIOR of a Line,
309
+ * some length of the source Line INTERIOR
310
+ * is also in the target Line EXTERIOR.
300
311
* This works for zero-length lines as well.
301
312
*/
302
-
303
313
if (locLine == Location .EXTERIOR ) {
304
314
updateDim (isLineA , Location .INTERIOR , Location .EXTERIOR , Dimension .L );
305
315
}
306
- }
316
+ }
307
317
308
318
private void addLineEndOnArea (boolean isLineA , int locLineEnd , int locArea , Coordinate pt ) {
309
- if (locArea == Location .BOUNDARY ) {
310
- updateDim (isLineA , locLineEnd , locArea , Dimension .P );
311
- }
312
- else {
319
+ if (locArea != Location .BOUNDARY ) {
320
+ /**
321
+ * When a line end is in an Area INTERIOR or EXTERIOR
322
+ * some length of the source Line Interior
323
+ * AND the Exterior of the line
324
+ * is also in that location of the target.
325
+ * NOTE: this assumes the line end is NOT also in an Area of a mixed-dim GC
326
+ */
313
327
//TODO: handle zero-length lines?
314
328
updateDim (isLineA , Location .INTERIOR , locArea , Dimension .L );
315
- updateDim (isLineA , locLineEnd , locArea , Dimension .P );
316
329
updateDim (isLineA , Location .EXTERIOR , locArea , Dimension .A );
317
330
}
318
331
}
0 commit comments