本文整理汇总了Java中org.postgis.LinearRing类的典型用法代码示例。如果您正苦于以下问题:Java LinearRing类的具体用法?Java LinearRing怎么用?Java LinearRing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearRing类属于org.postgis包,在下文中一共展示了LinearRing类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reverseMap
import org.postgis.LinearRing; //导入依赖的package包/类
@Override
public Map<String, Object> reverseMap(List<LatLng> latLngs, Action action) {
Point[] points = new Point[latLngs.size() + 1]; //+1 to close the ring
List<LatLng> path = latLngs;
for (int i = 0; i < path.size(); i++) {
LatLng latLng = path.get(i);
points[i] = new Point(latLng.getLng(), latLng.getLat());
}
//close the ring
points[points.length - 1] = points[0];
Polygon polygon = new Polygon(new LinearRing[]{new LinearRing(points)});
polygon.setSrid(Mappers.WGS84_SRID);
Map<String, Object> params = new HashMap<>(1);
params.put(colName, new PGgeometry(polygon));
return params;
}
开发者ID:vramirez122000,项目名称:trenurbanoapp,代码行数:17,代码来源:PolygonMapper.java
示例2: testBulkWithinPolygon
import org.postgis.LinearRing; //导入依赖的package包/类
@Test
public void testBulkWithinPolygon() throws SQLException {
LinearRing linearRing1 = new LinearRing("0 0, 1 1, 1 2, 1 1, 0 0");
Polygon polygon1 = new Polygon(new LinearRing[]{linearRing1});
LinearRing linearRing2 = new LinearRing("1 1, 1 1, 1 2, 1 1, 1 1");
Polygon polygon2 = new Polygon(new LinearRing[]{linearRing2});
LinearRing linearRing3 = new LinearRing("2 2, 1 1, 1 2, 1 1, 2 2");
Polygon polygon3 = new Polygon(new LinearRing[]{linearRing3});
LinearRing linearRing4 = new LinearRing("1 3, 1 2, 2 2, 1 1, 1 3");
Polygon polygon4 = new Polygon(new LinearRing[]{linearRing4});
Vertex v1 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon1);
Vertex v2 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon2);
Vertex v3 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon3);
Vertex v4 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon4);
this.sqlgGraph.tx().commit();
List<Vertex> vertices = this.sqlgGraph.traversal().V().hasLabel("Gis").has("polygon", P.within(polygon1, polygon3, polygon4)).toList();
Assert.assertEquals(3, vertices.size());
Assert.assertTrue(Arrays.asList(v1, v3, v4).containsAll(vertices));
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:21,代码来源:TestGisBulkWithin.java
示例3: testBulkWithinGeographyPolygon
import org.postgis.LinearRing; //导入依赖的package包/类
@Test
public void testBulkWithinGeographyPolygon() throws SQLException {
LinearRing linearRing1 = new LinearRing("0 0, 1 1, 1 2, 1 1, 0 0");
GeographyPolygon polygon1 = new GeographyPolygon(new LinearRing[]{linearRing1});
LinearRing linearRing2 = new LinearRing("1 1, 1 1, 1 2, 1 1, 1 1");
GeographyPolygon polygon2 = new GeographyPolygon(new LinearRing[]{linearRing2});
LinearRing linearRing3 = new LinearRing("2 2, 1 1, 1 2, 1 1, 2 2");
GeographyPolygon polygon3 = new GeographyPolygon(new LinearRing[]{linearRing3});
LinearRing linearRing4 = new LinearRing("1 3, 1 2, 2 2, 1 1, 1 3");
GeographyPolygon polygon4 = new GeographyPolygon(new LinearRing[]{linearRing4});
Vertex v1 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon1);
Vertex v2 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon2);
Vertex v3 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon3);
Vertex v4 = this.sqlgGraph.addVertex(T.label, "Gis", "polygon", polygon4);
this.sqlgGraph.tx().commit();
List<Vertex> vertices = this.sqlgGraph.traversal().V().hasLabel("Gis").has("polygon", P.within(polygon1, polygon3, polygon4)).toList();
Assert.assertEquals(3, vertices.size());
Assert.assertTrue(Arrays.asList(v1, v3, v4).containsAll(vertices));
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:21,代码来源:TestGisBulkWithin.java
示例4: before
import org.postgis.LinearRing; //导入依赖的package包/类
@Before
public void before() {
table = "test_polygon";
Point[] points = new Point[5];
points[0] = new Point(123.45d, 23.45d);
points[1] = new Point(124.45d, 23.45d);
points[2] = new Point(124.45d, 24.45d);
points[3] = new Point(123.45d, 24.45d);
points[4] = new Point(123.45d, 23.45d);
LinearRing linearRing = new LinearRing(points);
t = new Polygon(new LinearRing[]{linearRing});
t.setSrid(SRID);
}
开发者ID:eyougo,项目名称:mybatis-typehandlers-postgis,代码行数:15,代码来源:PolygonTypeHandlerTest.java
示例5: GeographyPolygon
import org.postgis.LinearRing; //导入依赖的package包/类
public GeographyPolygon(LinearRing[] rings) {
super(rings);
this.srid = Gis.SRID;
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:5,代码来源:GeographyPolygon.java
注:本文中的org.postgis.LinearRing类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论