public void GeneratePreviewSymbol()
{
// Step 1: Create a dictionary/map of well known attribute names to values
Dictionary<string, string> attributeSet = GenerateAttributeSetDictionary();
// Step 2: Set the SVG Home Folder
// This should be within the git clone of joint-military-symbology-xml
// ex: C:\Github\joint-military-symbology-xml\svg\MIL_STD_2525D_Symbols
// This is called in CheckSettings below, but you should call yourself if
// reusing this method
//Utilities.SetImageFilesHome(@"C:\Projects\Github\joint-military-symbology-xml\svg\MIL_STD_2525D_Symbols");
string militarySymbolsPath = System.IO.Path.Combine(ProSymbolUtilities.AddinAssemblyLocation(), "Images", "MIL_STD_2525D_Symbols");
bool pathExists = Utilities.SetImageFilesHome(militarySymbolsPath);
if (!Utilities.CheckImageFilesHomeExists())
//if (!CheckSettings())
{
Console.WriteLine("No SVG Folder, can't continue.");
return;
}
// Step 3: Get the Layered Bitmap from the Library
const int width = 256, height = 256;
Size exportSize = new Size(width, height);
System.Drawing.Bitmap exportBitmap;
bool success = Utilities.ExportSymbolFromAttributes(attributeSet, out exportBitmap, exportSize);
if (success && exportBitmap != null)
{
_symbolImage = ProSymbolUtilities.BitMapToBitmapImage(exportBitmap);
NotifyPropertyChanged(() => SymbolImage);
}
if (!success || (exportBitmap == null))
{
Console.WriteLine("Export failed!");
_symbolImage = null;
NotifyPropertyChanged(() => SymbolImage);
return;
}
}