Skip to content

Commit

Permalink
add test case for project in EPSG:4314
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeijerdfki committed Oct 6, 2024
1 parent 9c6acae commit cb7ed5b
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def project_setup(grpc_channel) -> Generator[Tuple[str, str], None, None]:


# NOTE: This fixture depends on working project creation and deletion
# this uses some example coordinates
@pytest.fixture
def epsg4326_project_setup(grpc_channel) -> Generator[str, None, None]:
fb_builder = flatbuffers.Builder()
Expand All @@ -88,3 +87,26 @@ def epsg4326_project_setup(grpc_channel) -> Generator[str, None, None]:
fb_helper.deleteProject(
grpc_channel, flatbuffers.Builder(), project_name, project_uuid
)


# NOTE: This fixture depends on working project creation and deletion
@pytest.fixture
def epsg4314_project_setup(grpc_channel) -> Generator[str, None, None]:
fb_builder = flatbuffers.Builder()
project_name = "geodeticProject"
project_uuid = fb_helper.createProject(
grpc_channel,
fb_builder,
project_name,
"map",
"EPSG:4314",
altitude=0,
latitude=52.35_96_109,
longitude=8.28_06_335,
)

yield project_uuid

fb_helper.deleteProject(
grpc_channel, flatbuffers.Builder(), project_name, project_uuid
)
75 changes: 75 additions & 0 deletions tests/python/gRPC/instances/test_gRPC_fb_getInstances.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,3 +769,78 @@ def test_gRPC_getInstanceQueryCrsStringEPSG3857(
)

assert instance_uuids_polygon == sorted(label_instances)


def test_gRPC_getInstanceQueryProjectEPSG4314(
grpc_channel, epsg4314_project_setup
):
proj_uuid = epsg4314_project_setup
serv_man = ServiceManager(grpc_channel)

camera_uuid = send_imgs_fb.send_cameraintrinsics(grpc_channel, proj_uuid)

timestamp_nanos = 1245
timestamps = [
(t, timestamp_nanos) for t in range(1661336507, 1661336606, 10)
]

img_bufs = send_imgs_fb.send_images(
grpc_channel,
proj_uuid,
camera_uuid,
send_imgs_fb.generate_image_ressources(10),
timestamps,
)

send_imgs_fb.send_tfs(grpc_channel, proj_uuid, timestamps)

# extract the sent images
images = [Image.Image.GetRootAs(img) for img in img_bufs]

timestamp_sorted_imgs = sorted(
images, key=lambda img: combine_stamps_nanos_fb(img)
)
timestamp_thresh_imgs = [timestamp_sorted_imgs[1]]

# retrieve the labelinstances of the bounding boxes
label_instances = get_instances_from_imgs_fb(timestamp_thresh_imgs)

query_builder = FbQuery(
grpc_channel,
enum_types={
EnumFbQuery.POLYGON,
EnumFbQuery.CRS_STRING,
EnumFbQuery.FULLY_ENCAPSULATED,
EnumFbQuery.WITHOUTDATA,
},
)

query_builder.set_active_function(
EnumFbQuery.CRS_STRING, lambda: "EPSG:3857"
)

query_builder.set_active_function(
EnumFbQuery.POLYGON,
lambda: Dtypes.Fb.polgon_epsg3857(query_builder.builder),
)

query_builder.assemble_datatype_instance()

queryinst_builder = FbQueryInstance(
grpc_channel, enum_types={EnumFbQueryInstance.QUERY}
)

queryinst_builder.set_active_function(
EnumFbQueryInstance.QUERY, lambda: query_builder.datatype_instance
)

queryinst_builder.assemble_datatype_instance()

instance_uuids_polygon = get_sorted_uuids_per_proj(
serv_man.call_get_instances_fb(
queryinst_builder.builder, queryinst_builder.datatype_instance
)
)

print(instance_uuids_polygon)
assert instance_uuids_polygon == sorted(label_instances)

0 comments on commit cb7ed5b

Please sign in to comment.