当前位置: 首页>>代码示例>>C#>>正文


C# QueryFilterClass类代码示例

本文整理汇总了C#中QueryFilterClass的典型用法代码示例。如果您正苦于以下问题:C# QueryFilterClass类的具体用法?C# QueryFilterClass怎么用?C# QueryFilterClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


QueryFilterClass类属于命名空间,在下文中一共展示了QueryFilterClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddFeaturesToSelection

 public static void AddFeaturesToSelection(IFeatureLayer featureLayer, int[] oids, string whereClause)
 {
     if (featureLayer != null && oids != null)
     {
         try
         {
             IFeatureClass featureClass = featureLayer.FeatureClass;
             IFeatureSelection featureSelection = featureLayer as IFeatureSelection;
             if (featureSelection != null && featureClass != null && oids.Length > 0)
             {
                 IWorkspace workspace = DisplayMap.GetWorkspaceFromClass(featureClass);
                 if (workspace != null)
                 {
                     IQueryFilter2 queryFilter = new QueryFilterClass();
                     queryFilter.WhereClause = featureClass.OIDFieldName + " < 0";
                     ISelectionSet selectionSet = featureClass.Select(queryFilter, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, workspace);
                     selectionSet.AddList(oids.Length, ref oids[0]);
                     queryFilter = new QueryFilterClass();
                     if (string.IsNullOrEmpty(whereClause) == false)
                     {
                         queryFilter.WhereClause = whereClause;
                         selectionSet = selectionSet.Select(queryFilter, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, workspace);
                     }
                     featureSelection.SelectionSet = selectionSet;
                 }
             }
         }
         catch { }
     }
 }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:30,代码来源:DisplayMap.cs

示例2: AddNotes

        public void AddNotes(string SqlWhereClause = null)
        {
            int idFld = m_NotesTable.FindField("Notes_ID");
            int ownerFld = m_NotesTable.FindField("OwnerID");
            int typeFld = m_NotesTable.FindField("Type");
            int notesFld = m_NotesTable.FindField("Notes");
            int dsFld = m_NotesTable.FindField("DataSourceID");

            ICursor theCursor;

            if (SqlWhereClause == null) { theCursor = m_NotesTable.Search(null, false); }
            else
            {
                IQueryFilter QF = new QueryFilterClass();
                QF.WhereClause = SqlWhereClause;
                theCursor = m_NotesTable.Search(QF, false);
            }

            IRow theRow = theCursor.NextRow();

            while (theRow != null)
            {
                Note anNote = new Note();
                anNote.Notes_ID = theRow.get_Value(idFld).ToString();
                anNote.OwnerID = theRow.get_Value(ownerFld).ToString();
                anNote.Notes = theRow.get_Value(notesFld).ToString();
                anNote.Type = theRow.get_Value(typeFld).ToString();
                anNote.DataSourceID = theRow.get_Value(dsFld).ToString();
                anNote.RequiresUpdate = true;

                m_NotesDictionary.Add(anNote.Notes_ID, anNote);

                theRow = theCursor.NextRow();
            }
        }
开发者ID:genhan2011,项目名称:ncgmp-toolbar,代码行数:35,代码来源:NotesAccess.cs

示例3: AddGlossary

        public void AddGlossary(string SqlWhereClause)
        {
            int idFld = m_GlossaryTable.FindField("Glossary_ID");
            int trmFld = m_GlossaryTable.FindField("Term");
            int defFld = m_GlossaryTable.FindField("Definition");
            int dsFld = m_GlossaryTable.FindField("DefinitionSourceID");

            IQueryFilter QF = new QueryFilterClass();
            QF.WhereClause = SqlWhereClause;

            ICursor theCursor = m_GlossaryTable.Search(QF, false);
            IRow theRow = theCursor.NextRow();

            while (theRow != null)
            {
                Glossary anGlossary = new Glossary();
                anGlossary.Glossary_ID = theRow.get_Value(idFld).ToString();
                anGlossary.Term = theRow.get_Value(trmFld).ToString();
                anGlossary.Definition = theRow.get_Value(trmFld).ToString();
                anGlossary.DefinitionSourceID = theRow.get_Value(dsFld).ToString();
                anGlossary.RequiresUpdate = true;

                m_GlossaryDictionary.Add(anGlossary.Glossary_ID, anGlossary);

                theRow = theCursor.NextRow();
            }
        }
