将自定义图标添加到 Spotfire 中的形状列表

Add custom icon to the shape list in Spotfire

我想在图标列表中添加自定义图标以获得更有意义的形状

确实,正如@Andrew Pruet 所建议的那样,没有 out-of-the-box 方法可以做到这一点。但是,如果您真的对自定义图标感兴趣,则可以使用 SDK 创建自定义图标,让您能够拥有任意数量的图标甚至图像。

如果您熟悉 R 编程语言,这是可行的。

在相关 Tibco's idea portal 中查看我的 post。

此特定用例将钻机绘制为自定义标记。

特别感谢 R Core team, tidyverse, and sf 作者。

# `data_raw` is a spatial data frame with latitude and longitude; in this case in CRS 4326
data_sf <- sf::st_as_sf(data_raw, coords = c("lng", "lat"), crs = 4326)

# Munge default geometry object, which is a point
# First, get it out as vectors
lng_lat <- lapply(data_sf$geometry, as.vector)

# The key _drawing_ function for a drilling rig; a minimalist artist I am, as you'll see :)
draw_rig <- function(mid_x, step_x, mid_y, step_y) {
  max_y <- min_y <- mid_y - 3 * step_y
  
  min_x <- mid_x - 3 * step_x

  max_x <- mid_x + 3 * step_x

  rig <- sf::st_linestring(
    cbind(
      c(min_x, mid_x, mid_x + step_x, mid_x - step_x, mid_x + 2 * step_x, mid_x + step_x, mid_x - 2 * step_x, mid_x + 2 * step_x, max_x),
      c(min_y, mid_y, mid_y - step_y, mid_y - step_y, mid_y - 2 * step_y, mid_y - step_y, mid_y - 2 * step_y, mid_y - 2 * step_y, max_y))
    )

  return(rig)
}

# Apply _drawing_ function; step_x and step_y are set based on personal taste and affect the size of marker in map
lng_lat_sf <- purrr::map(
  lng_lat,
  ~ draw_rig (
    mid_x = .x[[1]],
    step_x = 0.167 / 2,
    mid_y = .x[[2]],
    step_y = 0.334 / 2
  )
)

# Convert back to sf object
data_sf$geometry <- sf::st_as_sfc(lng_lat_sf)

# Save as .shp file for .dxp import
sf::st_write(
  data_sf,
  "rigs.shp",
  driver = "ESRI Shapefile",
  delete_layer = TRUE
)