设置机位号(停机位)的图标大小

2016-02-16 09:07:37  访问(1661) 赞(0) 踩(0)


        /// <summary>
        /// 设置机位号(停机位)的图标大小
        /// </summary>
        protected void FeatureLayerTjwChangeSize()
        {
            string layerName = "复件 登机位编号_point";

            IAppHelper ah
                =
                AppDriver.IAppHelperGet();


            // 获得临时图层 //
            FeatureLayer lyr = FeatureLayerGetByName
                (
                    layerName
                );

            if (lyr == null)
            {
                return;
            }


            Table tb = lyr.Table;

            if (tb == null)
            {
                return;
            }

            CoordSys csys = lyr.CoordSys;  

            int carPointSize = 2;

            if (tb.CurrentAccessMode == TableAccessMode.Write)
            {
                throw new Exception
                    (
                        "方法:"
                        + MethodBase.GetCurrentMethod().ReflectedType.FullName
                        + " "
                        + MethodBase.GetCurrentMethod().ToString()
                        + " 发生异常:" + layerName + "图层已经被写锁定"
                    );
            }

            //更新点的位置
            tb.BeginAccess(MapInfo.Data.TableAccessMode.Write);

            try
            {
                MapInfo.Styles.SimpleVectorPointStyle cs = null;
                foreach (Feature fcar in tb)
                {
                    if (!(fcar.Style is MapInfo.Styles.SimpleVectorPointStyle))
                        continue;

                    cs = fcar.Style as MapInfo.Styles.SimpleVectorPointStyle;
                     
                    if (cs == null)
                        continue;

                    cs.PointSize = carPointSize;

                    fcar.Update();
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (tb != null 
                    && 
                    tb.CurrentAccessMode == TableAccessMode.Write)
                {
                    tb.EndAccess();
                }

                mapControl1.Refresh();
            }
        }


标签:设置机位号(停机位)的图标大小 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)