Desktop/sourceforge/geometria/src/geometria.cpp

Go to the documentation of this file.
00001 /*
00002 This file is part of geometria.
00003 
00004 geometria is free software; you can redistribute it and/or modify 
00005 it under the terms of the GNU General Public License as published 
00006 by the Free Software Foundation; either version 2 of the License, 
00007 or (at your option) any later version.
00008 
00009 geometria is distributed in the hope that it will be useful, but 
00010 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
00011 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
00012 License for more details.
00013 
00014 You should have received a copy of the GNU General Public 
00015 License along with geometria; if not, write to the Free Software 
00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
00017 
00018 (c) Philipp Moritz, 2006
00019 */
00020 
00021 #include <iostream>
00022 #include "kernel/point.hpp"
00023 #include "kernel/line.hpp"
00024 
00025 #include "kernel/geo_point.hpp"
00026 #include "kernel/point_algorithm.hpp"
00027 #include "kernel/free_point_algorithm.hpp"
00028 
00029 #include "kernel/geo_line.hpp"
00030 #include "kernel/line_algorithm.hpp"
00031 #include "kernel/line_join_algorithm.hpp"
00032 #include "kernel/lines_meet_algorithm.hpp"
00033 
00034 #include "kernel/kernel_fassade.hpp"
00035 
00036 #include <boost/shared_ptr.hpp>
00037 
00038 //GUI
00039 #include <QtGui/QApplication>
00040 #include "ui/main_window.hpp"
00041 
00042 int main(int argc, char** argv)
00043 {
00044         QApplication app(argc, argv);
00045         main_window window;
00046         window.show();
00047 
00048         boost::shared_ptr<point_algorithm> algo(new free_point_algorithm(1.0, 4.5));
00049         geo_point_ref p(new geo_point("p", algo));
00050         kernel_fassade::get_instance().add_point(p);
00051 
00052         boost::shared_ptr<point_algorithm> algo2(new free_point_algorithm(5.0, 6.5));
00053         geo_point_ref q(new geo_point("q", algo2));
00054         kernel_fassade::get_instance().add_point(q);
00055 
00056         boost::shared_ptr<point_algorithm> algo3(new free_point_algorithm(5.0, 3.0));
00057         geo_point_ref p2(new geo_point("p2", algo3));
00058         kernel_fassade::get_instance().add_point(p2);
00059 
00060         boost::shared_ptr<point_algorithm> algo4(new free_point_algorithm(1.0, 3.5));
00061         geo_point_ref q2(new geo_point("q2", algo4));
00062         kernel_fassade::get_instance().add_point(q2);
00063 
00064         boost::shared_ptr<line_algorithm> line_algo( new
00065                 line_join_algorithm(p, q));
00066         geo_line_ref l(new geo_line("l", line_algo));
00067         kernel_fassade::get_instance().add_line(l);
00068 
00069         boost::shared_ptr<line_algorithm> line_algo2( new line_join_algorithm(p2, q2));
00070         geo_line_ref l2(new geo_line("l2", line_algo2));
00071         kernel_fassade::get_instance().add_line(l2);
00072 
00073         boost::shared_ptr<point_algorithm> point_algo( new lines_meet_algorithm(l, l2));
00074         geo_point_ref p3(new geo_point("p3", point_algo));
00075         kernel_fassade::get_instance().add_point(p3);
00076 
00077         std::cout << *p;
00078         std::cout << *l;
00079         std::cout << *p3;
00080 
00081         boost::shared_ptr<point_algorithm> new_algo(new free_point_algorithm(10.0, 12.0));
00082         //p->change_parent_algo(new_algo);
00083 
00084         std::cout << *p;
00085         std::cout << *l;
00086         std::cout << *p3;
00087         std::cout << *p3;
00088         
00089 
00090         std::cin.get();
00091         return app.exec();
00092 }
00093 
00102 
00103 
00104 
00107 
00110 

Generated on Fri May 19 19:30:28 2006 for geometria by  doxygen 1.4.6-NO