Adding Custom Symbols - missioncommand/mil-sym-java GitHub Wiki
It is possible to add custom symbols to be used in unit frames.
-
Decide what your symbol will be and where it will go amongst the existing symbol. This feature will not let you overwrite an existing symbol. For the example, we will add a symbol under Land Unit, Sustainment (symbol set 10, entity code 160000). Sustainment has 56 symbols underneath it so we will add a 57th (165700).
-
Make your custom svg. It should fit within the middle section of the octagon.
The octagon svg is at the bottom of this page. Put the shape in a group element with the ID you are going to use. The id is comprised of the Symbol Set Number and the Entity code you are going to assign to this symbol. Below is an example: "<g id="10165700"><text font-family="sans-serif" fill="red" font-size="89" x="192" y="428">MWR"
-
Next we will add the symbol using calls to the renderer library (Java example)
//Get modifiers from an existing symbol in the same symbol set
MSInfo miBase = MSLookup.getInstance().getMSLInfo("10160000",SymbolID.Version_2525E);
//Create new MSInfo object
MSInfo mi = new MSInfo(SymbolID.Version_2525E,"10", "Sustainment","TEST","","165700",miBase.getModifiers());
//Create new SVGInfo object
SVGInfo si = new SVGInfo("10165700", new Rectangle2D.Double(198.0,365.0,215.0,64.0),"<g id=\"10165700\"><text font-family=\"sans-serif\" fill=\"red\" font-size=\"89\" x=\"192\" y=\"428\">MWR</text></g>");
//Add symbol to the renderer
MilStdIconRenderer.getInstance().AddCustomSymbol(mi,si);
- Your symbol can now be drawn like any other unit:
String svgCustom = MilStdIconRenderer.getInstance().RenderSVG("130310000016570000000000000000",modifiers, attributes)
Octagon Horizontal:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Version_1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
<g id="main">
<g id="outFrame">
<line fill="none" stroke="#0000FF" stroke-width="2" x1="220" y1="309.5" x2="306" y2="273"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="306" y1="273" x2="390.5" y2="309.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="390.5" y1="309.5" x2="427" y2="396"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="427" y1="396" x2="390.5" y2="482.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="390.5" y1="482.5" x2="306" y2="516"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="306" y1="516" x2="220" y2="482.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="220" y1="482.5" x2="183" y2="396"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="183" y1="396" x2="220" y2="309.5"/>
</g>
<line id="mod2_1_" fill="none" stroke="#0000FF" stroke-width="2" x1="203.966" y1="445.015" x2="406.199" y2="445.295"/>
<line id="mod1_1_" fill="none" stroke="#0000FF" stroke-width="2" x1="203.966" y1="346.985" x2="406.199" y2="346.705"/>
</g>
</svg>
Octagon Vertical:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Version_1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
<g id="main" >
<g id="outFrame">
<line fill="none" stroke="#0000FF" stroke-width="2" x1="220" y1="479.5" x2="183.5" y2="393.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="183.5" y1="393.5" x2="220" y2="309"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="220" y1="309" x2="306.5" y2="272.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="306.5" y1="272.5" x2="393" y2="309"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="393" y1="309" x2="426.5" y2="393.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="426.5" y1="393.5" x2="393" y2="479.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="393" y1="479.5" x2="306.5" y2="516.5"/>
<line fill="none" stroke="#0000FF" stroke-width="2" x1="306.5" y1="516.5" x2="220" y2="479.5"/>
</g>
<line id="mod2_1_" fill="none" stroke="#0000FF" stroke-width="2" x1="355.515" y1="495.534" x2="355.795" y2="293.301"/>
<line id="mod1_1_" fill="none" stroke="#0000FF" stroke-width="2" x1="257.485" y1="495.534" x2="257.205" y2="293.301"/>
</g>
</svg>