当前位置: 首页>>代码示例>>Java>>正文


Java LineStringBuilder类代码示例

本文整理汇总了Java中org.elasticsearch.common.geo.builders.LineStringBuilder的典型用法代码示例。如果您正苦于以下问题:Java LineStringBuilder类的具体用法?Java LineStringBuilder怎么用?Java LineStringBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LineStringBuilder类属于org.elasticsearch.common.geo.builders包,在下文中一共展示了LineStringBuilder类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testShapeWithHoleAtEdgeEndPoints

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testShapeWithHoleAtEdgeEndPoints() {
   PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
           .coordinate(-4, 2)
           .coordinate(4, 2)
           .coordinate(6, 0)
           .coordinate(4, -2)
           .coordinate(-4, -2)
           .coordinate(-6, 0)
           .coordinate(-4, 2)
           );

   builder.hole(new LineStringBuilder(new CoordinatesBuilder()
       .coordinate(4, 1)
       .coordinate(4, -1)
       .coordinate(-4, -1)
       .coordinate(-4, 1)
       .coordinate(4, 1)
       ));

   Shape shape = builder.close().build();
   assertPolygon(shape);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:ShapeBuilderTests.java

示例2: testShapeWithTangentialHole

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testShapeWithTangentialHole() {
    // test a shape with one tangential (shared) vertex (should pass)
    PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
            .coordinate(179, 10)
            .coordinate(168, 15)
            .coordinate(164, 0)
            .coordinate(166, -15)
            .coordinate(179, -10)
            .coordinate(179, 10)
            );
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(-177, 10)
            .coordinate(-178, -10)
            .coordinate(-180, -5)
            .coordinate(-180, 5)
            .coordinate(-177, 10)
            ));
    Shape shape = builder.close().build();
    assertMultiPolygon(shape);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:ShapeBuilderTests.java

示例3: testShapeWithInvalidTangentialHole

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testShapeWithInvalidTangentialHole() {
    // test a shape with one invalid tangential (shared) vertex (should throw exception)
    PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
            .coordinate(179, 10)
            .coordinate(168, 15)
            .coordinate(164, 0)
            .coordinate(166, -15)
            .coordinate(179, -10)
            .coordinate(179, 10)
            );
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(164, 0)
            .coordinate(175, 10)
            .coordinate(175, 5)
            .coordinate(179, -10)
            .coordinate(164, 0)
            ));
    Exception e = expectThrows(InvalidShapeException.class, () -> builder.close().build());
    assertThat(e.getMessage(), containsString("interior cannot share more than one point with the exterior"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:ShapeBuilderTests.java

示例4: testBoundaryShapeWithTangentialHole

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testBoundaryShapeWithTangentialHole() {
    // test a shape with one tangential (shared) vertex for each hole (should pass)
    PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
            .coordinate(-177, 10)
            .coordinate(176, 15)
            .coordinate(172, 0)
            .coordinate(176, -15)
            .coordinate(-177, -10)
            .coordinate(-177, 10)
            );
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(-177, 10)
            .coordinate(-178, -10)
            .coordinate(-180, -5)
            .coordinate(-180, 5)
            .coordinate(-177, 10)
            ));
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(172, 0)
            .coordinate(176, 10)
            .coordinate(176, -5)
            .coordinate(172, 0)
            ));
    Shape shape = builder.close().build();
    assertMultiPolygon(shape);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:ShapeBuilderTests.java

示例5: testBoundaryShapeWithInvalidTangentialHole

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testBoundaryShapeWithInvalidTangentialHole() {
    // test shape with two tangential (shared) vertices (should throw exception)
    PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
            .coordinate(-177, 10)
            .coordinate(176, 15)
            .coordinate(172, 0)
            .coordinate(176, -15)
            .coordinate(-177, -10)
            .coordinate(-177, 10)
            );
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(-177, 10)
            .coordinate(172, 0)
            .coordinate(180, -5)
            .coordinate(176, -10)
            .coordinate(-177, 10)
            ));
    Exception e = expectThrows(InvalidShapeException.class, () -> builder.close().build());
    assertThat(e.getMessage(), containsString("interior cannot share more than one point with the exterior"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:ShapeBuilderTests.java

示例6: testReusableBuilder

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testReusableBuilder() throws IOException {
    ShapeBuilder polygon = ShapeBuilders.newPolygon(new CoordinatesBuilder()
            .coordinate(170, -10).coordinate(190, -10).coordinate(190, 10).coordinate(170, 10).close())
            .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(175, -5).coordinate(185, -5).coordinate(185, 5).coordinate(175, 5).close()));
    assertUnmodified(polygon);

    ShapeBuilder linestring = ShapeBuilders.newLineString(new CoordinatesBuilder()
            .coordinate(170, -10).coordinate(190, -10).coordinate(190, 10).coordinate(170, 10).close());
    assertUnmodified(linestring);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:GeoShapeQueryTests.java

示例7: testMultiLineString

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testMultiLineString() {
    ShapeBuilders.newMultiLinestring()
        .linestring(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(-100.0, 50.0)
            .coordinate(50.0, 50.0)
            .coordinate(50.0, 20.0)
            .coordinate(-100.0, 20.0)
            )
        )
        .linestring(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(-100.0, 20.0)
            .coordinate(50.0, 20.0)
            .coordinate(50.0, 0.0)
            .coordinate(-100.0, 0.0)
            )
        )
        .build();

    // LineString that needs to be wrapped
    ShapeBuilders.newMultiLinestring()
        .linestring(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(150.0, 60.0)
            .coordinate(200.0, 60.0)
            .coordinate(200.0, 40.0)
            .coordinate(150.0,  40.0)
            )
            )
        .linestring(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(150.0, 20.0)
            .coordinate(200.0, 20.0)
            .coordinate(200.0, 0.0)
            .coordinate(150.0, 0.0)
            )
            )
        .build();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:37,代码来源:ShapeBuilderTests.java

示例8: testDatelineOGC

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testDatelineOGC() {
    // tests that the following shape (defined in counterclockwise OGC order)
    // https://gist.github.com/anonymous/7f1bb6d7e9cd72f5977c crosses the dateline
    // expected results: 3 polygons, 1 with a hole

    // a giant c shape
    PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
        .coordinate(174,0)
        .coordinate(-176,0)
        .coordinate(-176,3)
        .coordinate(177,3)
        .coordinate(177,5)
        .coordinate(-176,5)
        .coordinate(-176,8)
        .coordinate(174,8)
        .coordinate(174,0)
        );

    // 3/4 of an embedded 'c', crossing dateline once
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
        .coordinate(175, 1)
        .coordinate(175, 7)
        .coordinate(-178, 7)
        .coordinate(-178, 6)
        .coordinate(176, 6)
        .coordinate(176, 2)
        .coordinate(179, 2)
        .coordinate(179,1)
        .coordinate(175, 1)
        ));

    // embedded hole right of the dateline
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
        .coordinate(-179, 1)
        .coordinate(-179, 2)
        .coordinate(-177, 2)
        .coordinate(-177,1)
        .coordinate(-179,1)
        ));

    Shape shape = builder.close().build();
    assertMultiPolygon(shape);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:44,代码来源:ShapeBuilderTests.java

示例9: testDateline

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testDateline() {
    // tests that the following shape (defined in clockwise non-OGC order)
    // https://gist.github.com/anonymous/7f1bb6d7e9cd72f5977c crosses the dateline
    // expected results: 3 polygons, 1 with a hole

    // a giant c shape
    PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
            .coordinate(-186,0)
            .coordinate(-176,0)
            .coordinate(-176,3)
            .coordinate(-183,3)
            .coordinate(-183,5)
            .coordinate(-176,5)
            .coordinate(-176,8)
            .coordinate(-186,8)
            .coordinate(-186,0)
            );

    // 3/4 of an embedded 'c', crossing dateline once
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(-185,1)
            .coordinate(-181,1)
            .coordinate(-181,2)
            .coordinate(-184,2)
            .coordinate(-184,6)
            .coordinate(-178,6)
            .coordinate(-178,7)
            .coordinate(-185,7)
            .coordinate(-185,1)
            ));

    // embedded hole right of the dateline
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(-179,1)
            .coordinate(-177,1)
            .coordinate(-177,2)
            .coordinate(-179,2)
            .coordinate(-179,1)
            ));

    Shape shape = builder.close().build();
    assertMultiPolygon(shape);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:44,代码来源:ShapeBuilderTests.java

