Esempio n. 1
0
        private void LoopHideLegend(ILayer layer)
        {
            ILegendGroup lgroup = null;

            if (layer is ICompositeLayer && (layer as ICompositeLayer).Count > 0)
            {
                ICompositeLayer cplayer  = layer as ICompositeLayer;
                ILayer          sublayer = null;
                for (int j = 0; j < cplayer.Count; j++)
                {
                    sublayer = cplayer.get_Layer(j);
                    LoopHideLegend(sublayer);
                }
            }
            else
            {
                ILegendInfo lInfo = layer as ILegendInfo;
                if (lInfo != null && lInfo.LegendGroupCount >= 0)
                {
                    for (int g = 0; g < lInfo.LegendGroupCount; g++)
                    {
                        lgroup         = lInfo.get_LegendGroup(g);
                        lgroup.Visible = false;
                    }
                }
            }
        }
Esempio n. 2
0
 public void Add(ILegendGroup legendGroup)
 {
     if (legendGroup != null && !_legendGroups.Contains(legendGroup))
     {
         _legendGroups.Add(legendGroup);
     }
 }
    ESRI.ArcGIS.Carto.ILegendGroup ILegendInfo.get_LegendGroup(int Index)
        {
            string strHeading = null;
            ILegendInfo pLegendInfo = null;
            switch (Index)
            {
                case 0:
                    pLegendInfo = m_pMainRend as ILegendInfo;
                    if (m_pMainRend == m_pShapePatternRend)
                        strHeading = "Shape/Pattern: ";
                    else if (m_pMainRend == m_pSizeRend)
                        strHeading = "Size: ";
                    else
                        strHeading = "Color 1: ";
                    break;
                case 1:
                    if (m_pShapePatternRend != null)
                    {
                        if (m_pSizeRend != null)
                        {
                            pLegendInfo = m_pSizeRend as ILegendInfo;
                            strHeading = "Size: ";
                        }
                        else
                        {
                            pLegendInfo = m_pColorRend1 as ILegendInfo;
                            strHeading = "Color 1: ";
                        }
                    }
                    else
                    {
                        if (m_pSizeRend != null)
                        {
                            pLegendInfo = m_pColorRend1 as ILegendInfo;
                            strHeading = "Color 1: ";
                        }
                        else
                        {
                            pLegendInfo = m_pColorRend2 as ILegendInfo;
                            strHeading = "Color 2: ";
                        }
                    }
                    break;
                case 2:
                    pLegendInfo = m_pColorRend1 as ILegendInfo;
                    strHeading = "Color 1: ";
                    break;
                case 3:
                    pLegendInfo = m_pColorRend2 as ILegendInfo;
                    strHeading = "Color 2: ";

                    break;
            }

            ILegendGroup pLegendGroup = null;
            pLegendGroup = pLegendInfo.get_LegendGroup(0);
            //pLegendGroup.Heading = strHeading & pLegendGroup.Heading

            return pLegendGroup;
        }
        /// <summary>
        /// Class default constructor
        /// </summary>
        public GlobeCustomLayerBase()
        {
            m_sName       = string.Empty;
            m_bVisible    = true;
            m_bValid      = true;
            m_bCached     = false;
            m_dblMaxScale = 0;
            m_dblMinScale = 0;
            m_table       = new DataTable("RECORDS");

            m_table.Columns.Add("ID", typeof(long));

            m_extensions = new ArrayList();

            ILegendClass legendClass = new LegendClassClass();

            legendClass.Label = "GlobeCustomLayer";

            m_legendGroup          = new LegendGroupClass();
            m_legendGroup.Heading  = "";
            m_legendGroup.Editable = false;
            m_legendGroup.AddClass(legendClass);

            m_sName = "GlobeCustomLayer";

            //call CreateControl in order to create the handle
            this.CreateControl();
        }
Esempio n. 5
0
        private void InsertLegendInfoToTree(ILegendInfo pLegendInfo, TOCTreeNode pParantNode)
        {
            int         legendGroupCount = pLegendInfo.LegendGroupCount;
            TOCTreeNode pNode            = pParantNode;
            TOCTreeNode node2            = null;

            for (int i = 0; i < legendGroupCount; i++)
            {
                ILegendGroup group = pLegendInfo.get_LegendGroup(i);
                if (legendGroupCount > 1)
                {
                    pNode = new TOCTreeNodeEx(group.Heading)
                    {
                        Tag = group
                    };
                    pParantNode.Nodes.Add(pNode);
                }
                int classCount = group.ClassCount;
                for (int j = 0; j < classCount; j++)
                {
                    ILegendClass class2 = group.get_Class(j);
                    node2 = new TOCTreeNodeEx(class2.Label, false, true)
                    {
                        Tag = class2
                    };
                    pNode.Nodes.Add(node2);
                }
            }
        }
        ILegendGroup ILegendInfo.get_LegendGroup(int Index)
        {
            ILegendGroup pLegendGroup = m_pTwoLegendGroup.get_Element(Index);


            m_pLegendGroup = pLegendGroup;
            return(m_pLegendGroup);
        }
Esempio n. 7
0
        public VerySimpleCustomRenderer()
        {
            lg = new LegendGroupClass();
            ILegendClass lc = new LegendClassClass();

            sym       = new SimpleFillSymbolClass();
            lc.Label  = "A very simple custom renderer";
            lc.Symbol = sym;
            lg.AddClass(lc);
        }
Esempio n. 8
0
 private void CollapseGroup(ILayer layer)
 {
     try
     {
         ILegendInfo  info  = (ILegendInfo)layer;
         ILegendGroup group = (ILegendGroup)info.get_LegendGroup(0);
         group.Visible = false;
     }
     catch (Exception) { }
 }
