Exemple #1
0
 private void GetCurrentRasterInteractiver(TextBox txt, string percentArgName, bool maxValue)
 {
     if (_argProvider != null)
     {
         ICurrentRasterInteractiver crt = _argProvider.CurrentRasterInteractiver;
         if (crt != null)
         {
             int bandNI = (int)_argProvider.GetArg("NearInfrared");
             if (bandNI <= 0)
             {
                 return;
             }
             float percent = (float)_argProvider.GetArg(percentArgName) / 100;
             if (maxValue)
             {
                 crt.StartAOIDrawing(() =>
                 {
                     txt.Text = Math.Round(crt.GetMaxAvgBandValueInAOI(bandNI, percent), 2).ToString();
                     if (_handler != null)
                     {
                         _handler(GetParameterValues());
                     }
                     crt.TryFinishPencilTool();
                 });
             }
             else
             {
                 crt.StartAOIDrawing(() =>
                 {
                     txt.Text = Math.Round(crt.GetMinAvgBandValueInAOI(bandNI, percent), 2).ToString();
                     if (_handler != null)
                     {
                         _handler(GetParameterValues());
                     }
                     crt.TryFinishPencilTool();
                 });
             }
         }
     }
 }
Exemple #2
0
 private void btnGetData_Click(object sender, EventArgs e)
 {
     if (this.Tag != null)
     {
         IArgumentProvider          arg = this.Tag as IArgumentProvider;
         ICurrentRasterInteractiver crt = arg.CurrentRasterInteractiver;
         if (crt != null)
         {
             int bandMI = (int)arg.GetArg("MiddleInfrared");
             int bandFI = (int)arg.GetArg("FarInfrared");
             if (bandFI <= 0 || bandMI <= 0)
             {
                 return;
             }
             crt.StartAOIDrawing(() =>
             {
                 try
                 {
                     double[] mIBand = crt.GetBandValuesInAOI(bandMI);
                     double[] fIBand = crt.GetBandValuesInAOI(bandFI);
                     if (mIBand == null || fIBand == null || mIBand.Length != fIBand.Length)
                     {
                         return;
                     }
                     float avgValue    = 0;
                     double totalValue = 0;
                     for (int i = 0; i < mIBand.Length; i++)
                     {
                         totalValue += mIBand[i] - fIBand[i];
                     }
                     avgValue      = (float)Math.Round(totalValue / mIBand.Length, 2);
                     txtValue.Text = avgValue.ToString();
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("未能获取薄雾判识所需通道值!", "提示", MessageBoxButtons.OK);
                 }
             });
         }
     }
     return;
 }
Exemple #3
0
 private void btnLand_Click(object sender, EventArgs e)
 {
     if (this.Tag != null)
     {
         IArgumentProvider          arg = this.Tag as IArgumentProvider;
         ICurrentRasterInteractiver crt = arg.CurrentRasterInteractiver;
         if (crt != null)
         {
             int bandNI = (int)arg.GetArg("NearInfrared");
             if (bandNI <= 0)
             {
                 return;
             }
             crt.StartAOIDrawing(() =>
             {
                 float landAvgValue = (float)Math.Round(crt.GetAvgBandValueInAOI(bandNI), 2);
                 txtLand.Text       = landAvgValue.ToString();
             });
         }
     }
 }
        private void StatFilterAreas()
        {
            ICurrentRasterInteractiver inter = _session.SmartWindowManager.ActiveCanvasViewer as ICurrentRasterInteractiver;

            if (inter != null)
            {
                inter.StartAOIDrawing(GetPencilType(), (aoi, shape) =>
                {
                    string layerName = "System:StatArea";
                    ILabelLayer lyr  = GetLabelLayer((_activeViewer as ICurrentRasterInteractiver), layerName, _fieldNames);
                    if (lyr != null)
                    {
                        Dictionary <string, double> areas = StatArea(aoi, _filters);
                        _layerName = layerName;
                        //ApplyColor(lyr);
                        //lyr.LabelDef.Fieldname = "面积(平方公里)";

                        ApplyColor(lyr);
                        lyr.LabelDef.Fieldname      = _fieldNames[1];
                        lyr.LabelDef.EnableLabeling = true;

                        CodeCell.AgileMap.Core.Feature fet = null;
                        try
                        {
                            fet = ToFeature(shape, areas.Values.ToArray());
                        }
                        catch (Exception ex)
                        {
                            _session.PrintMessage(ex);
                        }
                        if (fet != null)
                        {
                            lyr.AddFeature(fet);
                            AddFeatureToListView(fet);
                        }
                    }
                });
            }
        }
        private void SataSimpleArea()
        {
            string[] lstViewfieldNames = new string[] { "名称", "像元个数", "面积(平方公里)" };
            string[] fieldNames        = new string[] { "name", "pixelcount", "area" };
            UpdateHeadersOfListView(lstViewfieldNames);
            ICurrentRasterInteractiver inter = _activeViewer as ICurrentRasterInteractiver;

            if (inter != null)
            {
                //inter
                inter.StartAOIDrawing(GetPencilType(), (aoi, shape) =>
                {
                    string layerName = "System:StatArea";
                    ILabelLayer lyr  = GetLabelLayer((_activeViewer as ICurrentRasterInteractiver), layerName, fieldNames);
                    if (lyr != null)
                    {
                        _layerName = layerName;
                        ApplyColor(lyr);
                        lyr.LabelDef.Fieldname             = "area";
                        CodeCell.AgileMap.Core.Feature fet = null;
                        try
                        {
                            fet = ToFeature(aoi, shape, fieldNames);
                        }
                        catch (Exception ex)
                        {
                            _session.PrintMessage(ex);
                        }
                        if (fet != null)
                        {
                            lyr.AddFeature(fet);
                            AddFeatureToListView(fet);
                        }
                    }
                });
            }
        }