Exemplo n.º 1
0
void Obstacle::setNewPoly(const Polygon& poly)
{
    COLA_ASSERT(m_first_vert != NULL);
    COLA_ASSERT(m_polygon.size() == poly.size());

    m_polygon = poly;
    Polygon routingPoly = routingPolygon();

    VertInf *curr = m_first_vert;
    for (size_t pt_i = 0; pt_i < routingPoly.size(); ++pt_i)
    {
        COLA_ASSERT(curr->visListSize == 0);
        COLA_ASSERT(curr->invisListSize == 0);

        // Reset with the new polygon point.
        curr->Reset(routingPoly.ps[pt_i]);
        curr->pathNext = NULL;

        curr = curr->shNext;
    }
    COLA_ASSERT(curr == m_first_vert);

    // It may be that the polygon for the obstacle has been updated after
    // creating the shape.  These events may have been combined for a single
    // transaction, so update pin positions.
    for (ShapeConnectionPinSet::iterator curr =
                m_connection_pins.begin(); curr != m_connection_pins.end(); ++curr)
    {
        ShapeConnectionPin *pin = *curr;
        pin->updatePosition(m_polygon);
    }
}
Exemplo n.º 2
0
// Given a set of directions, mark visibility edges in all other directions
// as being invalid so they get ignored during the search.
//
void VertInf::setVisibleDirections(const ConnDirFlags directions)
{
    for (EdgeInfList::const_iterator edge = visList.begin();
            edge != visList.end(); ++edge)
    {
        if (directions == ConnDirAll)
        {
            (*edge)->setDisabled(false);
        }
        else
        {
            VertInf *otherVert = (*edge)->otherVert(this);
            ConnDirFlags direction = otherVert->directionFrom(this);
            bool visible = (direction & directions);
            (*edge)->setDisabled(!visible);
        }
    }

    for (EdgeInfList::const_iterator edge = orthogVisList.begin();
            edge != orthogVisList.end(); ++edge)
    {
        if (directions == ConnDirAll)
        {
            (*edge)->setDisabled(false);
        }
        else
        {
            VertInf *otherVert = (*edge)->otherVert(this);
            ConnDirFlags direction = otherVert->directionFrom(this);
            bool visible = (direction & directions);
            (*edge)->setDisabled(!visible);
        }
    }
}
Exemplo n.º 3
0
void Obstacle::removeFromGraph(void)
{
    bool isConnPt = false;
    for (VertInf *iter = firstVert(); iter != lastVert()->lstNext; )
    {
        VertInf *tmp = iter;
        iter = iter->lstNext;
 
        tmp->removeFromGraph(isConnPt);
    }
}
Exemplo n.º 4
0
void Obstacle::setNewPoly(const Polygon& poly)
{
    COLA_ASSERT(m_first_vert != NULL);
    COLA_ASSERT(m_polygon.size() == poly.size());
    
    VertInf *curr = m_first_vert;
    for (size_t pt_i = 0; pt_i < m_polygon.size(); ++pt_i)
    {
        COLA_ASSERT(curr->visListSize == 0);
        COLA_ASSERT(curr->invisListSize == 0);

        // Reset with the new polygon point.
        curr->Reset(poly.ps[pt_i]);
        curr->pathNext = NULL;
        
        curr = curr->shNext;
    }
    COLA_ASSERT(curr == m_first_vert);
        
    m_polygon = poly;
}