private string _buildSIDCKey(SymbolSet ss, SymbolSetLegacySymbol legacySymbol)
        {
            // Builds a unique key from a select number of characters from an SIDC.
            // The pattern for this is:
            //
            // S-D-FFFFFF
            //
            // Where:
            //
            // S = Schema code
            // D = Dimension code
            // FFFFFF = Function code

            string result = "";

            LegacyFunctionCodeType functionCode = _configHelper.LegacyFunction(legacySymbol.LegacyFunctionCode, _standard);

            if (functionCode != null)
            {
                if (functionCode.SchemaOverride == "")
                {
                    LegacyLetterCodeType letterCode = _configHelper.LegacyLetter(ss.LegacyCodingSchemeCode, _standard);
                    if (letterCode != null)
                    {
                        result = letterCode.Value;
                    }
                }
                else
                {
                    result = functionCode.SchemaOverride;
                }

                result = result + "-";

                Librarian        lib       = _configHelper.Librarian;
                LibraryDimension dimension = lib.Dimension(ss.DimensionID);

                if (functionCode.DimensionOverride == "")
                {
                    LegacyLetterCodeType letterCode = _configHelper.LegacyLetter(dimension.LegacyDimensionCode, _standard);
                    if (letterCode != null)
                    {
                        result = result + letterCode.Value;
                    }
                }
                else
                {
                    result = result + functionCode.DimensionOverride;
                }

                result = result + "-";
                result = result + functionCode.Value;
            }

            return(result);
        }
        public LegacyFunctionCodeType LegacyFunction(LegacyFunctionCodeType[] functionArray, string standard)
        {
            // Retrieves and returns the first function code in the given array matching the given standard

            LegacyFunctionCodeType functionCode = null;

            foreach (LegacyFunctionCodeType functionCodeInArray in functionArray)
            {
                if (functionCodeInArray.Name == standard)
                {
                    functionCode = functionCodeInArray;
                    break;
                }
            }

            return(functionCode);
        }
        public string Line(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetLegacySymbol symbol, LegacyEntityType entity, LegacyFunctionCodeType code)
        {
            string result  = "";
            string graphic = "";

            _notes = "";

            string graphicPath = _configHelper.GetPath("JMSML_2525C", FindEnum.Find2525C);

            if (entity.Graphic != "" && entity.Icon != IconType.FULL_FRAME)
            {
                graphic = entity.Graphic;
            }
            else
            {
                graphic = GrabGraphic(entity.CloverGraphic, entity.RectangleGraphic, entity.SquareGraphic, entity.DiamondGraphic, sig.GraphicSuffix);
            }

            string id = graphic.Substring(0, graphic.Length - 4);;

            IconType iType        = entity.Icon;
            string   geometryType = GeometryIs(entity.GeometryType);

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

            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 + "," + BuildEntityItemCategory(ss, iType, geometryType);
            result = result + "," + BuildEntityItemTags(sig, ss, symbol, entity, code);
            result = result + "," + id;
            result = result + "," + geometryType;
            result = result + "," + _notes;

            return(result);
        }
