Example #1
0
        public void moveLatLnd(ClsLatLnd clsLatLnd)
        {
            ClsPagePosXY clsPagePosXY;
            int          setxPage, setyPage;
            int          setxdot, setydot;

            //m_nMapBase = 15;
            //setTableElement(); // m_nMapTblIdx, m_nLastX, m_nLastY, m_dLatDotStep, m_dLndDotStep 設定

            // ページ数+ページ位置算出
            clsPagePosXY = convLatLndToRltvPagePosXY(clsLatLnd);
            // ページ数セット
            setxPage = (int)(clsPagePosXY.m_dPagePosX);
            setyPage = (int)(clsPagePosXY.m_dPagePosY);
            // ドット数
            setxdot = (int)((clsPagePosXY.m_dPagePosX - setxPage) * Constants.MAPDOTSIZE);
            setydot = (int)((clsPagePosXY.m_dPagePosY - setyPage) * Constants.MAPDOTSIZE);

            m_nCrtX = setxPage - m_nCenterXBlock - m_nWidthDiv;
            m_nCrtY = setyPage - m_nCenterYBlock - m_nHeightDiv;
            int nPageX = m_nCrtX + m_tblTopX[m_nMapTblIdx];
            int nPageY = m_nCrtY + m_tblTopY[m_nMapTblIdx];

            m_nAddX     = m_nCanvasWidth / 2 - (m_nCenterXBlock * Constants.MAPDOTSIZE + setxdot);
            m_nAddY     = m_nCanvasHeight / 2 - (m_nCenterYBlock * Constants.MAPDOTSIZE + setydot);
            m_nAddX     = m_nAddX - m_nWidthDiv * Constants.MAPDOTSIZE;
            m_nAddY     = m_nAddY - m_nHeightDiv * Constants.MAPDOTSIZE;
            m_nMoveX    = 0;
            m_nMoveY    = 0;
            m_dZoomTime = 1.0;
            m_nZoomAddX = 0;
            m_nZoomAddY = 0;
            m_cnvsMove.RenderTransform = null;
            initMapArea();
        }
Example #2
0
        private void drawCnvsMoveGPSMark(double dLat, double dLnd, string sStr)
        {
            ClsLatLnd    clsLapLnd;
            ClsPagePosXY cppRltvXY;
            int          sx, sy;
            TextBlock    tb;

            // pagepos?
            clsLapLnd        = new ClsLatLnd();
            clsLapLnd.m_dLat = dLat;
            clsLapLnd.m_dLnd = dLnd;
            cppRltvXY        = convLatLndToRltvPagePosXY(clsLapLnd);
            sx = (int)((cppRltvXY.m_dPagePosX - m_nCrtX) * Constants.MAPDOTSIZE * m_dZoomTime);
            sy = (int)((cppRltvXY.m_dPagePosY - m_nCrtY) * Constants.MAPDOTSIZE * m_dZoomTime);
            sx = sx + (int)(m_nAddX * m_dZoomTime + m_nMoveX + m_nZoomAddX);
            sy = sy + (int)(m_nAddY * m_dZoomTime + m_nMoveY + m_nZoomAddY);
            if (checkInCnvsMarkArea(sx, sy) == false)
            {
                return;
            }
            m_libCnvs.setFontSize(24);
            tb            = m_libCnvs.CreateTextBlock(0, 0, sStr);
            tb.Foreground = Brushes.Red;
            Canvas.SetLeft(tb, sx);
            Canvas.SetTop(tb, sy);
            cnvsMarkArea.Children.Add(tb);
        }
