void _ReadSLType( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLBaseType"]; Dictionary<int, SLBaseType> slBaseTypes = new Dictionary<int, SLBaseType>(); if (table != null) { foreach (DataRow reader in table.Rows) { if (IsDbNull(reader, "SLBaseTypeID")) continue; SLBaseType type = new SLBaseType(); type.id = ReadInt(reader, "SLBaseTypeID").Value; type.SLBaseTypeID = type.id; string category = ReadString(reader, "SLCategory"); if (category == "PrecastConcrete") type.SLCategory = SLCategoryEnum.PrecastConcrete; else if (category == "CastIron") type.SLCategory = SLCategoryEnum.CastIron; else if (category == "SteelPlate") type.SLCategory = SLCategoryEnum.SteelPlate; string shape = ReadString(reader, "SLShape"); if (shape == "Stright") type.SLShape = SLShapeEnum.Straight; else if (shape == "Tapered") type.SLShape = SLShapeEnum.Tapered; else if (shape == "Universal") type.SLShape = SLShapeEnum.Universal; type.NumberOfSegments = ReadInt(reader, "SLNumOfSegments").Value; type.Conicity = ReadDouble(reader, "SLConicity").Value; type.Thickness = ReadDouble(reader, "SLThickness").Value; type.Width = ReadDouble(reader, "SLWidth").Value; type.OuterDiameter = ReadDouble(reader, "SLOutDiameter").Value; type.InnerDiameter = ReadDouble(reader, "SLInnerDiameter").Value; type.TotalKeyPos = ReadInt(reader, "SLTotalKeyPos").Value; slBaseTypes[(int)type.SLBaseTypeID] = type; } table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLType"]; if (table != null) { foreach (DataRow reader in table.Rows) { if (IsDbNull(reader, "SLTypeID")) continue; SLType type = new SLType(reader); type.id = ReadInt(reader, "SLTypeID").Value; type.name = ReadString(reader, "SLTypeName"); type.SLBaseTypeID = ReadInt(reader, "SLBaseTypeID"); type.description = ReadString(reader, "SLTypeDescription"); type.Description_CN = ReadString(reader, "SLTypeDescription_CN"); if (type.SLBaseTypeID != null && slBaseTypes.ContainsKey((int)type.SLBaseTypeID)) { SLBaseType baseType = slBaseTypes[(int)type.SLBaseTypeID]; type.SLCategory = baseType.SLCategory; type.SLShape = baseType.SLShape; type.NumberOfSegments = baseType.NumberOfSegments; type.Conicity = baseType.Conicity; type.Thickness = baseType.Thickness; type.Width = baseType.Width; type.OuterDiameter = baseType.OuterDiameter; type.InnerDiameter = baseType.InnerDiameter; type.TotalKeyPos = baseType.TotalKeyPos; } objs[type.key] = type; } } table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "Segments"]; if (table != null) { Dictionary<int, List<Segment>> allSegments = new Dictionary<int, List<Segment>>(); List<Segment> segments; foreach (DataRow reader in table.Rows) { Segment seg = new Segment(); int i = 0; int SLBaseTypeID = ReadInt(reader, "SLBaseTypeID").Value; seg.StartAngle = ReadDouble(reader, "StartAngle").Value; seg.CentralAngle = ReadDouble(reader, "CentralAngle").Value; seg.Code = ReadString(reader, "Code"); if (allSegments.ContainsKey(SLBaseTypeID)) segments = allSegments[SLBaseTypeID]; else { segments = new List<Segment>(); allSegments[SLBaseTypeID] = segments; } segments.Add(seg); } foreach (var obj in objs.values) { SLType slType = obj as SLType; if (slType.SLBaseTypeID == null) continue; int SLBaseTypeID = (int)slType.SLBaseTypeID; if (allSegments.ContainsKey(SLBaseTypeID)) { segments = allSegments[SLBaseTypeID]; slType.Segments.AddRange(segments); } } } } }
public static ISymbol GetSegFillSymbol(Segment seg) { if (_segFillSymbols == null) { _segFillSymbols = new ISimpleFillSymbol[2]; ISimpleLineSymbol lineSymbol = GraphicsUtil.GetDefaultLineSymbol(); ISimpleFillSymbol symbol = Runtime.graphicEngine.newSimpleFillSymbol( Colors.Red, SimpleFillStyle.Solid, lineSymbol); _segFillSymbols[0] = symbol; symbol = Runtime.graphicEngine.newSimpleFillSymbol( Colors.Cyan, SimpleFillStyle.Solid, lineSymbol); _segFillSymbols[1] = symbol; } if (seg.Code.Contains("F") || seg.Code.Contains("K")) return _segFillSymbols[0]; else return _segFillSymbols[1]; }