示例#1
0
        private void CreateNodeMap()
        {
            cnodes.Clear();

            //centroids
            foreach (Polygon poly in polygons)
            {
                CNode n = new CNode(poly.Centroid);
                n.Associate(poly);

                cnodes.Add(n);
            }

            //midpoints
            foreach (Link link in links)
            {
                CNode n = new CNode(link.ConnectingLine().Midpoint);
                n.Associate(link.StartPoly);
                n.Associate(link.EndPoly);

                cnodes.Add(n);
            }

            //connect nodes
            foreach (CNode n in cnodes)
            {
                foreach (CNode n2 in cnodes)
                {
                    if (n == n2)
                    {
                        continue;
                    }
                    foreach (Polygon poly in n.Polygons)
                    {
                        if (n2.isAssociated(poly))
                        {
                            n.Add(n2);
                        }
                    }
                }
            }
        }
示例#2
0
        public void GenerateNodeMap(Point start, Point end)
        {
            nodes.Clear();

            CNode startNode = new CNode(start);
            CNode endNode = new CNode(end);

            foreach (Polygon poly in polygons)
            {
                if (poly.Intersects(startNode.Location))
                    startNode.Associate(poly);
                if (poly.Intersects(endNode.Location))
                    endNode.Associate(poly);
            }

            nodes.Add(startNode);
            nodes.Add(endNode);

            CreateNodeMap();
        }
示例#3
0
        public void GenerateNodeMap(Point start, Point end)
        {
            nodes.Clear();

            CNode startNode = new CNode(start);
            CNode endNode   = new CNode(end);

            foreach (Polygon poly in polygons)
            {
                if (poly.Intersects(startNode.Location))
                {
                    startNode.Associate(poly);
                }
                if (poly.Intersects(endNode.Location))
                {
                    endNode.Associate(poly);
                }
            }

            nodes.Add(startNode);
            nodes.Add(endNode);

            CreateNodeMap();
        }
示例#4
0
        private void CreateNodeMap()
        {
            //centroids
            foreach (Polygon poly in polygons)
            {
                CNode n = new CNode(poly.Centroid);
                n.Associate(poly);

                nodes.Add(n);
            }

            //midpoints
            foreach (Link link in links)
            {
                CNode n = new CNode(link.ConnectingLine().Midpoint);
                n.Associate(link.StartPoly);
                n.Associate(link.EndPoly);

                nodes.Add(n);
            }

            //connect nodes
            foreach (CNode n in nodes)
            {
                foreach (CNode n2 in nodes)
                {
                    if (n == n2)
                        continue;
                    foreach (Polygon poly in n.Polygons)
                    {
                        if (n2.isAssociated(poly))
                            n.Add(n2);
                    }
                }
            }
        }