Пример #1
0
def glc_annotation(rect, coords, single, missing):
    glc = layers.GeonotebookLayerCollection([
        layers.DataLayer('rect', None, rect, vis_url='vis'),
        layers.DataLayer('coords', None, coords, vis_url='vis'),
        layers.DataLayer('single', None, single, vis_url='vis'),
        layers.DataLayer('missing', None, missing, vis_url='vis')])

    glc.append(layers.AnnotationLayer(
        'annotation', None, glc, expose_as="annotation", system_layer=True))

    return glc
Пример #2
0
def test_layer_reprs(visserver):
    assert str(layers.GeonotebookLayer('gnbl', None, None)) == \
        "<GeonotebookLayer('gnbl')>"
    assert str(layers.AnnotationLayer('al', None, None)) == \
        "<AnnotationLayer('al')>"
    assert str(layers.NoDataLayer('ndl', None, None)) == "<NoDataLayer('ndl')>"
    assert str(layers.DataLayer('dl', None, None, vis_url='bogus')) == \
        "<DataLayer('dl')>"
    assert str(layers.SimpleLayer('sl', None, None, vis_url='bogus')) == \
        "<SimpleLayer('sl')>"
    assert str(
        layers.TimeSeriesLayer('tsl', None, [RDMock(name='bogus_data')])
    ) == \
        "<TimeSeriesLayer('tsl')>"
Пример #3
0
def test_annotation_layer_add_bad_annotation(poly_coords):
    al = layers.AnnotationLayer('al', None, None)
    with pytest.raises(RuntimeError):
        al.add_annotation('badtype', poly_coords, {})
Пример #4
0
def test_annotation_layer_add_poly_annotation(poly_coords):
    al = layers.AnnotationLayer('al', None, None)
    al.add_annotation('polygon', poly_coords, {})
    assert len(al.polygons) == 1
    assert al.polygons[0].layer == al
    assert len(al.polygons[0].exterior.coords) == 7
Пример #5
0
def test_annotation_layer_add_rect_annotation(rect_coords):
    al = layers.AnnotationLayer('al', None, None)
    al.add_annotation('rectangle', rect_coords, {})
    assert len(al.rectangles) == 1
    assert al.rectangles[0].layer == al
    assert len(al.rectangles[0].exterior.coords) == 5
Пример #6
0
def test_annotation_layer_add_point_annotation(point_coords):
    al = layers.AnnotationLayer('al', None, None)
    al.add_annotation('point', point_coords, {})
    assert len(al.points) == 1
    assert al.points[0].layer == al
    assert len(al.points[0].coords) == 1