📄 eqd.htm
字号:
<html>
<head>
<title>CEQD v1.0</title>
</head>
<body bgcolor="#FFFFFF">
<p align="left"><strong><font face="Arial" size="6">CEQD v1.0</font></strong></p>
<p><font face="Arial">Welcome to <strong>CEQD</strong>, a freeware MFC class to
support retrieval of recent Earthquake information from the USGS (United States Geological
Survey) via the finger
protocol.</font></p>
<p><font face="Arial">For detailed information about the Finger protocol, you
should read RFC 1288.</font> <font face="Arial">You can find numerous Web
Servers which carry these documents by going to <a href="http://www.yahoo.com">www.yahoo.com</a>
and look for RFC and 1288. </font></p>
<p></p>
<p><font face="Arial">The sample app provided with the code implements a very
simple console app which queries for the Earthquake information and displays the
results using simple printf calls.</font></p>
<p> </p>
<table border="0">
<tbody>
<tr>
<td><font face="Arial" size="3"><strong>Contents</strong></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#History">History</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#Features">Features</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#Usage">Usage</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#APIReference">API Reference</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#Contact">Contacting the Author</a></font></td>
</tr>
</tbody>
</table>
<p></p>
<p> </p>
<p> </p>
<p><font face="Arial"><a name="History"></a><strong><big><big>History</big></big></strong></font></p>
<p><font color="#000000" size="3" face="Arial"><strong>V1.0 (18 October 1999)</strong></font>
<ul>
<li><font color="#000000" face="Arial" size="3">First public release.</font></li>
</ul>
<p> </p>
<p> </p>
<p> </p>
<p><font face="Arial"><a name="Features"></a><big><strong><big>Features</big></strong></big></font>
<ul>
<li><font color="#000000" face="Arial" size="3">Simple and clean C++
interface.</font>
<li><font color="#000000" face="Arial" size="3">The interface provided is
synchronous which provides an easier programming model than using
asynchronous sockets.</font>
<li><font color="#000000" face="Arial" size="3">The code does not rely on the
MFC socket classes. These classes have a number of shortcomings, one of
which causes problems when they are used in NT services.</font>
<li><font color="#000000" face="Arial" size="3">The code can be used in a
console application without any problems (Again this is not the case for the
MFC socket classes).</font>
<li><font color="#000000" face="Arial" size="3">A configurable timeout for the
connection can be set through the main class method.</font></li>
</ul>
<p> </p>
<p> </p>
<p> </p>
<p><a name="Usage"></a><font face="Arial"><big><big><strong>Usage</strong></big></big></font>
<ul>
<li><font color="#000000" face="Arial" size="3">The code internally makes use
of another of the authors classes namely CFinger. Before you can compile
CEQD, you will also need to download the <a href="http://indigo.ie/~pjn/finger.html">CFinger
source</a> and copy over the finger cpp and h files into the directory where
you have unzipped the CEQD code</font>
<li><font color="#000000" face="Arial" size="3">To use the class in your code
simple include eqd.cpp and finger.cpp in your project and #include eqd.h in
which ever of your modules needs to make calls to the class.</font></li>
<li><font face="Arial">To see the class in action, have a look at the code in
main in the module "main.cpp".</font>
<li><font face="Arial">Your code will need to include MFC either statically or
dynamically.</font>
<li><font face="Arial">You will need to have a functioning Winsock stack
installed and correctly initialized prior to calling the GetQuakeData
method. Depending on your application, this will involve calling either
WSAStartup or AfxSocketInit at startup of your application.</font>
<li><font face="Arial">You will also need to have afxpriv.h and winsock.h or
afxsock.h in your precompiled header. The code will work just as well in a
GUI or console app. The code should also work in a multithreaded
application, although it has not be explicitly tested in this scenario.</font></li>
</ul>
<p> </p>
<p> </p>
<p> </p>
<p class="crt"><font face="Arial"><a name="APIReference"></a><big><big><strong>API
Reference</strong></big></big></font></p>
<p><font face="Arial">The API consists of the class CQuakeData and the single
public member function of the class CEQD namely GetQuakeData.</font></p>
<p><a href="#CQuakeData"><b><font face="Arial">CQuakeData</font></b></a><br>
<font face="Arial"><a href="#GetQuakeData"><b>CEQD::GetQuakeData</b></a></font></p>
<p>
</p>
<p><font face="Arial"><a name="CQuakeData"></a><b>class CQuakeData</b><br>
{<br>
enum MagnitudeType<br>
{<br>
Ml,<br>
Lg,<br>
Md,<br>
Mb,<br>
Ms,<br>
Mw,<br>
};<br>
<br>
enum LocationQuality<br>
{<br>
A,<br>
B,<br>
C,<br>
D,<br>
U,<br>
};<br>
<br>
SYSTEMTIME m_Time;<br>
float m_Latitude;<br>
float m_Longitude;<br>
float m_Depth;<br>
MagnitudeType m_MagType;<br>
float m_Magnitude;<br>
LocationQuality m_Quality;<br>
CString m_sComments;<br>
};</font>
</p>
<p>
</p>
<p class="crt"><font face="Arial"><strong>Members</strong></font></p>
<table width="563">
<tbody>
<tr>
<td vAlign="top" width="132"><font face="Arial"><strong>m_Time</strong></font></td>
<td width="423"><font face="Arial">The Coordinated Universal Time of when
the Earthquake took place.</font></td>
</tr>
<tr>
<td vAlign="top" width="132"><font face="Arial"><strong>m_Latitude</strong></font></td>
<td width="423"><font face="Arial">Geographic latitude of the Epicenter.
North of the equator is positive, south of the equator is negative.</font></td>
</tr>
<tr>
<td vAlign="top" width="132"><font face="Arial"><strong>m_Longitude</strong></font></td>
<td width="423"><font face="Arial">Geographic longitude of the Epicenter.
East of the Greenwich prime meridian is positive, west of the prime
meridian is negative.</font></td>
</tr>
<tr>
<td vAlign="top" width="132"><font face="Arial"><strong>m_Depth</strong></font></td>
<td width="423"><font face="Arial">The depth below sea level in Km of the epicenter</font></td>
</tr>
<tr>
<td vAlign="top" width="132"><font face="Arial"><strong>m_MagType</strong></font></td>
<td width="423"><font face="Arial">Enum of the type of magnitude as
reported in m_Magnitude. This member is one of the following enums:</font>
<p><font face="Arial"><i>Ml: The original Richter magnitude<br>
Lg: Local or regional magnitude<br>
Md: Duration wave<br>
Mb: Body wave<br>
Ms: Surface wave<br>
Mw: Moment wave</i></font></p>
</td>
</tr>
<tr>
<td vAlign="top" width="132"><font face="Arial"><strong>m_Magnitude</strong></font></td>
<td width="423"><font face="Arial">The actual magnitude of the earthquake
on the Richter Scale.</font></td>
</tr>
<tr>
<td vAlign="top" width="132"><font face="Arial"><strong>m_Quality</strong></font></td>
<td width="423"><font face="Arial">Enum of quality of the location fix.
This member is one of the following enums:</font>
<p><font face="Arial"><i>A: Quake location is "Good"<br>
B: Quake location is "Fair"<br>
C: Quake location is "Poor"<br>
D: Quake Location is "Bad"<br>
U: Quake Location quality has not been determined</i></font></p>
</td>
</tr>
<tr>
<td vAlign="top" width="132"><font face="Arial"><b>m_sComments</b></font></td>
<td width="423"><font face="Arial">This is a textual Description, Normally
this will be the location of the quake</font></td>
</tr>
</tbody>
</table>
<p class="crt"><font face="Arial">The CQuakeData class represents the data
associated with a single earthquake as returned from CEQD::GetQuakeData.</font></p>
<p> </p>
<p> </p>
<p><a name="GetQuakeData"><strong><font face="Arial"><big></font></strong></a><font face="Arial"><strong>CEQD</strong></font></big><strong><font face="Arial"><big>::GetQuakeData</big></font></strong></p>
<p><font face="Arial"><strong>BOOL CEQD::GetQuakeData(CArray<CQuakeData,
CQuakeData&>& </strong>data<strong>, DWORD </strong><i>dwTimeout</i><strong>
= 500);</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">If the function succeeds, the return value is
TRUE. If the function fails, the return value is FALSE. To get extended error
information, call ::GetLastError.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>data</em> Upon successful return, this will contain an
array of CQuakeData instances which represent all the most recent earthquakes
which have occurred.</font></p>
<p><font face="Arial"><i>dwTimeout</i> The timeout value to use in milliseconds
for socket connections.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Call this member function to perform the actual retrieval
of the quake data.</font></p>
<p></p>
<p> </p>
<p> </p>
<p><font face="Arial"><a name="Contact"></a><font color="#000000" size="3"><strong>CONTACTING
THE AUTHOR</strong></font></font></p>
<p><font color="#000000" face="Arial" size="3">PJ Naughter<br>
Email: <a href="mailto:pjn@indigo..ie">pjn@indigo..ie</a><br>
Web: <a href="http://indigo.ie/~pjn">http://indigo.ie/~pjn</a><br>
18 October 1999</font></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -