aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/primitive_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/primitive_8cpp-source.html1965
1 files changed, 1965 insertions, 0 deletions
diff --git a/docs/doxygen/nel/primitive_8cpp-source.html b/docs/doxygen/nel/primitive_8cpp-source.html
new file mode 100644
index 00000000..da3c406d
--- /dev/null
+++ b/docs/doxygen/nel/primitive_8cpp-source.html
@@ -0,0 +1,1965 @@
+<!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>primitive.cpp</h1><a href="primitive_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="primitive_8h.html">nel/ligo/primitive.h</a>"</font>
+00027 <font class="preprocessor">#include "<a class="code" href="i__xml_8h.html">nel/misc/i_xml.h</a>"</font>
+00028
+00029 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00030 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00031
+<a name="l00032"></a><a class="code" href="primitive_8cpp.html#a0">00032</a> <font class="preprocessor">#define NLLIGO_PRIMITVE_VERSION 0</font>
+00033 <font class="preprocessor"></font>
+00034 <font class="keyword">namespace </font>NLLIGO
+00035 {
+00036
+00037 <font class="comment">// ***************************************************************************</font>
+00038 <font class="comment">// XML helpers</font>
+00039 <font class="comment">// ***************************************************************************</font>
+00040
+00041 <font class="keywordtype">void</font> <a class="code" href="namespaceNLLIGO.html#a2">Error</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ...)
+00042 {
+00043 va_list args;
+00044 va_start( args, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a> );
+00045 <font class="keywordtype">char</font> buffer[1024];
+00046 sint ret = vsnprintf( buffer, 1024, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, args );
+00047 va_end( args );
+00048
+00049 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"In File (%s) %s"</font>, filename, buffer);
+00050 }
+00051
+00052 <font class="comment">// ***************************************************************************</font>
+00053
+00054 <font class="keywordtype">void</font> <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ... )
+00055 {
+00056 va_list args;
+00057 va_start( args, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a> );
+00058 <font class="keywordtype">char</font> buffer[1024];
+00059 sint ret = vsnprintf( buffer, 1024, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, args );
+00060 va_end( args );
+00061
+00062 <a class="code" href="namespaceNLLIGO.html#a2">Error</a> (filename, <font class="stringliteral">"node (%s), line (%d) : %s"</font>, xmlNode-&gt;name, (<font class="keywordtype">int</font>)xmlNode-&gt;content, buffer);
+00063 }
+00064
+00065
+00066 <font class="comment">// ***************************************************************************</font>
+00067
+00068 xmlNodePtr <a class="code" href="namespaceNLLIGO.html#a4">GetFirstChildNode</a> (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, <font class="keyword">const</font> <font class="keywordtype">char</font> *childName)
+00069 {
+00070 <font class="comment">// Call the CIXml version</font>
+00071 xmlNodePtr result;
+00072 <font class="keywordflow">if</font> ((result = CIXml::getFirstChildNode (xmlNode, childName)))
+00073 {
+00074 <font class="keywordflow">return</font> result;
+00075 }
+00076 <font class="keywordflow">else</font>
+00077 {
+00078 <font class="comment">// Output a formated error</font>
+00079 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (xmlNode, filename, <font class="stringliteral">"Can't find XML node named (%s)"</font>, childName);
+00080 <font class="keywordflow">return</font> NULL;
+00081 }
+00082 }
+00083
+00084 <font class="comment">// ***************************************************************************</font>
+00085
+00086 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (string &amp;result, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *propName)
+00087 {
+00088 <font class="comment">// Call the CIXml version</font>
+00089 <font class="keywordflow">if</font> (!CIXml::getPropertyString (result, xmlNode, propName))
+00090 {
+00091 <font class="comment">// Output a formated error</font>
+00092 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (xmlNode, filename, <font class="stringliteral">"Can't find XML node property (%s)"</font>, propName);
+00093 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00094 }
+00095 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00096 }
+00097
+00098 <font class="comment">// ***************************************************************************</font>
+00099
+00100 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLLIGO.html#a6">ReadFloat</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *propName, <font class="keywordtype">float</font> &amp;result, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, xmlNodePtr xmlNode)
+00101 {
+00102 string <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>;
+00103 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, filename, xmlNode, propName))
+00104 {
+00105 result = (float)atof (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>.c_str ());
+00106 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00107 }
+00108 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00109 }
+00110
+00111 <font class="comment">// ***************************************************************************</font>
+00112
+00113 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLLIGO.html#a7">ReadVector</a> (CPrimVector &amp;point, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, xmlNodePtr xmlNode)
+00114 {
+00115 CPrimVector pos;
+00116 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a6">ReadFloat</a> (<font class="stringliteral">"X"</font>, pos.x, filename, xmlNode))
+00117 {
+00118 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a6">ReadFloat</a> (<font class="stringliteral">"Y"</font>, pos.y, filename, xmlNode))
+00119 {
+00120 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a6">ReadFloat</a> (<font class="stringliteral">"Z"</font>, pos.z, filename, xmlNode))
+00121 {
+00122 pos.Selected = <font class="keyword">false</font>;
+00123 string result;
+00124 <font class="keywordflow">if</font> (CIXml::getPropertyString (result, xmlNode, <font class="stringliteral">"SELECTED"</font>))
+00125 {
+00126 <font class="keywordflow">if</font> (result == <font class="stringliteral">"true"</font>)
+00127 pos.Selected = <font class="keyword">true</font>;
+00128 }
+00129 point = pos;
+00130 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00131 }
+00132 }
+00133 }
+00134 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00135 }
+00136
+00137 <font class="comment">// ***************************************************************************</font>
+00138
+00139 <font class="keywordtype">void</font> <a class="code" href="namespaceNLLIGO.html#a8">WriteVector</a> (<font class="keyword">const</font> CPrimVector &amp;point, xmlNodePtr xmlNode)
+00140 {
+00141 <font class="comment">// Set properties</font>
+00142 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"X"</font>, (<font class="keyword">const</font> xmlChar*)(toString (point.x).c_str ()));
+00143 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Y"</font>, (<font class="keyword">const</font> xmlChar*)(toString (point.y).c_str ()));
+00144 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Z"</font>, (<font class="keyword">const</font> xmlChar*)(toString (point.z).c_str ()));
+00145 <font class="keywordflow">if</font> (point.Selected)
+00146 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"SELECTED"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"true"</font>);
+00147 }
+00148
+00149 <font class="comment">// ***************************************************************************</font>
+00150
+00151 <font class="keywordtype">void</font> <a class="code" href="namespaceNLLIGO.html#a9">WriteFloat</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *propName, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, xmlNodePtr xmlNode)
+00152 {
+00153 <font class="comment">// Set properties</font>
+00154 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)propName, (<font class="keyword">const</font> xmlChar*)(toString (value).c_str ()));
+00155 }
+00156
+00157 <font class="comment">// ***************************************************************************</font>
+00158
+00159 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLLIGO.html#a10">GetNodeString</a> (string &amp;result, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *nodeName)
+00160 {
+00161 <font class="comment">// Look for the node</font>
+00162 xmlNodePtr node = CIXml::getFirstChildNode (xmlNode, nodeName);
+00163 <font class="keywordflow">if</font> (!node)
+00164 {
+00165 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (xmlNode, filename, <font class="stringliteral">"Can't find XML node named (%s)"</font>, nodeName);
+00166 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00167 }
+00168
+00169 <font class="comment">// Get the node string</font>
+00170 <font class="keywordflow">if</font> (!CIXml::getContentString (result, node))
+00171 {
+00172 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (xmlNode, filename, <font class="stringliteral">"Can't find any text in the node named (%s)"</font>, nodeName);
+00173 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00174 }
+00175
+00176 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00177 }
+00178
+00179 <font class="comment">// ***************************************************************************</font>
+00180
+00181 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLLIGO.html#a11">GetContentString</a> (string &amp;result, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, xmlNodePtr xmlNode)
+00182 {
+00183 <font class="comment">// Get the node string</font>
+00184 <font class="keywordflow">if</font> (!CIXml::getContentString (result, xmlNode))
+00185 {
+00186 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (xmlNode, filename, <font class="stringliteral">"Can't find any text in the node"</font>);
+00187 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00188 }
+00189
+00190 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00191 }
+00192
+00193 <font class="comment">// ***************************************************************************</font>
+00194 <font class="comment">// CPropertyString</font>
+00195 <font class="comment">// ***************************************************************************</font>
+00196
+<a name="l00197"></a><a class="code" href="classNLLIGO_1_1CPropertyString.html#a1">00197</a> CPropertyString::CPropertyString (<font class="keyword">const</font> <font class="keywordtype">char</font> *str)
+00198 {
+00199 <a class="code" href="classNLLIGO_1_1CPropertyString.html#m0">String</a> = str;
+00200 }
+00201
+00202 <font class="comment">// ***************************************************************************</font>
+00203 <font class="comment">// CPropertyStringArray</font>
+00204 <font class="comment">// ***************************************************************************</font>
+00205
+<a name="l00206"></a><a class="code" href="classNLLIGO_1_1CPropertyStringArray.html#a1">00206</a> CPropertyStringArray::CPropertyStringArray (<font class="keyword">const</font> std::vector&lt;std::string&gt; &amp;stringArray)
+00207 {
+00208 <a class="code" href="classNLLIGO_1_1CPropertyStringArray.html#m0">StringArray</a> = stringArray;
+00209 }
+00210
+00211 <font class="comment">// ***************************************************************************</font>
+00212
+<a name="l00213"></a><a class="code" href="classNLLIGO_1_1CPrimPoint.html#a1">00213</a> <font class="keywordtype">void</font> CPrimPoint::serial (IStream &amp;f)
+00214 {
+00215 f.xmlPushBegin (<font class="stringliteral">"POINT"</font>);
+00216
+00217 f.xmlSetAttrib (<font class="stringliteral">"NAME"</font>);
+00218 f.serial (<a class="code" href="classNLLIGO_1_1IPrimitive.html#m1">Name</a>);
+00219 f.xmlSetAttrib (<font class="stringliteral">"LAYER"</font>);
+00220 f.serial (<a class="code" href="classNLLIGO_1_1IPrimitive.html#m0">Layer</a>);
+00221 f.xmlPushEnd ();
+00222
+00223 f.serial (<a class="code" href="classNLLIGO_1_1CPrimPoint.html#m0">Point</a>);
+00224
+00225 <font class="keywordflow">if</font> (f.isReading ())
+00226 {
+00227 <a class="code" href="classNLLIGO_1_1CPrimPoint.html#m1">Angle</a> = 0;
+00228 }
+00229
+00230 f.xmlPop ();
+00231 }
+00232
+00233 <font class="comment">// ***************************************************************************</font>
+<a name="l00234"></a><a class="code" href="classNLLIGO_1_1CPrimPath.html#a0">00234</a> <font class="keywordtype">void</font> CPrimPath::serial (IStream &amp;f)
+00235 {
+00236 f.xmlPushBegin (<font class="stringliteral">"PATH"</font>);
+00237
+00238 f.xmlSetAttrib (<font class="stringliteral">"NAME"</font>);
+00239 f.serial (<a class="code" href="classNLLIGO_1_1IPrimitive.html#m1">Name</a>);
+00240 f.xmlSetAttrib (<font class="stringliteral">"LAYER"</font>);
+00241 f.serial (<a class="code" href="classNLLIGO_1_1IPrimitive.html#m0">Layer</a>);
+00242 f.xmlPushEnd ();
+00243
+00244 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>);
+00245
+00246 f.xmlPop ();
+00247 }
+00248
+00249 <font class="comment">// ***************************************************************************</font>
+00250
+<a name="l00251"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#d3">00251</a> <font class="keywordtype">bool</font> CPrimZone::contains (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keyword">const</font> std::vector&lt;CPrimVector&gt; &amp;points)
+00252 {
+00253 uint32 i;
+00254 CVector vMin, vMax;
+00255
+00256 <font class="comment">// Point or line can't contains !</font>
+00257 <font class="keywordflow">if</font> (points.size() &lt; 3)
+00258 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00259
+00260 <font class="comment">// Get the bounding rectangle of the zone</font>
+00261 vMax = vMin = points[0];
+00262 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00263 {
+00264 <font class="keywordflow">if</font> (vMin.x &gt; points[i].x)
+00265 vMin.x = points[i].x;
+00266 <font class="keywordflow">if</font> (vMin.y &gt; points[i].y)
+00267 vMin.y = points[i].y;
+00268
+00269 <font class="keywordflow">if</font> (vMax.x &lt; points[i].x)
+00270 vMax.x = points[i].x;
+00271 <font class="keywordflow">if</font> (vMax.y &lt; points[i].y)
+00272 vMax.y = points[i].y;
+00273 }
+00274
+00275 <font class="keywordflow">if</font> ((v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &lt; vMin.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &lt; vMin.y) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &gt; vMax.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &gt; vMax.y))
+00276 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00277
+00278 uint32 nNbIntersection = 0;
+00279 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00280 {
+00281 <font class="keyword">const</font> CVector &amp;p1 = points[i];
+00282 <font class="keyword">const</font> CVector &amp;p2 = points[(i+1)%points.size()];
+00283
+00284 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0))
+00285 <font class="keywordflow">continue</font>;
+00286 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0))
+00287 <font class="keywordflow">continue</font>;
+00288 <font class="keywordtype">float</font> xinter = p1.x + (p2.x-p1.x) * ((v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>-p1.y)/(p2.y-p1.y));
+00289 <font class="keywordflow">if</font> (xinter &gt; v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>)
+00290 ++nNbIntersection;
+00291 }
+00292 <font class="keywordflow">if</font> ((nNbIntersection&amp;1) == 1) <font class="comment">// odd intersections so the vertex is inside</font>
+00293 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00294 <font class="keywordflow">else</font>
+00295 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00296 }
+00297
+00298 <font class="comment">// ***************************************************************************</font>
+00299
+<a name="l00300"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#d1">00300</a> <font class="keywordtype">bool</font> CPrimZone::contains (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keyword">const</font> std::vector&lt;NLMISC::CVector&gt; &amp;points)
+00301 {
+00302 uint32 i;
+00303 CVector vMin, vMax;
+00304
+00305 <font class="comment">// Point or line can't contains !</font>
+00306 <font class="keywordflow">if</font> (points.size() &lt; 3)
+00307 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00308
+00309 <font class="comment">// Get the bounding rectangle of the zone</font>
+00310 vMax = vMin = points[0];
+00311 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00312 {
+00313 <font class="keywordflow">if</font> (vMin.x &gt; points[i].x)
+00314 vMin.x = points[i].x;
+00315 <font class="keywordflow">if</font> (vMin.y &gt; points[i].y)
+00316 vMin.y = points[i].y;
+00317
+00318 <font class="keywordflow">if</font> (vMax.x &lt; points[i].x)
+00319 vMax.x = points[i].x;
+00320 <font class="keywordflow">if</font> (vMax.y &lt; points[i].y)
+00321 vMax.y = points[i].y;
+00322 }
+00323
+00324 <font class="keywordflow">if</font> ((v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &lt; vMin.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &lt; vMin.y) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &gt; vMax.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &gt; vMax.y))
+00325 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00326
+00327 uint32 nNbIntersection = 0;
+00328 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00329 {
+00330 <font class="keyword">const</font> CVector &amp;p1 = points[i];
+00331 <font class="keyword">const</font> CVector &amp;p2 = points[(i+1)%points.size()];
+00332
+00333 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0))
+00334 <font class="keywordflow">continue</font>;
+00335 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0))
+00336 <font class="keywordflow">continue</font>;
+00337 <font class="keywordtype">float</font> xinter = p1.x + (p2.x-p1.x) * ((v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>-p1.y)/(p2.y-p1.y));
+00338 <font class="keywordflow">if</font> (xinter &gt; v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>)
+00339 ++nNbIntersection;
+00340 }
+00341 <font class="keywordflow">if</font> ((nNbIntersection&amp;1) == 1) <font class="comment">// odd intersections so the vertex is inside</font>
+00342 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00343 <font class="keywordflow">else</font>
+00344 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00345 }
+00346
+00347 <font class="comment">// ***************************************************************************</font>
+00348 <font class="comment">// CPrimNode</font>
+00349 <font class="comment">// ***************************************************************************</font>
+00350
+<a name="l00351"></a><a class="code" href="classNLLIGO_1_1CPrimNode.html#c3">00351</a> <font class="keywordtype">bool</font> CPrimNode::read (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, uint version)
+00352 {
+00353 <font class="keywordflow">return</font> IPrimitive::read (xmlNode, filename, version);
+00354 }
+00355
+00356 <font class="comment">// ***************************************************************************</font>
+00357
+<a name="l00358"></a><a class="code" href="classNLLIGO_1_1CPrimNode.html#c4">00358</a> <font class="keywordtype">void</font> CPrimNode::write (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)<font class="keyword"> const</font>
+00359 <font class="keyword"></font>{
+00360 <font class="comment">// Set the type</font>
+00361 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"TYPE"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"node"</font>);
+00362
+00363 IPrimitive::write (xmlNode, filename);
+00364 }
+00365
+00366 <font class="comment">// ***************************************************************************</font>
+00367
+<a name="l00368"></a><a class="code" href="classNLLIGO_1_1CPrimNode.html#c0">00368</a> uint CPrimNode::getNumVector ()<font class="keyword"> const</font>
+00369 <font class="keyword"></font>{
+00370 <font class="keywordflow">return</font> 0;
+00371 }
+00372
+00373 <font class="comment">// ***************************************************************************</font>
+00374
+<a name="l00375"></a><a class="code" href="classNLLIGO_1_1CPrimNode.html#c1">00375</a> <font class="keyword">const</font> CPrimVector *CPrimNode::getPrimVector ()<font class="keyword"> const</font>
+00376 <font class="keyword"></font>{
+00377 <font class="keywordflow">return</font> NULL;
+00378 }
+00379
+00380 <font class="comment">// ***************************************************************************</font>
+00381
+<a name="l00382"></a><a class="code" href="classNLLIGO_1_1CPrimNode.html#c2">00382</a> CPrimVector *CPrimNode::getPrimVector ()
+00383 {
+00384 <font class="keywordflow">return</font> NULL;
+00385 }
+00386
+00387 <font class="comment">// ***************************************************************************</font>
+00388 <font class="comment">// CPrimNode</font>
+00389 <font class="comment">// ***************************************************************************</font>
+00390
+00391 <font class="comment">/*void CPrimNode::operator= (const CPrimNode &amp;node)</font>
+00392 <font class="comment">{</font>
+00393 <font class="comment"> // Copy the IPrimitive</font>
+00394 <font class="comment"> IPrimitive::operator= (node);</font>
+00395 <font class="comment">}</font>
+00396 <font class="comment"></font>
+00397 <font class="comment">// ***************************************************************************</font>
+00398 <font class="comment"></font>
+00399 <font class="comment">void CPrimPoint::operator= (const CPrimPoint &amp;node)</font>
+00400 <font class="comment">{</font>
+00401 <font class="comment"> // Copy the IPrimitive</font>
+00402 <font class="comment"> IPrimitive::operator= (node);</font>
+00403 <font class="comment">}</font>
+00404 <font class="comment"></font>
+00405 <font class="comment">// ***************************************************************************</font>
+00406 <font class="comment"></font>
+00407 <font class="comment">void CPrimPath::operator= (const CPrimPath &amp;node)</font>
+00408 <font class="comment">{</font>
+00409 <font class="comment"> // Copy the IPrimitive</font>
+00410 <font class="comment">}</font>
+00411 <font class="comment"></font>
+00412 <font class="comment">// ***************************************************************************</font>
+00413 <font class="comment"></font>
+00414 <font class="comment">void CPrimZone::operator= (const CPrimZone &amp;node)</font>
+00415 <font class="comment">{</font>
+00416 <font class="comment"> // Copy the IPrimitive</font>
+00417 <font class="comment"> IPrimitive::operator= (node);</font>
+00418 <font class="comment">}</font>
+00419 <font class="comment">*/</font>
+00420
+00421 <font class="comment">// ***************************************************************************</font>
+00422
+<a name="l00423"></a><a class="code" href="classNLLIGO_1_1CPrimPoint.html#c0">00423</a> uint CPrimPoint::getNumVector ()<font class="keyword"> const</font>
+00424 <font class="keyword"></font>{
+00425 <font class="keywordflow">return</font> 1;
+00426 }
+00427
+00428 <font class="comment">// ***************************************************************************</font>
+00429
+<a name="l00430"></a><a class="code" href="classNLLIGO_1_1CPrimPoint.html#c1">00430</a> <font class="keyword">const</font> CPrimVector *CPrimPoint::getPrimVector ()<font class="keyword"> const</font>
+00431 <font class="keyword"></font>{
+00432 <font class="keywordflow">return</font> &amp;<a class="code" href="classNLLIGO_1_1CPrimPoint.html#m0">Point</a>;
+00433 }
+00434
+00435 <font class="comment">// ***************************************************************************</font>
+00436
+<a name="l00437"></a><a class="code" href="classNLLIGO_1_1CPrimPoint.html#c2">00437</a> CPrimVector *CPrimPoint::getPrimVector ()
+00438 {
+00439 <font class="keywordflow">return</font> &amp;<a class="code" href="classNLLIGO_1_1CPrimPoint.html#m0">Point</a>;
+00440 }
+00441
+00442 <font class="comment">// ***************************************************************************</font>
+00443
+<a name="l00444"></a><a class="code" href="classNLLIGO_1_1CPrimPoint.html#c3">00444</a> <font class="keywordtype">bool</font> CPrimPoint::read (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, uint version)
+00445 {
+00446 <font class="comment">// Read points</font>
+00447 xmlNodePtr ptNode = <a class="code" href="namespaceNLLIGO.html#a4">GetFirstChildNode</a> (xmlNode, filename, <font class="stringliteral">"PT"</font>);
+00448 <font class="keywordflow">if</font> (ptNode)
+00449 {
+00450 <font class="comment">// Read a vector</font>
+00451 <font class="keywordflow">if</font> (!<a class="code" href="namespaceNLLIGO.html#a7">ReadVector</a> (<a class="code" href="classNLLIGO_1_1CPrimPoint.html#m0">Point</a>, filename, ptNode))
+00452 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00453
+00454 ptNode = <a class="code" href="namespaceNLLIGO.html#a4">GetFirstChildNode</a> (xmlNode, filename, <font class="stringliteral">"ANGLE"</font>);
+00455 <font class="keywordflow">if</font> (ptNode)
+00456 {
+00457 <font class="comment">// Read a float</font>
+00458 <font class="keywordflow">if</font> (!<a class="code" href="namespaceNLLIGO.html#a6">ReadFloat</a> (<font class="stringliteral">"VALUE"</font>, <a class="code" href="classNLLIGO_1_1CPrimPoint.html#m1">Angle</a>, filename, ptNode))
+00459 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00460 }
+00461 <font class="keywordflow">else</font>
+00462 <a class="code" href="classNLLIGO_1_1CPrimPoint.html#m1">Angle</a> = 0;
+00463 }
+00464 <font class="keywordflow">else</font>
+00465 {
+00466 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00467 }
+00468
+00469 <font class="keywordflow">return</font> IPrimitive::read (xmlNode, filename, version);
+00470 }
+00471
+00472 <font class="comment">// ***************************************************************************</font>
+00473
+<a name="l00474"></a><a class="code" href="classNLLIGO_1_1CPrimPoint.html#c4">00474</a> <font class="keywordtype">void</font> CPrimPoint::write (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)<font class="keyword"> const</font>
+00475 <font class="keyword"></font>{
+00476 <font class="comment">// Set the type</font>
+00477 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"TYPE"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"point"</font>);
+00478
+00479 <font class="comment">// Save the point</font>
+00480 xmlNodePtr ptNode = xmlNewChild ( xmlNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"PT"</font>, NULL);
+00481 <a class="code" href="namespaceNLLIGO.html#a8">WriteVector</a> (<a class="code" href="classNLLIGO_1_1CPrimPoint.html#m0">Point</a>, ptNode);
+00482
+00483 <font class="comment">// Save the angle</font>
+00484 <font class="keywordflow">if</font> (<a class="code" href="classNLLIGO_1_1CPrimPoint.html#m1">Angle</a> != 0)
+00485 {
+00486 xmlNodePtr ptNode = xmlNewChild ( xmlNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"ANGLE"</font>, NULL);
+00487 <a class="code" href="namespaceNLLIGO.html#a9">WriteFloat</a> (<font class="stringliteral">"VALUE"</font>, <a class="code" href="classNLLIGO_1_1CPrimPoint.html#m1">Angle</a>, ptNode);
+00488 }
+00489
+00490 IPrimitive::write (xmlNode, filename);
+00491 }
+00492
+00493 <font class="comment">// ***************************************************************************</font>
+00494 <font class="comment">// CPrimPath</font>
+00495 <font class="comment">// ***************************************************************************</font>
+00496
+<a name="l00497"></a><a class="code" href="classNLLIGO_1_1CPrimPath.html#c0">00497</a> uint CPrimPath::getNumVector ()<font class="keyword"> const</font>
+00498 <font class="keyword"></font>{
+00499 <font class="keywordflow">return</font> <a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>.size ();
+00500 }
+00501
+00502 <font class="comment">// ***************************************************************************</font>
+00503
+<a name="l00504"></a><a class="code" href="classNLLIGO_1_1CPrimPath.html#c1">00504</a> <font class="keyword">const</font> CPrimVector *CPrimPath::getPrimVector ()<font class="keyword"> const</font>
+00505 <font class="keyword"></font>{
+00506 <font class="keywordflow">return</font> &amp;(<a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>[0]);
+00507 }
+00508
+00509 <font class="comment">// ***************************************************************************</font>
+00510
+<a name="l00511"></a><a class="code" href="classNLLIGO_1_1CPrimPath.html#c2">00511</a> CPrimVector *CPrimPath::getPrimVector ()
+00512 {
+00513 <font class="keywordflow">return</font> &amp;(<a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>[0]);
+00514 }
+00515
+00516 <font class="comment">// ***************************************************************************</font>
+00517
+<a name="l00518"></a><a class="code" href="classNLLIGO_1_1CPrimPath.html#c3">00518</a> <font class="keywordtype">bool</font> CPrimPath::read (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, uint version)
+00519 {
+00520 <font class="comment">// Read points</font>
+00521 <a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>.clear ();
+00522 <a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>.reserve (CIXml::countChildren (xmlNode, <font class="stringliteral">"PT"</font>));
+00523 xmlNodePtr ptNode = CIXml::getFirstChildNode (xmlNode, <font class="stringliteral">"PT"</font>);
+00524 <font class="keywordflow">if</font> (ptNode)
+00525 {
+00526 <font class="keywordflow">do</font>
+00527 {
+00528 <font class="comment">// Read a vector</font>
+00529 <a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>.push_back (CPrimVector ());
+00530 <font class="keywordflow">if</font> (!<a class="code" href="namespaceNLLIGO.html#a7">ReadVector</a> (<a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>.back (), filename, ptNode))
+00531 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00532 }
+00533 <font class="keywordflow">while</font> ((ptNode = CIXml::getNextChildNode (ptNode, <font class="stringliteral">"PT"</font>)));
+00534 }
+00535
+00536 <font class="keywordflow">return</font> IPrimitive::read (xmlNode, filename, version);
+00537 }
+00538
+00539 <font class="comment">// ***************************************************************************</font>
+00540
+<a name="l00541"></a><a class="code" href="classNLLIGO_1_1CPrimPath.html#c4">00541</a> <font class="keywordtype">void</font> CPrimPath::write (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)<font class="keyword"> const</font>
+00542 <font class="keyword"></font>{
+00543 <font class="comment">// Set the type</font>
+00544 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"TYPE"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"path"</font>);
+00545
+00546 <font class="comment">// Save the points</font>
+00547 <font class="keywordflow">for</font> (uint i=0; i&lt;<a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>.size (); i++)
+00548 {
+00549 xmlNodePtr ptNode = xmlNewChild ( xmlNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"PT"</font>, NULL);
+00550 <a class="code" href="namespaceNLLIGO.html#a8">WriteVector</a> (<a class="code" href="classNLLIGO_1_1CPrimPath.html#m0">VPoints</a>[i], ptNode);
+00551 }
+00552
+00553 IPrimitive::write (xmlNode, filename);
+00554 }
+00555
+00556 <font class="comment">// ***************************************************************************</font>
+00557 <font class="comment">// CPrimZone</font>
+00558 <font class="comment">// ***************************************************************************</font>
+00559
+<a name="l00560"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#c0">00560</a> uint CPrimZone::getNumVector ()<font class="keyword"> const</font>
+00561 <font class="keyword"></font>{
+00562 <font class="keywordflow">return</font> <a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>.size ();
+00563 }
+00564
+00565 <font class="comment">// ***************************************************************************</font>
+00566
+<a name="l00567"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#c1">00567</a> <font class="keyword">const</font> CPrimVector *CPrimZone::getPrimVector ()<font class="keyword"> const</font>
+00568 <font class="keyword"></font>{
+00569 <font class="keywordflow">return</font> &amp;(<a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>[0]);
+00570 }
+00571
+00572 <font class="comment">// ***************************************************************************</font>
+00573
+<a name="l00574"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#c2">00574</a> CPrimVector *CPrimZone::getPrimVector ()
+00575 {
+00576 <font class="keywordflow">return</font> &amp;(<a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>[0]);
+00577 }
+00578
+00579 <font class="comment">// ***************************************************************************</font>
+00580
+<a name="l00581"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#c3">00581</a> <font class="keywordtype">bool</font> CPrimZone::read (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, uint version)
+00582 {
+00583 <font class="comment">// Read points</font>
+00584 <a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>.clear ();
+00585 <a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>.reserve (CIXml::countChildren (xmlNode, <font class="stringliteral">"PT"</font>));
+00586 xmlNodePtr ptNode = CIXml::getFirstChildNode (xmlNode, <font class="stringliteral">"PT"</font>);
+00587 <font class="keywordflow">if</font> (ptNode)
+00588 {
+00589 <font class="keywordflow">do</font>
+00590 {
+00591 <font class="comment">// Read a vector</font>
+00592 <a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>.push_back (CPrimVector ());
+00593 <font class="keywordflow">if</font> (!<a class="code" href="namespaceNLLIGO.html#a7">ReadVector</a> (<a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>.back (), filename, ptNode))
+00594 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00595 }
+00596 <font class="keywordflow">while</font> ((ptNode = CIXml::getNextChildNode (ptNode, <font class="stringliteral">"PT"</font>)));
+00597 }
+00598
+00599 <font class="keywordflow">return</font> IPrimitive::read (xmlNode, filename, version);
+00600 }
+00601
+00602 <font class="comment">// ***************************************************************************</font>
+00603
+<a name="l00604"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#c4">00604</a> <font class="keywordtype">void</font> CPrimZone::write (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)<font class="keyword"> const</font>
+00605 <font class="keyword"></font>{
+00606 <font class="comment">// Set the type</font>
+00607 xmlSetProp (xmlNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"TYPE"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"zone"</font>);
+00608
+00609 <font class="comment">// Save the points</font>
+00610 <font class="keywordflow">for</font> (uint i=0; i&lt;<a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>.size (); i++)
+00611 {
+00612 xmlNodePtr ptNode = xmlNewChild ( xmlNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"PT"</font>, NULL);
+00613 <a class="code" href="namespaceNLLIGO.html#a8">WriteVector</a> (<a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>[i], ptNode);
+00614 }
+00615
+00616 IPrimitive::write (xmlNode, filename);
+00617 }
+00618
+00619 <font class="comment">// ***************************************************************************</font>
+00620
+<a name="l00621"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#d4">00621</a> <font class="keywordtype">bool</font> CPrimZone::contains (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keyword">const</font> std::vector&lt;CPrimVector&gt; &amp;points, <font class="keywordtype">float</font> &amp;distance, <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;nearPos, <font class="keywordtype">bool</font> isPath)
+00622 {
+00623 uint32 i;
+00624 CVector vMin, vMax;
+00625 <font class="keywordtype">float</font> nearest = FLT_MAX;
+00626 CVector pos;
+00627
+00628 <font class="comment">// Point or line can't contains !</font>
+00629 <font class="keywordflow">if</font> (points.size() &lt; 3 || isPath)
+00630 {
+00631 <font class="comment">// only compute the distance.</font>
+00632 <font class="keywordflow">if</font> (points.size() == 1)
+00633 {
+00634 distance = (points[0] - v).norm();
+00635 nearPos = points[0];
+00636 }
+00637 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (points.size() == 2)
+00638 {
+00639 distance = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, points[0], points[1], nearPos);
+00640 }
+00641 <font class="keywordflow">else</font>
+00642 {
+00643 <font class="comment">// compute nearest segment</font>
+00644 <font class="keywordflow">for</font> (i = 0; i &lt; points.size()-1; ++i)
+00645 {
+00646 <font class="keyword">const</font> CVector &amp;p1 = points[i];
+00647 <font class="keyword">const</font> CVector &amp;p2 = points[i+1];
+00648
+00649 <font class="keywordtype">float</font> dist = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, p1, p2, pos);
+00650 <font class="keywordflow">if</font>( dist &lt; nearest)
+00651 {
+00652 nearest = dist;
+00653 nearPos = pos;
+00654 }
+00655 }
+00656 distance = nearest;
+00657 }
+00658 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00659 }
+00660
+00661 <font class="comment">// Get the bounding rectangle of the zone</font>
+00662 vMax = vMin = points[0];
+00663 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00664 {
+00665 vMin.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> = <a class="code" href="bit__set_8cpp.html#a0">min</a>(vMin.x, points[i].x);
+00666 vMin.y = <a class="code" href="bit__set_8cpp.html#a0">min</a>(vMin.y, points[i].y);
+00667 vMax.x = max(vMax.x, points[i].x);
+00668 vMax.y = max(vMax.y, points[i].y);
+00669 }
+00670
+00671 <font class="keywordflow">if</font> ((v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &lt; vMin.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &lt; vMin.y) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &gt; vMax.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &gt; vMax.y))
+00672 {
+00673 <font class="comment">// find the nearest distance of all segment</font>
+00674 <font class="keywordflow">for</font> (uint i=0; i&lt;points.size(); ++i)
+00675 {
+00676 <font class="keywordtype">float</font> dist = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, points[i], points[(i+1) % points.size()], pos);
+00677
+00678 <font class="keywordflow">if</font> (dist &lt; nearest)
+00679 {
+00680 nearest = dist;
+00681 nearPos = pos;
+00682 }
+00683 }
+00684 distance = nearest;
+00685 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00686 }
+00687
+00688 uint32 nNbIntersection = 0;
+00689 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00690 {
+00691 <font class="keyword">const</font> CVector &amp;p1 = points[i];
+00692 <font class="keyword">const</font> CVector &amp;p2 = points[(i+1)%points.size()];
+00693
+00694 <font class="keywordtype">float</font> dist = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, p1, p2, pos);
+00695 <font class="keywordflow">if</font>( dist &lt; nearest)
+00696 {
+00697 nearest = dist;
+00698 nearPos = pos;
+00699 }
+00700
+00701 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0))
+00702 <font class="keywordflow">continue</font>;
+00703 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0))
+00704 <font class="keywordflow">continue</font>;
+00705 <font class="keywordtype">float</font> xinter = p1.x + (p2.x-p1.x) * ((v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>-p1.y)/(p2.y-p1.y));
+00706 <font class="keywordflow">if</font> (xinter &gt; v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>)
+00707 ++nNbIntersection;
+00708 }
+00709
+00710 distance = nearest;
+00711 <font class="keywordflow">if</font> ((nNbIntersection&amp;1) == 1) <font class="comment">// odd intersections so the vertex is inside</font>
+00712 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00713 <font class="keywordflow">else</font>
+00714 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00715 }
+00716
+00717 <font class="comment">// ***************************************************************************</font>
+00718
+00719 <font class="keywordtype">bool</font> CPrimZone::contains (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keyword">const</font> std::vector&lt;CVector&gt; &amp;points, <font class="keywordtype">float</font> &amp;distance, <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;nearPos, <font class="keywordtype">bool</font> isPath)
+00720 {
+00721 uint32 i;
+00722 CVector vMin, vMax;
+00723 <font class="keywordtype">float</font> nearest = FLT_MAX;
+00724 CVector pos;
+00725
+00726 <font class="comment">// Point or line can't contains !</font>
+00727 <font class="keywordflow">if</font> (points.size() &lt; 3 || isPath)
+00728 {
+00729 <font class="comment">// only compute the distance.</font>
+00730 <font class="keywordflow">if</font> (points.size() == 1)
+00731 {
+00732 distance = (points[0] - v).norm();
+00733 nearPos = points[0];
+00734 }
+00735 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (points.size() == 2)
+00736 {
+00737 distance = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, points[0], points[1], nearPos);
+00738 }
+00739 <font class="keywordflow">else</font>
+00740 {
+00741 <font class="comment">// compute nearest segment</font>
+00742 <font class="keywordflow">for</font> (i = 0; i &lt; points.size()-1; ++i)
+00743 {
+00744 <font class="keyword">const</font> CVector &amp;p1 = points[i];
+00745 <font class="keyword">const</font> CVector &amp;p2 = points[i+1];
+00746
+00747 <font class="keywordtype">float</font> dist = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, p1, p2, pos);
+00748 <font class="keywordflow">if</font>( dist &lt; nearest)
+00749 {
+00750 nearest = dist;
+00751 nearPos = pos;
+00752 }
+00753 }
+00754 distance = nearest;
+00755 }
+00756 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00757 }
+00758
+00759 <font class="comment">// Get the bounding rectangle of the zone</font>
+00760 vMax = vMin = points[0];
+00761 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00762 {
+00763 vMin.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> = <a class="code" href="bit__set_8cpp.html#a0">min</a>(vMin.x, points[i].x);
+00764 vMin.y = <a class="code" href="bit__set_8cpp.html#a0">min</a>(vMin.y, points[i].y);
+00765 vMax.x = max(vMax.x, points[i].x);
+00766 vMax.y = max(vMax.y, points[i].y);
+00767 }
+00768
+00769 <font class="keywordflow">if</font> ((v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &lt; vMin.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &lt; vMin.y) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> &gt; vMax.x) || (v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> &gt; vMax.y))
+00770 {
+00771 <font class="comment">// find the nearest distance of all segment</font>
+00772 <font class="keywordflow">for</font> (uint i=0; i&lt;points.size(); ++i)
+00773 {
+00774 <font class="keywordtype">float</font> dist = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, points[i], points[(i+1) % points.size()], pos);
+00775
+00776 <font class="keywordflow">if</font> (dist &lt; nearest)
+00777 {
+00778 nearest = dist;
+00779 nearPos = pos;
+00780 }
+00781 }
+00782 distance = nearest;
+00783 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00784 }
+00785
+00786 uint32 nNbIntersection = 0;
+00787 <font class="keywordflow">for</font> (i = 0; i &lt; points.size(); ++i)
+00788 {
+00789 <font class="keyword">const</font> CVector &amp;p1 = points[i];
+00790 <font class="keyword">const</font> CVector &amp;p2 = points[(i+1)%points.size()];
+00791
+00792 <font class="keywordtype">float</font> dist = <a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">getSegmentDist</a>(v, p1, p2, pos);
+00793 <font class="keywordflow">if</font>( dist &lt; nearest)
+00794 {
+00795 nearest = dist;
+00796 nearPos = pos;
+00797 }
+00798
+00799 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &lt; 0.0))
+00800 <font class="keywordflow">continue</font>;
+00801 <font class="keywordflow">if</font> (((p1.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0)&amp;&amp;((p2.y-v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>) &gt; 0.0))
+00802 <font class="keywordflow">continue</font>;
+00803 <font class="keywordtype">float</font> xinter = p1.x + (p2.x-p1.x) * ((v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>-p1.y)/(p2.y-p1.y));
+00804 <font class="keywordflow">if</font> (xinter &gt; v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>)
+00805 ++nNbIntersection;
+00806 }
+00807
+00808 distance = nearest;
+00809 <font class="keywordflow">if</font> ((nNbIntersection&amp;1) == 1) <font class="comment">// odd intersections so the vertex is inside</font>
+00810 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00811 <font class="keywordflow">else</font>
+00812 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00813 }
+00814
+00815 <font class="comment">// ***************************************************************************</font>
+00816
+<a name="l00817"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#d0">00817</a> <font class="keywordtype">float</font> CPrimZone::getSegmentDist(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> v, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;p1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;p2, <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;nearPos)
+00818 {
+00819 <font class="comment">// too point, compute distance to the segment.</font>
+00820 CVector V = (p2-p1).normed();
+00821 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a> = ((v-p1)*V)/(p2-p1).norm();
+00822 <font class="keywordtype">float</font> distance;
+00823 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a> &lt; 0.0f)
+00824 {
+00825 nearPos = p1;
+00826 distance = (p1-v).<a class="code" href="classNLMISC_1_1CVector.html#z331_2">norm</a>();
+00827 }
+00828 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a> &gt; 1.0f)
+00829 {
+00830 nearPos = p2;
+00831 distance = (p2-v).<a class="code" href="classNLMISC_1_1CVector.html#z331_2">norm</a>();
+00832 }
+00833 <font class="keywordflow">else</font>
+00834 {
+00835 nearPos = p1 + <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>*(p2-p1);
+00836 distance = (v-nearPos).norm();
+00837 }
+00838
+00839 <font class="keywordflow">return</font> distance;
+00840 }
+00841
+00842
+00843
+00844 <font class="comment">// ***************************************************************************</font>
+<a name="l00845"></a><a class="code" href="classNLLIGO_1_1CPrimZone.html#a2">00845</a> <font class="keywordtype">void</font> CPrimZone::serial (IStream &amp;f)
+00846 {
+00847 f.xmlPushBegin (<font class="stringliteral">"ZONE"</font>);
+00848
+00849 f.xmlSetAttrib (<font class="stringliteral">"NAME"</font>);
+00850 f.serial (<a class="code" href="classNLLIGO_1_1IPrimitive.html#m1">Name</a>);
+00851 f.xmlSetAttrib (<font class="stringliteral">"LAYER"</font>);
+00852 f.serial (<a class="code" href="classNLLIGO_1_1IPrimitive.html#m0">Layer</a>);
+00853 f.xmlPushEnd ();
+00854
+00855 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimZone.html#m0">VPoints</a>);
+00856
+00857 f.xmlPop ();
+00858 }
+00859
+00860 <font class="comment">// ***************************************************************************</font>
+<a name="l00861"></a><a class="code" href="classNLLIGO_1_1CPrimRegion.html#a0">00861</a> <font class="keywordtype">void</font> CPrimRegion::serial (IStream &amp;f)
+00862 {
+00863 f.xmlPushBegin (<font class="stringliteral">"REGION"</font>);
+00864
+00865 f.xmlSetAttrib (<font class="stringliteral">"NAME"</font>);
+00866 f.serial (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m0">Name</a>);
+00867
+00868 f.xmlPushEnd();
+00869
+00870 sint version = 2;
+00871 version = f.serialVersion (version);
+00872 string check = <font class="stringliteral">"REGION"</font>;
+00873 f.serialCheck (check);
+00874
+00875 f.xmlPush (<font class="stringliteral">"POINTS"</font>);
+00876 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m1">VPoints</a>);
+00877 f.xmlPop ();
+00878 f.xmlPush (<font class="stringliteral">"PATHES"</font>);
+00879 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m3">VPaths</a>);
+00880 f.xmlPop ();
+00881 f.xmlPush (<font class="stringliteral">"ZONES"</font>);
+00882 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m2">VZones</a>);
+00883 f.xmlPop ();
+00884
+00885 <font class="keywordflow">if</font> (version &gt; 1)
+00886 {
+00887 f.xmlPush (<font class="stringliteral">"HIDEPOINTS"</font>);
+00888 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m4">VHidePoints</a>);
+00889 f.xmlPop ();
+00890 f.xmlPush (<font class="stringliteral">"HIDEZONES"</font>);
+00891 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m5">VHideZones</a>);
+00892 f.xmlPop ();
+00893 f.xmlPush (<font class="stringliteral">"HIDEPATHS"</font>);
+00894 f.serialCont (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m6">VHidePaths</a>);
+00895 f.xmlPop ();
+00896 }
+00897 <font class="keywordflow">else</font>
+00898 {
+00899 <a class="code" href="classNLLIGO_1_1CPrimRegion.html#m4">VHidePoints</a>.resize (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m1">VPoints</a>.size(), <font class="keyword">false</font>);
+00900 <a class="code" href="classNLLIGO_1_1CPrimRegion.html#m5">VHideZones</a>.resize (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m2">VZones</a>.size(), <font class="keyword">false</font>);
+00901 <a class="code" href="classNLLIGO_1_1CPrimRegion.html#m6">VHidePaths</a>.resize (<a class="code" href="classNLLIGO_1_1CPrimRegion.html#m3">VPaths</a>.size(), <font class="keyword">false</font>);
+00902 }
+00903 }
+00904
+00905 <font class="comment">// ***************************************************************************</font>
+00906 <font class="comment">// IPrimitive</font>
+00907 <font class="comment">// ***************************************************************************</font>
+00908
+<a name="l00909"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a2">00909</a> IPrimitive::IPrimitive (<font class="keyword">const</font> IPrimitive &amp;node)
+00910 {
+00911 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o0">_Parent</a> = NULL;
+00912 IPrimitive::operator= (node);
+00913 }
+00914
+00915 <font class="comment">// ***************************************************************************</font>
+00916
+<a name="l00917"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a3">00917</a> IPrimitive* IPrimitive::copy ()<font class="keyword"> const</font>
+00918 <font class="keyword"></font>{
+00919 <font class="comment">// What is this primitive ?</font>
+00920
+00921 <font class="comment">// The copy</font>
+00922 <a class="code" href="classNLLIGO_1_1IPrimitive.html#a0">IPrimitive</a> *theCopy;
+00923
+00924 <font class="comment">// Is it a prim node ?</font>
+00925 <font class="keyword">const</font> CPrimNode *primNode = dynamic_cast&lt;const CPrimNode*&gt;(this);
+00926 <font class="keywordflow">if</font> (primNode)
+00927 {
+00928 theCopy = <font class="keyword">new</font> CPrimNode;
+00929 *(CPrimNode*)theCopy = *(<font class="keyword">const</font> CPrimNode*)<font class="keyword">this</font>;
+00930 }
+00931 <font class="keywordflow">else</font>
+00932 {
+00933 <font class="comment">// Is it a point node ?</font>
+00934 <font class="keyword">const</font> CPrimPoint *pointNode = dynamic_cast&lt;const CPrimPoint*&gt;(this);
+00935 <font class="keywordflow">if</font> (pointNode)
+00936 {
+00937 theCopy = <font class="keyword">new</font> CPrimPoint;
+00938 *(CPrimPoint*)theCopy = *(<font class="keyword">const</font> CPrimPoint*)<font class="keyword">this</font>;
+00939 }
+00940 <font class="keywordflow">else</font>
+00941 {
+00942 <font class="comment">// Is it a path node ?</font>
+00943 <font class="keyword">const</font> CPrimPath *pathNode = dynamic_cast&lt;const CPrimPath*&gt;(this);
+00944 <font class="keywordflow">if</font> (pathNode)
+00945 {
+00946 theCopy = <font class="keyword">new</font> CPrimPath;
+00947 *(CPrimPath*)theCopy = *(<font class="keyword">const</font> CPrimPath*)<font class="keyword">this</font>;
+00948 }
+00949 <font class="keywordflow">else</font>
+00950 {
+00951 <font class="comment">// Is it a path node ?</font>
+00952 <font class="keyword">const</font> CPrimZone *zoneNode = dynamic_cast&lt;const CPrimZone*&gt;(this);
+00953 <a class="code" href="debug_8h.html#a9">nlverify</a> (zoneNode);
+00954 theCopy = <font class="keyword">new</font> CPrimZone;
+00955 *(CPrimZone*)theCopy = *(<font class="keyword">const</font> CPrimZone*)<font class="keyword">this</font>;
+00956 }
+00957 }
+00958 }
+00959
+00960
+00961 <font class="comment">// Copy children</font>
+00962 theCopy-&gt;_Children.resize (<a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ());
+00963 <font class="keywordflow">for</font> (uint child = 0; child &lt; <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size (); child++)
+00964 {
+00965 <font class="comment">// Copy the child</font>
+00966 theCopy-&gt;_Children[child] = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[child]-&gt;copy ();
+00967
+00968 <font class="comment">// Set the parent</font>
+00969 theCopy-&gt;_Children[child]-&gt;_Parent = theCopy;
+00970 }
+00971
+00972 <font class="comment">// Copy properties</font>
+00973 std::map&lt;std::string, IProperty*&gt;::const_iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.begin ();
+00974 <font class="keywordflow">while</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+00975 {
+00976 <font class="comment">// Get the property</font>
+00977 CPropertyString *propString = dynamic_cast&lt;CPropertyString *&gt;(ite-&gt;second);
+00978 <font class="keywordflow">if</font> (propString)
+00979 {
+00980 <font class="comment">// New property</font>
+00981 CPropertyString *newProp = <font class="keyword">new</font> CPropertyString ();
+00982 *newProp = *propString;
+00983 theCopy-&gt;_Properties.insert (std::map&lt;std::string, IProperty*&gt;::value_type (ite-&gt;first, newProp));
+00984 }
+00985 <font class="keywordflow">else</font>
+00986 {
+00987 CPropertyStringArray *propStringArray = dynamic_cast&lt;CPropertyStringArray *&gt;(ite-&gt;second);
+00988 <font class="keywordflow">if</font> (propStringArray)
+00989 {
+00990 <font class="comment">// New property</font>
+00991 CPropertyStringArray *newProp = <font class="keyword">new</font> CPropertyStringArray ();
+00992 *newProp = *propStringArray;
+00993 theCopy-&gt;_Properties.insert (std::map&lt;std::string, IProperty*&gt;::value_type (ite-&gt;first, newProp));
+00994 }
+00995 <font class="keywordflow">else</font>
+00996 {
+00997 CPropertyColor *propColor = dynamic_cast&lt;CPropertyColor *&gt;(ite-&gt;second);
+00998 <a class="code" href="debug_8h.html#a9">nlverify</a> (propColor);
+00999
+01000 <font class="comment">// New property</font>
+01001 CPropertyColor *newProp = <font class="keyword">new</font> CPropertyColor ();
+01002 *newProp = *propColor;
+01003 theCopy-&gt;_Properties.insert (std::map&lt;std::string, IProperty*&gt;::value_type (ite-&gt;first, newProp));
+01004 }
+01005 }
+01006
+01007 ite++;
+01008 }
+01009
+01010 <font class="keywordflow">return</font> theCopy;
+01011 }
+01012
+01013 <font class="comment">// ***************************************************************************</font>
+01014
+<a name="l01015"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a4">01015</a> <font class="keywordtype">void</font> IPrimitive::operator= (<font class="keyword">const</font> IPrimitive &amp;node)
+01016 {
+01017 <font class="comment">// Clean dest</font>
+01018 <a class="code" href="classNLLIGO_1_1IPrimitive.html#a12">removeChildren</a> ();
+01019 <a class="code" href="classNLLIGO_1_1IPrimitive.html#a27">removeProperties</a> ();
+01020
+01021 <font class="comment">// Copy children</font>
+01022 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.resize (node._Children.size ());
+01023 <font class="keywordflow">for</font> (uint child = 0; child &lt; node._Children.size (); child++)
+01024 {
+01025 <font class="comment">// Copy the child</font>
+01026 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[child] = node._Children[child]-&gt;copy ();
+01027
+01028 <font class="comment">// Set the parent</font>
+01029 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[child]-&gt;_Parent = <font class="keyword">this</font>;
+01030 }
+01031
+01032 <font class="comment">// Copy properties</font>
+01033 std::map&lt;std::string, IProperty*&gt;::const_iterator ite = node._Properties.begin ();
+01034 <font class="keywordflow">while</font> (ite != node._Properties.end ())
+01035 {
+01036 <font class="comment">// Get the property</font>
+01037 CPropertyString *propString = dynamic_cast&lt;CPropertyString *&gt;(ite-&gt;second);
+01038 <font class="keywordflow">if</font> (propString)
+01039 {
+01040 <font class="comment">// New property</font>
+01041 CPropertyString *newProp = <font class="keyword">new</font> CPropertyString ();
+01042 *newProp = *propString;
+01043 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.insert (std::map&lt;std::string, IProperty*&gt;::value_type (ite-&gt;first, newProp));
+01044 }
+01045 <font class="keywordflow">else</font>
+01046 {
+01047 CPropertyStringArray *propStringArray = dynamic_cast&lt;CPropertyStringArray *&gt;(ite-&gt;second);
+01048 <font class="keywordflow">if</font> (propStringArray)
+01049 {
+01050 <font class="comment">// New property</font>
+01051 CPropertyStringArray *newProp = <font class="keyword">new</font> CPropertyStringArray ();
+01052 *newProp = *propStringArray;
+01053 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.insert (std::map&lt;std::string, IProperty*&gt;::value_type (ite-&gt;first, newProp));
+01054 }
+01055 <font class="keywordflow">else</font>
+01056 {
+01057 CPropertyColor *propColor = dynamic_cast&lt;CPropertyColor *&gt;(ite-&gt;second);
+01058 <a class="code" href="debug_8h.html#a9">nlverify</a> (propColor);
+01059
+01060 <font class="comment">// New property</font>
+01061 CPropertyColor *newProp = <font class="keyword">new</font> CPropertyColor ();
+01062 *newProp = *propColor;
+01063 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.insert (std::map&lt;std::string, IProperty*&gt;::value_type (ite-&gt;first, newProp));
+01064 }
+01065 }
+01066
+01067 ite++;
+01068 }
+01069 }
+01070
+01071 <font class="comment">// ***************************************************************************</font>
+01072
+<a name="l01073"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a15">01073</a> <font class="keywordtype">bool</font> IPrimitive::getProperty (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, std::string &amp;property_name, <font class="keyword">const</font> IProperty *&amp;result)<font class="keyword"> const</font>
+01074 <font class="keyword"></font>{
+01075 <font class="comment">// Look for the property</font>
+01076 std::map&lt;std::string, IProperty*&gt;::const_iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.begin ();
+01077 <font class="keywordflow">while</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01078 {
+01079 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == 0)
+01080 {
+01081 property_name = ite-&gt;first;
+01082 result = ite-&gt;second;
+01083 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01084 }
+01085 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>--;
+01086 ite ++;
+01087 }
+01088 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getProperty : invalid index (index : %d, size : %d)."</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.size ());
+01089 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01090 }
+01091
+01092 <font class="comment">// ***************************************************************************</font>
+01093
+<a name="l01094"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a16">01094</a> <font class="keywordtype">bool</font> IPrimitive::getProperty (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, std::string &amp;property_name, IProperty *&amp;result)
+01095 {
+01096 <font class="comment">// Look for the property</font>
+01097 std::map&lt;std::string, IProperty*&gt;::iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.begin ();
+01098 <font class="keywordflow">while</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01099 {
+01100 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == 0)
+01101 {
+01102 property_name = ite-&gt;first;
+01103 result = ite-&gt;second;
+01104 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01105 }
+01106 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>--;
+01107 ite ++;
+01108 }
+01109 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getProperty : invalid index (index : %d, size : %d)."</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.size ());
+01110 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01111 }
+01112
+01113 <font class="comment">// ***************************************************************************</font>
+01114
+<a name="l01115"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a18">01115</a> <font class="keywordtype">bool</font> IPrimitive::getPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, <font class="keyword">const</font> IProperty *&amp;result)<font class="keyword"> const</font>
+01116 <font class="keyword"></font>{
+01117 <font class="comment">// Look for the property</font>
+01118 std::map&lt;std::string, IProperty*&gt;::const_iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.find (property_name);
+01119 <font class="keywordflow">if</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01120 {
+01121 result = ite-&gt;second;
+01122 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01123 }
+01124 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01125 }
+01126
+01127 <font class="comment">// ***************************************************************************</font>
+01128
+<a name="l01129"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a19">01129</a> <font class="keywordtype">bool</font> IPrimitive::getPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, IProperty *&amp;result)
+01130 {
+01131 <font class="comment">// Look for the property</font>
+01132 std::map&lt;std::string, IProperty*&gt;::iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.find (property_name);
+01133 <font class="keywordflow">if</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01134 {
+01135 result = ite-&gt;second;
+01136 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01137 }
+01138 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01139 }
+01140
+01141 <font class="comment">// ***************************************************************************</font>
+01142
+<a name="l01143"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a20">01143</a> <font class="keywordtype">bool</font> IPrimitive::getPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, std::string *&amp;result)
+01144 {
+01145 <font class="comment">// Get the property</font>
+01146 IProperty *prop;
+01147 <font class="keywordflow">if</font> (<a class="code" href="classNLLIGO_1_1IPrimitive.html#a18">getPropertyByName</a> (property_name, prop))
+01148 {
+01149 CPropertyString *strProp = dynamic_cast&lt;CPropertyString *&gt; (prop);
+01150 <font class="keywordflow">if</font> (strProp)
+01151 {
+01152 result = &amp;(strProp-&gt;String);
+01153 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01154 }
+01155 <font class="keywordflow">else</font>
+01156 {
+01157 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string."</font>, property_name);
+01158 }
+01159 }
+01160 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01161 }
+01162
+01163 <font class="comment">// ***************************************************************************</font>
+01164
+<a name="l01165"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a22">01165</a> <font class="keywordtype">bool</font> IPrimitive::getPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, std::string &amp;result)<font class="keyword"> const</font>
+01166 <font class="keyword"></font>{
+01167 <font class="comment">// Get the property</font>
+01168 <font class="keyword">const</font> IProperty *prop;
+01169 <font class="keywordflow">if</font> (<a class="code" href="classNLLIGO_1_1IPrimitive.html#a18">getPropertyByName</a> (property_name, prop))
+01170 {
+01171 <font class="keyword">const</font> CPropertyString *strProp = dynamic_cast&lt;const CPropertyString *&gt; (prop);
+01172 <font class="keywordflow">if</font> (strProp)
+01173 {
+01174 result = strProp-&gt;String;
+01175 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01176 }
+01177 <font class="keywordflow">else</font>
+01178 {
+01179 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string."</font>, property_name);
+01180 }
+01181 }
+01182 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01183 }
+01184
+01185 <font class="comment">// ***************************************************************************</font>
+01186
+<a name="l01187"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a21">01187</a> <font class="keywordtype">bool</font> IPrimitive::getPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, std::vector&lt;std::string&gt; *&amp;result)
+01188 {
+01189 <font class="comment">// Get the property</font>
+01190 IProperty *prop;
+01191 <font class="keywordflow">if</font> (<a class="code" href="classNLLIGO_1_1IPrimitive.html#a18">getPropertyByName</a> (property_name, prop))
+01192 {
+01193 CPropertyStringArray *strProp = dynamic_cast&lt;CPropertyStringArray *&gt; (prop);
+01194 <font class="keywordflow">if</font> (strProp)
+01195 {
+01196 result = &amp;(strProp-&gt;StringArray);
+01197 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01198 }
+01199 <font class="keywordflow">else</font>
+01200 {
+01201 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string."</font>, property_name);
+01202 }
+01203 }
+01204 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01205 }
+01206
+01207 <font class="comment">// ***************************************************************************</font>
+01208
+<a name="l01209"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a23">01209</a> <font class="keywordtype">bool</font> IPrimitive::getPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, <font class="keyword">const</font> std::vector&lt;std::string&gt; *&amp;result)<font class="keyword"> const</font>
+01210 <font class="keyword"></font>{
+01211 <font class="comment">// Get the property</font>
+01212 IProperty *prop;
+01213 <font class="keywordflow">if</font> (<a class="code" href="classNLLIGO_1_1IPrimitive.html#a18">getPropertyByName</a> (property_name, prop))
+01214 {
+01215 <font class="keyword">const</font> CPropertyStringArray *strProp = dynamic_cast&lt;const CPropertyStringArray *&gt; (prop);
+01216 <font class="keywordflow">if</font> (strProp)
+01217 {
+01218 result = &amp;(strProp-&gt;StringArray);
+01219 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01220 }
+01221 <font class="keywordflow">else</font>
+01222 {
+01223 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string."</font>, property_name);
+01224 }
+01225 }
+01226 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01227 }
+01228
+01229 <font class="comment">// ***************************************************************************</font>
+01230
+<a name="l01231"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a24">01231</a> <font class="keywordtype">bool</font> IPrimitive::getPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> &amp;result)<font class="keyword"> const</font>
+01232 <font class="keyword"></font>{
+01233 <font class="comment">// Get the property</font>
+01234 IProperty *prop;
+01235 <font class="keywordflow">if</font> (<a class="code" href="classNLLIGO_1_1IPrimitive.html#a18">getPropertyByName</a> (property_name, prop))
+01236 {
+01237 <font class="keyword">const</font> CPropertyColor *colorProp = dynamic_cast&lt;const CPropertyColor *&gt; (prop);
+01238 <font class="keywordflow">if</font> (colorProp)
+01239 {
+01240 result = colorProp-&gt;Color;
+01241 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01242 }
+01243 <font class="keywordflow">else</font>
+01244 {
+01245 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a color."</font>, property_name);
+01246 }
+01247 }
+01248 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01249 }
+01250
+01251 <font class="comment">// ***************************************************************************</font>
+01252
+<a name="l01253"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a25">01253</a> <font class="keywordtype">bool</font> IPrimitive::removeProperty (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+01254 {
+01255 <font class="comment">// Look for the property</font>
+01256 std::map&lt;std::string, IProperty*&gt;::iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.begin ();
+01257 <font class="keywordflow">while</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01258 {
+01259 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == 0)
+01260 {
+01261 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.erase (ite);
+01262 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01263 }
+01264 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>--;
+01265 ite ++;
+01266 }
+01267 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::removeProperty : invalid index (index : %d, size : %d)."</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.size ());
+01268 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01269 }
+01270
+01271 <font class="comment">// ***************************************************************************</font>
+01272
+<a name="l01273"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a26">01273</a> <font class="keywordtype">bool</font> IPrimitive::removePropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name)
+01274 {
+01275 <font class="comment">// Look for the property</font>
+01276 std::map&lt;std::string, IProperty*&gt;::iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.find (property_name);
+01277 <font class="keywordflow">if</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01278 {
+01279 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.erase (ite);
+01280 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01281 }
+01282 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01283 }
+01284
+01285 <font class="comment">// ***************************************************************************</font>
+01286
+<a name="l01287"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a27">01287</a> <font class="keywordtype">void</font> IPrimitive::removeProperties ()
+01288 {
+01289 std::map&lt;std::string, IProperty*&gt;::iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.begin ();
+01290 <font class="keywordflow">while</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01291 {
+01292 <font class="keyword">delete</font> ite-&gt;second;
+01293 ite++;
+01294 }
+01295 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.clear ();
+01296 }
+01297
+01298 <font class="comment">// ***************************************************************************</font>
+01299
+<a name="l01300"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a6">01300</a> <font class="keywordtype">bool</font> IPrimitive::getChild (<font class="keyword">const</font> IPrimitive *&amp;result, uint childId)<font class="keyword"> const</font>
+01301 <font class="keyword"></font>{
+01302 <font class="keywordflow">if</font> (childId &lt; <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ())
+01303 {
+01304 result = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[childId];
+01305 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01306 }
+01307 <font class="keywordflow">else</font>
+01308 {
+01309 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getChild : invalid index (index : %d, size %d)."</font>, childId, <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ());
+01310 }
+01311 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01312 }
+01313
+01314 <font class="comment">// ***************************************************************************</font>
+01315
+<a name="l01316"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a7">01316</a> <font class="keywordtype">bool</font> IPrimitive::getChild (IPrimitive *&amp;result, uint childId)
+01317 {
+01318 <font class="keywordflow">if</font> (childId &lt; <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ())
+01319 {
+01320 result = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[childId];
+01321 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01322 }
+01323 <font class="keywordflow">else</font>
+01324 {
+01325 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::getChild : invalid index (index : %d, size %d)."</font>, childId, <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ());
+01326 }
+01327 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01328 }
+01329
+01330 <font class="comment">// ***************************************************************************</font>
+01331
+<a name="l01332"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a11">01332</a> <font class="keywordtype">bool</font> IPrimitive::removeChild (uint childId)
+01333 {
+01334 <font class="keywordflow">if</font> (childId &lt; <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ())
+01335 {
+01336 <font class="keyword">delete</font> <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[childId];
+01337 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.erase (<a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.begin()+childId);
+01338 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01339 }
+01340 <font class="keywordflow">else</font>
+01341 {
+01342 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLLIGO::IPrimitive::removeChild : invalid index (index : %d, size %d)."</font>, childId, <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ());
+01343 }
+01344 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01345 }
+01346
+01347 <font class="comment">// ***************************************************************************</font>
+01348
+<a name="l01349"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a12">01349</a> <font class="keywordtype">void</font> IPrimitive::removeChildren ()
+01350 {
+01351 <font class="comment">// Erase children</font>
+01352 <font class="keywordflow">for</font> (uint i=0; i&lt;<a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size (); i++)
+01353 {
+01354 <font class="keyword">delete</font> <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[i];
+01355 }
+01356 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.clear ();
+01357 }
+01358
+01359 <font class="comment">// ***************************************************************************</font>
+01360
+<a name="l01361"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a13">01361</a> <font class="keywordtype">bool</font> IPrimitive::insertChild (IPrimitive *primitive, uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+01362 {
+01363 <font class="comment">// At the end ?</font>
+01364 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == <a class="code" href="classNLLIGO_1_1IPrimitive.html#s2s1">AtTheEnd</a>)
+01365 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ();
+01366
+01367 <font class="comment">// Index valid ?</font>
+01368 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&gt;<a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ())
+01369 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01370
+01371 <font class="comment">// Insert</font>
+01372 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.insert (<a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.begin () + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, primitive);
+01373
+01374 <font class="comment">// Link to the parent</font>
+01375 primitive-&gt;_Parent = <font class="keyword">this</font>;
+01376
+01377 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01378 }
+01379
+01380 <font class="comment">// ***************************************************************************</font>
+01381
+<a name="l01382"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a1">01382</a> IPrimitive::~IPrimitive ()
+01383 {
+01384 <font class="comment">// Remove children</font>
+01385 <a class="code" href="classNLLIGO_1_1IPrimitive.html#a12">removeChildren</a> ();
+01386
+01387 <font class="comment">// Erase properties</font>
+01388 <a class="code" href="classNLLIGO_1_1IPrimitive.html#a27">removeProperties</a> ();
+01389 }
+01390
+01391 <font class="comment">// ***************************************************************************</font>
+01392
+<a name="l01393"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a17">01393</a> <font class="keywordtype">bool</font> IPrimitive::addPropertyByName (<font class="keyword">const</font> <font class="keywordtype">char</font> *property_name, IProperty *result)
+01394 {
+01395 <font class="keywordtype">bool</font> inserted = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.insert (std::map&lt;std::string, IProperty*&gt;::value_type (property_name, result)).second;
+01396 <font class="keywordflow">if</font> (inserted)
+01397 {
+01398 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01399 }
+01400 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01401 }
+01402
+01403 <font class="comment">// ***************************************************************************</font>
+01404
+<a name="l01405"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a28">01405</a> <font class="keywordtype">bool</font> IPrimitive::read (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename, uint version)
+01406 {
+01407 <font class="comment">// Erase old properties</font>
+01408 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.clear ();
+01409
+01410 <font class="comment">// Read the properties</font>
+01411 xmlNodePtr propNode;
+01412 propNode = CIXml::getFirstChildNode (xmlNode, <font class="stringliteral">"PROPERTY"</font>);
+01413 <font class="keywordflow">if</font> (propNode)
+01414 {
+01415 <font class="keywordflow">do</font>
+01416 {
+01417 <font class="comment">// Read the name</font>
+01418 string name;
+01419 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a10">GetNodeString</a> (name, filename, propNode, <font class="stringliteral">"NAME"</font>))
+01420 {
+01421 <font class="comment">// Get the property type</font>
+01422 string <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>;
+01423 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, filename, propNode, <font class="stringliteral">"TYPE"</font>))
+01424 {
+01425 <font class="comment">// The property</font>
+01426 IProperty *property = NULL;
+01427
+01428 <font class="comment">// Check the type</font>
+01429 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <font class="stringliteral">"string"</font>)
+01430 {
+01431 <font class="comment">// Create a new property</font>
+01432 CPropertyString *propertyString = <font class="keyword">new</font> CPropertyString;
+01433 property = propertyString;
+01434
+01435 <font class="comment">// Read it</font>
+01436 <font class="keywordflow">if</font> (!<a class="code" href="namespaceNLLIGO.html#a10">GetNodeString</a> (propertyString-&gt;String, filename, propNode, <font class="stringliteral">"STRING"</font>))
+01437 {
+01438 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01439 }
+01440 }
+01441 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <font class="stringliteral">"string_array"</font>)
+01442 {
+01443 <font class="comment">// Create a new property</font>
+01444 CPropertyStringArray *propertyStringArray = <font class="keyword">new</font> CPropertyStringArray;
+01445 property = propertyStringArray;
+01446
+01447 <font class="comment">// Read strings</font>
+01448 xmlNodePtr stringNode;
+01449 propertyStringArray-&gt;StringArray.reserve (CIXml::countChildren (xmlNode, <font class="stringliteral">"STRING"</font>));
+01450 stringNode = CIXml::getFirstChildNode (xmlNode, <font class="stringliteral">"STRING"</font>);
+01451 <font class="keywordflow">if</font> (stringNode)
+01452 {
+01453 <font class="keywordflow">do</font>
+01454 {
+01455 <font class="comment">// Add the string</font>
+01456 string content;
+01457 <a class="code" href="namespaceNLLIGO.html#a11">GetContentString</a> (content, filename, stringNode);
+01458 propertyStringArray-&gt;StringArray.push_back (content);
+01459 }
+01460 <font class="keywordflow">while</font> ((stringNode = CIXml::getNextChildNode (stringNode, <font class="stringliteral">"STRING"</font>)));
+01461 }
+01462 }
+01463 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <font class="stringliteral">"color"</font>)
+01464 {
+01465 <font class="comment">// Create a new property</font>
+01466 CPropertyColor *propertyColor= <font class="keyword">new</font> CPropertyColor;
+01467 property = propertyColor;
+01468
+01469 <font class="comment">// Read strings</font>
+01470 xmlNodePtr colorNode;
+01471 colorNode = CIXml::getFirstChildNode (xmlNode, <font class="stringliteral">"COLOR"</font>);
+01472 string R, G, B, A;
+01473 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (R, filename, colorNode, <font class="stringliteral">"R"</font>) &amp;&amp;
+01474 <a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (G, filename, colorNode, <font class="stringliteral">"G"</font>) &amp;&amp;
+01475 <a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (B, filename, colorNode, <font class="stringliteral">"B"</font>) &amp;&amp;
+01476 <a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (A, filename, colorNode, <font class="stringliteral">"A"</font>))
+01477 {
+01478 sint32 sR=0, sG=0, sB=0, sA=255;
+01479 sR = atoi (R.c_str ());
+01480 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (sR, 0, 255);
+01481 sG = atoi (G.c_str ());
+01482 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (sG, 0, 255);
+01483 sB = atoi (B.c_str ());
+01484 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (sB, 0, 255);
+01485 sA = atoi (A.c_str ());
+01486 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (sR, 0, 255);
+01487 propertyColor-&gt;Color.R = (uint8)sR;
+01488 propertyColor-&gt;Color.G = (uint8)sG;
+01489 propertyColor-&gt;Color.B = (uint8)sB;
+01490 propertyColor-&gt;Color.A = (uint8)sA;
+01491 }
+01492 <font class="keywordflow">else</font>
+01493 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01494 }
+01495
+01496 <font class="comment">// Property found ?</font>
+01497 <font class="keywordflow">if</font> (property == NULL)
+01498 {
+01499 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (propNode, filename, <font class="stringliteral">"IPrimitive::read : Unknown property type (%s)"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>.c_str ());
+01500 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01501 }
+01502
+01503 <font class="comment">// Add it</font>
+01504 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.insert (std::map&lt;std::string, IProperty*&gt;::value_type (name, property));
+01505 }
+01506 <font class="keywordflow">else</font>
+01507 {
+01508 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01509 }
+01510 }
+01511 <font class="keywordflow">else</font>
+01512 {
+01513 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01514 }
+01515 }
+01516 <font class="keywordflow">while</font> (propNode = CIXml::getNextChildNode (propNode, <font class="stringliteral">"PROPERTY"</font>));
+01517 }
+01518
+01519 <font class="comment">// Read children</font>
+01520 xmlNodePtr childNode;
+01521 childNode = CIXml::getFirstChildNode (xmlNode, <font class="stringliteral">"CHILD"</font>);
+01522 <font class="keywordflow">if</font> (childNode)
+01523 {
+01524 <font class="keywordflow">do</font>
+01525 {
+01526 <font class="comment">// Get the property class</font>
+01527 string <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>;
+01528 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, filename, childNode, <font class="stringliteral">"TYPE"</font>))
+01529 {
+01530 <font class="comment">// Primitive</font>
+01531 <a class="code" href="classNLLIGO_1_1IPrimitive.html#a0">IPrimitive</a> *primitive = NULL;
+01532
+01533 <font class="comment">// Check the type</font>
+01534 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <font class="stringliteral">"node"</font>)
+01535 {
+01536 <font class="comment">// Create new primitive</font>
+01537 primitive = <font class="keyword">new</font> CPrimNode;
+01538 }
+01539 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <font class="stringliteral">"point"</font>)
+01540 {
+01541 <font class="comment">// Create new primitive</font>
+01542 primitive = <font class="keyword">new</font> CPrimPoint;
+01543 }
+01544 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <font class="stringliteral">"path"</font>)
+01545 {
+01546 <font class="comment">// Create new primitive</font>
+01547 primitive = <font class="keyword">new</font> CPrimPath;
+01548 }
+01549 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> == <font class="stringliteral">"zone"</font>)
+01550 {
+01551 <font class="comment">// Create new primitive</font>
+01552 primitive = <font class="keyword">new</font> CPrimZone;
+01553 }
+01554
+01555 <font class="comment">// Primitive type not found ?</font>
+01556 <font class="keywordflow">if</font> (primitive == NULL)
+01557 {
+01558 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (childNode, filename, <font class="stringliteral">"IPrimitive::read : Unknown primitive type (%s)"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>.c_str ());
+01559 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01560 }
+01561
+01562 <font class="comment">// Read it</font>
+01563 primitive-&gt;read (childNode, filename, version);
+01564
+01565 <font class="comment">// Add it</font>
+01566 <a class="code" href="classNLLIGO_1_1IPrimitive.html#a13">insertChild</a> (primitive);
+01567 }
+01568 <font class="keywordflow">else</font>
+01569 {
+01570 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01571 }
+01572 }
+01573 <font class="keywordflow">while</font> (childNode = CIXml::getNextChildNode (childNode, <font class="stringliteral">"CHILD"</font>));
+01574 }
+01575
+01576 <font class="comment">// Done</font>
+01577 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01578 }
+01579
+01580 <font class="comment">// ***************************************************************************</font>
+01581
+<a name="l01582"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a29">01582</a> <font class="keywordtype">void</font> IPrimitive::write (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)<font class="keyword"> const</font>
+01583 <font class="keyword"></font>{
+01584 <font class="comment">// Save the properties</font>
+01585 std::map&lt;std::string, IProperty*&gt;::const_iterator ite = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.begin ();
+01586 <font class="keywordflow">while</font> (ite != <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.end ())
+01587 {
+01588 <font class="comment">// Create new nodes</font>
+01589 xmlNodePtr propNode = xmlNewChild ( xmlNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"PROPERTY"</font>, NULL);
+01590 xmlNodePtr nameNode = xmlNewChild ( propNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"NAME"</font>, NULL);
+01591 xmlNodePtr textNode = xmlNewText ((<font class="keyword">const</font> xmlChar *)(ite-&gt;first.c_str ()));
+01592 xmlAddChild (nameNode, textNode);
+01593
+01594 <font class="comment">// Type</font>
+01595 <font class="keyword">const</font> CPropertyString *str = dynamic_cast&lt;const CPropertyString *&gt; (ite-&gt;second);
+01596 <font class="keywordflow">if</font> (str)
+01597 {
+01598 <font class="comment">// Set the type</font>
+01599 xmlSetProp (propNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"TYPE"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"string"</font>);
+01600
+01601 <font class="comment">// Create new nodes</font>
+01602 xmlNodePtr stringNode = xmlNewChild ( propNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"STRING"</font>, NULL);
+01603 xmlNodePtr textNode = xmlNewText ((<font class="keyword">const</font> xmlChar *)(str-&gt;String.c_str ()));
+01604 xmlAddChild (stringNode, textNode);
+01605 }
+01606 <font class="keywordflow">else</font>
+01607 {
+01608 <font class="comment">// Should be an array</font>
+01609 <font class="keyword">const</font> CPropertyStringArray *array = dynamic_cast&lt;const CPropertyStringArray *&gt; (ite-&gt;second);
+01610 <font class="keywordflow">if</font> (array)
+01611 {
+01612 <font class="comment">// Set the type</font>
+01613 xmlSetProp (propNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"TYPE"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"string_array"</font>);
+01614
+01615 <font class="comment">// For each strings in the array</font>
+01616 <font class="keywordflow">for</font> (uint i=0; i&lt;array-&gt;StringArray.size (); i++)
+01617 {
+01618 <font class="comment">// Create new nodes</font>
+01619 xmlNodePtr stringNode = xmlNewChild ( propNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"STRING"</font>, NULL);
+01620 xmlNodePtr textNode = xmlNewText ((<font class="keyword">const</font> xmlChar *)(array-&gt;StringArray[i].c_str ()));
+01621 xmlAddChild (stringNode, textNode);
+01622 }
+01623 }
+01624 <font class="keywordflow">else</font>
+01625 {
+01626 <font class="comment">// Should be a color</font>
+01627 <font class="keyword">const</font> CPropertyColor *color = safe_cast&lt;const CPropertyColor *&gt; (ite-&gt;second);
+01628
+01629 <font class="comment">// Set the type</font>
+01630 xmlSetProp (propNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"TYPE"</font>, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"color"</font>);
+01631
+01632 <font class="comment">// Create new nodes</font>
+01633 xmlNodePtr colorNode = xmlNewChild ( propNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"COLOR"</font>, NULL);
+01634 xmlSetProp (colorNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"R"</font>, (<font class="keyword">const</font> xmlChar*)toString (color-&gt;Color.R).c_str ());
+01635 xmlSetProp (colorNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"G"</font>, (<font class="keyword">const</font> xmlChar*)toString (color-&gt;Color.G).c_str ());
+01636 xmlSetProp (colorNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"B"</font>, (<font class="keyword">const</font> xmlChar*)toString (color-&gt;Color.B).c_str ());
+01637 xmlSetProp (colorNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"A"</font>, (<font class="keyword">const</font> xmlChar*)toString (color-&gt;Color.A).c_str ());
+01638 }
+01639 }
+01640
+01641 ite++;
+01642 }
+01643
+01644 <font class="comment">// Save the children</font>
+01645 <font class="keywordflow">for</font> (uint i=0; i&lt;<a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size (); i++)
+01646 {
+01647 <font class="comment">// New node</font>
+01648 xmlNodePtr childNode = xmlNewChild ( xmlNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"CHILD"</font>, NULL);
+01649
+01650 <font class="comment">// Write it</font>
+01651 <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[i]-&gt;write (childNode, filename);
+01652 }
+01653 }
+01654
+01655 <font class="comment">// ***************************************************************************</font>
+01656
+<a name="l01657"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a10">01657</a> <font class="keywordtype">bool</font> IPrimitive::getChildId (uint &amp;childId, <font class="keyword">const</font> IPrimitive *child)<font class="keyword"> const</font>
+01658 <font class="keyword"></font>{
+01659 <font class="keyword">const</font> uint childrenSize = <a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>.size ();
+01660 <font class="keywordflow">for</font> (uint i=0; i&lt;childrenSize; i++)
+01661 {
+01662 <font class="keywordflow">if</font> (<a class="code" href="classNLLIGO_1_1IPrimitive.html#o1">_Children</a>[i] == child)
+01663 {
+01664 childId = i;
+01665 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01666 }
+01667 }
+01668 childId = 0xffffffff;
+01669 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01670 }
+01671
+01672 <font class="comment">// ***************************************************************************</font>
+01673
+<a name="l01674"></a><a class="code" href="classNLLIGO_1_1IPrimitive.html#a14">01674</a> uint IPrimitive::getNumProperty ()<font class="keyword"> const </font>
+01675 <font class="keyword"></font>{
+01676 <font class="keywordflow">return</font> <a class="code" href="classNLLIGO_1_1IPrimitive.html#o2">_Properties</a>.size ();
+01677 }
+01678
+01679 <font class="comment">// ***************************************************************************</font>
+01680 <font class="comment">// CPrimitives</font>
+01681 <font class="comment">// ***************************************************************************</font>
+01682
+<a name="l01683"></a><a class="code" href="classNLLIGO_1_1CPrimitives.html#a1">01683</a> <font class="keywordtype">bool</font> CPrimitives::read (xmlNodePtr xmlNode, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)
+01684 {
+01685 <a class="code" href="debug_8h.html#a6">nlassert</a> (xmlNode);
+01686
+01687 <font class="comment">// Get the name</font>
+01688 <font class="keywordflow">if</font> (strcmp ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)xmlNode-&gt;name, <font class="stringliteral">"PRIMITIVES"</font>) == 0)
+01689 {
+01690 <font class="comment">// Get the version</font>
+01691 string versionName = <font class="stringliteral">"0"</font>;
+01692 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLLIGO.html#a5">GetPropertyString</a> (versionName, filename, xmlNode, <font class="stringliteral">"VERSION"</font>))
+01693 {
+01694 <font class="comment">// Get the version</font>
+01695 uint version = atoi (versionName.c_str ());
+01696
+01697 <font class="comment">// Check the version</font>
+01698 <font class="keywordflow">if</font> (version &lt;= <a class="code" href="primitive_8cpp.html#a0">NLLIGO_PRIMITVE_VERSION</a>)
+01699 {
+01700 <font class="comment">// Read the primitives</font>
+01701 xmlNode = <a class="code" href="namespaceNLLIGO.html#a4">GetFirstChildNode</a> (xmlNode, filename, <font class="stringliteral">"ROOT_PRIMITIVE"</font>);
+01702 <font class="keywordflow">if</font> (xmlNode)
+01703 {
+01704 <font class="comment">// Read the primitive tree</font>
+01705 ((IPrimitive*)&amp;<a class="code" href="classNLLIGO_1_1CPrimitives.html#m0">RootNode</a>)-&gt;read (xmlNode, filename, version);
+01706 }
+01707 }
+01708 <font class="keywordflow">else</font>
+01709 {
+01710 <a class="code" href="namespaceNLLIGO.html#a2">Error</a> (filename, <font class="stringliteral">"CPrimitives::read : Unknown file version (%d)"</font>, version);
+01711 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01712 }
+01713 }
+01714 <font class="keywordflow">else</font>
+01715 {
+01716 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01717 }
+01718 }
+01719 <font class="keywordflow">else</font>
+01720 {
+01721 <a class="code" href="namespaceNLLIGO.html#a3">XMLError</a> (xmlNode, filename, <font class="stringliteral">"This XML document is not a NeL primitive file"</font>);
+01722 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01723 }
+01724
+01725 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01726 }
+01727
+01728 <font class="comment">// ***************************************************************************</font>
+01729
+<a name="l01730"></a><a class="code" href="classNLLIGO_1_1CPrimitives.html#a2">01730</a> <font class="keywordtype">void</font> CPrimitives::write (xmlDocPtr doc, <font class="keyword">const</font> <font class="keywordtype">char</font> *filename)<font class="keyword"> const</font>
+01731 <font class="keyword"></font>{
+01732 <a class="code" href="debug_8h.html#a6">nlassert</a> (doc);
+01733
+01734 <font class="comment">// Primitive node</font>
+01735 xmlNodePtr primNode = xmlNewDocNode (doc, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"PRIMITIVES"</font>, NULL);
+01736 xmlDocSetRootElement (doc, primNode);
+01737
+01738 <font class="comment">// Version node</font>
+01739 xmlSetProp (primNode, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"VERSION"</font>, (<font class="keyword">const</font> xmlChar*)toString (NLLIGO_PRIMITVE_VERSION).c_str ());
+01740
+01741 <font class="comment">// The primitive root node</font>
+01742 xmlNodePtr nameNode = xmlNewChild ( primNode, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"ROOT_PRIMITIVE"</font>, NULL);
+01743
+01744 <font class="comment">// Write the primitive tree</font>
+01745 ((IPrimitive*)&amp;<a class="code" href="classNLLIGO_1_1CPrimitives.html#m0">RootNode</a>)-&gt;write (nameNode, filename);
+01746 }
+01747
+01748 <font class="comment">// ***************************************************************************</font>
+01749
+<a name="l01750"></a><a class="code" href="classNLLIGO_1_1CPrimitives.html#c0">01750</a> <font class="keywordtype">void</font> CPrimitives::convertAddPrimitive (IPrimitive *child, <font class="keyword">const</font> IPrimitive *prim, <font class="keywordtype">bool</font> hidden)
+01751 {
+01752 <font class="comment">// The primitve</font>
+01753 IPrimitive *primitive = NULL;
+01754
+01755 <font class="comment">// What kind of primitive ?</font>
+01756 <font class="keyword">const</font> CPrimPoint *oldPoint = dynamic_cast&lt;const CPrimPoint *&gt;(prim);
+01757 <font class="keywordflow">if</font> (oldPoint)
+01758 {
+01759 <font class="comment">// Create a primitive</font>
+01760 CPrimPoint *point = <font class="keyword">new</font> CPrimPoint ();
+01761 primitive = point;
+01762
+01763 <font class="comment">// Copy it</font>
+01764 *point = *oldPoint;
+01765 }
+01766 <font class="keywordflow">else</font>
+01767 {
+01768 <font class="comment">// Path ?</font>
+01769 <font class="keyword">const</font> CPrimPath *oldPath = dynamic_cast&lt;const CPrimPath *&gt;(prim);
+01770 <font class="keywordflow">if</font> (oldPath)
+01771 {
+01772 <font class="comment">// Create a primitive</font>
+01773 CPrimPath *path = <font class="keyword">new</font> CPrimPath ();
+01774 primitive = path;
+01775
+01776 <font class="comment">// Copy it</font>
+01777 *path = *oldPath;
+01778 }
+01779 <font class="keywordflow">else</font>
+01780 {
+01781 <font class="keyword">const</font> CPrimZone *oldZone = safe_cast&lt;const CPrimZone *&gt;(prim);
+01782 <font class="keywordflow">if</font> (oldZone)
+01783 {
+01784 <font class="comment">// Create a primitive</font>
+01785 CPrimZone *zone = <font class="keyword">new</font> CPrimZone ();
+01786 primitive = zone;
+01787
+01788 <font class="comment">// Copy it</font>
+01789 *zone = *oldZone;
+01790 }
+01791 }
+01792 }
+01793
+01794 <font class="comment">// Primitive has been created ?</font>
+01795 <font class="keywordflow">if</font> (primitive)
+01796 {
+01797 <font class="comment">// Create a property for the name</font>
+01798 CPropertyString *nameProp = <font class="keyword">new</font> CPropertyString;
+01799 nameProp-&gt;String = prim-&gt;Name;
+01800
+01801 <font class="comment">// Add the property</font>
+01802 primitive-&gt;addPropertyByName (<font class="stringliteral">"Name"</font>, nameProp);
+01803
+01804 <font class="comment">// The primitive is hidden ?</font>
+01805 <font class="keywordflow">if</font> (hidden)
+01806 {
+01807 <font class="comment">// Create a property for hidden</font>
+01808 nameProp = <font class="keyword">new</font> CPropertyString;
+01809
+01810 <font class="comment">// Add the property</font>
+01811 primitive-&gt;addPropertyByName (<font class="stringliteral">"Hidden"</font>, nameProp);
+01812 }
+01813
+01814 <font class="comment">// Add the child</font>
+01815 child-&gt;insertChild (primitive);
+01816 }
+01817 }
+01818
+01819 <font class="comment">// ***************************************************************************</font>
+01820
+<a name="l01821"></a><a class="code" href="classNLLIGO_1_1CPrimitives.html#c1">01821</a> <font class="keywordtype">void</font> CPrimitives::convertPrimitive (<font class="keyword">const</font> IPrimitive *prim, <font class="keywordtype">bool</font> hidden)
+01822 {
+01823 <font class="comment">// Look for the group</font>
+01824 uint numChildren = <a class="code" href="classNLLIGO_1_1CPrimitives.html#m0">RootNode</a>.getNumChildren ();
+01825 uint j;
+01826 <font class="keywordflow">for</font> (j=0; j&lt;numChildren; j++)
+01827 {
+01828 IPrimitive *child;
+01829 <a class="code" href="debug_8h.html#a9">nlverify</a> (<a class="code" href="classNLLIGO_1_1CPrimitives.html#m0">RootNode</a>.getChild (child, j));
+01830 <font class="keyword">const</font> IProperty *prop;
+01831 <font class="keywordflow">if</font> (child-&gt;getPropertyByName (<font class="stringliteral">"Name"</font>, prop))
+01832 {
+01833 <font class="comment">// Prop string</font>
+01834 <font class="keyword">const</font> CPropertyString *name = dynamic_cast&lt;const CPropertyString *&gt;(prop);
+01835 <font class="keywordflow">if</font> (name)
+01836 {
+01837 <font class="comment">// This one ?</font>
+01838 <font class="keywordflow">if</font> (name-&gt;String == prim-&gt;Layer)
+01839 {
+01840 <a class="code" href="classNLLIGO_1_1CPrimitives.html#c0">convertAddPrimitive</a> (child, prim, hidden);
+01841 <font class="keywordflow">break</font>;
+01842 }
+01843 }
+01844 }
+01845 }
+01846
+01847 <font class="comment">// Not found ?</font>
+01848 <font class="keywordflow">if</font> (j==numChildren)
+01849 {
+01850 <font class="comment">// Create a node</font>
+01851 CPrimNode *primNode = <font class="keyword">new</font> CPrimNode;
+01852
+01853 <font class="comment">// Create a property for the layer</font>
+01854 CPropertyString *nameProp = <font class="keyword">new</font> CPropertyString;
+01855 nameProp-&gt;String = prim-&gt;Layer;
+01856
+01857 <font class="comment">// Add the property</font>
+01858 primNode-&gt;addPropertyByName (<font class="stringliteral">"Name"</font>, nameProp);
+01859
+01860 <font class="comment">// Add the child</font>
+01861 <a class="code" href="classNLLIGO_1_1CPrimitives.html#m0">RootNode</a>.insertChild (primNode);
+01862
+01863 <font class="comment">// Add the primitive</font>
+01864 <a class="code" href="classNLLIGO_1_1CPrimitives.html#c0">convertAddPrimitive</a> (primNode, prim, hidden);
+01865 }
+01866 }
+01867
+01868 <font class="comment">// ***************************************************************************</font>
+01869
+<a name="l01870"></a><a class="code" href="classNLLIGO_1_1CPrimitives.html#a0">01870</a> <font class="keywordtype">void</font> CPrimitives::convert (<font class="keyword">const</font> CPrimRegion &amp;region)
+01871 {
+01872 <font class="comment">// Delete</font>
+01873 <a class="code" href="classNLLIGO_1_1CPrimitives.html#m0">RootNode</a>.removeChildren ();
+01874 <a class="code" href="classNLLIGO_1_1CPrimitives.html#m0">RootNode</a>.removeProperties ();
+01875
+01876 <font class="comment">// For each primitives</font>
+01877 uint i;
+01878 <font class="keywordflow">for</font> (i=0; i&lt;region.VPoints.size (); i++)
+01879 {
+01880 <a class="code" href="classNLLIGO_1_1CPrimitives.html#c1">convertPrimitive</a> (&amp;(region.VPoints[i]), region.VHidePoints[i]);
+01881 }
+01882 <font class="keywordflow">for</font> (i=0; i&lt;region.VPaths.size (); i++)
+01883 {
+01884 <a class="code" href="classNLLIGO_1_1CPrimitives.html#c1">convertPrimitive</a> (&amp;(region.VPaths[i]), region.VHidePaths[i]);
+01885 }
+01886 <font class="keywordflow">for</font> (i=0; i&lt;region.VZones.size (); i++)
+01887 {
+01888 <a class="code" href="classNLLIGO_1_1CPrimitives.html#c1">convertPrimitive</a> (&amp;(region.VZones[i]), region.VHideZones[i]);
+01889 }
+01890 }
+01891
+01892 <font class="comment">// ***************************************************************************</font>
+01893
+01894
+01895 } <font class="comment">// namespace NLLIGO</font>
+01896
+</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>