Ejemplo n.º 4
0
        private string _BuildLegacySIDC(LegacyFunctionCodeType functionCode)
        {
            string result = "";

            if (_symbolSet != null && _affiliation != null && _dimension != null &&
                _status != null && _amplifierGroup != null && _amplifier != null && _context.ContextCode != 2)
            {
                if (_legacySymbol != null)
                {
                    // Schema
                    if (functionCode.SchemaOverride != "")
                    {
                        result = functionCode.SchemaOverride;
                    }
                    else
                    {
                        result = _symbolSet.LegacyCodingSchemeCode[0].Value;
                    }

                    // Standard Identity
                    if (functionCode.StandardIdentityOverride != "")
                    {
                        result = result + functionCode.StandardIdentityOverride;
                    }
                    else
                    {
                        result = result + _affiliation.LegacyStandardIdentityCode[0].Value;
                    }

                    // Dimension
                    if (functionCode.DimensionOverride != "")
                    {
                        result = result + functionCode.DimensionOverride;
                    }
                    else
                    {
                        result = result + _dimension.LegacyDimensionCode[0].Value;
                    }

                    // Status
                    if (functionCode.StatusOverride != "")
                    {
                        result = result + functionCode.StatusOverride;
                    }
                    else
                    {
                        result = result + _status.LegacyStatusCode[0].Value;
                    }

                    // Function
                    result = result + functionCode.Value;
                }
                else
                {
                    result = _symbolSet.LegacyCodingSchemeCode[0].Value +
                             _affiliation.LegacyStandardIdentityCode[0].Value +
                             _dimension.LegacyDimensionCode[0].Value +
                             _status.LegacyStatusCode[0].Value +
                             _blankLegacyFunction;
                }

                // HQTFFD
                if (functionCode.HQTFFDOverride != "")
                {
                    result = result + functionCode.HQTFFDOverride;
                }
                else
                {
                    result = result + _amplifierGroup.LegacyModifierCode[0].Value;
                }

                // Amplifier
                if (functionCode.AmplifierOverride != "")
                {
                    result = result + functionCode.AmplifierOverride;
                }
                else
                {
                    result = result + _amplifier.LegacyModifierCode[0].Value;
                }

                //Tail
                if (functionCode.TailOverride != "")
                {
                    result = result + functionCode.TailOverride;
                }
                else
                {
                    result = result + _blankLegacyTail;
                }
            }

            return(result);
        }
        public string Line(SymbolSet ss, SymbolSetLegacySymbol legacySymbol, LegacyEntityType legacyEntity, LegacyFunctionCodeType functionCode)
        {
            string result = "";

            string sidcKey = _buildSIDCKey(ss, legacySymbol, functionCode);

            bool   fullFrame       = (legacyEntity.Icon == IconType.FULL_FRAME);
            string fullFrameOutput = fullFrame ? "TRUE" : "";

            result = legacyEntity.Label;
            result = result + "," + sidcKey;
            result = result + "," + sidcKey;
            result = result + ",";
            result = result + ",";
            result = result + ",";
            result = result + "," + fullFrameOutput;
            result = result + "," + "Point"; // TODO : Handle this through a modernized form of GeometryIt
            result = result + ",";
            result = result + ",";
            result = result + ",";

            return(result);
        }
        public string Line(SymbolSet ss, SymbolSetLegacySymbol legacySymbol, LegacyFunctionCodeType functionCode)
        {
            string result = "";

            string name       = _buildName(ss, legacySymbol);
            string entityCode = "";
            string extraIcon  = "";

            // Special care is needed with special entity subtypes

            bool isEntitySubTypeSpecial = false;

            if (_entitySubType != null)
            {
                if (_configHelper.IsSpecialEntitySubtype(ss, _entitySubType))
                {
                    entityCode             = _entityExport.CodeIt(null, ss, _entity, _entityType, null);
                    extraIcon              = _entityExport.CodeIt(null, ss, null, null, _entitySubType);
                    isEntitySubTypeSpecial = true;
                }
                else
                {
                    entityCode = _entityExport.CodeIt(null, ss, _entity, _entityType, _entitySubType);
                }
            }
            else
            {
                entityCode = _entityExport.CodeIt(null, ss, _entity, _entityType, _entitySubType);
            }

            string mod1Code = "";
            string mod2Code = "";

            if (_modifier1 != null && _modifier1.Label != "Unspecified" && _modifier1.Label != "Not Applicable")
            {
                mod1Code = _modifierExport.CodeIt(ss, "1", _modifier1);
            }

            if (_modifier2 != null && _modifier2.Label != "Unspecified" && _modifier2.Label != "Not Applicable")
            {
                mod2Code = _modifierExport.CodeIt(ss, "2", _modifier2);
            }

            bool   fullFrame = false;
            string geometry  = _entityExport.GeometryIt(_entity, _entityType, _entitySubType);

            if (_entitySubType != null && !isEntitySubTypeSpecial)
            {
                fullFrame = _entitySubType.Icon == IconType.FULL_FRAME;
            }
            else if (_entityType != null)
            {
                fullFrame = _entityType.Icon == IconType.FULL_FRAME;
            }
            else if (_entity != null)
            {
                fullFrame = _entity.Icon == IconType.FULL_FRAME;
            }

            string fullFrameOutput = fullFrame ? "TRUE" : "";

            result = name;
            result = result + "," + _buildSIDCKey(ss, legacySymbol, functionCode); // + "LegacyKey";
            result = result + "," + entityCode;                                    // + "MainIcon";
            result = result + "," + mod1Code;                                      // + "Modifier1";
            result = result + "," + mod2Code;                                      // + "Modifier2";
            result = result + "," + extraIcon;                                     // + "ExtraIcon";
            result = result + "," + fullFrameOutput;                               // + "FullFrame";
            result = result + "," + geometry;                                      // + "GeometryType";
            result = result + ",";                                                 // + "Standard";
            result = result + ",";                                                 // + "Status";
            result = result + ",";                                                 // + "Notes";

            return(result);
        }
