protected string BuildModifierItemName(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            // Constructs a string containing the name of a modifier, where each Label value
            // is seperated by a DomainSeparator (usually a colon).  Builds this for each group
            // of related SymbolSet and modifier.

            //string result = this.BuildModifierItemCategory(ss, modNumber);

            //result = result + _configHelper.DomainSeparator + m.Category.Replace(',', '-') + _configHelper.DomainSeparator + m.Label.Replace(',', '-');

            string result;

            if (m.Category != null && m.Category != "")
            {
                result = ((m.CategoryAlias == "") ? m.Category : m.CategoryAlias) + _configHelper.DomainSeparator + ((m.LabelAlias == "") ? m.Label : m.LabelAlias);
            }
            else
            {
                result = m.LabelAlias == "" ? m.Label : m.LabelAlias;
            }

            result = result.Replace(',', '-');

            return result;
        }
        string IModifierExport.Line(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            string result = BuildModifierItemName(null, modNumber, m) + ",";

            result = result + BuildModifierCode(null, modNumber, m);

            return result;
        }
        protected string BuildQuotedModifierCode(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            // Constructs a quoted string containing the symbol set and modifier codes for a given
            // set of those objects.

            string code = '"' + this.BuildModifierCode(ss, modNumber, m) + '"';

            return code;
        }
        public string NameIt(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            string name = "";

            if(ss != null && m != null)
                name = BuildModifierItemName(ss, modNumber, m);

            return name;
        }
        public string CodeIt(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            string code = "";

            if (ss != null && m != null)
                code = BuildModifierCode(ss, modNumber, m);

            return code;
        }
        string IModifierExport.Line(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            _notes = "";

            string result = "";
            string graphicPath = "";

            switch (modNumber)
            {
                case "1":
                    graphicPath = _configHelper.GetPath(ss.ID, FindEnum.FindModifierOnes);
                    break;

                case "2":
                    graphicPath = _configHelper.GetPath(ss.ID, FindEnum.FindModifierTwos);
                    break;
            }

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

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

            string itemName = BuildModifierItemName(ss, modNumber, m);
            string itemCategory = BuildModifierItemCategory(ss, modNumber);
            string itemTags = BuildModifierItemTags(ss, modNumber, m, _omitSource, _omitLegacy);
            string itemID = BuildModifierCode(ss, modNumber, m);

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

            return result;
        }
        string IModifierExport.Line(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            string result = Convert.ToString(ss.SymbolSetCode.DigitOne) + Convert.ToString(ss.SymbolSetCode.DigitTwo);

            result = result + "," + modNumber + ",";

            if (m.Category != null)
                result = result + m.Category.Replace(',', '-') + ",";
            else
                result = result + ",";

            result = result + m.Label.Replace(',', '-') + ",";

            result = result + Convert.ToString(m.ModifierCode.DigitOne) + Convert.ToString(m.ModifierCode.DigitTwo);

            result = result + "," + BuildModifierItemName(ss, modNumber, m);

            return result;
        }
        protected string BuildModifierCode(SymbolSet ss, string modNumber, ModifiersTypeModifier m)
        {
            // Constructs a string containing the symbol set and modifier codes for a given
            // set of those objects.

            string code = "";

            if(ss != null)
            {
                code = code + Convert.ToString(ss.SymbolSetCode.DigitOne) + Convert.ToString(ss.SymbolSetCode.DigitTwo);
            }

            code = code + Convert.ToString(m.ModifierCode.DigitOne) + Convert.ToString(m.ModifierCode.DigitTwo);

            if (ss != null)
            {
                code = code + modNumber;
            }

            return code;
        }
        private void _UpdateFromLegacy()
        {
            // Search for the appropriate JMSML Library elements, given the older/legacy (2525C, 2525B, etc.)
            // SIDC for this Symbol.

            _librarian.ResetStatusCode();

            _version = _librarian.Version(1, 0);

            _legacySymbol = _librarian.LegacySymbol(_legacySIDC, ref _dimension, ref _symbolSet);

            if (_legacySymbol != null)
            {
                _affiliation = _librarian.AffiliationByLegacyCode(_legacySIDC.Substring(1, 1), _dimension.ID);

                if (_affiliation != null)
                {
                    _context = _librarian.Context(_affiliation.ContextID);
                    _standardIdentity = _librarian.StandardIdentity(_affiliation.StandardIdentityID);
                    _sig = _librarian.StandardIdentityGroup(_standardIdentity);
                }

                _status = _librarian.Status(_legacySIDC.Substring(3, 1), _legacySIDC.Substring(0, 1));
                _hqTFDummy = _librarian.HQTFDummy(_legacySIDC.Substring(10, 1));

                _amplifier = _librarian.Amplifier(_legacySIDC.Substring(11, 1), _legacySIDC.Substring(0, 1));

                if (_amplifier != null)
                {
                    _amplifierGroup = _librarian.AmplifierGroup(_amplifier);
                }

                _entity = _librarian.Entity(_symbolSet, _legacySymbol.EntityID);
                _entityType = _librarian.EntityType(_entity, _legacySymbol.EntityTypeID);
                _entitySubType = _librarian.EntitySubType(_symbolSet, _entityType, _legacySymbol.EntitySubTypeID);
                _modifierOne = _librarian.ModifierOne(_symbolSet, _legacySymbol.ModifierOneID);
                _modifierTwo = _librarian.ModifierTwo(_symbolSet, _legacySymbol.ModifierTwoID);
            }

            _librarian.LogConversionResult(_legacySIDC);

            _ValidateStatus();
        }
        private void _UpdateFromCurrent()
        {
            // Search for the appropriate JMSML Library elements, given the current (2525D)
            // SIDC for this Symbol.

            string first10 = _sidc.PartAString;
            string second10 = _sidc.PartBString;

            _librarian.ResetStatusCode();

            _version = _librarian.Version(Convert.ToUInt16(first10.Substring(0, 1)),
                                          Convert.ToUInt16(first10.Substring(1, 1)));

            _context = _librarian.Context(Convert.ToUInt16(first10.Substring(2, 1)));
            _standardIdentity = _librarian.StandardIdentity(Convert.ToUInt16(first10.Substring(3, 1)));
            _sig = _librarian.StandardIdentityGroup(_standardIdentity);
            _symbolSet = _librarian.SymbolSet(Convert.ToUInt16(first10.Substring(4, 1)), Convert.ToUInt16(first10.Substring(5, 1)));

            if (_symbolSet != null)
            {
                _dimension = _librarian.DimensionBySymbolSet(_symbolSet.ID);
            }

            if (_context != null && _dimension != null && _standardIdentity != null)
            {
                _affiliation = _librarian.Affiliation(_context.ID, _dimension.ID, _standardIdentity.ID);
            }

            _status = _librarian.Status(Convert.ToUInt16(first10.Substring(6, 1)));
            _hqTFDummy = _librarian.HQTFDummy(Convert.ToUInt16(first10.Substring(7, 1)));
            _amplifierGroup = _librarian.AmplifierGroup(Convert.ToUInt16(first10.Substring(8, 1)));

            if (_amplifierGroup != null)
            {
                _amplifier = _librarian.Amplifier(_amplifierGroup, Convert.ToUInt16(first10.Substring(9, 1)));
            }

            if (_symbolSet != null)
            {
                _entity = _librarian.Entity(_symbolSet, Convert.ToUInt16(second10.Substring(0, 1)), Convert.ToUInt16(second10.Substring(1, 1)));

                if (_entity != null)
                {
                    _entityType = _librarian.EntityType(_entity, Convert.ToUInt16(second10.Substring(2, 1)), Convert.ToUInt16(second10.Substring(3, 1)));
                }

                if (_entityType != null)
                {
                    _entitySubType = _librarian.EntitySubType(_entityType, Convert.ToUInt16(second10.Substring(4, 1)), Convert.ToUInt16(second10.Substring(5, 1)));

                    if (_entitySubType == null)
                    {
                        _entitySubType = _librarian.EntitySubType(_symbolSet, Convert.ToUInt16(second10.Substring(4, 1)), Convert.ToUInt16(second10.Substring(5, 1)));
                    }
                }

                _modifierOne = _librarian.ModifierOne(_symbolSet, Convert.ToUInt16(second10.Substring(6, 1)), Convert.ToUInt16(second10.Substring(7, 1)));
                _modifierTwo = _librarian.ModifierTwo(_symbolSet, Convert.ToUInt16(second10.Substring(8, 1)), Convert.ToUInt16(second10.Substring(9, 1)));

                _legacySymbol = _librarian.LegacySymbol(_symbolSet, _entity, _entityType, _entitySubType, _modifierOne, _modifierTwo);
            }

            _librarian.LogConversionResult(_sidc.PartAString + ", " + _sidc.PartBString);

            _ValidateStatus();
        }
        private void _SetInvalidSymbolProps()
        {
            // If a symbol can't be recognized, this method sets up
            // the current symbol to represent the special Invalid symbol.

            _version = _librarian.Version(1, 0);
            _context = _librarian.Context(0);
            _dimension = _librarian.Dimension("INTERNAL");
            _standardIdentity = _librarian.StandardIdentity(1);
            _symbolSet = _librarian.SymbolSet(9, 8);
            _status = _librarian.Status(0);
            _hqTFDummy = _librarian.HQTFDummy(0);
            _amplifierGroup = _librarian.AmplifierGroup(0);
            _amplifier = _librarian.Amplifier(_amplifierGroup, 0);
            _affiliation = _librarian.Affiliation("REALITY", "INTERNAL", "SI_UNKNOWN");
            _entity = _librarian.Entity(_symbolSet, "INVALID");
            _entityType = null;
            _entitySubType = null;
            _modifierOne = null;
            _modifierTwo = null;
        }
