예제 #1
0
        // ***********************************************************************************
        // * ...Clear the graphicslayers and charts
        // ***********************************************************************************
        private void clearMapToolParameters()
        {
            //clear the graphicsLayer
            _spillLocationGraphicsLayer.Graphics.Clear();
            _ergZoneGraphicsLayer.Graphics.Clear();
            _facilitiesGraphicsLayer.Graphics.Clear();

            //Select features using polygon
            IEnumerable <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;

            foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
            {
                client.FeatureLayer featureL = _mapWidget.FindFeatureLayer(d);
                featureL.ClearSelection();
            }
        }
        // ***********************************************************************************
        // * ...Set the map mouseclick event so that user can enter the incident
        // ***********************************************************************************
        private void btnSolve_Click(object sender, RoutedEventArgs e)
        {
            // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
            _bufferParams      = new BufferParameters();
            _bufferParams.Unit = currentLinearUnit();
            _bufferParams.BufferSpatialReference = new SpatialReference(4326);
            _bufferParams.OutSpatialReference    = _mapWidget.Map.SpatialReference;

            _bufferParams.Features.Clear();
            if (_selectedRadioButtonName == "rbDrawPoints" || _selectedRadioButtonName == "rbSelectedFeaturesFromLayer")
            {
                _bufferParams.Features.AddRange(_bufferPointLayer.Graphics);
            }
            else if (_selectedRadioButtonName == "rbSelectedFeaturesOnMap")
            {
                _bufferPointLayer.ClearGraphics();

                IEnumerable <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                {
                    client.FeatureLayer featureL = _mapWidget.FindFeatureLayer(d);
                    if (featureL.SelectionCount > 0)
                    {
                        _bufferParams.Features.AddRange(featureL.SelectedGraphics);
                    }
                }
            }

            if (_bufferParams.Features.Count == 0)
            {
                MessageBox.Show("Please select features on the map first", "Error");
                return;
            }

            var bufferDistance = Convert.ToDouble(ringInterval.Text);
            var ringDistance   = bufferDistance;

            var numRings = Convert.ToInt32(numberOfRings.Text);

            for (var i = 0; i < numRings; i++)
            {
                _bufferParams.Distances.Add(ringDistance);
                ringDistance = ringDistance + bufferDistance;
            }

            _geometryService.BufferAsync(_bufferParams);
        }
예제 #3
0
        async void Map_ExtentChanged(object sender, ExtentEventArgs e)
        {
            try
            {
                if (callQuery)
                {
                    //Select features using polygon
                    IEnumerable <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                    foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                    {
                        //if (d.IsSelectable)
                        // {
                        System.Diagnostics.Debug.WriteLine(d.Name);
                        ESRI.ArcGIS.OperationsDashboard.Query query = new ESRI.ArcGIS.OperationsDashboard.Query();

                        query.SpatialFilter  = outdoorPoly;
                        query.ReturnGeometry = true;
                        query.Fields         = new string[] { d.ObjectIdFieldName };

                        ESRI.ArcGIS.OperationsDashboard.QueryResult result = await d.ExecuteQueryAsync(query);

                        //System.Diagnostics.Debug.WriteLine("Features : " + result.Features.Count);
                        if (result.Features.Count > 0)
                        {
                            // Get the array of IDs from the query results.
                            var resultOids = from feature in result.Features select System.Convert.ToInt32(feature.Attributes[d.ObjectIdFieldName]);

                            // Find the map layer in the map widget that contains the data source.
                            MapWidget mapW = MapWidget.FindMapWidget(d);
                            if (mapW != null)
                            {
                                // Get the feature layer in the map for the data source.
                                client.FeatureLayer featureL = mapW.FindFeatureLayer(d);

                                // NOTE: Can check here if the feature layer is selectable, using code shown above.
                                // For each result feature, find the corresponding graphic in the map by OID and select it.
                                foreach (client.Graphic feature in featureL.Graphics)
                                {
                                    int featureOid;
                                    int.TryParse(feature.Attributes[d.ObjectIdFieldName].ToString(), out featureOid);
                                    if (resultOids.Contains(featureOid))
                                    {
                                        feature.Select();
                                    }
                                }
                            }
                        }
                    }
                }
                callQuery = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in MapExent Changed: " + ex.Message);
            }
        }
