Example #1
0
        public RegionEventType(pLandRegionType r)
            : base(r.ID)
        {


            //Convert to the form needed by the convexity tester
            List<GeometricPointType> gList = new List<GeometricPointType>();
            for (int i = 0; i < r.Vertices.Count; i++)
            {
                gList.Add(new GeometricPointType(r.Vertices[i].X, r.Vertices[i].Y));
            }
            /* Do not check a land readion for convexity
             * if (!ConvexTest.IsConvex(gList))
                        {
                            throw (new ApplicationException("Region " + r.ID + "  is not convex"));
                        }
            */
            vertices = new List<PointType>();
            for (int i = 0; i < gList.Count; i++)
            {
                vertices.Add(new PointType(gList[i]));
            }
            isActive = true;// Needed for regions that are not Active regions? MAybe better than sending nulls
            isVisible = true;
        }
Example #2
0
        public override pLandRegionType pGetLandRegion()
        {
            string id = "Unknown Land Region";
            pLandRegionType region;
            try
            {
                reader.Read(); // bypass 'xxxRegion'
                id = pGetString();
                region = new pLandRegionType(id);
                while ("Vertex" == reader.Name)
                {
                    region.Add(pGetPoint());
                }
                if (3 > region.Vertices.Count)
                {
                    throw new ApplicationException("Found vertex list for region "
                        + id + " with fewer than three vertices.");
                }

                reader.ReadEndElement();
            }
            catch (System.Exception e)
            {
                throw new ApplicationException("Error reading Land Region with id=" +
                    id + ": ", e);
            }

            return region;
        }