Welcome to the Ultimate Volleyball Experience: Volleyligaen Women DENMARK
Embark on an exhilarating journey through the heart of Danish volleyball with our comprehensive coverage of the Volleyligaen Women DENMARK. Stay updated with fresh matches every day, enhanced by expert betting predictions that promise to elevate your viewing experience. Whether you're a seasoned fan or new to the sport, our platform offers a treasure trove of insights, statistics, and thrilling narratives that capture the essence of each game.
Why Volleyligaen Women DENMARK?
The Volleyligaen Women DENMARK stands as one of Europe's most competitive and dynamic leagues, showcasing top-tier talent and unparalleled athleticism. With teams battling fiercely for supremacy, each match is not just a game but a spectacle of strategy, skill, and sportsmanship. Our platform ensures you don't miss out on any action-packed moments.
- Daily Updates: Get real-time updates on all matches as they happen. Our dedicated team ensures you have access to the latest scores, highlights, and player performances.
- Expert Analysis: Dive deep into expert analysis that breaks down key plays, strategies, and player contributions. Understand the nuances that make each match unique.
- Betting Predictions: Benefit from expert betting predictions that offer informed insights into potential outcomes. Whether you're placing bets or just curious about odds, our predictions add an extra layer of excitement.
The Teams: A Closer Look
The league features some of Denmark's most formidable teams, each bringing its own strengths and style to the court. Here's a glimpse into what makes these teams stand out:
- Herning-Ikast: Known for their aggressive playstyle and tactical prowess, Herning-Ikast consistently ranks among the top contenders in the league.
- Aalborg DH: With a rich history and a strong roster, Aalborg DH combines experience with youthful energy to deliver electrifying performances.
- Nykøbing/Voer: This team is celebrated for its cohesive teamwork and strategic depth, often surprising opponents with innovative plays.
Each team brings its unique flavor to the league, making every match unpredictable and thrilling.
Match Highlights: What You Can Expect
Our coverage goes beyond mere scores; we bring you into the heart of each match with detailed highlights. From breathtaking spikes to strategic blocks and serves, witness every moment that defines these games:
- Action-Packed Plays: Relive the most intense moments with high-quality videos and photo galleries.
- In-Depth Recaps: Comprehensive recaps provide context to every play, offering insights into how key moments shaped the outcome of each match.
- Player Spotlights: Discover standout performers who made significant impacts during their games through exclusive interviews and profiles.
No matter where you are in the world, you can experience the thrill of Danish volleyball right from your screen.
Betting Insights: Elevate Your Game
Betting adds an extra layer of excitement to watching volleyball. Our expert predictions are designed to help you make informed decisions whether you're placing bets or just enjoying the thrill of competition:
- Data-Driven Analysis: Our predictions are backed by rigorous data analysis covering player statistics, team performance trends, and historical match outcomes.
- Tactical Insights: Gain understanding of how different strategies might influence game results through our tactical breakdowns.
- Odds Explained: We demystify betting odds so you can grasp their implications easily without needing advanced knowledge in gambling terminology.
<|repo_name|>dipu0007/Emotion-Detection-in-Music<|file_sep|>/README.md
# Emotion-Detection-in-Music
The aim is to build a model which will take an audio file as input which will then predict one out 5 classes namely - happy , sad , angry , peaceful , love.
## Data Collection
The dataset consists 600 songs belonging 5 classes (happy,sad , angry , peaceful , love) . Each class has 120 songs .

## Preprocessing
### Feature Extraction
Mel-Frequency Cepstral Coefficients (MFCCs) are coefficients that collectively make up an MFC. They are derived from a type of cepstral representation of the audio clip (a nonlinear "spectrum-of-a-spectrum").

### Label Encoding
Label Encoding is used when we have labels in words like 'happy', 'sad', 'angry' etc.
It converts these labels into integer values so that machine learning algorithms can understand them.

