Ejemplo n.º 1
0
def packet_from_point(feat, id_=None):
    name = feat.get("name",
                    "point_{}".format(id_) if id_ is not None else "point_0")
    description = feat.get("description", name)
    color = get_color(feat.get("color", 0xff0000))
    point = feat.get_shape(WGS84_CRS)

    return Packet(
        id=id_,
        name=name,
        description=description,
        point=Point(color=color, pixelSize=5),
        position=Position(
            # this assumes 0 elevation for all points
            cartographicDegrees=[point.x, point.y, 0]),
    )
Ejemplo n.º 2
0
def test_packet_point():
    expected_result = """{
    "id": "id_00",
    "point": {
        "color": {
            "rgba": [
                255,
                0,
                0,
                255
            ]
        }
    }
}"""
    packet = Packet(id="id_00", point=Point(color=Color.from_list([255, 0, 0, 255])))

    assert repr(packet) == expected_result
Ejemplo n.º 3
0
def test_point():
    expected_result = """{
    "show": true,
    "pixelSize": 10,
    "scaleByDistance": {
        "nearFarScalar": [
            150,
            2.0,
            15000000,
            0.5
        ]
    },
    "disableDepthTestDistance": 1.2
}"""

    pnt = Point(
        show=True,
        pixelSize=10,
        scaleByDistance=NearFarScalar(nearFarScalar=NearFarScalarValue(
            values=[150, 2.0, 15000000, 0.5])),
        disableDepthTestDistance=1.2,
    )
    assert repr(pnt) == expected_result