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,34 @@
Third tutorial
-----------------
This tutorial guides you through the first contact with Layers.
This tutorial is doing exactly what the previous tutorial does, but
instead of putting the code for drawing in the redraw() function, it use a
layer.
In this example the layer is:
class My_Layer : public CGAL::Qt_widget_layer{
void draw(CGAL::Qt_widget& win){
win << dt;
}
};
As you see you have to provide a draw() function in your layer, in
order to create output on the screen. The Qt_widget will call this
draw() function for every attached and active layer. A layer is active
in the moment of attaching by default.
In the code of the constructor of My_Window the layer is attached to
the widget:
attach(&v);
Because the layer is attached, the triangulation will appear on the
screen every time you call redraw(), as the widget redraws all the
layers. This means that in this tutorial every time you press the mouse
button, the triangulation will be redrawn.
Try to detach the layer to see what happens. Or try to deactivate
the layer: The triangulation will not be shown anymore.
@@ -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: tutorial3$(EXE_EXT)
tutorial3$(EXE_EXT): tutorial3$(OBJ_EXT)
$(CGAL_CXX) $(EXE_OPT)tutorial3 tutorial3$(OBJ_EXT) $(LDFLAGS)
clean: tutorial3.clean
#---------------------------------------------------------------------#
# suffix rules
#---------------------------------------------------------------------#
.C$(OBJ_EXT):
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<
@@ -0,0 +1,54 @@
//demo/Qt_widget/basic/tutorial3/tutorial3.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 <CGAL/IO/Qt_widget.h>
#include <CGAL/IO/Qt_widget_layer.h>
#include <qapplication.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 << dt;
}
};
class My_window : public CGAL::Qt_widget {
public:
My_window(int x, int y)
{
resize(x,y);
attach(&layer);
};
private:
//this method is called 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();
}
My_layer layer;
};
int main( int argc, char **argv )
{
QApplication app( argc, argv );
My_window *W = new My_window(400,400);
app.setMainWidget(W);
W->show();
W->set_window(0, 400, 0, 400);
return app.exec();
}
#endif