ShapeConnectionPin::ShapeConnectionPin(JunctionRef *junction, const unsigned int classId, const ConnDirFlags visDirs) : m_shape(NULL), m_junction(junction), m_class_id(classId), m_x_portion_offset(0.0), m_y_portion_offset(0.0), m_inside_offset(0.0), m_visibility_directions(visDirs), m_exclusive(true), m_connection_cost(0.0), m_vertex(NULL) { COLA_ASSERT(m_junction != NULL); m_router = m_junction->router(); m_junction->addConnectionPin(this); // Create a visibility vertex for this ShapeConnectionPin. VertID id(m_junction->id(), kShapeConnectionPin, VertID::PROP_ConnPoint | VertID::PROP_ConnectionPin); m_vertex = new VertInf(m_router, id, m_junction->position()); m_vertex->visDirections = visDirs; if (m_router->_polyLineRouting) { vertexVisibility(m_vertex, NULL, true, true); } }
void ShapeConnectionPin::updateVisibility(void) { m_vertex->removeFromGraph(); if (m_router->_polyLineRouting) { vertexVisibility(m_vertex, NULL, true, true); } }
ShapeConnectionPin::ShapeConnectionPin(ShapeRef *shape, const unsigned int classId, const double xPortionOffset, const double yPortionOffset, const double insideOffset, const ConnDirFlags visDirs) : m_shape(shape), m_junction(NULL), m_class_id(classId), m_x_portion_offset(xPortionOffset), m_y_portion_offset(yPortionOffset), m_inside_offset(insideOffset), m_visibility_directions(visDirs), m_exclusive(true), m_connection_cost(0.0), m_vertex(NULL) { COLA_ASSERT(m_shape != NULL); m_router = m_shape->router(); m_shape->addConnectionPin(this); // Create a visibility vertex for this ShapeConnectionPin. VertID id(m_shape->id(), kShapeConnectionPin, VertID::PROP_ConnPoint | VertID::PROP_ConnectionPin); m_vertex = new VertInf(m_router, id, this->position()); m_vertex->visDirections = this->directions(); if (m_vertex->visDirections == ConnDirAll) { // A pin with visibility in all directions is not exclusive // by default. m_exclusive = false; } if (m_router->_polyLineRouting) { vertexVisibility(m_vertex, NULL, true, true); } }
std::pair<bool, VertInf *> ConnEnd::getHyperedgeVertex(Router *router) const { bool addedVertex = false; VertInf *vertex = NULL; if (m_anchor_obj) { for (ShapeConnectionPinSet::iterator curr = m_anchor_obj->m_connection_pins.begin(); curr != m_anchor_obj->m_connection_pins.end(); ++curr) { ShapeConnectionPin *currPin = *curr; if ((currPin->m_class_id == m_connection_pin_class_id) && (!currPin->m_exclusive || currPin->m_connend_users.empty())) { vertex = currPin->m_vertex; } } COLA_ASSERT(vertex != NULL); } else { VertID id(0, kUnassignedVertexNumber, VertID::PROP_ConnPoint); vertex = new VertInf(router, id, m_point); vertex->visDirections = m_directions; addedVertex = true; if (router->m_allows_orthogonal_routing) { vertexVisibility(vertex, NULL, true, true); } } return std::make_pair(addedVertex, vertex); }