Example #12
0
        private void _exportMod(StreamWriter w, SymbolSet s, ModifiersTypeModifier mod, string modNumber, IModifierExport exporter, string expression)
        {
            string line;

            if (!(exporter is ImageModifierExport) || mod.ModifierCode.DigitOne != 0 || mod.ModifierCode.DigitTwo != 0)
            {
                if (expression == "" ||
                    System.Text.RegularExpressions.Regex.IsMatch(mod.Label, expression, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                {
                    line = string.Format("{0}", exporter.Line(s, modNumber, mod));

                    w.WriteLine(line);
                    w.Flush();
                }
                else if (mod.Category != null)
                {
                    if (System.Text.RegularExpressions.Regex.IsMatch(mod.Category, expression, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                    {
                        line = string.Format("{0}", exporter.Line(s, modNumber, mod));

                        w.WriteLine(line);
                        w.Flush();
                    }
                }
            }
        }
        internal SymbolSetLegacySymbol LegacySymbol(SymbolSet symbolSet, 
                                                  SymbolSetEntity entity, 
                                                  SymbolSetEntityEntityType entityType, 
                                                  EntitySubTypeType entitySubType, 
                                                  ModifiersTypeModifier modifierOne, 
                                                  ModifiersTypeModifier modifierTwo)
        {
            SymbolSetLegacySymbol retObj = null;

            // Account now for non-null modifiers that are effectively treated like null (00)

            if (modifierOne != null)
            {
                if (modifierOne.ModifierCode.DigitOne == 0 &&
                    modifierOne.ModifierCode.DigitTwo == 0)

                    modifierOne = null;
            }

            if (modifierTwo != null)
            {
                if (modifierTwo.ModifierCode.DigitOne == 0 &&
                    modifierTwo.ModifierCode.DigitTwo == 0)

                    modifierTwo = null;
            }

            // Now build a legacy 15 character SIDC from the 2525D symbol objects

            if (symbolSet != null)
            {
                if (symbolSet.LegacySymbols != null)
                {
                    int match = 0;

                    foreach (SymbolSetLegacySymbol lObj in symbolSet.LegacySymbols)
                    {
                        if(entity != null)
                        {
                            if (lObj.EntityID != "NA")
                            {
                                if (lObj.EntityID == entity.ID)
                                    match++;
                            }
                        }
                        else if(lObj.EntityID == "NA")
                            match++;

                        if(entityType != null)
                        {
                            if (lObj.EntityTypeID != "NA")
                            {
                                if (lObj.EntityTypeID == entityType.ID)
                                    match++;
                            }
                        }
                        else if(lObj.EntityTypeID == "NA")
                            match++;

                        if(entitySubType != null)
                        {
                            if (lObj.EntitySubTypeID != "NA")
                            {
                                if (lObj.EntitySubTypeID == entitySubType.ID)
                                    match++;
                            }
                        }
                        else if(lObj.EntitySubTypeID == "NA")
                            match++;

                        if(modifierOne != null)
                        {
                            if (lObj.ModifierOneID != "NA")
                            {
                                if (lObj.ModifierOneID == modifierOne.ID)
                                    match++;
                            }
                        }
                        else if(lObj.ModifierOneID == "NA")
                            match++;

                        if(modifierTwo != null)
                        {
                            if (lObj.ModifierTwoID != "NA")
                            {
                                if (lObj.ModifierTwoID == modifierTwo.ID)
                                    match++;
                            }
                        }
                        else if(lObj.ModifierTwoID == "NA")
                            match++;

                        if(match == 5)
                        {
                            return lObj;
                        }

                        match = 0;
                    }
                }
            }

            _statusFlag -= 65536;

            return retObj;
        }
        private string _buildName(SymbolSet ss, SymbolSetLegacySymbol legacySymbol)
        {
            // Builds a seperated string of components names for all the 2525D elements
            // used to make this legacy symbol

            string result = "";

            Librarian lib = _configHelper.Librarian;

            if (legacySymbol.EntityID != "")
                _entity = lib.Entity(ss, legacySymbol.EntityID);
            else
                _entity = null;

            if (_entity != null && legacySymbol.EntityTypeID != "")
                _entityType = lib.EntityType(_entity, legacySymbol.EntityTypeID);
            else
                _entityType = null;

            if (_entityType != null && legacySymbol.EntitySubTypeID != "")
                _entitySubType = lib.EntitySubType(ss, _entityType, legacySymbol.EntitySubTypeID);
            else
                _entitySubType = null;

            if (legacySymbol.ModifierOneID != "")
                _modifier1 = lib.ModifierOne(ss, legacySymbol.ModifierOneID);
            else
                _modifier1 = null;

            if (legacySymbol.ModifierTwoID != "")
                _modifier2 = lib.ModifierTwo(ss, legacySymbol.ModifierTwoID);
            else
                _modifier2 = null;

            result = _entityExport.NameIt(null, ss, _entity, _entityType, _entitySubType);

            if (_modifier1 != null && _modifier1.Label != "Unspecified" && _modifier1.Label != "Not Applicable")
                result = result + _configHelper.DomainSeparator + _modifierExport.NameIt(ss, "1", _modifier1);

            if (_modifier2 != null && _modifier2.Label != "Unspecified" && _modifier2.Label != "Not Applicable")
                result = result + _configHelper.DomainSeparator + _modifierExport.NameIt(ss, "2", _modifier2);

            return result;
        }
        protected string BuildModifierItemTags(SymbolSet ss, 
                                               string modNumber, 
                                               ModifiersTypeModifier m, 
                                               bool omitSource,
                                               bool omitLegacy)
        {
            // Constructs a string of semicolon delimited tags that users can utilize to search
            // for or find a given symbol.

            // The information concatenated together for this comes from a given SymbolSet and
            // modifier.  Information includes the Label attributes, geometry
            // type, location of the original graphic file, the code, etc.

            string path = "";
            string typ = "";
            string result = ss.Label.Replace(',', '-');

            result = result + ";" + "Modifier " + modNumber;
            result = result + ";" + m.Label.Replace(',', '-');

            switch (modNumber)
            {
                case "1":
                    path = _configHelper.GetPath(ss.ID, FindEnum.FindModifierOnes, true);
                    typ = "MOD1";
                    break;
                case "2":
                    path = _configHelper.GetPath(ss.ID, FindEnum.FindModifierTwos, true);
                    typ = "MOD2";
                    break;
            }

            result = result + ";" + typ;

            if(!omitLegacy)
                result = result + ";" + _configHelper.SIDCIsNA ;

            if(!omitSource)
                result = result + ";" + path + "\\" + m.Graphic;

            result = result + ";Point";
            result = result + ";" + BuildModifierItemName(ss, modNumber, m);
            result = result + ";" + BuildModifierCode(ss, modNumber, m);

            return result;
        }