Advertisement
Guest User

Untitled

a guest
May 30th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1.     // Loop through the file's data one line at a time until it runs out of data/lines.
  2.     while (std::getline(fileData, singleLine))
  3.     {
  4.         // Store each line as a stringstream.
  5.         istringstream lineData(singleLine);
  6.  
  7.         // Each line has a known structure so use variables to grab the values from the line's stringstream.
  8.         // Each line consists of: placeZ X Y, with X and Y being coordinate numbers and Z being the
  9.         // place number.
  10.         // E.g. place0 1234 5678.
  11.         string placeName;
  12.         double xPos;
  13.         double yPos;
  14.  
  15.         lineData >> placeName;  // Grab the placename from the stream.
  16.         lineData >> xPos;       // Grab the X coordinate from the stream.
  17.         lineData >> yPos;       // Grab the Y coordinate from the stream.
  18.  
  19.         // Create a feature node with the recently collected data.
  20.         PlaceNode* tempNode = new PlaceNode(placeName, xPos, yPos);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement