|
|
|
@ -371,39 +371,171 @@ diff -up ./FAQ.html.orig ./FAQ.html
|
|
|
|
|
diff -up ./svm-predict.c.orig ./svm-predict.c
|
|
|
|
|
diff -up ./svm-toy/qt/Makefile.orig ./svm-toy/qt/Makefile
|
|
|
|
|
--- ./svm-toy/qt/Makefile.orig 2007-10-14 16:29:12.000000000 +1000
|
|
|
|
|
+++ ./svm-toy/qt/Makefile 2008-04-01 16:17:52.000000000 +1000
|
|
|
|
|
@@ -1,19 +1,23 @@
|
|
|
|
|
+++ ./svm-toy/qt/Makefile 2008-04-02 14:07:17.000000000 +1000
|
|
|
|
|
@@ -1,19 +1,43 @@
|
|
|
|
|
CXX? = g++
|
|
|
|
|
CFLAGS = -Wall -O3 -DQT_THREAD_SUPPORT
|
|
|
|
|
+QTDIR = $(LIBDIR)/qt-3.3
|
|
|
|
|
BIN = $(QTDIR)/bin
|
|
|
|
|
INCLUDE = $(QTDIR)/include
|
|
|
|
|
LIB = $(QTDIR)/lib
|
|
|
|
|
-CFLAGS = -Wall -O3 -DQT_THREAD_SUPPORT
|
|
|
|
|
-BIN = $(QTDIR)/bin
|
|
|
|
|
-INCLUDE = $(QTDIR)/include
|
|
|
|
|
-LIB = $(QTDIR)/lib
|
|
|
|
|
-#BIN = /usr/bin
|
|
|
|
|
-#INCLUDE = /usr/include/qt3
|
|
|
|
|
-#LIB = /usr/lib/qt3
|
|
|
|
|
+DOT_LIBS=../../.libs
|
|
|
|
|
+LIBS= -L${DOT_LIBS} -lsvm
|
|
|
|
|
+#CFLAGS = -Wall -O3 -DQT_THREAD_SUPPORT
|
|
|
|
|
+CFLAGS = -Wall -O3
|
|
|
|
|
+QT4_DIR= $(shell if [ -e /usr/lib/qt4 ]; then echo /usr/lib/qt4; fi)
|
|
|
|
|
+#LIBDIR=/usr/lib64
|
|
|
|
|
+#QT4_DIR=
|
|
|
|
|
|
|
|
|
|
-svm-toy: svm-toy.cpp svm-toy.moc ../../svm.o
|
|
|
|
|
- $(CXX) -I$(INCLUDE) $(CFLAGS) svm-toy.cpp ../../svm.o -o svm-toy -L$(LIB) -lqt-mt
|
|
|
|
|
+ifdef QT4_DIR
|
|
|
|
|
+ QTDIR=${QT4_DIR}
|
|
|
|
|
+ BIN = $(QTDIR)/bin
|
|
|
|
|
+ FLAGS=${CFLAGS} -I/usr/include/Qt -DQT3_SUPPORT `pkg-config --cflags --libs Qt3Support QtGui`
|
|
|
|
|
+else
|
|
|
|
|
+ QTDIR=${LIBDIR}/qt-3.3
|
|
|
|
|
+ BIN = $(QTDIR)/bin
|
|
|
|
|
+ FLAGS=${CFLAGS} `pkg-config --cflags --libs qt-mt`
|
|
|
|
|
+endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+DOT_LIBS=../../.libs
|
|
|
|
|
+LIBS= -L${DOT_LIBS} -lsvm
|
|
|
|
|
+
|
|
|
|
|
+all: svm-toy-qt
|
|
|
|
|
+
|
|
|
|
|
+svm-toy-qt: svm-toy.cpp svm-toy.moc ../../svm.o
|
|
|
|
|
+ $(CXX) -I$(INCLUDE) $(CFLAGS) svm-toy.cpp ../../svm.o -o svm-toy-qt -L$(LIB) $(LIBS) -lqt-mt
|
|
|
|
|
+svm-toy-qt: svm-toy.new.cpp svm-toy.moc ../../svm.o
|
|
|
|
|
+ $(CXX) $(FLAGS) svm-toy.new.cpp ../../svm.o -o svm-toy-qt $(LIBS)
|
|
|
|
|
# add -pthread for bsd
|
|
|
|
|
|
|
|
|
|
svm-toy.moc: svm-toy.cpp
|
|
|
|
|
+ echo "LIBDIR=${LIBDIR}"
|
|
|
|
|
+ echo "QTDIR=${QTDIR}"
|
|
|
|
|
$(BIN)/moc svm-toy.cpp -o svm-toy.moc
|
|
|
|
|
-svm-toy.moc: svm-toy.cpp
|
|
|
|
|
- $(BIN)/moc svm-toy.cpp -o svm-toy.moc
|
|
|
|
|
-../../svm.o:
|
|
|
|
|
- cd ../..; make svm.o
|
|
|
|
|
+
|
|
|
|
|
+svm-toy.moc: svm-toy.new.cpp
|
|
|
|
|
+ echo "LIBDIR=${LIBDIR}"
|
|
|
|
|
+ echo "QTDIR=${QTDIR}"
|
|
|
|
|
+ echo "FLAGS=${FLAGS}"
|
|
|
|
|
+ $(BIN)/moc svm-toy.new.cpp -o svm-toy.moc
|
|
|
|
|
+#../../svm.o:
|
|
|
|
|
+# cd ../..; make svm.o
|
|
|
|
|
+svm-toy.new.cpp: svm-toy.cpp
|
|
|
|
|
+ cp svm-toy.cpp svm-toy.new.cpp
|
|
|
|
|
+ifdef QT4_DIR
|
|
|
|
|
+ ${BIN}/qt3to4 -alwaysOverwrite svm-toy.new.cpp
|
|
|
|
|
+endif
|
|
|
|
|
+
|
|
|
|
|
clean:
|
|
|
|
|
rm -f *~ svm-toy svm-toy.moc ../../svm.o
|
|
|
|
|
- rm -f *~ svm-toy svm-toy.moc ../../svm.o
|
|
|
|
|
+ rm -f *~ svm-toy-qt svm-toy.moc ../../svm.o svm-toy.new.cpp
|
|
|
|
|
diff -up ./svm-toy/qt/svm-toy.cpp.orig ./svm-toy/qt/svm-toy.cpp
|
|
|
|
|
--- ./svm-toy/qt/svm-toy.cpp.orig 2008-04-01 16:55:51.000000000 +1000
|
|
|
|
|
+++ ./svm-toy/qt/svm-toy.cpp 2008-04-02 14:01:47.000000000 +1000
|
|
|
|
|
@@ -67,14 +67,15 @@ private:
|
|
|
|
|
void clear_all()
|
|
|
|
|
{
|
|
|
|
|
point_list.clear();
|
|
|
|
|
- buffer.fill(black);
|
|
|
|
|
+ buffer.fill(Qt::black);
|
|
|
|
|
paintEvent(NULL);
|
|
|
|
|
}
|
|
|
|
|
void draw_point(const point& p)
|
|
|
|
|
{
|
|
|
|
|
const QPixmap& icon = choose_icon(p.value);
|
|
|
|
|
- window_painter.drawPixmap((int)(p.x*XLEN),(int)(p.y*YLEN),icon);
|
|
|
|
|
+
|
|
|
|
|
buffer_painter.drawPixmap((int)(p.x*XLEN),(int)(p.y*YLEN),icon);
|
|
|
|
|
+ repaint(FALSE);
|
|
|
|
|
}
|
|
|
|
|
void draw_all_points()
|
|
|
|
|
{
|
|
|
|
|
@@ -213,33 +214,23 @@ private slots:
|
|
|
|
|
|
|
|
|
|
buffer_painter.setPen(colors[0]);
|
|
|
|
|
buffer_painter.drawLine(0,0,0,YLEN-1);
|
|
|
|
|
- window_painter.setPen(colors[0]);
|
|
|
|
|
- window_painter.drawLine(0,0,0,YLEN-1);
|
|
|
|
|
|
|
|
|
|
int p = (int)(param.p * YLEN);
|
|
|
|
|
for(i = 1; i < XLEN; i++)
|
|
|
|
|
{
|
|
|
|
|
buffer_painter.setPen(colors[0]);
|
|
|
|
|
buffer_painter.drawLine(i,0,i,YLEN-1);
|
|
|
|
|
- window_painter.setPen(colors[0]);
|
|
|
|
|
- window_painter.drawLine(i,0,i,YLEN-1);
|
|
|
|
|
|
|
|
|
|
buffer_painter.setPen(colors[5]);
|
|
|
|
|
buffer_painter.drawLine(i-1,j[i-1],i,j[i]);
|
|
|
|
|
- window_painter.setPen(colors[5]);
|
|
|
|
|
- window_painter.drawLine(i-1,j[i-1],i,j[i]);
|
|
|
|
|
|
|
|
|
|
if(param.svm_type == EPSILON_SVR)
|
|
|
|
|
{
|
|
|
|
|
buffer_painter.setPen(colors[2]);
|
|
|
|
|
buffer_painter.drawLine(i-1,j[i-1]+p,i,j[i]+p);
|
|
|
|
|
- window_painter.setPen(colors[2]);
|
|
|
|
|
- window_painter.drawLine(i-1,j[i-1]+p,i,j[i]+p);
|
|
|
|
|
|
|
|
|
|
buffer_painter.setPen(colors[2]);
|
|
|
|
|
buffer_painter.drawLine(i-1,j[i-1]-p,i,j[i]-p);
|
|
|
|
|
- window_painter.setPen(colors[2]);
|
|
|
|
|
- window_painter.drawLine(i-1,j[i-1]-p,i,j[i]-p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -281,9 +272,7 @@ private slots:
|
|
|
|
|
double d = svm_predict(model, x);
|
|
|
|
|
if (param.svm_type == ONE_CLASS && d<0) d=2;
|
|
|
|
|
buffer_painter.setPen(colors[(int)d]);
|
|
|
|
|
- window_painter.setPen(colors[(int)d]);
|
|
|
|
|
buffer_painter.drawPoint(i,j);
|
|
|
|
|
- window_painter.drawPoint(i,j);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
svm_destroy_model(model);
|
|
|
|
|
@@ -352,9 +341,9 @@ SvmToyWindow::SvmToyWindow()
|
|
|
|
|
,current_value(1)
|
|
|
|
|
{
|
|
|
|
|
buffer.resize(XLEN,YLEN);
|
|
|
|
|
- buffer.fill(black);
|
|
|
|
|
+ buffer.fill(Qt::black);
|
|
|
|
|
|
|
|
|
|
- window_painter.begin(this);
|
|
|
|
|
+// window_painter.begin(this);
|
|
|
|
|
buffer_painter.begin(&buffer);
|
|
|
|
|
|
|
|
|
|
QObject::connect(&button_change_icon, SIGNAL(clicked()), this,
|
|
|
|
|
@@ -371,7 +360,7 @@ SvmToyWindow::SvmToyWindow()
|
|
|
|
|
SLOT(button_run_clicked()));
|
|
|
|
|
|
|
|
|
|
// don't blank the window before repainting
|
|
|
|
|
- setBackgroundMode( NoBackground );
|
|
|
|
|
+ setBackgroundMode( Qt::NoBackground );
|
|
|
|
|
|
|
|
|
|
icon1.resize(4,4);
|
|
|
|
|
icon2.resize(4,4);
|
|
|
|
|
@@ -403,7 +392,7 @@ SvmToyWindow::SvmToyWindow()
|
|
|
|
|
|
|
|
|
|
SvmToyWindow::~SvmToyWindow()
|
|
|
|
|
{
|
|
|
|
|
- window_painter.end();
|
|
|
|
|
+// window_painter.end();
|
|
|
|
|
buffer_painter.end();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -417,7 +406,9 @@ void SvmToyWindow::mousePressEvent( QMou
|
|
|
|
|
void SvmToyWindow::paintEvent( QPaintEvent* )
|
|
|
|
|
{
|
|
|
|
|
// copy the image from the buffer pixmap to the window
|
|
|
|
|
- bitBlt( this, 0, 0, &buffer );
|
|
|
|
|
+ // Compatiable both Qt-3 and Qt-4
|
|
|
|
|
+ QPainter p(this);
|
|
|
|
|
+ p.drawPixmap(0, 0, buffer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main( int argc, char* argv[] )
|
|
|
|
|
diff -up ./svm-toy/gtk/interface.h.orig ./svm-toy/gtk/interface.h
|
|
|
|
|
diff -up ./svm-toy/gtk/interface.c.orig ./svm-toy/gtk/interface.c
|
|
|
|
|
diff -up ./svm-toy/gtk/Makefile.orig ./svm-toy/gtk/Makefile
|
|
|
|
|