load("//tools/lint:lint.bzl", "add_lint_tests")
load(
    "//tools/skylark:drake_cc.bzl",
    "drake_cc_googletest",
    "drake_cc_library",
    "drake_cc_package_library",
)

package(default_visibility = ["//visibility:public"])

drake_cc_package_library(
    name = "visualization",
    visibility = ["//visibility:public"],
    deps = [
        ":colorize_depth_image",
        ":colorize_label_image",
        ":concatenate_images",
        ":inertia_visualizer",
        ":meshcat_pose_sliders",
        ":visualization_config",
        ":visualization_config_functions",
    ],
)

drake_cc_library(
    name = "colorize_depth_image",
    srcs = ["colorize_depth_image.cc"],
    hdrs = ["colorize_depth_image.h"],
    deps = [
        "//geometry:rgba",
        "//systems/framework",
        "//systems/sensors:image",
    ],
)

drake_cc_library(
    name = "colorize_label_image",
    srcs = ["colorize_label_image.cc"],
    hdrs = ["colorize_label_image.h"],
    deps = [
        "//geometry:rgba",
        "//geometry/render",
        "//systems/framework",
        "//systems/sensors:image",
    ],
)

drake_cc_library(
    name = "concatenate_images",
    srcs = ["concatenate_images.cc"],
    hdrs = ["concatenate_images.h"],
    deps = [
        "//systems/framework",
        "//systems/sensors:image",
    ],
)

drake_cc_library(
    name = "inertia_visualizer",
    srcs = ["inertia_visualizer.cc"],
    hdrs = ["inertia_visualizer.h"],
    deps = [
        "//multibody/plant",
        "//systems/framework:diagram_builder",
        "//systems/framework:leaf_system",
    ],
)

drake_cc_library(
    name = "meshcat_pose_sliders",
    srcs = ["meshcat_pose_sliders.cc"],
    hdrs = ["meshcat_pose_sliders.h"],
    deps = [
        "//common:scope_exit",
        "//geometry:meshcat",
        "//geometry:meshcat_graphviz",
        "//systems/framework",
    ],
)

drake_cc_library(
    name = "visualization_config",
    srcs = ["visualization_config.cc"],
    hdrs = ["visualization_config.h"],
    deps = [
        "//common:name_value",
        "//geometry:drake_visualizer_params",
        "//geometry:meshcat",
        "//geometry:meshcat_visualizer",
        "//geometry:meshcat_visualizer_params",
        "//geometry:rgba",
        "@eigen",
    ],
)

drake_cc_library(
    name = "visualization_config_functions",
    srcs = ["visualization_config_functions.cc"],
    hdrs = ["visualization_config_functions.h"],
    interface_deps = [
        ":visualization_config",
        "//geometry:drake_visualizer_params",
        "//geometry:scene_graph",
        "//multibody/meshcat:contact_visualizer_params",
        "//multibody/plant",
        "//systems/framework:diagram_builder",
        "//systems/lcm:lcm_buses",
    ],
    deps = [
        ":inertia_visualizer",
        "//geometry:drake_visualizer",
        "//multibody/meshcat:contact_visualizer",
        "//multibody/plant:contact_results_to_lcm",
        "//systems/lcm:lcm_config_functions",
    ],
)

drake_cc_googletest(
    name = "colorize_depth_image_test",
    deps = [
        ":colorize_depth_image",
        "//common/test_utilities:expect_throws_message",
        "//systems/sensors/test_utilities:image_compare",
    ],
)

drake_cc_googletest(
    name = "colorize_label_image_test",
    deps = [
        ":colorize_label_image",
        "//systems/sensors/test_utilities:image_compare",
    ],
)

drake_cc_googletest(
    name = "concatenate_images_test",
    deps = [
        ":concatenate_images",
        "//systems/sensors/test_utilities:image_compare",
    ],
)

drake_cc_googletest(
    name = "inertia_visualizer_test",
    data = [
        "//geometry/render:test_models",
        "//multibody/benchmarks/acrobot:models",
    ],
    deps = [
        ":inertia_visualizer",
        ":visualization_config_functions",
        "//common/test_utilities:eigen_matrix_compare",
        "//geometry:meshcat",
        "//geometry/test_utilities:meshcat_environment",
        "//multibody/parsing",
    ],
)

drake_cc_googletest(
    name = "meshcat_pose_sliders_test",
    deps = [
        ":meshcat_pose_sliders",
        "//common/test_utilities:eigen_matrix_compare",
        "//common/test_utilities:expect_throws_message",
        "//geometry:meshcat_visualizer",
        "//geometry/test_utilities:meshcat_environment",
        "//systems/analysis:simulator",
        "//systems/framework/test_utilities",
    ],
)

drake_cc_googletest(
    name = "visualization_config_functions_test",
    deps = [
        ":inertia_visualizer",
        ":visualization_config_functions",
        "//common/test_utilities:expect_throws_message",
        "//lcm:drake_lcm",
        "//systems/analysis:simulator",
    ],
)

add_lint_tests()
