Using Milsymbols by Spatial Illusions in Servoy

Måns Beckman of Spatial Illusions has created Milsymbol, a small library in pure javascript that creates military unit symbols according to MIL-STD-2525 (US) and STANAG APP-6 (NATO) publications. The project is OpenSource and it can be freely used according to the MIT License. Being a war game enthusiast, I would like to use it in a Servoy solution but I don’t know which would be the best way to do this. The library milsymbol.js doesn’t require any dependency, and therefore it is quite simple to use it in a browser to create an SVG or canvas.

<html>
<head>
	<title>test</title>
	<meta name="generator" content="BBEdit 12.0" />
	 <meta charset="UTF-8" />
  <script src="milsymbol.js"></script>
</head>
<body>
 <script>
 document.write(new ms.Symbol('10031000001211050051', { size: 100}).asSVG());
 </script>
</body>
</html>

The long number is the so called SDIC or Symbol ID Code that uniquely identifies a symbol. My questions are: which would be the best way to load the library and have it always available in my solution and how would you trigger the js function to draw the symbol? Thanks for any suggestion.

What type of servoy-client do you need it for?

Either the smart or web. I don’t have enough experience on NG to use it.

Thanks

Probably my original question scope was too broad and generic. But the main question is probably simpler to reply: how can I access the MilSymbol library (milsymbol.js) from inside Servoy? Where should I put it?

Thanks for any help.

I guess easiest is to put it in the application_server/server/webabbs/ROOT folder.
That way, you can access it through :/milsymbol.js

For webclient you can add it to your resources using the web client-utils plugin.
Now you only need to add the svg in some way to your forms.

For smart client it’s probably a bit more complicated, as you need to be able to display an SVG file.
On servoy-forge you’ll find a svg-bean (never used it myself though)
Not sure what the easies way is to retrieve the svg-data (maybe a simple html page where you can post the milsymbol ID to using http plugin and which will return the svg data)

Thank you very much Marc. I’ll try it tonight.