当前位置: 首页>>代码示例>>C#>>正文


C# Window.Union方法代码示例

本文整理汇总了C#中Window.Union方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Union方法的具体用法?C# Window.Union怎么用?C# Window.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Window的用法示例。


在下文中一共展示了Window.Union方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CleanupQuery

        /// <summary>
        /// Creates a new <c>CleanupQuery</c> and executes it.
        /// </summary>
        /// <param name="model">The model to clean</param>
        internal CleanupQuery(CadastralMapModel model)
        {
            if (model==null)
                throw new ArgumentNullException();

            m_Model = model;
            m_UpdateWindow = new Window();
            m_Deletions = new List<ISpatialObject>(100);
            m_Moves = new List<Feature>(100);

            // Cleanup features
            model.Index.QueryWindow(null, SpatialType.Feature, CleanupFeature);

            // Cleanup polygons
            model.Index.QueryWindow(null, SpatialType.Polygon, CleanupPolygon);

            // Remove stuff from spatial index if it's been deleted
            EditingIndex index = model.EditingIndex;
            foreach (ISpatialObject o in m_Deletions)
            {
                m_UpdateWindow.Union(o.Extent);

                if (o is Feature)
                    index.RemoveFeature((Feature)o);
                else if (o is Ring)
                    index.Remove(o);
                else
                    throw new ApplicationException("Unexpected data type: " + o.GetType().Name);
            }
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:34,代码来源:CleanupQuery.cs

示例2: RingMetrics

        /// <summary>
        /// Creates a new <c>RingMetrics</c> object for the supplied faces.
        /// </summary>
        /// <param name="edge">The faces defining a ring</param>
        internal RingMetrics(List<Face> edge)
        {
            m_Area = 0.0;
            m_Window = new Window();

            foreach(Face face in edge)
            {
                IDivider d = face.Divider;
                bool isLeft = face.IsLeft;

                double area, length;
                IWindow awin;
                d.LineGeometry.GetGeometry(out awin, out area, out length);
                m_Window.Union(awin);

                if (face.IsLeft)
                    m_Area -= area;
                else
                    m_Area += area;
            }
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:25,代码来源:RingMetrics.cs

示例3: GetFeatureExtent

        /// <summary>
        /// Obtains the spatial extent of the features created by this edit.
        /// </summary>
        /// <returns>The extent of features created by this edit (null if no features were created)</returns>
        IWindow GetFeatureExtent()
        {
            Window result = new Window();

            foreach (Feature f in this.Features)
                result.Union(f.Extent);

            return (result.IsEmpty ? null : result);
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:13,代码来源:Operation.cs

示例4: GetExtent

        public static IWindow GetExtent(ICircularArcGeometry g)
        {
            // If the curve is a complete circle, just define it the easy way.
            if (g.BC.IsCoincident(g.EC))
                return CircleGeometry.GetExtent(g.Circle);

            IPosition bcp = g.BC;
            IPosition ecp = g.EC;
            IPosition centre = g.Circle.Center;

            // Initialize the window with the start location.
            Window win = new Window(bcp);

            // Expand using the end location
            win.Union(ecp);

            // If the curve is completely within one quadrant, we're done.
            QuadVertex bc = new QuadVertex(centre, bcp);
            QuadVertex ec = new QuadVertex(centre, ecp);

            Quadrant qbc = bc.Quadrant;
            Quadrant qec = ec.Quadrant;

            if (qbc == qec)
            {
                if (g.IsClockwise)
                {
                    if (bc.GetTanAngle() < ec.GetTanAngle())
                        return win;
                }
                else
                {
                    if (ec.GetTanAngle() < bc.GetTanAngle())
                        return win;
                }
            }

            // Get the window of the circle
            IWindow circle = CircleGeometry.GetExtent(g.Circle);

            // If the curve is anticlockwise, switch the quadrants for BC & EC
            if (!g.IsClockwise)
            {
                Quadrant temp = qbc;
                qbc = qec;
                qec = temp;
            }

            // Expand the window, depending on which quadrants the start &
            // end points fall in. The lack of breaks in the inner switches
            // is intentional (e.g. if start & end both fall in Quadrant.NorthEast,
            // the window we want is the complete circle, having checked above
            // for the case where the arc is JUST in Quadrant.NorthEast).

            // Define do-nothing values for the Union's below
            double wx = win.Min.X;
            double wy = win.Min.Y;

            if (qbc==Quadrant.NE)
            {
                switch (qec)
                {
                    case Quadrant.NE:
                        win.Union(wx, circle.Max.Y);
                        goto case Quadrant.NW;
                    case Quadrant.NW:
                        win.Union(circle.Min.X, wy);
                        goto case Quadrant.SW;
                    case Quadrant.SW:
                        win.Union(wx, circle.Min.Y);
                        goto case Quadrant.SE;
                    case Quadrant.SE:
                        win.Union(circle.Max.X, wy);
                        break;
                }
            }
            else if (qbc==Quadrant.SE)
            {
                switch (qec)
                {
                    case Quadrant.SE:
                        win.Union(circle.Max.X, wy);
                        goto case Quadrant.NE;
                    case Quadrant.NE:
                        win.Union(wx, circle.Max.Y);
                        goto case Quadrant.NW;
                    case Quadrant.NW:
                        win.Union(circle.Min.X, wy);
                        goto case Quadrant.SW;
                    case Quadrant.SW:
                        win.Union(wx, circle.Min.Y);
                        break;
                }
            }
            else if (qbc==Quadrant.SW)
            {
                switch (qec)
                {
                    case Quadrant.SW:
                        win.Union(wx, circle.Min.Y);
//.........这里部分代码省略.........
开发者ID:steve-stanton,项目名称:backsight,代码行数:101,代码来源:CircularArcGeometry.cs

示例5: LoadControl

        /// <summary>
        /// Loads control data from external file (based on the ranges currently defined
        /// in <see cref="m_Ranges"/>)
        /// </summary>
        /// <returns>The window of the loaded data (null if an error is reported)</returns>
        IWindow LoadControl()
        {
            // Get the name of the control file.
            string fspec = controlFileTextBox.Text;

            // Open the control file and scan through it. For each line, try to form
            // a control object. If successful, scan the array of control ranges we have
            // to try to find a match.

            try
            {
                // Initialize the window of loaded data
                Window win = new Window();

                using (StreamReader sr = File.OpenText(fspec))
                {
                    string str;
                    while ((str = sr.ReadLine()) != null)
                    {
                        ControlPoint control;
                        if (ControlPoint.TryParse(str, out control))
                        {
                            foreach (ControlRange r in m_Ranges)
                            {
                                if (control.IsInRange(r))
                                {
                                    r.Insert(control);
                                    win.Union(control);
                                    break;
                                }
                            }
                        }
                    }
                }

                return win;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return null;
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:50,代码来源:GetControlForm.cs

示例6: GetIntersect

        /// <summary>
        /// Returns the intersection of the parallel with a line.
        /// </summary>
        /// <param name="refline">The reference line.</param>
        /// <param name="parpos">Search position that coincides with the parallel.</param>
        /// <param name="line">The line to intersect with.</param>
        /// <returns>The intersection (if any). In cases where the line intersects the
        /// parallel more than once, you get the intersection that is closest to the
        /// search position.</returns>
        internal static IPosition GetIntersect(LineFeature refline, IPosition parpos, LineFeature line)
        {
            // Make sure the intersection is undefined.
            IPosition result = null;

            // Return if the parallel point is undefined.
            if (parpos==null)
                return null;

            // If the reference line is a circular arc (or a section based on an arc), get the curve info.
            ArcFeature arc = refline.GetArcBase();
            if (arc != null)
            {
                Circle circle = arc.Circle;
                double radius = circle.Radius;
                IPointGeometry centre = circle.Center;
                bool iscw = arc.IsClockwise;

                // Construct a circle that passes through the search position
                double parrad = Geom.Distance(centre, parpos);

                // Intersect the circle with the line to intersect with.
                IntersectionResult xres = new IntersectionResult(line);
                uint nx = xres.Intersect(centre, parrad);
                if (nx==0)
                    return null;

                // If there is only one intersection, that's what we want.
                if (nx==1)
                    return xres.Intersections[0].P1;

                // Get the intersection that is closest to the search position.
                xres.GetClosest(parpos, out result, 0.0);
            }
            else
            {
                // Get the bearing from the start to the end of the reference line.
                IPosition spos = refline.StartPoint;
                IPosition epos = refline.EndPoint;
                double bearing = Geom.BearingInRadians(spos, epos);

                // Project the parallel line to positions that are a long way away (but make sure we
                // don't end up with negative numbers).
                Window searchWindow = new Window(line.Extent);
                searchWindow.Union(refline.Extent);
                searchWindow.Union(parpos);
                double dist = Geom.Distance(searchWindow.Min, searchWindow.Max);

                IPosition start = Geom.Polar(parpos, bearing+Constants.PI, dist);
                IPosition end = Geom.Polar(parpos, bearing, dist);

                // Intersect the line segment with the line to intersect with.
                IntersectionResult xres = new IntersectionResult(line);
                IPointGeometry sg = new PointGeometry(start);
                IPointGeometry eg = new PointGeometry(end);
                uint nx = xres.Intersect(sg, eg);
                if (nx==0)
                    return null;

                // If there is only one intersection, that's what we want.
                if (nx==1)
                    return xres.Intersections[0].P1;

                // Get the intersection that is closest to the search position
                xres.GetClosest(parpos, out result, 0.0);
            }

            return result;
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:78,代码来源:ParallelLineUI.cs


注:本文中的Window.Union方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。