⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arcengine开发statistics代码 .txt

📁 这是关于Ae开发常用的代码
💻 TXT
字号:
arcengine开发Statistics代码 
By  yumao 发表于 2007-7-18 0:25:00   

基础统计(BaseStatistics)组件用来生成和报告统计结果。IFrequencyStatistics接口提供对用来报告频率统计的成员的访问。IGenerateStatistics接口提供对用来生成统计结果的成员的访问。IStatisticsResults提供对用来报告统计结果的成员的访问。可访问的属性有Count,Sum,Maximum,Minimum,Meanm,StandardDeviation(标准差) 
DataStatistics组件允许返回统计结果及单个字段的唯一值。组件创建后,用来分析的数据通过IDataStatistics::Cursor属性,以光标形式的传入。注意ICursor的对象只能使用一次,如果要获取多个结果,应当再次创建光标。
IDataStatistics是数据统计组件中唯一的接口,下面是例子:
Dim pFeatLyr As IFeatureLayer
        pFeatLyr = New FeatureLayer

        Dim pMap As IMap
        pMap = AxMapControl1.Map
        Dim i As Integer
        For i = 0 To pMap.LayerCount - 1
            If pMap.Layer(i).Name = "STATES" Then
                pFeatLyr = pMap.Layer(i)
                Exit For
            End If
        Next
        Dim pFeatClass As IFeatureClass
        pFeatClass = pFeatLyr.FeatureClass

        Dim pDataStatistics As IDataStatistics
        pDataStatistics = New DataStatistics
        Dim pFeatCursor As IFeatureCursor
        pFeatCursor = pFeatClass.Search(Nothing, False)
        Dim pCursor As ICursor
        pCursor = pFeatCursor

        pDataStatistics.Cursor = pCursor
        pDataStatistics.Field = "AREA_1"

        Dim pStaResult As IStatisticsResults
        pStaResult = pDataStatistics.Statistics
        Dim num As Long
        Dim dMax As Double
        Dim dMin As Double
        Dim dMean As Double
        num = pStaResult.Count
        dMax = pStaResult.Maximum
        dMin = pStaResult.Minimum
        dMean = pStaResult.Mean
        MessageBox.Show("共有" + num.ToString + "个州,其中最大面积是:" + dMax.ToString + ",最小面积是:" + dMin.ToString + ",平均面积是:" + dMean.ToString)
 
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -