Beispiel #1
0
        void getStartPositionByFp(out Data.PathStartPoint2 startPosition, FastonPosition fastonPosition)
        {
            double startX, startY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fastonPosition.positionLongitudeOnRoad, fastonPosition.positionLatitudeOnRoad, out startX, out startY);
            startPosition = new Data.PathStartPoint2()
            {
                x = Convert.ToInt32(startX * 256),
                y = Convert.ToInt32(startY * 256)
            };
        }
Beispiel #2
0
        /// <summary>
        /// 将序号按距离进行排序
        /// </summary>
        /// <param name="target"></param>
        /// <returns>返回的值为0至37的排序</returns>
        internal List <int> getCollectPositionsByDistance(FastonPosition target)
        {
            List <int> positions = new List <int>();

            for (int i = 0; i < 38; i++)
            {
                positions.Add(i);
                //var collectP = Program.dt.GetFpByIndex(this._collectPosition[i]);
                //positions.Add(collectP);
            }
            positions = (from item in positions orderby CommonClass.Geography.getLengthOfTwoPoint.GetDistance(target.Latitde, target.Longitude, Program.dt.GetFpByIndex(this._collectPosition[item]).Latitde, Program.dt.GetFpByIndex(this._collectPosition[item]).Longitude) select item).ToList();
            return(positions);
        }
Beispiel #3
0
        internal bool Contain(FastonPosition fp)
        {
            var    baseFp = Program.dt.GetFpByIndex(this.StartFPIndex);
            double fpX, fpY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fp.Longitude, fp.Latitde, out fpX, out fpY);

            double baseX, baseY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(baseFp.Longitude, baseFp.Latitde, out baseX, out baseY);

            return(Math.Sqrt((baseX - fpX) * (baseX - fpX) + (baseY - fpY) * (baseY - fpY)) <= this.Radius);
            //  throw new NotImplementedException();
        }
Beispiel #4
0
        internal void ViewPosition(RoleInGame role, FastonPosition fpResult, ref List <string> notifyMsg)
        {
            if (role.playerType == RoleInGame.PlayerType.player)
            {
                var        player = (Player)role;
                var        url    = player.FromUrl;
                ViewSearch sn     = new ViewSearch()
                {
                    c           = "ViewSearch",
                    WebSocketID = player.WebSocketID,
                    mctX        = fpResult.MacatuoX,
                    mctY        = fpResult.MacatuoY
                };

                var sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(sn);
                notifyMsg.Add(url);
                notifyMsg.Add(sendMsg);
            }
        }
Beispiel #5
0
        public System.Numerics.Complex getComplex(FastonPosition fastonPosition)
        {
            double x1, y1, x2, y2;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fastonPosition.Longitude, fastonPosition.Latitde, out x1, out y1);
            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fastonPosition.positionLongitudeOnRoad, fastonPosition.positionLatitudeOnRoad, out x2, out y2);
            // throw new NotImplementedException();
            var l = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));

            System.Numerics.Complex c;
            if (l > 1e-8)
            {
                c = new System.Numerics.Complex((x1 - x2) / l, (y1 - y2) / l);
            }
            else
            {
                throw new Exception("");
            }
            return(c);
        }