Example #3
0
        private void cmbPlaceName_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string sPlace;

            string[]  ary;
            int       nSXBlock;
            int       nSYBlock;
            ClsLatLnd clsLatLnd;

            int idx = cmbPlaceName.SelectedIndex;

            if (idx == -1)
            {
                return;
            }
            sPlace = m_aryPlaceNameLine[idx + 1];
            ary    = sPlace.Split(',');
            if (cmbGroup.SelectedIndex == 2)
            {
                m_nMapBase   = 15;
                m_nMapTblIdx = m_nMapBase - 10;
                m_nLastX     = m_tblEndX[m_nMapTblIdx] - m_tblTopX[m_nMapTblIdx] - m_nWidthDiv * 3 + 2;
                m_nLastY     = m_tblEndY[m_nMapTblIdx] - m_tblTopY[m_nMapTblIdx] - m_nHeightDiv * 3 + 2;
                m_bRetouMode = true;
                nSXBlock     = m_libCmn.StrToInt(ary[3]) - m_tblTopX[m_nMapTblIdx];
                nSYBlock     = m_libCmn.StrToInt(ary[4]) - m_tblTopY[m_nMapTblIdx];
                m_nCrtX      = nSXBlock - m_nWidthDiv;
                m_nCrtY      = nSYBlock - m_nHeightDiv;
                m_nAddX      = -m_nWidthDiv * Constants.MAPDOTSIZE;
                m_nAddY      = -m_nHeightDiv * Constants.MAPDOTSIZE;
                m_dZoomTime  = 1.0;
                m_cnvsMove.RenderTransform = null;
                initMapArea();
            }
            else
            {
                m_bRetouMode     = false;
                clsLatLnd        = new ClsLatLnd();
                clsLatLnd.m_dLat = m_libCmn.StrToDouble(ary[1]);
                clsLatLnd.m_dLnd = m_libCmn.StrToDouble(ary[2]);
                moveLatLnd(clsLatLnd);
            }
        }
Example #4
0
        public void setCrtCardWinDisp()
        {
            int       nCrtIdx;
            ClsCard   clsCard;
            ClsLatLnd clsLatLnd;

            if (m_cardWin != null)
            {
                return;
            }
            nCrtIdx   = getCrtCardIdx();
            m_cardWin = new CardWin();
            m_cardWin.SetMainWindow(this);
            if (nCrtIdx == -1)
            {
                m_clsCardBack = null;
                m_clsCardNew  = new ClsCard();
                nCrtIdx       = m_clsObserve.m_lstClsCard.Count;
                m_clsObserve.m_lstClsCard.Add(m_clsCardNew);
                setCrtCardIdx(nCrtIdx);
                m_cardWin.SetClsCard(m_clsCardNew);
            }
            else
            {
                m_clsCardNew  = null;
                m_clsCardBack = new ClsCard();
                m_clsCardBack.copySetElement(m_clsObserve.m_lstClsCard[nCrtIdx]);
                clsCard          = m_clsCardBack;
                clsLatLnd        = new ClsLatLnd();
                clsLatLnd.m_dLat = clsCard.m_dLat;
                clsLatLnd.m_dLnd = clsCard.m_dLnd;
                moveLatLnd(clsLatLnd);
                m_cardWin.SetClsCard(clsCard);
            }
            m_cardWin.Owner = this;
            m_cardWin.Show();
        }
Example #5
0
        private Point drawCnvsCardMark(double dLat, double dLnd, string sSetNo)
        {
            ClsLatLnd    clsLapLnd;
            ClsPagePosXY cppRltvXY;
            Point        pt;
            int          sx, sy;

            clsLapLnd        = new ClsLatLnd();
            clsLapLnd.m_dLat = dLat;
            clsLapLnd.m_dLnd = dLnd;
            cppRltvXY        = convLatLndToRltvPagePosXY(clsLapLnd);
            sx   = (int)((cppRltvXY.m_dPagePosX - m_nCrtX) * Constants.MAPDOTSIZE * m_dZoomTime);
            sy   = (int)((cppRltvXY.m_dPagePosY - m_nCrtY) * Constants.MAPDOTSIZE * m_dZoomTime);
            sx   = sx + (int)(m_nAddX * m_dZoomTime + m_nMoveX + m_nZoomAddX);
            sy   = sy + (int)(m_nAddY * m_dZoomTime + m_nMoveY + m_nZoomAddY);
            pt   = new Point();
            pt.X = sx;
            pt.Y = sy;
            if (checkInCnvsMarkArea(sx, sy) == false)
            {
                return(pt);
            }
            m_libCnvs.setFontSize(24);
            m_tbCrt = m_libCnvs.CreateTextBlock(0, 0, sSetNo);
            Canvas.SetLeft(m_tbCrt, sx - 24);
            Canvas.SetTop(m_tbCrt, sy - 24);
            cnvsMarkArea.Children.Add(m_tbCrt);
            m_imgCamera = new Image();
            Canvas.SetLeft(m_imgCamera, sx);
            Canvas.SetTop(m_imgCamera, sy);
            m_imgCamera.Width   = 32;
            m_imgCamera.Stretch = Stretch.Fill;
            m_imgCamera.Source  = new BitmapImage(new Uri("pic/camera.png", UriKind.Relative));
            cnvsMarkArea.Children.Add(m_imgCamera);
            return(pt);
        }
