public static IWorkspace SwitchVersionWorkspace(IWorkspace pWS, string sVersion, string sPws) { string str = pWS.ConnectionProperties.GetProperty("Server").ToString(); string str1 = pWS.ConnectionProperties.GetProperty("Instance").ToString(); string str2 = pWS.ConnectionProperties.GetProperty("User").ToString(); return(WorkspaceHelper.GetSDEWorkspace(str, str1, str2, sPws, sVersion)); }
private void SearchLayer(ILayer pSubLayer, XmlLocator locator, string searchKey) { if (_searchCount > _context.Config.LocatorMaxCount) { return; } IQueryFilter queryFilter = new QueryFilter(); IFeatureClass pClass = ((IFeatureLayer)pSubLayer).FeatureClass; string likeStr = WorkspaceHelper.GetSpecialCharacter(pClass as IDataset, esriSQLSpecialCharacters.esriSQL_WildcardManyMatch); if (!string.IsNullOrEmpty(searchKey)) { queryFilter.WhereClause = BuildWhereClause(locator.SearchFields, searchKey, likeStr); } IFeatureCursor cursor = pClass.Search(queryFilter, false); IFeature pFeature = cursor.NextFeature(); int nameIdx = GetFieldIdx(cursor, locator.NameField); int addIdx = GetFieldIdx(cursor, locator.AddressField); int descIdx = GetFieldIdx(cursor, locator.DescriptionField); int telIdx = GetFieldIdx(cursor, locator.TelephoneField); int emailIdx = GetFieldIdx(cursor, locator.EmailField); int phoIdx = GetFieldIdx(cursor, locator.PhotoField); while (pFeature != null) { IGeometry pGeometry = pFeature.Shape; if (pGeometry.IsEmpty) { pFeature = cursor.NextFeature(); continue; } DataRow row = _dataTable.NewRow(); row["图层"] = pSubLayer.Name; row["序号"] = pFeature.OID; row["名称"] = nameIdx < 0 ? "" : pFeature.get_Value(nameIdx); row["地址"] = addIdx < 0 ? "" : pFeature.get_Value(addIdx); row["说明"] = descIdx < 0 ? "" : pFeature.get_Value(descIdx); row["电话"] = telIdx < 0 ? "" : pFeature.get_Value(telIdx); row["邮箱"] = emailIdx < 0 ? "" : pFeature.get_Value(emailIdx); row["要素"] = pFeature.Shape; row["照片"] = phoIdx < 0 ? null : pFeature.get_Value(phoIdx); _dataTable.Rows.Add(row); _searchCount++; if (_searchCount > _context.Config.LocatorMaxCount) { break; } pFeature = cursor.NextFeature(); } OtherHelper.ReleaseObject(cursor); }
private void FillIndexMap() { txtName.Text = _indexMap.Name; txtLayer.Text = _indexMap.IndexLayerName; txtLayer.Tag = _indexMap.WorkspaceName; if (string.IsNullOrEmpty(_indexMap.IndexLayerName)) { return; } IFeatureClass fClass = WorkspaceHelper.GetFeatureClass(_indexMap.WorkspaceName, _indexMap.IndexLayerName); cmbNameField.EditValue = _indexMap.NameField; cmbTemplate.EditValue = _indexMap.TemplateName; if (string.IsNullOrEmpty(_indexMap.SearchFields)) { string[] sFlds = _indexMap.SearchFields.Split(','); for (int i = 0; i < sFlds.Length; i++) { int idx = chkQueryFields.Items.IndexOf(sFlds[i]); chkQueryFields.SetItemChecked(idx, true); } } }
public static List <string> QueryFeatureClassName(IWorkspace pWorkspace, bool pUpperCase) { return(WorkspaceHelper.QueryFeatureClassName(pWorkspace, pUpperCase, false)); }
public static IVersion GetVersion(IWorkspace pWS, string sVersionName, string sPws) { pWS = WorkspaceHelper.SwitchVersionWorkspace(pWS, sVersionName, sPws); return(pWS as IVersionedWorkspace as IVersion); }