SVG Example

Nobori Symbology MIL-STD-2525 C++ SDK SVG example.

The example below shows just how easily a C or C++ language program can call the straightforward and logical C++ API of the Nobori Symbology MIL-STD-2525 SDK to generate an SVG image and stroke it yourself or write it to a file. 

#include 
#include 

static void basic_test()
{
	MilSymbolStartup();
	const char *style =
		"{fill:true}"
		"{frame:true}"
		"{infoFields:true}"
		"{engagementType:TARGET}"
		"{colorMode:Medium}"
		"{infoBackground:grey}"
		"{infoColor:orange}"
		"{outlineColor:false}"
		"{infoOutlineColor:black}"
		"{outlineWidth:2}"
		"{infoOutlineWidth:2}"
		"{hqStaffLength:120}"
		"{infoSize:40}";

	const char *description =
		"{sidc:10031020231205005801}"
		"{reinforcedReduced:F}"
		"{staffComments:G}"
		"{additionalInformation:H}"
		"{evaluationRating:J}"
		"{combatEffectiveness:K}"
		"{signatureEquipment:L}"
		"{higherFormation:M}"
		"{hostile:N}"
		"{iffSif:P}"
		"{direction:331.2}"
		"{uniqueDesignation:T}"
		"{type:V}"
		"{dtg:W}"
		"{altitudeDepth:X}"
		"{location:Y}"
		"{speed:Z}"
		"{engagementBar:AO}";

	MilSymbolContextRef context = MilSymbolContextCreate();
	MilSymbolContextSetStyle(context, style);
	MilSymbolRef symbol = MilSymbolContextGenerateSymbol(context, description);
	if (symbol)
	{
		MilSymbolSVGRef svg = MilSymbolSymbolAsSVG(symbol);
		if (svg)
		{
			std::ofstream svg_file("basic_test.svg");
			if (svg_file)
			{
				svg_file << svg;
				svg_file.close();
			}
			MilSymbolSVGDestroy(svg);
		}
	}

	MilSymbolContextRelease(context);
	MilSymbolShutdown();
}
Scroll to top
0
    0
    Your Cart
    Your cart is emptyReturn to Shop