Example #6
0
        private void setCardStat(String sId, String sMsg)
        {
            int       idx;
            int       len;
            String    sCheckStr;
            ClsLatLnd clsLatLnd;

            idx = searchCardIdx(sId);
            if (idx == -1)
            {
                return;
            }
            len       = sMsg.Length;
            sCheckStr = "";
            if (12 < len)
            {
                sCheckStr = sMsg.Substring(0, 12);
            }
            if (sMsg == "ログイン")
            {
                if (m_clsObserve.m_lstClsCard[idx].m_sStat != "0")
                {
                    m_clsObserve.m_lstClsCard[idx].m_sStat = "0";
                    setBlockWin();
                }
            }
            else if (sMsg == "ログアウト")
            {
                if (m_clsObserve.m_lstClsCard[idx].m_sStat != "")
                {
                    m_clsObserve.m_lstClsCard[idx].m_sStat = "";
                    setBlockWin();
                }
            }
            else if (sMsg == "I/O モニタリング停止")
            {
                if (m_clsObserve.m_lstClsCard[idx].m_sStat != "0")
                {
                    m_clsObserve.m_lstClsCard[idx].m_sStat = "0";
                    setBlockWin();
                }
            }
            else if (sCheckStr == "I/Oモジュール 1 -")
            {
                if (sMsg == "I/Oモジュール 1 - インプット 6 作動検知")
                {
                    if (m_clsObserve.m_lstClsCard[idx].m_sStat != "2")
                    {
                        m_clsObserve.m_lstClsCard[idx].m_sStat = "2";
                        setCheckStartUdp();
                        clsLatLnd        = new ClsLatLnd();
                        clsLatLnd.m_dLat = m_clsObserve.m_lstClsCard[idx].m_dLat;
                        clsLatLnd.m_dLnd = m_clsObserve.m_lstClsCard[idx].m_dLnd;
                        moveLatLnd(clsLatLnd);
                        setUnderMsg("持ち去り警報");
                        setBlockWin();
                    }
                }
                else
                {
                    m_clsObserve.m_lstClsCard[idx].m_sStat = "1";
                    clsLatLnd        = new ClsLatLnd();
                    clsLatLnd.m_dLat = m_clsObserve.m_lstClsCard[idx].m_dLat;
                    clsLatLnd.m_dLnd = m_clsObserve.m_lstClsCard[idx].m_dLnd;
                    moveLatLnd(clsLatLnd);
                    setUnderMsg("発報中,センサー発報中 " + sMsg.Substring(13));
                    setBlockWin();
                }
            }
            else if (sCheckStr == "1 I/Oモジュール異常")
            {
                if (m_clsObserve.m_lstClsCard[idx].m_sStat != "2")
                {
                    m_clsObserve.m_lstClsCard[idx].m_sStat = "2";
                    setCheckStartUdp();
                    clsLatLnd        = new ClsLatLnd();
                    clsLatLnd.m_dLat = m_clsObserve.m_lstClsCard[idx].m_dLat;
                    clsLatLnd.m_dLnd = m_clsObserve.m_lstClsCard[idx].m_dLnd;
                    moveLatLnd(clsLatLnd);
                    setUnderMsg("持ち去り警報");
                    setBlockWin();
                }
            }
            //else
            //{
            //    m_clsObserve.m_lstClsCard[idx].m_sStat = "0";
            //}
        }
