<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"        "http://www.w3.org/TR/html4/loose.dtd">
<html>
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                <title>Web API Reference</title>
                <link href="../../custom.css" rel="stylesheet" type="text/css">
                <link href="../../tabs.css" rel="stylesheet" type="text/css">
        </head>
        <body bgcolor="#FFFFFF">
                <table width="100%" border="0">
                        <tr>
                                <td><b>Web API Reference</b></td>
                                <td align="right"><b>MapGuide Open Source</b></td>
                        </tr>                        
                </table>
<!-- End of: MgOpenSource_header.html -->
<!-- Generated by Doxygen 1.4.5 -->
<div class="tabs">
<ul>
<li><a href="../../main.html"><span>Main Page</span></a></li>
<li><a href="../../modules.html"><span>Modules</span></a></li>
<li><a href="../../namespaces.html"><span>Namespaces</span></a></li>
<li id="current"><a href="../../annotated.html"><span>Classes</span></a></li>
<li><a href="../../files.html"><span>Files</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="../../annotated.html"><span>Class List</span></a></li>
<li><a href="../../classes.html"><span>Alphabetical List</span></a></li>
<li><a href="../../hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="../../functions.html"><span>Class Members</span></a></li>
</ul></div>
<h1>MgFeatureReader Class Reference<br>
<small>
[<a class="el" href="../../d1/d38/group___mg_feature_reader.html">MgFeatureReader</a>]</small>
</h1><!-- doxytag: class="MgFeatureReader" --><!-- doxytag: inherits="MgReader" -->Inherits <a class="el" href="../../df/dcc/class_mg_reader.html">MgReader</a>.
<p>
Inherited by <a class="el" href="../../de/d56/class_mg_gws_feature_reader.html">MgGwsFeatureReader</a>.
<p>
Inheritance diagram for MgFeatureReader:<p><center><img src="../../d8/d5f/class_mg_feature_reader__inherit__graph.png" border="0" usemap="#d3/daf/_mg_feature_reader__inherit__map" alt="Inheritance graph"></center>
<map name="d3/daf/_mg_feature_reader__inherit__map">
<area href="../../de/d56/class_mg_gws_feature_reader.html" shape="rect" coords="7,156,161,183" alt="">
<area href="../../df/dcc/class_mg_reader.html" shape="rect" coords="43,7,125,33" alt="">
</map>
<center><font size="2">[<a target="top" href="../../graph_legend.html">legend</a>]</font></center><a href="../../d1/d4c/class_mg_feature_reader-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
Provides a forward-only, read-only iterator for reading features selected from the FDO Provider by the MgFeatureService::SelecteFeatures() method call.
<p>
<dl compact><dt><b>Remarks:</b></dt><dd>You must call <a class="el" href="../../df/dcc/class_mg_reader_c3678e4e76f61e5481df9b2d04b23805.html#c3678e4e76f61e5481df9b2d04b23805">ReadNext()</a> before you can access the data. Call GetProperties() to get the property values for the feature. For each property, determine the property type and then call the appropriate Get<type>() method to get the value of the property. With one exception the Get<type> methods belong to the <a class="el" href="../../df/dcc/class_mg_reader.html">MgReader</a> base class. The exception is <a class="el" href="../../d6/ddc/class_mg_feature_reader_448e2cbb8ae4479ba1531aa44a0d298f.html#448e2cbb8ae4479ba1531aa44a0d298f">MgFeatureReader::GetFeatureObject()</a>. Obtain the next feature by calling the <a class="el" href="../../df/dcc/class_mg_reader_c3678e4e76f61e5481df9b2d04b23805.html#c3678e4e76f61e5481df9b2d04b23805">ReadNext()</a> method.</dd></dl>
<div class="Example">
<b>Example (PHP)</b>
<br>
<div class="fragment"><pre class="fragment"> <span class="comment">// each ReadNext() gets a "row" object, that is,</span>
<span class="comment">// an instantiation of a class with properties</span>
<span class="comment">// returns number of features in reader</span>
function printFeatureReader($featureReader) {
global $logFileHandle;
$i = 0;
<span class="keywordflow">while</span> ($featureReader->ReadNext()) {
fwrite($logFileHandle, <span class="stringliteral">"Printing a feature.n"</span>);
$i++;
$propCount = $featureReader->GetPropertyCount();
<span class="keywordflow">for</span>($j=0; $j<$propCount; $j++) {
$propertyName = $featureReader->GetPropertyName($j);
$boolVal = $featureReader->IsNull($propertyName);
<span class="keywordflow">if</span> ($boolVal) {
<span class="keywordflow">continue</span>;
}
$propertyType = $featureReader->GetPropertyType($propertyName);
printPropertyValueFromFeatReader($featureReader, $propertyType, $propertyName);
}
}
<span class="keywordflow">return</span> $i;
\}
function printPropertyValueFromFeatReader($featureReader, $propertyType, $propertyName) {
global $logFileHandle;
global $agfReaderWriter;
global $wktReaderWriter;
<span class="keywordflow">switch</span> ($propertyType) {
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_bbb93ef26e3c101ff11cdd21cab08a94.html#bbb93ef26e3c101ff11cdd21cab08a94">MgPropertyType::Null</a> :
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is a null propertyn"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_27226c864bac7454a8504f8edb15d95b.html#27226c864bac7454a8504f8edb15d95b">MgPropertyType::Boolean</a> :
$val = $featureReader->GetBoolean($propertyName);
$valStr = printBoolean($val);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is boolean "</span>$valStr<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_a245c3230debe5c956484ecc6fa93877.html#a245c3230debe5c956484ecc6fa93877">MgPropertyType::Byte</a> :
$val = $featureReader->GetByte($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName has a byte value of "</span>$val<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_8cf10d2341ed01492506085688270c1e.html#8cf10d2341ed01492506085688270c1e">MgPropertyType::DateTime</a> :
$val = $featureReader->GetDateTime($propertyName);
$valStr = printDateTime($val);
fwrite($logFileHandle, <span class="stringliteral">"DateTime is "</span>$valStr<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_66ba162102bbf6ae31b522aec561735e.html#66ba162102bbf6ae31b522aec561735e">MgPropertyType::Single</a> :
$val = $featureReader->GetSingle($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is single "</span>$val<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_d909d38d705ce75386dd86e611a82f5b.html#d909d38d705ce75386dd86e611a82f5b">MgPropertyType::Double</a> :
$val = $featureReader->GetDouble($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is double "</span>$val<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_39bc2ae44b184207f560ff8619823208.html#39bc2ae44b184207f560ff8619823208">MgPropertyType::Int16</a> :
$val = $featureReader->GetInt16($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is int16 "</span>$val<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_c06129f6e6e15c09328365e553f1dc31.html#c06129f6e6e15c09328365e553f1dc31">MgPropertyType::Int32</a> :
$val = $featureReader->GetInt32($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is int32 "</span>$val<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_fbde23b11d7e59af7828e81144c8b487.html#fbde23b11d7e59af7828e81144c8b487">MgPropertyType::Int64</a> :
$val = $featureReader->GetInt64($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is int64 "</span>$val<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_27118326006d3829667a400ad23d5d98.html#27118326006d3829667a400ad23d5d98">MgPropertyType::String</a> :
$val = $featureReader->GetString($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is string "</span>$val<span class="stringliteral">"n"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_e8016c85ada38bdc5fac616ec1318047.html#e8016c85ada38bdc5fac616ec1318047">MgPropertyType::Blob</a> :
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is blobn"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_a2fa2338da6bc90879f423acd76c7155.html#a2fa2338da6bc90879f423acd76c7155">MgPropertyType::Clob</a> :
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is clobn"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_21021ea0e52be8e9c599f4dff41e5be0.html#21021ea0e52be8e9c599f4dff41e5be0">MgPropertyType::Feature</a> :
$val = $featureReader->GetFeatureObject($propertyName);
<span class="keywordflow">if</span> ($val != NULL) {
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is a featuren"</span>);
printFeatureReader($val);
}
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_d9c6333623e6357515fcbf17be806273.html#d9c6333623e6357515fcbf17be806273">MgPropertyType::Geometry</a> :
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is a geometryn"</span>);
$val = $featureReader->GetGeometry($propertyName);
<span class="keywordflow">if</span> ($val != NULL) {
$aGeometry = $agfReaderWriter->Read($val);
$wktRepresentation = $wktReaderWriter->Write($aGeometry);
fwrite($logFileHandle, <span class="stringliteral">"WKT Representation: "</span>$wktRepresentation<span class="stringliteral">"n"</span>);
} <span class="keywordflow">else</span> {
fwrite($logFileHandle, <span class="stringliteral">"This geometry property is nulln"</span>);
}
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> <a class="code" href="../../d1/d70/class_mg_property_type_7125f394de382b13a7e7a5a4b6d23364.html#7125f394de382b13a7e7a5a4b6d23364">MgPropertyType::Raster</a> :
$val = $featureReader->GetRaster($propertyName);
fwrite($logFileHandle, <span class="stringliteral">"$propertyName is a rastern"</span>);
<span class="keywordflow">break</span>;
<span class="keywordflow">default</span> : fwrite($logFileHandle, <span class="stringliteral">"Unknown property typen"</span>);
}
\}
</pre></div> </div>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="../../db/dcf/class_mg_class_definition.html">MgClassDefinition</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d6/ddc/class_mg_feature_reader_a0bf28795df94035d3bf72332a4ddbb5.html#a0bf28795df94035d3bf72332a4ddbb5">GetClassDefinition</a> ()=0</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the class definition of the object currently being read. If the user has requested only a subset of the class properties (as specified in the filter text), the class definition reflects what the user has requested, rather than the full class definition. <a href="#a0bf28795df94035d3bf72332a4ddbb5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="../../d6/ddc/class_mg_feature_reader.html">MgFeatureReader</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d6/ddc/class_mg_feature_reader_448e2cbb8ae4479ba1531aa44a0d298f.html#448e2cbb8ae4479ba1531aa44a0d298f">GetFeatureObject</a> (CREFSTRING propertyName)=0</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Use this method to obtain the values of the properties belonging to an object contained in the feature class instance. Such an object is a property of the feature class instance with a type of <a class="el" href="../../d1/d70/class_mg_property_type_21021ea0e52be8e9c599f4dff41e5be0.html#21021ea0e52be8e9c599f4dff41e5be0">MgPropertyType::Feature</a>. <a href="#448e2cbb8ae4479ba1531aa44a0d298f"></a><br></td></tr>
</table>
<!-- MgOpenSource_footer.html -->        
                <!--
                <hr>
                *** Not currently used. Need new address. ***                
                
                <table width="100%" border="0">
                        <tr>
                                <td>Comments or suggestions? Send us
                                 <a href="mailto:docfeedback@osgeo.org&subject=MapGuide%20Web%20API%20documentation">
                                 feedback</a>.
                                </td>
                                [[The logo can go in another cell, when we get one]]                
                        </tr>
                </table>
                -->
                <hr>
        </body>
</html>