Move packages to trunk root

This commit is contained in:
Laurent Saboret
2006-02-14 08:58:20 +00:00
parent ee07ad352c
commit 1ba3a9542f
317 changed files with 158 additions and 158 deletions
@@ -0,0 +1,32 @@
5th tutorial
-----------------
The fifth tutorial includes the standard toolbar in the
application. The application has the same functionality but as you
see you can now zoom in, zoom out and translate, using the tools from
the standard toolbar.
The layer is still there, doing nothing but drawing the triangulation.
The class My_Widget is like in the previous example an intance of
Qt_widget, that you need in the class My_Window.
The only difference between this example and the previous one is the
use of standard toolbar. It is declared as private in My_Window class:
CGAL::Qt_widget_standard_toolbar *stoolbar;
To use it, in the constructor of My_Window, it is added:
stoolbar = new CGAL::Qt_widget_standard_toolbar(widget, this);
this->addToolBar(stoolbar->toolbar(), Top, FALSE);
In this tutorial you can play a little bit with the standard toolbar
but you will see probably something that is not quite pleasant. If you
select the hand, and try to use it, you'll see that when you click to
select the first point, also a new CGAL::Point_2 is inserted in the
triangulation. This is due to the fact that the mousePressEvent
implemented in My_Window it is called every time you click on the
widget, even if a tool from the standard toolbar is active.
You will see later a solution to this problem.
@@ -0,0 +1,48 @@
# Created by the script create_makefile
# This is the makefile for compiling a CGAL application.
#---------------------------------------------------------------------#
# include platform specific settings
#---------------------------------------------------------------------#
# Choose the right include file from the <cgalroot>/make directory.
# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE
include $(CGAL_MAKEFILE)
#---------------------------------------------------------------------#
# compiler flags
#---------------------------------------------------------------------#
CXXFLAGS = -I../../../../include/ \
$(CGAL_CXXFLAGS) \
$(LONG_NAME_PROBLEM_CXXFLAGS) \
$(DEBUG_OPT)
#---------------------------------------------------------------------#
# linker flags
#---------------------------------------------------------------------#
LIBPATH = \
$(CGAL_LIB_DIR)
LDFLAGS = \
$(LONG_NAME_PROBLEM_LDFLAGS) \
$(CGAL_QT_LDFLAGS)
#---------------------------------------------------------------------#
# target entries
#---------------------------------------------------------------------#
all: tutorial5$(EXE_EXT)
tutorial5$(EXE_EXT): tutorial5$(OBJ_EXT)
$(CGAL_CXX) $(EXE_OPT)tutorial5 tutorial5$(OBJ_EXT) $(LDFLAGS)
clean: tutorial5.clean
#---------------------------------------------------------------------#
# suffix rules
#---------------------------------------------------------------------#
.C$(OBJ_EXT):
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<
@@ -0,0 +1,74 @@
//demo/Qt_widget/basic/tutorial5/tutorial5.C
#ifndef CGAL_USE_QT
#include <iostream>
int main(int, char*){
std::cout << "Sorry, this demo needs QT..." << std::endl; return 0;}
#else
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/IO/Qt_widget_Delaunay_triangulation_2.h>
#include <qapplication.h>
#include <qmainwindow.h>
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/IO/Qt_widget_layer.h>
#include <CGAL/IO/Qt_widget_standard_toolbar.h>
typedef CGAL::Cartesian<double> Rep;
typedef CGAL::Point_2<Rep> Point;
typedef CGAL::Delaunay_triangulation_2<Rep> Delaunay;
Delaunay dt;
class My_layer : public CGAL::Qt_widget_layer{
void draw(){
*widget << CGAL::BLACK;
*widget << dt;
}
};
class My_widget : public CGAL::Qt_widget {
public:
My_widget(QMainWindow* c) : CGAL::Qt_widget(c) {};
private:
//this event is called only when the user presses the mouse
void mousePressEvent(QMouseEvent *e)
{
Qt_widget::mousePressEvent(e);
dt.insert(Point(x_real(e->x()), y_real(e->y())));
redraw();
}
};
class My_window : public QMainWindow{
public:
My_window(int x, int y)
{
widget = new My_widget(this);
setCentralWidget(widget);
resize(x,y);
widget->set_window(0, x, 0, y);
//How to attach the standard toolbar
stoolbar = new CGAL::Qt_widget_standard_toolbar(widget, this,
"Standard toolbar");
widget->attach(&v);
}
private:
My_widget *widget;
My_layer v;
CGAL::Qt_widget_standard_toolbar *stoolbar;
};
int main( int argc, char **argv )
{
QApplication app( argc, argv );
My_window W(400,400);
app.setMainWidget( &W );
W.show();
W.setCaption("Using the Standard Toolbar");
return app.exec();
}
#endif