コード例 #1
0
        /// <summary>
        /// Create element chart and add it into an Elememt Layer in the Map
        /// </summary>
        private void CreateElementChart(Graphic graphic, string displayValue)
        {
            ChartQueryLayer chartLayer = queryTool.QueryLayer as ChartQueryLayer;

            string[] outFields = chartLayer.OutputFields.Split(',');
            string[] outLabels = chartLayer.OutputLabels.Split(',');

            string title = string.Format("{0} - {1}", displayValue, chartLayer.Title);
            bool   isPercentDependent = chartLayer.ChartOutput.DependentIsPercentage;
            string dependentAxisTitle = chartLayer.ChartOutput.DependentAxisTitle;

            Chart chart = null;

            switch (chartLayer.ChartOutput.ChartType)
            {
            case "Bar":
            case "Column":
                chart = CreateSingleBarChart(graphic, chartLayer.ChartOutput.ChartType, outFields, outLabels, title, dependentAxisTitle);
                break;

            case "Pie":
                chart            = CreateSinglePieChart(graphic, outFields, outLabels, title, dependentAxisTitle, isPercentDependent);
                chart.Background = new SolidColorBrush(Color.FromArgb(204, 240, 240, 255));
                break;
            }

            Envelope ext = GeometryTool.ExpandGeometryExtent(graphic.Geometry, 0.10);

            ElementLayer.SetEnvelope(chart, ext);
            elementLayer.Children.Clear();
            elementLayer.Children.Add(chart);
            this.MapControl.ZoomTo(ext);
        }
コード例 #2
0
        private void Query_ResultReady(object sender, QueryResultEventArgs args)
        {
            this.ClearGraphics(2); // Toggle to Results Panel

            if (args.Results != null && args.Results.Features.Count > 0)
            {
                isFirstLoad = true; // Suppress filter results by map extent or pan map
                QueryResultMessage.Visibility = Visibility.Collapsed;

                FeatureSet           fset    = args.Results;
                Symbol               symbol  = ChooseSymbol(fset.GeometryType.ToString(), false);
                GeoFeatureCollection dataset = new GeoFeatureCollection(args.QueryLayer.OutputFields, args.QueryLayer.OutputLabels, fset.DisplayFieldName, args.QueryLayer.Title);

                foreach (Graphic feature in fset.Features)
                {
                    feature.Symbol = symbol;
                    feature.Geometry.SpatialReference = fset.SpatialReference;
                    this.GraphicsLayer.Graphics.Add(feature);
                    dataset.Add(feature);
                }

                this.FeatureSets.Add(dataset);
                this.GraphicsTipTemplate = args.QueryLayer.MapTipTemplate;
                this.MapControl.ZoomTo(GeometryTool.ExpandGeometryExtent(this.GraphicsLayer.FullExtent, 0.25));
            }
            else
            {
                QueryResultMessage.Visibility = Visibility.Visible;
                QueryResultMessage.Text       = string.Format("Sorry! {0}", (string.IsNullOrEmpty(args.ErrorMsg)) ? "No features are found." : args.ErrorMsg);
            }

            this.IsBusy = false;
        }
コード例 #3
0
 /// <summary>
 /// Zoom map to a specific graphic
 /// </summary>
 public void ZoomToGraphics()
 {
     if (graphicsLayer != null)
     {
         // Expand the extent in case only one point graphic available in the graphics layer
         this.MapControl.ZoomTo(GeometryTool.ExpandGeometryExtent(this.GraphicsLayer.FullExtent, 0.25));
     }
 }
コード例 #4
0
 private void FeatureLayer_UpdateCompleted(object sender, EventArgs e)
 {
     if (agisFeatureLayer.FullExtent != null)
     {
         // Expand this extent in case only one point is selected
         this.MapControl.ZoomTo(GeometryTool.ExpandGeometryExtent(agisFeatureLayer.FullExtent, 0.0));
     }
 }
コード例 #5
0
        private void AddressCandidate_Click(object sender, MouseButtonEventArgs e)
        {
            if (sender is TextBlock)
            {
                TextBlock block = sender as TextBlock;

                if (block.Tag != null && block.Tag is MapPoint)
                {
                    MapPoint location = (MapPoint)block.Tag;
                    HighlightSelectedGraphic(location, block.Text);
                    this.MapControl.ZoomTo(GeometryTool.ExpandGeometryExtent(this.SelectedGraphic.Geometry, 0.5));
                }
            }
        }
コード例 #6
0
        private void RSSTitleLink_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (sender is SimpleLinkButton)
            {
                if (selectedRssItemPanel != null)
                {
                    TextBlock oldRssDesc = selectedRssItemPanel.FindName("RssDescription") as TextBlock;
                    oldRssDesc.Visibility = Visibility.Collapsed;

                    HyperlinkButton oldRssLink = selectedRssItemPanel.FindName("RssHyperlink") as HyperlinkButton;
                    oldRssLink.Visibility = Visibility.Collapsed;
                }

                SimpleLinkButton titleLink    = sender as SimpleLinkButton;
                StackPanel       rssItemStack = titleLink.Parent as StackPanel;
                selectedRssItemPanel = rssItemStack;

                TextBlock textRssDesc = rssItemStack.FindName("RssDescription") as TextBlock;
                if (textRssDesc != null)
                {
                    textRssDesc.Visibility = Visibility.Visible;
                }
                HyperlinkButton btnRssLink = rssItemStack.FindName("RssHyperlink") as HyperlinkButton;
                if (btnRssLink != null)
                {
                    btnRssLink.Visibility = Visibility.Visible;
                }

                ESRI.ArcGIS.Client.Geometry.Geometry geometry = titleLink.Tag as ESRI.ArcGIS.Client.Geometry.Geometry;
                this.MapControl.ZoomTo(GeometryTool.ExpandGeometryExtent(geometry, 0.10));

                /* If other widgets need to know the SelectedGraphic */
                this.SelectedGraphic          = new Graphic();
                this.SelectedGraphic.Geometry = geometry;
                this.SelectedGraphic.Attributes.Add("Title", titleLink.Text);
                this.SelectedGraphic.Attributes.Add("Description", textRssDesc.Text);
                this.SelectedGraphic.Attributes.Add("Link", btnRssLink.NavigateUri.AbsoluteUri);
            }
        }