Esempio n. 9
0
        //Create Legend
        public void CreateLegend()
        {
            clsSnippet pSnippet = new clsSnippet();

            //Create Legend Group
            m_pLegendGroup = new LegendGroup();

            m_pLegendGroup.Heading  = "Robustness";
            m_pLegendGroup.Editable = true;
            m_pLegendGroup.Visible  = true;

            //For Values
            ILegendClass legendClass = new LegendClass();

            ILineFillSymbol pLineFillSym = new LineFillSymbolClass();



            double dblInstantSep = (dblFromSep - dblToSep) / Convert.ToDouble(intUncernBreakCount - 2);

            for (int i = 0; i < intUncernBreakCount; i++)
            {
                legendClass = new LegendClass();
                if (i == intUncernBreakCount - 1)
                {
                    legendClass.Label = "1";
                }
                else if (i == intUncernBreakCount - 2)
                {
                    legendClass.Label = arrRobustBrks[i].ToString() + " - " + (1 - (1 * Math.Pow(0.1, intRoundingDigits))).ToString();
                }
                else
                {
                    legendClass.Label = arrRobustBrks[i].ToString() + " - " + (arrRobustBrks[i + 1] - (1 * Math.Pow(0.1, intRoundingDigits))).ToString();
                }

                pLineFillSym = new LineFillSymbolClass();

                pLineFillSym.Angle            = dblAngle;
                pLineFillSym.Color            = pLineColor;
                pLineFillSym.LineSymbol.Width = dblLinewidth;
                if (i == (intUncernBreakCount - 1))
                {
                    pLineFillSym.Separation = double.MaxValue;
                }
                else
                {
                    pLineFillSym.Separation = dblToSep + (dblInstantSep * Convert.ToDouble(i));
                }
                legendClass.Symbol = pLineFillSym as ISymbol;
                m_pLegendGroup.AddClass(legendClass);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Creates legend items for each layer and symbology category.
        /// </summary>
        private IEnumerable <LegendItem> CreateLegendItems(ILegendGroup group)
        {
            var layers = group.Layers.Where(item => _layerHandles.Contains(item.Handle)).ToList();

            foreach (var item in layers.Where(l => !l.HideFromLegend))
            {
                var fs = item.FeatureSet;
                if (fs != null)
                {
                    // default style for layer
                    yield return(new LegendItem {
                        Layer = item, Options = fs.Style, Name = item.Name
                    });

                    // categories
                    foreach (var ct in fs.Categories)
                    {
                        string name = item.Name + ": " + ct.Name;
                        yield return(new LegendItem {
                            Layer = item, Options = ct.Style, Name = name
                        });
                    }

                    continue;
                }

                if (item.Raster != null)
                {
                    // it's an image
                    yield return(new LegendItem {
                        Layer = item, Options = null, Name = item.Name
                    });

                    var scheme = item.Raster.ActiveColorScheme;
                    if (scheme != null)
                    {
                        foreach (var ct in scheme)
                        {
                            yield return(new LegendItem {
                                Layer = item, RasterBreak = ct, Name = ct.Range
                            });
                        }
                    }

                    continue;
                }

                yield return(new LegendItem {
                    Layer = item, Name = item.Name
                });
            }
        }
Esempio n. 11
0
 private void FoldLyrsItem_Click(object sender, EventArgs e)
 {
     //折叠所有图层
     for (int i = 0; i < this.axMapcontrol.LayerCount; i++)
     {
         ILegendInfo m_LengendInfo = this.axMapcontrol.get_Layer(i) as ILegendInfo;
         for (int j = 0; j < m_LengendInfo.LegendGroupCount; j++)
         {
             ILegendGroup pLenGroup = m_LengendInfo.get_LegendGroup(j) as ILegendGroup;
             pLenGroup.Visible = false;
         }
     }
     this.axTOOControl.Update();
 }
Esempio n. 12
0
 public void SetSymbol(ILegendItem item, ISymbol symbol)
 {
     for (int i = 0; i < LegendItemCount; i++)
     {
         if (item == LegendItem(i))
         {
             ILegendGroup legendGroup = ByIndex(i);
             if (legendGroup != null)
             {
                 legendGroup.SetSymbol(item, symbol);
             }
             break;
         }
     }
 }
        private void LoadFileList()
        {
            bool       itWorked    = false;
            GroupLayer rasterGroup = null;

            if (_fileList.Count > 0)
            {
                rasterGroup      = new GroupLayer();
                rasterGroup.Name = "New Files";
            }

            foreach (KeyValuePair <String, Boolean> file in _fileList)
            {
                if (file.Value == true)
                {
                    if (!itWorked)
                    {
                        //SaveFileTypeList(GetExtension());
                        itWorked = true;
                    }

                    string filePath = txb_FileWorkspace.Text + "\\" + Utilities.Utilities_General.AddPrefixAndSuffixToFileName(file.Key, txb_Prefix.Text, txb_Suffix.Text) + GetExtension();
                    try
                    {
                        IRasterLayer rasterLayer = new RasterLayer();
                        rasterLayer.CreateFromFilePath(filePath);
                        ILegendGroup group = ((ILegendInfo)rasterLayer).get_LegendGroup(0);
                        group.Visible = false;
                        rasterGroup.Add(rasterLayer);
                    }
                    catch (Exception ex)
                    {
                        ex.ToString();
                        // Just So ArcMap doesn't crash ;)
                    }
                }
            }
            if (itWorked)
            {
                if (rasterGroup != null)
                {
                    _mxdocument.AddLayer(rasterGroup);
                }
                _mxdocument.ActivatedView.Refresh();
            }

            _fileList.Clear();
        }
Esempio n. 14
0
        public void SetSymbol(ISymbol symbol)
        {
            ILegendGroup legendGroup = LegendItem.LegendGroup(_layerItem);

            if (legendGroup == null)
            {
                return;
            }
            legendGroup.SetSymbol(_legendItem, symbol);
            if (_legendItem is ISymbol)
            {
                ((ISymbol)_legendItem).Release();
            }

            _legendItem = symbol;
        }
Esempio n. 15
0
        /// <summary>
        /// Handles Layer position changes within groups
        /// </summary>
        /// <param name="currentPositionInGroup"> The Current Position In Group. </param>
        /// <param name="source"> The Source group </param>
        /// <param name="targetPositionInGroup"> The Target Position In Group. </param>
        /// <param name="target"> The Destination group. Can be the same as the Source </param>
        public void ChangeLayerPosition(ILegendGroup source, int currentPositionInGroup, ILegendGroup target, int targetPositionInGroup = -1)
        {
            var sourceGroup      = source as LegendGroup;
            var destinationGroup = target as LegendGroup;

            if (sourceGroup == null || destinationGroup == null)
            {
                throw new NullReferenceException("Group reference is null");
            }

            if (currentPositionInGroup < 0 || currentPositionInGroup >= sourceGroup.Layers.Count)
            {
                throw new IndexOutOfRangeException("Invalid layer index");
            }

            var lyr = sourceGroup.LayersList[currentPositionInGroup];

            sourceGroup.LayersList.Remove(lyr);

            if (targetPositionInGroup >= destinationGroup.Layers.Count || targetPositionInGroup == -1)
            {
                destinationGroup.LayersList.Add(lyr);
            }
            else if (targetPositionInGroup <= 0)
            {
                destinationGroup.LayersList.Insert(0, lyr);
            }
            else
            {
                destinationGroup.LayersList.Insert(targetPositionInGroup, lyr);
            }

            sourceGroup.RecalcHeight();
            sourceGroup.UpdateGroupVisibility();

            if (sourceGroup.Handle != destinationGroup.Handle)
            {
                destinationGroup.RecalcHeight();
                destinationGroup.UpdateGroupVisibility();

                _legend.SelectedGroupHandle = destinationGroup.Handle;
            }
        }
Esempio n. 16
0
        void ISpacingBreaksRenderer.CreateLegend()
        {
            //Create Legend Group
            m_pLegendGroup = new LegendGroup();

            m_pLegendGroup.Heading  = strHeading;
            m_pLegendGroup.Editable = true;
            m_pLegendGroup.Visible  = true;

            intBrksCount  = arrClassBrks.Length - 1;
            dblInstantSep = (dblFromSep - dblToSep) / Convert.ToDouble(intBrksCount - 1);



            //For Values
            ILegendClass legendClass = new LegendClass();

            ILineFillSymbol pLineFillSym = new LineFillSymbolClass();

            for (int i = 0; i < intBrksCount; i++)
            {
                legendClass = new LegendClass();
                //if (i == intUncernBreakCount - 1)
                //    legendClass.Label = "1";
                //else if (i == intUncernBreakCount - 2)
                //    legendClass.Label = arrClassBrks[i].ToString() + " - " + (1 - (1 * Math.Pow(0.1, intRoundingDigits))).ToString();
                //else
                legendClass.Label = Math.Round(arrClassBrks[i], intRoundingDigits).ToString() + " - " + (Math.Round(arrClassBrks[i + 1], intRoundingDigits) - (1 * Math.Pow(0.1, intRoundingDigits))).ToString();

                pLineFillSym = new LineFillSymbolClass();

                pLineFillSym.Angle            = dblLineAngle;
                pLineFillSym.Color            = pLineRgb;
                pLineFillSym.LineSymbol.Width = dblLineWidth;
                pLineFillSym.Separation       = dblToSep + (dblInstantSep * Convert.ToDouble(i));

                legendClass.Symbol = pLineFillSym as ISymbol;
                m_pLegendGroup.AddClass(legendClass);
            }
        }
Esempio n. 17
0
 private void ExpandedLayers(ILayer layer, bool expended)
 {
     if (layer is IGroupLayer)
     {
         ICompositeLayer pCompositeLayer = (ICompositeLayer)layer;
         for (int i = 0; i < pCompositeLayer.Count; i++)
         {
             ILayer pLayer = pCompositeLayer.Layer[i];
             ExpandedLayers(pLayer, expended);
         }
         ((IGroupLayer)layer).Expanded = expended;
     }
     else if (layer is ILegendInfo)
     {
         ILegendInfo pLegendInfo = layer as ILegendInfo;
         for (int j = 0; j < pLegendInfo.LegendGroupCount; j++)
         {
             ILegendGroup pLegendGroup = pLegendInfo.LegendGroup[j];
             pLegendGroup.Visible = expended;
         }
     }
 }
        /// <summary>
        /// Dispose the layer
        /// </summary>
        /// <returns></returns>
        public virtual new void Dispose()
        {
            if (IntPtr.Zero != m_hSmallBitmap)
            {
                DeleteObject(m_hSmallBitmap);
            }

            if (IntPtr.Zero != m_hLargeBitmap)
            {
                DeleteObject(m_hLargeBitmap);
            }

            m_extensions.Clear();
            m_table.Dispose();

            m_extent      = null;
            m_spRef       = null;
            m_legendGroup = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
        private void ShowHideLegend(RendererItem item)
        {
            if (_renderer == null)
            {
                return;
            }

            int index = RendererBox.Items.IndexOf(item);

            if (index == -1)
            {
                return;
            }

            if (!item.ShowLegend)
            {
                for (int i = index + 1; i < RendererBox.Items.Count; i++)
                {
                    if (RendererBox.Items[i] is RendererItem)
                    {
                        break;
                    }
                    RendererBox.Items.RemoveAt(i);
                    i--;
                }
            }
            else
            {
                if (item.LabelRenderer is ILegendGroup)
                {
                    ILegendGroup lGroup = item.LabelRenderer as ILegendGroup;
                    for (int i = 0; i < lGroup.LegendItemCount; i++)
                    {
                        RendererBox.Items.Insert(index + 1, new LegendItem(lGroup.LegendItem(i)));
                    }
                }
            }
        }
Esempio n. 20
0
        //Create Legend
        public void CreateLegend()
        {
            clsSnippet pSnippet = new clsSnippet();

            //Create Legend Group
            m_pLegendGroup          = new LegendGroup();
            m_pLegendGroup.Heading  = m_strOriRenderField;
            m_pLegendGroup.Editable = true;
            m_pLegendGroup.Visible  = true;

            ILegendClass legendClass = new LegendClass();

            legendClass.Label = Math.Round(dblMaxValue, 0).ToString();

            IStackedChartSymbol stackedChartSymbol = new StackedChartSymbolClass();

            //IBarChartSymbol barChartSymbol = new BarChartSymbolClass();
            stackedChartSymbol.Width = 10;
            if (bln3Dfeature)
            {
                I3DChartSymbol p3DChartSymbol = stackedChartSymbol as I3DChartSymbol;
                p3DChartSymbol.Display3D = true;
                p3DChartSymbol.Thickness = 3;
            }
            //IMarkerSymbol markerSymbol = stackedChartSymbol as IMarkerSymbol;
            //markerSymbol.Size = 50;
            IChartSymbol chartSymbol = stackedChartSymbol as IChartSymbol;

            chartSymbol.MaxValue = dblMaxValue;

            ISymbolArray symbolArray = stackedChartSymbol as ISymbolArray;
            //Stacked Symbol
            IFillSymbol fillSymbol = new SimpleFillSymbolClass();

            fillSymbol.Color         = pSnippet.getRGB(255, 0, 0);
            fillSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);
            symbolArray.AddSymbol(fillSymbol as ISymbol);
            chartSymbol.set_Value(0, dblMaxUncern);

            //fillSymbol = new SimpleFillSymbolClass();
            //fillSymbol.Color = pSnippet.getRGB(255, 0, 0);
            //fillSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);
            //symbolArray.AddSymbol(fillSymbol as ISymbol);
            //chartSymbol.set_Value(1, dblMaxUncern);

            fillSymbol               = new SimpleFillSymbolClass();
            fillSymbol.Color         = pSnippet.getRGB(255, 255, 255);
            fillSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);
            symbolArray.AddSymbol(fillSymbol as ISymbol);
            chartSymbol.set_Value(1, dblMaxEstimate - dblMaxUncern);

            legendClass.Symbol = (ISymbol)chartSymbol;
            m_pLegendGroup.AddClass(legendClass);

            //Bounds
            legendClass       = new LegendClass();
            legendClass.Label = "Upper Bound";
            ISimpleFillSymbol pLegendUncerSymbol = new SimpleFillSymbol();

            pLegendUncerSymbol.Color         = pSnippet.getRGB(0, 0, 255);
            pLegendUncerSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);

            legendClass.Symbol = (ISymbol)pLegendUncerSymbol;
            m_pLegendGroup.AddClass(legendClass);

            legendClass                      = new LegendClass();
            legendClass.Label                = "Lower Bound";
            pLegendUncerSymbol               = new SimpleFillSymbol();
            pLegendUncerSymbol.Color         = pSnippet.getRGB(255, 0, 0);
            pLegendUncerSymbol.Outline.Color = pSnippet.getRGB(0, 0, 0);

            legendClass.Symbol = (ISymbol)pLegendUncerSymbol;
            m_pLegendGroup.AddClass(legendClass);
        }
        public static void UpdateMapUnitPolysRenderer(IWorkspace theWorkspace)
        {
            // Get the MapUnitPolys Layer from the ToC
            IFeatureLayer theLayer = commonFunctions.FindFeatureLayer(theWorkspace, "MapUnitPolys");

            // If the layer was not found, don't try and update the renderer!
            if (theLayer == null)
            {
                return;
            }

            // Setup the renderer
            IUniqueValueRenderer theRenderer = new UniqueValueRendererClass();

            theRenderer.FieldCount = 1;
            theRenderer.Field[0]   = "MapUnit";

            // Setup a couple variables
            IColor nullColor = new RgbColorClass();

            nullColor.NullColor = true;

            // Setup a blank line
            ILineSymbol nullLine = new SimpleLineSymbolClass();

            nullLine.Color = nullColor;

            // Setup the "All Other Values" symbol
            ISimpleFillSymbol defaultSymbol = new SimpleFillSymbolClass();
            IColor            defaultColor  = new RgbColorClass();

            defaultColor.RGB      = 255;
            defaultSymbol.Color   = defaultColor;
            defaultSymbol.Outline = nullLine;

            // Apply the "All other values" symbol to the renderer
            theRenderer.DefaultSymbol    = defaultSymbol as ISymbol;
            theRenderer.UseDefaultSymbol = true;

            string theHeading = "Geologic Map Units";

            // Get the Legend Items
            var sortedDmu = GetDmuSortedByHierarchy(theWorkspace);

            // Loop through the legend items
            foreach (KeyValuePair <string, DescriptionOfMapUnitsAccess.DescriptionOfMapUnit> legendEntry in sortedDmu)
            {
                DescriptionOfMapUnitsAccess.DescriptionOfMapUnit thisDmuEntry = legendEntry.Value;

                // If this is a heading, make it so
                if (thisDmuEntry.ParagraphStyle.Contains("Heading") == true)
                {
                    theHeading = thisDmuEntry.Name;
                    continue;
                }

                // Make a Simple Fill RuleID
                ISimpleFillSymbol theSymbol = new SimpleFillSymbolClass();
                //theRuleID.Style = esriSimpleFillStyle.esriSFSSolid;

                // Get the right color
                IColor   symbolColor = new RgbColorClass();
                string   rgbString   = thisDmuEntry.AreaFillRGB;
                string[] rgbValues   = rgbString.Split(';');

                // Long integer representations of RGB values are dumb: G*65536 + B*256 + R
                if (rgbValues.Length < 3)
                {
                    symbolColor.RGB = 16777215;
                }
                else
                {
                    symbolColor.RGB = int.Parse(rgbValues[0]) + int.Parse(rgbValues[1]) * 256 + int.Parse(rgbValues[2]) * 65536;
                }
                theSymbol.Color = symbolColor;

                theSymbol.Outline = nullLine;

                // Add it to the renderer
                theRenderer.AddValue(thisDmuEntry.MapUnit, theHeading, theSymbol as ISymbol);

                // Give it the right label
                theRenderer.Label[thisDmuEntry.MapUnit] = thisDmuEntry.MapUnit + " - " + thisDmuEntry.Name;
            }

            // Apply the renderer
            IGeoFeatureLayer geoFLayer = (IGeoFeatureLayer)theLayer;

            geoFLayer.Renderer = (IFeatureRenderer)theRenderer;

            // Minimizing the legend info in the Table of Contents is not trivial
            ILegendInfo layerLegendInfo = (ILegendInfo)theLayer;

            for (int i = 0; i < layerLegendInfo.LegendGroupCount; i++)
            {
                ILegendGroup layerLegendGroup = layerLegendInfo.get_LegendGroup(i);
                layerLegendGroup.Visible = false;
            }

            // Update the views
            ArcMap.Document.UpdateContents();
            ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, theLayer, null);
        }
