public static SinglePointRenderer getInstance()
        {
            lock (syncLock)
            {
                if (_instance == null)
                {
                    _instance = new SinglePointRenderer();
                }
            }

            return(_instance);
        }
Пример #2
0
        public ImageInfo Render(String symbolID, Dictionary <int, String> modifiers, Dictionary <int, String> attributes, CanvasDevice device)
        {
            SinglePointRenderer spr = SinglePointRenderer.getInstance();

            int symStd = 1;

            if (modifiers != null && modifiers[MilStdAttributes.SymbologyStandard] != null)
            {
                symStd = Convert.ToInt32(modifiers[MilStdAttributes.SymbologyStandard]);
            }
            else
            {
                if (modifiers == null)
                {
                    modifiers = new Dictionary <int, String>();
                }
                modifiers[MilStdAttributes.SymbologyStandard] = Convert.ToString(RendererSettings.getInstance().getSymbologyStandard());
            }

            var basicID = SymbolUtilities.getBasicSymbolIDStrict(symbolID);

            if (SymbolUtilities.isTacticalGraphic(symbolID))
            {
                SymbolDef sd = SymbolDefTable.getInstance().getSymbolDef(basicID, symStd);
                if (sd == null)
                {
                    sd = SymbolDefTable.getInstance().getSymbolDef(basicID, symStd);
                }

                if (sd != null && sd.getDrawCategory() == SymbolDef.DRAW_CATEGORY_POINT)
                {
                    return(spr.RenderSPTG(symbolID, modifiers, attributes));
                }
                else
                {
                    Color color = RenderUtilities.DrawingColorToUIColor(SymbolUtilities.getLineColorOfAffiliation(symbolID));
                    int   size  = 35;
                    if (attributes.ContainsKey(MilStdAttributes.PixelSize))
                    {
                        size = int.Parse(attributes[MilStdAttributes.PixelSize]);
                    }

                    if (modifiers.ContainsKey(MilStdAttributes.LineColor))
                    {
                        color = RenderUtilities.getColorFromHexString(modifiers[MilStdAttributes.LineColor]);
                    }
                    if (modifiers.ContainsKey(MilStdAttributes.PixelSize))
                    {
                        size = int.Parse(modifiers[MilStdAttributes.PixelSize]);
                    }
                    return(TacticalGraphicIconRenderer.getIcon(symbolID, size, color, 0));
                }
            }
            else if (UnitFontLookup.getInstance().getLookupInfo(basicID) != null)
            {
                return(spr.RenderUnit(symbolID, modifiers, attributes, device));
            }
            else
            {
                //symbolID = SymbolUtilities.reconcileSymbolID(symbolID, false);
                return(spr.RenderUnit(symbolID, modifiers, attributes, null));
            }
        }