Exemplo n.º 1
0
        /// <summary>
        /// 获得图饰位置
        /// </summary>
        void GetSurroundPose()
        {
            m_mapSurroundList = new List <MapSurroundEntity>();
            IGraphicsContainer graphicsContainer = axPageLayoutControl1.PageLayout as IGraphicsContainer;
            IEnvelope          mapEnvelop        = (graphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap) as IElement).Geometry.Envelope;

            graphicsContainer.Reset();
            IElement element = graphicsContainer.Next();

            while (element != null)
            {
                if (element is IMapFrame)
                {
                    element = graphicsContainer.Next();
                    continue;
                }
                else
                {
                    IEnvelope         envelop           = element.Geometry.Envelope as IEnvelope;
                    MapSurroundEntity mapSurroundEntity = new MapSurroundEntity();
                    mapSurroundEntity.left    = envelop.XMin - mapEnvelop.XMin;
                    mapSurroundEntity.right   = mapEnvelop.XMax - envelop.XMax;
                    mapSurroundEntity.top     = mapEnvelop.YMax - envelop.YMax;
                    mapSurroundEntity.bottom  = envelop.YMin - mapEnvelop.YMin;
                    mapSurroundEntity.width   = envelop.Width;
                    mapSurroundEntity.height  = envelop.Height;
                    mapSurroundEntity.element = element;
                    m_mapSurroundList.Add(mapSurroundEntity);
                }
                element = graphicsContainer.Next();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新文本位置
        /// </summary>
        /// <params name="mapEnvelop">地图范围</params>
        /// <params name="mapSurroundEntity">文本位置实体</params>
        /// <returns></returns>
        private bool UpdateTextElement(IEnvelope mapEnvelop, MapSurroundEntity mapSurroundEntity)
        {
            bool      isUpdate = false;
            IPoint    point    = mapSurroundEntity.element.Geometry as IPoint;
            IEnvelope envelop  = mapSurroundEntity.element.Geometry.Envelope;


            if (mapSurroundEntity.left > mapSurroundEntity.right)
            {
                if (mapSurroundEntity.left > mapEnvelop.Width || (mapSurroundEntity.left > mapSurroundEntity.right && (mapEnvelop.XMax - envelop.XMax) > mapSurroundEntity.right))
                {
                    point.X  = mapEnvelop.XMax - mapSurroundEntity.right - mapSurroundEntity.width;
                    isUpdate = true;
                }
            }
            if (mapSurroundEntity.bottom > mapEnvelop.Height || (mapSurroundEntity.bottom > mapSurroundEntity.top && mapEnvelop.YMax - envelop.YMax > mapSurroundEntity.top))
            {
                point.Y  = mapEnvelop.YMax - mapSurroundEntity.top - mapSurroundEntity.height;
                isUpdate = true;
            }

            if (isUpdate)
            {
                mapSurroundEntity.element.Geometry = point;
            }
            return(isUpdate);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新MapSurroundFrame位置
        /// </summary>
        /// <params name="mapEnvelop">地图范围</params>
        /// <params name="mapSurroundEntity">MapSurroundFrame位置实体</params>
        /// <returns></returns>
        private bool UpdateMapSurroundFrame(IEnvelope mapEnvelop, MapSurroundEntity mapSurroundEntity)
        {
            bool      isUpdate = false;
            IEnvelope envelop  = mapSurroundEntity.element.Geometry.Envelope;

            if (mapSurroundEntity.left > mapSurroundEntity.right)
            {
                if (mapSurroundEntity.left > mapEnvelop.Width)
                {
                    envelop.XMin = mapEnvelop.XMax - mapSurroundEntity.right - mapSurroundEntity.width;
                    envelop.XMax = envelop.XMin + mapSurroundEntity.width;
                    isUpdate     = true;
                }
                else if (mapSurroundEntity.left > mapSurroundEntity.right && (mapEnvelop.XMax - envelop.XMax) > mapSurroundEntity.right)
                {
                    envelop.XMax = mapEnvelop.XMax - mapSurroundEntity.right;
                    envelop.XMin = envelop.XMax - mapSurroundEntity.width;
                    isUpdate     = true;
                }
            }
            if (mapSurroundEntity.bottom > mapEnvelop.Height)
            {
                envelop.YMin = mapEnvelop.YMax - mapSurroundEntity.top - mapSurroundEntity.height;
                envelop.YMax = envelop.YMin + mapSurroundEntity.height;
                isUpdate     = true;
            }
            else if (mapSurroundEntity.bottom > mapSurroundEntity.top && mapEnvelop.YMax - envelop.YMax > mapSurroundEntity.top)
            {
                envelop.YMax = mapEnvelop.YMax - mapSurroundEntity.top;
                envelop.YMin = envelop.YMax - mapSurroundEntity.height;
                isUpdate     = true;
            }
            if (isUpdate)
            {
                mapSurroundEntity.element.Geometry = envelop;
            }
            return(isUpdate);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新文本位置
        /// </summary>
        /// <params name="mapEnvelop">地图范围</params>
        /// <params name="mapSurroundEntity">文本位置实体</params>
        /// <returns></returns>
        private bool UpdateTextElement(IEnvelope mapEnvelop, MapSurroundEntity mapSurroundEntity)
        {
            bool isUpdate = false;
            IPoint point = mapSurroundEntity.element.Geometry as IPoint;
            IEnvelope envelop = mapSurroundEntity.element.Geometry.Envelope;

            if (mapSurroundEntity.left > mapSurroundEntity.right)
            {
                if (mapSurroundEntity.left > mapEnvelop.Width || (mapSurroundEntity.left > mapSurroundEntity.right && (mapEnvelop.XMax - envelop.XMax) > mapSurroundEntity.right))
                {
                    point.X = mapEnvelop.XMax - mapSurroundEntity.right - mapSurroundEntity.width;
                    isUpdate = true;
                }
            }
            if (mapSurroundEntity.bottom > mapEnvelop.Height || (mapSurroundEntity.bottom > mapSurroundEntity.top && mapEnvelop.YMax - envelop.YMax > mapSurroundEntity.top))
            {
                point.Y = mapEnvelop.YMax - mapSurroundEntity.top - mapSurroundEntity.height;
                isUpdate = true;
            }

            if (isUpdate)
            {
                mapSurroundEntity.element.Geometry = point;
            }
            return isUpdate;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 更新MapSurroundFrame位置
        /// </summary>
        /// <params name="mapEnvelop">地图范围</params>
        /// <params name="mapSurroundEntity">MapSurroundFrame位置实体</params>
        /// <returns></returns>
        private bool UpdateMapSurroundFrame(IEnvelope mapEnvelop, MapSurroundEntity mapSurroundEntity)
        {
            bool isUpdate = false;
            IEnvelope envelop = mapSurroundEntity.element.Geometry.Envelope;

            if (mapSurroundEntity.left > mapSurroundEntity.right)
            {
                if (mapSurroundEntity.left > mapEnvelop.Width)
                {
                    envelop.XMin = mapEnvelop.XMax - mapSurroundEntity.right - mapSurroundEntity.width;
                    envelop.XMax = envelop.XMin + mapSurroundEntity.width;
                    isUpdate = true;
                }
                else if (mapSurroundEntity.left > mapSurroundEntity.right && (mapEnvelop.XMax - envelop.XMax) > mapSurroundEntity.right)
                {
                    envelop.XMax = mapEnvelop.XMax - mapSurroundEntity.right;
                    envelop.XMin = envelop.XMax - mapSurroundEntity.width;
                    isUpdate = true;
                }

            }
            if (mapSurroundEntity.bottom > mapEnvelop.Height)
            {
                envelop.YMin = mapEnvelop.YMax - mapSurroundEntity.top - mapSurroundEntity.height;
                envelop.YMax = envelop.YMin + mapSurroundEntity.height;
                isUpdate = true;
            }
            else if (mapSurroundEntity.bottom > mapSurroundEntity.top && mapEnvelop.YMax - envelop.YMax > mapSurroundEntity.top)
            {
                envelop.YMax = mapEnvelop.YMax - mapSurroundEntity.top;
                envelop.YMin = envelop.YMax - mapSurroundEntity.height;
                isUpdate = true;
            }
            if (isUpdate)
            {
                mapSurroundEntity.element.Geometry = envelop;
            }
            return isUpdate;
        }
Exemplo n.º 6
0
 /// <summary>
 /// 获得图饰位置
 /// </summary>
 void GetSurroundPose()
 {
     m_mapSurroundList = new List<MapSurroundEntity>();
     IGraphicsContainer graphicsContainer = axPageLayoutControl1.PageLayout as IGraphicsContainer;
     IEnvelope mapEnvelop = (graphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap) as IElement).Geometry.Envelope;
     graphicsContainer.Reset();
     IElement element = graphicsContainer.Next();
     while (element != null)
     {
         if (element is IMapFrame)
         {
             element = graphicsContainer.Next();
             continue;
         }
         else
         {
             IEnvelope envelop = element.Geometry.Envelope as IEnvelope;
             MapSurroundEntity mapSurroundEntity = new MapSurroundEntity();
             mapSurroundEntity.left = envelop.XMin - mapEnvelop.XMin;
             mapSurroundEntity.right = mapEnvelop.XMax - envelop.XMax;
             mapSurroundEntity.top = mapEnvelop.YMax - envelop.YMax;
             mapSurroundEntity.bottom = envelop.YMin - mapEnvelop.YMin;
             mapSurroundEntity.width = envelop.Width;
             mapSurroundEntity.height = envelop.Height;
             mapSurroundEntity.element = element;
             m_mapSurroundList.Add(mapSurroundEntity);
         }
         element = graphicsContainer.Next();
     }
 }