private bool readRailDatas()
        {
            bool bRet            = false;
            int  iRailDatasCount = 0;

            try
            {
                IEnumerable <ARAIL> enumerRail = null;
                enumerRail      = mainForm.BCApp.SCApplication.MapBLL.loadAllRail();
                iRailDatasCount = enumerRail.Count();
                if (iRailDatasCount > 0)
                {
                    m_objItemRail = new uctlRail[iRailDatasCount];

                    int index = 0;
                    foreach (ARAIL rail in enumerRail)
                    {
                        m_objItemRail[index]                  = new uctlRail();
                        m_objItemRail[index].p_Num            = index + 1;
                        m_objItemRail[index].p_ID             = rail.RAIL_ID;
                        m_objItemRail[index].p_RailType       = rail.RAILTYPE;
                        m_objItemRail[index].p_StrMapRailInfo = rail;
                        m_objItemRail[index].p_RailWidth      = (int)rail.WIDTH;
                        m_objItemRail[index].p_RailColor      = BCUtility.ConvStr2Color(rail.COLOR);
                        m_objItemRail[index].p_LocX           = rail.LOCATIONX;
                        m_objItemRail[index].p_LocY           = rail.LOCATIONY;
                        m_objItemRail[index].p_RailLength     = (int)rail.LENGTH;
                        if (m_objItemRail[index].p_RailType == E_RAIL_TYPE.Straight_Vertical)
                        {
                            m_objItemRail[index].Tag = m_objItemRail[index].Top + "|" + m_objItemRail[index].Left + "|"
                                                       + m_objItemRail[index].Height + "|" + m_objItemRail[index].p_RailWidth;
                        }
                        else
                        {
                            m_objItemRail[index].Tag = m_objItemRail[index].Top + "|" + m_objItemRail[index].Left + "|"
                                                       + m_objItemRail[index].Width + "|" + m_objItemRail[index].p_RailWidth;
                        }

                        if (m_objItemRail[index].p_RailType == E_RAIL_TYPE.Arrow_Up ||
                            m_objItemRail[index].p_RailType == E_RAIL_TYPE.Arrow_Down ||
                            m_objItemRail[index].p_RailType == E_RAIL_TYPE.Arrow_Left ||
                            m_objItemRail[index].p_RailType == E_RAIL_TYPE.Arrow_Right)
                        {
                            m_objItemRail[index].Visible = false;
                        }
                        index++;
                    }
                    this.pnl_Map.Controls.AddRange(m_objItemRail);
                }
                bRet = true;
            }
            catch (Exception ex)
            {
                bRet = false;
                logger.Error(ex, "Exception");
            }
            return(bRet);
        }
Exemplo n.º 2
0
        private bool readAddressPortDatas()
        {
            bool bRet       = false;
            int  iAddrCount = 0;

            try
            {
                IEnumerable <AADDRESS> enumerAdr = mainForm.BCApp.SCApplication.MapBLL.loadAllAddress();

                iAddrCount = enumerAdr.Count();

                int index = 0;
                m_objItemAddr = new uctlAddress[iAddrCount];
                foreach (AADDRESS adr in enumerAdr)
                {
                    m_objItemAddr[index]           = new uctlAddress(this);
                    m_objItemAddr[index].p_AddrPt  = index;
                    m_objItemAddr[index].p_Address = adr.ADR_ID.Trim();
                    var port_obj = mainForm.BCApp.SCApplication.PortStationBLL.OperateCatch.getPortStationByID(adr.ADR_ID.Trim());
                    if (port_obj != null)
                    {
                        m_objItemAddr[index].p_Port = port_obj.PORT_ID.Trim();
                    }
                    APOINT point = mainForm.BCApp.SCApplication.MapBLL.getPointByID(adr.ADR_ID);
                    if (point != null)
                    {
                        m_objItemAddr[index].str_Map_Add_Info = point;
                        m_objItemAddr[index].p_LayoutPoint    = 0;
                        m_objItemAddr[index].p_Text           = string.Empty;
                        m_objItemAddr[index].p_PointType      = point.POINTTYPE;
                        m_objItemAddr[index].p_LocX           = point.LOCATIONX;
                        m_objItemAddr[index].p_LocY           = point.LOCATIONY;
                        m_objItemAddr[index].p_SizeW          = (int)point.WIDTH;
                        m_objItemAddr[index].p_SizeH          = (int)point.HEIGHT;
                        m_objItemAddr[index].p_Color          = BCUtility.ConvStr2Color(point.COLOR);
                        m_objItemAddr[index].p_ZoomLV         = adr.ZOOM_LV;
                        m_objItemAddr[index].Visible          = adr.ZOOM_LV >= trackBar_scale.Value;
                        m_objItemAddr[index].Tag = m_objItemAddr[index].Top + "|" + m_objItemAddr[index].Left + "|"
                                                   + m_objItemAddr[index].Height + "|" + m_objItemAddr[index].Width;
                    }
                    index++;
                }

                if (iAddrCount > 0)
                {
                    this.pnl_Map.Controls.AddRange(m_objItemAddr);
                }

                bRet = true;
            }
            catch (Exception ex)
            {
                bRet = false;
                logger.Error(ex, "Exception");
            }
            return(bRet);
        }
        private bool readPortIconDatas()
        {
            bool bRet           = false;
            int  iPortIconCount = 0;

            try
            {
                IEnumerable <APORTICON> enumerportIcon = mainForm.BCApp.SCApplication.MapBLL.loadAllPortIcon();

                iPortIconCount = enumerportIcon.Count();

                int index = 0;
                m_objItemPortNew = new uctlPortNew[iPortIconCount];
                foreach (APORTICON adr in enumerportIcon)
                {
                    m_objItemPortNew[index]            = new uctlPortNew();
                    m_objItemPortNew[index].p_PortName = adr.PORT_ID;
                    m_objItemPortNew[index].p_Address  = adr.ADR_ID;
                    m_objItemPortNew[index].p_LocX     = adr.LOCATIONX;
                    m_objItemPortNew[index].p_LocY     = adr.LOCATIONY;
                    m_objItemPortNew[index].p_SizeH    = adr.HEIGHT;
                    m_objItemPortNew[index].p_SizeW    = adr.WIDTH;
                    m_objItemPortNew[index].p_Color    = BCUtility.ConvStr2Color(adr.COLOR);

                    m_objItemPortNew[index].Tag = m_objItemPortNew[index].Top + "|" + m_objItemPortNew[index].Left + "|"
                                                  + m_objItemPortNew[index].Height + "|" + m_objItemPortNew[index].Width;

                    index++;
                }

                if (iPortIconCount > 0)
                {
                    this.pnl_Map.Controls.AddRange(m_objItemPortNew);
                }

                bRet = true;
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
                bRet = false;
            }
            return(bRet);
        }