Exemplo n.º 1
0
        // private AttributeStreamOfInt32 m_orphanVertices;
        private void _beforeRemoveVertex(int vertex, bool bChangePathFirst)
        {
            int vertexlistIndex = m_shape.GetUserIndex(vertex, m_userIndexSortedIndexToVertex);

            if (m_nextVertexToProcess == vertexlistIndex)
            {
                m_nextVertexToProcess = m_sortedVertices.GetNext(m_nextVertexToProcess);
            }
            if (m_firstCoincidentVertex == vertexlistIndex)
            {
                m_firstCoincidentVertex = m_sortedVertices.GetNext(m_firstCoincidentVertex);
            }
            m_sortedVertices.DeleteElement(m_sortedVerticesListIndex, vertexlistIndex);
            _removeAngleSortInfo(vertex);
            if (bChangePathFirst)
            {
                int path = m_shape.GetPathFromVertex(vertex);
                if (path != -1)
                {
                    int first = m_shape.GetFirstVertex(path);
                    if (first == vertex)
                    {
                        int next = m_shape.GetNextVertex(vertex);
                        if (next != vertex)
                        {
                            int p = m_shape.GetPathFromVertex(next);
                            if (p == path)
                            {
                                m_shape.SetFirstVertex_(path, next);
                                return;
                            }
                            else
                            {
                                int prev = m_shape.GetPrevVertex(vertex);
                                if (prev != vertex)
                                {
                                    p = m_shape.GetPathFromVertex(prev);
                                    if (p == path)
                                    {
                                        m_shape.SetFirstVertex_(path, prev);
                                        return;
                                    }
                                }
                            }
                        }
                        m_shape.SetFirstVertex_(path, -1);
                        m_shape.SetLastVertex_(path, -1);
                    }
                }
            }
        }
Exemplo n.º 2
0
        internal virtual bool InsertEdge_(int vertex, int reused_node)
        {
            com.epl.geometry.Point2D pt_1 = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D pt_2 = new com.epl.geometry.Point2D();
            m_shape.GetXY(vertex, pt_1);
            int next = m_shape.GetNextVertex(vertex);

            m_shape.GetXY(next, pt_2);
            bool b_res = false;

            if (pt_1.y < pt_2.y)
            {
                b_res = true;
                int edge = m_edges.NewEdge(vertex);
                int aetNode;
                if (reused_node == -1)
                {
                    aetNode = m_AET.AddElement(edge, -1);
                }
                else
                {
                    aetNode = reused_node;
                    m_AET.SetElement(aetNode, edge);
                }
                int node = m_shape.GetUserIndex(next, m_node_1_user_index);
                if (node == -1)
                {
                    m_shape.SetUserIndex(next, m_node_1_user_index, aetNode);
                }
                else
                {
                    m_shape.SetUserIndex(next, m_node_2_user_index, aetNode);
                }
                int path = m_shape.GetPathFromVertex(vertex);
                if (m_shape.GetPathUserIndex(path, m_path_orientation_index) == 0)
                {
                    m_unknown_nodes.Add(aetNode);
                }
            }
            int prev = m_shape.GetPrevVertex(vertex);

            m_shape.GetXY(prev, pt_2);
            if (pt_1.y < pt_2.y)
            {
                b_res = true;
                int edge = m_edges.NewEdge(prev);
                int aetNode;
                if (reused_node == -1)
                {
                    aetNode = m_AET.AddElement(edge, -1);
                }
                else
                {
                    aetNode = reused_node;
                    m_AET.SetElement(aetNode, edge);
                }
                int node = m_shape.GetUserIndex(prev, m_node_1_user_index);
                if (node == -1)
                {
                    m_shape.SetUserIndex(prev, m_node_1_user_index, aetNode);
                }
                else
                {
                    m_shape.SetUserIndex(prev, m_node_2_user_index, aetNode);
                }
                int path = m_shape.GetPathFromVertex(vertex);
                if (m_shape.GetPathUserIndex(path, m_path_orientation_index) == 0)
                {
                    m_unknown_nodes.Add(aetNode);
                }
            }
            return(b_res);
        }
Exemplo n.º 3
0
 internal int GetPath(int index)
 {
     return(m_shape.GetPathFromVertex(GetEnd1(index)));
 }