added max k-gon demo

This commit is contained in:
Radu Ursu 2002-02-13 14:15:01 +00:00
parent 805792c9ee
commit 0dfeda54f6
6 changed files with 784 additions and 0 deletions

1
.gitattributes vendored
View File

@ -1412,6 +1412,7 @@ Packages/Polyhedron/examples/Polyhedron/corner_with_sharp_edge.off -text
Packages/Polyhedron/examples/Polyhedron/cross.off -text
Packages/Qt_widget/demo/Qt_widget/Alpha_shapes_2/demo.dsp -text
Packages/Qt_widget/demo/Qt_widget/Convex_Hull_2/demo.dsp -text
Packages/Qt_widget/demo/Qt_widget/Max_k-gon/demo.dsp -text
Packages/Qt_widget/demo/Qt_widget/Min_ellipse_2/demo.dsp -text
Packages/Qt_widget/demo/Qt_widget/Min_quadrilateral_2/demo.dsp -text
Packages/Qt_widget/demo/Qt_widget/Partition_2/demo.dsp -text

View File

@ -0,0 +1,113 @@
// ============================================================================
//
// Copyright (c) 1997-2000 The CGAL Consortium
//
// This software and related documentation is part of an INTERNAL release
// of the Computational Geometry Algorithms Library (CGAL). It is not
// intended for general use.
//
// ----------------------------------------------------------------------------
//
// file : src/Qt_Window_toolbar.C
// package : QT_window
// author(s) : Radu Ursu
// release :
// release_date :
//
// coordinator : Laurent Rineau <rineau@clipper.ens.fr>
//
// ============================================================================
#ifdef CGAL_USE_QT
#include <CGAL/IO/Qt_widget.h>
#include "Qt_widget_toolbar.h"
// icons
#include <CGAL/IO/pixmaps/movepoint.xpm>
#include <CGAL/IO/pixmaps/point.xpm>
#include <CGAL/IO/pixmaps/arrow.xpm>
namespace CGAL {
Tools_toolbar::Tools_toolbar(Qt_widget *w, QMainWindow *mw, std::list<Point> &l1)
{
//when it is created, the toolbar has 0 buttons
nr_of_buttons = 0;
//set the widget
widget = w;
is_active = FALSE;
#if QT_VERSION < 300
// for Qt 2.3 and before
maintoolbar = new QToolBar("tools", mw, QMainWindow::Top, TRUE, "Tools");
#else
// from Qt 3.0
maintoolbar = new QToolBar(mw, "Tools");
mw->addDockWindow (maintoolbar, "tools", DockTop, TRUE );
#endif
but[0] = new QToolButton(QPixmap( (const char**)arrow_xpm ),
"Detach current tool",
0,
this,
SLOT(notool()),
maintoolbar,
"Detach current tool");
but[1] = new QToolButton(QPixmap( (const char**)point_xpm ),
"Point Tool",
0,
this,
SLOT(pointtool()),
maintoolbar,
"Point Tool");
but[1]->setToggleButton(TRUE);
nr_of_buttons = 2;
connect(w, SIGNAL(detached_tool()), this, SLOT(toggle_button()));
};
//the definition of the slots
void Tools_toolbar::toggle_button ()
{
if(is_active) {
but[activebutton]->toggle();
is_active = false;
}
}
void Tools_toolbar::pointtool()
{
if (but[1]->isOn())
{
widget->attach(pointbut);
activebutton = 1;
is_active = true;
}
else
{
is_active = false;
widget->detach_current_tool();
}
}
void Tools_toolbar::notool()
{
if(is_active) {
widget->detach_current_tool();
is_active = false;
}
}
}//end namespace
#include "Qt_widget_toolbar.moc"
#endif

View File

