Revision: 65257
          http://sourceforge.net/p/brlcad/code/65257
Author:   ejno
Date:     2015-06-10 21:33:53 +0000 (Wed, 10 Jun 2015)
Log Message:
-----------
handle repeated references to regions

Modified Paths:
--------------
    brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp

Modified: brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp
===================================================================
--- brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp    2015-06-10 
21:13:15 UTC (rev 65256)
+++ brlcad/trunk/src/libgcv/conv/fastgen4/fastgen4_write.cpp    2015-06-10 
21:33:53 UTC (rev 65257)
@@ -1571,6 +1571,7 @@
                                 leaves.end())) {
                std::copy(leaves.begin(), leaves.end(), std::inserter(results,
                          results.begin()));
+               // TODO: write WALL records
            }
        }
     }
@@ -1590,7 +1591,7 @@
 
     void create_section(const db_full_path &path);
     Section &get_section(const db_full_path &path);
-    bool member_ignored(const db_full_path &path, const directory &dir) const;
+    bool member_ignored(const db_full_path &path) const;
 
 
 private:
@@ -1646,8 +1647,11 @@
     std::pair<std::map<const directory *, Section *>::iterator, bool> found =
        m_sections.insert(std::make_pair(region_dir, static_cast<Section 
*>(NULL)));
 
-    if (!found.second)
-       throw std::logic_error("Section already created");
+    if (!found.second) {
+       // new reference to a region
+       found.first->second->write(m_writer);
+       delete found.first->second;
+    }
 
     const std::string name = AutoPtr<char>(db_path_to_string(&path)).ptr;
     found.first->second = new Section(name, true);
@@ -1667,8 +1671,7 @@
 
 
 bool
-FastgenConversion::member_ignored(const db_full_path &path,
-                                 const directory &dir) const
+FastgenConversion::member_ignored(const db_full_path &path) const
 {
     RT_CK_FULL_PATH(&path);
 
@@ -1677,7 +1680,7 @@
     if (!region_dir)
        return false; // toplevel
 
-    return m_ignored_members.at(region_dir).count(&dir);
+    return m_ignored_members.at(region_dir).count(&get_parent_dir(path));
 }
 
 
@@ -1844,7 +1847,7 @@
     const std::string name = AutoPtr<char>(db_path_to_string(path)).ptr;
     bool converted = false;
 
-    if (data.member_ignored(*path, get_parent_dir(*path)))
+    if (data.member_ignored(*path))
        converted = true;
     else
        try {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to