Click here to Skip to main content
Click here to Skip to main content

CEQD v1.0 - Earthquake Data Downloader

, 3 Mar 2000
Rate this:
Please Sign up or sign in to vote.
A Freeware MFC class to support retrieval of recent Earthquake data from the USGS.
  • Download source files - 10 Kb
  • Introduction

    Welcome to CEQD, a freeware MFC class to support retrieval of recent Earthquake information from the USGS (United States Geological Survey) via the finger protocol.

    For detailed information about the Finger protocol, you should read RFC 1288. You can find numerous Web Servers which carry these documents by going to www.yahoo.com and look for RFC and 1288.

    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.


    History
    Features
    Usage
    API Reference
    Contacting the Author


    History

    V1.0 (18 October 1999)
    • First public release.


    Features

    • Simple and clean C++ interface.
    • The interface provided is synchronous which provides an easier programming model than using asynchronous sockets.
    • 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.
    • The code can be used in a console application without any problems (Again this is not the case for the MFC socket classes).
    • A configurable timeout for the connection can be set through the main class method.


    Usage

    • 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 CFinger source and copy over the finger cpp and h files into the directory where you have unzipped the CEQD code.
    • To use the class in your code simply 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.
    • To see the class in action, have a look at the code in main in the module main.cpp.
    • Your code will need to include MFC either statically or dynamically.
    • 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.
    • 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.


    API Reference

    The API consists of the class CQuakeData and the single public member function of the class CEQD namely GetQuakeData.

    CQuakeData
    CEQD::GetQuakeData


    class CQuakeData
    {
       enum MagnitudeType
       {
          Ml,
          Lg,
          Md,
          Mb,
          Ms,
          Mw,
       }
    
       enum LocationQuality
    
       {
          A,
          B,
          C,
          D,
          U,
       }
    
       SYSTEMTIME      m_Time;
       float           m_Latitude;
       float           m_Longitude;
       float           m_Depth;
       MagnitudeType   m_MagType;
       float           m_Magnitude;
       LocationQuality m_Quality;
       CString         m_sComments;
    };
    


    Members:

    m_Time
    The Coordinated Universal Time of when the Earthquake took place.

    m_Latitude
    Geographic latitude of the Epicenter. North of the equator is positive, south of the equator is negative.

    m_Longitude
    Geographic longitude of the Epicenter. East of the Greenwich prime meridian is positive, west of the prime meridian is negative.

    m_Depth
    The depth below sea level in Km of the epicenter.

    m_MagType
    Enum of the type of magnitude as reported in m_Magnitude. This member is one of the following enums:
    • Ml: The original Richter magnitude
    • Lg: Local or regional magnitude
    • Md: Duration wave
    • Mb: Body wave
    • Ms: Surface wave
    • Mw: Moment wave

    m_Magnitude
    The actual magnitude of the earthquake on the Richter Scale.

    m_Quality
    Enum of quality of the location fix. This member is one of the following enums:
    • A: Quake location is "Good"
    • B: Quake location is "Fair"
    • C: Quake location is "Poor"
    • D: Quake Location is "Bad"
    • U: Quake Location quality has not been determined

    m_sComments
    This is a textual Description, Normally this will be the location of the quake.

    The CQuakeData class represents the data associated with a single earthquake as returned from CEQD::GetQuakeData().


    CEQD::GetQuakeData

    BOOL CEQD::GetQuakeData(CArray<CQuakeData, CQuakeData&>& data, DWORD dwTimeout = 500);

    Return Value:
    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().

    Parameters:

    • data -- Upon successful return, this will contain an array of CQuakeData instances which represent all the most recent earthquakes which have occurred.
    • dwTimeout -- The timeout value to use in milliseconds for socket connections.

    Remarks:
    Call this member function to perform the actual retrieval of the quake data.



    Contacting the Author

    PJ Naughter
    Email: pjn@indigo..ie
    Web: http://www.naughter.com
    18 October 1999


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    PJ Naughter

    United States United States
    No Biography provided

    Comments and Discussions

     
    Generalbug/fix PinmemberBryce2-May-01 18:10 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Mobile
    Web01 | 2.8.140721.1 | Last Updated 4 Mar 2000
    Article Copyright 2000 by PJ Naughter
    Everything else Copyright © CodeProject, 1999-2014
    Terms of Service
    Layout: fixed | fluid