@ -0,0 +1,81 @@
// ============================================================================
//
// Copyright (c) 1997-2000 The CGAL Consortium
//
// This software and related documentation is part of an INTERNAL release
// of the Computational Geometry Algorithms Library (CGAL). It is not
// intended for general use.
//
// ----------------------------------------------------------------------------
//
// file : include/CGAL/IO/Qt_Window_toolbar.h
// package : QT_window
// author(s) : Ursu Radu
// release :
// release_date :
//
// coordinator : Laurent Rineau <rineau@clipper.ens.fr>
//
// ============================================================================
#ifndef CGAL_QT_WINDOW_TOOLBAR_H
#define CGAL_QT_WINDOW_TOOLBAR_H
#include <CGAL/basic.h>
#include <CGAL/Cartesian.h>
// TODO: check if some of those includes shouldn't be in the .C file
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/IO/Qt_widget_get_point.h>
#include <qobject.h>
#include <qtoolbutton.h>
#include <qtoolbar.h>
#include <qmainwindow.h>
typedef CGAL::Cartesian<double> Rp;
typedef Rp::Point_2 Point;
namespace CGAL {
class Tools_toolbar : public QObject
{
Q_OBJECT
public:
Tools_toolbar(Qt_widget *w, QMainWindow *mw, std::list<Point> &l1);
~Tools_toolbar()
{
delete maintoolbar;
};
QToolBar* toolbar(){return maintoolbar;}
signals:
void new_object(CGAL::Object);
private slots:
void get_new_object(CGAL::Object obj) { emit(new_object(obj)); }
void pointtool();
void notool();
void toggle_button();
private:
QToolBar *maintoolbar;
QToolButton *but[10];
Qt_widget *widget;
int activebutton;
bool is_active;
void setActiveButton(int i);
int nr_of_buttons;
CGAL::Qt_widget_get_point<Rp> pointbut;
};//end class
};//end namespace
#endif

View File

