示例#1
0
    public List <CircleInfo> BindRechargeCircle()
    {
        CircleInfo        ci = new CircleInfo();
        List <CircleInfo> CountryInformation = new List <CircleInfo>();

        SqlParameter[] parameters =
        {
        };
        DataTable dt = objFramework.GetRecordSet("adv_proc_BindCircle", CommandType.StoredProcedure, parameters);

        try
        {
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    CountryInformation.Add(new CircleInfo()
                    {
                        Circlecode = Convert.ToString(dr["CircleCode"]),
                        Circlename = dr["CircleName"].ToString()
                    });
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(CountryInformation);
    }
示例#2
0
    public void AddCircle(float radius, Color color)
    {
        var info = new CircleInfo(radius, color);

        CalculatePoints(info);
        circleList.Add(info);
    }
示例#3
0
        private void Update()
        {
            var circleInfo = new CircleInfo
            {
                center    = transform.position,
                forward   = transform.forward,
                radius    = Radius,
                fillColor = FillColor
            };


            if (Border)
            {
                circleInfo.bordered    = true;
                circleInfo.borderColor = BorderColor;
                circleInfo.borderWidth = BorderWidth;
            }

            if (Sector)
            {
                circleInfo.isSector = true;
                circleInfo.sectorInitialAngleInDegrees = InitialAngle;
                circleInfo.sectorArcLengthInDegrees    = ArcLength;
            }


            Circle.Draw(circleInfo);
        }
示例#4
0
        private void DrawCircle(CircleInfo c)
        {
            //var stPanel = new StackPanel();
            var ell = new System.Windows.Shapes.Ellipse();

            ell.StrokeThickness = 2;
            ell.Stroke          = Brushes.Black;
            ell.Height          = 100;
            ell.Width           = 100;
            //ell.Margin
            panel.Children.Add(ell);

            //this.Content = stPanel;
        }
        public void Radius_ShouldThrowException_WhenZeroOrNegativeNumber(int sign)
        {
            // Arrange
            var radius = _fixture.Create <double>() * sign;

            // Act
            var circle = new CircleInfo();

            Exception exception = Record.Exception(() => circle.Radius = radius);

            // Assert
            Assert.NotNull(exception);
            Assert.IsType <ArgumentOutOfRangeException>(exception);
        }
        public void Radius_ShouldAcceptValue_WhenPositiveNumber()
        {
            // Arrange
            var radius = _fixture.Create <double>();

            // Act
            var circle = new CircleInfo
            {
                Radius = radius
            };

            // Assert
            Assert.Equal(radius, circle.Radius);
        }
示例#7
0
        private void BindInfo(CircleInfo info)
        {
            info.Images = db.t_circle_image.Where(i => i.circle_id == info.CircleId).Select(i => new ImageInfo()
            {
                Url    = i.image_url,
                Height = i.height,
                Width  = i.width
            }).ToList();

            var    user         = db.t_user.Where(u => u.id == info.PublishUserId).FirstOrDefault();
            string friendRemark = db.t_user_friend.Where(f => f.user_id == this.request.UserId && f.friend_user_id == info.PublishUserId).Select(f => f.friend_user_remark).FirstOrDefault();

            info.PublishUserName  = UserUtility.GetShowName(friendRemark, user.name);
            info.PublishUserImage = user.head_image;
            info.IsLiked          = db.t_circle_like.Where(l => l.circle_id == info.CircleId && l.like_user_id == this.request.UserId && l.is_delete == false).Select(l => l.id).FirstOrDefault() > 0 ? true : false;
        }
示例#8
0
    private void CalculatePoints(CircleInfo info)
    {
        float          radius = info.radius;
        List <Vector3> points = info.pointList;

        int   pointCount = 10 + (int)(radius * 3);
        float angle      = 360f / pointCount;

        Quaternion r = transform.rotation;

        for (int i = 0; i < pointCount; i++)
        {
            Quaternion q = Quaternion.Euler(r.eulerAngles.x, r.eulerAngles.y - (angle * i), r.eulerAngles.z);
            Vector3    v = transform.position + (q * Vector3.forward) * radius;
            v.Set(v.x, 0.1f, v.z);
            points.Add(v);
        }
    }
示例#9
0
 // Use this for initialization
 void Start()
 {
     _circleController = CircleController.Instance;
     _poolCircle       = ObjectPoolSystem.Instance.GetQueuePool(0);
     for (int i = 0; i < _poolCircle.Count; i++)
     {
         var circle = _poolCircle.Dequeue();
         _poolCircle.Enqueue(circle);
         var position = new Vector2(Random.Range(-1f, 1f), transform.position.y);
         circle.transform.position   = position;
         circle.transform.localScale = Vector3.one * Random.RandomRange(0.2f, 0.8f);
         circle.SetActive(true);
         circle.GetComponent <Rigidbody2D>().gravityScale = 0;
         var circleInfo = new CircleInfo(circle.transform, Time.time, Random.Range(1, 3) * 2 - 3, circle.transform.localScale.x * 10f, 2f);
         circleInfo.Active = false;
         _circles.Add(circleInfo);
     }
 }
示例#10
0
        /// <summary>
        /// 根据字符串获取图形类信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static GraphicInfo getDrawInfo(string info, MapGIS mapgis)
        {
            if (mapgis == null)
            {
                return(null);
            }
            info = info.Replace(" ", "").Replace("\n", "");
            string[] gInfoArr = null;
            string[] gInfo    = info.Split(':');
            if (gInfo.Length == 2)
            {
                switch (gInfo[0])
                {
                case "polyline":
                    PolylineInfo lineInfo = new PolylineInfo();
                    gInfoArr = gInfo[1].Split('|');
                    if (gInfoArr.Length == 2)
                    {
                        //样式
                        string[] gStyle = gInfoArr[0].Split(',');
                        if (gStyle.Length == 2)
                        {
                            lineInfo.BorderColor = gStyle[0];
                            double.TryParse(gStyle[1], out lineInfo.BorderWidth);
                        }
                        //点
                        string[] gPoints = gInfoArr[1].Split('&');
                        if (gPoints.Length > 0)
                        {
                            lineInfo.Points = new List <I_GS_MapBase.Portal.Types.MapPointEx>();
                            for (int i = 0; i < gPoints.Length; i++)
                            {
                                string[] p = gPoints[i].Split(',');
                                lineInfo.Points.Add(mapgis.MainMap.MapPointFactory.Create(p[0].TryToDoubleZero(), p[1].TryToDoubleZero()));
                            }
                        }
                    }
                    return(lineInfo);

                case "polygon":
                    PolygonInfo gonInfo = new PolygonInfo();
                    gInfoArr = gInfo[1].Split('|');
                    if (gInfoArr.Length == 2)
                    {
                        //样式
                        string[] gStyle = gInfoArr[0].Split(',');
                        if (gStyle.Length == 3)
                        {
                            gonInfo.BorderColor = gStyle[0];
                            double.TryParse(gStyle[1], out gonInfo.BorderWidth);
                            gonInfo.FillColor = gStyle[2];
                        }
                        //点
                        string[] gPoints = gInfoArr[1].Split('&');
                        if (gPoints.Length > 0)
                        {
                            gonInfo.Points = new List <I_GS_MapBase.Portal.Types.MapPointEx>();
                            for (int i = 0; i < gPoints.Length; i++)
                            {
                                string[] p = gPoints[i].Split(',');
                                gonInfo.Points.Add(mapgis.MainMap.MapPointFactory.Create(p[0].TryToDoubleZero(), p[1].TryToDoubleZero()));
                            }
                        }
                    }
                    return(gonInfo);

                case "circle":
                    CircleInfo circleInfo = new CircleInfo();
                    gInfoArr = gInfo[1].Split('|');
                    if (gInfoArr.Length == 2)
                    {
                        //样式
                        string[] gStyle = gInfoArr[0].Split(',');
                        if (gStyle.Length == 3)
                        {
                            circleInfo.BorderColor = gStyle[0];
                            double.TryParse(gStyle[1], out circleInfo.BorderWidth);
                            circleInfo.FillColor = gStyle[2];
                        }
                        //中心点 半径
                        string[] gPoints = gInfoArr[1].Split('&');
                        if (gPoints.Length == 2)
                        {
                            string[] p = gPoints[0].Split(',');
                            circleInfo.CenterPoint = mapgis.MainMap.MapPointFactory.Create(p[0].TryToDoubleZero(), p[1].TryToDoubleZero());
                            circleInfo.Radius      = gPoints[1].TryToDoubleZero();
                        }
                    }
                    return(circleInfo);

                case "rectangle":
                    RectangleInfo rectangleInfo = new RectangleInfo();
                    gInfoArr = gInfo[1].Split('|');
                    if (gInfoArr.Length == 2)
                    {
                        //样式
                        string[] gStyle = gInfoArr[0].Split(',');
                        if (gStyle.Length == 3)
                        {
                            rectangleInfo.BorderColor = gStyle[0];
                            double.TryParse(gStyle[1], out rectangleInfo.BorderWidth);
                            rectangleInfo.FillColor = gStyle[2];
                        }

                        string[] gPoints = gInfoArr[1].Split('&');
                        if (gPoints.Length == 3)
                        {
                            string[] p = gPoints[0].Split(',');
                            rectangleInfo.LeftTopPoint = mapgis.MainMap.MapPointFactory.Create(p[0].TryToDoubleZero(), p[1].TryToDoubleZero());
                            rectangleInfo.RectWidth    = gPoints[1].TryToDoubleZero();
                            rectangleInfo.RectHeight   = gPoints[2].TryToDoubleZero();
                        }
                        if (gPoints.Length == 2)
                        {
                            string[] p = gPoints[0].Split(',');
                            rectangleInfo.LeftTopPoint = mapgis.MainMap.MapPointFactory.Create(p[0].TryToDoubleZero(), p[1].TryToDoubleZero());
                            string[] p2 = gPoints[1].Split(',');
                            rectangleInfo.RightBottomPoint = mapgis.MainMap.MapPointFactory.Create(p2[0].TryToDoubleZero(), p2[1].TryToDoubleZero());
                        }
                    }
                    return(rectangleInfo);
                }
            }
            return(null);
        }
示例#11
0
 public void Init(CircleInfo info)
 {
     transform.position   = new Vector3(info.x, 0, info.y);
     transform.localScale = new Vector3(info.radius * 2.0f, 1f, info.radius * 2.0f);
 }
示例#12
0
 public Stream(CircleInfo source)
 {
     _activities = new ObservableCollection<Activity>();
     _circle = source;
 }
示例#13
0
文件: Stream.cs 项目: jak180/Metrooz
 public Stream(CircleInfo source, StreamManager manager)
 {
     _activities = new ObservableCollection<Activity>();
     _syncer = new System.Threading.SemaphoreSlim(1, 1);
     Circle = source;
 }
    void CreateObstacle(ObjectTypes type)
    {
        Vector3      position;
        Vector3      scale;
        Quaternion   rotation;
        ObstacleData obsData;

        for (int i = 0; i < _enteringReferencePoint + 1; ++i)
        {
            _referencePoints[i].y = 0f;
        }
        switch (type)
        {
        case ObjectTypes.Cube:
            Vector3 frontLeftCorner = _referencePoints[0]; Vector3 frontRightCorner = _referencePoints[1]; Vector3 backRightCorner = _referencePoints[2];
            position = backRightCorner - frontLeftCorner;
            position = frontLeftCorner + position.normalized * (position.magnitude * 0.5f);

            rotation = Quaternion.LookRotation(backRightCorner - frontRightCorner, Vector3.up);

            scale = new Vector3(
                (frontRightCorner - frontLeftCorner).magnitude,
                Mathf.Max((frontRightCorner - frontLeftCorner).magnitude, (backRightCorner - frontRightCorner).magnitude),
                (backRightCorner - frontRightCorner).magnitude);

            position.y += scale.y / 2f;

            obsData = CreateObstacleDataAndInstantiate(position, rotation, scale, _creatingType);

            ObstacleDataContainer.CurrentObstacleData.Add(obsData);

            break;

        case ObjectTypes.Cylinder:
            List <Vector2> referencePoints = new List <Vector2>();

            for (int i = 0; i < _enteringReferencePoint + 1; ++i)
            {
                Vector2 vec = new Vector2(_referencePoints[i].x, _referencePoints[i].z);
                referencePoints.Add(vec);
            }

            CircleInfo circleInfo = ComputeCircle(referencePoints);

            position = new Vector3(circleInfo.position.x, 0f, circleInfo.position.y);

            rotation = Quaternion.identity;

            scale = new Vector3(circleInfo.radius * 2f,
                                circleInfo.radius * 2f,
                                circleInfo.radius * 2f);

            position.y += scale.y;

            obsData = CreateObstacleDataAndInstantiate(position, rotation, scale, _creatingType);

            ObstacleDataContainer.CurrentObstacleData.Add(obsData);

            break;

        default:
            Debug.LogWarning("Something is wrong with object types, object type case not found when creating object.");
            break;
        }

        SaveData();
    }
示例#15
0
        /// <summary>
        /// 解析字符串并绘制
        /// </summary>
        /// <param name="GraphicId">id</param>
        /// <param name="GraphicInfo">图形信息 格式:polyline:blue,2|127,1,42.2&126.8&41.9</param>
        /// <param name="mapControl">需要绘制的地图对象,为空则往ShowMap上绘制</param>
        private void DrawPlaceLocation(string GraphicId, string GraphicInfo, MapGIS mapgis = null)
        {
            if (string.IsNullOrEmpty(GraphicId) || string.IsNullOrEmpty(GraphicInfo))
            {
                return;
            }
            //各形状用*分隔
            //polyline:blue,2|127,1,42.2&126.8,41.9
            //polygon:blue,2,red|127,1,42.2&126.8,41.9
            //circle:blue,2,red|127,1,42.2&2000
            //rectangle:blue,2,red|127,1,42.2&127,1,42.2
            //rectangle:blue,2,red|127,1,42.2&2000&1000
            if (mapgis == null)
            {
                mapgis = ShowMap;
            }

            string[] info = GraphicInfo.Split('*');
            for (int i = 0; i < info.Length; i++)
            {
                NameId++;
                GraphicInfo ginfo = getDrawInfo(info[i], mapgis);
                if (ginfo is PolylineInfo)
                {
                    PolylineInfo g = ginfo as PolylineInfo;
                    if (g == null)
                    {
                        continue;
                    }
                    mapgis.DrawPolyline(g.Points, GraphicId + "-" + NameId.ToString(), new List <KeyValuePair <string, object> > {
                        new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                        new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                    }, null);
                }
                if (ginfo is PolygonInfo)
                {
                    PolygonInfo g = ginfo as PolygonInfo;
                    if (g == null)
                    {
                        continue;
                    }
                    mapgis.DrawPolygon(g.Points, GraphicId + "-" + NameId.ToString(), new List <KeyValuePair <string, object> > {
                        new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                        new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                        new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                    }, null);
                }
                if (ginfo is CircleInfo)
                {
                    CircleInfo g = ginfo as CircleInfo;
                    if (g == null)
                    {
                        continue;
                    }
                    mapgis.DrawCircle(g.CenterPoint, g.Radius, GraphicId + "-" + NameId.ToString(), new List <KeyValuePair <string, object> > {
                        new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                        new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                        new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                    }, null);
                }
                if (ginfo is RectangleInfo)
                {
                    RectangleInfo g = ginfo as RectangleInfo;
                    if (g == null)
                    {
                        continue;
                    }
                    if (g.RightBottomPoint != null)
                    {
                        mapgis.DrawRectangle(g.LeftTopPoint, g.RightBottomPoint, GraphicId + "-" + NameId.ToString(), new List <KeyValuePair <string, object> > {
                            new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                            new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                            new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                        }, null);
                    }
                    else
                    {
                        mapgis.DrawRectangle(g.LeftTopPoint, g.RectWidth, g.RectHeight, GraphicId + "-" + NameId.ToString(), new List <KeyValuePair <string, object> > {
                            new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                            new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                            new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                        }, null);
                    }
                }
            }
        }
示例#16
0
        /// <summary>
        /// 绘制地图
        /// </summary>
        /// <param name="place">地点信息</param>
        /// <param name="mapgis">地图</param>
        private void DrawMap(ActivityPlaceInfo place, MapGIS mapgis = null)
        {
            GraphicInfo ginfo = getDrawInfo(place.Graphics, mapgis);

            if (ginfo is PolylineInfo)
            {
                PolylineInfo g = ginfo as PolylineInfo;
                if (g == null)
                {
                    return;
                }
                mapgis.DrawPolyline(g.Points, place.Guid + "-0", new List <KeyValuePair <string, object> > {
                    new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                    new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                }, null);
            }
            if (ginfo is PolygonInfo)
            {
                PolygonInfo g = ginfo as PolygonInfo;
                if (g == null)
                {
                    return;
                }
                mapgis.DrawPolygon(g.Points, place.Guid + "-0", new List <KeyValuePair <string, object> > {
                    new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                    new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                    new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                }, null);
            }
            if (ginfo is CircleInfo)
            {
                CircleInfo g = ginfo as CircleInfo;
                if (g == null)
                {
                    return;
                }
                mapgis.DrawCircle(g.CenterPoint, g.Radius, place.Guid + "-0" + "", new List <KeyValuePair <string, object> > {
                    new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                    new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                    new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                }, null);
            }
            if (ginfo is RectangleInfo)
            {
                RectangleInfo g = ginfo as RectangleInfo;
                if (g == null)
                {
                    return;
                }
                if (g.RightBottomPoint != null)
                {
                    mapgis.DrawRectangle(g.LeftTopPoint, g.RightBottomPoint, place.Guid + "-0", new List <KeyValuePair <string, object> > {
                        new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                        new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                        new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                    }, null);
                }
                else
                {
                    mapgis.DrawRectangle(g.LeftTopPoint, g.RectWidth, g.RectHeight, place.Guid + "-0", new List <KeyValuePair <string, object> > {
                        new KeyValuePair <string, object>(GraphicStyle.BorderColor.ToString(), g.BorderColor),
                        new KeyValuePair <string, object>(GraphicStyle.BorderWidth.ToString(), g.BorderWidth),
                        new KeyValuePair <string, object>(GraphicStyle.FillColor.ToString(), g.FillColor),
                    }, null);
                }
            }
        }
        //-------------------------------------------------------------------------------
        #region -readCircleInfo ROMnファイル読み込み
        //-------------------------------------------------------------------------------
        //
        private async static Task<List<CircleInfo>> readCircleInfo(StorageFile circleFile, int dayIndex) {
            var cList = new List<CircleInfo>();
            try {
                using (Stream st = (await circleFile.OpenReadAsync()).AsStream())
                using (TextReader reader = new StreamReader(st, Encoding.GetEncoding("shift_jis"))) {
                    string line = reader.ReadLine();
                    string curr = "";
                    while (line != null) {
                        string[] data = line.Split('\t');

                        CircleInfo cinfo = new CircleInfo() {
                            DayIndex = dayIndex,
                            MapPoint = new Point() { X = int.Parse(data[0]), Y = int.Parse(data[1]) },
                            PageNO = int.Parse(data[2]),
                            CutIndex = int.Parse(data[3]),
                            Area = data[5],
                            Block = data[6][0],
                            SpaceNo = int.Parse(data[7]),
                            GenreCode = int.Parse(data[8]),
                            CircleName = data[9],
                            CircleKana = data[10],
                            AuthorName = data[11],
                            BookName = data[12],
                            Url = data[13],
                            MailAdress = data[14],
                            OtherDescription = data[15]
                        };

                        cList.Add(cinfo);

                        line = reader.ReadLine();
                    }
                }
            }
            catch (Exception e) { }

            return cList;
        }