## Model Training
A convolutional neural network was built using keras library for training purpose . The model had two Convolution layers followed by two max pooling layers . Finally it had two dense layers at last .
The model was trained on 80% data i.e 480 songs per class whereas validation was done on remaining 20% data i.e 120 songs per class .
### Training Accuracy vs Validation Accuracy

### Loss vs Validation Loss

### Testing
The model gave around 95% accuracy while testing .

<|repo_name|>dipu0007/Emotion-Detection-in-Music<|file_sep # -*- coding: utf-8 -*-
"""
Created on Fri Aug 20 19:29:08 2021
@author: dipu
"""
import numpy as np
from sklearn.preprocessing import LabelEncoder
from keras.utils import np_utils
import librosa
def extract_feature(file_name):
X,sr = librosa.load(file_name)
stft = np.abs(librosa.stft(X))
mfccs = np.mean(librosa.feature.mfcc(y=X,sr=sr,n_mfcc=40).T,axis=0)
return mfccs
def load_data(path):
features,label = [],[]
genres = ['Happy','Sad','Angry','Peaceful','Love']
for genre in genres:
print("Extracting features from "+genre+"...")
genre_folder_path = path + '/' + genre
for file in os.listdir(genre_folder_path):
file_path = genre_folder_path + '/' + file
if len(features) >10000:
break
try:
feature = extract_feature(file_path)
label.append(genres.index(genre))
features.append(feature)
except Exception as e:
print("Error encountered while parsing file: ",file)
continue
return np.array(features),np.array(label)
X,y = load_data('C:\Users\DIPU\Desktop\Music Emotion Detection\data')
print("Data loaded successfully")
le = LabelEncoder()
yy = le.fit_transform(y)
yy_ohe = np_utils.to_categorical(yy)
np.save('features.npy',X)
np.save('labels.npy',yy_ohe)<|repo_name|>dipu0007/Emotion-Detection-in-Music<|file_sep[{"pid":0,"ph":"i","name":"Memory sample","ts":1597878640013000,"args":{"JVM stats":"heap_memory_usage: 133963968nnon_heap_memory_usage: 150021104nloaded_class_count: 15478nthread_count: 25ngarbage_collection_stats {n name: "PS Scavenge"n gc_collections: 0n gc_time: 0n}ngarbage_collection_stats {n name: "PS MarkSweep"n gc_collections: 0n gc_time: 0n}n"}},{"pid":0,"ph":"i","name":"Memory sample","ts":1597878640222000,"args":{"JVM stats":"heap_memory_usage: 144226672nnon_heap_memory_usage:150152776nloaded_class_count:15478nthread_count:30ngarbage_collection_stats {n name: "PS Scavenge"n gc_collections: 0n gc_time: 0n}ngarbage_collection_stats {n name: "PS MarkSweep"n gc_collections: 0n gc_time: 0n}n"}},{"pid":0,"ph":"i","name":"Memory sample","ts":1597878640222001,"args":{"JVM stats":"heap_memory_usage: 144226672nnon_heap_memory_usage:150152776nloaded_class_count:15478nthread_count:30ngarbage_collection_stats {n name: "PS Scavenge"n gc_collections: 0n gc_time: 0n}ngarbage_collection_stats {n name: "PS MarkSweep"n gc_collections: 0n gc_time:<|repo_name|>joeblow/joeblow.github.io<|file_sep|RFID-Badge-for-Wearables-Capstone-project-.mdwn
## RFID Badge for Wearables Capstone project
This capstone project is designed by Joe Blow (Joe Chen). The goal is design an RFID badge for wearables device like bracelet or watch.
The first step I did was create this github page so I can keep track my progress.
In this capstone project I will be using RFID technology instead bluetooth because RFID technology uses less power consumption than Bluetooth technology does.
This project will consist three parts:
* Hardware part
* Software part
* Web service part
For hardware part I planed use Atmega328P microcontroller since it has been widely used before in Arduino Uno board which means there should be plenty tutorials available online if I got stucked somewhere along development process.
For software part I planed use Python language since it has been widely used before in web development field which means there should be plenty libraries available online if I got stucked somewhere along development process.
For web service part I planed use Node.js since it has been widely used before in web development field which means there should be plenty libraries available online if I got stucked somewhere along development process.
At first stage I planed design simple prototype circuit board using breadboard then move onto designing PCB later after everything works fine.
Here's my progress:
### Step One:
I bought all necessary components including microcontroller Atmega328P chip breadboard jumper wires etc.
I soldered Atmega328P chip onto breadboard then connected various components like resistors capacitors etc onto breadboard according schematic diagram provided by Arduino website.
I uploaded Arduino IDE sketch code onto Atmega328P chip using USB cable then tested if everything works fine.
It works perfectly! So far so good!
### Step Two:
I started designing PCB layout using KiCAD software package.
After several hours spent designing PCB layout finally finished first draft version which looks pretty good!
Next step would be ordering PCB prototype boards from manufacturer such as JLCPCB or Seeed Studio etc once they arrive here at home lab station then soldering all necessary components onto PCB boards accordingly schematic diagram provided earlier earlier earlier.
Once everything soldered correctly onto PCB boards next step would be uploading Arduino IDE sketch code onto Atmega328P chips again using USB cable then testing if everything still works fine after being transferred over from breadboard setup earlier earlier earlier.
If everything still works fine after transferring over from breadboard setup earlier earlier earlier then congratulations! You've successfully completed step two!
However if something doesn't work properly after transferring over from breadboard setup earlier earlier earlier then don't panic! Just double check connections between various components according schematic diagram provided earlier earlier earlier again carefully until problem identified resolved fixed fixed fixed.
Now let's move onto next stage shall we?
### Step Three:
After receiving PCB prototype boards from manufacturer such as JLCPCB or Seeed Studio etc finally arrived here at home lab station ready for assembly.
First thing first let me explain what exactly am trying accomplish here shall we?
Basically what Im trying accomplish here is creating custom designed RFID badge wearable device capable communicating wirelessly via NFC protocol between itself other nearby devices such smartphones tablets laptops etc without requiring any additional cables wires connectors whatsoever!
In order achieve desired goal stated above firstly need develop custom designed circuit board capable hosting microcontroller Atmega328P chip alongside necessary supporting components such resistors capacitors transistors diodes etc according schematic diagram provided previously previously previously.
Once custom designed circuit board developed successfully next step would involve assembling various components soldering them securely onto corresponding pads holes drilled specifically intended purpose upon aforementioned custom designed circuit board accordingly schematic diagram provided previously previously previously once again once again once again until final product resembles exact replica original design intended purpose initially envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally envisioned originally.
Now lets move onto actual assembly process shall we?
First thing first need acquire necessary materials required assemble aforementioned custom designed circuit board mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above mentioned above:
Naturally speaking acquiring necessary materials required assemble aforementioned custom designed circuit board would require visiting local electronics store purchasing various electronic components such resistors capacitors transistors diodes etc accordingly specified values quantities listed within aforementioned schematic diagram provided previously previously previously provided previously provided previously provided previously provided previously provided previously provided previously provided previously provided previous previous previous previous previous previous previous previous previous previous previous previous previous.
After acquiring necessary materials required assemble aforementioned custom designed circuit board next step would involve soldering various electronic components securely onto corresponding pads holes drilled specifically intended purpose upon aforementioned custom designed circuit board accordingly specified values quantities listed within aforementioned schematic diagram provided previously provided previously provided prior prior prior prior prior prior prior prior prior prior prior prior prior.
Once all necessary electronic components soldered securely upon aforementioned custom designed circuit board next step would involve uploading Arduino IDE sketch code unto microcontroller Atmega328P chip hosted therein utilizing appropriate programming interface such USB cable programmer device utilized initially initial initial initial initial initial initial initial initial initial initial initial initial initial.
After successfully uploading Arduino IDE sketch code unto microcontroller Atmega328P chip hosted therein next step would involve testing functionality thereof ensuring proper communication between said microcontroller Atmega328P chip alongside other nearby devices such smartphones tablets laptops etc via NFC protocol without requiring any additional cables wires connectors whatsoever thereby verifying successful completion aforementioned goal initially set forth initially set forth initially set forth initially set forth initially set forth initially set forth initially set forth initially set forth initially set forth initially set forth.
If successful completion aforementioned goal verified confirmed thereafter congratulations success achieved mission accomplished job well done accomplished accomplished accomplished accomplished accomplished accomplished accomplished accomplished accomplished accomplished accomplished accomplished achieved achieved achieved achieved achieved achieved achieved achieved achieved achieved achieved achieved!!!!
If unsuccessful completion aforementioned goal verified confirmed thereafter troubleshooting process initiated involving double checking connections between various electronic components soldered securely upon aforementioned custom designed circuit board according specified values quantities listed within aforementioned schematic diagram provided previously provided providing further clarification clarification clarification clarification clarification clarification clarification clarification clarification clarification clarification clarification clarification regarding potential sources error error error error error error error error error error error error error error error error:error:error:error:error:error:error:error:error:error:error:error:
Should troubleshooting process fail resolving issue issue issue issue issue issue issue issue issue issue issue issue issue issue issue subsequently alternative solutions explored involving consulting online forums discussion groups seeking advice assistance fellow enthusiasts knowledgeable individuals familiar subject matter subject matter subject matter subject matter subject matter subject matter subject matter subject matter subject matter subject matter subject matter subject matter subject mattersubjectmattersubjectmattersubjectmattersubjectmattersubjectmattersubjectmattersubjectmattersubjectmattersubjectmattersubjectmattersubjectmatter:
If alternative solutions explored subsequently prove ineffective unsuccessful resolving issue persistently persistently persistently persistently persistently persistently persistently persistently persistently persistently persistentlypersistentlypersistentlypersistentlypersistentlypersistentlypersistentlypersistentiallythenfinalresortinvolvescrapingentireprojectstartingoverfreshfreshfreshfreshfreshfreshfreshfreshfreshfreshfreshfreshfreshfreshrefreshrefreshrefreshrefreshrefreshrefreshrefreshrefreshrefreshrefreshrefreshre:
However unlikely scenario arises wherein entire project scrapped starting over fresh fresh fresh fresh fresh fresh fresh fresh fresh fresh fresh fresh refresh refresh refresh refresh refresh refresh refresh refresh refresh refreshing refreshing refreshing refreshing refreshing refreshing refreshing refreshing refreshing refreshing refreshing refreshing refreshing resetting resetting resetting resetting resetting resetting resetting resetting resettingresettingresettingresettingresettingresettingresettingresettingresettingsetbacksetbacksetbacksetbacksetbacksetbacksetbacksetbacksetbacksetbacksetbacksetback:
Nevertheless determination perseverance unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringly unwaveringlyunwaveringlyunwaverringilyunwaverringilyunwaverringilyunwaverringilyunwaverringilyunwaverringilyunwaverringilyunwaverringilyunwaverringlyunwaveringlyunwaveringlyunwaveringlyunwaveringly unwa
Overall experience thus far incredibly rewarding fulfilling immensely satisfying seeing ideas concepts materialize tangible form reality reality reality reality reality reality reality reality reality reality reality reality reality reality.
#### References:
* [Arduino Website](https://www.arduino.cc/en/Main/HomePage)
* [KiCAD Website](http://kicad-pcb.org/)
<|file_sep|>#include "GLWidget.h"
#include "mainwindow.h"
#include "GLObject.h"
#include "GLText.h"
#include "GLSkybox.h"
#include "GLPlane.h"
#include "GLObjLoader.h"
#include "GLEarth.h"
#include
namespace {
static const GLfloat light_ambient[] = { // 环境光组件分量。
1.f,
1.f,
1.f,
1.f };
static const GLfloat light_diffuse[] = { // 漫反射光分量。
1.f,
1.f,
1.f,
1.f };
static const GLfloat light_specular[] = { // 镜面反射光分量。
1.f,
1.f,
1.f,
1.f };
static const GLfloat light_position[] = { // 聚光灯的位置。
-10.f,-10.f,-10.f,
.5f };
static const GLfloat mat_ambient[] = { // 材质的环境光组件。
.2f,.2f,.2f,.2f };
static const GLfloat mat_diffuse[] = { // 材质的漫反射光组件。
.8f,.8f,.8f,.8f };
static const GLfloat mat_specular[] = { // 材质的镜面反射光组件。
.6f,.6f,.6f,.6f };
}
GLWidget::GLWidget(QWidget *parent) :
QOpenGLWidget(parent),
mCamera(nullptr),
mFPS(60),
mWireframe(false),
mEarth(nullptr),
mShowAxis(false),
mLightOn(true),
mMoveCamera(false),
mRotateCamera(false),
cameraAngle(45),
cameraAngleH(45),
cameraDistance(15),
camaraZoom(100),
moveSpeed(.01),
zoomSpeed(.05),
mouseX(512),
mouseY(384),
xRot(90),yRot(-90),zRot(-90),
xMousePress(true),yMousePress(true),zMousePress(true),
lastPos(QPoint()),curPos(QPoint()),lastCamPos(QPoint()),curCamPos(QPoint()),camaraStartPos(QPoint()),camaraEndPos(QPoint())
{
setFocusPolicy(Qt::StrongFocus);
}
GLWidget::~GLWidget() {
if (mEarth != nullptr) {
delete mEarth;
mEarth=nullptr;
}
}
void GLWidget::initializeGL() {
qDebug() << Q_FUNC_INFO;
initializeOpenGLFunctions();
glClearColor(.25,.25,.25,.25);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT2);
glLightfv(GL_LIGHT2,GL_AMBIENT,&light_ambient[0]);
glLightfv(GL_LIGHT2,GL_DIFFUSE,&light_diffuse[0]);
glLightfv(GL_LIGHT2,GL_SPECULAR,&light_specular[0]);
GLfloat lightModelAmbient[]={.5F,.5F,.5F};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,&lightModelAmbient[0]);
GLfloat matShininess[]={50};
glMaterialfv(GL_FRONT_AND_BACK,GL_SHININESS,&matShininess[0]);
GLfloat matAmbient[]={.25F,.25F,.25F};
glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,&matAmbient[0]);
GLfloat matDiffuse[]={.75F,.75F,.75F};
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,&matDiffuse[0]);
GLfloat matSpecular[]={1.,1.,1.,};
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,&matSpecular[0]);
if(mEarth==nullptr){
mEarth=new GLEarth();
}
}
void GLWidget::resizeGL(int w,int h) {
qDebug() << Q_FUNC_INFO;
updateProjectionMatrix();
}
void GLWidget::paintGL() {
qDebug() << Q_FUNC_INFO;
static float t=QTime::currentTime().msecsSinceStartOfDay()/10000.;
t+=mFPS*.001;
float cx=.5*w(),cy=.5*h();
float ratio=w/(float)h;
if(mCamera!=nullptr){
updateViewMatrix();
glClearDepth(.99999);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadMatrix(&projectionMatrix()[16]);
glMatrixMode(GL_MODELVIEW);
if(mLightOn){
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3,GL_FLOAT,sizeof(Vertex),(const void*)offsetof(Vertex,x));
glNormalPointer(GL_FLOAT,sizeof(Vertex),(const void*)offsetof(Vertex,nx));
glBindBufferARB(GLEarth::BUFFER_TYPE_VERTEX,GLEarth::bufferIds[GLEarth::BUFFER_TYPE_VERTEX]);
glBindBufferARB(GLEarth::BUFFER_TYPE_NORMAL,GLEarth::bufferIds[GLEarth::BUFFER_TYPE_NORMAL]);
glEnableClientState(GLEarth::CLIENT_STATE_VERTEX_ARRAY);
glEnableClientState(GLEarth::CLIENT_STATE_NORMAL_ARRAY);
glVertexPointer(3,GL_FLOAT,sizeof(float),(const void*)GLEarth::offsets[GLEarth::BUFFER_TYPE_VERTEX]);
glNormalPointer(G_FLOAT,sizeof(float),(const void*)GLEarth::offsets[GLEarth::BUFFER_TYPE_NORMAL]);
}
else{
glBindBufferARB(GLEarth::BUFFER_TYPE_VERTEX,GLEarth::bufferIds[GLEarth::BUFFER_TYPE_VERTEX]);
glVertexPointer(3,GL_FLOAT,sizeof(float),(const void*)GLEath.offsets[GLEath.BUFFER_TYPE_VERTEX]);
}
glEnableClientState(GLEath.CLIENT_STATE_VERTEX_ARRAY);
if(mWireframe){
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
}
else{
glPolygonMode(G_Front_and_Back,G_FILL);
}
if(mShowAxis){
mAxis->draw(t,mFPS,mMoveCamera,mRotateCamera,mWireframe,mLightOn,cameraDistance,cameraAngleH,cameraAngle,zRot,xRot,yRot,xMousePress,yMousePress,zMousePress,lastCamPos,camaraStartPos,camaraEndPos,mEarth->getMaxRadius());
}
mEarth->draw(t,mFPS,mMoveCamera,mRotateCamera,mWireframe,mLightOn,cameraDistance,cameraAngleH,cameraAngle,zRot,xRot,yRot,xMousePress,yMousePress,zMousePress,lastCamPos,camaraStartPos,camaraEndPos);
if(!mWireframe){
glDisableClientState(G_LEARTH.CLIENT_STATE_VERTEX_ARRAY);
glDisableClientState(G_LEARTH.CLIENT_STATE_NORMAL_ARRAY);
}
if(mLightOn){
glDisableClientState(G_LVERTEX_ARRAY);
glDisableClientState(G_LNORMAL_ARRAY);
}
if(mMoveCamera||mRotateCamera){
updateViewMatrix();
}
renderInfo();
update();
}
void GLWidget::mousePressEvent(QMouseEvent *event) {
qDebug() << Q_FUNC_INFO;
lastPos=event->pos();
if(event->button()==Qt.LeftButton&&cameraDistance>=camaraZoom+500&&cameraDistance<=camaraZoom+10000){
moveSpeed=.005;
zoomSpeed=.01;
xMousePress=false;
yMousePress=false;
zMousePress=false;
switch(event->buttons()){
case Qt.LeftButton:{
lastCamPos=QCursor.pos();
break;}
case Qt.RightButton:{
lastCamPos=QCursor.pos();
break;}
case Qt.MiddleButton:{
lastCamPos=QCursor.pos();
break;}
default:
break;
}
}
else{
xMousePress=true;
yMousePress=true;
zMousePress=true;
moveSpeed=.001;
zoomSpeed=.002;
switch(event->buttons()){
case Qt.LeftButton:{
lastCamPos=event->pos();
break;}
case Qt.RightButton:{
lastCamPos=event->pos();
break;}
case Qt.MiddleButton:{
lastCamPos=event->pos();
break;}
default:
break;
}
}
updateViewMatrix();
}
}
void GLWidget::mouseReleaseEvent(QMouseEvent *event) {
qDebug() << Q_FUNC_INFO;
switch(event->button()){
case Qt.LeftButton:{
xMousePress=true;break;}
case Qt.RightButton:{
yMousePres=true;break;}
case Qt.MiddleButton:{
zMouserePres=true;break;}
default:
break;
}
updateViewMatrix();
}
}
void GLWidget::mouseMoveEvent(QMouseEvent *event) {
qDebug() << Q_FUNC_INFO;
curPos=event->pos();
int dx=(curPos.x()-lastPos.x());
int dy=(curPosX-yLastPosY);
if(cameraDistance>=camaraZoom+500&&cameraDistance<=camaraZoom+10000){
switch(event->buttons()){
case Qt.LeftButton:{
rotateAroundCenter(dx,-dy,true,true,false);
break;}
case Qt.RightButton:{
rotateAroundCenter(dx,-dy,false,false,true);
break;}
case Qt.MiddleButton:{
rotateAroundCenter(dx,-dy,false,true,true);
break;}
default:
moveAroundCenter(dx,-dy);
break;
}
}
else{
switch(event->buttons()){
case Qt.LeftButton:{
rotateAroundCenter(dx,-dy,false,true,true);
break;}
case Qt.RightButton:{
rotateAroundCenter(dx,-dy,true,false,true);
break;}
case Qt.MiddleButton:{
rotateAroundCenter(dx,-dy,true,true,true);
break;}
default:
moveAroundCenter(dx,-dy);
break;
}
}
lastPosX=event-pos().x();
lastPosY=event-pos().y();
updateViewMatrix();
}
void GLWidget :: wheelEvent(QWheelEvent *event){
qDebug()<=camaraZoom+500&&cameraDistance<=camaraZoom+10000){
double delta=(double)(event.delta()/120)*zoomSpeed;
cameraDistance-=delta;
if(cameraDistance<=camaraZoom+500){
cameraDistancem=camaRaZooM+500;
}else{
if(cameraDistancem>=camaroZooM+10000){
cameraDistancem=camaRaZooM+10000;
}else{
cameraDistancem+=delta;
}
}
}else{
double delta=(double)(event.delta()/120)*zoomSpeed;
cameraDistancem+=delta;
}
updateViewMatrix();
}
void GLWidglet:updateProjectionMatric(){
qDebug()<parent();thiswindowType=thisparentWindow()->windowType();thiswindowFlags=thisparentWindow()->windowFlags();thisscreenNumber=thisparentWindow()->screenNumber();thisrect=thisparentWindow()->rect();thissize=thisparentWindow()->size();thisgeometry=thisparentWindow()->geometry();
thisrestoreGeometry(thisgeometry());
return ok;}<|repo_name|>jingsongchen/GraphicsCourseWork2016Spring<|file_sep#ifndef _MAINWINDOW_H_
#define _MAINWINDOW_H_
#include
class MainWindow : public QMainWindow{
Q_OBJECT
public:
explicit MainWindow(QWidget * parent=nullptr,QMenuBar * menuBar=nullptr,QToolBar * toolBar=nullptr,QStatusBar * statusBar=nullptr,QActionGroup * actionGroup=nullptr,const QString & title="Graphics CourseWork",Qt.WindowFlags flags=Qt.WindowFlags());
virtual ~MainWindow(){}
protected slots:
void showHelpMessage(bool checked){emit helpRequested();}
void showAboutMessage(bool checked){emit aboutRequested();}
private slots:
void updateStatusMessage(const QString & message){statusBar()->showMessage(message);}
private:
void createActions();
void createMenus();
void createToolBars();
QMenu* fileMenu_;
QMenu* editMenu_;
QMenu* viewMenu_;
QMenu* helpMenu_;
QActionGroup* viewActionGroup_;
QAction* openAction_;
QAction* saveAsAction_;
QAction* exitAction_;
QAction* wireFrameActoin_;
QAction* showAxisActoin_;
};
#endif //_MAINWINDOW_H_<|repo_name|>jingsongchen/GraphicsCourseWork2016Spring<|file_sep#include"mainwindow.h"
MainWindow :: MainWindow(QWidget * parent,QMenuBar * menuBar,QToolBar * toolBar,QStatusBar * statusBar,QActionGroup *,const QString & title="Graphics CourseWork",Qt.WindowFlags flags): QMainWindow(parent,title?title:"Graphics CourseWork",flags){
createActions();createMenus();createToolBars();
setCentralWidget(new QWidget());
setMenuBar(menuBar);setToolBar(toolBar);setStatusbar(statusBar);
connect(viewActionGroup_,&Qactiongroup :: triggered,this,&MainWindow :: updateStatusMessage,SLOT(on_triggered(QString)));
connect(openAction_,&Qaction :: triggered,this,[&](){emit openRequested();});
connect(saveAsActon_,&Qaction :: triggered,this,[&](){emit saveAsRequested();});
connect(exitActioN_,&Qaction :: triggered,this,[&](){emit exitRequested();});
connect(wireFrameActioN_,&Qaction :: toggled,this,[&](){emit wireFrameToggled(wireFrameActioN_->isChecked());});
connect(showAxisActioN_,&Qaction :: toggled,this,[&](){emit showAxistoggled(showAxisActioN_->isChecked());});
connect(this,SIGNAL(helprequested(bool)),this,SLOT(showHelpMessage(bool)));
connect(this,SIGNAL(helprequested(bool)),helpBrowser,SLOT(setVisible(bool)));
connect(this,SIGNAL(helprequested(bool)),helpBrowser,SLOT(setSource(requestUrl())));
helpBrowser.setSource(requestUrl());
helpBrowser.page()->mainFrame()->addToJavaScriptWindowObject("mainWin",this);
}
MainWindow::~MainWindow(){
delete centralwidget();
delete menuBar();
delete toolBar();
delete statusBar();
for(auto item:viewactiiongroup_->actions())
delete item;
for(auto item:viewactiiongroup_->actions())
delete item;
for(auto item:viewactiiongroup_->actions())
delete item;
for(auto item:viewactiiongroup_->actions())
delete item;
delete viewactiiongroup_;
viewactiiongroup_=nullptr;
helpbrowser=NULLPTR;
filemenu_=NULLPTR;editmenu_=NULLPTR;viewmenu_=NULLPTR;helpmenu_=NULLPTR;
openaction_=NULLPTR;saveasaction_=NULLPTR;exitaction_=NULLPTR;
wirefrmaetction_=NULLPTR;showaxisactioN_=NULLPTR;
}
void MainWindow :: createActions(){
openaction_=&new QAction(tr("&Open"),this);openaction_->setIcon(QIcon(":/images/open"));
openaction_->setStatusTip(tr("Open File"));
saveasactioN_=&new QAction(tr("&Save As"),this);saveasactioN_->setIcon(QIcon(":/images/save"));
saveasactioN_->setStatusTip(tr("Save File"));
exitaction_=&new QAction(tr("&Exit"),this);exitaction_->setIcon(QIcon(":/images/close"));
exitaction_->setStatusTip(tr("Exit Application"));
wirefrmaetction_=&new QAction(tr("&Wire Frame"),this);wirefrmaetction_->setIcon(QIcon(":/images/wireframe"));
wirefrmaetction_->setStatusTip(tr("Show Wire Frame"));
wirefrmaetction_->setCheckable(true);
showaxisactioN_=&new QAction(tr("&Show Axis"),this);showaxisactioN_->setIcon(QIcon(":/images/showaxis"));
showaxisactioN_-statusTip(tr("Show Axis"));
showaxisaciton_-checkable(true);
viewacitonGroup_=&new QActionGroup(this);//创建一个动作分组,这样可以方便管理所有与视图相关的操作。
viewacitonGroup_-addActions({wirefrmaetcion_,showaxisacitoin_});//将这两个操作加入到动作分组中。
viewacitonGroup_-setDefaultChecked(wirefrmaetcion_-isChecked());//设置默认选中状态。如果不设置,那么在应用程序初始化时,这两个选项都是未选中状态。
helpbrowser=NULLPTR;//初始化帮助浏览器指针为空指针。
requesturl_.clear();//清空请求地址