1
2
3
4
5
6
7
8
9 package org.locationtech.spatial4j.io;
10
11 import org.locationtech.spatial4j.shape.Point;
12 import org.locationtech.spatial4j.shape.ShapeFactory;
13
14
15 public class OnePointsBuilder implements ShapeFactory.PointsBuilder<OnePointsBuilder> {
16 private ShapeFactory shapeFactory;
17 private Point point;
18
19 public OnePointsBuilder(ShapeFactory shapeFactory) {
20 this.shapeFactory = shapeFactory;
21 }
22
23 @Override
24 public OnePointsBuilder pointXY(double x, double y) {
25 assert point == null;
26 point = shapeFactory.pointXY(x, y);
27 return this;
28 }
29
30 @Override
31 public OnePointsBuilder pointXYZ(double x, double y, double z) {
32 assert point == null;
33 point = shapeFactory.pointXYZ(x, y, z);
34 return this;
35 }
36
37 @Override
38 public OnePointsBuilder pointLatLon(double latitude, double longitude) {
39 assert point == null;
40 point = shapeFactory.pointLatLon(latitude, longitude);
41 return this;
42 }
43
44 public Point getPoint() {
45 return point;
46 }
47 }