コード例 #1
0
        private void UserControl_Load(object sender, EventArgs e)
        {
            filenames = new GeoCollection <string>();
            filenames.Add("ShortestPath", "ShortestPath");
            filenames.Add("FastestPath", "FastestPath");
            filenames.Add("DallasWithOneWayRoad", "DallasWithOneWayRoad");
            filenames.Add("OptimizeHighway", "OptimizeHighway");
            cmbPurpose.DataSource = filenames.GetKeys();
            RtgRoutingSource.BuildingRoutingData += new EventHandler <BuildingRoutingDataRtgRoutingSourceEventArgs>(RtgRoutingSource_BuildingRoadData);

            RenderMap();
        }
コード例 #2
0
        private void btnUnion_Click(object sender, RoutedEventArgs e)
        {
            InMemoryFeatureLayer inMemoryLayer = (InMemoryFeatureLayer)wpfMap1.FindFeatureLayer("InMemoryFeatureLayer");

            if (inMemoryLayer.InternalFeatures.Count > 1)
            {
                GeoCollection<AreaBaseShape> areaBaseShapes = new GeoCollection<AreaBaseShape>();

                GeoCollection<Feature> features = inMemoryLayer.InternalFeatures;
                foreach (Feature feature in features)
                {
                    AreaBaseShape targetAreaBaseShape = feature.GetShape() as AreaBaseShape;
                    if (targetAreaBaseShape != null)
                    {
                        areaBaseShapes.Add(targetAreaBaseShape);
                    }
                }

                AreaBaseShape unionedAreaBaseShape = AreaBaseShape.Union(areaBaseShapes);
                unionedAreaBaseShape.Id = "UnionedFeature";
                inMemoryLayer.InternalFeatures.Clear();
                inMemoryLayer.InternalFeatures.Add("UnionedFeature", new Feature(unionedAreaBaseShape));
                inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.SimpleColors.Green);

                wpfMap1.Overlays["InMemoryOverlay"].Refresh();
            }
        }
        private void btnUnion_Click(object sender, EventArgs e)
        {
            InMemoryFeatureLayer inMemoryLayer = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("InMemoryFeatureLayer");

            if (inMemoryLayer.InternalFeatures.Count > 1)
            {
                GeoCollection <AreaBaseShape> areaBaseShapes = new GeoCollection <AreaBaseShape>();

                GeoCollection <Feature> features = inMemoryLayer.InternalFeatures;
                foreach (Feature feature in features)
                {
                    AreaBaseShape targetAreaBaseShape = feature.GetShape() as AreaBaseShape;
                    if (targetAreaBaseShape != null)
                    {
                        areaBaseShapes.Add(targetAreaBaseShape);
                    }
                }

                AreaBaseShape unionedAreaBaseShape = AreaBaseShape.Union(areaBaseShapes);
                unionedAreaBaseShape.Id = "UnionedFeature";
                inMemoryLayer.InternalFeatures.Clear();
                inMemoryLayer.InternalFeatures.Add("UnionedFeature", new Feature(unionedAreaBaseShape));
                inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.SimpleColors.Green);

                winformsMap1.Refresh(winformsMap1.Overlays["InMemoryOverlay"]);
            }
        }
コード例 #4
0
        public string GetCurrentPosition()
        {
            if (vehicles == null)
            {
                ReadVehicles();
            }

            GeoCollection <JsonVehicle> jsonVehicles = new GeoCollection <JsonVehicle>();

            for (int i = 0; i < 6; i++)
            {
                string            vehicleId = (i + 1).ToString(CultureInfo.InvariantCulture);
                List <PointShape> locations = vehicles[vehicleId];

                readIndex[i]++;
                if (readIndex[i] >= locations.Count)
                {
                    readIndex[i] = 0;
                }

                PointShape  location = locations[readIndex[i]];
                JsonVehicle vehicle  = new JsonVehicle(vehicleId, "vehicle_van_" + (i + 1) + ".png", location.X, location.Y);

                jsonVehicles.Add(vehicle);
            }

            return(Serialize <Collection <JsonVehicle> >(jsonVehicles));
        }
コード例 #5
0
 public static void LoadFrom <T>(this GeoCollection <T> sourceCollection, GeoCollection <T> targetCollection)
 {
     sourceCollection.Clear();
     foreach (var key in targetCollection.GetKeys())
     {
         sourceCollection.Add(key, targetCollection[key]);
     }
 }
コード例 #6
0
        private GeoCollection <string> GetFeatureIds(IEnumerable <string> adjacentIds)
        {
            GeoCollection <string> featureIds = new GeoCollection <string>();

            foreach (string item in adjacentIds)
            {
                string featureId = item.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0];
                featureIds.Add(item, featureId);
            }
            return(featureIds);
        }
コード例 #7
0
        private void GenerateKeywords(TreeNodeCollection treeNodes)
        {
            foreach (TreeNode item in treeNodes)
            {
                if (item.Tag != null)
                {
                    keywords.Add(item.Tag.ToString(), item);
                }

                if (item.Nodes.Count > 0)
                {
                    GenerateKeywords(item.Nodes);
                }
            }
        }
コード例 #8
0
        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);
        }
コード例 #9
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);
        }