@ -0,0 +1,218 @@
# Microsoft Developer Studio Project File - Name="demo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=demo - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "demo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "demo.mak" CFG="demo - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "demo - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "demo - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "demo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "demo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "$(QTDIR)\include" /I "$(CGALROOT)\stlport" /I "$(CGALROOT)\include\cgal\config\msvc" /I "$(CGALROOT)\auxiliary\wingmp\gmp-2.0.2" /I "$(CGALROOT)\include" /I "..\..\..\\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "CGAL_USE_QT" /D "QT_DLL" /D "UNICODE" /D "QT_THREAD_SUPPORT" /FR /YX /FD /GZ /c /Tp
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib winmm.lib wsock32.lib imm32.lib wsock32.lib winmm.lib $(QTDIR)\lib\qt-mt230nc.lib $(QTDIR)\lib\qtmain.lib $(CGALROOT)\lib\msvc\CGAL.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"msvcrt.lib" /nodefaultlib:"libcmtd" /pdbtype:sept
!ENDIF
# Begin Target
# Name "demo - Win32 Release"
# Name "demo - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=".\max_k-gon.C"
# End Source File
# Begin Source File
SOURCE=..\..\..\src\CGALQt\Qt_widget.C
# End Source File
# Begin Source File
SOURCE=..\..\..\src\CGALQt\Qt_widget_standard_toolbar.C
# End Source File
# Begin Source File
SOURCE=..\..\..\src\CGALQt\Qt_widget_tool.C
# End Source File
# Begin Source File
SOURCE=.\Qt_widget_toolbar.C
# End Source File
# Begin Source File
SOURCE=..\..\..\src\CGALQt\Qt_widget_view.C
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\..\include\CGAL\IO\Qt_Widget.h
!IF "$(CFG)" == "demo - Win32 Release"
!ELSEIF "$(CFG)" == "demo - Win32 Debug"
# Begin Custom Build
InputPath=..\..\..\include\CGAL\IO\Qt_Widget.h
"../../../src/CGALQt/Qt_Widget.moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(QTDIR)\bin\moc.exe -o "../../../src/CGALQt/Qt_Widget.moc" "../../../Include/CGAL/IO/Qt_Widget.h"
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\include\CGAL\IO\Qt_Widget_Get_point.h
# End Source File
# Begin Source File
SOURCE=..\..\..\include\CGAL\IO\Qt_Widget_Handtool.h
# End Source File
# Begin Source File
SOURCE=..\..\..\include\CGAL\IO\Qt_Widget_standard_toolbar.h
!IF "$(CFG)" == "demo - Win32 Release"
!ELSEIF "$(CFG)" == "demo - Win32 Debug"
# Begin Custom Build
InputPath=..\..\..\include\CGAL\IO\Qt_Widget_standard_toolbar.h
"../../../src/CGALQt/Qt_Widget_standard_toolbar.moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(QTDIR)\bin\moc.exe -o "../../../src/CGALQt/Qt_Widget_standard_toolbar.moc" "../../../Include/CGAL/IO/Qt_Widget_standard_toolbar.h"
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\include\CGAL\IO\Qt_Widget_tool.h
!IF "$(CFG)" == "demo - Win32 Release"
!ELSEIF "$(CFG)" == "demo - Win32 Debug"
# Begin Custom Build
InputPath=..\..\..\include\CGAL\IO\Qt_Widget_tool.h
"../../../src/CGALQt/Qt_Widget_tool.moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(QTDIR)\bin\moc.exe -o "../../../src/CGALQt/Qt_Widget_tool.moc" "../../../Include/CGAL/IO/Qt_Widget_tool.h"
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\Qt_widget_toolbar.h
!IF "$(CFG)" == "demo - Win32 Release"
!ELSEIF "$(CFG)" == "demo - Win32 Debug"
# Begin Custom Build
InputPath=.\Qt_widget_toolbar.h
"Qt_widget_toolbar.moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(QTDIR)\bin\moc.exe -o "Qt_widget_toolbar.moc" "Qt_widget_toolbar.h"
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\include\CGAL\IO\Qt_Widget_Zoom.h
# End Source File
# Begin Source File
SOURCE=..\..\..\include\CGAL\IO\Qt_Widget_Zoomrect.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -0,0 +1,64 @@
# 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_LIBPATH)
LDFLAGS = \
$(LONG_NAME_PROBLEM_LDFLAGS) \
$(CGAL_QT_LDFLAGS) \
-lCGALQt
#---------------------------------------------------------------------#
# target entries
#---------------------------------------------------------------------#
all: convex_hull_2
Qt_widget_toolbar$(OBJ_EXT): Qt_widget_toolbar.C Qt_widget_toolbar.moc
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) Qt_widget_toolbar.C
Qt_widget_toolbar.moc: Qt_widget_toolbar.h
$(QT_MOC) -o Qt_widget_toolbar.moc $<
convex_hull_2.moc: convex_hull_2.C Qt_widget_toolbar$(OBJ_EXT)
${QT_MOC} -o convex_hull_2.moc convex_hull_2.C
convex_hull_2$(OBJ_EXT): convex_hull_2.C convex_hull_2.moc
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) convex_hull_2.C
convex_hull_2$(EXE_EXT): convex_hull_2$(OBJ_EXT)
$(CGAL_CXX) $(EXE_OPT)convex_hull_2 convex_hull_2$(OBJ_EXT) \
Qt_widget_toolbar$(OBJ_EXT) $(LDFLAGS)
clean: convex_hull_2.clean \
Qt_widget_toolbar.clean
#---------------------------------------------------------------------#
# suffix rules
#---------------------------------------------------------------------#
.C$(OBJ_EXT):
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<

View File

@ -0,0 +1,307 @@
// if QT is not installed, a message will be issued in runtime.
#ifndef CGAL_USE_QT
#include <iostream>
int main(int, char*)
{
std::cout << "Sorry, this demo needs QT...";
std::cout << std::endl;
return 0;
}
#else
#include <fstream>
#include <stack>
#include <set>
#include <string>
#include <list>
#include <CGAL/basic.h>
#include <CGAL/Cartesian.h>
#include <CGAL/extremal_polygon_2.h>
#include <CGAL/convex_hull_2.h>
#include <CGAL/Polygon_2_algorithms.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/IO/Qt_widget.h>
#include "Qt_widget_toolbar.h"
#include <CGAL/IO/Qt_widget_standard_toolbar.h>
#include <CGAL/IO/Qt_widget_view.h>
#include <qplatinumstyle.h>
#include <qapplication.h>
#include <qmainwindow.h>
#include <qstatusbar.h>
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qtoolbutton.h>
#include <qtoolbar.h>
#include <qfiledialog.h>
#include <qtimer.h>
typedef double Coord_type;
typedef CGAL::Cartesian<Coord_type> Rep;
typedef CGAL::Polygon_traits_2<Rep> Traits;
typedef Traits::Point_2 Point;
typedef Traits::Segment_2 Segment;
typedef std::vector<Point> Container;
typedef CGAL::Polygon_2<Traits,Container> Polygonvec;
const QString my_title_string("Maximum Inscribed K-gon Demo with"
" CGAL Qt_widget");
//global flags and variables
int current_state;
std::list<Point> list_of_points;
class Qt_view_show_ch : public CGAL::Qt_widget_view
{
public:
Qt_view_show_ch(){};
void draw(CGAL::Qt_widget &win)
{
win.lock();
//MAXIMUM INSCRIBED 3-GON
Polygonvec outpol;
CGAL::convex_hull_points_2(list_of_points.begin(), list_of_points.end(), std::back_inserter(outpol));
Polygonvec kg;
if (outpol.size()>2)
CGAL::maximum_area_inscribed_k_gon(outpol.vertices_begin(),outpol.vertices_end(),3, std::back_inserter(kg));
RasterOp old = win.rasterOp(); //save the initial raster mode
win.setRasterOp(XorROP);
win << CGAL::FillColor(CGAL::BLUE);
win << kg;
win.setRasterOp(old);
//MAXIMUM INSCRIBED 5-GON
Polygonvec kg1;
if (outpol.size()>2)
CGAL::maximum_area_inscribed_k_gon(outpol.vertices_begin(),outpol.vertices_end(),5, std::back_inserter(kg1));
old = win.rasterOp(); //save the initial raster mode
win.setRasterOp(XorROP);
win << CGAL::FillColor(CGAL::GRAY);
win << kg1;
win.setRasterOp(old);
//VERTICES
win << CGAL::PointSize(7) << CGAL::PointStyle(CGAL::CROSS);
win << CGAL::GREEN;
std::list<Point>::iterator itp = list_of_points.begin();
while(itp!=list_of_points.end())
win << (*itp++);
//CONVEX HULL
std::list<Point> out;
std::list<Segment> Sl;
CGAL::convex_hull_points_2(list_of_points.begin(), list_of_points.end(), std::back_inserter(out));
if( out.size() > 1 ) {
Point pakt,prev,pstart;
std::list<Point>::const_iterator it;
it=out.begin();
prev= *it; pstart=prev;
it++;
for(; it!=out.end(); ++it) {
pakt= *it;
Sl.push_back(Segment(prev,pakt));
prev=pakt;
}
Sl.push_back(Segment(pakt,pstart));
win << CGAL::RED;
std::list<Segment>::iterator its = Sl.begin();
while(its!=Sl.end())
win << (*its++);
}
win.unlock();
};
};//end class
class MyWindow : public QMainWindow
{
Q_OBJECT
public:
MyWindow(int w, int h): win(this) {
setCentralWidget(&win);
//create a timer for checking if somthing changed
QTimer *timer = new QTimer( this );
connect( timer, SIGNAL(timeout()),
this, SLOT(timer_done()) );
timer->start( 200, FALSE );
// file menu
QPopupMenu * file = new QPopupMenu( this );
menuBar()->insertItem( "&File", file );
file->insertItem("&New", this, SLOT(new_instance()), CTRL+Key_N);
file->insertItem("New &Window", this, SLOT(new_window()), CTRL+Key_W);
file->insertSeparator();
file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X );
file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
// drawing menu
QPopupMenu * draw = new QPopupMenu( this );
menuBar()->insertItem( "&Draw", draw );
draw->insertItem("&Generate points", this, SLOT(gen_points()), CTRL+Key_G );
// help menu
QPopupMenu * help = new QPopupMenu( this );
menuBar()->insertItem( "&Help", help );
help->insertItem("&About", this, SLOT(about()), CTRL+Key_A );
help->insertItem("About &Qt", this, SLOT(aboutQt()) );
//the new tools toolbar
setUsesBigPixmaps(TRUE);
newtoolbar = new CGAL::Tools_toolbar(&win, this, list_of_points);
//the standard toolbar
stoolbar = new CGAL::Standard_toolbar (&win, this);
this->addToolBar(stoolbar->toolbar(), Top, FALSE);
this->addToolBar(newtoolbar->toolbar(), Top, FALSE);
win << CGAL::LineWidth(2) << CGAL::BackgroundColor (CGAL::BLACK);
resize(w,h);
win.show();
win.setMouseTracking(TRUE);
//connect the widget to the main function that receives the objects
connect(&win, SIGNAL(new_cgal_object(CGAL::Object)),
this, SLOT(get_new_object(CGAL::Object)));
//application flag stuff
old_state = 0;
//views
win.attach(&testview);
};
~MyWindow()
{
};
private:
void something_changed(){current_state++;};
public slots:
void set_window(double xmin, double xmax, double ymin, double ymax)
{
win.set_window(xmin, xmax, ymin, ymax);
}
void new_instance()
{
win.detach_current_tool();
win.lock();
list_of_points.clear();
win.set_window(-1.1, 1.1, -1.1, 1.1); // set the Visible Area to the Interval
win.unlock();
something_changed();
}
private slots:
void get_new_object(CGAL::Object obj)
{
Point p;
if(CGAL::assign(p,obj)) {
list_of_points.push_back(p);
something_changed();
}
};
void about()
{
QMessageBox::about( this, my_title_string,
"This is a demo for Triangulation,\n"
"Copyright CGAL @2001");
};
void aboutQt()
{
QMessageBox::aboutQt( this, my_title_string );
}
void new_window(){
MyWindow *ed = new MyWindow(500, 500);
ed->setCaption("View");
ed->show();
ed->set_window(-1.1, 1.1, -1.1, 1.1);
something_changed();
}
void timer_done()
{
if(old_state!=current_state){
win.redraw();
old_state = current_state;
}
}
void gen_points()
{
win.set_window(-1.1, 1.1, -1.1, 1.1); // set the Visible Area to the Interval
// send resizeEvent only on show.
CGAL::Random_points_in_disc_2<Point> g(0.5);
for(int count=0; count<200; count++) {
list_of_points.push_back(*g++);
}
something_changed();
}
private:
CGAL::Qt_widget win;
CGAL::Tools_toolbar *newtoolbar;
CGAL::Standard_toolbar *stoolbar;
int old_state;
Qt_view_show_ch testview;
};
#include "max_k-gon.moc"
int
main(int argc, char **argv)
{
QApplication app( argc, argv );
app.setStyle( new QPlatinumStyle );
QPalette p( QColor( 250, 215, 100 ) );
app.setPalette( p, TRUE );
MyWindow win(800,800); // physical window size
app.setMainWidget(&win);
win.setCaption(my_title_string);
win.setMouseTracking(TRUE);
win.show();
// because Qt send resizeEvent only on show.
win.set_window(-1, 1, -1, 1);
current_state = -1;
return app.exec();
}
#endif // CGAL_USE_QT