Ejemplo n.º 1
0
        private static Overlaps SelectOverlaps(Overlaps overlaps, Geometry sketch)
        {
            if (overlaps == null)
            {
                return(new Overlaps());
            }

            int selectionTolerancePixels = 3;

            bool singlePick = ToolUtils.IsSingleClickSketch(sketch);

            if (singlePick)
            {
                sketch = ToolUtils.GetSinglePickSelectionArea(sketch, selectionTolerancePixels);
            }

            Overlaps result = overlaps.SelectNewOverlaps(
                o => o.GeometryType == GeometryType.Polyline &&
                IsOverlapSelected(sketch, o, singlePick));

            // in case of single pick the line has priority
            if (!result.HasOverlaps() || !singlePick)
            {
                result.AddGeometries(overlaps,
                                     g => g.GeometryType == GeometryType.Polygon &&
                                     IsOverlapSelected(sketch, g, singlePick));
            }

            return(result);
        }
Ejemplo n.º 2
0
        private Overlaps SelectOverlaps(Overlaps overlaps, Geometry sketch)
        {
            if (overlaps == null)
            {
                return(new Overlaps());
            }

            sketch = ToolUtils.SketchToSearchGeometry(sketch, GetSelectionTolerancePixels(),
                                                      out bool singlePick);

            // in case of single pick the line has priority...
            Overlaps result = overlaps.SelectNewOverlaps(
                o => o.GeometryType == GeometryType.Polyline &&
                ToolUtils.IsSelected(sketch, o, singlePick));

            // ... over the polygon
            if (!result.HasOverlaps() || !singlePick)
            {
                result.AddGeometries(overlaps,
                                     g => g.GeometryType == GeometryType.Polygon &&
                                     ToolUtils.IsSelected(sketch, g, singlePick));
            }

            return(result);
        }