string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";

            if (_legacyFrame != null)
            {
                result = BuildFrameItemName(context, dimension, identity, status, false);

                result = result + "," + BuildSIDCKey(_legacyStatusCode(_standard, status), _legacyFrame);

                if(_legacyFrame.LimitUseTo == "2525C" || _legacyFrame.LimitUseTo == "")
                    // For 2525C frames or 2525Bc2 frames that are the same we 2525C we use the 2525D icons
                    // (2525C and some 2525Bc2 frames are identical to 2525D)
                    result = result + "," + BuildFrameCode(context, identity, dimension, status, false);
                else
                    // For 2525Bc2 unique frames we use the unique icons that are keyed accordingly.
                    result = result + "," + BuildFrameCode(_legacyStatusCode(_standard, status), _legacyFrame);

                result = result + ","; // + "Modifier1";
                result = result + ","; // + "Modifier2";
                result = result + ","; // + "ExtraIcon";
                result = result + ","; // + "FullFrame";
                result = result + "," + "Point"; // + "GeometryType";
                result = result + "," + _legacyFrame.LimitUseTo; // + "Standard";
                result = result + ","; // + "Status";
                result = result + "," + _legacyFrame.Description; // + "Notes";
            }

            return result;
        }
        public LegacyETL(ConfigHelper helper, JMSMLConfigETLConfig config)
        {
            _helper = helper;
            _etlConfig = config;

            _lib = _helper.Librarian;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";

            result = BuildFrameItemName(null, null, identity, null, false) + "," + BuildFrameCode(null, identity, null, null, false);

            return result;
        }
Esempio n. 4
0
        public ETL(Librarian librarian)
        {
            _librarian = librarian;
            _library = _librarian.Library;
            _symbolSets = _librarian.SymbolSets;

            _configHelper = new ConfigHelper(_librarian);
        }
        public ConfigHelper(Librarian librarian)
        {
            _librarian = librarian;
            _configData = librarian.ConfigData;
            _etlConfig = _configData.ETLConfig;

            _findPaths();
        }
 public void MakeSymbolTest()
 {
     string configPath = string.Empty;
     Librarian target = new Librarian(configPath);
     SIDC sidc = new SIDC(1003010000,1100000000);
     Symbol actual = null;
     actual = target.MakeSymbol(sidc);
     Assert.IsNotNull(actual, "Symbol object is null.");
 }
        public FormSIDCConverter()
        {
            InitializeComponent();

            _librarian = new Librarian();
            _librarian.IsLogging = true;
            
            _badSymbol = _librarian.MakeSymbol(1001980000, 1000000000);
            _symbol = _badSymbol;
            updateControls();
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            _notes = "";

            string result = "";
            string graphic = "";

            string graphicPath = _configHelper.GetPath(context.ID, FindEnum.FindFrames);

            LibraryAffiliation affiliation = librarian.Affiliation(context.ID, dimension.ID, identity.ID);

            if (affiliation != null)
            {
                if (affiliation.Shape != ShapeType.NA && (status.StatusCode == 0 || affiliation.PlannedGraphic != ""))
                {
                    if (status.StatusCode == 0)
                        if (asCivilian && affiliation.CivilianGraphic != "")
                            graphic = affiliation.CivilianGraphic;
                        else
                            graphic = affiliation.Graphic;
                    else
                        if (asPlannedCivilian && affiliation.PlannedCivilianGraphic != "")
                            graphic = affiliation.PlannedCivilianGraphic;
                        else
                            graphic = affiliation.PlannedGraphic;

                    if (graphic == null)
                        _notes = _notes + "graphic is missing - frame is NA - frame is never to be drawn;";

                    string itemRootedPath = _configHelper.BuildRootedPath(graphicPath, graphic);
                    string itemOriginalPath = _configHelper.BuildOriginalPath(graphicPath, graphic);

                    if (!File.Exists(itemOriginalPath))
                        _notes = _notes + "image file does not exist;";

                    string itemName = BuildFrameItemName(context, dimension, identity, status, asCivilian || asPlannedCivilian);
                    string itemCategory = "Frame";
                    string itemTags = BuildFrameItemTags(context, identity, dimension, status, graphicPath + "\\" + graphic, _omitSource, _omitLegacy, asCivilian || asPlannedCivilian);
                    string itemID = BuildFrameCode(context, identity, dimension, status, asCivilian || asPlannedCivilian);

                    result = itemRootedPath + "," +
                             Convert.ToString(_configHelper.PointSize) + "," +
                             itemName + "," +
                             itemCategory + "," +
                             itemTags + "," +
                             itemID + "," +
                             "Point" + "," +
                             _notes;
                }
            }

            return result;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";

            if (_legacyFrame != null)
            {
                result = BuildFrameItemName(context, dimension, identity, status, false);

                result = result + "," + BuildSIDCKey(_legacyStatusCode(_standard, status), _legacyFrame);

                result = result + "," + BuildFrameCode(context, identity, dimension, status, false);

                result = result + ","; // + "Modifier1";
                result = result + ","; // + "Modifier2";
                result = result + ","; // + "ExtraIcon";
                result = result + ","; // + "FullFrame";
                result = result + "," + "Point"; // + "GeometryType";
                result = result + ","; // + "Status";
                result = result + "," + _legacyFrame.Description; // + "Notes";
            }

            return result;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";
            string graphic = "";

            _notes = "";

            string graphicPath = _configHelper.GetPath("JMSML_2525BC2", FindEnum.Find2525BC2);

            graphic = _legacyFrame.Graphic;

            string id = BuildFrameCode(_legacyStatusCode(_standard, status), _legacyFrame);

            string geometryType = "Point";

            string itemRootedPath = _configHelper.BuildRootedPath(graphicPath, graphic);
            string itemOriginalPath = _configHelper.BuildOriginalPath(graphicPath, graphic);
            string tags = BuildFrameItemTags(context, identity, dimension, status, graphicPath, true, true, false);

            // Replace the 2525D ID with the 2525B Change 2 ID
            string dCode = BuildFrameCode(context, identity, dimension, status, false);
            tags = tags.Replace(dCode, id);

            if (!File.Exists(itemOriginalPath))
                _notes = _notes + "image file does not exist;";

            result = result + itemRootedPath;
            result = result + "," + Convert.ToString(_configHelper.PointSize);
            result = result + "," + id;
            result = result + "," + "Frame";
            result = result + "," + tags;
            result = result + "," + id;
            result = result + "," + geometryType;
            result = result + "," + _notes;

            return result;
        }
 public void InvalidSymbolTest()
 {
     string configPath = string.Empty;
     Librarian target = new Librarian(configPath);
     Symbol sym = target.InvalidSymbol;
     string expected1 = "1001980000";
     string expected2 = "1000000000";
     string actual1 = sym.SIDC.PartAString;
     string actual2 = sym.SIDC.PartBString;
     Assert.AreEqual(actual1, expected1);
     Assert.AreEqual(actual2, expected2);
 }
 public void LibrarianConstructorTest()
 {
     string configPath = string.Empty;
     Librarian target = new Librarian(configPath);
     Assert.IsNotNull(target, "Librarian object is null.");
 }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            _notes = "";

            string result  = "";
            string graphic = "";

            string graphicPath = _configHelper.GetPath(context.ID, FindEnum.FindFrames);

            LibraryAffiliation affiliation = librarian.Affiliation(context.ID, dimension.ID, identity.ID);

            if (affiliation != null)
            {
                if (affiliation.Shape != ShapeType.NA && (status.StatusCode == 0 || affiliation.PlannedGraphic != ""))
                {
                    if (status.StatusCode == 0)
                    {
                        if (asCivilian && affiliation.CivilianGraphic != "")
                        {
                            graphic = affiliation.CivilianGraphic;
                        }
                        else
                        {
                            graphic = affiliation.Graphic;
                        }
                    }
                    else
                    if (asPlannedCivilian && affiliation.PlannedCivilianGraphic != "")
                    {
                        graphic = affiliation.PlannedCivilianGraphic;
                    }
                    else
                    {
                        graphic = affiliation.PlannedGraphic;
                    }

                    if (graphic == null)
                    {
                        _notes = _notes + "graphic is missing - frame is NA - frame is never to be drawn;";
                    }

                    string itemRootedPath   = _configHelper.BuildRootedPath(graphicPath, graphic);
                    string itemOriginalPath = _configHelper.BuildOriginalPath(graphicPath, graphic);

                    if (!File.Exists(itemOriginalPath))
                    {
                        _notes = _notes + "image file does not exist;";
                    }

                    string itemName     = BuildFrameItemName(context, dimension, identity, status, asCivilian || asPlannedCivilian);
                    string itemCategory = "Frame";
                    string itemTags     = BuildFrameItemTags(context, identity, dimension, status, graphicPath + "\\" + graphic, _omitSource, _omitLegacy, asCivilian || asPlannedCivilian);
                    string itemID       = BuildFrameCode(context, identity, dimension, status, asCivilian || asPlannedCivilian);

                    result = itemRootedPath + "," +
                             Convert.ToString(_configHelper.PointSize) + "," +
                             itemName + "," +
                             itemCategory + "," +
                             itemTags + "," +
                             itemID + "," +
                             "Point" + "," +
                             _notes;
                }
            }

            return(result);
        }
        internal Symbol(Librarian librarian, string legacyStandard, string legacySIDC, bool drawColorBars = true, bool drawCivilianFrame = false)
        {
            _librarian = librarian;
            _legacySIDC = legacySIDC;
            _colorBarOCA = drawColorBars;
            _useCivilianFrame = drawCivilianFrame;

            _configHelper = new ConfigHelper(_librarian);

            _UpdateFromLegacy();

            switch (_symbolStat)
            {
                case SymbolStatusEnum.statusEnumOld:
                    _BuildSIDC();
                    break;
                case SymbolStatusEnum.statusEnumRetired:
                    _sidc.PartAUInt = SIDC.RETIRED.PartAUInt;
                    _sidc.PartBUInt = SIDC.RETIRED.PartBUInt;
                    break;
            }

            _BuildNames();
            _BuildTags();
            _BuildLabels();
            _BuildDrawRule();
            _BuildGraphics();
        }
        static void Main(string[] args)
        {
            DataTable symbolTable = new DataTable();

            // Warning: this order must match the .csv
            // Mil-2525C-Wildcards.csv format
            // Full SIDC,SIDC By Parts,Hierarchy Code,Name,Geometry
            symbolTable.Columns.Add("SymbolId");
            symbolTable.Columns.Add("SymbolIdByParts");
            symbolTable.Columns.Add("HierarchyCode");
            symbolTable.Columns.Add("Name");
            symbolTable.Columns.Add("Geometry");

            string csvFileName = @"Data\Mil-2525C-Wildcards.csv";
            string basePath = AppDomain.CurrentDomain.BaseDirectory;
            string csvFullPath = System.IO.Path.Combine(basePath, csvFileName);

            foreach (string line in File.ReadLines(csvFullPath))
            {
                if (line.StartsWith("#"))
                    continue;

                string[] values = line.Split(',');
                if (values.Length >= 4)
                {
                    string symbolId = values[0];
                    string symbolIdByParts = values[1];
                    string hierarchyCode = values[2];
                    string name = values[3];

                    // convention used in test data: pt, pl, pg (point, polyline, polygon)
                    string geometry = "pt"; // not every row/entry has this so default to "pt"
                    if (values.Length > 4)
                        geometry = values[4];

                    symbolTable.Rows.Add(symbolId, symbolIdByParts, name, geometry);
                }
            }

            System.Console.WriteLine("Check Debug/Trace Window for Output");

            Librarian librarian = new Librarian(string.Empty);

            var results = from row in symbolTable.AsEnumerable() select row;

            int resultCount = results.Count();

            foreach (DataRow row in results)
            {
                string name = row["Name"] as string;
                string symbolId = row["SymbolId"] as string;

                StringBuilder sb = new StringBuilder(symbolId);

                // Replace wildcards used
                if (symbolId[1] == '*')
                    sb[1] = 'F';
                if (symbolId[3] == '*')
                    sb[3] = 'P';

                // System.Diagnostics.Trace.WriteLine("Found Match: " + symbolId + ", " + name + ")");
                symbolId = sb.ToString();
                symbolId = symbolId.Replace("*", "-");

                // TODO: Add any other code needed to test these results here
                Symbol jmsSymbol = librarian.MakeSymbol("2525C", symbolId);

                if (jmsSymbol == null)
                {
                    System.Diagnostics.Trace.WriteLine(symbolId + " ==>> 2525C: " +
                    symbolId + " is null in 2525D.");
                    continue;
                }

                if ((jmsSymbol.SymbolStatus != SymbolStatusEnum.statusEnumOld) &&
                    (jmsSymbol.SymbolStatus != SymbolStatusEnum.statusEnumRetired))
                {
                    System.Diagnostics.Trace.WriteLine("Unexpected Value for: " + symbolId + " ==>> (" +
                    jmsSymbol.SIDC.PartAString + ", " + jmsSymbol.SIDC.PartBString + ")" + " : " + jmsSymbol.SymbolStatus);
                }

                // To see just "Retired" symbols uncomment:
                //if (jmsSymbol.SymbolStatus == SymbolStatusEnum.statusEnumRetired)
                //{
                //    System.Diagnostics.Trace.WriteLine("Retired Symbol: " + symbolId + " ==>> (" +
                //    jmsSymbol.SIDC.PartAString + ", " + jmsSymbol.SIDC.PartBString + ")" + " : " + jmsSymbol.SymbolStatus);
                //}

            } // end for each row

        } // Main
        internal Symbol(Librarian librarian, SIDC sidc, bool drawColorBars = true, bool drawCivilianFrame = false)
        {
            _librarian = librarian;
            _sidc = sidc;
            _colorBarOCA = drawColorBars;
            _useCivilianFrame = drawCivilianFrame;

            _legacySIDC = _blankLegacySIDC;
            _configHelper = new ConfigHelper(_librarian);

            _UpdateFromCurrent();

            switch (_symbolStat)
            {
                case SymbolStatusEnum.statusEnumOld:
                    _BuildLegacySIDC();
                    break;
                case SymbolStatusEnum.statusEnumNew:
                    _legacySIDC = _blankLegacySIDC;
                    break;
            }

            _BuildNames();
            _BuildTags();
            _BuildLabels();
            _BuildDrawRule();
            _BuildGraphics();
        }
 public static void MyClassInitialize(TestContext testContext)
 {
     _librarian = new Librarian(string.Empty);
 }