Пример #1
0
        public const int MAX_POLYGON_INDICES = 32; //TODO probably would be better in config file or some constants file

        /// <summary>
        /// Constructor for creating a polygon with specified geo points.
        /// </summary>
        /// <param name="points">Array of geo points fof which the polygon consists.</param>
        public Polygon(GeoPoint[] points)
        {
            if (points.Length > MAX_POLYGON_INDICES)
            {
                throw new ArgumentException("Too many geopoints for polygon");
            }
            geoPoints_ = new RepeatedField <GeoPoint>();
            GeoPoints.AddRange(points);
        }
Пример #2
0
        /// <summary>
        /// 向数据库添加点数据
        /// </summary>
        public static bool ImportSFCLSData(DataTable dataTable, string className)
        {
            DataBase gdb = DataBase.OpenByURL("GDBP://MapGisLocal/Templates");
            //打开简单要素类
            SFeatureCls sfcls = gdb.GetXClass(XClsType.SFCls) as SFeatureCls;
            bool        op    = sfcls.Open(className, 0);

            GeoPoints pnts   = null;
            Dot3D     newdot = new Dot3D();
            //PntInfo pntInfo = new PntInfo();

            int i = 0;

            foreach (DataRow dr in dataTable.Rows)
            {
                double.TryParse(dr["x 坐标"].ToString(), out double x);
                double.TryParse(dr["y 坐标"].ToString(), out double y);
                //点要素坐标
                newdot.X = y;
                newdot.Y = x;
                newdot.Z = 0;
                pnts     = new GeoPoints();
                pnts.Append(newdot);

                Record rcd  = new Record();
                Fields Flds = sfcls.Fields;
                if (Flds == null)
                {
                    return(false);
                }

                PntInfo pntInfo = new PntInfo();
                //点参数
                pntInfo.LibID  = 0;
                pntInfo.SymID  = 1;
                pntInfo.Width  = 10;
                pntInfo.Height = 10;


                rcd.Fields = Flds;

                //设置属性字段的值
                rcd.set_FldVal(1, (i++).ToString());
                rcd.set_FldVal(2, dr["车牌"].ToString());
                string time = dr["时间"].ToString().Replace('T', ' ');
                rcd.set_FldVal(3, time);
                rcd.set_FldVal(4, time);
                rcd.set_FldVal(5, x);
                rcd.set_FldVal(6, y);

                //添加点要素
                long oid = sfcls.Append(pnts, rcd, pntInfo);
            }

            Debug.WriteLine("Done.");
            return(true);
        }
Пример #3
0
 public LocationAverager()
 {
     Positions = new GeoPoints();
 }
Пример #4
0
 /// <summary>
 /// Setter for setting geo points to a polygon.
 /// </summary>
 /// <param name="points">Array of geo points.</param>
 public void SetGeoPoints(GeoPoint[] points)
 {
     GeoPoints.Clear();
     GeoPoints.AddRange(points);
 }
Пример #5
0
 /// <summary>
 /// Getter for getting geo points of a polygon.
 /// </summary>
 /// <returns>Array of geo points.</returns>
 public GeoPoint[] GetGeoPoints()
 {
     return(GeoPoints.ToArray());
 }
Пример #6
0
 public void ClearPoints()
 {
     GeoPoints?.Clear();
     GeoPoints = null;
 }
Пример #7
0
 public IActionResult GetDistance(GeoPoints model)
 {
     // publish message
     _manager.Publish(model, "RabbitMQ", "fanout", "RabbitMQ");
     return(Ok("Distance inserted, you can check GetAllDistances"));
 }