示例#1
0
        public AreaAnalystConfiguration(string routeFilePathName, GeoCollection <object> parameters)
        {
            this.MapUnit           = GeographyUnit.Meter;
            this.routeFilePathName = routeFilePathName;
            this.DistanceUnit      = DistanceUnit.Mile;

            if (parameters.Contains("category"))
            {
                this.category = parameters["category"].ToString();
            }
            if (parameters.Contains("subCategory"))
            {
                this.subCategory = parameters["subCategory"].ToString().Replace(">~", ">=");
            }
            if (parameters.Contains("searchPoint"))
            {
                this.searchPoint = PointShape.CreateShapeFromWellKnownData(parameters["searchPoint"].ToString()) as PointShape;
            }

            if (parameters.Contains("searchMode") && parameters["searchMode"].ToString().Equals("ServiceArea", StringComparison.OrdinalIgnoreCase))
            {
                this.serviceSearchMode = ServiceSearchMode.ServiceArea;
                this.drivingTime       = Convert.ToInt32(parameters["driveTime"].ToString(), CultureInfo.InvariantCulture);
            }
            else
            {
                this.serviceSearchMode = ServiceSearchMode.BufferArea;
                this.bufferDistance    = Convert.ToDouble(parameters["bufferDistance"].ToString(), CultureInfo.InvariantCulture);
                this.distanceUnit      = GetDistanceFrom(parameters["distanceUnit"].ToString());
            }
        }
        protected virtual Dictionary <FeatureLayer, GeoCollection <Feature> > GetSelectedFeaturesGroupCore(FeatureLayer targetFeatureLayer)
        {
            Dictionary <FeatureLayer, GeoCollection <Feature> > groupedFeatures    = new Dictionary <FeatureLayer, GeoCollection <Feature> >();
            IEnumerable <IGrouping <FeatureLayer, Feature> >    tmpGroupedFeatures = null;

            if (targetFeatureLayer != null)
            {
                tmpGroupedFeatures = HighlightFeatureLayer.InternalFeatures.Where(tmpFeature => tmpFeature.Tag == targetFeatureLayer)
                                     .GroupBy(tmpFeature => (FeatureLayer)tmpFeature.Tag);
            }
            else
            {
                tmpGroupedFeatures = HighlightFeatureLayer.InternalFeatures.GroupBy(tmpFeature => (FeatureLayer)tmpFeature.Tag);
            }

            foreach (var item in tmpGroupedFeatures)
            {
                GeoCollection <Feature> tmpFeatures = new GeoCollection <Feature>();
                foreach (var feature in item)
                {
                    string featureId = GetOriginalFeatureId(feature);
                    if (!tmpFeatures.Contains(featureId))
                    {
                        Feature newFeature = new Feature(feature.GetWellKnownBinary(), featureId, feature.ColumnValues);
                        //LINK:
                        //foreach (var linkItem in feature.LinkColumnValues)
                        //{
                        //    newFeature.LinkColumnValues.Add(linkItem.Key, linkItem.Value);
                        //}
                        tmpFeatures.Add(featureId, newFeature);
                    }
                }

                groupedFeatures.Add(item.Key, tmpFeatures);
            }

            return(groupedFeatures);
        }
示例#3
0
        /// <summary>
        /// Gets the related plugins.
        /// </summary>
        /// <returns></returns>
        public Collection <Plugin> GetPlugins()
        {
            Collection <Plugin> resultPlugins = new Collection <Plugin>();

            GettingPluginsPluginManagerEventArgs args = new GettingPluginsPluginManagerEventArgs();

            OnGettingPlugins(args);

            foreach (var item in args.Plugins)
            {
                resultPlugins.Add(item);
            }

            if (plugins == null)
            {
                plugins = new GeoCollection <Plugin>();
                GetPluginsCore().OrderBy(p => p.Index).ForEach(p =>
                {
                    if (!plugins.Contains(p.Id))
                    {
                        plugins.Add(p.Id, p);
                    }
                });
            }

            foreach (var item in plugins)
            {
                resultPlugins.Add(item);
            }

            GottenPluginsPluginManagerEventArgs gottenArgs = new GottenPluginsPluginManagerEventArgs(resultPlugins);

            OnGottenPlugins(gottenArgs);

            return(gottenArgs.Plugins);
        }