1
0
Fork 0

Converted to Point3D class.

This commit is contained in:
curt 1998-10-20 15:49:22 +00:00
parent 5321d533d6
commit 048130a991
2 changed files with 30 additions and 11 deletions

View file

@ -3,7 +3,7 @@
//
// Written by Curtis Olson, started November 1997.
//
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
// Copyright (C) 1997 Curtis L. Olson - curt@me.umn.edu
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -36,16 +36,20 @@
#include <Misc/fgstream.hxx>
#include "fixnode.hxx"
// #include "triload.hxx"
// load extra nodes
void load_extra(const string& filename, container& extra_list) {
}
// load the node information
void load_nodes(const string& filename, container& node_list) {
fgPoint3d node;
Point3D node;
int dim, junk1, junk2;
int i, nodecount;
cout << "Loading node file: " + filename + " ...\n";
cout << "Loading node file: " << filename << " ...\n";
fg_gzifstream in( filename );
if ( !in ) {
@ -64,7 +68,7 @@ void load_nodes(const string& filename, container& node_list) {
in.eat_comments();
while ( ! in.eof() ) {
in.stream() >> junk1 >> node.x >> node.y >> node.z >> junk2;
in.stream() >> junk1 >> node >> junk2;
in.eat_comments();
node_list.push_back(node);
}
@ -86,8 +90,9 @@ void fix_nodes( const string& filename, fgDEM& dem, container& node_list )
// printf("Current: %d %.2f %.2f %.2f\n", i, nodes[i][0],
// nodes[i][1], nodes[i][2]);
(*current).z =
dem.interpolate_altitude( (*current).x, (*current).y );
(*current).setz(
dem.interpolate_altitude( (*current).x(),
(*current).y() ) );
// printf("Fixed: %d %.2f %.2f %.2f\n", i, nodes[i][0],
// nodes[i][1], nodes[i][2]);
@ -107,7 +112,7 @@ void fix_nodes( const string& filename, fgDEM& dem, container& node_list )
i = 1;
for ( current = node_list.begin() ; current != last ; ++current ) {
fprintf( fd, "%d %.2f %.2f %.2f 0\n", i,
(*current).x, (*current).y, (*current).z );
(*current).x(), (*current).y(), (*current).z() );
++i;
}
@ -116,6 +121,9 @@ void fix_nodes( const string& filename, fgDEM& dem, container& node_list )
// $Log$
// Revision 1.6 1998/10/20 15:49:22 curt
// Converted to Point3D class.
//
// Revision 1.5 1998/09/22 23:49:10 curt
// eliminated a left over #include
//

View file

@ -40,10 +40,10 @@ using namespace std;
#endif
#include <DEM/dem.hxx>
#include <Include/fg_types.h>
#include <Math/point3d.hxx>
typedef vector < fgPoint3d > container;
typedef vector < Point3D > container;
typedef container::iterator iterator;
typedef container::const_iterator const_iterator;
@ -52,7 +52,15 @@ typedef container::const_iterator const_iterator;
void load_nodes(const string& basename, container& node_list);
// load the node information
// load the extra nodes. These are always the first n nodes of the
// .node file. (??? These will be tagged with a code indicating what
// needs to be done with this node's elevation such as adjust to local
// DEM elevation, or massage the local DEM points to match this
// elevation point. ???)
void load_extra_nodes(const string& filename, container& node_list);
// fix the node elevations
void fix_nodes( const string& basename, fgDEM& dem, container& node_list );
@ -60,6 +68,9 @@ void fix_nodes( const string& basename, fgDEM& dem, container& node_list );
// $Log$
// Revision 1.4 1998/10/20 15:49:23 curt
// Converted to Point3D class.
//
// Revision 1.3 1998/09/19 20:43:53 curt
// C++-ified and STL-ified the code. Combined triload.* and fixnode.* into
// a single file.