private void InitPositionData() { CheckItems.Clear(); CheckItemModel mdl = new CheckItemModel() { ItemName = "P01", IsChecked = false }; CheckItemModel mdl2 = new CheckItemModel() { ItemName = "P02", IsChecked = false }; CheckItemModel mdl3 = new CheckItemModel() { ItemName = "P03", IsChecked = false }; CheckItemModel mdl4 = new CheckItemModel() { ItemName = "P04", IsChecked = false }; CheckItems.Add(mdl); CheckItems.Add(mdl2); CheckItems.Add(mdl3); CheckItems.Add(mdl4); }
private void LoadCheckItems() { CheckItems.Clear(); CheckItemCount = 0; IFeatureWorkspace ws = Util.ServerWorkspace as IFeatureWorkspace; IDataset ds = ws as IDataset; List <String> fcNames = new List <string>(); GetAllFeatureClassNames(ds, ref fcNames); foreach (string fcname in fcNames) { List <int> ids = new List <int>(); IFeatureClass fc = ws.OpenFeatureClass(fcname); IQueryFilter filter = new QueryFilterClass(); filter.WhereClause = "[SyncStatus]='A' OR [SyncStatus]='U'"; IFeatureCursor cur = fc.Search(filter, false); IFeature fea = cur.NextFeature(); while (fea != null) { ids.Add(fea.OID); fea = cur.NextFeature(); } if (ids.Count > 0) { CheckItems.Add(fcname, ids); CheckItemCount += ids.Count; } } }
private void InitTowerData() { CheckItems.Clear(); CheckItemModel mdl = new CheckItemModel() { ItemName = "进港", IsChecked = false }; CheckItemModel mdl2 = new CheckItemModel() { ItemName = "离港", IsChecked = false }; CheckItemModel mdl3 = new CheckItemModel() { ItemName = "训练", IsChecked = false }; CheckItemModel mdl4 = new CheckItemModel() { ItemName = "飞跃", IsChecked = false }; CheckItems.Add(mdl); CheckItems.Add(mdl2); CheckItems.Add(mdl3); CheckItems.Add(mdl4); }
private void LoadCheckItems(string taskName, bool isPartial) { CheckItems.Clear(); CheckItemCount = 0; IFeatureWorkspace ws = Util.ServerWorkspace as IFeatureWorkspace; IWorkspace2 ws2 = ws as IWorkspace2; if (isPartial) { //Check point items IFeatureClass fc = ws.OpenFeatureClass("CheckItemPtn"); IQueryFilter filter = new QueryFilterClass(); filter.WhereClause = "VersionName ='" + taskName + "'"; IFeatureCursor cur = fc.Search(filter, false); IFeature fea = cur.NextFeature(); while (fea != null) { string fc_name = fea.get_Value(fc.FindField("FeatureClassName")) as string; int fc_id = (int)fea.get_Value(fc.FindField("FeatureID")); if (CheckItems.ContainsKey(fc_name)) { List <int> ids; CheckItems.TryGetValue(fc_name, out ids); ids.Add(fc_id); CheckItems[fc_name] = ids; } else { List <int> ids = new List <int>(); ids.Add(fc_id); CheckItems.Add(fc_name, ids); } CheckItemCount++; fea = cur.NextFeature(); } //Check line items fc = ws.OpenFeatureClass("CheckItemLn"); cur = fc.Search(filter, false); fea = cur.NextFeature(); while (fea != null) { string fc_name = fea.get_Value(fc.FindField("FeatureClassName")) as string; int fc_id = (int)fea.get_Value(fc.FindField("FeatureID")); if (CheckItems.ContainsKey(fc_name)) { List <int> ids; CheckItems.TryGetValue(fc_name, out ids); ids.Add(fc_id); CheckItems[fc_name] = ids; } else { List <int> ids = new List <int>(); ids.Add(fc_id); CheckItems.Add(fc_name, ids); } CheckItemCount++; fea = cur.NextFeature(); } //Check polygon items fc = ws.OpenFeatureClass("CheckItemPoly"); cur = fc.Search(filter, false); fea = cur.NextFeature(); while (fea != null) { string fc_name = fea.get_Value(fc.FindField("FeatureClassName")) as string; int fc_id = (int)fea.get_Value(fc.FindField("FeatureID")); if (CheckItems.ContainsKey(fc_name)) { List <int> ids; CheckItems.TryGetValue(fc_name, out ids); ids.Add(fc_id); CheckItems[fc_name] = ids; } else { List <int> ids = new List <int>(); ids.Add(fc_id); CheckItems.Add(fc_name, ids); } CheckItemCount++; fea = cur.NextFeature(); } } else { HashSet <string> targets = new HashSet <string>(); foreach (BaseChecker checker in Checkers) { targets.Add(checker.GetCheckingTarget()); } TaskManager tm = TaskManager.GetInstance(); IPolygon area = tm.GetTaskLocation(taskName); ISpatialFilter filter = new SpatialFilter(); filter.Geometry = area; //filter.GeometryField = "Shape"; filter.SubFields = ""; filter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; foreach (string target in targets) { if (!ws2.get_NameExists(esriDatasetType.esriDTFeatureClass, target)) { continue; } IFeatureClass fc = ws.OpenFeatureClass(target); IFeatureCursor cur = fc.Search(filter, true); IFeature fea = cur.NextFeature(); while (fea != null) { int fc_id = fea.OID; if (CheckItems.ContainsKey(target)) { List <int> ids; CheckItems.TryGetValue(target, out ids); ids.Add(fc_id); CheckItems[target] = ids; } else { List <int> ids = new List <int>(); ids.Add(fc_id); CheckItems.Add(target, ids); } CheckItemCount++; fea = cur.NextFeature(); } } } }