1 // Description:
2 //   Path manager.
3 //
4 // Copyright (C) 2001 Frank Becker
5 //
6 // This program is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free Software
8 // Foundation;  either version 2 of the License,  or (at your option) any  later
9 // version.
10 //
11 // This program is distributed in the hope that it will be useful,  but  WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
14 //
15 #include <Trace.hpp>
16 #include <LPathManager.hpp>
17 
LPathManager(void)18 LPathManager::LPathManager( void)
19 {
20     XTRACE();
21 }
22 
~LPathManager()23 LPathManager::~LPathManager()
24 {
25     XTRACE();
26 }
27 
load(const string & pathName)28 LPath *LPathManager::load( const string &pathName)
29 {
30     XTRACE();
31     LPath *lp = 0;
32     BezierCurve<Point3D> *bc = new BezierCurve<Point3D>(64);
33 
34     string fullPathName = pathName+".path";
35 
36     if( bc->Load( fullPathName.c_str()))
37     {
38 	//move start of curve to origin
39 	Point3D start = bc->GetControlPoint(0) * -1;
40 	bc->MoveCurve( start);
41 	bc->ScaleCurve( 0.15f);
42 /*
43 	LOG_INFO << "Moving Curve by ["
44 		 << start.x << ","
45 		 << start.y << ","
46 		 << start.z << "]" << endl;
47 */
48 
49 	lp = new LPath( bc);
50 	LOG_INFO << "  Path [" << pathName << "]" << endl;
51     }
52     else
53     {
54 	LOG_ERROR << "Unable to load: " << pathName << endl;
55 	delete bc;
56     }
57 
58     return lp;
59 }
60