Exemplo n.º 1
0
        public void setThemeGraphBar3DVisible(Workspace workspaceN)
        {
            Workspace wp = workspaceN;

            m_layerThemeGraphBar3D = null;
            try
            {
                if (m_layerThemeGraphBar3D == null)
                {
                    m_datasetVector = wp.Datasources[0].Datasets["盘锦行政区划"] as DatasetVector;
                    //构造统计专题图
                    ThemeGraph graphBar3D = new ThemeGraph();

                    //初始化子项,及子项的风格
                    GeoStyle geoStyle = new GeoStyle();
                    geoStyle.LineWidth        = 0.1;
                    geoStyle.FillGradientMode = FillGradientMode.Linear;

                    ThemeGraphItem item0 = new ThemeGraphItem();
                    item0.GraphExpression  = dilei + "00";
                    geoStyle.FillForeColor = Color.FromArgb(231, 154, 0);
                    item0.UniformStyle     = geoStyle;

                    ThemeGraphItem item1 = new ThemeGraphItem();
                    item1.GraphExpression  = dilei + "09";
                    geoStyle.FillForeColor = Color.FromArgb(70, 153, 255);
                    item1.UniformStyle     = geoStyle;



                    //添加子项
                    graphBar3D.Add(item0);
                    graphBar3D.Add(item1);


                    //设置偏移量,和非固定偏移,即随图偏移
                    //graphBar3D.IsOffsetFixed = false;
                    //graphBar3D.OffsetY = "13000";

                    ////设置非流动显示
                    //graphBar3D.IsFlowEnabled = false;

                    ////设置非避让方式显示
                    //graphBar3D.IsOverlapAvoided = false;

                    ////设置统计图显示的最大值和最小值,和非固定大小,即随图缩放
                    //graphBar3D.MaxGraphSize = 10000000.0000;
                    //graphBar3D.MinGraphSize = 0.0000;

                    ////显示统计图文本,并设置文本显示模式
                    //graphBar3D.IsGraphTextDisplayed = true;
                    //graphBar3D.GraphTextFormat = ThemeGraphTextFormat.Value;

                    //设置统计图类型
                    graphBar3D.GraphType = ThemeGraphType.Bar3D;

                    TextStyle textStyle = graphBar3D.GraphTextStyle;
                    textStyle.IsSizeFixed = false;
                    textStyle.FontHeight  = 10000;

                    //添加三维柱状统计图图层
                    m_layerThemeGraphBar3D = mapControl1.Map.Layers.Add(m_datasetVector, graphBar3D, true);
                }

                //设置图层是否可显示,并刷新地图
                m_layerThemeGraphBar3D.IsVisible = true;
                mapControl1.Map.Refresh();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设置是否显示三维柱状统计图
        /// Whether to display the theme of Bar3D graph or not
        /// </summary>
        /// <param name="value"></param>
        public void addThemeGraphBar3DVisible()
        {
            // 将等待光标设置为无效
            // IsWaitCursorEnabled property is set to be false
            m_mapControl.IsWaitCursorEnabled = false;
            // 设置反走样
            // IsAntialias property is set to be true
            m_mapControl.Map.IsAntialias = true;
            // 设置压盖时仍然显示
            // IsOverlapDisplayed property is set to be true
            m_mapControl.Map.IsOverlapDisplayed = true;
            // 打开地图即可同时显示三维柱状图,饼图,三维玫瑰图
            // Display the theme graphs in the map

            Boolean value = true;

            try
            {
                if (m_layerThemeGraphBar3D == null)
                {
                    // 构造统计专题图
                    // Create the theme layer of Pie graph
                    ThemeGraph graphBar3D = new ThemeGraph();

                    // 初始化子项,及子项的风格
                    // Initialize the theme items and set the style
                    GeoStyle geoStyle = new GeoStyle();
                    geoStyle.LineWidth        = 0.1;
                    geoStyle.FillGradientMode = FillGradientMode.Linear;

                    ThemeGraphItem item0 = new ThemeGraphItem();
                    item0.GraphExpression  = "Pop_Rate95";
                    geoStyle.FillForeColor = Color.FromArgb(231, 154, 0);
                    item0.UniformStyle     = geoStyle;

                    ThemeGraphItem item1 = new ThemeGraphItem();
                    item1.GraphExpression  = "Pop_Rate99";
                    geoStyle.FillForeColor = Color.FromArgb(70, 153, 255);
                    item1.UniformStyle     = geoStyle;



                    // 添加子项
                    // Add the items into the theme
                    graphBar3D.Add(item0);
                    graphBar3D.Add(item1);


                    // 设置偏移量,和非固定偏移,即随图偏移
                    // Set the offset value
                    graphBar3D.IsOffsetFixed = false;
                    graphBar3D.OffsetY       = "13000";

                    // 设置非流动显示
                    //IsFlowEnabled property is set to be false
                    graphBar3D.IsFlowEnabled = false;

                    // 设置非避让方式显示
                    // IsOverlapAvoided property is set to be true
                    graphBar3D.IsOverlapAvoided = true;

                    // 设置统计图显示的最大值和最小值,和非固定大小,即随图缩放
                    // Set the MaxGraphSize and MinGraphSize property
                    graphBar3D.MaxGraphSize = 100000.0000;
                    graphBar3D.MinGraphSize = 50000.0000;

                    // 显示统计图文本,并设置文本显示模式
                    // Display the text of theme graph
                    graphBar3D.IsGraphTextDisplayed = true;
                    graphBar3D.GraphTextFormat      = ThemeGraphTextFormat.Value;

                    // 设置统计图类型
                    // Set the type of theme graph
                    graphBar3D.GraphType = ThemeGraphType.Bar3D;

                    TextStyle textStyle = graphBar3D.GraphTextStyle;
                    textStyle.IsSizeFixed = false;
                    textStyle.FontHeight  = 10000;

                    // 添加三维柱状统计图图层
                    // Add the theme layer of Pie graph into the map
                    m_layerThemeGraphBar3D = m_mapControl.Map.Layers.Add(m_dataset, graphBar3D, true);
                }

                // 设置图层是否可显示,并刷新地图
                // Whether to display the theme layer or not .Refresh the map
                m_layerThemeGraphBar3D.IsVisible = value;
                this.m_mapControl.Map.Refresh();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }