コード例 #1
0
        private static IStyleGalleryItem GetESRIStyleColorRamp(out IColorRamp pColorRamp, string sColorRampName)
        {
            IStyleGallery        pStyleGallery = new ESRI.ArcGIS.Framework.StyleGalleryClass();
            IStyleGalleryStorage pStyleStorage;

            pStyleStorage = pStyleGallery as IStyleGalleryStorage;
            string pStylePath = pStyleStorage.DefaultStylePath + "ESRI.style";

            pStyleStorage.AddFile(pStylePath);
            ESRI.ArcGIS.esriSystem.IEnumBSTR eESRIRampCategories = pStyleGallery.Categories["Color Ramps"];
            string            sESRIRampCategoryName = eESRIRampCategories.Next();
            IStyleGalleryItem pStyleItem;

            while (!string.IsNullOrEmpty(sESRIRampCategoryName))
            {
                IEnumStyleGalleryItem eESRIColorRamps = pStyleGallery.Items["Color Ramps", pStylePath, sESRIRampCategoryName];
                pStyleItem = eESRIColorRamps.Next();
                while (pStyleItem != null)
                {
                    if (string.Compare(pStyleItem.Name, sColorRampName) == 0)
                    {
                        pColorRamp = (IColorRamp)pStyleItem.Item;
                        return(pStyleItem);
                    }

                    pStyleItem = eESRIColorRamps.Next();
                }

                sESRIRampCategoryName = eESRIRampCategories.Next();
            }

            throw new Exception(string.Format("Cannot find the color ramp with the name '{0}'", sColorRampName));
        }
コード例 #2
0
ファイル: LegendPropertyPage.cs プロジェクト: secondii/Yutai
 private void LegendPropertyPage_Load(object sender, EventArgs e)
 {
     if (this.istyleGallery_0 != null)
     {
         IStyleGalleryItem     item  = null;
         IEnumStyleGalleryItem item2 = this.istyleGallery_0.get_Items("Line Patches", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboLinePatches.Add(item);
         }
         if (this.cboLinePatches.Items.Count > 0)
         {
             this.cboLinePatches.SelectedIndex = 0;
         }
         item2 = this.istyleGallery_0.get_Items("Area Patches", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboAreaPatches.Add(item);
         }
         if (this.cboAreaPatches.Items.Count > 0)
         {
             this.cboAreaPatches.SelectedIndex = 0;
         }
     }
     this.method_0();
     this.bool_0 = true;
     this.lvcolumnHeader_0.ColumnStyle = ListViewColumnStyle.ReadOnly;
     this.lvcolumnHeader_1.ColumnStyle = ListViewColumnStyle.EditBox;
 }
コード例 #3
0
ファイル: AttributeForm.cs プロジェクト: yanfp/Water-quality
        private void DrawColorRamp()
        {
            string               sInstall            = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path;
            string               styleFilePath       = sInstall + "\\Styles\\ESRI.ServerStyle";
            IStyleGallery        styleGallery        = new ServerStyleGalleryClass();
            IStyleGalleryItem    styleGalleryItem    = null;
            IStyleGalleryStorage styleGalleryStorage = styleGallery as IStyleGalleryStorage;

            styleGalleryStorage.AddFile(styleFilePath);

            IEnumStyleGalleryItem enumStyleGalleryItem = styleGallery.get_Items("Color Ramps", styleFilePath, "");

            enumStyleGalleryItem.Reset();

            styleGalleryItem = enumStyleGalleryItem.Next();

            while (styleGalleryItem != null)
            {
                m_ColorRamp = (IColorRamp)styleGalleryItem.Item;
                EnumStyleItem.Add(m_ColorRamp);
                m_FillSymbol = new GradientFillSymbol();
                m_FillSymbol.GradientAngle = 0;
                m_FillSymbol.ColorRamp     = m_ColorRamp;
                pictureBox1.Image          = SymbolToBitmap(m_FillSymbol, 0, pictureBox1.Width, pictureBox1.Height);
                imageList1.Images.Add(pictureBox1.Image);
                comboBoxColor.Items.Add(pictureBox1.Image);
                styleGalleryItem = enumStyleGalleryItem.Next();
            }

            System.Runtime.InteropServices.Marshal.ReleaseComObject(enumStyleGalleryItem);
        }
コード例 #4
0
        private void LoadChildren()
        {
            if (m_childrenLoaded)
            {
                return;
            }

            //Our children are GxContainer objects that represent the actual style items
            //of a certain type.

            IEnumStyleGalleryItem pEnumItems = null;

            pEnumItems = m_pParent.StyleGallery.get_Items(m_pClass.Name, "ESRI.style", "");

            IStyleGalleryItem pItem = null;

            pItem = pEnumItems.Next();
            while (pItem != null)
            {
                clsGxStyleGalleryItem pGxItem = null;
                pGxItem = new clsGxStyleGalleryItem();
                pGxItem.StyleGalleryItem = pItem;

                IGxObject pGxObject = null;
                pGxObject = pGxItem;
                pGxObject.Attach(this, m_pCatalog);

                m_pChildren.Insert(-1, pGxObject);
                pItem = pEnumItems.Next();
            }
            m_childrenLoaded = true;
        }
コード例 #5
0
        private void DrawColorRamp()
        {
            string               strDefaultStyleFileName = string.Format("{0}\\CNUStyles\\ESRI.ServerStyle", Application.StartupPath);
            IStyleGallery        styleGallery            = new ServerStyleGalleryClass();
            IStyleGalleryItem    styleGalleryItem        = new ServerStyleGalleryItemClass();
            IStyleGalleryStorage styleGalleryStorage     = styleGallery as IStyleGalleryStorage;

            styleGalleryStorage.AddFile(strDefaultStyleFileName);
            IEnumStyleGalleryItem enumStyleGalleryItem = styleGallery.get_Items("Color Ramps", strDefaultStyleFileName, "");

            enumStyleGalleryItem.Reset();
            styleGalleryItem = enumStyleGalleryItem.Next();
            while (styleGalleryItem != null)
            {
                m_ColorRamp = (IColorRamp)styleGalleryItem.Item;
                EnumStyleItem.Add(m_ColorRamp);
                //新建m_FillSymbol和m_colorRamp
                m_FillSymbol = new GradientFillSymbol();
                m_FillSymbol.GradientPercentage = 1;
                m_FillSymbol.IntervalCount      = 255;
                m_FillSymbol.GradientAngle      = 0;
                m_FillSymbol.ColorRamp          = m_ColorRamp;
                pictureBox1.Image = SymbolToBitmap(m_FillSymbol, 0, pictureBox1.Width, pictureBox1.Height);
                pictureBox2.Image = SymbolToBitmap(m_FillSymbol, 0, pictureBox1.Width, pictureBox1.Height);
                imageList1.Images.Add(m_ColorRamp.Name, pictureBox1.Image);
                imageList2.Images.Add(m_ColorRamp.Name, pictureBox1.Image);
                colorComboBox.Items.Add(pictureBox1.Image);
                colorComboBox1.Items.Add(pictureBox2.Image);
                styleGalleryItem = enumStyleGalleryItem.Next();
            }
        }
コード例 #6
0
        // 从符号
        public static ISymbol FetchSymbol(string name)
        {
            string               strStartPath         = System.Windows.Forms.Application.StartupPath;
            IStyleGallery        pStyleGallery        = new ServerStyleGalleryClass();
            IStyleGalleryStorage pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage;

            pStyleGalleryStorage.AddFile(strStartPath + "\\mlb.ServerStyle");

            IEnumStyleGalleryItem pEnumStyleGalleryItem = pStyleGallery.get_Items("Marker Symbols", strStartPath + "\\mlb.ServerStyle", null);

            ISymbol pSymbol = null;

            pEnumStyleGalleryItem.Reset();
            IStyleGalleryItem pStyleGalleryItem = pEnumStyleGalleryItem.Next();


            while (pStyleGalleryItem != null)
            {
                if (pStyleGalleryItem.Name == name)
                {
                    //获取符号
                    pSymbol = pStyleGalleryItem.Item as ISymbol;
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumStyleGalleryItem);
                    break;
                }

                pStyleGalleryItem = pEnumStyleGalleryItem.Next();
            }

            return(pSymbol);
        }
コード例 #7
0
ファイル: SymbolFind.cs プロジェクト: secondii/Yutai
        public static IStyleGalleryItem FindStyleGalleryItem(string string_0, IStyleGallery istyleGallery_0,
                                                             string string_1, string string_2, string string_3)
        {
            IStyleGalleryItem result;

            if (istyleGallery_0 == null)
            {
                result = null;
            }
            else
            {
                try
                {
                    IEnumStyleGalleryItem enumStyleGalleryItem = istyleGallery_0.get_Items(string_2, string_1, string_3);
                    enumStyleGalleryItem.Reset();
                    for (IStyleGalleryItem styleGalleryItem = enumStyleGalleryItem.Next();
                         styleGalleryItem != null;
                         styleGalleryItem = enumStyleGalleryItem.Next())
                    {
                        if (styleGalleryItem.Name.ToUpper() == string_0.ToUpper())
                        {
                            result = styleGalleryItem;
                            return(result);
                        }
                    }
                }
                catch
                {
                }
                System.GC.Collect();
                result = null;
            }
            return(result);
        }
コード例 #8
0
 private void LegendSetupUserControl_Load(object sender, EventArgs e)
 {
     if (this.istyleGallery_0 != null)
     {
         IStyleGalleryItem     item  = null;
         IEnumStyleGalleryItem item2 = this.istyleGallery_0.get_Items("Line Patches", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboLinePatches.Add(item);
         }
         if (this.cboLinePatches.Items.Count > 0)
         {
             this.cboLinePatches.SelectedIndex = 0;
         }
         item2 = this.istyleGallery_0.get_Items("Area Patches", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboAreaPatches.Add(item);
         }
         if (this.cboAreaPatches.Items.Count > 0)
         {
             this.cboAreaPatches.SelectedIndex = 0;
         }
     }
     this.method_0();
     this.bool_0 = true;
 }
コード例 #9
0
        private void InitControl()
        {
            this.m_CanDo = false;
            this.numericUpDownAngle.Value           = (decimal)this.m_GradientFillSymbol.GradientAngle;
            this.numericUpDownPrecent.Value         = (decimal)(this.m_GradientFillSymbol.GradientPercentage * 100.0);
            this.numericUpDownIntervalCount.Value   = this.m_GradientFillSymbol.IntervalCount;
            this.cboGradientFillStyle.SelectedIndex = (int)this.m_GradientFillSymbol.Style;
            this.btnOutline.Style = this.m_GradientFillSymbol.Outline;
            IStyleGalleryItem item = new ServerStyleGalleryItemClass
            {
                Item = this.m_GradientFillSymbol.ColorRamp
            };

            this.colorRampComboBox.Add(item);
            if (this.m_pSG != null)
            {
                IEnumStyleGalleryItem item2 = this.m_pSG.get_Items("Color Ramps", "", "");
                item2.Reset();
                for (item = item2.Next(); item != null; item = item2.Next())
                {
                    this.colorRampComboBox.Add(item);
                }
                item2 = null;
                GC.Collect();
            }
            if (this.colorRampComboBox.Items.Count > 0)
            {
                this.colorRampComboBox.SelectedIndex = 0;
            }
            this.m_CanDo = true;
        }
        private void SetDefaultSymbol(ILineElement elem)
        {
            ILineSymbol          defaultLineSym = null;
            String               esriStylePath;
            IStyleGallery        styleGallery = new StyleGalleryClass();
            IStyleGalleryStorage styleStor    = (IStyleGalleryStorage)styleGallery;

            esriStylePath = styleStor.DefaultStylePath + "ESRI.style";

            IEnumStyleGalleryItem styleItems = styleGallery.get_Items("Line Symbols", esriStylePath, "Dashed");

            styleItems.Reset();
            IStyleGalleryItem styleGalleryItem = styleItems.Next();

            while (!(styleGalleryItem == null))
            {
                if (styleGalleryItem.Name == "Dashed 4:4")
                {
                    defaultLineSym       = (ILineSymbol)styleGalleryItem.Item;
                    defaultLineSym.Width = 1.50;
                    IRgbColor rgbColor = new RgbColorClass();
                    rgbColor.Red          = 255;
                    rgbColor.Blue         = 0;
                    rgbColor.Green        = 0;
                    rgbColor.Transparency = 50;
                    defaultLineSym.Color  = rgbColor;
                    break;
                }
                else
                {
                    styleGalleryItem = styleItems.Next();
                }
            }
            elem.Symbol = defaultLineSym;
        }
コード例 #11
0
        private void RasterClassifiedRenderPage_Load(object sender, EventArgs e)
        {
            int num = -1;

            if (this.irasterClassifyColorRampRenderer_0 != null)
            {
                string colorRamp = (this.irasterClassifyColorRampRenderer_0 as IRasterClassifyUIProperties).ColorRamp;
                if (this.istyleGallery_0 != null)
                {
                    IEnumStyleGalleryItem item = this.istyleGallery_0.get_Items("Color Ramps", "", "");
                    item.Reset();
                    for (IStyleGalleryItem item2 = item.Next(); item2 != null; item2 = item.Next())
                    {
                        this.cboColorRamp.Add(item2);
                        if (item2.Name == colorRamp)
                        {
                            num = this.cboColorRamp.Items.Count - 1;
                        }
                    }
                    item = null;
                    GC.Collect();
                }
                if (this.cboColorRamp.Items.Count == 0)
                {
                    this.cboColorRamp.Enabled = false;
                    IRandomColorRamp ramp = new RandomColorRampClass
                    {
                        StartHue      = 40,
                        EndHue        = 120,
                        MinValue      = 65,
                        MaxValue      = 90,
                        MinSaturation = 25,
                        MaxSaturation = 45,
                        Size          = 5,
                        Seed          = 23
                    };
                    this.icolorRamp_0 = ramp;
                }
                else
                {
                    this.cboColorRamp.SelectedIndex = num;
                    if (this.cboColorRamp.SelectedIndex == -1)
                    {
                        this.cboColorRamp.SelectedIndex = 0;
                    }
                    this.icolorRamp_0 = this.cboColorRamp.GetSelectStyleGalleryItem().Item as IColorRamp;
                    (this.irasterClassifyColorRampRenderer_0 as IRasterClassifyUIProperties).ColorRamp =
                        this.cboColorRamp.Text;
                }
                if (this.irasterLayer_0 != null)
                {
                    this.method_1();
                }
                this.bool_0 = true;
            }
        }
コード例 #12
0
        private void ClassBreaksRendererCtrl_Load(object sender, EventArgs e)
        {
            this.method_1();
            int    num       = -1;
            string colorRamp = (this.iclassBreaksRenderer_0 as IClassBreaksUIProperties).ColorRamp;

            if (this.istyleGallery_0 != null)
            {
                IEnumStyleGalleryItem item = this.istyleGallery_0.get_Items("Color Ramps", "", "");
                item.Reset();
                for (IStyleGalleryItem item2 = item.Next(); item2 != null; item2 = item.Next())
                {
                    this.colorRampComboBox1.Add(item2);
                    if (item2.Name == colorRamp)
                    {
                        num = this.colorRampComboBox1.Items.Count - 1;
                    }
                }
                item = null;
                GC.Collect();
            }
            if (this.colorRampComboBox1.Items.Count == 0)
            {
                this.colorRampComboBox1.Enabled = false;
                IRandomColorRamp ramp = new RandomColorRampClass
                {
                    StartHue      = 40,
                    EndHue        = 120,
                    MinValue      = 65,
                    MaxValue      = 90,
                    MinSaturation = 25,
                    MaxSaturation = 45,
                    Size          = 5,
                    Seed          = 23
                };
                this.icolorRamp_0 = ramp;
            }
            else
            {
                this.colorRampComboBox1.SelectedIndex = num;
                if (this.colorRampComboBox1.SelectedIndex == -1)
                {
                    this.colorRampComboBox1.SelectedIndex = 0;
                }
                this.icolorRamp_0 = this.colorRampComboBox1.GetSelectColorRamp();
                (this.iclassBreaksRenderer_0 as IClassBreaksUIProperties).ColorRamp = this.colorRampComboBox1.Text;
            }
            if (this.igeoFeatureLayer_0 != null)
            {
                this.method_0();
            }
            this.bool_0 = true;
        }
コード例 #13
0
ファイル: DisplayAdvancePage.cs プロジェクト: secondii/Yutai
 private void DisplayAdvancePage_Load(object sender, EventArgs e)
 {
     if (this.m_pGpsDisplayProperties != null)
     {
         IStyleGalleryItem item;
         this.chkShowCurrentAltitude.Checked     = this.m_pGpsDisplayProperties.ShowCurrentAltitude;
         this.chkShowCurrentBearing.Checked      = this.m_pGpsDisplayProperties.ShowCurrentBearing;
         this.chkShowCurrentSpeed.Checked        = this.m_pGpsDisplayProperties.ShowCurrentSpeed;
         this.chkShowMarkerTrailAltitude.Checked = this.m_pGpsDisplayProperties.ShowMarkerTrailAltitude;
         this.chkShowMarkerTrailBearing.Checked  = this.m_pGpsDisplayProperties.ShowMarkerTrailBearing;
         this.chkShowMarkerTrailSpeed.Checked    = this.m_pGpsDisplayProperties.ShowMarkerTrailSpeed;
         this.txtHighAltitudeSize.Text           = this.m_pGpsDisplayProperties.HighAltitudeSize.ToString();
         this.txtHighAltitudeValue.Text          = this.m_pGpsDisplayProperties.HighAltitudeValue.ToString();
         this.txtLowAltitudeSize.Text            = this.m_pGpsDisplayProperties.LowAltitudeSize.ToString();
         this.txtLowAltitudeValue.Text           = this.m_pGpsDisplayProperties.LowAltitudeValue.ToString();
         this.txtLowSpeedValue.Text   = this.m_pGpsDisplayProperties.LowSpeedValue.ToString();
         this.lblMaxAltituteUnit.Text = CommonHelper.GetUnit(this.m_pGpsDisplayProperties.AltitudeUnits);
         this.lblMinAltituteUnit.Text = this.lblMaxAltituteUnit.Text;
         this.lblMaxSpeedUnit.Text    = this.GetSpeedUnitDescription(this.m_pGpsDisplayProperties.SpeedUnits);
         this.lblMinSpeedUnit.Text    = this.lblMaxSpeedUnit.Text;
         if (this.m_pGpsDisplayProperties.SpeedColorRamp != null)
         {
             item = new ServerStyleGalleryItemClass
             {
                 Item = this.m_pGpsDisplayProperties.SpeedColorRamp
             };
             this.cboSpeedColorRamp.Add(item);
         }
         if (this.m_pSG != null)
         {
             IEnumStyleGalleryItem item2 = this.m_pSG.get_Items("Color Ramps", "", "");
             item2.Reset();
             for (item = item2.Next(); item != null; item = item2.Next())
             {
                 this.cboSpeedColorRamp.Add(item);
             }
             item2 = null;
             GC.Collect();
         }
         if (this.cboSpeedColorRamp.Items.Count > 0)
         {
             this.cboSpeedColorRamp.SelectedIndex = 0;
         }
         else
         {
             this.cboSpeedColorRamp.Enabled = false;
         }
         this.m_CanDo = true;
     }
 }
コード例 #14
0
        ///<summary>
        ///获取符号库中符号
        ///</summary>
        ///<param name="sServerStylePath">符号库全路径名称</param>
        ///<param name="sGalleryClassName">GalleryClass名称</param>
        ///<param name="symbolName">符号名称</param>
        ///<returns>符号</returns>
        private ISymbol GetSymbol(string sServerStylePath, string sGalleryClassName, string symbolName)
        {
            try
            {
                //ServerStyleGallery对象
                IStyleGallery        pStyleGaller         = new ServerStyleGalleryClass();
                IStyleGalleryStorage pStyleGalleryStorage = pStyleGaller as IStyleGalleryStorage;

                IEnumStyleGalleryItem pEnumSyleGalleryItem = null;
                IStyleGalleryItem     pStyleGallerItem     = null;
                IStyleGalleryClass    pStyleGalleryClass   = null;
                //使用IStyleGalleryStorage接口的AddFile方法加载ServerStyle文件
                pStyleGalleryStorage.AddFile(sServerStylePath);
                //遍历ServerGallery中的Class
                for (int i = 0; i < pStyleGaller.ClassCount; i++)
                {
                    pStyleGalleryClass = pStyleGaller.get_Class(i);
                    if (pStyleGalleryClass.Name != sGalleryClassName)
                    {
                        continue;
                    }
                    //获取EnumStyleGalleryItem对象
                    pEnumSyleGalleryItem = pStyleGaller.get_Items(sGalleryClassName, sServerStylePath, "");
                    pEnumSyleGalleryItem.Reset();
                    //遍历pEnumSyleGalleryItem
                    pStyleGallerItem = pEnumSyleGalleryItem.Next();
                    while (pStyleGallerItem != null)
                    {
                        if (pStyleGallerItem.Name == symbolName)
                        {
                            //获取符号
                            ISymbol pSymbol = pStyleGallerItem.Item as ISymbol;
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumSyleGalleryItem);
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(pStyleGalleryClass);
                            return(pSymbol);
                        }
                        pStyleGallerItem = pEnumSyleGalleryItem.Next();
                    }
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumSyleGalleryItem);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pStyleGalleryClass);
                return(null);
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(null);
            }
        }
コード例 #15
0
 private void LegendFrameUserControl_Load(object sender, EventArgs e)
 {
     this.cboBorder.Add(null);
     this.cboBackground.Add(null);
     this.cboShadow.Add(null);
     if (this.istyleGallery_0 != null)
     {
         IStyleGalleryItem     item  = null;
         IEnumStyleGalleryItem item2 = this.istyleGallery_0.get_Items("Borders", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboBorder.Add(item);
         }
         if (this.cboBorder.Items.Count > 0)
         {
             this.cboBorder.SelectedIndex = 0;
         }
         item2 = this.istyleGallery_0.get_Items("Backgrounds", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboBackground.Add(item);
         }
         if (this.cboBackground.Items.Count > 0)
         {
             this.cboBackground.SelectedIndex = 0;
         }
         item2 = this.istyleGallery_0.get_Items("Shadows", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboShadow.Add(item);
         }
         if (this.cboShadow.Items.Count > 0)
         {
             this.cboShadow.SelectedIndex = 0;
         }
     }
     if (this.iframeElement_0 != null)
     {
         this.method_0();
         this.bool_0 = true;
     }
 }
コード例 #16
0
ファイル: frmBurstReport.cs プロジェクト: secondii/Yutai
        private IMarkerSymbol GetMarkerSymbol()
        {
            IMarkerSymbol markerSymbol;
            IStyleGallery serverStyleGalleryClass = new ServerStyleGallery();
            IMarkerSymbol item = null;
            bool          flag = false;
            string        str  = string.Concat(Application.StartupPath, "\\Styles\\ESRI.ServerStyle");

            if (!File.Exists(str))
            {
                markerSymbol = null;
            }
            else
            {
                string str1 = str;
                serverStyleGalleryClass.Clear();
                (serverStyleGalleryClass as IStyleGalleryStorage).AddFile(str1);
                IEnumStyleGalleryItem items = serverStyleGalleryClass.Items["Marker Symbols", str1, "Default"];
                items.Reset();
                IStyleGalleryItem styleGalleryItem = items.Next();
                while (true)
                {
                    if (styleGalleryItem == null)
                    {
                        break;
                    }
                    else if (styleGalleryItem.Name == "Star 5")
                    {
                        flag = true;
                        break;
                    }
                    else
                    {
                        styleGalleryItem = items.Next();
                    }
                }
                if (flag)
                {
                    item = (IMarkerSymbol)styleGalleryItem.Item;
                }
                item.Size    = 19;
                markerSymbol = item;
            }
            return(markerSymbol);
        }
コード例 #17
0
ファイル: StyleUtils.cs プロジェクト: arcpad/epsgis
        /// <summary>
        /// 获取指定种类,指定符号id的符号
        /// </summary>
        /// <param name="sGallery">符号种类(e.g.填充颜色)</param>
        /// <param name="id">符号id</param>
        /// <returns>符号</returns>
        public static ISymbol GetStyleSymbol(string sGallery, int id)
        {
            try
            {
                IStyleGallery        pStyleGallery        = new ServerStyleGalleryClass();
                IStyleGalleryStorage pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage;

                for (int i = pStyleGalleryStorage.FileCount - 1; i >= 0; i--)
                {
                    pStyleGalleryStorage.RemoveFile(pStyleGalleryStorage.get_File(i));
                }

                pStyleGalleryStorage.AddFile(_STYLEFILE);
                IEnumStyleGalleryItem pEnumStyleItem = pStyleGallery.get_Items(sGallery, _STYLEFILE, "");
                pEnumStyleItem.Reset();
                IStyleGalleryItem  mStyleItem  = pEnumStyleItem.Next();
                IStyleGalleryClass mStyleClass = null;
                for (int i = 0; i < pStyleGallery.ClassCount; i++)
                {
                    mStyleClass = pStyleGallery.get_Class(i);
                    string str = mStyleClass.Name;
                    if (str == sGallery)
                    {
                        break;
                    }
                }

                ISymbol result = null;
                while (mStyleItem != null)
                {
                    if (mStyleItem.ID == id)
                    {
                        result = mStyleItem.Item as ISymbol;
                        break;
                    }
                    mStyleItem = pEnumStyleItem.Next();
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumStyleItem);
                return(result);
            }
            catch
            {
                return(null);
            }
        }
コード例 #18
0
 private void UniqueValueRendererCtrl_Load(object sender, EventArgs e)
 {
     this.method_0();
     if (this.m_pSG != null)
     {
         IEnumStyleGalleryItem item = this.m_pSG.get_Items("Color Ramps", "", "");
         item.Reset();
         for (IStyleGalleryItem item2 = item.Next(); item2 != null; item2 = item.Next())
         {
             this.cboColorRamp.Add(item2);
         }
         item = null;
         GC.Collect();
     }
     if (this.cboColorRamp.Items.Count == 0)
     {
         this.cboColorRamp.Enabled = false;
         IRandomColorRamp ramp = new RandomColorRampClass
         {
             StartHue      = 40,
             EndHue        = 120,
             MinValue      = 65,
             MaxValue      = 90,
             MinSaturation = 25,
             MaxSaturation = 45,
             Size          = 5,
             Seed          = 23
         };
         this.icolorRamp_0 = ramp;
     }
     else
     {
         this.cboColorRamp.Text = this.iuniqueValueRenderer_0.ColorScheme;
         if (this.cboColorRamp.SelectedIndex == -1)
         {
             this.cboColorRamp.SelectedIndex         = 0;
             this.iuniqueValueRenderer_0.ColorScheme = this.cboColorRamp.Text;
         }
         this.icolorRamp_0 = this.cboColorRamp.GetSelectStyleGalleryItem().Item as IColorRamp;
     }
     this.method_1();
     this.bool_0 = true;
 }
コード例 #19
0
 private void TrailsSetCtrl_Load(object sender, EventArgs e)
 {
     if (this.m_pPositionTrails != null)
     {
         IStyleGalleryItem item;
         this.chkLineTrail.Checked  = this.m_pPositionTrails.ShowLinearTrail;
         this.chkPointTrail.Checked = this.m_pPositionTrails.ShowMarkerTrails;
         this.btnLineSymbol.Style   = this.m_pPositionTrails.LinearTrailSymbol;
         this.btnPointSymbol.Style  = this.m_pPositionTrails.MarkerTrailSymbol;
         this.txtDistance.Text      = this.m_pPositionTrails.MarkerTrailDistance.ToString();
         this.txtPointNum.Text      = this.m_pPositionTrails.MarkerTrailCount.ToString();
         this.txtLineLength.Text    = this.m_pPositionTrails.LinearTrailDistance.ToString();
         if (this.m_pPositionTrails.MarkerTrailColorRamp != null)
         {
             item = new ServerStyleGalleryItemClass
             {
                 Item = this.m_pPositionTrails.MarkerTrailColorRamp
             };
             this.cboSpeedColorRamp.Add(item);
         }
         if (this.m_pSG != null)
         {
             IEnumStyleGalleryItem item2 = this.m_pSG.get_Items("Color Ramps", "", "");
             item2.Reset();
             for (item = item2.Next(); item != null; item = item2.Next())
             {
                 this.cboSpeedColorRamp.Add(item);
             }
             item2 = null;
             GC.Collect();
         }
         if (this.cboSpeedColorRamp.Items.Count > 0)
         {
             this.cboSpeedColorRamp.SelectedIndex = 0;
         }
         else
         {
             this.cboSpeedColorRamp.Enabled = false;
         }
         this.m_CanDo = true;
     }
 }
コード例 #20
0
        public ISymbol GetLineSymbol(out string sLineSymbolName)
        {
            List <string> list = new List <string>();
            //this.method_1(list);
            IStyleGallery styleGallery = new ServerStyleGallery();
            ISymbol       result;

            foreach (string current in _config.StyleFiles)
            {
                styleGallery.Clear();
                ((IStyleGalleryStorage)styleGallery).AddFile(current);
                IEnumStyleGalleryItem enumStyleGalleryItem = styleGallery.get_Items("Line Symbols", current, "");
                enumStyleGalleryItem.Reset();
                for (IStyleGalleryItem styleGalleryItem = enumStyleGalleryItem.Next();
                     styleGalleryItem != null;
                     styleGalleryItem = enumStyleGalleryItem.Next())
                {
                    if (this.lineName == "")
                    {
                        sLineSymbolName = styleGalleryItem.Name;
                        ISymbol symbol = (ISymbol)styleGalleryItem.Item;
                        result = symbol;
                        return(result);
                    }
                    if (styleGalleryItem.Name == this.lineName)
                    {
                        IRgbColor rgbColor = new RgbColor();
                        rgbColor.RGB = (this.lineColor);
                        ((ILineSymbol)styleGalleryItem.Item).Color = (rgbColor);
                        ((ILineSymbol)styleGalleryItem.Item).Width = (this.lineWidth);
                        sLineSymbolName = styleGalleryItem.Name;
                        ISymbol symbol = (ISymbol)styleGalleryItem.Item;
                        result = symbol;
                        return(result);
                    }
                }
            }
            sLineSymbolName = "";
            result          = null;
            return(result);
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: AKROGIS/makiArcGISStyle
        private static void ConvertVectorPicturesToRepresentationMarkers(string stylePath)
        {
            IStyleGallery        styleGallery        = GetStyleGallery(stylePath);
            IStyleGalleryStorage styleGalleryStorage = styleGallery as IStyleGalleryStorage;

            styleGalleryStorage.TargetFile = stylePath;
            IEnumStyleGalleryItem enumItems = styleGallery.get_Items("Marker Symbols", stylePath, "Vector");

            IStyleGalleryItem3 originalItem = null;
            IStyleGalleryItem3 newItem      = null;

            enumItems.Reset();

            originalItem = enumItems.Next() as IStyleGalleryItem3;
            while (originalItem != null)
            {
                newItem = ConvertMarkerItemToRep(originalItem);
                styleGallery.AddItem(newItem);
                originalItem = enumItems.Next() as IStyleGalleryItem3;
            }
        }
コード例 #22
0
        private void ScaleTextFormatPropertyPage_Load(object sender, EventArgs e)
        {
            IStyleGalleryItem item;

            this.cboFontName.Items.Clear();
            InstalledFontCollection fonts = new InstalledFontCollection();

            for (int i = 0; i < fonts.Families.Length; i++)
            {
                this.cboFontName.Items.Add(fonts.Families[i].Name);
            }
            if (this.istyleGallery_0 != null)
            {
                item = null;
                IEnumStyleGalleryItem item2 = this.istyleGallery_0.get_Items("Scale Texts", "", "");
                item2.Reset();
                item = item2.Next();
                while (item != null)
                {
                    this.cboStyle.Add(item);
                    item = item2.Next();
                }
                if (this.cboStyle.Items.Count > 0)
                {
                    this.cboStyle.SelectedIndex = 0;
                }
            }
            if (m_pScaleText != null)
            {
                item = new MyStyleGalleryItem
                {
                    Name = "<定制>",
                    Item = m_pScaleText
                };
                this.cboStyle.SelectStyleGalleryItem(item);
            }
            this.method_0();
            this.bool_0 = true;
        }
コード例 #23
0
 private void LegendItemGeneralPropertyPage_Load(object sender, EventArgs e)
 {
     if (this.istyleGallery_0 != null)
     {
         IStyleGalleryItem     item  = null;
         IEnumStyleGalleryItem item2 = this.istyleGallery_0.get_Items("Line Patches", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboLinePatches.Add(item);
         }
         this.cboLinePatches.SelectedIndex = -1;
         item2 = this.istyleGallery_0.get_Items("Area Patches", "", "");
         item2.Reset();
         for (item = item2.Next(); item != null; item = item2.Next())
         {
             this.cboAreaPatches.Add(item);
         }
         this.cboAreaPatches.SelectedIndex = -1;
     }
     this.method_1();
     this.bool_0 = true;
 }
コード例 #24
0
        private static void ConvertVectorPicturesToRepresentationMarkers(string stylePath)
        {
            if (!System.IO.File.Exists(stylePath))
            {
                Console.WriteLine("StylePath does NOT exist: " + stylePath);
                return;
            }

            IStyleGallery        styleGallery        = GetStyleGallery(stylePath);
            IStyleGalleryStorage styleGalleryStorage = styleGallery as IStyleGalleryStorage;

            styleGalleryStorage.TargetFile = stylePath;
            IEnumStyleGalleryItem enumItems = styleGallery.get_Items("Marker Symbols", stylePath, "");

            IStyleGalleryItem3 originalItem = null;
            IStyleGalleryItem3 newItem      = null;

            enumItems.Reset();

            originalItem = enumItems.Next() as IStyleGalleryItem3;
            while (originalItem != null)
            {
                IPictureMarkerSymbol pictureMS = originalItem.Item as IPictureMarkerSymbol;
                if (pictureMS != null)
                {
                    // check if it requires conversion to rep marker?
                    // TODO: perhaps make this an option if user doesn't need rep's
                    if (containsVectorTag(originalItem.Tags))
                    {
                        newItem = ConvertMarkerItemToRep(originalItem);
                        Console.WriteLine("Converting symbol " + newItem.Name + " to a representation marker");
                        styleGallery.AddItem(newItem);
                    }
                    originalItem = enumItems.Next() as IStyleGalleryItem3;
                }
            }
        }
コード例 #25
0
 private void DotDensityRendererCtrl_Load(object sender, EventArgs e)
 {
     this.method_2();
     if (this.istyleGallery_0 != null)
     {
         IEnumStyleGalleryItem item = this.istyleGallery_0.get_Items("Color Ramps", "", "");
         item.Reset();
         for (IStyleGalleryItem item2 = item.Next(); item2 != null; item2 = item.Next())
         {
             this.colorRampComboBox1.Add(item2);
         }
         item = null;
         GC.Collect();
     }
     if (this.colorRampComboBox1.Items.Count == 0)
     {
         this.colorRampComboBox1.Enabled = false;
     }
     else
     {
         this.colorRampComboBox1.Text = this.idotDensityRenderer_0.ColorScheme;
         if (this.colorRampComboBox1.SelectedIndex == -1)
         {
             this.colorRampComboBox1.SelectedIndex  = 0;
             this.idotDensityRenderer_0.ColorScheme = this.colorRampComboBox1.Text;
         }
         IFields fields = this.igeoFeatureLayer_0.FeatureClass.Fields;
         this.ienumColors_0 = this.method_1(this.colorRampComboBox1.GetSelectColorRamp(), fields.FieldCount);
         this.ienumColors_0.Reset();
     }
     if (this.igeoFeatureLayer_0 != null)
     {
         this.method_0();
     }
     this.bool_0 = true;
 }
コード例 #26
0
ファイル: StyleUtils.cs プロジェクト: arcpad/epsgis
        /// <summary>
        /// 读取ServerStyle中的文件并显示
        /// </summary>
        /// <param name="StyleGalleryClass">符号文件的种类</param>
        /// <param name="CategoryClass">符号的种类</param>
        /// <param name="cbxCategory">符号文件的种类的容器</param>
        /// <param name="lvSymbol">符号位图的容器</param>
        public static void ReadServerStyle(string StyleGalleryClass, string CategoryClass, ComboBox cbxCategory, ListView lvSymbol)
        {
            lvSymbol.Items.Clear();
            lvSymbol.LargeImageList.Images.Clear();
            IStyleGallery        pStyleGallery        = new ServerStyleGalleryClass();
            IStyleGalleryStorage pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage;

            // 增加符号文件
            //pStyleGalleryStorage.TargetFile = _STYLEFILE;
            for (int i = pStyleGalleryStorage.FileCount - 1; i >= 0; i--)
            {
                pStyleGalleryStorage.RemoveFile(pStyleGalleryStorage.get_File(i));
            }
            pStyleGalleryStorage.AddFile(_STYLEFILE);
            // 根据当前符号的类别和文件得到符号的枚举循环子,符号类别包括Fill Symbol,Line Symbol等
            IEnumStyleGalleryItem pEnumStyleItem = pStyleGallery.get_Items(StyleGalleryClass, _STYLEFILE, "");

            // 得到符号文件类别的各个条目,增加到一个Combox中
            if (cbxCategory != null)
            {
                cbxCategory.Items.Clear();
                cbxCategory.Items.Add(_ALLSYMBOLS);
                IEnumBSTR pEnumBSTR = pStyleGallery.get_Categories(StyleGalleryClass);
                pEnumBSTR.Reset();
                string Category = "";
                Category = pEnumBSTR.Next();
                while (Category != null)
                {
                    cbxCategory.Items.Add(Category);
                    Category = pEnumBSTR.Next();
                }
            }

            pEnumStyleItem.Reset();
            IStyleGalleryItem  mStyleItem  = pEnumStyleItem.Next();
            IStyleGalleryClass mStyleClass = null;

            for (int i = 0; i < pStyleGallery.ClassCount; i++)
            {
                mStyleClass = pStyleGallery.get_Class(i);
                string str = mStyleClass.Name;
                if (str == StyleGalleryClass)
                {
                    break;
                }
            }

            // 得到各个符号并转化为图片
            int       ImageIndex = 0;
            ImageList Largeimage = lvSymbol.LargeImageList;

            if (CategoryClass == "" || CategoryClass == _ALLSYMBOLS)
            {
                while (mStyleItem != null)
                {
                    // 调用另一个类的方法将符号转化为图片
                    Bitmap bmpB = StyleGalleryItemToBmp(32, 32, mStyleClass, mStyleItem);
                    Largeimage.Images.Add(bmpB);
                    ListViewItem lvItem = new ListViewItem(new string[] { mStyleItem.Name, mStyleItem.ID.ToString(), mStyleItem.Category }, ImageIndex);
                    lvSymbol.Items.Add(lvItem);
                    ImageIndex++;
                    mStyleItem = pEnumStyleItem.Next();
                }
            }
            else
            {
                while (mStyleItem != null)
                {
                    if (CategoryClass == mStyleItem.Category)
                    {
                        // 调用另一个类的方法将符号转化为图片
                        Bitmap bmpB = StyleGalleryItemToBmp(32, 32, mStyleClass, mStyleItem);
                        Largeimage.Images.Add(bmpB);
                        ListViewItem lvItem = new ListViewItem(new string[] { mStyleItem.Name, mStyleItem.ID.ToString(), mStyleItem.Category }, ImageIndex);
                        lvSymbol.Items.Add(lvItem);
                        ImageIndex++;
                    }
                    mStyleItem = pEnumStyleItem.Next();
                }
            }
            // 必须采用此方式进行释放,第二次才能正常读取
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumStyleItem);
        }
コード例 #27
0
 private void btnConvert_Click(object sender, EventArgs e)
 {
     if (this.listBox1.Items.Count == 0)
     {
         MessageBox.Show("请选择要转换的源符号库");
     }
     else if (this.txtDest.Text.Length == 0)
     {
         MessageBox.Show("请输入转出目录");
     }
     else
     {
         IStyleGallery  gallery;
         int            num3;
         string         str;
         SaveFileDialog dialog = new SaveFileDialog
         {
             FileName = this.txtDest.Text
         };
         Stream stream = dialog.OpenFile();
         if (stream != null)
         {
             Stream manifestResourceStream;
             int    num;
             if (!this.m_IsStyleFile)
             {
                 manifestResourceStream =
                     base.GetType()
                     .Assembly.GetManifestResourceStream(
                         "Yutai.ArcGIS.Controls.Controls.SymbolUI.template.style");
             }
             else
             {
                 manifestResourceStream =
                     base.GetType()
                     .Assembly.GetManifestResourceStream(
                         "Yutai.ArcGIS.Controls.Controls.SymbolUI.template.ServerStyle");
             }
             byte[] buffer = new byte[4096];
             while ((num = manifestResourceStream.Read(buffer, 0, 4096)) > 0)
             {
                 stream.Write(buffer, 0, num);
             }
             stream.Close();
         }
         if (this.m_IsStyleFile)
         {
             gallery = new ServerStyleGalleryClass();
             num3    = (gallery as IStyleGalleryStorage).FileCount - 1;
             while (num3 >= 0)
             {
                 str = (gallery as IStyleGalleryStorage).get_File(num3);
                 (gallery as IStyleGalleryStorage).RemoveFile(str);
                 num3--;
             }
         }
         else
         {
             gallery = new MyStyleGallery();
         }
         gallery.Clear();
         (gallery as IStyleGalleryStorage).TargetFile = this.txtDest.Text;
         foreach (object obj2 in this.listBox1.Items)
         {
             try
             {
                 IStyleGallery gallery2;
                 if (this.m_IsStyleFile)
                 {
                     gallery2 = new MyStyleGallery();
                 }
                 else
                 {
                     gallery2 = new ServerStyleGalleryClass();
                     num3     = (gallery2 as IStyleGalleryStorage).FileCount - 1;
                     while (num3 >= 0)
                     {
                         str = (gallery2 as IStyleGalleryStorage).get_File(num3);
                         (gallery2 as IStyleGalleryStorage).RemoveFile(str);
                         num3--;
                     }
                 }
                 gallery2.Clear();
                 (gallery2 as IStyleGalleryStorage).AddFile(obj2.ToString());
                 for (num3 = 0; num3 < gallery2.ClassCount; num3++)
                 {
                     string    name  = gallery2.get_Class(num3).Name;
                     IEnumBSTR mbstr = gallery2.get_Categories(name);
                     string    fileNameWithoutExtension = Path.GetFileNameWithoutExtension(obj2.ToString());
                     mbstr.Reset();
                     for (string str4 = mbstr.Next(); str4 != null; str4 = mbstr.Next())
                     {
                         IEnumStyleGalleryItem item = gallery2.get_Items(name, obj2.ToString(), str4);
                         item.Reset();
                         IStyleGalleryItem item2 = null;
                         try
                         {
                             item2 = item.Next();
                         }
                         catch
                         {
                         }
                         while (item2 != null)
                         {
                             string str6;
                             if (this.m_IsStyleFile)
                             {
                                 IStyleGalleryItem item3 = new ServerStyleGalleryItemClass();
                                 object            obj3  = item2.Item;
                                 item3.Item = obj3;
                                 string str5 = item2.Name;
                                 item3.Name = str5;
                                 if (item2.Category.Length > 0)
                                 {
                                     str6           = fileNameWithoutExtension + "_" + item2.Category;
                                     item3.Category = str6;
                                 }
                                 else
                                 {
                                     item3.Category = fileNameWithoutExtension;
                                 }
                                 try
                                 {
                                     string defaultStylePath = (gallery as IStyleGalleryStorage).DefaultStylePath;
                                     int    fileCount        = (gallery as IStyleGalleryStorage).FileCount;
                                     gallery.AddItem(item3);
                                 }
                                 catch (Exception)
                                 {
                                 }
                             }
                             else
                             {
                                 if (item2.Category.Length > 0)
                                 {
                                     str6           = fileNameWithoutExtension + "_" + item2.Category;
                                     item2.Category = str6;
                                 }
                                 else
                                 {
                                     item2.Category = fileNameWithoutExtension;
                                 }
                                 gallery.AddItem(item2);
                             }
                             try
                             {
                                 item2 = item.Next();
                             }
                             catch
                             {
                             }
                         }
                     }
                 }
                 (gallery2 as IStyleGalleryStorage).RemoveFile(obj2.ToString());
             }
             catch (Exception)
             {
             }
         }
         try
         {
             (gallery as IStyleGalleryStorage).RemoveFile(this.txtDest.Text);
         }
         catch
         {
         }
         base.Close();
     }
 }
コード例 #28
0
ファイル: frmStyleConvert.cs プロジェクト: secondii/Yutai
 private void btnConvert_Click(object sender, EventArgs e)
 {
     if (this.txtOrigin.Text.Length == 0)
     {
         MessageBox.Show("请选择要转换的源符号库");
     }
     else if (this.txtDest.Text.Length == 0)
     {
         MessageBox.Show("请输入目的符号库");
     }
     else
     {
         SaveFileDialog dialog = new SaveFileDialog
         {
             FileName = this.txtDest.Text
         };
         Stream stream = dialog.OpenFile();
         if (stream != null)
         {
             Stream        manifestResourceStream;
             int           num;
             IStyleGallery gallery;
             IStyleGallery gallery2;
             int           num3;
             if (this.m_IsStyleFile)
             {
                 manifestResourceStream =
                     base.GetType()
                     .Assembly.GetManifestResourceStream("Yutai.ArcGIS.Controls.SymbolUI.template.style");
             }
             else
             {
                 manifestResourceStream =
                     base.GetType()
                     .Assembly.GetManifestResourceStream(
                         "Yutai.ArcGIS.Controls.SymbolUI.template.ServerStyle");
             }
             byte[] buffer = new byte[4096];
             while ((num = manifestResourceStream.Read(buffer, 0, 4096)) > 0)
             {
                 stream.Write(buffer, 0, num);
             }
             stream.Close();
             if (this.m_IsStyleFile)
             {
                 gallery  = new ServerStyleGalleryClass();
                 gallery2 = new MyStyleGallery();
             }
             else
             {
                 gallery  = new MyStyleGallery();
                 gallery2 = new ServerStyleGalleryClass();
                 for (num3 = (gallery2 as IStyleGalleryStorage).FileCount - 1; num3 >= 0; num3--)
                 {
                     string path = (gallery2 as IStyleGalleryStorage).get_File(num3);
                     (gallery2 as IStyleGalleryStorage).RemoveFile(path);
                 }
             }
             (gallery as IStyleGalleryStorage).AddFile(this.txtOrigin.Text);
             (gallery2 as IStyleGalleryStorage).AddFile(this.txtDest.Text);
             for (num3 = 0; num3 < gallery.ClassCount; num3++)
             {
                 string name = gallery.get_Class(num3).Name;
                 IEnumStyleGalleryItem item = gallery.get_Items(name, this.txtOrigin.Text, "");
                 item.Reset();
                 for (IStyleGalleryItem item2 = item.Next(); item2 != null; item2 = item.Next())
                 {
                     gallery2.AddItem(item2);
                 }
             }
         }
     }
 }
コード例 #29
0
        private void AddSymbol(string FileName)
        {
            IEnumStyleGalleryItem item = null;

            switch (this.m_SymbolType)
            {
            case enumSymbolType.enumSTPoint:
                item = this.m_pSG.get_Items("Marker Symbols", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTLine:
                item = this.m_pSG.get_Items("Line Symbols", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTFill:
                item = this.m_pSG.get_Items("Fill Symbols", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTText:
                item = this.m_pSG.get_Items("Text Symbols", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTColorRamp:
                item = this.m_pSG.get_Items("Color Ramps", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTColor:
                item = this.m_pSG.get_Items("Colors", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTNorthArrow:
                item = this.m_pSG.get_Items("North Arrows", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTScaleBar:
                item = this.m_pSG.get_Items("Scale Bars", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTScaleText:
                item = this.m_pSG.get_Items("Scale Texts", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTBorder:
                item = this.m_pSG.get_Items("Borders", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTShadow:
                item = this.m_pSG.get_Items("Shadows", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTBackground:
                item = this.m_pSG.get_Items("Backgrounds", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTLinePatch:
                item = this.m_pSG.get_Items("Line Patches", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTLegendItem:
                item = this.m_pSG.get_Items("Legend Items", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTLabel:
                item = this.m_pSG.get_Items("Labels", FileName, this.m_Category);
                break;

            case enumSymbolType.enumSTMapGrid:
                item = this.m_pSG.get_Items("Reference Systems", FileName, this.m_Category);
                break;
            }
            if (item != null)
            {
                item.Reset();
                for (IStyleGalleryItem item2 = item.Next(); item2 != null; item2 = item.Next())
                {
                    this.symbolListView1.Add(item2);
                }
                item.Reset();
                item = null;
                GC.Collect();
            }
        }
コード例 #30
0
 private void ReadSymbol()
 {
     try
     {
         this.symbolListView1.RemoveAll();
         IEnumStyleGalleryItem item = null;
         if (this.m_ClassName != null)
         {
             IStyleGalleryItem styleGalleryItem = null;
             for (int i = 0; i < (this.m_pSG as IStyleGalleryStorage).FileCount; i++)
             {
                 string path = (this.m_pSG as IStyleGalleryStorage).get_File(i);
                 string str2 = Path.GetExtension(path).ToLower();
                 if ((!(this.m_pSG is ESRI.ArcGIS.esriSystem.IPersistStream) || (str2 == ".serverstyle")) &&
                     (!(this.m_pSG is MyStyleGallery) || !(str2 != ".style")))
                 {
                     item = this.m_pSG.get_Items(this.m_ClassName, path, this.m_Category);
                     if (item != null)
                     {
                         try
                         {
                             item.Reset();
                             for (styleGalleryItem = item.Next();
                                  styleGalleryItem != null;
                                  styleGalleryItem = item.Next())
                             {
                                 this.symbolListView1.Add(styleGalleryItem);
                                 if (styleGalleryItem.Name.ToLower() == this.m_styleName)
                                 {
                                     this.symbolListView1.SelectedIndices.Clear();
                                     this.symbolListView1.SelectedIndices.Add(this.symbolListView1.Items.Count -
                                                                              1);
                                     if (this.m_pPreviewSelSymbol == null)
                                     {
                                         this.m_pPreviewSelSymbol = (styleGalleryItem.Item as IClone).Clone();
                                         this.symbolItem1.Symbol  = (ISymbol)styleGalleryItem.Item;
                                     }
                                 }
                             }
                         }
                         catch
                         {
                         }
                         item = null;
                         GC.Collect();
                     }
                 }
             }
             if (this.m_pPreviewSelSymbol == null)
             {
                 styleGalleryItem = this.symbolListView1.GetStyleGalleryItem(0);
                 if (styleGalleryItem != null)
                 {
                     this.m_pPreviewSelSymbol = (styleGalleryItem.Item as IClone).Clone();
                     this.symbolItem1.Symbol  = (ISymbol)styleGalleryItem.Item;
                 }
             }
         }
     }
     catch (Exception)
     {
     }
 }