Esempio n. 1
0
        public Boolean Evaluate(Feature feature)
        {
            if (feature.geometry == null)
            {
                return(false);
            }
            switch (feature.geometry.geometryType)
            {
            case OSGeo.OGR.wkbGeometryType.wkbPoint:
                PointD point_data = (PointD)feature.geometry;
                PointD point_map  = this.rsTransfrom.sourceToTarget(point_data);
                return(SpatialTopology.IsPointInRectangle(point_map, this.rect));

            case OSGeo.OGR.wkbGeometryType.wkbPolygon:
                SimplePolygon polygon_data = (SimplePolygon)feature.geometry;
                return(checksimplepolygon(polygon_data));

            case OSGeo.OGR.wkbGeometryType.wkbLineString:
                SimplePolyline line_data = (SimplePolyline)feature.geometry;
                return(checkpolyline(line_data));

            case OSGeo.OGR.wkbGeometryType.wkbMultiPolygon:
                Polygon mutipolygon_data = (Polygon)feature.geometry;
                return(checkmutipolygon(mutipolygon_data));

            case OSGeo.OGR.wkbGeometryType.wkbMultiLineString:
                break;
            }
            //to do
            return(false);
        }
Esempio n. 2
0
        public bool checkpolyline(SimplePolyline polyline_data)
        {
            List <PointD> polyline_points_map = new List <PointD>();
            int           pointcount          = polyline_data.points.Count;

            for (int i = 0; i < pointcount; i++)
            {
                polyline_points_map.Add(rsTransfrom.sourceToTarget(polyline_data.points[i]));
            }
            SimplePolyline polyline_map = new SimplePolyline(polyline_points_map);

            return(SpatialTopology.IsSimplePolyLineInRectangle(polyline_map, rect));
        }
Esempio n. 3
0
        public bool checksimplepolygon(SimplePolygon polygon_data)
        {
            List <PointD> ring0_points_data = polygon_data.rings[0].points;
            List <PointD> ring0_points_map  = new List <PointD>();

            for (int i = 0; i < ring0_points_data.Count; i++)
            {
                ring0_points_map.Add(this.rsTransfrom.sourceToTarget(ring0_points_data[i]));
            }
            SimplePolyline        ring0       = new SimplePolyline(ring0_points_map);
            List <SimplePolyline> temp        = new List <SimplePolyline>(); temp.Add(ring0);
            SimplePolygon         polygon_map = new SimplePolygon(temp);

            return(SpatialTopology.IsSimplePolygonIntersectRect(polygon_map, this.rect));
        }
Esempio n. 4
0
        public bool CheckIsPointSelectedofSelectedFeatureCollection(PointD mouselocation, double interval)
        {
            if (selectedFeatureCollection == null || selectedFeatureCollection.featureList.Count == 0)
            {
                return(false);
            }
            foreach (Feature feature in selectedFeatureCollection.featureList)
            {
                switch (feature.geometry.geometryType)
                {
                case OSGeo.OGR.wkbGeometryType.wkbPoint:
                    if (SpatialTopology.GetDistanceBetweenPoints((PointD)feature.geometry, mouselocation) < interval)
                    {
                        this.selectedPoint = (PointD)feature.geometry;
                        return(true);
                    }
                    break;

                case OSGeo.OGR.wkbGeometryType.wkbLineString:
                    SimplePolyline simpleline = (SimplePolyline)feature.geometry;
                    foreach (PointD linepoint in simpleline.points)
                    {
                        if (SpatialTopology.GetDistanceBetweenPoints(linepoint, mouselocation) < interval)
                        {
                            this.selectedPoint = linepoint;
                            return(true);
                        }
                    }
                    break;

                case OSGeo.OGR.wkbGeometryType.wkbPolygon:
                    SimplePolygon simplepolygon = (SimplePolygon)feature.geometry;
                    foreach (SimplePolyline ring in simplepolygon.rings)
                    {
                        foreach (PointD linepoint in ring.points)
                        {
                            if (SpatialTopology.GetDistanceBetweenPoints(linepoint, mouselocation) < interval)
                            {
                                this.selectedPoint = linepoint;
                                return(true);
                            }
                        }
                    }
                    break;
                }
            }
            this.selectedPoint = null; return(false);
        }