Esempio n. 22
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //高程底面
            ILayer   pBaseLayer = null;
            ISurface pSurface   = null;

            if (m_pSceneCtrl != null)
            {
                try
                {
                    // m_pSceneCtrl.LoadSxFile(ClsGDBDataCommon.GetParentPathofExe() +@"Resource\DefaultData\Default.sxd");
                }
                catch
                {
                }
                //IScene pScene = new SceneClass();
                //pScene.Name = "Scene";
                //m_pSceneCtrl.Scene = pScene;

                IScene pScene = m_pSceneCtrl.Scene;
                pScene.Name = "Scene";
                //ILayer pglayer = new GraphicsLayer3DClass();
                //pScene.AddLayer(pglayer);
                //pScene.ActiveGraphicsLayer = new CompositeGraphicsLayerClass();

                pScene.ExaggerationFactor = Convert.ToDouble(doubleInputExaFactor.Value.ToString());
                while (pScene.LayerCount > 0)
                {
                    pScene.DeleteLayer(pScene.get_Layer(0));
                }
                // pScene.ClearLayers();
                pScene.AddLayer(pScene.ActiveGraphicsLayer);
                GC.Collect();
                for (int i = 0; i < m_pMapCtrl.Map.LayerCount; i++)
                {
                    ILayer pMapLayer = m_pMapCtrl.Map.get_Layer(i);
                    ILayer pLayer    = pMapLayer;

                    if (comboBoxExBaseHeightLayer.Items.Count > 0)
                    {
                        if (pLayer.Name == comboBoxExBaseHeightLayer.SelectedItem.ToString())
                        {
                            pBaseLayer = pLayer;
                        }
                    }
                }

                if (pBaseLayer is IRasterLayer)
                {
                    IRaster        pRaster  = ((IRasterLayer)pBaseLayer).Raster;
                    IRasterBand    pBand    = ((IRasterBandCollection)pRaster).Item(0);
                    IRasterSurface rsurface = new RasterSurface();
                    rsurface.RasterBand = pBand;
                    //将dem的数据指定为surface
                    pSurface = rsurface as ISurface;
                }
                if (pBaseLayer is ITinLayer)
                {
                    ITin        pTin        = ((ITinLayer)pBaseLayer).Dataset;
                    ITinSurface pTinSurface = pTin as ITinSurface;
                    pSurface = pTinSurface as ISurface;
                }


                for (int i = 0; i < m_pMapCtrl.Map.LayerCount; i++)
                {
                    ILayer pMapLayer = m_pMapCtrl.Map.get_Layer(i);

                    ILayer pLayer     = pMapLayer;
                    string filepath   = "";
                    string filename   = "";
                    string sourcepath = GetDataLayerPath(pMapLayer as IDataLayer, ref filepath, ref filename);

                    //if (pMapLayer is IRasterLayer)
                    //{
                    //    IRasterLayer prl = new RasterLayerClass();
                    //     prl.CreateFromRaster(((IRasterLayer)pMapLayer).Raster);
                    //     pLayer = prl as ILayer;
                    //}
                    if (pMapLayer is IFeatureLayer)
                    {
                        // if (((IFeatureLayer)pMapLayer).FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch)
                        //  {

                        IFeatureLayer pfl = new FeatureLayerClass();
                        IFeatureClass pFc = ((IFeatureLayer)pMapLayer).FeatureClass;
                        if (pFc != null)
                        {
                            pfl.FeatureClass = ((IFeatureLayer)pMapLayer).FeatureClass;
                            pLayer           = pfl as ILayer;
                            pLayer.Name      = pMapLayer.Name;

                            /////////////////////////////////////////////////////////////////////
                            //后期添加,用于带进涂层渲染
                            /////////////////////////////////////////////////////////////////////
                            IGeoFeatureLayer pGeoFLayer  = pfl as IGeoFeatureLayer;
                            IGeoFeatureLayer pGFMapLayer = pMapLayer as IGeoFeatureLayer;
                            if (pGFMapLayer != null)  //注记图层为空
                            {
                                pGeoFLayer.Renderer = pGFMapLayer.Renderer;
                                ILegendInfo pLegend3D = (ILegendInfo)pGeoFLayer;
                                for (int k = 0; k < pLegend3D.LegendGroupCount; k++)
                                {
                                    ILegendGroup pLgroup = pLegend3D.LegendGroup[k];
                                    for (int p = 0; p < pLgroup.ClassCount; p++)
                                    {
                                        ILegendClass pLClass = pLgroup.Class[p];
                                        if (pLClass.Symbol is IMarkerSymbol)
                                        {
                                            IMarkerSymbol pSMSymbol = pLClass.Symbol as IMarkerSymbol;
                                            pSMSymbol.Size /= 20;
                                        }
                                    }
                                }
                                if (pFc.ShapeType == esriGeometryType.esriGeometryMultipoint || pFc.ShapeType == esriGeometryType.esriGeometryPoint)
                                {
                                    if (pGFMapLayer.Renderer is IUniqueValueRenderer)
                                    {
                                    }
                                }
                            }
                        }
                        //  }
                    }

                    #region 这段代码家的有点重复,如果不加有时候会弹出设置数据源的对话框
                    if (pLayer is IRasterLayer)
                    {
                        I3DProperties properties = null;

                        properties = new Raster3DPropertiesClass();
                        ILayerExtensions layerextensions = pLayer as ILayerExtensions;

                        object p3d;
                        for (int j = 0; j < layerextensions.ExtensionCount; j++)
                        {
                            p3d = layerextensions.get_Extension(j);
                            if (p3d != null)
                            {
                                properties = p3d as I3DProperties;
                                if (properties != null)
                                {
                                    break;
                                }
                            }
                        }
                        properties.BaseOption  = esriBaseOption.esriBaseSurface;
                        properties.BaseSurface = pSurface;
                        //I、更改分辨率后,如何让分辨率设置发挥作用。主要是刷新的问题(使用IActiveView刷新、而不能使用Iscene及IScenegraph刷新)
                        //II、分辨率数值在( 262144-268435456)范围之内,越大越清晰。使用3DProperties.MaxTextureMemory 方法
                        properties.MaxTextureMemory = 268435456;
                    }
                    #endregion
                    pScene.AddLayer(pLayer);
                    //if (((CheckBoxItem)itemPanelSetVisible.Items[i]).Checked == false)
                    //{
                    //    pLayer.Visible = false;
                    //}
                    //else
                    //{
                    //    pLayer.Visible = true;
                    //}
                    if (comboBoxExBaseHeightLayer.Items.Count > 0)
                    {
                        if (pLayer.Name == comboBoxExBaseHeightLayer.SelectedItem.ToString())
                        {
                            pBaseLayer = pLayer;
                        }
                    }
                }
            }

            if (pSurface != null)
            {
                for (int i = 0; i < m_pSceneCtrl.Scene.LayerCount; i++)
                {
                    ILayer pLayer = m_pSceneCtrl.Scene.get_Layer(i);

                    ILayerExtensions layerextensions = m_pSceneCtrl.Scene.get_Layer(i) as ILayerExtensions;
                    I3DProperties    properties      = null;
                    if (pLayer is IRasterLayer)
                    {
                        properties = new Raster3DPropertiesClass();
                    }
                    if (pLayer is IFeatureLayer)
                    {
                        properties = new Feature3DPropertiesClass();
                    }
                    if (pLayer is ITinLayer)
                    {
                        properties = new Tin3DPropertiesClass();
                    }
                    object p3d;
                    for (int j = 0; j < layerextensions.ExtensionCount; j++)
                    {
                        p3d = layerextensions.get_Extension(j);
                        if (p3d != null)
                        {
                            properties = p3d as I3DProperties;
                            if (properties != null)
                            {
                                break;
                            }
                        }
                    }
                    if (!(pLayer is IFeatureLayer))
                    {
                        properties.BaseOption  = esriBaseOption.esriBaseSurface;
                        properties.BaseSurface = pSurface;
                        //I、更改分辨率后,如何让分辨率设置发挥作用。主要是刷新的问题(使用IActiveView刷新、而不能使用Iscene及IScenegraph刷新)
                        //II、分辨率数值在( 262144-268435456)范围之内,越大越清晰。使用3DProperties.MaxTextureMemory 方法
                        properties.MaxTextureMemory = 268435456;
                    }
                    else
                    {
                        IFeatureLayer pFlayer = pLayer as IFeatureLayer;
                        //multipatch的本身有高度信息
                        if (pFlayer.FeatureClass != null && pFlayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch)
                        {
                            bool needConstantHeight = false;

                            /*
                             * try
                             * {
                             *  //把导航点转向角,视场角等信息都设置成不贴在表面而需要根据生产该信息的文件设置高度
                             *  IFeatureClass fc = pFlayer.FeatureClass;
                             *  IFeatureCursor pFcursor = fc.Search(null, false);
                             *  int OriginalFeatureidx = fc.FindField("OriginalFeatureClass");
                             *  int OriginalFeatureOIDidx = fc.FindField("OID");
                             *  IFeature pF = pFcursor.NextFeature();
                             *  IFeatureLayer pOFeatureLayer = null;
                             *  if (OriginalFeatureidx == -1|| OriginalFeatureOIDidx == -1)
                             *  {
                             *      pF = null;
                             *  }
                             *  else
                             *  {
                             *      if (pF != null)
                             *      {
                             *          //获取路径点图层名称
                             *          string orignalname = pF.get_Value(OriginalFeatureidx).ToString();
                             *          IMap pMap = m_pMapCtrl.Map;
                             *          for (int k = 0; k < pMap.LayerCount; k++)
                             *          {
                             *              if (pMap.get_Layer(k).Name.Equals(orignalname))
                             *              {
                             *                  pOFeatureLayer = pMap.get_Layer(k) as IFeatureLayer;
                             *                  break;
                             *              }
                             *          }
                             *          if (pOFeatureLayer == null)
                             *          {
                             *              pF = null;
                             *          }
                             *      }
                             *  }
                             *
                             *  while (pF != null)
                             *  {
                             *      //IFeatureClass pFClass = pOFeatureLayer.FeatureClass;
                             *      //pFClass.FindField(OriginalFeatureOIDidx);
                             *
                             *
                             *      pF = pFcursor.NextFeature();
                             *  }
                             * }
                             * catch
                             * {
                             *  ;
                             * }
                             */
                            if (needConstantHeight == false)
                            {
                                properties.BaseOption = esriBaseOption.esriBaseSurface;
                                //I3DProperties2 pr = properties as I3DProperties2;
                                //if (pr != null)
                                //{
                                //    pr.OffsetExpressionString = "0.005";
                                //}
                                //  properties.BaseOption = esriBaseOption.esriBaseExpression;
                                properties.BaseSurface = pSurface;
                                //I、更改分辨率后,如何让分辨率设置发挥作用。主要是刷新的问题(使用IActiveView刷新、而不能使用Iscene及IScenegraph刷新)
                                //II、分辨率数值在( 262144-268435456)范围之内,越大越清晰。使用3DProperties.MaxTextureMemory 方法
                                properties.MaxTextureMemory = 268435456;
                            }
                        }
                    }
                    //  properties.Apply3DProperties(domlayer);
                    // ps.SceneGraph.RefreshViewers();

                    IActiveView iv = m_pSceneCtrl.Scene as IActiveView;
                    iv.PartialRefresh(esriViewDrawPhase.esriViewGeography, pLayer, null);
                }
            }
        }
        private void AddLayersToMap(IWorkspace ValidNcgmpDatabase, bool useRepresentation) // bool hasTopologyStuff, bool hasStationFunction,
        {
            // Get references to the map for adding layers and tables
            IMxDocument MxDoc   = (IMxDocument)ArcMap.Document;
            IMap        thisMap = MxDoc.FocusMap;
            IStandaloneTableCollection thisMapTables = (IStandaloneTableCollection)thisMap;

            // Create a group layer
            IGroupLayer GeoMapGroupLayer = new GroupLayerClass();

            GeoMapGroupLayer.Name = "Geologic Map";

            // Create a group layer
            IGroupLayer StationGroupLayer = new GroupLayerClass();

            StationGroupLayer.Name = "Observation Data";

            //if (hasTopologyStuff == true)
            {
                #region "GeologicMapTopology"
                ITopology      geoMapTopo   = commonFunctions.OpenTopology(ValidNcgmpDatabase, "GeologicMapTopology");
                ITopologyLayer geoMapTopoTL = new TopologyLayerClass();
                geoMapTopoTL.Topology = geoMapTopo;

                ILayer geoMapTopoL = (ILayer)geoMapTopoTL;
                geoMapTopoL.Name    = "Geologic Map Topology";
                geoMapTopoL.Visible = false;

                // Minimizing the legend info in the Table of Contents is not trivial
                ILegendInfo  geoMapTopoLegendInfo  = (ILegendInfo)geoMapTopoL;
                ILegendGroup geoMapTopoLegendGroup = geoMapTopoLegendInfo.get_LegendGroup(0);
                geoMapTopoLegendGroup.Visible = false;
                geoMapTopoLegendGroup         = geoMapTopoLegendInfo.get_LegendGroup(1);
                geoMapTopoLegendGroup.Visible = false;
                geoMapTopoLegendGroup         = geoMapTopoLegendInfo.get_LegendGroup(2);
                geoMapTopoLegendGroup.Visible = false;

                GeoMapGroupLayer.Add(geoMapTopoL);

                #endregion
            }
            {
                #region "OrientationPoints"
                IFeatureClass orientationPointsFC = commonFunctions.OpenFeatureClass(ValidNcgmpDatabase, "OrientationPoints");
                IFeatureLayer orientationPointsFL = new FeatureLayerClass();
                orientationPointsFL.FeatureClass = orientationPointsFC;

                orientationPointsFL.Name         = "Orientation Points";
                orientationPointsFL.DisplayField = "Type";

                if (useRepresentation == true)
                {
                    // Set the layer renderer to use representations
                    IGeoFeatureLayer orientationPointsGeoFL = (IGeoFeatureLayer)orientationPointsFL;

                    IRepresentationRenderer orientationPointsRepRend = new RepresentationRendererClass();
                    orientationPointsRepRend.RepresentationClass = commonFunctions.GetRepClass(ValidNcgmpDatabase, "OrientationPoints_Rep");

                    orientationPointsGeoFL.Renderer = (IFeatureRenderer)orientationPointsRepRend;

                    commonFunctions.BuildGenericTemplates(ValidNcgmpDatabase, orientationPointsFL as ILayer, "OrientationPoints");
                }

                ILegendInfo  orientationPointsLegendInfo  = (ILegendInfo)orientationPointsFL;
                ILegendGroup orientationPointsLegendGroup = orientationPointsLegendInfo.get_LegendGroup(0);
                orientationPointsLegendGroup.Visible = false;

                StationGroupLayer.Add(orientationPointsFL);

                #endregion

                #region "ObservationData"
                string[] arr = new string[4]; // Initialize
                arr[0] = "Stations";          // Element 1
                arr[1] = "GenericPoints";     // Element 2
                arr[2] = "GenericSamples";    // Element 3
                arr[3] = "GeochronPoints";    // Element 4

                foreach (string s in arr)
                {
                    try
                    {
                        IFeatureClass FC = commonFunctions.OpenFeatureClass(ValidNcgmpDatabase, s);
                        IFeatureLayer FL = new FeatureLayerClass();
                        FL.FeatureClass = FC;

                        FL.Name    = s;
                        FL.Visible = false;

                        ILegendInfo  LegendInfo  = (ILegendInfo)FL;
                        ILegendGroup LegendGroup = LegendInfo.get_LegendGroup(0);
                        LegendGroup.Visible = false;

                        StationGroupLayer.Add(FL);
                    }
                    catch (Exception ex)
                    {
                        // Write exception to C:\Users\<user name>\AppData\Local\Temp\NCGMPToolbarLog.txt
                        string path    = Path.Combine(Environment.GetEnvironmentVariables()["LOCALAPPDATA"] as string, "Temp/NCGMPToolbarLog.txt");
                        string message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + s + ": " + ex.Message + "\r\n";
                        System.IO.File.AppendAllText(path, message);
                    }
                }

                #endregion
            }

            //add station group layer to map document
            GeoMapGroupLayer.Add(StationGroupLayer);

            {
                #region "LinesWithoutRepresentations"
                string[] arr = new string[2]; // Initialize
                arr[0] = "CartographicLines"; // Element 1
                arr[1] = "IsoValueLines";     // Element 2

                foreach (string s in arr)
                {
                    try
                    {
                        IFeatureClass FC = commonFunctions.OpenFeatureClass(ValidNcgmpDatabase, s);
                        IFeatureLayer FL = new FeatureLayerClass();
                        FL.FeatureClass = FC;

                        FL.Name    = s;
                        FL.Visible = false;

                        ILegendInfo  LegendInfo  = (ILegendInfo)FL;
                        ILegendGroup LegendGroup = LegendInfo.get_LegendGroup(0);
                        LegendGroup.Visible = false;

                        GeoMapGroupLayer.Add(FL);
                    }
                    catch (Exception ex)
                    {
                        // Write exception to C:\Users\<user name>\AppData\Local\Temp\NCGMPToolbarLog.txt
                        string path    = Path.Combine(Environment.GetEnvironmentVariables()["LOCALAPPDATA"] as string, "Temp/NCGMPToolbarLog.txt");
                        string message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + s + ": " + ex.Message + "\r\n";
                        System.IO.File.AppendAllText(path, message);
                    }
                }

                #endregion
            }
            {
                #region "LinesWithRepresentations"
                string[] arr = new string[2]; // Initialize
                arr[0] = "GeologicLines";     // Element 1
                arr[1] = "ContactsAndFaults"; // Element 2

                foreach (string s in arr)
                {
                    try
                    {
                        IFeatureClass FC = commonFunctions.OpenFeatureClass(ValidNcgmpDatabase, s);
                        IFeatureLayer FL = new FeatureLayerClass();
                        FL.FeatureClass = FC;

                        FL.Name = s;

                        if (useRepresentation == true)
                        {
                            // Set the layer renderer to use representations
                            IGeoFeatureLayer GeoFL = (IGeoFeatureLayer)FL;

                            IRepresentationRenderer RepRend = new RepresentationRendererClass();
                            RepRend.RepresentationClass = commonFunctions.GetRepClass(ValidNcgmpDatabase, s + "_Rep");

                            GeoFL.Renderer = (IFeatureRenderer)RepRend;

                            commonFunctions.BuildGenericTemplates(ValidNcgmpDatabase, FL as ILayer, s);
                        }

                        ILegendInfo  LegendInfo  = (ILegendInfo)FL;
                        ILegendGroup LegendGroup = LegendInfo.get_LegendGroup(0);
                        LegendGroup.Visible = false;

                        GeoMapGroupLayer.Add(FL);
                    }
                    catch (Exception ex)
                    {
                        // Write exception to C:\Users\<user name>\AppData\Local\Temp\NCGMPToolbarLog.txt
                        string path    = Path.Combine(Environment.GetEnvironmentVariables()["LOCALAPPDATA"] as string, "Temp/NCGMPToolbarLog.txt");
                        string message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + s + ": " + ex.Message + "\r\n";
                        System.IO.File.AppendAllText(path, message);
                    }
                }

                #endregion
            }
            {
                #region "Polygons"
                string[] arr = new string[3]; // Initialize
                arr[0] = "DataSourcePolys";   // Element 1
                arr[1] = "MapUnitPolys";      // Element 2
                arr[2] = "OtherPolys";        // Element 3

                foreach (string s in arr)
                {
                    try
                    {
                        IFeatureClass FC = commonFunctions.OpenFeatureClass(ValidNcgmpDatabase, s);
                        IFeatureLayer FL = new FeatureLayerClass();
                        FL.FeatureClass = FC;

                        FL.Name = s;

                        ILegendInfo  LegendInfo  = (ILegendInfo)FL;
                        ILegendGroup LegendGroup = LegendInfo.get_LegendGroup(0);
                        LegendGroup.Visible = false;

                        GeoMapGroupLayer.Add(FL);
                    }
                    catch (Exception ex)
                    {
                        // Write exception to C:\Users\<user name>\AppData\Local\Temp\NCGMPToolbarLog.txt
                        string path    = Path.Combine(Environment.GetEnvironmentVariables()["LOCALAPPDATA"] as string, "Temp/NCGMPToolbarLog.txt");
                        string message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + s + ": " + ex.Message + "\r\n";
                        System.IO.File.AppendAllText(path, message);
                    }
                }

                #endregion
            }
            {
                #region "Tables"
                string[] arr = new string[7];     // Initialize
                arr[0] = "DataSources";           // Element 1
                arr[1] = "DescriptionOfMapUnits"; // Element 2
                arr[2] = "ExtendedAttributes";    // Element 3
                arr[3] = "GeologicEvents";        // Element 4
                arr[4] = "Glossary";              // Element 5
                arr[5] = "Notes";                 // Element 6
                arr[6] = "StandardLithology";     // Element 7
                foreach (string s in arr)
                {
                    try
                    {
                        ITable           Table      = commonFunctions.OpenTable(ValidNcgmpDatabase, s);
                        IStandaloneTable Standalone = new StandaloneTableClass();
                        Standalone.Table = Table;

                        Standalone.Name = s;

                        thisMapTables.AddStandaloneTable(Standalone);
                    }
                    catch (Exception ex)
                    {
                        // Write exception to C:\Users\<user name>\AppData\Local\Temp\NCGMPToolbarLog.txt
                        string path    = Path.Combine(Environment.GetEnvironmentVariables()["LOCALAPPDATA"] as string, "Temp/NCGMPToolbarLog.txt");
                        string message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + s + ": " + ex.Message + "\r\n";
                        System.IO.File.AppendAllText(path, message);
                    }
                }

                #endregion
            }

            // Add the Geologic Map Group Layer to the map
            GeoMapGroupLayer.Expanded = true;
            thisMap.AddLayer(GeoMapGroupLayer);

            // Adjust the MapUnitPolys Renderer
            commonFunctions.UpdateMapUnitPolysRenderer(ValidNcgmpDatabase);

            // Adjust the MapUnitPolys Feature Templates
            commonFunctions.UpdateMapUnitPolysFeatureTemplates(ValidNcgmpDatabase);
        }
