image-polygons.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const config = `
  2. <View>
  3. <Image name="img" value="$image" showMousePos="true" zoom="true"></Image>
  4. <PolygonLabels name="tag" toName="img" strokewidth="5" fillcolor="red" pointstyle="circle" pointsize="small">
  5. <Label value="Hello" background="red"></Label>
  6. <Label value="World" background="blue"></Label>
  7. </PolygonLabels>
  8. </View>
  9. `;
  10. const data = {
  11. image: "https://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg",
  12. };
  13. const result = [
  14. {
  15. id: "XSMXwwsaTa",
  16. from_name: "tag",
  17. to_name: "img",
  18. type: "polygonlabels",
  19. origin: "manual",
  20. original_width: 10109,
  21. original_height: 4542,
  22. image_rotation: 0,
  23. value: {
  24. points: [
  25. [27.199999999999996, 41.246290801186944],
  26. [25.73333333333333, 70.62314540059347],
  27. [48.13333333333333, 62.61127596439169],
  28. [48.13333333333333, 32.93768545994065],
  29. ],
  30. polygonlabels: ["Hello"],
  31. closed: true,
  32. },
  33. },
  34. {
  35. id: "DSm8iGlaA8",
  36. from_name: "tag",
  37. to_name: "img",
  38. type: "polygonlabels",
  39. origin: "manual",
  40. original_width: 10109,
  41. original_height: 4542,
  42. image_rotation: 0,
  43. value: {
  44. points: [
  45. [60.788381742738586, 76.21247113163972],
  46. [65.87136929460583, 52.19399538106235],
  47. [88.69294605809128, 60.508083140877595],
  48. [87.75933609958506, 87.06697459584295],
  49. ],
  50. closed: true,
  51. polygonlabels: ["World"],
  52. },
  53. },
  54. ];
  55. const title = "Polygons on Image";
  56. module.exports = { config, data, result, title };