Ignore:
Timestamp:
02/18/06 18:02:12 (18 years ago)
Author:
mattausch
Message:

exporting / loading full merge hierarchy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r650 r651  
    12621262 
    12631263        int totalPvs; 
    1264         float totalRenderCost, float avgRenderCost, float expectedCost; 
     1264        float totalRenderCost, avgRenderCost, expectedCost; 
    12651265 
    12661266        float deviation = 0; 
     
    12701270        ofstream stats; 
    12711271        stats.open("mergeStats.log"); 
    1272  
    1273         Debug << "here343" << endl; 
    12741272 
    12751273        stats  
     
    13471345 
    13481346 
    1349 /*float ViewCellsTree::ComputeVolume(ViewCell *vc) 
     1347#if 0 
     1348float ViewCellsTree::ComputeVolume(ViewCell *vc) 
    13501349{ 
    13511350        if (vc->IsLeaf()) 
     
    13691368                return volume; 
    13701369        } 
    1371 }*/ 
    1372  
     1370} 
     1371#endif 
    13731372 
    13741373void ViewCellsTree::SetRoot(ViewCell *root) 
     
    16211620 
    16221621 
    1623 void ViewCellsTree::PropagateUpPvs(ViewCell *vc) 
     1622void ViewCellsTree::PropagatePvs(ViewCell *vc) 
    16241623{ 
    16251624        while (vc->GetParent()) 
     
    16271626                vc->GetParent()->GetPvs().Merge(vc->GetPvs()); 
    16281627                vc = vc->GetParent(); 
     1628        } 
     1629 
     1630        if (vc->IsLeaf()) 
     1631                return; 
     1632 
     1633        stack<ViewCell *> tstack; 
     1634 
     1635        tstack.push(vc); 
     1636 
     1637        while (!tstack.empty()) 
     1638        { 
     1639                ViewCell *viewCell = tstack.top(); 
     1640                tstack.pop(); 
     1641 
     1642                if (viewCell != vc) 
     1643                { 
     1644                        viewCell->GetPvs().Merge(vc->GetPvs()); 
     1645                } 
     1646 
     1647                if (!viewCell->IsLeaf()) 
     1648                { 
     1649                        ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(viewCell); 
     1650                        ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 
     1651 
     1652                        for (it = interior->mChildren.begin(); it != it_end; ++ it) 
     1653                        { 
     1654                                tstack.push(*it); 
     1655                        } 
     1656                } 
    16291657        } 
    16301658} 
     
    17271755 
    17281756 
     1757void ViewCellsTree::CreateUniqueViewCellsIds() 
     1758{ 
     1759        stack<ViewCell *> tstack; 
     1760 
     1761        int currentId = 0; 
     1762 
     1763        tstack.push(mRoot); 
     1764 
     1765        while (!tstack.empty()) 
     1766        { 
     1767                ViewCell *vc = tstack.top(); 
     1768                tstack.pop(); 
     1769 
     1770                vc->SetId(currentId ++); 
     1771 
     1772                if (!vc->IsLeaf()) 
     1773                { 
     1774                        ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 
     1775                        ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 
     1776                        for (it = interior->mChildren.begin(); it != it_end; ++ it) 
     1777                        { 
     1778                                tstack.push(*it); 
     1779                        } 
     1780                } 
     1781        } 
     1782} 
     1783 
     1784 
    17291785void ViewCellsTree::ExportViewCell(ViewCell *viewCell, ofstream &stream) 
    17301786{ 
    17311787        ObjectPvsMap::iterator it, it_end = viewCell->GetPvs().mEntries.end(); 
    1732  
    1733         if (0) // test with empty pvs 
    1734         for (it = viewCell->GetPvs().mEntries.begin(); it != it_end; ++ it) 
    1735         { 
    1736                 stream << (*it).first->GetId() << " "; 
    1737         } 
    1738  
    1739         stream << "\" />" << endl; 
    17401788 
    17411789        if (viewCell->IsLeaf()) 
     
    17461794                stream << "mergecost=\"" << viewCell->GetMergeCost() << "\" "; 
    17471795                stream << "pvs=\""; 
    1748                 stream << "</Leaf>" << endl; 
     1796                if (0)// test with empty pvs 
     1797                        for (it = viewCell->GetPvs().mEntries.begin(); it != it_end; ++ it) 
     1798                        { 
     1799                                stream << (*it).first->GetId() << " "; 
     1800                        } 
     1801 
     1802         
     1803                stream << "\" />" << endl; 
     1804                //stream << " </Leaf>" << endl; 
    17491805        } 
    17501806        else 
     
    17571813                stream << "mergecost=\"" << viewCell->GetMergeCost() << "\" "; 
    17581814                stream << "pvs=\""; 
     1815 
     1816                if (0)// test with empty pvs 
     1817                        for (it = viewCell->GetPvs().mEntries.begin(); it != it_end; ++ it) 
     1818                        { 
     1819                                stream << (*it).first->GetId() << " "; 
     1820                        } 
     1821 
     1822                stream << "\" >" << endl; 
    17591823 
    17601824                ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 
Note: See TracChangeset for help on using the changeset viewer.