开发者ID:genhan2011,项目名称:ncgmp-toolbar,代码行数:27,代码来源:GlossaryAccess.cs

示例4: AddDataSources

        // The AddDatasources method adds Datasource structures to the collection, based on a query defined by input parameters.
        public void AddDataSources(string SqlWhereClause)
        {
            // Get m_identifier indexes outside the loop for better performance
            int idFld = m_DataSourcesTable.FindField("DataSources_ID");
            int sourceFld = m_DataSourcesTable.FindField("Source");
            int notesFld = m_DataSourcesTable.FindField("Notes");

            // Setup the query
            IQueryFilter QF = new QueryFilterClass();
            QF.WhereClause = SqlWhereClause;

            // Perform the search, and grab the first returned row
            ICursor theCursor = m_DataSourcesTable.Search(QF,false);
            IRow theRow = theCursor.NextRow();

            // Loop through the returned rows until you're all done.
            while (theRow != null)
            {
                // Populate a DataSource Structure
                Datasource aDataSource = new Datasource();
                aDataSource.DataSources_ID = theRow.get_Value(idFld).ToString();
                aDataSource.Source = theRow.get_Value(sourceFld).ToString();
                aDataSource.Notes = theRow.get_Value(notesFld).ToString();
                aDataSource.RequiresUpdate = true;

                // Add the Structure to the dictionary
                m_dataSourceDictionary.Add(aDataSource.DataSources_ID, aDataSource);

                // Increment to the next returned DataSource
                theRow = theCursor.NextRow();
            }
        }
开发者ID:genhan2011,项目名称:ncgmp-toolbar,代码行数:33,代码来源:DataSourcesAccess.cs

示例5: Execute

        protected override void Execute()
        {
            var featureClass = FeatureWorkspace.OpenFeatureClass(Args.FeatureClass.Trim());

            var errors = ValidateFields(featureClass, Args.ReturnValues);

            if (errors.Any())
            {
                ErrorMessage = "{0} does not contain an attribute {1}. Check your spelling."
                    .With(Args.FeatureClass, string.Join(" or ", errors));

                return;
            }

            var filter = new QueryFilterClass
                {
                    WhereClause = Args.WhereClause
                };

            var fCursor = featureClass.Search(filter, true);

            var fields = featureClass.Fields;

            var container = AddResultsToContainer(fCursor, fields, Args.ReturnValues, Args.SpatialRefefence);

            Result = container;
        }
开发者ID:agrc,项目名称:api.mapserv.utah.gov,代码行数:27,代码来源:NonSpatialQueryCommand.cs

示例6: getQueryFilter

        public virtual IQueryFilter getQueryFilter(string[] values)
        {
            IQueryFilter qf = new QueryFilterClass();

            for (int ii = 0; ii < values.Length; ii++)
            {
                if (fields.Length > 1)
                {
                    string[] curr_values = values[ii].Split(';');

                    qf.WhereClause += " (";

                    for (int j = 0; j < fields.Length; j++)
                    {
                        qf.WhereClause = qf.WhereClause + fields[j] + "='" + curr_values[j].Trim() +"' ";

                        if (j < fields.Length - 1)
                        {
                            qf.WhereClause += " AND ";
                        }
                    }

                    qf.WhereClause += ") ";
                }
                else
                {
                    qf.WhereClause = qf.WhereClause + " " + fields[0] + "='" + values[ii] + "'";// +((ii <= (values.Length - 1)) ? "" : "OR ");
                }

                if (ii < (values.Length - 1))
                    qf.WhereClause += " OR ";
            }
            return qf;
        }
开发者ID:Georgia-Tech-Center-for-GIS,项目名称:GA-NWI,代码行数:34,代码来源:QueryHelperClasses.cs