Example #7
0
        public ClsLatLnd getAddressToLatLnd(String sAddress)
        {
            ClsLatLnd      latlnd;
            OdbcConnection con;
            int            max, len;
            bool           bRet;
            string         sBeforeSql;
            string         sSql;
            OdbcCommand    com;
            OdbcDataReader reader;
            string         sSubStr;

            latlnd        = new ClsLatLnd();
            latlnd.m_dLat = 0;
            latlnd.m_dLnd = 0;
            sAddress      = m_libCmn.StrNumToKan(sAddress);
            if (3 < sAddress.Length && sAddress.Substring(0, 3) == "東京都")
            {
                sAddress = sAddress.Substring(3);
            }
            con = m_libOdbc.openMdb();
            if (con != null)
            {
                sBeforeSql = "";
                max        = sAddress.Length;
                for (len = 2; len <= max; len++)
                {
                    sSubStr = sAddress.Substring(0, len);
                    sSql    = "SELECT * FROM adrslatlnd";
                    sSql    = sSql + " WHERE adrs LIKE '" + sSubStr + "%';";
                    // 前後のあいまいさを排除
                    //sSql = sSql + " WHERE adrs LIKE '%" + sSubStr + "%';";
                    com = new OdbcCommand(sSql, con);
                    try
                    {
                        reader = com.ExecuteReader();
                        bRet   = reader.Read();
                        if (bRet == true)
                        {
                            sBeforeSql = sSql;
                        }
                        else
                        {
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                com = new OdbcCommand(sBeforeSql, con);
                try
                {
                    reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        //len = reader.GetInt32(0);
                        //sSubStr = reader.GetString(1);
                        latlnd.m_dLat = reader.GetDouble(2);
                        latlnd.m_dLnd = reader.GetDouble(3);
                        //txtInfo.Text = sSubStr + "(" + latlnd.m_dLat + "," + latlnd.m_dLnd + ")";
                        break;
                    }
                }
                catch (Exception ex)
                {
                }
                m_libOdbc.closeMdb(con);
            }
            return(latlnd);
        }
Example #8
0
        private ClsPagePosXY convLatLndToRltvPagePosXY(ClsLatLnd clsLatLnd)
        {
            ClsPagePosXY clsPagePosXY;
            double       dSubLat, dSubLnd;
            int          idx;
            double       dPage18X, dPage18Y;
            double       dLnd18DotStep, dLat18DotStep;
            int          nLevel;

            clsPagePosXY = new ClsPagePosXY();
            if (m_tblRitouSLat[0] < clsLatLnd.m_dLat)
            {
                dSubLnd = (clsLatLnd.m_dLnd - m_tblTopLnd[m_nMapTblIdx]);
                clsPagePosXY.m_dPagePosX = dSubLnd / m_tblLndBlock[m_nMapTblIdx];
                m_dLndDotStep            = m_tblLndBlock[m_nMapTblIdx] / Constants.MAPDOTSIZE;
                if (clsPagePosXY.m_dPagePosX < 0)
                {
                    clsPagePosXY.m_dPagePosX = 0;
                }
                if ((double)(m_nLastX + m_nWidthDiv * 3) < clsPagePosXY.m_dPagePosX)
                {
                    clsPagePosXY.m_dPagePosX = (double)m_nLastX;
                }
                dSubLat = clsLatLnd.m_dLat - m_dBaseLat;
                clsPagePosXY.m_dPagePosY = getLatBlockPagePos(dSubLat);
            }
            else
            {
                if (m_tblRitouSLat[1] < clsLatLnd.m_dLat) // 大島 三宅島 御蔵島 八丈島
                {
                    idx = 0;
                }
                else if (m_tblRitouSLat[2] < clsLatLnd.m_dLat) // 青ヶ島
                {
                    idx = 1;
                }
                else
                {
                    idx = 2;
                }
                dSubLnd  = (clsLatLnd.m_dLnd - m_tblRitouSLnd[idx]);
                dPage18X = m_tblRitouSX[idx] + dSubLnd / m_tblRitouLndBlock[idx];

                dSubLat  = (clsLatLnd.m_dLat - m_tblRitouSLat[idx]);
                dPage18Y = m_tblRitouSY[idx] + dSubLat / m_tblRitouLatBlock[idx];

                dLnd18DotStep            = m_tblRitouLndBlock[idx] / Constants.MAPDOTSIZE;
                dLat18DotStep            = m_tblRitouLatBlock[idx] / Constants.MAPDOTSIZE;
                m_dLndDotStep            = dLnd18DotStep;
                m_dLatDotStep            = dLat18DotStep;
                clsPagePosXY.m_dPagePosX = dPage18X;
                clsPagePosXY.m_dPagePosY = dPage18Y;
                for (idx = 8; idx >= m_nMapTblIdx; idx--)
                {
                    m_dLndDotStep            = m_dLndDotStep * 2;
                    m_dLatDotStep            = m_dLatDotStep * 2;
                    clsPagePosXY.m_dPagePosX = clsPagePosXY.m_dPagePosX * 0.5;
                    clsPagePosXY.m_dPagePosY = clsPagePosXY.m_dPagePosY * 0.5;
                }
            }
            return(clsPagePosXY);
        }