Annotation.metamodel 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. {
  2. "types": {
  3. "$*": [],
  4. "Annotation": [
  5. {
  6. "name": "text",
  7. "type": "code",
  8. "default": "Your Annotation Text"
  9. },
  10. {
  11. "name": "position",
  12. "type": "list<int>",
  13. "default": "[0,0]"
  14. },
  15. {
  16. "name": "textStyle",
  17. "type": "map<string,string>",
  18. "default": {
  19. "stroke": "#000000",
  20. "stroke-dasharray": "",
  21. "fill": "#000000",
  22. "fill-opacity": 0,
  23. "font-size": "17px",
  24. "stroke-width": 1,
  25. "arrow-start": "none",
  26. "arrow-end": "none",
  27. "font-family": "Courier New"
  28. }
  29. }
  30. ],
  31. "annotates": [],
  32. "TextAnnotationBox": [
  33. {
  34. "name": "width",
  35. "type": "double",
  36. "default": 100
  37. },
  38. {
  39. "name": "height",
  40. "type": "double",
  41. "default": 100
  42. },
  43. {
  44. "name": "style",
  45. "type": "map<string, string>",
  46. "default": {
  47. "stroke": "#04B404",
  48. "stroke-dasharray": "",
  49. "fill": "#F2F2F2",
  50. "fill-opacity": 0.75,
  51. "font-size": "20px",
  52. "stroke-width": 2.5,
  53. "arrow-start": "none",
  54. "arrow-end": "none"
  55. }
  56. },
  57. {
  58. "name": "text",
  59. "type": "code",
  60. "default": "Your Annotation Text"
  61. },
  62. {
  63. "name": "position",
  64. "type": "list<int>",
  65. "default": "[0,0]"
  66. },
  67. {
  68. "name": "textStyle",
  69. "type": "map<string,string>",
  70. "default": {
  71. "stroke": "#000000",
  72. "stroke-dasharray": "",
  73. "fill": "#000000",
  74. "fill-opacity": 0,
  75. "font-size": "17px",
  76. "stroke-width": 1,
  77. "arrow-start": "none",
  78. "arrow-end": "none",
  79. "font-family": "Courier New"
  80. }
  81. }
  82. ],
  83. "TextAnnotationRound": [
  84. {
  85. "name": "r",
  86. "type": "double",
  87. "default": 50
  88. },
  89. {
  90. "name": "style",
  91. "type": "map<int,int>",
  92. "default": {
  93. "stroke": "#04B404",
  94. "stroke-dasharray": "",
  95. "fill": "#F2F2F2",
  96. "fill-opacity": 0.75,
  97. "font-size": "20px",
  98. "stroke-width": 2.5,
  99. "arrow-start": "none",
  100. "arrow-end": "none"
  101. }
  102. },
  103. {
  104. "name": "text",
  105. "type": "code",
  106. "default": "Your Annotation Text"
  107. },
  108. {
  109. "name": "position",
  110. "type": "list<int>",
  111. "default": "[0,0]"
  112. },
  113. {
  114. "name": "textStyle",
  115. "type": "map<string,string>",
  116. "default": {
  117. "stroke": "#000000",
  118. "stroke-dasharray": "",
  119. "fill": "#000000",
  120. "fill-opacity": 0,
  121. "font-size": "17px",
  122. "stroke-width": 1,
  123. "arrow-start": "none",
  124. "arrow-end": "none",
  125. "font-family": "Courier New"
  126. }
  127. }
  128. ],
  129. "TextAnnotationRoundedBox": [
  130. {
  131. "name": "width",
  132. "type": "double",
  133. "default": 100
  134. },
  135. {
  136. "name": "height",
  137. "type": "int",
  138. "default": 100
  139. },
  140. {
  141. "name": "style",
  142. "type": "map<int,int>",
  143. "default": {
  144. "stroke": "#04B404",
  145. "stroke-dasharray": "",
  146. "fill": "#F2F2F2",
  147. "fill-opacity": 0.75,
  148. "font-size": "20px",
  149. "stroke-width": 2.5,
  150. "arrow-start": "none",
  151. "arrow-end": "none"
  152. }
  153. },
  154. {
  155. "name": "text",
  156. "type": "code",
  157. "default": "Your Annotation Text"
  158. },
  159. {
  160. "name": "position",
  161. "type": "list<int>",
  162. "default": "[0,0]"
  163. },
  164. {
  165. "name": "textStyle",
  166. "type": "map<string,string>",
  167. "default": {
  168. "stroke": "#000000",
  169. "stroke-dasharray": "",
  170. "fill": "#000000",
  171. "fill-opacity": 0,
  172. "font-size": "17px",
  173. "stroke-width": 1,
  174. "arrow-start": "none",
  175. "arrow-end": "none",
  176. "font-family": "Courier New"
  177. }
  178. }
  179. ]
  180. },
  181. "constraints": [],
  182. "actions": [
  183. {
  184. "name": "resizeToText",
  185. "event": "post-edit",
  186. "code": "/*newline*/var text = getAttr('text').replace(/\\n/g, ' '), /*newline*/ strLen = text.length, /*newline*/ fontSize = getAttr('textStyle')['font-size'], /*newline*/ strPix = parseInt(fontSize.substring(0,fontSize.indexOf('p'))), /*newline*/ strWidth = strPix * strLen; /*newline*/if (strWidth > 0) { /*newline*/ var strLenSqrt = Math.ceil(Math.sqrt(strLen)), /*newline*/ i = strLenSqrt, /*newline*/ oldIdx = 0, /*newline*/ longestLine = strLenSqrt, /*newline*/ nrOfLines = 0; /*newline*/ while (i < strLen) { /*newline*/ var idx = text.indexOf(' ', i); /*newline*/ if (idx > -1) { /*newline*/ text = text.slice(0,idx) + '\\n' + text.slice(idx).replace(/^ /g, ''); /*newline*/ if (idx - oldIdx > longestLine) { /*newline*/ longestLine = idx - oldIdx /*newline*/ } /*newline*/ i = idx + strLenSqrt; /*newline*/ oldIdx = idx; /*newline*/ nrOfLines += 1; /*newline*/ } else { /*newline*/ i = strLen; /*newline*/ } /*newline*/ } /*newline*/ setAttr('text', text); /*newline*/ var width = longestLine * (strPix - 5) + 35; /*newline*/ setAttr('width', width); /*newline*/ setAttr('height', (nrOfLines * (strPix + 5)) + 40); /*newline*/}",
  187. "targetType": "TextAnnotationBox"
  188. },
  189. {
  190. "name": "",
  191. "event": "ENUM( pre-connect , pre-create , pre-disconnect , pre-delete , pre-edit , post-connect , post-create , post-disconnect , post-delete , post-edit )",
  192. "code": "",
  193. "targetType": "TextAnnotationBox"
  194. },
  195. {
  196. "name": "resizeToText",
  197. "event": "post-edit",
  198. "code": "/*newline*/var text = getAttr('text').replace(/\\n/g, ' '), /*newline*/ strLen = text.length, /*newline*/ fontSize = getAttr('textStyle')['font-size'], /*newline*/ strPix = parseInt(fontSize.substring(0,fontSize.indexOf('p'))), /*newline*/ strWidth = strPix * strLen; /*newline*/if (strWidth > 0) { /*newline*/ var strLenSqrt = Math.ceil(Math.sqrt(strLen)), /*newline*/ i = strLenSqrt; /*newline*/ while (i < strLen) { /*newline*/ var idx = text.indexOf(' ', i); /*newline*/ if (idx > -1) { /*newline*/ text = text.slice(0,idx) + '\\n' + text.slice(idx).replace(/^ /g, ''); /*newline*/ i = idx + strLenSqrt; /*newline*/ } else { /*newline*/ i = strLen; /*newline*/ } /*newline*/ } /*newline*/ setAttr('text', text); /*newline*/ var width = strLenSqrt * (strPix - 5) + 35; /*newline*/ setAttr('r', width / 2); /*newline*/}",
  199. "targetType": "TextAnnotationRound"
  200. },
  201. {
  202. "name": "resizeToText",
  203. "event": "post-edit",
  204. "code": "/*newline*/var text = getAttr('text').replace(/\\n/g, ' '), /*newline*/ strLen = text.length, /*newline*/ fontSize = getAttr('textStyle')['font-size'], /*newline*/ strPix = parseInt(fontSize.substring(0,fontSize.indexOf('p'))), /*newline*/ strWidth = strPix * strLen; /*newline*/if (strWidth > 0) { /*newline*/ var strLenSqrt = Math.ceil(Math.sqrt(strLen)), /*newline*/ i = strLenSqrt, /*newline*/ oldIdx = 0, /*newline*/ longestLine = strLenSqrt, /*newline*/ nrOfLines = 0; /*newline*/ while (i < strLen) { /*newline*/ var idx = text.indexOf(' ', i); /*newline*/ if (idx > -1) { /*newline*/ text = text.slice(0,idx) + '\\n' + text.slice(idx).replace(/^ /g, ''); /*newline*/ if (idx - oldIdx > longestLine) { /*newline*/ longestLine = idx - oldIdx /*newline*/ } /*newline*/ i = idx + strLenSqrt; /*newline*/ oldIdx = idx; /*newline*/ nrOfLines += 1; /*newline*/ } else { /*newline*/ i = strLen; /*newline*/ } /*newline*/ } /*newline*/ setAttr('text', text); /*newline*/ var width = longestLine * (strPix - 5) + 35; /*newline*/ setAttr('width', width); /*newline*/ setAttr('height', nrOfLines * (strPix + 5) + 40); /*newline*/}",
  205. "targetType": "TextAnnotationRoundedBox"
  206. }
  207. ],
  208. "cardinalities": {
  209. "$*": [
  210. {
  211. "dir": "in",
  212. "type": "annotates",
  213. "min": "0",
  214. "max": "Infinity"
  215. }
  216. ],
  217. "Annotation": [
  218. {
  219. "dir": "out",
  220. "type": "annotates",
  221. "min": "0",
  222. "max": "Infinity"
  223. }
  224. ],
  225. "annotates": [
  226. {
  227. "dir": "in",
  228. "type": "Annotation",
  229. "min": "0",
  230. "max": "1"
  231. },
  232. {
  233. "dir": "out",
  234. "type": "$*",
  235. "min": "0",
  236. "max": "1"
  237. },
  238. {
  239. "dir": "in",
  240. "type": "TextAnnotationBox",
  241. "min": "0",
  242. "max": "1"
  243. },
  244. {
  245. "dir": "in",
  246. "type": "TextAnnotationRound",
  247. "min": "0",
  248. "max": "1"
  249. },
  250. {
  251. "dir": "in",
  252. "type": "TextAnnotationRoundedBox",
  253. "min": "0",
  254. "max": "1"
  255. }
  256. ],
  257. "TextAnnotationBox": [
  258. {
  259. "dir": "out",
  260. "type": "annotates",
  261. "min": "0",
  262. "max": "Infinity"
  263. }
  264. ],
  265. "TextAnnotationRound": [
  266. {
  267. "dir": "out",
  268. "type": "annotates",
  269. "min": "0",
  270. "max": "Infinity"
  271. }
  272. ],
  273. "TextAnnotationRoundedBox": [
  274. {
  275. "dir": "out",
  276. "type": "annotates",
  277. "min": "0",
  278. "max": "Infinity"
  279. }
  280. ]
  281. },
  282. "legalConnections": {
  283. "Annotation": {
  284. "$*": [
  285. "annotates"
  286. ]
  287. },
  288. "TextAnnotationBox": {
  289. "$*": [
  290. "annotates"
  291. ]
  292. },
  293. "TextAnnotationRound": {
  294. "$*": [
  295. "annotates"
  296. ]
  297. },
  298. "TextAnnotationRoundedBox": {
  299. "$*": [
  300. "annotates"
  301. ]
  302. }
  303. },
  304. "connectorTypes": {
  305. "annotates": "visual"
  306. },
  307. "types2parentTypes": {
  308. "$*": [],
  309. "Annotation": [],
  310. "annotates": [],
  311. "TextAnnotationBox": [
  312. "Annotation"
  313. ],
  314. "TextAnnotationRound": [
  315. "Annotation"
  316. ],
  317. "TextAnnotationRoundedBox": [
  318. "Annotation"
  319. ]
  320. }
  321. }