예제 #4
0
        private void DoneButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_graphicsLayer != null)
                {
                    _graphicsLayer.Graphics.Clear();
                }

                // Find the map layer in the map widget that contains the data source.
                IEnumerable <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                {
                    if (_mapWidget != null && d.IsSelectable == true)
                    {
                        // Get the feature layer in the map for the data source.
                        client.FeatureLayer featureL = _mapWidget.FindFeatureLayer(d);

                        //Clear Selection on Feature Layers in map
                        featureL.ClearSelection();
                    }
                }
                location            = null;
                RunButton.IsEnabled = false;
                txtAddress.Text     = "Enter Address";

                if (_mapWidget != null)
                {
                    _mapWidget.Map.MouseClick -= Map_MouseClick;
                    _mapWidget.SetToolbar(null);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
예제 #5
0
        protected FeatureLayer FindFeatureLayer(OD.DataSource dataSource)
        {
            if (dataSource == null)
            {
                return(null);
            }
            MapWidget mapWidget = GetMapWidget(dataSource);

            if (mapWidget == null)
            {
                return(null);
            }

            return(mapWidget.FindFeatureLayer(dataSource));
        }
        public async Task QueryForFeatures(client.Geometry.Geometry bufferPolygon)
        {
            //Set up the query and query result
            Query query = new Query("", bufferPolygon, true);

            //Run the query and check the result
            QueryResult result = await TargetDataSource.ExecuteQueryAsync(query);

            if ((result == null) || (result.Canceled) || (result.Features == null) || (result.Features.Count < 1))
            {
                return;
            }

            // Get the array of OIDs from the query results.
            var resultOids = from resultFeature in result.Features select Convert.ToInt32(resultFeature.Attributes[TargetDataSource.ObjectIdFieldName]);

            // Get the feature layer in the map for the data source.
            client.FeatureLayer featureLayer = mapWidget.FindFeatureLayer(TargetDataSource);
            if (featureLayer == null)
            {
                return;
            }

            // For each graphic feature in featureLayer, use its OID to find the graphic feature from the result set.
            // Note that though the featureLayer's graphic feature and the result set's feature graphic feature share the same properties,
            // they are indeed different objects
            foreach (client.Graphic feature in featureLayer.Graphics)
            {
                int featureOid;
                int.TryParse(feature.Attributes[TargetDataSource.ObjectIdFieldName].ToString(), out featureOid);

                //If feature has been selected in previous session, unselect it
                if (feature.Selected)
                {
                    feature.UnSelect();
                }

                //If the feature is in the query result set, select it
                if ((resultOids.Contains(featureOid)))
                {
                    feature.Select();
                }
            }
        }
    public async Task QueryForFeatures(client.Geometry.Geometry bufferPolygon)
    {
      //Set up the query and query result
      Query query = new Query("", bufferPolygon, true);
      DataSource ds = OperationsDashboard.Instance.DataSources.Where(d => d.Id == TargetDataSourceId).FirstOrDefault();
      if (ds != null)
      {
          //Run the query and check the result
          QueryResult result = await ds.ExecuteQueryAsync(query);
          if ((result == null) || (result.Canceled) || (result.Features == null) || (result.Features.Count < 1))
              return;

          // Get the array of OIDs from the query results.
          var resultOids = from resultFeature in result.Features select System.Convert.ToInt32(resultFeature.Attributes[ds.ObjectIdFieldName]);

          // Find the map layer in the map widget that contains the target data source.
          MapWidget mapW = MapWidget.FindMapWidget(ds);
          if (mapW != null)
          {
              // Get the feature layer in the map for the data source.
              client.FeatureLayer featureLayer = mapW.FindFeatureLayer(ds);

              // For each graphic feature in featureLayer, use its OID to find the graphic feature from the result set.
              // Note that though the featureLayer's graphic feature and the result set's feature graphic feature share the same properties,
              // they are indeed different objects
              foreach (client.Graphic feature in featureLayer.Graphics)
              {
                  int featureOid;
                  int.TryParse(feature.Attributes[ds.ObjectIdFieldName].ToString(), out featureOid);

                  //If feature has been selected in previous session, unselect it
                  if (feature.Selected)
                      feature.UnSelect();

                  //If the feature is in the query result set, select it
                  if ((resultOids.Contains(featureOid)))
                      feature.Select();
              }
          }

      }
   
    }
        private void HighlightFeature_Click(object sender, RoutedEventArgs e)
        {
            SiteDetails sd = ((Button)sender).DataContext as SiteDetails;

            Geometry g = Geometry.FromJson(sd.ZoomExtent);

            ESRI.ArcGIS.Client.FeatureLayer fl = mapWidget.FindFeatureLayer(dataSource);

            for (int i = 0; i < fl.Graphics.Count; i++)
            {
                client.Graphic feature = fl.Graphics[i];
                int            featureOid;
                int.TryParse(feature.Attributes[dataSource.ObjectIdFieldName].ToString(), out featureOid);
                if (sd.f == featureOid.ToString())
                {
                    fl.ClearSelection();
                    feature.Select();
                }
            }
        }
        //Validate if the input data source can be used as a team data source
        private bool IsValidTeamDataSource(DataSource dataSrc)
        {
            //If the dataSource has the field "SearchAreaName",
            //and its associated feature layer is a polygon layer
            //return true
            if (dataSrc.Fields.Any(f => f.Name == "SearchAreaName") == false)
            {
                return(false);
            }

            MapWidget mw = MapWidget.FindMapWidget(dataSrc);

            client.FeatureLayer layer = mw.FindFeatureLayer(dataSrc);
            if (layer != null && layer.LayerInfo.GeometryType == client.Tasks.GeometryType.Point)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #10
0
        /*private void set_equipment(object sender, RoutedEventArgs e)
         * {
         *  if ((Boolean)((CheckBox)sender).IsChecked)
         *  {
         *      DataSourceSelectorEquipment.IsEnabled = true;
         *      //EquipmentUIDComboBox.IsEnabled = true;
         *      //EquipmentHFComboBox.IsEnabled = true;
         *      //EquipmentLabelComboBox.IsEnabled = true;
         *  }
         *  else
         *  {
         *      if (DataSources.Count > 1)
         *      {
         *          DataSources.Remove(DataSources[1]);
         *      }
         *      DataSourceSelectorEquipment.IsEnabled = false;
         *      //EquipmentUIDComboBox.IsEnabled = false;
         *      //EquipmentHFComboBox.IsEnabled = false;
         *      //EquipmentLabelComboBox.IsEnabled = false;
         *  }
         * }*/

        private async void AddDatasourceToCache(OOBDataSource ods)
        {
            try
            {
                String Uid       = ods.UIDField;
                String HF        = ods.HFField;
                String DF        = ods.DescField;
                String Labels    = "";
                String DescFlds  = "";
                String CacheName = ods.Key;
                Dictionary <String, String> fields = new Dictionary <String, String>();
                fields["UID"] = Uid;
                fields["HF"]  = HF;

                Int32 numBaseFlds = 2;
                if (DF != null)
                {
                    fields["DESCFIELD"] = DF;
                    numBaseFlds         = 3;
                }

                Int32    arraySize = ods.LabelFields.Count + ods.DescriptionFields.Count + numBaseFlds;
                string[] qfields   = new string[arraySize];
                qfields[0] = Uid;
                qfields[1] = HF;
                if (DF != null)
                {
                    qfields[2] = DF;
                }
                Int32   c     = numBaseFlds;
                Boolean first = true;
                foreach (String f in ods.LabelFields)
                {
                    if (!first)
                    {
                        Labels += ",";
                    }
                    else
                    {
                        first = false;
                    }
                    Labels    += f;
                    qfields[c] = f;
                    ++c;
                }
                first = true;
                foreach (String f in ods.DescriptionFields)
                {
                    if (!first)
                    {
                        DescFlds += ",";
                    }
                    else
                    {
                        first = false;
                    }
                    DescFlds  += f;
                    qfields[c] = f;
                    ++c;
                }
                fields["LABELS"]   = Labels;
                fields["DESCFLDS"] = DescFlds;
                Query q = new Query();



                q.Fields = qfields;
                cache.AddFeatuereContainer(CacheName);

                DataSource ds = ods.DataSource;
                q.ReturnGeometry = true;
                QueryResult res = await ds.ExecuteQueryAsync(q);

                var resultOids = from feature in res.Features select System.Convert.ToInt32(feature.Attributes[ds.ObjectIdFieldName]);

                MapWidget           mw = MapWidget.FindMapWidget(ds);
                client.FeatureLayer fl = mw.FindFeatureLayer(ds);
                //fl.Update();
                client.UniqueValueRenderer r = fl.Renderer as client.UniqueValueRenderer;
                foreach (client.Graphic g in fl.Graphics)
                {
                    cache.AddFeature(CacheName, g, ods.BaseDescription, ods.BaseLabel, fields, r);
                }
                ods.IsCacheCreated = true;

                //cache.AddFeature
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.Message + "/n" + e.Source
                                               + "/n" + e.StackTrace);
            }
        }
      /// <summary>
      /// Determines if the feature action can be executed based on the specified data source and feature, before the option to execute
      /// the feature action is displayed to the user.
      /// </summary>
      /// <param name="searchAreaDS">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
      /// <param name="searchArea">The data which will be subsequently passed to the Execute method if CanExecute returns true.</param>
      /// <returns>True if the feature action should be enabled, otherwise false.</returns>
      public bool CanExecute(DataSource searchAreaDS, client.Graphic searchArea)
      {
         //Map widget that contains the searchArea data Source
         MapWidget areaMW;
         //Map widget that contains the rescueTeam data Source
         MapWidget teamMW;
         
         try
         {
            #region Check if the polygon data source is valid
            //Check if the searchAreaDS has a display name field
            if (searchAreaDS.DisplayFieldName == null) return false;

            //Check if the map widget associated with the search area dataSource is valid
            if ((areaMW = MapWidget.FindMapWidget(searchAreaDS)) == null) return false;

            //Check if the search area layer is polygon 
            if (areaMW.FindFeatureLayer(searchAreaDS).LayerInfo.GeometryType != client.Tasks.GeometryType.Polygon) return false;
            #endregion

            #region Find the rescue team data source and check if it is consumed by the same mapWidget as the polygon data source
            //Find all the data sources that can possibly be a taem data sources
            //(i.e. are associated with point layers and hase the field "SearchAreaName")
            var teamDataSrcs = OperationsDashboard.Instance.DataSources.Where(ds => IsValidTeamDataSource(ds));
            if (teamDataSrcs == null || teamDataSrcs.Count() == 0)
               return false;

            //For each of the data source retrieved, get its associated mapWidget
            //Check if the polygon feature source is also consumed by the same map widget (i.e. teamMW)
            foreach (DataSource teamDataSrc in teamDataSrcs)
            {
               if ((teamMW = MapWidget.FindMapWidget(teamDataSrc)) == null) return false;
               
               if (teamMW.Id == areaMW.Id)
               {
                  MapWidget = areaMW;
                  TeamDataSrc = teamDataSrc;
                  TeamFeatureLayer = MapWidget.FindFeatureLayer(TeamDataSrc);
                  return true;
               }
            }
            #endregion

            return false;
         }
         catch (Exception)
         {
            return false;
         }
      }
예제 #12
0
        public ERGChemicalMapToolbar(MapWidget mapWidget, string ERGChemicalURL, string ERGPlacardURL,
                                     string FindNearestWSURL, string WindDirectionLayerDataSource, string windDirectionFieldName,
                                     string windWeatherStationFieldName, string windRecordedDateFieldName, string defaultChemicalName, string defaultPlacardName)
        {
            try
            {
                InitializeComponent();
                this.DataContext = this;

                // Store a reference to the MapWidget that the toolbar has been installed to.
                _mapWidget = mapWidget;

                if (string.IsNullOrEmpty(ERGChemicalURL))
                {
                    MessageBox.Show("Please configure the tool!", "Error");
                    return;
                }

                //set up erg Chemical GP URL
                ERGChemicalURL       = (ERGChemicalURL ?? "");
                _chemicalURL         = ERGChemicalURL;
                chemicalGPParameters = new List <GPParameterInfo>();
                var chemicalJSONUrl = _chemicalURL + "?f=pjson";
                ChemicalList = getListOfChemicalsOrPlacards("chemical", chemicalJSONUrl);
                cmbChemicalOrPlacardType.ItemsSource = ChemicalList;

                if (!String.IsNullOrEmpty(defaultChemicalName))
                {
                    _defaultChemicalName = defaultChemicalName;
                }
                else
                {
                    _defaultChemicalName = _defaultERGName;
                }

                cmbChemicalOrPlacardType.SelectedValue = _defaultChemicalName;

                //set up erg Placard GP URL
                ERGPlacardURL       = (ERGPlacardURL ?? "");
                _placardURL         = ERGPlacardURL;
                placardGPParameters = new List <GPParameterInfo>();
                var placardJsonUrl = _placardURL + "?f=pjson";
                PlacardList = getListOfChemicalsOrPlacards("placard", placardJsonUrl);

                if (!String.IsNullOrEmpty(defaultPlacardName))
                {
                    _defaultPlacardName = defaultPlacardName;
                }
                else
                {
                    _defaultPlacardName = _defaultERGName;
                }

                //wind direction
                _findNearestWSURL = FindNearestWSURL;

                if (!string.IsNullOrEmpty(WindDirectionLayerDataSource) && !string.IsNullOrEmpty(_findNearestWSURL))
                {
                    ESRI.ArcGIS.OperationsDashboard.DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Name == WindDirectionLayerDataSource);
                    if (dataSource != null)
                    {
                        _windDirectionLayer = _mapWidget.FindFeatureLayer(dataSource);
                    }

                    //wind direction fields
                    if (!string.IsNullOrEmpty(windDirectionFieldName))
                    {
                        _windDirectionFieldName = windDirectionFieldName;
                    }

                    if (!string.IsNullOrEmpty(windWeatherStationFieldName))
                    {
                        _windWeatherStationFieldName = windWeatherStationFieldName;
                    }

                    if (!string.IsNullOrEmpty(windRecordedDateFieldName))
                    {
                        _windRecordedDateFieldName = windRecordedDateFieldName;
                    }

                    btnLookupWindDirection.IsEnabled = true;
                }

                _mydictionary        = new ResourceDictionary();
                _mydictionary.Source = new Uri("/ERGChemicalAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                MessageBox.Show("There is an error! Check your parameters!", "Error");
                return;
            }
        }
        public ERGChemicalMapToolbar(MapWidget mapWidget, string ERGChemicalURL, string ERGPlacardURL,
           string FindNearestWSURL, string WindDirectionLayerDataSource, string windDirectionFieldName,
            string windWeatherStationFieldName, string windRecordedDateFieldName, string defaultChemicalName, string defaultPlacardName)
        {
            try
            {
                InitializeComponent();
                this.DataContext = this;

                // Store a reference to the MapWidget that the toolbar has been installed to.
                _mapWidget = mapWidget;

                if (string.IsNullOrEmpty(ERGChemicalURL))
                {
                    MessageBox.Show("Please configure the tool!", "Error");
                    return;
                }

                //set up erg Chemical GP URL
                ERGChemicalURL = (ERGChemicalURL ?? "");
                _chemicalURL = ERGChemicalURL;
                chemicalGPParameters = new List<GPParameterInfo>();
                var chemicalJSONUrl = _chemicalURL + "?f=pjson";
                ChemicalList = getListOfChemicalsOrPlacards("chemical", chemicalJSONUrl);
                cmbChemicalOrPlacardType.ItemsSource = ChemicalList;

                if (!String.IsNullOrEmpty(defaultChemicalName))
                    _defaultChemicalName = defaultChemicalName;
                else
                    _defaultChemicalName = _defaultERGName;

                cmbChemicalOrPlacardType.SelectedValue = _defaultChemicalName;

                //set up erg Placard GP URL
                ERGPlacardURL = (ERGPlacardURL ?? "");
                _placardURL = ERGPlacardURL;
                placardGPParameters = new List<GPParameterInfo>();
                var placardJsonUrl = _placardURL + "?f=pjson";
                PlacardList = getListOfChemicalsOrPlacards("placard", placardJsonUrl);

                if (!String.IsNullOrEmpty(defaultPlacardName))
                    _defaultPlacardName = defaultPlacardName;
                else
                    _defaultPlacardName = _defaultERGName; 

                //wind direction
                _findNearestWSURL = FindNearestWSURL;

                if (!string.IsNullOrEmpty(WindDirectionLayerDataSource) && !string.IsNullOrEmpty(_findNearestWSURL))
                {
                    ESRI.ArcGIS.OperationsDashboard.DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Name == WindDirectionLayerDataSource);
                    if (dataSource != null)
                        _windDirectionLayer = _mapWidget.FindFeatureLayer(dataSource);

                    //wind direction fields 
                    if (!string.IsNullOrEmpty(windDirectionFieldName))
                        _windDirectionFieldName = windDirectionFieldName;

                    if (!string.IsNullOrEmpty(windWeatherStationFieldName))
                        _windWeatherStationFieldName = windWeatherStationFieldName;

                    if (!string.IsNullOrEmpty(windRecordedDateFieldName))
                        _windRecordedDateFieldName = windRecordedDateFieldName;

                    btnLookupWindDirection.IsEnabled = true;
                }

                _mydictionary = new ResourceDictionary();
                _mydictionary.Source = new Uri("/ERGChemicalAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                MessageBox.Show("There is an error! Check your parameters!", "Error");
                return; 
            }
        }
        /// <summary>
        /// Determines if the feature action can be executed based on the specified data source and feature, before the option to execute
        /// the feature action is displayed to the user.
        /// </summary>
        /// <param name="searchAreaDS">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <param name="searchArea">The data which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <returns>True if the feature action should be enabled, otherwise false.</returns>
        public bool CanExecute(DataSource searchAreaDS, client.Graphic searchArea)
        {
            //Map widget that contains the searchArea data Source
            MapWidget areaMW;
            //Map widget that contains the rescueTeam data Source
            MapWidget teamMW;

            try
            {
                #region Check if the polygon data source is valid
                //Check if the searchAreaDS has a display name field
                if (searchAreaDS.DisplayFieldName == null)
                {
                    return(false);
                }

                //Check if the map widget associated with the search area dataSource is valid
                if ((areaMW = MapWidget.FindMapWidget(searchAreaDS)) == null)
                {
                    return(false);
                }

                //Check if the search area layer is polygon
                if (areaMW.FindFeatureLayer(searchAreaDS).LayerInfo.GeometryType != client.Tasks.GeometryType.Polygon)
                {
                    return(false);
                }
                #endregion

                #region Find the rescue team data source and check if it is consumed by the same mapWidget as the polygon data source
                //Find all the data sources that can possibly be a taem data sources
                //(i.e. are associated with point layers and hase the field "SearchAreaName")
                var teamDataSrcs = OperationsDashboard.Instance.DataSources.Where(ds => IsValidTeamDataSource(ds));
                if (teamDataSrcs == null || teamDataSrcs.Count() == 0)
                {
                    return(false);
                }

                //For each of the data source retrieved, get its associated mapWidget
                //Check if the polygon feature source is also consumed by the same map widget (i.e. teamMW)
                foreach (DataSource teamDataSrc in teamDataSrcs)
                {
                    if ((teamMW = MapWidget.FindMapWidget(teamDataSrc)) == null)
                    {
                        return(false);
                    }

                    if (teamMW.Id == areaMW.Id)
                    {
                        MapWidget        = areaMW;
                        TeamDataSrc      = teamDataSrc;
                        TeamFeatureLayer = MapWidget.FindFeatureLayer(TeamDataSrc);
                        return(true);
                    }
                }
                #endregion

                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }