public void GeoRectangle_Center()
        {
            var r = new GeoRectangle(-10.0, -20.0, 20.0, 40.0);

            Assert.AreEqual(5.0, r.Center.Latitude);
            Assert.AreEqual(10.0, r.Center.Longitude);
        }
Ejemplo n.º 2
0
        /// <example>

        /*
         * <osm-script>
         * <union into="_">
         *  <bbox-query e="36.2344722451331" n="49.99447425225" s="49.9899697477477" w="36.2274857548669"/>
         *  <recurse into="x" type="node-relation"/>
         *  <query type="way">
         *    <bbox-query e="36.2344722451331" n="49.99447425225" s="49.9899697477477" w="36.2274857548669"/>
         *  </query>
         *  <recurse into="x" type="way-node"/>
         *  <recurse type="way-relation"/>
         * </union>
         * <print/>
         * </osm-script>
         */
        /// </example>
        private static XDocument PrepareQueryForObjectsInBoundingBox(GeoRectangle boundingBox)
        {
            return(new XDocument(
                       new XElement("osm-script",
                                    new XElement("union",
                                                 new XAttribute("into", "_"),
                                                 new XElement("bbox-query",
                                                              new XAttribute("w", boundingBox.SouthWestVertex.Longitude),
                                                              new XAttribute("s", boundingBox.SouthWestVertex.Latitude),
                                                              new XAttribute("e", boundingBox.NorthEastVertex.Longitude),
                                                              new XAttribute("n", boundingBox.NorthEastVertex.Latitude)),
                                                 new XElement("recurse",
                                                              new XAttribute("into", "x"),
                                                              new XAttribute("type", "node-relation")),
                                                 new XElement("query",
                                                              new XAttribute("type", "way"),
                                                              new XElement("bbox-query",
                                                                           new XAttribute("w",
                                                                                          boundingBox.SouthWestVertex.Longitude),
                                                                           new XAttribute("s",
                                                                                          boundingBox.SouthWestVertex.Latitude),
                                                                           new XAttribute("e",
                                                                                          boundingBox.NorthEastVertex.Longitude),
                                                                           new XAttribute("n",
                                                                                          boundingBox.NorthEastVertex.Latitude))),
                                                 new XElement("recurse",
                                                              new XAttribute("into", "x"),
                                                              new XAttribute("type", "way-node")),
                                                 new XElement("recurse",
                                                              new XAttribute("type", "way-relation"))),
                                    new XElement("print"))));
        }
        public void GeoRectangle_NorthWest()
        {
            var r = new GeoRectangle(10.0, 20.0, 20.0, 40.0);

            Assert.AreEqual(10.0, r.NorthWest.Latitude);
            Assert.AreEqual(20.0, r.NorthWest.Longitude);
        }
        public void GeoRectangle_SouthEast()
        {
            var r = new GeoRectangle(10.0, 20.0, 20.0, 40.0);

            Assert.AreEqual(20.0, r.SouthEast.Latitude);
            Assert.AreEqual(40.0, r.SouthEast.Longitude);
        }
Ejemplo n.º 5
0
        public void GeoRectangle_Serialize()
        {
            var r1 = new GeoRectangle(new GeoCoordinate(30, 20), new GeoCoordinate(-30, 5));
            var r2 = (GeoRectangle)GeoRegion.Parse(r1.ToString());

            Assert.AreEqual(r1, r2);
        }
        public void GeoRectangle_Points()
        {
            var r = new GeoRectangle(10.0, 20.0, 20.0, 40.0);

            Assert.AreEqual(10.0, r.Points.First().Latitude);
            Assert.AreEqual(20.0, r.Points.First().Longitude);
            Assert.AreEqual(20.0, r.Points.Last().Latitude);
            Assert.AreEqual(40.0, r.Points.Last().Longitude);
        }
Ejemplo n.º 7
0
        public void PolygonBorderTest()
        {
            var polygonPoints = GetPentagonPoints();

            var actualBorder = GeoUtilities.PolygonBorder(polygonPoints);

            var expectedBorder = new GeoRectangle(1, 8, 1, 6);

            Assert.Equal(expectedBorder, actualBorder);
        }
Ejemplo n.º 8
0
        public void GeoRectangle_Basic()
        {
            GeoRectangle r1;

            r1 = new GeoRectangle(new GeoCoordinate(45, 60), new GeoCoordinate(1, 2));
            Assert.AreEqual(new GeoCoordinate(45, 60), r1.Northeast);
            Assert.AreEqual(new GeoCoordinate(1, 2), r1.Southwest);

            r1 = new GeoRectangle(45, 60, 1, 2);
            Assert.AreEqual(new GeoCoordinate(45, 60), r1.Northeast);
            Assert.AreEqual(new GeoCoordinate(1, 2), r1.Southwest);
        }
Ejemplo n.º 9
0
        public void GeoRectangle_Bounds()
        {
            var r1 = new GeoRectangle(new GeoCoordinate(30, 20), new GeoCoordinate(-30, 5));

            Assert.AreEqual(r1, r1.Bounds);

            // Verify that bounds are restored after serialization

            var r2 = new GeoRectangle(r1.ToString());

            Assert.AreEqual(r1, r2.Bounds);
        }
Ejemplo n.º 10
0
        public void GetObjectsOfImportance()
        {
            var boundingBox = new GeoRectangle
            {
                NorthEastVertex = new GeoPoint(),
                SouthWestVertex = new GeoPoint()
            };
            var xmlData = new OverpassApiClient(new TestHttpClient()).GetDataInBoundingBox(null, boundingBox);
            var objects = OsmApiDataProcessor.GetObjectsOfImportance(xmlData);

            AssertSingleNodes(objects.SingleNodes);
            AssertBuildingsWays(objects.BuildingsWays);
        }
        // ==================================================
        // Constructors
        public GeoRegionData(int country, int id, int division, string iso, string abbr, string name, string nameLocal, double latCenter, double lonCenter, double latNorthWest, double lonNorthWest, double latSouthEast, double lonSouthEast)
        {
            CountryID = country;
            RegionID  = id;

            RegionDiv  = division;
            RegionName = name;

            RegionISO       = iso.ToUpperInvariant();
            RegionAbbr      = (String.IsNullOrWhiteSpace(abbr) ? "" : abbr);;
            RegionNameLocal = (String.IsNullOrWhiteSpace(nameLocal) ? "" : nameLocal);

            Center = new GeoPosition(latCenter, lonCenter);
            Bounds = new GeoRectangle(latNorthWest, lonNorthWest, latSouthEast, lonSouthEast);
        }
Ejemplo n.º 12
0
        public XDocument GetDataInBoundingBox(string apiUrl, GeoRectangle boundingBox)
        {
            var xmlQuery = PrepareQueryForObjectsInBoundingBox(boundingBox);

            try
            {
                var apiResponse = HttpClient.Post(apiUrl, xmlQuery.ToString(),
                                                  "Content-Type: application/xml; charset=utf-8");
                return(XDocument.Parse(apiResponse));
            }
            catch
            {
                throw new OsmApiException();
            }
        }
Ejemplo n.º 13
0
 public static int GetTotalTripsThroughGeoRectangle(GeoRectangle geoRectangle)
 {
     using (var dbConnection = new MySqlConnection(ConnectionString))
     {
         dbConnection.Open();
         return
             (dbConnection.Query <int>("sp_get_total_trips_through_georect",
                                       new
         {
             MinLatitude = geoRectangle.BottomLeft.Latitude,
             MinLongitude = geoRectangle.BottomLeft.Longitude,
             MaxLatitude = geoRectangle.TopRight.Latitude,
             MaxLongitude = geoRectangle.TopRight.Longitude
         }, commandType: CommandType.StoredProcedure)
              .FirstOrDefault());
     }
 }
Ejemplo n.º 14
0
        private void InitializeLayout()
        {
            try
            {
                LayoutElements elements = mapLayoutControl1.MapLayout.Elements;
                // 构造GeoMap
                // Create the GeoMap object.
                GeoMap geoMap = new GeoMap();

                geoMap.MapName = "地籍图";


                // 设置GeoMap对象的外切矩形
                // Set the exterior rectangle.
                Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(
                                                       1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMap.Shape = geoRect;
                elements.AddNew(geoMap);
                m_mapID = elements.GetID();

                // 构造指北针
                // Initialize the GeoNorthArrow
                GeoNorthArrow northArrow = new GeoNorthArrow(
                    NorthArrowStyleType.EightDirection,
                    new Rectangle2D(new Point2D(1400, 2250), new Size2D(350, 350)),
                    0);

                northArrow.BindingGeoMapID = m_mapID;

                elements.AddNew(northArrow);

                // 构造比例尺
                // Initialize the scale
                GeoMapScale scale = new GeoMapScale(m_mapID, new Point2D(125, 400), 50, 50);
                scale.LeftDivisionCount = 2;
                scale.ScaleUnit         = Unit.Kilometer;
                scale.SegmentCount      = 4;

                elements.AddNew(scale);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 15
0
 public static dynamic GetTotalTripsAndFaresThatStartOrStopInGeoRectangle(GeoRectangle geoRectangle)
 {
     using (var dbConnection = new MySqlConnection(ConnectionString))
     {
         dbConnection.Open();
         return
             (dbConnection.Query <dynamic>("sp_get_total_trips_and_fares_that_start_or_stop_in_georect",
                                           new
         {
             MinLatitude = geoRectangle.BottomLeft.Latitude,
             MinLongitude = geoRectangle.BottomLeft.Longitude,
             MaxLatitude = geoRectangle.TopRight.Latitude,
             MaxLongitude = geoRectangle.TopRight.Longitude
         }, commandType: CommandType.StoredProcedure)
              .FirstOrDefault());
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="node">The parent GeoTracker node.</param>
        public MercatorIndex(GeoTrackerNode node)
        {
            // Initialize the top-level blocks.

            this.topLevelBlocks = new MercatorBlock[TopLevelColumnCount, TopLevelRowCount];

            for (int row = 0; row < TopLevelRowCount; row++)
            {
                for (int col = 0; col < TopLevelColumnCount; col++)
                {
                    var neCorner = new GeoCoordinate(90.0 - row * 10, -180.0 + (col + 1) * 10.0);
                    var swCorner = new GeoCoordinate(90.0 - (row + 1) * 10.0, -180.0 + col * 10.0);
                    var bounds   = new GeoRectangle(neCorner, swCorner);

                    topLevelBlocks[row, col] = new MercatorBlock(node.Settings, bounds, 0);
                }
            }
        }
Ejemplo n.º 17
0
        public void GeoRectangle_Compare()
        {
            GeoRectangle r1, r2;

            r1 = new GeoRectangle(new GeoCoordinate(45, 60), new GeoCoordinate(1, 2));

            r2 = r1;
            Assert.IsTrue(r1.Equals(r2));
            Assert.IsFalse(r1.Equals(null));
            Assert.IsFalse(r1.Equals(10));
            Assert.IsTrue(r1 == r2);
            Assert.IsFalse(r1 != r2);

            r2 = new GeoRectangle(new GeoCoordinate(44, 61), new GeoCoordinate(0, 1));
            Assert.IsFalse(r1.Equals(r2));
            Assert.IsFalse(r1 == r2);
            Assert.IsTrue(r1 != r2);
        }
Ejemplo n.º 18
0
        public gk065()
        {
            InitializeComponent();


            workspace1 = new SuperMap.Data.Workspace();

            /* WorkspaceConnectionInfo workspaceConnectionInfo = new WorkspaceConnectionInfo();
             * workspaceConnectionInfo.Type = WorkspaceType.Oracle;
             * workspaceConnectionInfo.Server = "ORCL";
             * workspaceConnectionInfo.Database = "";
             * workspaceConnectionInfo.Name = "workspace";
             * workspaceConnectionInfo.User = "******";
             * workspaceConnectionInfo.Password = "******";
             * workspace1.Open(workspaceConnectionInfo);*/
            workspace1.Open(gkfqd.Common.Tool.GetConnectionInfo());
            mapLayoutControl1.MapLayout.Workspace = workspace1;

            mapLayoutControl1.IsHorizontalScrollbarVisible = true;
            mapLayoutControl1.IsVerticalScrollbarVisible   = true;

            try
            {
                LayoutElements elements = mapLayoutControl1.MapLayout.Elements;
                //构造GeoMap
                GeoMap geoMap = new GeoMap();
                geoMap.MapName = "temp";

                //设置GeoMap对象的外切矩形
                Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(
                                                       1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMap.Shape = geoRect;
                elements.AddNew(geoMap);
                m_mapID = elements.GetID();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            mapLayoutControl1.TrackMode = TrackMode.Edit;
            mapLayoutControl1.MapLayout.Zoom(4);
        }
Ejemplo n.º 19
0
        private List <EntityState> entities;                // The entities within the block (or null)

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="settings">The GeoTracker server settings.</param>
        /// <param name="bounds">The boundry for the area indexed by this instance.</param>
        /// <param name="depth">The depth of of this instance in the hierarchy (0 for the top level).</param>
        /// <remarks>
        /// <note>
        /// This constructor initially creates a leaf index block.  Subsequent calls to <see cref="Balance" />
        /// may split this block into sub-blocks or join sub-blocks back into a leaf node.
        /// </note>
        /// </remarks>
        public MercatorBlock(GeoTrackerServerSettings settings, GeoRectangle bounds, int depth)
        {
            this.Bounds    = bounds;
            this.Depth     = depth;
            this.subBlocks = null;
            this.entities  = new List <EntityState>();

            if (depth == 0)
            {
                edgeLength = 10.0;
            }
            else
            {
                edgeLength = 10.0 / (Math.Pow(BlockDimension, depth));
            }

            if (depth <= settings.IndexMaxGroupTableLevel)
            {
                groupMap = new Dictionary <string, bool>();
            }
        }
        // ==================================================
        // Constructors
        public GeoCountryData(GeoContinents continent, int id, int division, string iso2, string iso3, string oc, string name, string nameLong, string local, string localLong, string abbr10, string abbr15, string abbr30, double latCenter, double lonCenter, double latNorthWest, double lonNorthWest, double latSouthEast, double lonSouthEast)
        {
            Continent = continent;
            CountryID = id;
            Division  = division;

            ISO2 = iso2.ToUpperInvariant();
            ISO3 = iso3.ToUpperInvariant();
            OC   = oc.ToUpperInvariant();

            Name          = name;
            NameLong      = nameLong;
            NameLocal     = local;
            NameLocalLong = localLong;

            Abbr10 = abbr10;
            Abbr15 = abbr15;
            Abbr30 = abbr30;

            Center = new GeoPosition(latCenter, lonCenter);
            Bounds = new GeoRectangle(latNorthWest, lonNorthWest, latSouthEast, lonSouthEast);
        }
Ejemplo n.º 21
0
        public void InitializeLayout(string mapName)
        {
            try
            {
                LayoutElements elements = m_mapLayoutControl.MapLayout.Elements;
                // 构造GeoMap
                GeoMap geoMap = new GeoMap();

                //设置地图名称,在工作空间内的地图
                geoMap.MapName = mapName;

                // 设置GeoMap对象的外切矩形
                Rectangle2D  rect    = new Rectangle2D(new Point2D(1000, 1300), new Size2D(1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMap.Shape = geoRect;

                elements.AddNew(geoMap);
                m_mapID = elements.GetID();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 22
0
        public void GeoRectangle_ContainsPoint()
        {
            var r = new GeoRectangle(new GeoCoordinate(45, 60), new GeoCoordinate(0, 0));

            // Test points on the boundaries.

            Assert.IsTrue(r.Contains(new GeoCoordinate(45, 30)));
            Assert.IsTrue(r.Contains(new GeoCoordinate(22.5, 60)));
            Assert.IsTrue(r.Contains(new GeoCoordinate(0, 30)));
            Assert.IsTrue(r.Contains(new GeoCoordinate(22.5, 0)));

            // Test a point within

            Assert.IsTrue(r.Contains(new GeoCoordinate(22.5, 30)));

            // Test points outside

            Assert.IsFalse(r.Contains(new GeoCoordinate(22.5, 61)));
            Assert.IsFalse(r.Contains(new GeoCoordinate(-1, 61)));
            Assert.IsFalse(r.Contains(new GeoCoordinate(-1, 30)));
            Assert.IsFalse(r.Contains(new GeoCoordinate(0, -1)));
            Assert.IsFalse(r.Contains(new GeoCoordinate(22.5, -1)));
            Assert.IsFalse(r.Contains(new GeoCoordinate(46, -1)));
        }
Ejemplo n.º 23
0
        private void AddMap(string mapName)
        {
            try
            {
                LayoutElements elements = mapLayoutControl1.MapLayout.Elements;
                //构造GeoMap
                GeoMap geoMapUse = new GeoMap();
                geoMapUse.MapName = mapName;


                // geoMapUse. = m_mapControl.Map;
                //设置GeoMap对象的外切矩形
                Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(
                                                       1500, 1500));
                GeoRectangle geoRect = new GeoRectangle(rect, 0);
                geoMapUse.Shape = geoRect;
                elements.AddNew(geoMapUse);
                m_mapID = elements.GetID();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 24
0
        private void 边框ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GeoMap geoMapUseLine = new GeoMap();

            geoMapUseLine.MapName = "2000年各省人口数分段专题图";

            //设置GeoMap对象的外切矩形

            Rectangle2D rectangle2D = new Rectangle2D(new Point2D(850, 1250), new Size2D(1500, 1500));

            GeoRectangle geoRectangle = new GeoRectangle(rectangle2D, 0);

            geoMapUseLine.Shape = geoRectangle;

            //设置GeoMap对象的MapBorder

            GeoMapBorder geoMapBorder = new GeoMapBorder();

            geoMapBorder.BorderType = GeoMapBorderType.Complex;

            //设置MapBorder的内框

            geoMapBorder.InFrameColor = Color.White;

            geoMapBorder.InFrameWidth = 0.5;

            geoMapBorder.InFrameInterval = 5;

            //设置MapBorder的内线

            geoMapBorder.InLineColor = Color.FromArgb(115, 115, 115);

            geoMapBorder.InLineWidth = 0.5;

            geoMapBorder.InLineInterval = 5;

            //设置MapBorder的外线

            geoMapBorder.OutLineColor = Color.White;

            geoMapBorder.OutLineWidth = 0.5;

            geoMapBorder.OutLineInterval = 30;

            //设置MapBorder的外框

            geoMapBorder.OutFrameColor = Color.FromArgb(115, 115, 115);

            geoMapBorder.OutFrameWidth = 1;

            geoMapBorder.OutFrameInterval = 2;



            //设置填充文本的风格

            TextStyle fillTextStyle = new TextStyle();

            fillTextStyle.Shadow = true;

            fillTextStyle.Alignment = TextAlignment.TopCenter;

            fillTextStyle.BackColor = Color.White;

            fillTextStyle.ForeColor = Color.FromArgb(135, 171, 217);

            fillTextStyle.BackOpaque = true;

            fillTextStyle.Bold = false;

            fillTextStyle.FontName = "宋体";

            fillTextStyle.FontHeight = 10.0;

            fillTextStyle.FontWidth = 10.0;

            fillTextStyle.IsSizeFixed = false;

            fillTextStyle.Weight = 100;
            //设置MapBorder的填充

            geoMapBorder.FillType = GeoMapBorderFillType.Text;

            geoMapBorder.FillDirection = FillDirectionType.Inner;

            geoMapBorder.FillText = " * ";

            geoMapBorder.FillTextStyle = fillTextStyle;

            //设置MapBorder的转角填充

            geoMapBorder.CornerFillType = GeoMapBorderFillType.Image;

            geoMapBorder.CornerFillImageFile = @"../../Resources/SceneBrowse/a18.bmp";

            geoMapBorder.CornerFillStartMode = CornerFillStartMode.LeftBottom;



            geoMapUseLine.MapBorder = geoMapBorder;

            geoMapUseLine.IsBorderVisible = true;

            mapLayoutControl1.MapLayout.Elements.AddNew(geoMapUseLine);
        }
Ejemplo n.º 25
0
 public static int GetTotalTripsThroughGeoRectangle(GeoRectangle geoRectangle)
 {
     geoRectangle.Validate();
     return(TripDal.GetTotalTripsThroughGeoRectangle(geoRectangle));
 }
Ejemplo n.º 26
0
        private void 添加标题ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            gk066 addTitle = new gk066();

            addTitle.StartPosition = FormStartPosition.CenterScreen;    //窗体居中
            addTitle.ShowDialog();

            #region 添加标文本题
            //标题添加
            TextStyle textStyle = new TextStyle();
            textStyle.Alignment   = TextAlignment.TopCenter;
            textStyle.BackColor   = Color.FromArgb(65, 65, 65);
            textStyle.ForeColor   = Color.FromArgb(174, 241, 176);
            textStyle.BackOpaque  = false;
            textStyle.Bold        = true;
            textStyle.FontName    = "楷体";
            textStyle.FontHeight  = addTitle.FontHeight;
            textStyle.FontWidth   = addTitle.FontWidth;
            textStyle.IsSizeFixed = false;
            textStyle.Italic      = true;
            textStyle.Outline     = true;
            textStyle.Weight      = 500;

            //添加文本
            TextPart textPart = new TextPart(addTitle.title, new Point2D(850, 2150), 0);
            geoText = new GeoText(textPart, textStyle);
            //先删除后添加实现刷新效果
            if (ElementsId != -1)
            {
                ElementsIdS[0] = ElementsId;
                mapLayoutControl1.MapLayout.Elements.Delete(ElementsIdS);
            }
            //添加地图
            mapLayoutControl1.MapLayout.Elements.AddNew(geoText);
            //取得id 下次设定时删除用
            ElementsId = mapLayoutControl1.MapLayout.Elements.GetID();
            mapLayoutControl1.MapLayout.Elements.Refresh();
            #endregion

            #region 设定图层颜色 与显示比例尺
            geoMapUse = mapLayoutControl1.MapLayout.Elements.GetGeometry() as GeoMap;
            Map map = new Map();
            map.Workspace = workspace1;
            map.FromXML(workspace1.Maps.GetMapXML(geoMapUse.MapName));
            LayerSettingVector setting = map.Layers[0].AdditionalSetting as LayerSettingVector;
            setting.Style.FillForeColor     = addTitle.selectColor;
            map.Layers[0].AdditionalSetting = setting;
            workspace1.Maps.SetMapXML(geoMapUse.MapName, map.ToXML());
            workspace1.Save();
            geoMapUse         = new GeoMap();
            geoMapUse.MapName = "temp";
            //设置GeoMap对象的外切矩形
            Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(
                                                   1500, 1500));
            GeoRectangle geoRect = new GeoRectangle(rect, 0);
            geoMapUse.Shape = geoRect;
            //动态设置缩放比例尺
            geoMapUse.MapScale = addTitle.scaleNumerator / addTitle.scaleDenominato;
            mapLayoutControl1.MapLayout.Elements.AddNew(geoMapUse);
            //记录下mapid
            ElementsIdMap = mapLayoutControl1.MapLayout.Elements.GetID();
            mapLayoutControl1.MapLayout.Elements.Refresh();
            #endregion

            #region 添加地图比例标尺
            //添加地图带比例标尺
            geoMapScale                   = new GeoMapScale(ElementsIdMap, new Point2D(1050, 515), 550, 18);
            geoMapScale.ScaleUnit         = Unit.Kilometer;
            geoMapScale.LeftDivisionCount = 2;
            geoMapScale.SegmentCount      = 2;
            geoMapScale.ScaleType         = GeoMapScaleType.Railway;
            ////先删除后添加实现刷新效果
            if (ElementsIdScale != -1)
            {
                ElementsIdScaleArrar[0] = ElementsIdScale;
                mapLayoutControl1.MapLayout.Elements.Delete(ElementsIdScaleArrar);
            }
            //取得id 下次设定时删除用
            mapLayoutControl1.MapLayout.Elements.AddNew(geoMapScale);
            ElementsIdScale = mapLayoutControl1.MapLayout.Elements.GetID();
            mapLayoutControl1.MapLayout.Elements.Refresh();
            #endregion

            addTitle.Close();
        }
Ejemplo n.º 27
0
        static CoordinateMap MakeCoordinateMap(GeoLineList geoLines)
        {
            GeoRectangle rectangle = geoLines.GetBoundingRectangle();

            return(new CoordinateMap(rectangle.NorthWest, EarthGeo.North, 1000));
        }
Ejemplo n.º 28
0
 public static dynamic GetTotalTripsAndFaresThatStartOrStopInGeoRectangle(GeoRectangle geoRectangle)
 {
     geoRectangle.Validate();
     return(TripDal.GetTotalTripsAndFaresThatStartOrStopInGeoRectangle(geoRectangle));
 }
Ejemplo n.º 29
0
 public bool Equals(GeoRectangle other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.MinLat.Equals(MinLat) && other.MaxLat.Equals(MaxLat) && other.MinLng.Equals(MinLng) && other.MaxLng.Equals(MaxLng);
 }
Ejemplo n.º 30
0
        public void GeoRectangle_IntersectsWith()
        {
            GeoRectangle r, rTest;

            // $todo(jeff.lill): Geo related operations need some work.

            Assert.Inconclusive("Geo related operations need some work.");

            //-----------------------------------------------------------------
            // Test cases where the rectangles don't intersect at all.

            r = new GeoRectangle(10, 10, -10, -10);

            // Verify that a rectangle the same size as the test rectangle
            // that appears in the 8 areas around the test and does not touch
            // are considered to be non-intersecting.

            rTest = new GeoRectangle(10, 10, -10, -10);
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(0, +30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+30, +30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+30, 0)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-30, +30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-30, 0)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-30, -30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(0, -30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+30, -30)));

            // Verify that a rectangle the same size as the test rectangle
            // that appears in the 8 areas around the test and does not touch
            // are considered to be non-intersecting.

            rTest = new GeoRectangle(5, 5, -5, -5);
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(0, +30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+30, +30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+30, 0)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-30, +30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-30, 0)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-30, -30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(0, -30)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+30, -30)));

            // Verify that a rectangle the same size as the test rectangle
            // that appears in the 8 areas around the test and does touch
            // are considered to be non-intersecting.

            rTest = new GeoRectangle(10, 10, -10, -10);
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(0, +20)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+20, +20)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+20, 0)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-20, +20)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-20, 0)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(-20, -20)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(0, -20)));
            Assert.IsFalse(r.IntersectsWith(rTest.Translate(+20, -20)));

            // Verify that rectangles that span the areas above, below,
            // and on either side of the test rectangle but do not touch
            // are considered to be non-intersecting.

            Assert.IsFalse(r.IntersectsWith(new GeoRectangle(20, 20, 15, -20)));       // Above
            Assert.IsFalse(r.IntersectsWith(new GeoRectangle(-15, 20, -20, -20)));     // Below
            Assert.IsFalse(r.IntersectsWith(new GeoRectangle(20, -15, -20, -20)));     // Left
            Assert.IsFalse(r.IntersectsWith(new GeoRectangle(20, 20, 15, -20)));       // Right

            //-----------------------------------------------------------------
            // Verify intersection

            // A rectangle the entirely surrounds the test rectangle.

            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(20, 20, -20, -20)));

            // A rectangle that is entirely within the test.

            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(5, 5, -5, -5)));

            // The identical rectangle.

            Assert.IsTrue(r.IntersectsWith(r));

            // Rectangles with two corners within the test rectangle.

            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(0, 0, -5, -20)));
            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(0, 0, -20, -5)));
            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(5, 20, 0, 0)));
            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(20, 5, 0, 0)));

            // Rectangles with one corner within the test rectangle.

            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(0, 0, -20, -20)));
            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(0, 0, -20, 20)));
            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(20, 20, 0, 0)));
            Assert.IsTrue(r.IntersectsWith(new GeoRectangle(20, -20, 0, 0)));
        }
Ejemplo n.º 31
0
        private void AddData()
        {
            try
            {
                WorkspaceTreeNodeBase     node = workspaceControl1.WorkspaceTree.SelectedNode as WorkspaceTreeNodeBase;
                WorkspaceTreeNodeDataType type = node.NodeType;
                if ((type & WorkspaceTreeNodeDataType.Dataset) != WorkspaceTreeNodeDataType.Unknown)
                {
                    type = WorkspaceTreeNodeDataType.Dataset;
                }
                switch (type)
                {
                case WorkspaceTreeNodeDataType.Dataset:
                {
                    Dataset dataset = node.GetData() as Dataset;
                    layersControl1.Map.Layers.Add(dataset, true);
                    layersControl1.Map.Refresh();
                    m_mapControlEagleEye.Map.Layers.Add(dataset, true);
                    m_mapControlEagleEye.Map.Refresh();
                }
                break;

                case WorkspaceTreeNodeDataType.MapName:
                {
                    mapName = node.GetData() as String;
                    mapControl1.Map.Open(mapName);
                    geoMap.MapName = mapName;
                    rect           = new Rectangle2D(new Point2D(850, 1300), new Size2D(1500, 1500));
                    geoRect        = new GeoRectangle(rect, 0);
                    geoMap.Shape   = geoRect;
                    elements.AddNew(geoMap);
                    m_mapControlEagleEye.Map.Open(mapName);
                    mapControl1.Map.Refresh();
                    m_mapControlEagleEye.Map.Refresh();
                    m_mapControlEagleEye.Map.ViewEntire();
                }
                break;

                case WorkspaceTreeNodeDataType.SymbolMarker:
                {
                    SymbolLibraryDialog.ShowDialog(workspace1.Resources, SymbolType.Marker);
                }
                break;

                case WorkspaceTreeNodeDataType.SymbolLine:
                {
                    SymbolLibraryDialog.ShowDialog(workspace1.Resources, SymbolType.Line);
                }
                break;

                case WorkspaceTreeNodeDataType.SymbolFill:
                {
                    SymbolLibraryDialog.ShowDialog(workspace1.Resources, SymbolType.Fill);
                }
                break;

                default:
                    break;
                }
            }
            catch
            { }
        }