• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# QueryFilterClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddDescriptionOfMapUnits

        public void AddDescriptionOfMapUnits(string SqlWhereClause = null)
        {
            int idFld = m_DescriptionOfMapUnitsTable.FindField("DescriptionOfMapUnits_ID");
            int unitFld = m_DescriptionOfMapUnitsTable.FindField("MapUnit");
            int nameFld = m_DescriptionOfMapUnitsTable.FindField("Name");
            int flNameFld = m_DescriptionOfMapUnitsTable.FindField("FullName");
            int lblFld = m_DescriptionOfMapUnitsTable.FindField("Label");
            int ageFld = m_DescriptionOfMapUnitsTable.FindField("Age");
            int descFld = m_DescriptionOfMapUnitsTable.FindField("Description");
            int hierFld = m_DescriptionOfMapUnitsTable.FindField("HierarchyKey");
            int styleFld = m_DescriptionOfMapUnitsTable.FindField("ParagraphStyle");
            int rgbFld = m_DescriptionOfMapUnitsTable.FindField("AreaFillRGB");
            int patFld = m_DescriptionOfMapUnitsTable.FindField("AreaFillPatternDescription");
            int dsFld = m_DescriptionOfMapUnitsTable.FindField("DescriptionSourceID");
            int glFld = m_DescriptionOfMapUnitsTable.FindField("GeneralLithologyTerm");
            int glConfFld = m_DescriptionOfMapUnitsTable.FindField("GeneralLithologyConfidence");

            ICursor theCursor;

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

            IRow theRow = theCursor.NextRow();

            while (theRow != null)
            {
                DescriptionOfMapUnit anDescriptionOfMapUnit = new DescriptionOfMapUnit();
                anDescriptionOfMapUnit.DescriptionOfMapUnits_ID = theRow.get_Value(idFld).ToString();
                anDescriptionOfMapUnit.MapUnit = theRow.get_Value(unitFld).ToString();
                anDescriptionOfMapUnit.Name = theRow.get_Value(nameFld).ToString();
                anDescriptionOfMapUnit.FullName = theRow.get_Value(flNameFld).ToString();
                anDescriptionOfMapUnit.Label = theRow.get_Value(lblFld).ToString();
                anDescriptionOfMapUnit.Age = theRow.get_Value(ageFld).ToString();
                anDescriptionOfMapUnit.Description = theRow.get_Value(descFld).ToString();
                anDescriptionOfMapUnit.HierarchyKey = theRow.get_Value(hierFld).ToString();
                anDescriptionOfMapUnit.ParagraphStyle = theRow.get_Value(styleFld).ToString();
                anDescriptionOfMapUnit.AreaFillRGB = theRow.get_Value(rgbFld).ToString();
                anDescriptionOfMapUnit.AreaFillPatternDescription = theRow.get_Value(patFld).ToString();
                anDescriptionOfMapUnit.DescriptionSourceID = theRow.get_Value(dsFld).ToString();
                anDescriptionOfMapUnit.GeneralLithologyTerm = theRow.get_Value(glFld).ToString();
                anDescriptionOfMapUnit.GeneralLithologyConfidence = theRow.get_Value(glConfFld).ToString();
                anDescriptionOfMapUnit.RequiresUpdate = true;

                m_DescriptionOfMapUnitsDictionary.Add(anDescriptionOfMapUnit.DescriptionOfMapUnits_ID, anDescriptionOfMapUnit);

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


示例17: AddField

        //添加字段并赋值
        private void AddField()
        {
            //添加温度字段
            string HighTemp = "HighTemperature";
            string LowTemp = "LowTemperature";
            IFeatureLayer lyrProVince = Utilities.GetLayerByName("省市", axMapControl1.Map) as IFeatureLayer;
            IFeatureClass ProClass = lyrProVince.FeatureClass; ;
            if (ProClass.Fields.FindField(HighTemp) < 0)
            {
                IField pField = new FieldClass();
                IFieldEdit pFieldEdit = pField as IFieldEdit;
                pFieldEdit.Name_2 = HighTemp;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
                IClass pClass = ProClass as IClass;
                pClass.AddField(pFieldEdit);
            }
            if (ProClass.Fields.FindField(LowTemp) < 0)
            {
                IField pField = new FieldClass();
                IFieldEdit pFieldEdit = pField as IFieldEdit;
                pFieldEdit.Name_2 = LowTemp;
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
                IClass pClass = ProClass as IClass;
                pClass.AddField(pFieldEdit);

            }
            //为字段赋值
            string[] provinces = new string[] { "黑龙江省", "内蒙古自治区", "新疆维吾尔自治区", "吉林省", "甘肃省", "河北省", "北京市", "山西省", "天津市", "陕西省", "宁夏回族自治区", "青海省", "辽宁省", "山东省", "西藏自治区", "河南省", "江苏省", "安徽省", "四川省", "湖北省", "重庆市", "上海市", "浙江省", "湖南省", "江西省", "云南省", "贵州省", "广西壮族自治区", "福建省", "台湾省", "海南省", "广东省", "香港特别行政区", "澳门" };
            TomorrowWeatherInfo weath;

            IFeatureCursor featCursor = null;
            IQueryFilter queryFilter = new QueryFilterClass();
            for (int i = 0; i < provinces.Length; i++)
            {
                string selCity = provinces[i];
                string whereClause = "[NAME] = '" + selCity + "'";
                queryFilter.WhereClause = whereClause;
                featCursor = ProClass.Search(queryFilter, false);
                IFeature pFeature = featCursor.NextFeature();
                string pcity = Utilities.getCity(selCity);
                weath = new TomorrowWeatherInfo(pcity);

                Random random=new Random();//测试用随机数产生器
                if (pFeature != null)
                {
                    pFeature.set_Value(pFeature.Fields.FindField("HighTemperature"), random.Next(20,40));
                    pFeature.set_Value(pFeature.Fields.FindField("LowTemperature"), random.Next(1,20));
                    pFeature.Store();
                }
            }
            IGeoFeatureLayer geoProVince = Utilities.GetLayerByName("省市", axMapControl1.Map) as IGeoFeatureLayer;
            setColor(geoProVince);
        }
开发者ID:cwtok123,项目名称:ArcEngine,代码行数:54,代码来源:Form1.cs


示例18: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     string connStr = cmbCon.Text;
     if (connStr != "" && connStr != null)
     {
         IQueryFilter qf = new QueryFilterClass();
         qf.WhereClause = "CONNECTION = '" + cmbCon.Text + "'";
         msUtil.removeExistingRecords(msUtil.ConnectionsTable, qf);
         cmbCon.Items.Remove(connStr);
         cmbCon.Text = "";
         cmbSrv.Items.Clear();
         cmbSrv.Text = "";
         chbLayers.Items.Clear();
     }
     cmbCon.SelectedItem = cmbCon.Items[0];
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:16,代码来源:frmMapServices.cs


示例19: searchButton_Click

        private void searchButton_Click(object sender, EventArgs e)
        {
            // add Exception handling
            IMap map = ArcMap.Document.FocusMap;
            for (int i = 0; i < map.LayerCount; i++)
            {
                ILayer layer = map.get_Layer(i);
                string[] layerName = layer.Name.Split(new char[] {'.'});

                if (layerName[layerName.Length - 1] == "Cities" && layer.Visible == true)
                {
                    IFeatureLayer citiesLayer = map.get_Layer(i) as IFeatureLayer;
                    IFeatureClass citiesClass = citiesLayer.FeatureClass;

                    // fields indexes start from 0
                    int cityNameIndex = citiesClass.FindField("AREANAME");
                    int stateIndex = citiesClass.FindField("ST");

                    /**
                     * Important class
                     * IQueryFilter
                     *
                     */
                    IQueryFilter queryFilter = new QueryFilterClass();
                    /**
                     * _ - one symbol
                     * % - many symbol
                     *
                     */
                    queryFilter.WhereClause = String.Format("AREANAME LIKE '%{0}%'", searchTextBox.Text.ToUpper());
                    IFeatureCursor resCursor = citiesClass.Search(queryFilter, true);

                    IFeature cityFeature = resCursor.NextFeature();
                    while (cityFeature != null)
                    {
                        MessageBox.Show(String.Format("{0}, {1}", cityFeature.get_Value(cityNameIndex), cityFeature.get_Value(stateIndex)));

                        cityFeature = resCursor.NextFeature();
                    }

                    //
                    Marshal.ReleaseComObject(resCursor);

                    break;
                }
            }
        }
开发者ID:91kerezi,项目名称:gis2014,代码行数:47,代码来源:FMIDockableWindow.cs


示例20: AddOrientationDataPoints

        public void AddOrientationDataPoints(string SqlWhereClause)
        {
            int idFld = m_OrientationDataPointsFC.FindField("OrientationDataPoints_ID");
            int stationFld = m_OrientationDataPointsFC.FindField("StationID");
            int typeFld = m_OrientationDataPointsFC.FindField("Type");
            int idConfFld = m_OrientationDataPointsFC.FindField("IdentityConfidence");
            int lblFld = m_OrientationDataPointsFC.FindField("Label");
            int plotFld = m_OrientationDataPointsFC.FindField("PlotAtScale");
            int aziFld = m_OrientationDataPointsFC.FindField("Azimuth");
            int incFld = m_OrientationDataPointsFC.FindField("Inclination");
            int orConfFld = m_OrientationDataPointsFC.FindField("OrientationConfidenceDegrees");
            int notesFld = m_OrientationDataPointsFC.FindField("Notes");
            int dsFld = m_OrientationDataPointsFC.FindField("DataSourceID");
            int symbRotFld = m_OrientationDataPointsFC.FindField("SymbolRotation");
            int symFld = m_OrientationDataPointsFC.FindField("Symbol");

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

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

            while (theFeature != null)
            {
                OrientationDataPoint anOrientationDataPoint = new OrientationDataPoint();
                anOrientationDataPoint.OrientationDataPoints_ID = theFeature.get_Value(idFld).ToString();
                anOrientationDataPoint.StationID = theFeature.get_Value(stationFld).ToString();
                anOrientationDataPoint.Type = theFeature.get_Value(typeFld).ToString();
                anOrientationDataPoint.IdentityConfidence = theFeature.get_Value(idConfFld).ToString();
                anOrientationDataPoint.Label = theFeature.get_Value(lblFld).ToString();
                bool result;
                result = int.TryParse(theFeature.get_Value(plotFld).ToString(), out anOrientationDataPoint.PlotAtScale);
                result = double.TryParse(theFeature.get_Value(aziFld).ToString(), out anOrientationDataPoint.Azimuth);
                result = double.TryParse(theFeature.get_Value(incFld).ToString(), out anOrientationDataPoint.Inclination);
                result = double.TryParse(theFeature.get_Value(orConfFld).ToString(), out anOrientationDataPoint.OrientationConfidenceDegrees);
                anOrientationDataPoint.Notes = theFeature.get_Value(notesFld).ToString();
                anOrientationDataPoint.DataSourceID = theFeature.get_Value(dsFld).ToString();
                result = double.TryParse(theFeature.get_Value(symbRotFld).ToString(), out anOrientationDataPoint.SymbolRotation);
                result = int.TryParse(theFeature.get_Value(symFld).ToString(), out anOrientationDataPoint.Symbol);
                anOrientationDataPoint.Shape = (IPoint)theFeature.Shape;
                anOrientationDataPoint.RequiresUpdate = true;

                m_OrientationDataPointsDictionary.Add(anOrientationDataPoint.OrientationDataPoints_ID, anOrientationDataPoint);

                theFeature = theCursor.NextFeature();
            }
        }
开发者ID:genhan2011,项目名称:ncgmp-toolbar,代码行数:47,代码来源:OrientationDataPointsAccess.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# QueryFromClause类代码示例发布时间:2022-05-24
下一篇:
C# QueryFilter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap