private static IEnumerable <RadarRegionInfo> getRegions(SqlConnection con) { string sqlCmd = "select * from [DBT_FEATURE] where Type='LDZBQ'or Type='LDBWDQ'"; using (SqlDataAdapter sda = new SqlDataAdapter(sqlCmd, con)) { DataTable dt = new DataTable(); sda.Fill(dt); foreach (DataRow dr in dt.Rows) { string shape = dr["Shape"] as string; string name = dr["Name"] as string; string type = dr["Type"] as string; if (shape != null && name != null && type != null) { GeoAreaShape gas = null; try { gas = GeometryShape.Parse(shape) as GeoAreaShape; } catch { gas = null; } if (gas != null && gas.Polygon.Points.Count > 0) { string relatedRadar = string.Empty; object idObj = dr["Id"]; if (idObj is int) { relatedRadar = getRelatedRadar(con, (int)idObj); } RadarRegion region = new RadarRegion(); region.Name = name; region.Polygon = gas.Polygon.Points[0].Points.Select(pt => new Seecool.Radar.Unit.PointD(pt.X, pt.Y)).ToArray(); region.IsMask = type.ToUpper() == "LDZBQ"; region.ManualIdenfity = type.ToUpper() == "LDBWDQ"; yield return(new RadarRegionInfo(region, relatedRadar)); } } } } }
private List <CompactFeatureObj> updateResult(List <tagFEATURE> list) { List <CompactFeatureObj> result = new List <CompactFeatureObj>(); for (int i = 0; i < list.Count; i++) { tagFEATURE feature = list[i]; GeometryShape geoShape = null; if ((feature.PRIM == GeoPrimitiveType.Point || feature.PRIM == GeoPrimitiveType.Text) && feature.SG2D != null) { geoShape = new GeoPointShape(feature.SG2D.Points[0].X, feature.SG2D.Points[0].Y); } else if (feature.PRIM == GeoPrimitiveType.Line && feature.SG2D != null) { geoShape = new GeoLineShape(feature.SG2D); } else if (feature.PRIM == GeoPrimitiveType.Area && feature.Area != null) { geoShape = new GeoAreaShape(feature.Area); } if (geoShape != null && _locator.Rect.IntersectsWith(geoShape.Bounds)) { string name = string.Empty; string[] names = feature.GetAttribute(S57AttributeType.NOBJNM); if (names != null && names.Length > 0) { name = names[0]; } string fileName = feature.File.Header.FileName; int tempIndex = fileName.LastIndexOf('\\') + 1; CompactFeatureObj obj = new CompactFeatureObj(string.Empty, name, string.Empty, geoShape, fileName.Substring(tempIndex, fileName.LastIndexOf('.') - tempIndex), feature.OBJL.ToString()); result.Add(obj); setAttribute(feature, obj); } } return(result); }