Ejemplo n.º 7
0
        private void _exportLegacyEntities(StreamWriter w, bool isFirst, string standard, long size)
        {
            LegacyEntityExport entityExport = new LegacyEntityExport(_helper, standard, size);

            if (isFirst)
            {
                string headers = entityExport.Headers;

                w.WriteLine(headers);
                w.Flush();
            }

            foreach (SymbolSet ss in _lib.SymbolSets)
            {
                // For each symbol set in JMSML...

                logger.Info("Exporting legacy entities for: " + ss.ID);

                try
                {
                    if (ss.LegacySymbols != null)
                    {
                        foreach (SymbolSetLegacySymbol legacySymbol in ss.LegacySymbols)
                        {
                            // For each legacy symbol in that symbol set...

                            if (legacySymbol.LegacyEntity != null)
                            {
                                foreach (LegacyEntityType legacyEntity in legacySymbol.LegacyEntity)
                                {
                                    // Get the list of Legacy Function IDs for the specified legacy version of the standard

                                    if (legacyEntity.LegacyFunctionCode != null)
                                    {
                                        LegacyFunctionCodeType functionCode = _helper.LegacyFunction(legacyEntity.LegacyFunctionCode, standard);

                                        string line = "";

                                        // If the icon is Full Frame then four lines need to be exported, to reflect the four icon shapes.
                                        // Else just write out one line for non-Full-Frame.

                                        if (legacyEntity.Icon == IconType.FULL_FRAME)
                                        {
                                            foreach (LibraryStandardIdentityGroup sig in _lib.Library.StandardIdentityGroups)
                                            {
                                                line = string.Format("{0}", entityExport.Line(sig, ss, legacySymbol, legacyEntity, functionCode));

                                                w.WriteLine(line);
                                                w.Flush();
                                            }
                                        }
                                        else
                                        {
                                            line = string.Format("{0}", entityExport.Line(null, ss, legacySymbol, legacyEntity, functionCode));

                                            w.WriteLine(line);
                                            w.Flush();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
        }
Ejemplo n.º 8
0
        protected string BuildEntityItemTags(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetLegacySymbol symbol, LegacyEntityType entity, LegacyFunctionCodeType code)
        {
            // Builds a list of seperated tag strings from information derived from the specified objects.
            // TODO: Normalize with similar code found in the preceding function.

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

            string name = entity.Label.Replace(',', '-');

            // Add the type of geometry

            string geometry = _geometryList[(int)entity.GeometryType];

            if (entity.Icon == IconType.FULL_FRAME)
            {
                if (sig != null)
                {
                    graphic = GrabGraphic(entity.CloverGraphic, entity.RectangleGraphic, entity.SquareGraphic, entity.DiamondGraphic, sig.GraphicSuffix);
                }

                _notes = _notes + "icon touches frame;";
            }
            else
            {
                graphic = entity.Graphic;
            }

            // Create the unique ID

            string id = graphic.Substring(0, graphic.Length - 4);

            // Grab any custom XML tags that might exist

            string[] xmlTags = entity.Tags;

            // Now build the string

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

            // If there is a standard identity group, add it

            if (sig != null)
            {
                result = result + ";" + sig.Label;
            }

            // Add any custom XML or export tags that might exist

            result = _configHelper.AddCustomTags(result, id, xmlTags);

            // Add the 15 character SIDC for the symbol

            result = result + ";" + symbol.Label;

            // Add the entity's type

            result = result + ";" + Convert.ToString(entity.Icon);

            // Add the three most important pieces of information

            result = result + ";" + geometry;
            result = result + ";" + name;
            result = result + ";" + id;

            if (result.Length > 255)
            {
                // Can't have a tag string greater than 255 in length.
                // Human interaction will be required to resolve these on a case by case basis.

                _notes = _notes + "styleItemTags > 255;";
            }

            return(result);
        }