Exemple #1
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 21DEC2008  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * get all records based on given rectangle.
         * @param rectGeo the boundary..
         * @return a hashtable of all matched record.the key is the mapInfo ID.
         */
        public Hashtable SearchMapObjectsInRect(GeoLatLngBounds rectGeo)
        {
            Point pt1, pt2;

            pt1 = new Point(new[] {
                (int)(rectGeo.X * DOUBLE_PRECISION + 0.5),
                (int)(rectGeo.Y * DOUBLE_PRECISION + 0.5)
            });
            pt2 = new Point(new int[] {
                (int)((rectGeo.X + rectGeo.Width) * DOUBLE_PRECISION + 0.5),
                (int)((rectGeo.Y + rectGeo.Height) * DOUBLE_PRECISION + 0.5)
            });
            HyperCube h1 = new HyperCube(pt1, pt2);
            Hashtable retArrayList = new Hashtable();
            Point     p11, p12;

            for (IEnumeration e1 = _tree.Intersection(h1); e1.HasMoreElements();)
            {
                AbstractNode node = (AbstractNode)(e1.NextElement());
                if (node.IsLeaf())
                {
                    int         index = 0;
                    HyperCube[] data  = node.GetHyperCubes();
                    HyperCube   cube;
                    for (int cubeIndex = 0; cubeIndex < data.Length; cubeIndex++)
                    {
                        cube = data[cubeIndex];
                        if (cube.Intersection(h1))
                        {
                            p11 = cube.GetP1();
                            p12 = cube.GetP2();
                            int             mapinfoId = ((Leaf)node).GetDataPointer(index);
                            int             mapInfoId = mapinfoId;
                            GeoLatLngBounds mbr       = new GeoLatLngBounds();
                            mbr.X      = p11.GetFloatCoordinate(0) / DOUBLE_PRECISION;
                            mbr.Y      = p11.GetFloatCoordinate(1) / DOUBLE_PRECISION;
                            mbr.Width  = ((p12.GetFloatCoordinate(0) - p11.GetFloatCoordinate(0))) / DOUBLE_PRECISION;
                            mbr.Height = ((p12.GetFloatCoordinate(1) - p11.GetFloatCoordinate(1))) / DOUBLE_PRECISION;
                            if (!retArrayList.Contains(mapInfoId))
                            {
                                retArrayList.Add(mapInfoId, mbr);
                            }
                        }
                        index++;
                    }
                }
            }
            return(retArrayList);
        }
Exemple #2
0
 public bool HasNext()
 {
     return(_enum.HasMoreElements());
 }
Exemple #3
0
 public bool HasNext()
 {
     return(enumeration.HasMoreElements());
 }