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);
            }
        }
Ejemplo n.º 2
0
        private void Init()
        {
            try
            {
                Debug.Write("MilStdIconRenderer.Init()");
                Stopwatch sw = new Stopwatch();
                sw.Start();
                SymbolDefTable.getInstance();
                Debug.Write("SymbolDefTable Loaded");
                SinglePointLookup.getInstance();
                Debug.Write("SinglePointLookup Loaded");
                SymbolSVGTable.getInstance();
                Debug.Write("SymbolSVGTable Loaded");


                UnitDefTable.getInstance();
                Debug.Write("UnitDefTable Loaded");
                UnitFontLookup.getInstance();
                Debug.Write("UnitFontLookup Loaded");
                UnitSVGTable.getInstance();
                Debug.Write("UnitSVGTable Loaded");

                TacticalGraphicLookup.getInstance();
                Debug.Write("TacticalGraphicLookup Loaded");
                TGSVGTable.getInstance();
                Debug.Write("TGSVGTable Loaded");//*/
                sw.Stop();
                string ExecutionTimeTaken = string.Format("Minutes :{0} Seconds :{1} Mili seconds :{2}", sw.Elapsed.Minutes, sw.Elapsed.Seconds, sw.Elapsed.Milliseconds);
                Debug.WriteLine("Init Time: " + ExecutionTimeTaken);
            }
            catch (InvalidOperationException ioe)
            {
                Debug.Write(ioe.Message);
                Debug.Write(ioe.StackTrace);
            }
            catch (Exception exc)
            {
                Debug.Write(exc.Message);
                Debug.Write(exc.StackTrace);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Setup test page controls
        /// </summary>
        private void init()
        {
            try
            {
                //First get instance call initialized the renderer and its required classes.
                MilStdIconRenderer.getInstance();
                //initialize controls

                //Populate TG list
                System.Collections.Generic.List <SymbolDef> symbolDefs = SymbolDefTable.getInstance().getAllSymbolDefs().Values.ToList();
                symbolDefs.Sort();
                foreach (SymbolDef sd in symbolDefs)
                {
                    String itemTG = sd.getDescription() + "|" + sd.getBasicSymbolId();
                    if (sd.getDrawCategory() != 0 && sd.getBasicSymbolId().Contains("BS_") == false)
                    {
                        lbTGList.Items.Add(itemTG);
                    }
                }

                //Populate Unit List
                System.Collections.Generic.List <UnitDef> unitDefs = UnitDefTable.getInstance().GetAllUnitDefs().Values.ToList();
                unitDefs.Sort();
                foreach (UnitDef ud in unitDefs)
                {
                    String itemUnit = ud.getDescription() + "|" + ud.getBasicSymbolId();
                    if (ud.getDrawCategory() != 0)
                    {
                        lbUnitList.Items.Add(itemUnit);
                    }
                }

                //setup affiliations
                cbAffiliation.Items.Add("P");
                cbAffiliation.Items.Add("U"); //Unknown
                cbAffiliation.Items.Add("F"); //Friend
                cbAffiliation.Items.Add("N"); //NEutral
                cbAffiliation.Items.Add("H"); //Hostile
                cbAffiliation.Items.Add("A");
                cbAffiliation.Items.Add("S");
                cbAffiliation.Items.Add("G");
                cbAffiliation.Items.Add("W");
                cbAffiliation.Items.Add("D");
                cbAffiliation.Items.Add("L");
                cbAffiliation.Items.Add("M");
                cbAffiliation.Items.Add("J"); //Joker
                cbAffiliation.Items.Add("K"); //Faker
                cbAffiliation.SelectedIndex = 2;

                //setup status
                cbStatus.Items.Add("A"); //anticipated/planned
                cbStatus.Items.Add("P"); //present
                cbStatus.Items.Add("C"); //present/fully capable
                cbStatus.Items.Add("D"); //present/damaged
                cbStatus.Items.Add("X"); //present/destroyed
                cbStatus.Items.Add("F"); //present/full to capacity
                cbStatus.SelectedIndex = 1;

                chkbKeepUnitRatio.IsChecked = true;
                chkbLabels.IsChecked        = false;
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc.Message);
                Debug.WriteLine(exc.StackTrace);
                Debug.WriteLine(exc.Source);
            }
        }