Ejemplo n.º 1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                //Graphics gg = this.CreateGraphics();
                //gg.GetHdc();
                //gg.DrawLine(new Pen(Color.Red), 0, 0, 900, 900);
                //gg.DrawArc(new Pen(Color.Red), 500, 500, 50, 50, 0, 90);
                //gg.ReleaseHdc();
                Graphics g = this.CreateGraphics();
                SVGRenderer.getInstance().renderSVGPathToGraphics(g);

                String symbolID     = "SFZP------*****";
                String spaceStation = "SFPPT-----*****";
                String ambush       = "GFGPSLA---*****";
                String checkPoint   = "GFGPGPPK--****X";

                UnitDef ud = UnitDefTable.getInstance().getUnitDef(SymbolUtilities.getBasicSymbolID(symbolID));
                Console.WriteLine(ud.getDescription());
                SymbolDef sd = SymbolDefTable.getInstance().getSymbolDef(SymbolUtilities.getBasicSymbolID(ambush), 1);
                Console.WriteLine(sd.getDescription());

                int mapping = SinglePointLookup.getInstance().getCharCodeFromSymbol(checkPoint);
                Console.WriteLine(mapping.ToString());

                UnitFontLookupInfo ufli = UnitFontLookup.getInstance().getLookupInfo(spaceStation);
                Console.WriteLine(ufli.getMapping1(spaceStation).ToString());

                SinglePointRenderer spr = SinglePointRenderer.getInstance();
                //Bitmap tempBMP = spr.DrawTest();
                //tempBMP.Save("C:\\test.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
                //MilStdBMP msb = spr.RenderSymbol(spaceStation, null, null);
                //msb.getBitmap().Save("C:\\test.png", System.Drawing.Imaging.ImageFormat.Png);


                //Graphics g = Graphics.FromHwnd(this.Handle);
                //Graphics g = this.CreateGraphics();
                float x = this.Width / 2.0f;
                float y = this.Height / 2.0f;
                //g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
                //g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                //g.DrawImageUnscaled(tempBMP, (int)x, (int)y);
                //g.Flush();
                //g.Dispose();
                // g.DrawImage(spr.DrawTest(), x, y);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
                Console.WriteLine(exc.StackTrace);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="symbolID"></param>
        /// <param name="modifiers"></param>
        /// <param name="attributes"></param>
        /// <returns></returns>
        public ImageInfo RenderUnit(String symbolID, Dictionary <int, String> modifiers, Dictionary <int, String> attributes)
        {
            //L 1.5 = 2650 pixel units in the svg font file
            double L1_5 = 2650;

            Bitmap coreBMP = null;

            try
            {
                Graphics g = Graphics.FromImage(dimensionsBMP);

                //get unit font
                Font unitFont = _unitFont;

                //get font character indexes
                int     fillIndex    = -1;
                int     frameIndex   = -1;
                int     symbol1Index = -1;
                int     symbol2Index = -1;
                SVGPath svgFill      = null;
                SVGPath svgFrame     = null;
                SVGPath svgSymbol1   = null;
                SVGPath svgSymbol2   = null;

                //get attributes
                int     alpha         = 255;
                Boolean drawAsIcon    = false;
                Boolean keepUnitRatio = true;
                int     pixelSize     = 0;
                Color   fillColor     = SymbolUtilities.getFillColorOfAffiliation(symbolID);
                Color   frameColor    = SymbolUtilities.getLineColorOfAffiliation(symbolID);

                if (attributes == null)
                {
                    attributes = new Dictionary <int, string>();
                }
                if (attributes.ContainsKey(MilStdAttributes.LineColor))
                {
                    frameColor = SymbolUtilities.getColorFromHexString(attributes[MilStdAttributes.LineColor]);
                }

                if (attributes.ContainsKey(MilStdAttributes.FillColor))
                {
                    fillColor = SymbolUtilities.getColorFromHexString(attributes[MilStdAttributes.FillColor]);
                }

                if (attributes.ContainsKey(MilStdAttributes.Alpha))
                {
                    alpha = Convert.ToInt32(attributes[MilStdAttributes.Alpha]);
                }

                if (attributes.ContainsKey(MilStdAttributes.DrawAsIcon))
                {
                    drawAsIcon = Convert.ToBoolean(attributes[MilStdAttributes.DrawAsIcon]);
                }

                if (attributes.ContainsKey(MilStdAttributes.PixelSize))
                {
                    pixelSize = Convert.ToInt32(attributes[MilStdAttributes.PixelSize]);
                }
                else
                {
                    pixelSize = 35;
                }

                if (attributes.ContainsKey(MilStdAttributes.KeepUnitRatio))
                {
                    keepUnitRatio = Convert.ToBoolean(attributes[MilStdAttributes.KeepUnitRatio]);
                }

                UnitFontLookupInfo ufli = UnitFontLookup.getInstance().getLookupInfo(symbolID);
                fillIndex  = UnitFontLookup.getFillCode(symbolID);
                frameIndex = UnitFontLookup.getFrameCode(symbolID, fillIndex);
                if (ufli != null)
                {
                    symbol1Index = ufli.getMapping1(symbolID);
                    symbol2Index = ufli.getMapping2();
                }

                if (fillIndex > 0)
                {
                    svgFill = UnitSVGTable.getInstance().getSVGPath(fillIndex);
                }
                if (frameIndex > 0)
                {
                    svgFrame = UnitSVGTable.getInstance().getSVGPath(frameIndex);
                }
                if (symbol1Index > 0)
                {
                    svgSymbol1 = UnitSVGTable.getInstance().getSVGPath(symbol1Index);
                }
                if (symbol2Index > 0)
                {
                    svgSymbol2 = UnitSVGTable.getInstance().getSVGPath(symbol2Index);
                }


                //get dimensions for this symbol given the font size & fill index


                Matrix matrix  = null;
                double heightL = 1;
                double widthL  = 1;

                if (keepUnitRatio)
                {
                    RectangleF rectFrame = svgFrame.getBounds();
                    double     ratio     = pixelSize / L1_5 / 1.5;
                    widthL  = UnitFontLookup.getUnitRatioWidth(fillIndex);
                    heightL = UnitFontLookup.getUnitRatioHeight(fillIndex);
                    if (widthL > heightL)
                    {
                        ratio = ratio * widthL;
                    }
                    else
                    {
                        ratio = ratio * heightL;
                    }
                    pixelSize = (int)((ratio * L1_5) + 0.5);
                }

                matrix = svgFrame.TransformToFitDimensions(pixelSize, pixelSize);

                RectangleF rectF = svgFrame.getBounds();

                int w = (int)(rectF.Width + 1.5f);
                int h = (int)(rectF.Height + 1.5f);
                coreBMP = new Bitmap(w, h);
                Point centerPoint = new Point(w / 2, h / 2);

                //draw location
                PointF location = new PointF(0, 0);
                location.X = (rectF.Width / 2.0f);// +0.5f;//use 0.5f to round up
                location.Y = -(rectF.Height / 2.0f);

                //get & setup graphics object for destination BMP
                g = Graphics.FromImage(coreBMP);
                g.SmoothingMode     = SmoothingMode.AntiAlias;
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

                //draw symbol to BMP
                if (svgFill != null)
                {
                    svgFill.Draw(g, Color.Empty, 0, fillColor, matrix);
                }
                if (svgFrame != null)
                {
                    svgFrame.Draw(g, Color.Empty, 0, frameColor, null);
                }
                if (svgSymbol2 != null)
                {
                    svgSymbol2.Draw(g, Color.Empty, 0, ufli.getColor2(), matrix);
                }
                if (svgSymbol1 != null)
                {
                    svgSymbol1.Draw(g, Color.Empty, 0, ufli.getColor1(), matrix);
                }


                RectangleF coreDimensions  = new RectangleF(0, 0, w, h);
                Rectangle  finalDimensions = new Rectangle(0, 0, w, h);

                //adjust centerpoint for HQStaff if present

                /*if(SymbolUtilities.isHQ(symbolID))
                 * {
                 *      Point point1 = new Point();
                 *      Point point2 = new Point();
                 *      string affiliation = symbolID.Substring(1, 2);
                 *      if(affiliation==("F") ||
                 *              affiliation==("A") ||
                 *              affiliation==("D") ||
                 *              affiliation==("M") ||
                 *              affiliation==("J") ||
                 *              affiliation==("K") ||
                 *              affiliation==("N") ||
                 *              affiliation==("L"))
                 *      {
                 *              point1.X = 0;
                 * point1.Y = (coreBMP.Height);
                 *              point2.X = point1.X;
                 * point2.Y = point1.Y + coreBMP.Height;
                 *      }
                 *      else
                 *      {
                 *              point1.X = 1;
                 * point1.Y = (coreBMP.Height / 2);
                 *              point2.X = point1.X;
                 * point2.Y = point1.Y + coreBMP.Height;
                 *      }
                 *      centerPoint = point2;
                 * }//*/

                ImageInfo ii = new ImageInfo(coreBMP, centerPoint, coreDimensions);

                //process display modifiers
                ImageInfo iinew = null;

                Boolean hasDisplayModifiers = ModifierRenderer.hasDisplayModifiers(symbolID, modifiers);
                Boolean hasTextModifiers    = ModifierRenderer.hasTextModifiers(symbolID, modifiers, attributes);
                if (hasDisplayModifiers)
                {
                    iinew = ModifierRenderer.ProcessUnitDisplayModifiers(symbolID, ii, modifiers, attributes, true);
                }

                if (iinew != null)
                {
                    ii = iinew;
                }
                iinew = null;

                //process text modifiers
                if (hasTextModifiers)
                {
                    //iinew = ModifierRenderer.ProcessUnitTextModifiers(symbolID, ii, modifiers, attributes);
                    iinew = ModifierRenderer.ProcessUnitTextModifiers(ii, symbolID, modifiers, attributes);
                }

                if (iinew != null)
                {
                    ii = iinew;
                }
                iinew = null;

                g.Dispose();
                g = null;

                return(ii);
            }
            catch (Exception exc)
            {
                ErrorLogger.LogException("SinglePointRenderer", "RenderUnit", exc);
                return(null);
            }
        }
        public Bitmap DrawTest()
        {
            Bitmap myBmp = null;

            try
            {
                float dpi             = 72;
                float fontSize        = 50;
                float windowsFontSize = fontSize;
                float javaDPI         = 96;//72;
                float windowsDPI      = 72;

                //get symbol dimensions
                Graphics g = Graphics.FromImage(dimensionsBMP);
                // g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                //g.MeasureString("text", font);
                dpi = g.DpiX;

                //scaled the font for the C# renderer down by 0.75 so this calculation not necessary
                //had to scale it down also because bottom of symbols were getting clipped.
                //windowsFontSize = fontSize * windowsDPI / javaDPI;

                String spaceStation = "SUPPT-----*****"; //space station
                String airTrack     = "SUAPM-----*****"; //air track, militray
                String AtoSMissle   = "SFAPWMAP--*****"; //air track, air to space missile
                String armor        = "SUGPUCA---*****"; //ground
                String mLauncher    = "SFGPEWM---*****"; //ground equipment
                String SSGN         = "SUUPSNG---*****"; //sub surface, guided missile (SSGN)

                String sar    = "SHAPMFQH--*****";       //search and rescue
                String sensor = "SHGPUUMRS-*****";       //sensor

                String symbolID = SSGN;


                int    fillIndex    = -1;
                int    frameIndex   = -1;
                int    symbol1Index = -1;
                int    symbol2Index = -1;
                char[] fillString   = new char[1];
                char[] frameString  = new char[1];
                char[] symbol1      = new char[1];
                char[] symbol2      = new char[1];

                UnitFontLookupInfo ufli = UnitFontLookup.getInstance().getLookupInfo(symbolID);

                fillIndex    = UnitFontLookup.getFillCode(symbolID);
                frameIndex   = UnitFontLookup.getFrameCode(symbolID, fillIndex);
                symbol1Index = ufli.getMapping1(symbolID);
                symbol2Index = ufli.getMapping2();

                fillString[0]  = (char)fillIndex;
                frameString[0] = (char)frameIndex;
                symbol1[0]     = (char)symbol1Index;
                symbol2[0]     = (char)symbol2Index;

                Color fillColor  = SymbolUtilities.getFillColorOfAffiliation(symbolID);
                Color frameColor = SymbolUtilities.getLineColorOfAffiliation(symbolID);

                PointF center   = new PointF(150f, 150f);
                PointF location = new PointF(center.X, center.Y);

                StringFormat sf = new StringFormat();
                sf.Alignment     = StringAlignment.Center; //horizontal
                sf.LineAlignment = StringAlignment.Center; //vertical
                sf.FormatFlags   = StringFormatFlags.NoClip;

                sf = StringFormat.GenericTypographic;

                RectangleF rectF      = SymbolDimensions.getUnitBounds(fillIndex, fontSize);
                RectangleF rectLayout = new RectangleF(100f, 100f, 100f, 100f);

                //location.Y = location.Y + (rectF.Height / 2);// +rectF.Y;


                //create bitmap to draw to.
                //myBmp = new Bitmap(500,500);
                String temp = new String(frameString);


                int w = (int)Math.Round(rectF.Width);
                int h = (int)Math.Round(rectF.Height);
                myBmp      = new Bitmap(w, h);
                location.X = 0;//rectF.Width / 2;
                location.Y = 0;

                location.X = rectF.Width / 2.0f;
                //location.Y = rectF.Height * 0.3f;
                location.Y = -(rectF.Height / 2.0f);
                RectangleF rectL = new RectangleF(0, 0, rectF.Width, rectF.Height);

                g           = Graphics.FromImage(myBmp);
                g.Transform = new Matrix();
                //g.TranslateTransform(rectF.Width / 2, rectF.Height * 0.25f);
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                //g.DrawString(new String(frameString), unitFont, new SolidBrush(frameColor), location, sf);



                location.Y += rectF.Y;



                //g.DrawString(Convert.ToString("fillString"), new Font("Arial",35f), new SolidBrush(frameColor), new PointF(100f, 100f));
                g.Transform = new Matrix();
                Pen RectanglePen = new Pen(Color.Red, 1.0f);
                RectanglePen.DashPattern = new float[] { 4.0f, 2.0f, 1.0f, 3.0f };
                g.DrawRectangle(RectanglePen, 0, 0, w - 1, h - 1);
                //g.DrawRectangle(Pens.Red, rectLayout.X,rectLayout.Y,rectLayout.Width,rectLayout.Height);
                //g.FillRectangle(Brushes.Red,center.X-1f,center.Y-1f, 2f, 2f);

                sf.LineAlignment = StringAlignment.Far;

                g.DrawString("T", new Font("arial", 24f), Brushes.Orange, center, sf);
                //g.DrawString("g", new Font("arial", 24f), Brushes.Purple, center, sf);
                //g.Dispose();
                //g = null;
                //g.FillRectangle(Brushes.Red, center.X - 1f, center.Y - 1f, 2f, 2f);


                return(myBmp);
            }
            catch (Exception exc)
            {
                ErrorLogger.LogException("SinglePointRenderer", "DrawTest", exc);
                return(null);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="symbolID"></param>
        /// <param name="modifiers"></param>
        /// <param name="attributes"></param>
        /// <returns></returns>
        public ImageInfo RenderUnit(String symbolID, Dictionary <int, String> modifiers, Dictionary <int, String> attributes, CanvasDevice device)
        {
            //L 1.5 = 2650 pixel units in the svg font file
            double             L1_5     = 2650;
            CanvasRenderTarget finalBMP = null;

            CanvasRenderTarget coreBMP = null;

            try
            {
                //get font character indexes
                int     fillIndex    = -1;
                int     frameIndex   = -1;
                int     symbol1Index = -1;
                int     symbol2Index = -1;
                SVGPath svgFill      = null;
                SVGPath svgFrame     = null;
                SVGPath svgSymbol1   = null;
                SVGPath svgSymbol2   = null;

                //get attributes
                int     alpha         = 255;
                Boolean drawAsIcon    = false;
                Boolean keepUnitRatio = true;
                int     pixelSize     = 0;
                Color   fillColor     = RenderUtilities.DrawingColorToUIColor(SymbolUtilities.getFillColorOfAffiliation(symbolID));
                Color   frameColor    = RenderUtilities.DrawingColorToUIColor(SymbolUtilities.getLineColorOfAffiliation(symbolID));

                if (attributes == null)
                {
                    attributes = new Dictionary <int, string>();
                }
                if (attributes.ContainsKey(MilStdAttributes.LineColor))
                {
                    frameColor = RenderUtilities.DrawingColorToUIColor(SymbolUtilities.getColorFromHexString(attributes[MilStdAttributes.LineColor]));
                }

                if (attributes.ContainsKey(MilStdAttributes.FillColor))
                {
                    fillColor = RenderUtilities.DrawingColorToUIColor(SymbolUtilities.getColorFromHexString(attributes[MilStdAttributes.FillColor]));
                }

                if (attributes.ContainsKey(MilStdAttributes.Alpha))
                {
                    alpha = Convert.ToInt32(attributes[MilStdAttributes.Alpha]);
                }

                if (attributes.ContainsKey(MilStdAttributes.DrawAsIcon))
                {
                    drawAsIcon = Convert.ToBoolean(attributes[MilStdAttributes.DrawAsIcon]);
                }

                if (attributes.ContainsKey(MilStdAttributes.PixelSize))
                {
                    pixelSize = Convert.ToInt32(attributes[MilStdAttributes.PixelSize]);
                }
                else
                {
                    pixelSize = 35;
                }

                if (attributes.ContainsKey(MilStdAttributes.KeepUnitRatio))
                {
                    keepUnitRatio = Convert.ToBoolean(attributes[MilStdAttributes.KeepUnitRatio]);
                }

                String             basicID = SymbolUtilities.getBasicSymbolIDStrict(symbolID);
                UnitFontLookupInfo ufli    = UnitFontLookup.getInstance().getLookupInfo(basicID);
                fillIndex  = UnitFontLookup.getFillCode(symbolID);
                frameIndex = UnitFontLookup.getFrameCode(symbolID, fillIndex);
                if (ufli != null)
                {
                    symbol1Index = ufli.getMapping1(symbolID);
                    symbol2Index = ufli.getMapping2();
                }

                if (fillIndex > 0)
                {
                    svgFill = UnitSVGTable.getInstance().getSVGPath(fillIndex);
                }
                if (frameIndex > 0)
                {
                    svgFrame = UnitSVGTable.getInstance().getSVGPath(frameIndex);
                }
                if (symbol1Index > 0)
                {
                    svgSymbol1 = UnitSVGTable.getInstance().getSVGPath(symbol1Index);
                }
                if (symbol2Index > 0)
                {
                    svgSymbol2 = UnitSVGTable.getInstance().getSVGPath(symbol2Index);
                }


                //get dimensions for this symbol given the font size & fill index


                Matrix3x2 matrix  = new Matrix3x2();
                double    heightL = 1;
                double    widthL  = 1;

                Rect rectFrame = svgFrame.getBounds();
                if (keepUnitRatio)
                {
                    double ratio = pixelSize / L1_5 / 1.5;
                    widthL  = UnitFontLookup.getUnitRatioWidth(fillIndex);
                    heightL = UnitFontLookup.getUnitRatioHeight(fillIndex);
                    if (widthL > heightL)
                    {
                        ratio = ratio * widthL;
                    }
                    else
                    {
                        ratio = ratio * heightL;
                    }
                    pixelSize = (int)((ratio * L1_5) + 0.5);
                }

                Matrix3x2 mScale, mTranslate;
                Matrix3x2 mIdentity = Matrix3x2.Identity;
                Rect      rectF     = new Rect();
                matrix = svgFrame.CreateMatrix(pixelSize, pixelSize, out rectF, out mScale, out mTranslate);


                //int w = (int)(rectF.Width + 1.5f);
                //int h = (int)(rectF.Height + 1.5f);
                int w = (int)(rectF.Width);
                int h = (int)(rectF.Height);
                if (w == pixelSize && h != pixelSize)
                {
                    h = (int)Math.Ceiling(rectF.Height);
                }
                else if (h == pixelSize && w != pixelSize)
                {
                    w = (int)Math.Ceiling(rectF.Width);
                }

                bool bufferUsed = false;
                if (w < coreBufferSize && h < coreBufferSize)
                {
                    if (coreUnitBuffer == null)
                    {
                        if (device == null)
                        {
                            device = CanvasDevice.GetSharedDevice();
                        }
                        coreUnitBuffer = new CanvasRenderTarget(device, coreBufferSize, coreBufferSize, 96);//new Bitmap(w, h);
                    }
                    coreBMP    = coreUnitBuffer;
                    bufferUsed = true;
                }
                else
                {
                    if (device == null)
                    {
                        device = CanvasDevice.GetSharedDevice();
                    }
                    coreBMP = new CanvasRenderTarget(device, w, h, 96);//new Bitmap(w, h);
                }
                Point centerPoint = new Point(w / 2, h / 2);

                //get & setup graphics object for destination BMP

                using (CanvasDrawingSession ds = coreBMP.CreateDrawingSession())
                {
                    ds.Clear(Colors.Transparent);
                    //clear canvas
                    //ds.Transform = matrix;
                    // ds.Transform = mScale;
                    //draw symbol to BMP
                    // ds.Transform = mScale * mTranslate;
                    if (svgFill != null)
                    {
                        //svgFill.Transform(mScale);
                        //svgFill.Transform(mTranslate);
                        svgFill.Draw(ds, Colors.Transparent, 0, fillColor, matrix);
                    }
                    if (svgFrame != null)
                    {
                        svgFrame.Draw(ds, Colors.Transparent, 0, frameColor, matrix);
                    }
                    if (svgSymbol2 != null)
                    {
                        //svgSymbol2.Transform(mScale);
                        //svgSymbol2.Transform(mTranslate);
                        svgSymbol2.Draw(ds, Colors.Transparent, 0, RenderUtilities.DrawingColorToUIColor(ufli.getColor2()), matrix);
                    }
                    if (svgSymbol1 != null)
                    {
                        //svgSymbol1.Transform(mScale);
                        //svgSymbol1.Transform(mTranslate);
                        svgSymbol1.Draw(ds, Colors.Transparent, 0, RenderUtilities.DrawingColorToUIColor(ufli.getColor1()), matrix);
                    }
                    //ds.Transform = Matrix3x2.Identity;
                }//*/

                /*
                 * if (svgFill != null)
                 * {
                 *  svgFill.Transform(mScale);
                 *  svgFill.Transform(mTranslate);
                 *  //svgFill.Transform(matrix);
                 *  svgFill.Draw(coreBMP, Colors.Transparent, 0, fillColor, mIdentity);
                 * }
                 * if (svgFrame != null)
                 * {
                 *  svgFrame.Draw(coreBMP, Colors.Transparent, 0, frameColor, mIdentity);
                 * }
                 * if (svgSymbol2 != null)
                 * {
                 *  svgSymbol2.Transform(mScale);
                 *  svgSymbol2.Transform(mTranslate);
                 *  svgSymbol2.Draw(coreBMP, Colors.Transparent, 0, ufli.getColor2(), mIdentity);
                 * }
                 * if (svgSymbol1 != null)
                 * {
                 *  svgSymbol1.Transform(mScale);
                 *  svgSymbol1.Transform(mTranslate);
                 *  svgSymbol1.Draw(coreBMP, Colors.Transparent, 0, ufli.getColor1(), mIdentity);
                 * }//*/
                Rect coreDimensions  = new Rect(0, 0, w, h);
                Rect finalDimensions = new Rect(0, 0, w, h);

                //adjust centerpoint for HQStaff if present
                if (SymbolUtilities.isHQ(symbolID))
                {
                    Point  point1      = new Point();
                    Point  point2      = new Point();
                    string affiliation = symbolID.Substring(1, 2);
                    if (affiliation == ("F") ||
                        affiliation == ("A") ||
                        affiliation == ("D") ||
                        affiliation == ("M") ||
                        affiliation == ("J") ||
                        affiliation == ("K") ||
                        affiliation == ("N") ||
                        affiliation == ("L"))
                    {
                        point1.X = 0;
                        point1.Y = (coreBMP.Size.Height);
                        point2.X = point1.X;
                        point2.Y = point1.Y + coreBMP.Size.Height;
                    }
                    else
                    {
                        point1.X = 1;
                        point1.Y = (coreBMP.Size.Height / 2);
                        point2.X = point1.X;
                        point2.Y = point1.Y + coreBMP.Size.Height;
                    }
                    centerPoint = point2;
                }


                if (device == null)
                {
                    device = CanvasDevice.GetSharedDevice();
                }
                finalBMP = new CanvasRenderTarget(device, (float)finalDimensions.Width, (float)finalDimensions.Height, 96);

                ImageInfo ii = new ImageInfo(coreBMP, new Point(centerPoint.X, centerPoint.Y), new Rect(0, 0, coreBMP.Size.Width, coreBMP.Size.Height), coreBMP.GetBounds(device));


                //process display modifiers
                ImageInfo iinew = null;

                Boolean hasDisplayModifiers = ModifierRenderer.hasDisplayModifiers(symbolID, modifiers);
                Boolean hasTextModifiers    = ModifierRenderer.hasTextModifiers(symbolID, modifiers, attributes);
                if (hasDisplayModifiers)
                {
                    iinew = ModifierRenderer.ProcessUnitDisplayModifiers(symbolID, ii, modifiers, attributes, true, device);
                }//*/

                if (iinew != null)
                {
                    ii = iinew;
                }
                iinew = null;

                //process text modifiers
                if (hasTextModifiers)
                {
                    //iinew = ModifierRenderer.ProcessUnitTextModifiers(ii, symbolID, modifiers, attributes);
                }//*/

                if (iinew != null)
                {
                    ii = iinew;
                }
                iinew = null;


                //////
                svgFill    = null;
                svgFrame   = null;
                svgSymbol1 = null;
                svgSymbol2 = null;
                device     = null;
                //if(bufferUsed==false)
                //    coreBMP.Dispose();
                coreBMP  = null;
                finalBMP = null;
                return(ii);
            }
            catch (Exception exc)
            {
                ErrorLogger.LogException("SinglePointRenderer", "RenderUnit", exc);
                return(null);
            }
        }