public string GeometryIt(SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { string geo = ""; geo = GeometryIs(e, eType, eSubType); return geo; }
public string NameIt(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { string name = ""; if(ss != null && e != null) name = BuildEntityItemName(sig, ss, e, eType, eSubType); return name; }
public string CodeIt(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { string code = ""; if (ss != null); // && (e != null || (e == null && eType == null))) code = BuildEntityCode(sig, ss, e, eType, eSubType); return code; }
string IEntityExport.Line(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { string code = BuildEntityCode(null, null, e, eType, eSubType); return BuildEntityItemName(null, null, e, eType, eSubType) + "," + code; }
string IEntityExport.Line(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { GeometryType geoType = GeometryType.POINT; IconType icoType = IconType.MAIN; string result = Convert.ToString(ss.SymbolSetCode.DigitOne) + Convert.ToString(ss.SymbolSetCode.DigitTwo); string code = BuildEntityCode(sig, ss, e, eType, eSubType); // Remove the first two characters as this output does not require the symbol set code, and exclude any trailing underbar digit // Note that these code will not be unique, with the substring operation in place. code = code.Substring(2,6); result = result + ","; result = result + e.Label.Replace(',', '-'); geoType = e.GeometryType; icoType = e.Icon; result = result + ","; if (eType != null) { result = result + eType.Label.Replace(',', '-'); geoType = eType.GeometryType; icoType = eType.Icon; } result = result + ","; if (eSubType != null) { result = result + eSubType.Label.Replace(',', '-'); geoType = eSubType.GeometryType; icoType = eSubType.Icon; } if (sig != null) { result = result + "," + sig.Label; } else { result = result + ","; } result = result + "," + code + "," + _geometryList[(int)geoType]; result = result + "," + Convert.ToString(icoType) + "," + BuildEntityItemName(sig, ss, e, eType, eSubType); return result; }
protected string GeometryIs(SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { string geometry = _geometryList[0]; if(eSubType != null) geometry = _geometryList[(int)eSubType.GeometryType]; else if(eType != null) geometry = _geometryList[(int)eType.GeometryType]; else if(e != null) geometry = _geometryList[(int)e.GeometryType]; return geometry; }
protected string BuildEntityCode(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { // Constructs a string containing the symbol set and entity 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); } if (e == null && eType == null && eSubType != null) { // Deal with the special entity sub types as a special case code = code + eSubType.EntityCode + eSubType.EntityTypeCode + Convert.ToString(eSubType.EntitySubTypeCode.DigitOne) + Convert.ToString(eSubType.EntitySubTypeCode.DigitTwo); } else { // Almost everything is dealt with below code = code + Convert.ToString(e.EntityCode.DigitOne) + Convert.ToString(e.EntityCode.DigitTwo); if (eType != null) code = code + Convert.ToString(eType.EntityTypeCode.DigitOne) + Convert.ToString(eType.EntityTypeCode.DigitTwo); else code = code + "00"; if (eSubType != null) code = code + Convert.ToString(eSubType.EntitySubTypeCode.DigitOne) + Convert.ToString(eSubType.EntitySubTypeCode.DigitTwo); else code = code + "00"; } if (sig != null) { code = code + sig.GraphicSuffix; } return code; }
internal SymbolSetEntityEntityType EntityType(SymbolSetEntity entity, ushort entityTypeCodeOne, ushort entityTypeCodeTwo) { SymbolSetEntityEntityType retObj = null; if (entity != null) { if (entity.EntityTypes != null) { foreach (SymbolSetEntityEntityType lObj in entity.EntityTypes) { if (lObj.EntityTypeCode.DigitOne == entityTypeCodeOne && lObj.EntityTypeCode.DigitTwo == entityTypeCodeTwo) { return lObj; } } } } _statusFlag -= 4096; return retObj; }
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; }
string IEntityExport.Line(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { _notes = ""; string result = ""; string graphic = ""; IconType iType = IconType.MAIN; string graphicPath = _configHelper.GetPath(ss.ID, FindEnum.FindEntities); if (eSubType != null) { if (eSubType.Graphic != "" && eSubType.Icon != IconType.FULL_FRAME) graphic = eSubType.Graphic; else if (sig != null) { graphic = GrabGraphic(eSubType.CloverGraphic, eSubType.RectangleGraphic, eSubType.SquareGraphic, eSubType.DiamondGraphic, sig.GraphicSuffix); } iType = eSubType.Icon; } else if (eType != null) { if (eType.Graphic != "" && eType.Icon != IconType.FULL_FRAME) graphic = eType.Graphic; else if (sig != null) { graphic = GrabGraphic(eType.CloverGraphic, eType.RectangleGraphic, eType.SquareGraphic, eType.DiamondGraphic, sig.GraphicSuffix); } iType = eType.Icon; } else if (e != null) { if (e.Graphic != "" && e.Icon != IconType.FULL_FRAME) graphic = e.Graphic; else if (sig != null) { graphic = GrabGraphic(e.CloverGraphic, e.RectangleGraphic, e.SquareGraphic, e.DiamondGraphic, sig.GraphicSuffix); } iType = e.Icon; } // Suppressed as considered redundant information //if (iType == IconType.NA) // _notes = _notes + "icon is NA - entity is never to be drawn;"; //else if(iType != IconType.MAIN) // _notes = _notes + "icon is " + Convert.ToString(iType) + ";"; 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 = BuildEntityItemName(sig, ss, e, eType, eSubType); string itemTags = BuildEntityItemTags(sig, ss, e, eType, eSubType, _omitSource, _omitLegacy); string itemID = BuildEntityCode(sig, ss, e, eType, eSubType); string itemGeometry = GeometryIs(e, eType, eSubType); string itemCategory = BuildEntityItemCategory(ss, iType, itemGeometry); result = itemRootedPath + "," + Convert.ToString(_configHelper.PointSize) + "," + itemName + "," + itemCategory + "," + itemTags + "," + itemID + "," + itemGeometry + "," + _notes; return result; }
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(); }
protected string BuildEntityItemTags(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType, 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 // entity (type and sub type). Information includes the Label attributes, geometry // type, location of the original graphic file, the code, etc. string result = ss.Label.Replace(',', '-'); string graphic = ""; string geometry = ""; string iType = "NO_ICON"; string[] xmlTags = null; if (e == null && eType == null && eSubType != null) { result = result + ";" + "Special Entity Subtypes"; } if(e != null) { result = result + ";" + e.Label.Replace(',', '-'); iType = Convert.ToString(e.Icon); } if (eType != null) { result = result + ";" + eType.Label.Replace(',', '-'); iType = Convert.ToString(eType.Icon); } if (eSubType != null) { result = result + ";" + eSubType.Label.Replace(',', '-'); iType = Convert.ToString(eSubType.Icon); // Add the type of geometry geometry = _geometryList[(int)eSubType.GeometryType]; if (eSubType.Icon == IconType.FULL_FRAME) { if (sig != null) { graphic = GrabGraphic(eSubType.CloverGraphic, eSubType.RectangleGraphic, eSubType.SquareGraphic, eSubType.DiamondGraphic, sig.GraphicSuffix); } _notes = _notes + "icon touches frame;"; } else if (eSubType.Icon == IconType.NA) graphic = ""; else graphic = eSubType.Graphic; // Grab any custom XML tags that might exist xmlTags = eSubType.Tags; } else if(eType != null) { // Add the type of geometry geometry = _geometryList[(int)eType.GeometryType]; if (eType.Icon == IconType.FULL_FRAME) { if (sig != null) { graphic = GrabGraphic(eType.CloverGraphic, eType.RectangleGraphic, eType.SquareGraphic, eType.DiamondGraphic, sig.GraphicSuffix); } _notes = _notes + "icon touches frame;"; } else if (eType.Icon == IconType.NA) graphic = ""; else graphic = eType.Graphic; // Grab any custom XML tags that might exist xmlTags = eType.Tags; } else if(e != null) { // Add the type of geometry geometry = _geometryList[(int)e.GeometryType]; if (e.Icon == IconType.FULL_FRAME) { if (sig != null) { graphic = GrabGraphic(e.CloverGraphic, e.RectangleGraphic, e.SquareGraphic, e.DiamondGraphic, sig.GraphicSuffix); } _notes = _notes + "icon touches frame;"; } else if (e.Icon == IconType.NA) graphic = ""; else graphic = e.Graphic; // Grab any custom XML tags that might exist xmlTags = e.Tags; } // Create the unique ID/code for this object string code = BuildEntityCode(sig, ss, e, eType, eSubType); // 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, code, xmlTags); // Add an equivalent 2525C SIDC tag, if one exists if (!omitLegacy) { string sidcTag = BuildLegacySIDCTag(sig, ss, e, eType, eSubType); if (sidcTag != "") result = result + ";" + sidcTag; } // Add the icon's type result = result + ";" + iType; // Add the svg source if (!omitSource) result = result + ";" + _configHelper.GetPath(ss.ID, FindEnum.FindEntities, true) + "\\" + graphic; // Add the three most important pieces of information result = result + ";" + geometry; result = result + ";" + BuildEntityItemName(sig, ss, e, eType, eSubType); result = result + ";" + code; 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; }
protected string BuildEntityItemName(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { // Constructs a string containing the name of an entity, where each label value // is seperated by a DomainSeparator (usually a colon). Builds this for each group // of related SymbolSet and entity. string result = ""; if (e == null && eType == null && eSubType != null) { result = "Special Entity Subtypes" + _configHelper.DomainSeparator + eSubType.Label.Replace(',', '-'); } else { result = (e.LabelAlias == "") ? e.Label : e.LabelAlias; if (eType != null) { string eTypeLabel = (eType.LabelAlias == "") ? eType.Label : eType.LabelAlias; result = result + _configHelper.DomainSeparator + eTypeLabel.Replace(',', '-'); } if (eSubType != null) { string eSubTypeLabel = (eSubType.LabelAlias == "") ? eSubType.Label : eSubType.LabelAlias; result = result + _configHelper.DomainSeparator + eSubTypeLabel.Replace(',', '-'); } } if (sig != null) { result = result + _configHelper.DomainSeparator + sig.Label; } return result; }
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; }
internal SymbolSetEntityEntityType EntityType(SymbolSetEntity entity, string entityTypeID) { SymbolSetEntityEntityType retObj = null; if (entity != null) { if (entity.EntityTypes != null) { foreach (SymbolSetEntityEntityType lObj in entity.EntityTypes) { if (lObj.ID == entityTypeID) { return lObj; } } } } _statusFlag -= 4096; return retObj; }
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; }
protected string BuildLegacySIDCTag(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { string result = _configHelper.SIDCIsNew; if(ss != null && e != null) { uint partA = 1000000000 + (ss.SymbolSetCode.DigitOne * (uint)100000) + (ss.SymbolSetCode.DigitTwo * (uint)10000); if (sig != null) { partA = partA + (sig.StandardIdentityGroupCode * (uint)1000000); } uint partB = (e.EntityCode.DigitOne * (uint)1000000000) + (e.EntityCode.DigitTwo * (uint)100000000); if (eType != null) { partB = partB + (eType.EntityTypeCode.DigitOne * (uint)10000000) + (eType.EntityTypeCode.DigitTwo * (uint)1000000); } if (eSubType != null) { partB = partB + (eSubType.EntitySubTypeCode.DigitOne * (uint)100000) + (eSubType.EntitySubTypeCode.DigitTwo * (uint)10000); } Symbol symbol = _configHelper.Librarian.MakeSymbol(new SIDC(partA, partB)); // // If the symbol has a 2525C equivalent, return it // if (symbol != null) { if (symbol.SymbolStatus == SymbolStatusEnum.statusEnumOld) { result = symbol.LegacySIDC; if (sig == null && result.Substring(1, 1) == "P") { result = result.Substring(0, 1) + "*" + result.Substring(2); } if (result.Substring(14, 1) == "X") result = result.Substring(0, 10) + "****X"; else if (result.Substring(0, 1) == "W") result = result.Substring(0, 13) + "**"; else if (result.Substring(10, 5) == "-----") result = result.Substring(0, 10) + "*****"; else if (result.Substring(11, 4) == "----") result = result.Substring(0, 11) + "****"; } } else { logger.Warn("Symbol could not be built from: " + partA + ":" + partB); } } return result; }
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(); }
protected string BuildQuotedEntityCode(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType) { // Constructs a quoted string containing the symbol set and entity codes for a given // set of those objects. string code = '"' + this.BuildEntityCode(sig, ss, e, eType, eSubType) + '"'; return code; }