Пример #1
0
        /// <summary>
        /// 根据指定点搜索要素
        /// </summary>
        /// <param name="point"></param>
        /// <param name="tolerance"></param>
        /// <returns></returns>
        public moFeatures SearchFeaturesByPoint(moPoint point, double tolerance)
        {
            moFeatures sSelectedFeatures = new moFeatures();
            Int32      sFeatureCount     = _Features.Count;

            for (Int32 i = 0; i <= sFeatureCount - 1; i++)
            {
                if (_ShapeType == moGeometryTypeConstant.Point)
                {
                    moPoint sPoint = (moPoint)_Features.GetItem(i).Geometry;
                    if (moMapTools.IsPointOnPoint(point, sPoint, tolerance) == true)
                    {
                        sSelectedFeatures.Add(_Features.GetItem(i));
                    }
                }
                else if (_ShapeType == moGeometryTypeConstant.MultiPolyline)
                {
                    moMultiPolyline sMultiPolyline = (moMultiPolyline)_Features.GetItem(i).Geometry;
                    if (moMapTools.IsPointOnMultiPolyline(point, sMultiPolyline, tolerance) == true)
                    {
                        sSelectedFeatures.Add(_Features.GetItem(i));
                    }
                }
                else if (_ShapeType == moGeometryTypeConstant.MultiPolygon)
                {
                    moMultiPolygon sMultiPolygon = (moMultiPolygon)_Features.GetItem(i).Geometry;
                    if (moMapTools.IsPointWithinMultiPolygon(point, sMultiPolygon) == true)
                    {
                        sSelectedFeatures.Add(_Features.GetItem(i));
                    }
                }
            }
            return(sSelectedFeatures);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="selectingBox"></param>
        /// <returns></returns>

        private moFeatures SearchFeaturesByBox(moRectangle selectingBox)
        {
            moFeatures sSelectedFeatures = new moFeatures();
            Int32      sFeatureCount     = _Features.Count;

            for (Int32 i = 0; i <= sFeatureCount - 1; i++)
            {
                if (_ShapeType == moGeometryTypeConstant.Point)
                {
                    moPoint sPoint = (moPoint)_Features.GetItem(i).Geometry;
                    if (moMapTools.IsPointWithinBox(sPoint, selectingBox) == true)
                    {
                        sSelectedFeatures.Add(_Features.GetItem(i));
                    }
                }
                else if (_ShapeType == moGeometryTypeConstant.MultiPolyline)
                {
                    moMultiPolyline sMultiPolyline = (moMultiPolyline)_Features.GetItem(i).Geometry;
                    if (moMapTools.IsMultiPolylinePartiallyWithinBox(sMultiPolyline, selectingBox) == true)
                    {
                        sSelectedFeatures.Add(_Features.GetItem(i));
                    }
                }
                else if (_ShapeType == moGeometryTypeConstant.MultiPolygon)
                {
                    moMultiPolygon sMultiPolygon = (moMultiPolygon)_Features.GetItem(i).Geometry;
                    if (moMapTools.IsMultiPolygonPartiallyWithinBox(sMultiPolygon, selectingBox) == true)
                    {
                        sSelectedFeatures.Add(_Features.GetItem(i));
                    }
                }
            }
            return(sSelectedFeatures);
        }
Пример #3
0
 /// <summary>
 /// 根据指定方法执行选择,selectMethod即新建、求差、求交等
 /// </summary>
 /// <param name="features"></param>
 /// <param name="selectMethod"></param>
 public void ExecuteSelect(moFeatures features, Int32 selectMethod)
 {
     //说明:此处仅考虑新建集合
     if (selectMethod == 0)
     {
         _SelectedFeatures.Clear();
         Int32 sFeatureCount = features.Count;
         for (Int32 i = 0; i < sFeatureCount; i++)
         {
             _SelectedFeatures.Add(features.GetItem(i));
         }
     }
     else
     {
         throw new NotFiniteNumberException();
     }
 }