Пример #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);
            }
        }
Пример #2
0
        /**
         *
         * */
        private void Init()
        {
            try
            {
                SymbolDefTable sdTable = SymbolDefTable.getInstance();

                Dictionary <String, SymbolDef> symbolDefs = sdTable.getAllSymbolDefs();

                ICollection <SymbolDef> vc = symbolDefs.Values;

                IEnumerator <SymbolDef> enumerator = vc.GetEnumerator();
                SymbolDef sdTemp = null;
                UnitDef   udTemp = null;
                String    item   = null;
                while (enumerator.MoveNext())
                {
                    sdTemp = enumerator.Current;
                    item   = sdTemp.getDescription() + ":" + sdTemp.getBasicSymbolId();

                    if (sdTemp.getDrawCategory() != 0)//0 means category, not drawable
                    {
                        lbTGs.Items.Add(item);
                    }
                }
                lbTGs.Sorted = true;

                ////////////////////////////////////////////////////////////////////////

                UnitDefTable udTable = UnitDefTable.getInstance();

                Dictionary <String, UnitDef> unitDefs = udTable.GetAllUnitDefs();

                ICollection <UnitDef> c = unitDefs.Values;

                IEnumerator <UnitDef> ude = c.GetEnumerator();
                //SymbolDef temp = null;
                //String item = null;
                while (ude.MoveNext())
                {
                    udTemp = ude.Current;
                    item   = udTemp.getDescription() + ":" + udTemp.getBasicSymbolId();
                    lbFEs.Items.Add(item);
                }
                lbFEs.Sorted = true;

                /////////////////////////////////////////////////////////////////////////
                cbAffiliation.SelectedIndex   = 0;
                cbStatus.SelectedIndex        = 1;
                cbModifiers.SelectedIndex     = 0;
                cbSize.SelectedIndex          = 0;
                cbOutlineType.SelectedIndex   = 0;
                cbSpeedTestType.SelectedIndex = 1;
                cbDoubleBuffer.CheckState     = CheckState.Checked;

                //RENDERER SETTINGS//////////////////////////////////////////////////////
                RendererSettings RS = RendererSettings.getInstance();
                RS.setTextBackgroundMethod(RendererSettings.TextBackgroundMethod_OUTLINE_QUICK);
                //RS.setTextBackgroundMethod(RendererSettings.TextBackgroundMethod_OUTLINE);
                //RS.setTextBackgroundMethod(RendererSettings.TextBackgroundMethod_NONE);
                //RS.setTextBackgroundMethod(RendererSettings.TextBackgroundMethod_COLORFILL);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
                Console.WriteLine(exc.StackTrace);
            }
        }