//Set the sampling size for one or all of the layers in the map //The sampling size determines how many messages are factored into the message rate calculation. //For instance a sampling size of 500 will store the times the last 500 messages were received. //The message rate is calculated as the (oldest timestamp - current time) / number of messages private void SetSampleSize() { try { int samplingSize = Convert.ToInt32(txtSampleSize.Text); ITemporalLayer temporalLayer = GetSelectedTemporalLayer(); if (temporalLayer == null) { if (m_amsWorkspaceFactory == null) { m_amsWorkspaceFactory = new AMSWorkspaceFactoryClass(); } //Get the AMS Workspace Factory Statistics interface ITemporalWorkspaceStatistics temporalWsfStatistics = (ITemporalWorkspaceStatistics)m_amsWorkspaceFactory; temporalWsfStatistics.SetAllSampleSizes(samplingSize); } else { ITemporalFeatureClassStatistics temporalFCStats = (ITemporalFeatureClassStatistics)((IFeatureLayer)temporalLayer).FeatureClass; temporalFCStats.SampleSize = samplingSize; } } catch (Exception ex) { statusBarXY.Text = ex.Message; } }
//Reset the statistic's message rate for one or all of the layers in the map private void btnResetMsgRate_Click(object sender, EventArgs e) { try { ITemporalLayer temporalLayer = GetSelectedTemporalLayer(); if (temporalLayer == null) { if (m_amsWorkspaceFactory == null) { m_amsWorkspaceFactory = new AMSWorkspaceFactoryClass(); } //Get the AMS Workspace Factory Statistics interface ITemporalWorkspaceStatistics temporalWsfStatistics = (ITemporalWorkspaceStatistics)m_amsWorkspaceFactory; temporalWsfStatistics.ResetAllMessageRates(); } else { ITemporalFeatureClassStatistics temporalFCStats = (ITemporalFeatureClassStatistics)((IFeatureLayer)temporalLayer).FeatureClass; temporalFCStats.ResetMessageRate(); } } catch (Exception ex) { statusBarXY.Text = ex.Message; } }
//Refresh the statistics for a single layer using the ITemporalFeatureClassStatistics private void RefreshLayerStatistics(string sLayerName, ITemporalFeatureClassStatistics temporalFCStats) { ListViewItem lvItem = new ListViewItem(sLayerName); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.MessageRate)); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.TotalFeatureCount)); lvItem.SubItems.Add("Not Available"); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.TrackCount)); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.SampleSize)); lvStatistics.Items.Clear(); lvStatistics.Items.Add(lvItem); }
//Refresh the statistics for a single layer using the ITemporalFeatureClassStatistics private void RefreshLayerStatistics(string sLayerName, ITemporalFeatureClassStatistics temporalFCStats) { ListViewItem lvItem = new ListViewItem(sLayerName); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.MessageRate)); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.TotalFeatureCount)); lvItem.SubItems.Add("Not Available"); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.TrackCount)); lvItem.SubItems.Add(Convert.ToString(temporalFCStats.SampleSize)); lvStatistics.Items.Clear(); lvStatistics.Items.Add(lvItem); }