示例7: CheckIFeatureSelection

 public void CheckIFeatureSelection()
 {
     IQueryFilter qf = new QueryFilterClass();
     qf.WhereClause = "";
     ISelectionSet ss = fc.Select(qf, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, ws);
     Assert.Greater(ss.Count, 0);
 }
开发者ID:BGCX261,项目名称:ziggis-svn-to-git,代码行数:7,代码来源:UnitTest.cs

示例8: AddDataSourcePolys

        public void AddDataSourcePolys(string SqlWhereClause)
        {
            int idFld = m_DataSourcePolysFC.FindField("DataSourcePolys_ID");
            int notesFld = m_DataSourcePolysFC.FindField("Notes");
            int dsFld = m_DataSourcePolysFC.FindField("DataSourceID");

            IQueryFilter QF = new QueryFilterClass();
            QF.WhereClause = SqlWhereClause;

            IFeatureCursor theCursor = m_DataSourcePolysFC.Search(QF, false);
            IFeature theFeature = theCursor.NextFeature();

            while (theFeature != null)
            {
                DataSourcePoly anDataSourcePoly = new DataSourcePoly();
                anDataSourcePoly.DataSourcePolys_ID = theFeature.get_Value(idFld).ToString();
                anDataSourcePoly.Notes = theFeature.get_Value(notesFld).ToString();
                anDataSourcePoly.DataSourceID = theFeature.get_Value(dsFld).ToString();
                anDataSourcePoly.Shape = (IPolygon)theFeature.Shape;
                anDataSourcePoly.RequiresUpdate = true;

                m_DataSourcePolysDictionary.Add(anDataSourcePoly.DataSourcePolys_ID, anDataSourcePoly);

                theFeature = theCursor.NextFeature();
            }

            System.Runtime.InteropServices.Marshal.ReleaseComObject(theCursor);
        }
开发者ID:chinasio,项目名称:azgs-toolbar,代码行数:28,代码来源:DataSourcePolysAccess.cs

示例9: AddOtherPolys

        public void AddOtherPolys(string SqlWhereClause)
        {
            int idFld = m_OtherPolysFC.FindField("OtherPolys_ID");
            int unitFld = m_OtherPolysFC.FindField("MapUnit");
            int idConfFld = m_OtherPolysFC.FindField("IdentityConfidence");
            int lblFld = m_OtherPolysFC.FindField("Label");
            int notesFld = m_OtherPolysFC.FindField("Notes");
            int dsFld = m_OtherPolysFC.FindField("DataSourceID");
            int symFld = m_OtherPolysFC.FindField("Symbol");

            IQueryFilter QF = new QueryFilterClass();
            QF.WhereClause = SqlWhereClause;

            IFeatureCursor theCursor = m_OtherPolysFC.Search(QF, false);
            IFeature theFeature = theCursor.NextFeature();

            while (theFeature != null)
            {
                OtherPoly anOtherPoly = new OtherPoly();
                anOtherPoly.OtherPolys_ID = theFeature.get_Value(idFld).ToString();
                anOtherPoly.MapUnit = theFeature.get_Value(unitFld).ToString();
                anOtherPoly.IdentityConfidence = theFeature.get_Value(idConfFld).ToString();
                anOtherPoly.Label = theFeature.get_Value(lblFld).ToString();
                anOtherPoly.Notes = theFeature.get_Value(notesFld).ToString();
                anOtherPoly.DataSourceID = theFeature.get_Value(dsFld).ToString();
                anOtherPoly.Symbol = theFeature.get_Value(symFld).ToString();
                anOtherPoly.Shape = (IPolygon)theFeature.Shape;
                anOtherPoly.RequiresUpdate = true;

                m_OtherPolysDictionary.Add(anOtherPoly.OtherPolys_ID, anOtherPoly);

                theFeature = theCursor.NextFeature();
            }
        }
开发者ID:chinasio,项目名称:azgs-toolbar,代码行数:34,代码来源:OtherPolysAccess.cs

示例10: GetUnByDataStatistics

 private string[] GetUnByDataStatistics(ILayer layer, String strField)
 {
     IFeatureLayer featureLayer = layer as IFeatureLayer;
     ILayerFields pLayerFields = featureLayer as ILayerFields;
     int nCount=pLayerFields.FieldCount;
     IQueryFilter queryFilter = new QueryFilterClass();
     queryFilter.SubFields = strField;
     IFeatureCursor featureCursor = featureLayer.FeatureClass.Search(queryFilter, true);
     IDataStatistics dataStatistics = new DataStatisticsClass();
     dataStatistics.Field = strField;
     dataStatistics.Cursor = featureCursor as ICursor;
     System.Collections.IEnumerator pEnumvar = dataStatistics.UniqueValues;
     int number = dataStatistics.UniqueValueCount;
     pEnumvar.Reset();
     object obj = null;
     pEnumvar.MoveNext();
     int i = 0;
     string[] str = new string[nCount];
     while (pEnumvar.MoveNext())
     {
         obj = pEnumvar.Current;
         str[i++] = obj.ToString();
     }
     return str;
 }
开发者ID:lovelll,项目名称:FeatureMerge,代码行数:25,代码来源:MainForm.cs

示例11: getDeletes

        // join edit with working?
        public IFeatureCursor getDeletes(string key)
        {
            // Used in commit action
            IFeatureClass fc = null;
            try
            {
                fc = this.transactionDB.OpenFeatureClass("E_" + key);
            }
            catch(Exception e)
            {
                MessageBox.Show("Edit Feature Class For E_" + key + " Not Found in Transaction",
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }

            IQueryFilter filter = new QueryFilterClass();
            filter.WhereClause = EDIT_STATE + " = '"+DEL+"'";

            IFeatureCursor r = null;
            try
            {
                r = fc.Search(filter, false);
            }
            finally
            {
                Utils.Release(filter);
            }
            return r;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:31,代码来源:EditsDAO.cs

示例12: Check

        public override bool Check(ref List<Error> checkResult)
        {
            //����Ӧ��featureclass
            ITable ipTable=null;
            ICursor ipCursor=null;
            try
            {
                IFeatureWorkspace ipFtWS;
                ipFtWS = (IFeatureWorkspace) m_QueryWorkspace;
                ipTable = ipFtWS.OpenTable(m_layerName);

                //ִ�в�ѯ����
                IQueryFilter pFilter = new QueryFilterClass();

                pFilter.WhereClause = ConstructClause();
                pFilter.SubFields = "OBJECTID,BSM";

                //���Ų�ѯ
                try
                {
                    ipCursor = ipTable.Search(pFilter, false);
                    if (ipCursor == null)
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {

                    SendMessage(enumMessageType.RuleError, "��ǰ�������ݿ��ͼ��" + m_layerName + "�У�SQL���" + pFilter.WhereClause + "�޷�ִ��!");
                    return false;
                }
                //����Ϊ�գ�����ʽ����ȷ
                if (ipCursor == null)
                {
                    return false;
                }
                checkResult = GetResult(ipCursor);

                return checkResult!=null;
            }
            catch
            {
                return false;
            }
            finally
            {
                if (ipCursor != null)
                {
                    Marshal.ReleaseComObject(ipCursor);
                    ipCursor = null;
                }
                if (ipTable != null)
                {
                    Marshal.ReleaseComObject(ipTable);
                    ipTable = null;
                }
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:59,代码来源:RuleInvalidVal.cs

示例13: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            if (axMapControl1.LayerCount > LayerCount)
            {
                axMapControl1.DeleteLayer(axMapControl1.LayerCount);
            }
            //if (textBox1.Text != "")
            //{
                List<IFeature> pFList = new List<IFeature>();
                //QI��FeatureSelection
                IFeatureSelection pFeatureSelection = pFeatureLayer as IFeatureSelection;
                //����������
                IQueryFilter pQueryFilter = new QueryFilterClass();
                //���ù���������IJ�ѯ����
                pQueryFilter.WhereClause = label4.Text + " like '%" + textBox1.Text + "%'";

                IFeatureCursor pFeatureCursor = pFeatureLayer.Search(pQueryFilter, false);
                IFeature pFeature = pFeatureCursor.NextFeature();
                while (pFeature != null)
                {
                    //��ȡҪ�ض���
                    pFList.Add(pFeature);
                    pFeature = pFeatureCursor.NextFeature();
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);

                if (pFList.Count > 0)
                {
                    dataGridView1.RowCount = pFList.Count + 1;
                    //���ñ߽���
                    dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Sunken;
                    //��������
                    dataGridView1.ColumnCount = pFList[0].Fields.FieldCount;
                    //������һ��Ҫ�ص��ֶ����ڸ���ͷ��ֵ���ֶε����ƣ�
                    for (int m = 0; m < pFList[0].Fields.FieldCount; m++)
                    {
                        dataGridView1.Columns[m].HeaderText = pFList[0].Fields.get_Field(m).AliasName;
                        if (pFList[0].Fields.get_Field(m).AliasName == label4.Text)
                        {
                            DisplayFiledNum = m;
                        }
                    }
                    //����Ҫ��
                    for (int i = 0; i < pFList.Count; i++)
                    {
                        pFeature = pFList[i];
                        for (int j = 0; j < pFeature.Fields.FieldCount; j++)
                        {
                            //����ֶ�ֵ
                            dataGridView1[j, i].Value = pFeature.get_Value(j).ToString();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("û���κ�����");
                }
            //}
        }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:59,代码来源:SearchKey.cs

示例14: Check

        public override bool Check(ref List<Error> checkResult)
        {
            IQueryFilter pQueryFilter = new QueryFilterClass();
            pQueryFilter.WhereClause = m_structPara.strWhereClause;
            //����������ѯ
            IFeatureCursor ipFeatCursor = pSrcFeatClass.Search(pQueryFilter, true);
            IFeature ipFeature = ipFeatCursor.NextFeature();
            IGeometryCollection pGeometryCollection = new GeometryBagClass();
            ///��ȡ�����������geometry
            while (ipFeature != null)
            {
                IGeometry ipGeometry = ipFeature.Shape;
                if (ipGeometry == null)
                {
                    ipFeature = ipFeatCursor.NextFeature();
                    continue;
                }
                object Missing = Type.Missing;
                pGeometryCollection.AddGeometry(ipGeometry, ref Missing, ref Missing);

                ipFeature = ipFeatCursor.NextFeature();
            }

            ISpatialIndex pSpatialIndex = (ISpatialIndex)pGeometryCollection;
            pSpatialIndex.AllowIndexing = true;
            pSpatialIndex.Invalidate();

            ///��������ͼ������ص��Ŀռ��ѯ
            ISpatialFilter pSpatialFilter = new SpatialFilterClass();
            pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelOverlaps;
            ///�����GeometryCollection����spatialfilter
            pSpatialFilter.Geometry = (IGeometry)pGeometryCollection;
            string Fields = "OBJECTID,Shape";
            pSpatialFilter.SubFields = Fields;

            IFeatureCursor ipResultFtCur = pRelFeatClass.Search(pSpatialFilter, true);

            //��������
            List<Error> pRuleResult = new List<Error>();
            AddResult(ref pRuleResult, ipResultFtCur);

            checkResult = pRuleResult;

            if (ipResultFtCur != null)
            {
                Marshal.ReleaseComObject(ipResultFtCur);
                ipResultFtCur = null;
            } if (pSrcFeatClass != null)
            {
                Marshal.ReleaseComObject(pSrcFeatClass);
                pSrcFeatClass = null;
            }
            if (pRelFeatClass != null)
            {
                Marshal.ReleaseComObject(pRelFeatClass);
                pRelFeatClass = null;
            }
            return true;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:59,代码来源:RuleConditionCoincide.cs

示例15: SelectLayerFeatures

 public static void SelectLayerFeatures(IFeatureLayer fealyr,string whereclause)
 {
     IFeatureSelection feaSelection = fealyr as IFeatureSelection;
     if(feaSelection!=null)
     {
         IQueryFilter queryFilter = new QueryFilterClass();
         queryFilter.WhereClause = whereclause;
         feaSelection.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
         feaSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
     }
 }
开发者ID:weigiser,项目名称:AOProjects,代码行数:11,代码来源:MapSelectionHelperClass.cs


注:本文中的QueryFilterClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。