Esempio n. 24
0
 public VerySimpleCustomRenderer()
 {
     lg = new LegendGroupClass();
     ILegendClass lc = new LegendClassClass();
     sym = new SimpleFillSymbolClass();
     lc.Label = "A very simple custom renderer";
     lc.Symbol = sym;
     lg.AddClass(lc);
 }
    /// <summary>
    /// Dispose the layer
    /// </summary>
    /// <returns></returns>
    public virtual new void Dispose()
    {
      if (IntPtr.Zero != m_hSmallBitmap)
        DeleteObject(m_hSmallBitmap);

      if (IntPtr.Zero != m_hLargeBitmap)
        DeleteObject(m_hLargeBitmap);

      m_extensions.Clear();
      m_table.Dispose();

      m_extent = null;
      m_spRef = null;
      m_legendGroup = null;

      GC.Collect();
      GC.WaitForPendingFinalizers();
    }
Esempio n. 26
0
        //加载拓扑图层
        public static void AddTopoLayer(ref AxMapControl pMapCtrl, string strTopoLayerName, ITopologyWorkspace ipTopologyWS, IFeatureClassContainer ipFeatClassContainer, IFeatureDataset ipFeatDataset)
        {
            int nOriginClassID, nDestClassID;

            ITopology ipTopology;

            //打开数据集
            //ITopologyContainer ipTopoContainer = (ITopologyContainer)ipFeatDataset;

            IWorkspace2 pWorkspace = (IWorkspace2)ipFeatDataset.Workspace;

            if (pWorkspace.get_NameExists(esriDatasetType.esriDTTopology, strTopoLayerName))
            {
                ipTopology = ipTopologyWS.OpenTopology(strTopoLayerName);

                if (ipTopology == null)
                {
                    return;
                }

                ITopologyLayer ipTopologyLayer = new TopologyLayerClass();
                ipTopologyLayer.Topology = ipTopology;



                ILegendInfo legendInfo = (ILegendInfo)ipTopologyLayer;

                for (int i = 0; i < legendInfo.LegendGroupCount; i++)
                {
                    ILegendGroup legendgroup = legendInfo.get_LegendGroup(i);

                    ILegendClass legendclass = legendgroup.get_Class(0);

                    switch (legendgroup.Heading)
                    {
                    case "Area Errors":
                    {
                        legendgroup.Heading     = "";
                        legendclass.Label       = "面状错误";
                        legendclass.Description = "面状错误";
                        break;
                    }

                    case "Line Errors":
                    {
                        legendgroup.Heading     = "";
                        legendclass.Label       = "线状错误";
                        legendclass.Description = "线状错误";
                        break;
                    }

                    case "Point Errors":
                    {
                        legendgroup.Heading     = "";
                        legendclass.Label       = "点状错误";
                        legendclass.Description = "点状错误";
                        break;
                    }
                    }
                }


                ILayer ipLayer = (ILayer)ipTopologyLayer;
                ipLayer.Name = strTopoLayerName; //将拓扑检查合并后,将拓扑图层名指定为“拓扑错误”后,采用此方法命名  hehy20080724

                /*  将拓扑检查合并后,将拓扑图层名指定为“拓扑错误”后,注销以下代码 hehy20080724
                 * ///////////////////////////////////////////////////
                 * //得到拓扑层相对应的规则名称
                 * CModelSchema pModelSchema = new CModelSchema();
                 * string strRuleName = pModelSchema.GetRuleNameByTopoLayerName(m_pTask.pSchema, strTopoLayerName);
                 * //////////////////////////////////////////////////
                 * if (strRuleName.Length == 0)
                 * {
                 *  ipLayer.Name = strTopoLayerName;
                 * }
                 * else
                 * {
                 *  ipLayer.Name = strRuleName;
                 * }
                 */
                //把拓扑图层加载到map控件中
                //pMapCtrl.AddLayer(ipLayer, pMapCtrl.LayerCount);
                pMapCtrl.Map.AddLayer(ipLayer);
                //pMapCtrl.ActiveView.Extent = ipLayer.AreaOfInterest;
            }
        }
Esempio n. 27
0
 public XmlGroup(ILegendGroup group)
 {
     Name     = group.Text;
     Expanded = group.Expanded;
     Layers   = group.Layers.Select(l => l.Guid);
 }
    /// <summary>
    /// Class default constructor
    /// </summary>
    public GlobeCustomLayerBase()
    {
      m_sName = string.Empty;
      m_bVisible = true;
      m_bValid = true;
      m_bCached = false;
      m_dblMaxScale = 0;
      m_dblMinScale = 0;
      m_table = new DataTable("RECORDS");

      m_table.Columns.Add("ID", typeof(long));

      m_extensions = new ArrayList();

      ILegendClass legendClass = new LegendClassClass();
      legendClass.Label = "GlobeCustomLayer";

      m_legendGroup = new LegendGroupClass();
      m_legendGroup.Heading = "";
      m_legendGroup.Editable = false;
      m_legendGroup.AddClass(legendClass);

      m_sName = "GlobeCustomLayer";

      //call CreateControl in order to create the handle
      this.CreateControl();
    }