bool GetInvalidateRect(RectD & retVal) const { if (!m_invalidateRect.IsEmptyArea()) retVal = m_invalidateRect; if (m_hotItem) { if (hpcc::ElementG * hotElementG = GetElementG(m_hotItem)) { retVal = hotElementG->GetBoundingBox(); if (m_hotEdge) { if (hpcc::ElementG * hotElementG = GetElementG(m_hotEdge->GetFromVertex())) retVal.Union(hotElementG->GetBoundingBox()); if (hpcc::ElementG * hotElementG = GetElementG(m_hotEdge->GetToVertex())) retVal.Union(hotElementG->GetBoundingBox()); } else if(m_hotVertex) { for(IEdgeSet::const_iterator itr = m_hotVertex->GetInEdges().begin(); itr != m_hotVertex->GetInEdges().end(); ++itr) { if (hpcc::ElementG * hotElementG = GetElementG(itr->get())) retVal.Union(hotElementG->GetBoundingBox()); } for(IEdgeSet::const_iterator itr = m_hotVertex->GetOutEdges().begin(); itr != m_hotVertex->GetOutEdges().end(); ++itr) { if (hpcc::ElementG * hotElementG = GetElementG(itr->get())) retVal.Union(hotElementG->GetBoundingBox()); } } } } m_invalidateRect = retVal; return !m_invalidateRect.IsEmptyArea(); }
void FixSubgraphSizes(ICluster * cluster, RectD & parentRect) { RectD childRect; for(IClusterSet::const_iterator itr = cluster->GetClusters().begin(); itr != cluster->GetClusters().end(); ++itr) { std::string cluster; FixSubgraphSizes(itr->get(), childRect); } for(IVertexSet::const_iterator itr = cluster->GetVertices().begin(); itr != cluster->GetVertices().end(); ++itr) { if (childRect.IsEmptyArea()) childRect = GetBoundingRect(itr->get()); else childRect.Union(GetBoundingRect(itr->get())); } //if (!GetBoundingRect(cluster).Contains(childRect)) { if (childRect.IsEmptyArea()) childRect = GetBoundingRect(cluster); else childRect.Union(GetBoundingRect(cluster)); if (ElementG * eg = GetElementG(cluster)) { assert(eg->m_polygons.size() == 1); if (eg->m_polygons.size() == 1) { eg->m_polygons[0]->m_points.clear(); eg->m_polygons[0]->SetBoundingBox(RectD()); eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetBottom())); eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetTop())); eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetRight(), childRect.GetTop())); eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetRight(), childRect.GetBottom())); eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetBottom())); } //eg->SetBoundingBox(childRect); eg->CalcBoundingBox(); } //childRect.Union(GetBoundingRect(cluster)); //ElementGPtr elementG = new ElementG(childRect); //cluster->SetProperty(SVG_PROP_ELEMENTG, elementG); } if (parentRect.IsEmptyArea()) parentRect = childRect; else parentRect.Union(childRect); }
bool GetPrevInvalidateRect(RectD & retVal) const { retVal = m_prevInvalidateRect; return !m_prevInvalidateRect.IsEmptyArea(); }