示例#1
0
        }         // private void onMapLabelChanged(object sender, TextChangedEventArgs e)

        public void updateLayout()
        {
            // apply print layout
            log(string.Format("PrintForm.updateLayout"));
            this.label1.Content    = string.Format("{0}", this.tbMapLabel.Text);
            this.label1.FontFamily = SelectedFontFamily;
            this.label1.FontSize   = SelectedFontSize;

            this.tbDescription.Text       = string.Format("{0}", tbDescrSrc.Text);
            this.tbDescription.FontFamily = SelectedFontFamily;
            this.tbDescription.FontSize   = SelectedDescrFontSize;

            updatePixelsFromMillimeters();
            printableArea.Height = SelectedHeightPx;
            printableArea.Width  = SelectedWidthPx;

            scaleLine1.Map     = this.Map;
            scaleLine1.MapUnit = ESRI.ArcGIS.Client.Toolkit.ScaleLine.ScaleLineUnit.Kilometers;

            if (legendFixed)
            {
                ;
            }
            else
            {
                legendFixed = true;
                ESRI.ArcGIS.Client.Toolkit.Legend lgnd = this.legend1;
                foreach (var x in lgnd.LayerItems)                  // remove basemap from legend
                {
                    lgnd.LayerItems.Remove(x);
                    break;
                }

                ObservableCollection <ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel>
                swap = new ObservableCollection <ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel>();
                foreach (var x in lgnd.LayerItems)                  // fix labels
                {
                    var vl = new VLayer(x.Layer);
                    x.Label = vl.lyrName;
                    swap.Add(x);
                }
                lgnd.LayerItems.Clear();
                for (int ind = swap.Count; ind > 0; ind--)
                {
                    var x = swap[ind - 1];
                    lgnd.LayerItems.Insert(swap.Count - ind, x);
                }
            }             // fix legend

            if (cbLegend.IsChecked == false)
            {
                // legend off
                this.legend1.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                // legend on
                this.legend1.Visibility = System.Windows.Visibility.Visible;
                // legend width tailored
                log(string.Format("PrintForm.updateLayout: legend W {0}, map W {1}, prnA W {2}; legend ActW {3}, map ActW {4}",
                                  legend1.Width, Map.Width, printableArea.Width, legend1.ActualWidth, Map.ActualWidth));
                double mw = this.Map.ActualWidth;
                if (double.IsNaN(mw))
                {
                    mw = printableArea.Width;
                }
                if (double.IsNaN(this.legend1.ActualWidth) ||
                    this.legend1.ActualWidth > (mw / 4))
                {
                    this.legend1.Width = mw / 4;
                }
            }             // show legend

            if (cbComment.IsChecked == false)
            {
                // comment off
                this.tbDescription.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                // comment on
                this.tbDescription.Visibility = System.Windows.Visibility.Visible;
            }
        }         // public void updateLayout()
示例#2
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ESRIStandardMapApplication1;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.Map = ((ESRI.ArcGIS.Client.Map)(this.FindName("Map")));
     this.MainManu = ((ESRI.ArcGIS.SilverlightMapApp.CollapsiblePanel)(this.FindName("MainManu")));
     this.BannerGrid = ((System.Windows.Controls.Grid)(this.FindName("BannerGrid")));
     this.title = ((System.Windows.Controls.TextBlock)(this.FindName("title")));
     this.separatorBar = ((System.Windows.Shapes.Rectangle)(this.FindName("separatorBar")));
     this.subtitle = ((System.Windows.Controls.TextBlock)(this.FindName("subtitle")));
     this.myMenu = ((System.Windows.Controls.Button)(this.FindName("myMenu")));
     this.btnAbout = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("btnAbout")));
     this.myMenuItems = ((System.Windows.Controls.Grid)(this.FindName("myMenuItems")));
     this.myMenuItem1 = ((System.Windows.Controls.Button)(this.FindName("myMenuItem1")));
     this.myMenuItem2 = ((System.Windows.Controls.Button)(this.FindName("myMenuItem2")));
     this.myMenuItem3 = ((System.Windows.Controls.Button)(this.FindName("myMenuItem3")));
     this.BaseMapSwitcher = ((System.Windows.Controls.Border)(this.FindName("BaseMapSwitcher")));
     this.MainToolbar = ((ESRI.ArcGIS.SilverlightMapApp.CollapsiblePanel)(this.FindName("MainToolbar")));
     this.btnToggleBaseMapSwitcher = ((System.Windows.Controls.Button)(this.FindName("btnToggleBaseMapSwitcher")));
     this.btnToggleMapLegend = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("btnToggleMapLegend")));
     this.btnToggleOverviewMap = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("btnToggleOverviewMap")));
     this.btnToggleMagnifyingGlass = ((System.Windows.Controls.Button)(this.FindName("btnToggleMagnifyingGlass")));
     this.Navigator = ((ESRI.ArcGIS.Client.Toolkit.Navigation)(this.FindName("Navigator")));
     this.ScaleBar = ((ESRI.ArcGIS.Client.Toolkit.ScaleLine)(this.FindName("ScaleBar")));
     this.OverviewMapPanel = ((ESRI.ArcGIS.SilverlightMapApp.WindowPanel)(this.FindName("OverviewMapPanel")));
     this.OVMap = ((ESRI.ArcGIS.Client.Toolkit.OverviewMap)(this.FindName("OVMap")));
     this.MagnifyingGlass = ((ESRI.ArcGIS.Client.Toolkit.MagnifyingGlass)(this.FindName("MagnifyingGlass")));
     this.MapLegendPanel = ((ESRI.ArcGIS.SilverlightMapApp.WindowPanel)(this.FindName("MapLegendPanel")));
     this.Legend = ((ESRI.ArcGIS.Client.Toolkit.Legend)(this.FindName("Legend")));
     this.AboutWindow = ((ESRI.ArcGIS.SilverlightMapApp.WindowPanel)(this.FindName("AboutWindow")));
 }