示例10: testComplexShapeWithHole

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testComplexShapeWithHole() {
   PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
       .coordinate(-85.0018514,37.1311314)
       .coordinate(-85.0016645,37.1315293)
       .coordinate(-85.0016246,37.1317069)
       .coordinate(-85.0016526,37.1318183)
       .coordinate(-85.0017119,37.1319196)
       .coordinate(-85.0019371,37.1321182)
       .coordinate(-85.0019972,37.1322115)
       .coordinate(-85.0019942,37.1323234)
       .coordinate(-85.0019543,37.1324336)
       .coordinate(-85.001906,37.1324985)
       .coordinate(-85.001834,37.1325497)
       .coordinate(-85.0016965,37.1325907)
       .coordinate(-85.0016011,37.1325873)
       .coordinate(-85.0014816,37.1325353)
       .coordinate(-85.0011755,37.1323509)
       .coordinate(-85.000955,37.1322802)
       .coordinate(-85.0006241,37.1322529)
       .coordinate(-85.0000002,37.1322307)
       .coordinate(-84.9994,37.1323001)
       .coordinate(-84.999109,37.1322864)
       .coordinate(-84.998934,37.1322415)
       .coordinate(-84.9988639,37.1321888)
       .coordinate(-84.9987841,37.1320944)
       .coordinate(-84.9987208,37.131954)
       .coordinate(-84.998736,37.1316611)
       .coordinate(-84.9988091,37.131334)
       .coordinate(-84.9989283,37.1311337)
       .coordinate(-84.9991943,37.1309198)
       .coordinate(-84.9993573,37.1308459)
       .coordinate(-84.9995888,37.1307924)
       .coordinate(-84.9998746,37.130806)
       .coordinate(-85.0000002,37.1308358)
       .coordinate(-85.0004984,37.1310658)
       .coordinate(-85.0008008,37.1311625)
       .coordinate(-85.0009461,37.1311684)
       .coordinate(-85.0011373,37.1311515)
       .coordinate(-85.0016455,37.1310491)
       .coordinate(-85.0018514,37.1311314)
       );

   builder.hole(new LineStringBuilder(new CoordinatesBuilder()
       .coordinate(-85.0000002,37.1317672)
       .coordinate(-85.0001983,37.1317538)
       .coordinate(-85.0003378,37.1317582)
       .coordinate(-85.0004697,37.131792)
       .coordinate(-85.0008048,37.1319439)
       .coordinate(-85.0009342,37.1319838)
       .coordinate(-85.0010184,37.1319463)
       .coordinate(-85.0010618,37.13184)
       .coordinate(-85.0010057,37.1315102)
       .coordinate(-85.000977,37.1314403)
       .coordinate(-85.0009182,37.1313793)
       .coordinate(-85.0005366,37.1312209)
       .coordinate(-85.000224,37.1311466)
       .coordinate(-85.000087,37.1311356)
       .coordinate(-85.0000002,37.1311433)
       .coordinate(-84.9995021,37.1312336)
       .coordinate(-84.9993308,37.1312859)
       .coordinate(-84.9992567,37.1313252)
       .coordinate(-84.9991868,37.1314277)
       .coordinate(-84.9991593,37.1315381)
       .coordinate(-84.9991841,37.1316527)
       .coordinate(-84.9992329,37.1317117)
       .coordinate(-84.9993527,37.1317788)
       .coordinate(-84.9994931,37.1318061)
       .coordinate(-84.9996815,37.1317979)
       .coordinate(-85.0000002,37.1317672)
       )
       );

   Shape shape = builder.close().build();
   assertPolygon(shape);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:76,代码来源:ShapeBuilderTests.java

示例11: testShapeWithBoundaryHoles

import org.elasticsearch.common.geo.builders.LineStringBuilder; //导入依赖的package包/类
public void testShapeWithBoundaryHoles() {
    // test case 1: test the positive side of the dateline
    PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder()
            .coordinate(-177, 10)
            .coordinate(176, 15)
            .coordinate(172, 0)
            .coordinate(176, -15)
            .coordinate(-177, -10)
            .coordinate(-177, 10)
            );
    builder.hole(new LineStringBuilder(new CoordinatesBuilder()
            .coordinate(176, 10)
            .coordinate(180, 5)
            .coordinate(180, -5)
            .coordinate(176, -10)
            .coordinate(176, 10)
            ));
    Shape shape = builder.close().build();
    assertMultiPolygon(shape);

    // test case 2: test the negative side of the dateline
    builder = ShapeBuilders.newPolygon(
            new CoordinatesBuilder()
            .coordinate(-176, 15)
            .coordinate(179, 10)
            .coordinate(179, -10)
            .coordinate(-176, -15)
            .coordinate(-172, 0)
            .close()
            );
    builder.hole(new LineStringBuilder(
            new CoordinatesBuilder()
            .coordinate(-176, 10)
            .coordinate(-176, -10)
            .coordinate(-180, -5)
            .coordinate(-180, 5)
            .coordinate(-176, 10)
            .close()
            ));
    shape = builder.close().build();
    assertMultiPolygon(shape);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:43,代码来源:ShapeBuilderTests.java


注:本文中的org.elasticsearch.common.geo.builders.LineStringBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。