aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/landscapeig__manager_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/landscapeig__manager_8cpp-source.html431
1 files changed, 431 insertions, 0 deletions
diff --git a/docs/doxygen/nel/landscapeig__manager_8cpp-source.html b/docs/doxygen/nel/landscapeig__manager_8cpp-source.html
new file mode 100644
index 00000000..7221d58e
--- /dev/null
+++ b/docs/doxygen/nel/landscapeig__manager_8cpp-source.html
@@ -0,0 +1,431 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>landscapeig_manager.cpp</h1><a href="landscapeig__manager_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="landscapeig__manager_8h.html">nel/3d/landscapeig_manager.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="u__scene_8h.html">nel/3d/u_scene.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="u__instance__group_8h.html">nel/3d/u_instance_group.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
+00033 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
+00034 <font class="preprocessor">#include "<a class="code" href="file_8h.html">nel/misc/file.h</a>"</font>
+00035
+00036 <font class="comment">// std.</font>
+00037 <font class="preprocessor">#include &lt;fstream&gt;</font>
+00038
+00039
+00040 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00041 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00042
+00043
+00044 <font class="keyword">namespace </font>NL3D
+00045 {
+00046
+00047
+00048 <font class="comment">// ***************************************************************************</font>
+<a name="l00049"></a><a class="code" href="structNL3D_1_1CLandscapeIGManager_1_1CInstanceGroupElement.html#a0">00049</a> CLandscapeIGManager::CInstanceGroupElement::CInstanceGroupElement(UInstanceGroup *ig, <font class="keyword">const</font> <font class="keywordtype">char</font> *fileName)
+00050 {
+00051 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00052 <a class="code" href="structNL3D_1_1CLandscapeIGManager_1_1CInstanceGroupElement.html#m0">Ig</a> = ig;
+00053 <a class="code" href="structNL3D_1_1CLandscapeIGManager_1_1CInstanceGroupElement.html#m1">AddedToScene</a> = <font class="keyword">false</font>;
+00054 <font class="keywordflow">if</font> (fileName != NULL)
+00055 <a class="code" href="structNL3D_1_1CLandscapeIGManager_1_1CInstanceGroupElement.html#m2">FileName</a> = fileName;
+00056 }
+00057
+00058 <font class="comment">// ***************************************************************************</font>
+<a name="l00059"></a><a class="code" href="structNL3D_1_1CLandscapeIGManager_1_1CInstanceGroupElement.html#a1">00059</a> <font class="keywordtype">void</font> CLandscapeIGManager::CInstanceGroupElement::release()
+00060 {
+00061 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00062 <font class="keyword">delete</font> <a class="code" href="structNL3D_1_1CLandscapeIGManager_1_1CInstanceGroupElement.html#m0">Ig</a>;
+00063 <a class="code" href="structNL3D_1_1CLandscapeIGManager_1_1CInstanceGroupElement.html#m0">Ig</a>= NULL;
+00064 }
+00065
+00066
+00067 <font class="comment">// ***************************************************************************</font>
+<a name="l00068"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a0">00068</a> CLandscapeIGManager::CLandscapeIGManager()
+00069 {
+00070 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00071 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o0">_Scene</a>=NULL;
+00072 }
+00073 <font class="comment">// ***************************************************************************</font>
+<a name="l00074"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a1">00074</a> CLandscapeIGManager::~CLandscapeIGManager()
+00075 {
+00076 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00077 <font class="comment">// reset should have been called.</font>
+00078 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o0">_Scene</a>!=NULL)
+00079 <font class="keywordflow">throw</font> Exception(<font class="stringliteral">"CLandscapeIGManager not reseted"</font>);
+00080 }
+00081 <font class="comment">// ***************************************************************************</font>
+<a name="l00082"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a2">00082</a> <font class="keywordtype">void</font> CLandscapeIGManager::initIG(UScene *scene, <font class="keyword">const</font> std::string &amp;igDesc)
+00083 {
+00084 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00085 <a class="code" href="debug_8h.html#a6">nlassert</a>(scene);
+00086 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o0">_Scene</a>= scene;
+00087
+00088 <font class="comment">// Load the file.</font>
+00089 <font class="keywordflow">if</font>(igDesc.empty())
+00090 <font class="keywordflow">return</font>;
+00091
+00092 string igFile = CPath::lookup(igDesc);
+00093
+00094 <font class="comment">//ifstream file(igFile.c_str(), ios::in);</font>
+00095
+00096 CIFile <a class="code" href="cf__lexical_8cpp.html#a95">file</a>;
+00097
+00098 <font class="comment">// if loading ok.</font>
+00099 <font class="comment">//if(file.is_open())</font>
+00100 <font class="keywordflow">if</font> (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>.open (igFile))
+00101 {
+00102 <font class="keywordtype">char</font> tmpBuff[260];
+00103 <font class="keywordtype">char</font> delimiterBox[] = <font class="stringliteral">"\t"</font>;
+00104 <font class="comment">// While the end of the file is not reached.</font>
+00105 <font class="keywordflow">while</font>(!<a class="code" href="cf__lexical_8cpp.html#a95">file</a>.eof())
+00106 {
+00107 <font class="comment">// Get a line</font>
+00108 <a class="code" href="cf__lexical_8cpp.html#a95">file</a>.getline(tmpBuff, 260);
+00109 <font class="keywordtype">char</font> *token = strtok(tmpBuff, delimiterBox);
+00110 <font class="comment">// create the instance group.</font>
+00111 <font class="keywordflow">if</font>(token != NULL)
+00112 {
+00113 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.find(token)!=<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end() )
+00114 <font class="keywordflow">throw</font> Exception(<font class="stringliteral">"CLandscapeIGManager::initIG() found 2 igs with same name in %s"</font>, igFile.c_str());
+00115 <font class="keywordflow">else</font>
+00116 {
+00117 <font class="comment">// create the instanceGroup.</font>
+00118 UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(token);
+00119 <font class="keywordflow">if</font> (ig)
+00120 {
+00121 <font class="comment">// add it to the map.</font>
+00122 string tokId= token;
+00123 strupr(tokId);
+00124 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>[tokId]= CInstanceGroupElement(ig, token);
+00125 }
+00126 <font class="keywordflow">else</font>
+00127 {
+00128 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CLandscapeIGManager::initIG() Can't load instance group '%s' in '%s'"</font>, token, igFile.c_str());
+00129 }
+00130 }
+00131 }
+00132 }
+00133 <a class="code" href="cf__lexical_8cpp.html#a95">file</a>.close();
+00134 }
+00135 <font class="keywordflow">else</font>
+00136 {
+00137 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Couldn't load '%s'"</font>, igFile.c_str());
+00138 }
+00139 }
+00140 <font class="comment">// ***************************************************************************</font>
+<a name="l00141"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a3">00141</a> UInstanceGroup *CLandscapeIGManager::loadZoneIG(<font class="keyword">const</font> std::string &amp;name)
+00142 {
+00143 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00144 <font class="keywordflow">if</font>(name==<font class="stringliteral">""</font>)
+00145 <font class="keywordflow">return</font> NULL;
+00146
+00147 <font class="comment">// try to find this InstanceGroup.</font>
+00148 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#u1">ItZoneInstanceGroupMap</a> it;
+00149 it= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.find( <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#c0">translateName</a>(name) );
+00150
+00151 <font class="comment">// if found.</font>
+00152 <font class="keywordflow">if</font>( it!= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end() )
+00153 {
+00154 <font class="comment">// if not already added to the scene.</font>
+00155 <font class="keywordflow">if</font>( !it-&gt;second.AddedToScene )
+00156 {
+00157 <font class="comment">// add to the scene.</font>
+00158 <font class="keywordflow">if</font> (it-&gt;second.Ig != NULL)
+00159 {
+00160 it-&gt;second.Ig-&gt;addToScene(*<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o0">_Scene</a>);
+00161 it-&gt;second.AddedToScene= <font class="keyword">true</font>;
+00162 }
+00163 }
+00164 <font class="keywordflow">return</font> it-&gt;second.Ig;
+00165 }
+00166 <font class="keywordflow">else</font>
+00167 {
+00168 <font class="keywordflow">return</font> NULL;
+00169 }
+00170 }
+00171 <font class="comment">// ***************************************************************************</font>
+<a name="l00172"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a4">00172</a> <font class="keywordtype">void</font> CLandscapeIGManager::loadArrayZoneIG(<font class="keyword">const</font> std::vector&lt;std::string&gt; &amp;names, std::vector&lt;UInstanceGroup *&gt; *dest <font class="comment">/*= NULL*/</font>)
+00173 {
+00174 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00175 <font class="keywordflow">if</font> (dest)
+00176 {
+00177 dest-&gt;clear();
+00178 dest-&gt;reserve(names.size());
+00179 }
+00180 <font class="keywordflow">for</font>(uint i=0; i&lt;names.size(); i++)
+00181 {
+00182 UInstanceGroup *ig = <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a3">loadZoneIG</a>(names[i]);
+00183 <font class="keywordflow">if</font> (dest &amp;&amp; ig)
+00184 {
+00185 dest-&gt;push_back(ig);
+00186 }
+00187 }
+00188 }
+00189
+00190 <font class="comment">// ***************************************************************************</font>
+<a name="l00191"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a6">00191</a> <font class="keywordtype">void</font> CLandscapeIGManager::unloadArrayZoneIG(<font class="keyword">const</font> std::vector&lt;std::string&gt; &amp;names)
+00192 {
+00193 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00194 <font class="keywordflow">for</font>(uint i=0; i&lt;names.size(); i++)
+00195 {
+00196 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a5">unloadZoneIG</a>(names[i]);
+00197 }
+00198 }
+00199
+00200 <font class="comment">// ***************************************************************************</font>
+<a name="l00201"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a5">00201</a> <font class="keywordtype">void</font> CLandscapeIGManager::unloadZoneIG(<font class="keyword">const</font> std::string &amp;name)
+00202 {
+00203 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00204 <font class="keywordflow">if</font>(name==<font class="stringliteral">""</font>)
+00205 <font class="keywordflow">return</font>;
+00206
+00207 <font class="comment">// try to find this InstanceGroup.</font>
+00208 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#u1">ItZoneInstanceGroupMap</a> it;
+00209 it= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.find( <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#c0">translateName</a>(name) );
+00210
+00211 <font class="comment">// if found.</font>
+00212 <font class="keywordflow">if</font>( it!= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end() )
+00213 {
+00214 <font class="comment">// if really added to the scene.</font>
+00215 <font class="keywordflow">if</font>( it-&gt;second.AddedToScene )
+00216 {
+00217 <font class="comment">// remove from the scene.</font>
+00218 it-&gt;second.Ig-&gt;removeFromScene(*<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o0">_Scene</a>);
+00219 it-&gt;second.AddedToScene= <font class="keyword">false</font>;
+00220 }
+00221 }
+00222 }
+00223
+00224 <font class="comment">// ***************************************************************************</font>
+<a name="l00225"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a7">00225</a> <font class="keywordtype">bool</font> CLandscapeIGManager::isIGAddedToScene(<font class="keyword">const</font> std::string &amp;name)<font class="keyword"> const</font>
+00226 <font class="keyword"></font>{
+00227 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00228 <font class="keywordflow">if</font>(name==<font class="stringliteral">""</font>)
+00229 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00230
+00231 <font class="comment">// try to find this InstanceGroup.</font>
+00232 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#u2">ConstItZoneInstanceGroupMap</a> it;
+00233 it= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.find( <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#c0">translateName</a>(name) );
+00234
+00235 <font class="comment">// if found.</font>
+00236 <font class="keywordflow">if</font>( it!= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end() )
+00237 <font class="keywordflow">return</font> it-&gt;second.AddedToScene;
+00238 <font class="keywordflow">else</font>
+00239 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00240 }
+00241
+00242 <font class="comment">// ***************************************************************************</font>
+<a name="l00243"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a8">00243</a> UInstanceGroup *CLandscapeIGManager::getIG(<font class="keyword">const</font> std::string &amp;name)<font class="keyword"> const</font>
+00244 <font class="keyword"></font>{
+00245 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00246 <font class="keywordflow">if</font>(name==<font class="stringliteral">""</font>)
+00247 <font class="keywordflow">return</font> NULL;
+00248
+00249 <font class="comment">// try to find this InstanceGroup.</font>
+00250 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#u2">ConstItZoneInstanceGroupMap</a> it;
+00251 it= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.find( <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#c0">translateName</a>(name) );
+00252
+00253 <font class="comment">// if found.</font>
+00254 <font class="keywordflow">if</font>( it!= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end() )
+00255 <font class="keywordflow">return</font> it-&gt;second.Ig;
+00256 <font class="keywordflow">else</font>
+00257 <font class="keywordflow">return</font> NULL;
+00258 }
+00259
+00260
+00261 <font class="comment">// ***************************************************************************</font>
+<a name="l00262"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#c0">00262</a> std::string CLandscapeIGManager::translateName(<font class="keyword">const</font> std::string &amp;name)<font class="keyword"> const</font>
+00263 <font class="keyword"></font>{
+00264 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00265 std::string ret;
+00266 ret= name + <font class="stringliteral">".ig"</font>;
+00267 strupr(ret);
+00268
+00269 <font class="keywordflow">return</font> ret;
+00270 }
+00271
+00272
+00273 <font class="comment">// ***************************************************************************</font>
+<a name="l00274"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a9">00274</a> <font class="keywordtype">void</font> CLandscapeIGManager::reset()
+00275 {
+00276 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00277 <font class="keywordflow">while</font>( <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin() != <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end() )
+00278 {
+00279 string name= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin()-&gt;first;
+00280 <font class="comment">// first remove from scene</font>
+00281 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a5">unloadZoneIG</a>( name.substr(0, name.find(<font class="charliteral">'.'</font>)) );
+00282
+00283 <font class="comment">// then delete this entry.</font>
+00284 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin()-&gt;second.release();
+00285 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.erase(<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin());
+00286 }
+00287
+00288 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o0">_Scene</a>=NULL;
+00289 }
+00290
+00291
+00292 <font class="comment">// ***************************************************************************</font>
+<a name="l00293"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a10">00293</a> <font class="keywordtype">void</font> CLandscapeIGManager::reloadAllIgs()
+00294 {
+00295 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00296 vector&lt;std::string&gt; bkupIgFileNameList;
+00297 vector&lt;bool&gt; bkupIgAddedToScene;
+00298
+00299 <font class="comment">// First, erase all igs.</font>
+00300 <font class="keywordflow">while</font>( <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin() != <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end() )
+00301 {
+00302 string name= <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin()-&gt;first;
+00303
+00304 <font class="comment">// bkup the state of this ig.</font>
+00305 bkupIgFileNameList.push_back(<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin()-&gt;second.FileName);
+00306 bkupIgAddedToScene.push_back(<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin()-&gt;second.AddedToScene);
+00307
+00308 <font class="comment">// first remove from scene</font>
+00309 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a5">unloadZoneIG</a>( name.substr(0, name.find(<font class="charliteral">'.'</font>)) );
+00310
+00311 <font class="comment">// then delete this entry.</font>
+00312 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin()-&gt;second.release();
+00313 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.erase(<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin());
+00314 }
+00315
+00316 <font class="comment">// Then reload all Igs.</font>
+00317 <font class="keywordflow">for</font>(uint i=0; i&lt;bkupIgFileNameList.size(); i++)
+00318 {
+00319 <font class="keyword">const</font> <font class="keywordtype">char</font> *token= bkupIgFileNameList[i].c_str();
+00320 UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(token);
+00321 <font class="comment">// add it to the map.</font>
+00322 string tokId= token;
+00323 strupr(tokId);
+00324 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>[tokId]= CInstanceGroupElement(ig, token);
+00325
+00326 <font class="comment">// If was addedToScene before, re-add to scene now.</font>
+00327 <font class="keywordflow">if</font>(bkupIgAddedToScene[i])
+00328 {
+00329 <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a3">loadZoneIG</a>( tokId.substr(0, tokId.find(<font class="charliteral">'.'</font>)) );
+00330 }
+00331 }
+00332 }
+00333
+00334
+00335 <font class="comment">// ***************************************************************************</font>
+<a name="l00336"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a11">00336</a> <font class="keywordtype">void</font> CLandscapeIGManager::getAllIG(std::vector&lt;UInstanceGroup *&gt; &amp;dest)<font class="keyword"> const</font>
+00337 <font class="keyword"></font>{
+00338 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00339 dest.clear();
+00340 dest.reserve(<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.size());
+00341 <font class="comment">// add the instances</font>
+00342 <font class="keywordflow">for</font>(TZoneInstanceGroupMap::const_iterator it = <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin(); it != <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end(); ++it)
+00343 {
+00344 dest.push_back(it-&gt;second.Ig);
+00345 }
+00346 }
+00347
+00348 <font class="comment">// ***************************************************************************</font>
+<a name="l00349"></a><a class="code" href="classNL3D_1_1CLandscapeIGManager.html#a12">00349</a> <font class="keywordtype">void</font> CLandscapeIGManager::getAllIGWithNames(std::vector&lt;std::pair&lt;UInstanceGroup *, std::string&gt; &gt; &amp;dest)<font class="keyword"> const</font>
+00350 <font class="keyword"></font>{
+00351 <a class="code" href="landscapeig__manager_8h.html#a0">NL3D_MEM_LANDSCAPE_IG</a>
+00352 dest.clear();
+00353 dest.reserve(<a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.size());
+00354 <font class="comment">// add the instances</font>
+00355 <font class="keywordflow">for</font>(TZoneInstanceGroupMap::const_iterator it = <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.begin(); it != <a class="code" href="classNL3D_1_1CLandscapeIGManager.html#o1">_ZoneInstanceGroupMap</a>.end(); ++it)
+00356 {
+00357 dest.push_back(std::make_pair(it-&gt;second.Ig, it-&gt;second.FileName));
+00358 }
+00359 }
+00360
+00361
+00362 } <font class="comment">// NL3D</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>