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
void JunctionRef::moveAttachedConns(const Point& newPosition)
{
    // Update positions of attached connector ends.
    for (std::set<ConnEnd *>::iterator curr = m_following_conns.begin();
            curr != m_following_conns.end(); ++curr)
    {
        ConnEnd *connEnd = *curr;
        COLA_ASSERT(connEnd->m_conn_ref != NULL);
        m_router->modifyConnector(connEnd->m_conn_ref, connEnd->endpointType(),
                *connEnd);
    }
    for (ShapeConnectionPinSet::iterator curr = 
            m_connection_pins.begin(); curr != m_connection_pins.end(); ++curr)
    {
        ShapeConnectionPin *pin = *curr;
        pin->updatePosition(newPosition);
    }
}