mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-16 01:24:36 +00:00
Removed the useless Viewer Class. It was used only to derive the GLArea in a failed attempt of overgeneralization.
This commit is contained in:
parent
bf99de6098
commit
a96dbad8df
@ -36,7 +36,7 @@ using namespace std;
|
||||
using namespace vcg;
|
||||
|
||||
GLArea::GLArea(MultiViewer_Container *mvcont, RichParameterSet *current)
|
||||
: Viewer(mvcont)
|
||||
: QGLWidget(mvcont)
|
||||
{
|
||||
this->updateCustomSettingValues(*current);
|
||||
log=mvcont->LogPtr();
|
||||
@ -76,10 +76,10 @@ GLArea::GLArea(MultiViewer_Container *mvcont, RichParameterSet *current)
|
||||
zoom = false;
|
||||
targetTex = 0;
|
||||
|
||||
connect(meshDoc, SIGNAL(currentMeshChanged(int)), this, SLOT(updateLayer()),Qt::QueuedConnection);
|
||||
connect(meshDoc, SIGNAL(meshModified()), this, SLOT(updateDecoration()),Qt::QueuedConnection);
|
||||
connect(meshDoc, SIGNAL(meshSetChanged()), this, SLOT(updateMeshSetVisibilities()));
|
||||
connect(meshDoc, SIGNAL(rasterSetChanged()), this, SLOT(updateRasterSetVisibilities()));
|
||||
connect(this->md(), SIGNAL(currentMeshChanged(int)), this, SLOT(updateLayer()),Qt::QueuedConnection);
|
||||
connect(this->md(), SIGNAL(meshModified()), this, SLOT(updateDecoration()),Qt::QueuedConnection);
|
||||
connect(this->md(), SIGNAL(meshSetChanged()), this, SLOT(updateMeshSetVisibilities()));
|
||||
connect(this->md(), SIGNAL(rasterSetChanged()), this, SLOT(updateRasterSetVisibilities()));
|
||||
/*getting the meshlab MainWindow from parent, which is QWorkspace.
|
||||
*note as soon as the GLArea is added as Window to the QWorkspace the parent of GLArea is a QWidget,
|
||||
*which takes care about the window frame (its parent is the QWorkspace again).
|
||||
@ -99,7 +99,7 @@ GLArea::~GLArea()
|
||||
{
|
||||
// warn any iRender plugin that we're deleting glarea
|
||||
if (iRenderer)
|
||||
iRenderer->Finalize(currentShader, *meshDoc, this);
|
||||
iRenderer->Finalize(currentShader, *this->md(), this);
|
||||
if(targetTex) glDeleteTextures(1, &targetTex);
|
||||
}
|
||||
|
||||
@ -327,14 +327,14 @@ void GLArea::paintEvent(QPaintEvent */*event*/)
|
||||
if(rm.backFaceCull) glEnable(GL_CULL_FACE);
|
||||
else glDisable(GL_CULL_FACE);
|
||||
|
||||
if(!meshDoc->isBusy())
|
||||
if(!this->md()->isBusy())
|
||||
{
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
|
||||
if (iRenderer) iRenderer->Render(currentShader, *meshDoc, rm, this);
|
||||
if (iRenderer) iRenderer->Render(currentShader, *this->md(), rm, this);
|
||||
else
|
||||
{
|
||||
foreach(MeshModel * mp, meshDoc->meshList)
|
||||
foreach(MeshModel * mp, this->md()->meshList)
|
||||
{
|
||||
//Mesh visibility is read from the viewer visibility map, not from the mesh
|
||||
mp->glw.SetHintParamf(GLW::HNPPointSize,glas.pointSize);
|
||||
@ -351,7 +351,7 @@ void GLArea::paintEvent(QPaintEvent */*event*/)
|
||||
foreach(QAction * p , iDecoratorsList)
|
||||
{
|
||||
MeshDecorateInterface * decorInterface = qobject_cast<MeshDecorateInterface *>(p->parent());
|
||||
decorInterface->decorate(p,*meshDoc,this->glas.currentGlobalParamSet, this,&painter);
|
||||
decorInterface->decorate(p,*this->md(),this->glas.currentGlobalParamSet, this,&painter);
|
||||
}
|
||||
glPopAttrib();
|
||||
} ///end if busy
|
||||
@ -408,7 +408,7 @@ void GLArea::paintEvent(QPaintEvent */*event*/)
|
||||
}
|
||||
|
||||
//Draw highlight if it is the current viewer
|
||||
if(mvc->currentId==id)
|
||||
if(mvc()->currentId==id)
|
||||
displayViewerHighlight();
|
||||
|
||||
// Finally display HELP if requested
|
||||
@ -427,8 +427,8 @@ void GLArea::paintEvent(QPaintEvent */*event*/)
|
||||
|
||||
//check if viewers are linked
|
||||
MainWindow *window = qobject_cast<MainWindow *>(QApplication::activeWindow());
|
||||
if(window && window->linkViewersAct->isChecked() && mvc->currentId==id)
|
||||
mvc->updateTrackballInViewers();
|
||||
if(window && window->linkViewersAct->isChecked() && mvc()->currentId==id)
|
||||
mvc()->updateTrackballInViewers();
|
||||
painter.endNativePainting();
|
||||
}
|
||||
|
||||
@ -483,15 +483,15 @@ void GLArea::displayInfo(QPainter *painter)
|
||||
|
||||
Color4b logAreaColor = glas.logAreaColor;
|
||||
glas.logAreaColor[3]=128;
|
||||
if(mvc->currentId!=id) logAreaColor /=2.0;
|
||||
if(mvc()->currentId!=id) logAreaColor /=2.0;
|
||||
|
||||
painter->fillRect(QRect(0, this->height()-barHeight, width(), this->height()), ColorConverter::ToQColor(logAreaColor));
|
||||
|
||||
QString col1Text,col0Text;
|
||||
|
||||
if(meshDoc->size()>0)
|
||||
if(this->md()->size()>0)
|
||||
{
|
||||
if(meshDoc->size()==1)
|
||||
if(this->md()->size()==1)
|
||||
{
|
||||
col1Text += QString("Vertices: %1\n").arg(mm()->cm.vn);
|
||||
col1Text += QString("Faces: %1\n").arg(mm()->cm.fn);
|
||||
@ -499,8 +499,8 @@ void GLArea::displayInfo(QPainter *painter)
|
||||
else
|
||||
{
|
||||
col1Text += QString("Current Mesh: %1\n").arg(mm()->label());
|
||||
col1Text += QString("Vertices: %1 (%2)\n").arg(mm()->cm.vn).arg(meshDoc->vn());
|
||||
col1Text += QString("Faces: %1 (%2)\n").arg(mm()->cm.fn).arg(meshDoc->fn());
|
||||
col1Text += QString("Vertices: %1 (%2)\n").arg(mm()->cm.vn).arg(this->md()->vn());
|
||||
col1Text += QString("Faces: %1 (%2)\n").arg(mm()->cm.fn).arg(this->md()->fn());
|
||||
}
|
||||
|
||||
if(rm.selectedFace || rm.selectedVert || mm()->cm.sfn>0 || mm()->cm.svn>0 )
|
||||
@ -577,7 +577,7 @@ void GLArea::displayHelp(QPainter *painter)
|
||||
|
||||
Color4b logAreaColor = glas.logAreaColor;
|
||||
glas.logAreaColor[3]=128;
|
||||
if(mvc->currentId!=id) logAreaColor /=2.0;
|
||||
if(mvc()->currentId!=id) logAreaColor /=2.0;
|
||||
|
||||
static QString tableText;
|
||||
if(tableText.isEmpty())
|
||||
@ -608,12 +608,12 @@ void GLArea::saveSnapshot()
|
||||
|
||||
if(ss.snapAllLayers)
|
||||
{
|
||||
while(currSnapLayer<meshDoc->meshList.size())
|
||||
while(currSnapLayer<this->md()->meshList.size())
|
||||
{
|
||||
tileRow=tileCol=0;
|
||||
qDebug("Snapping layer %i",currSnapLayer);
|
||||
meshDoc->setCurrentMesh(currSnapLayer);
|
||||
foreach(MeshModel *mp,meshDoc->meshList) {
|
||||
this->md()->setCurrentMesh(currSnapLayer);
|
||||
foreach(MeshModel *mp,this->md()->meshList) {
|
||||
meshSetVisibility(mp,false);
|
||||
}
|
||||
meshSetVisibility(mm(),true);
|
||||
@ -624,7 +624,7 @@ void GLArea::saveSnapshot()
|
||||
}
|
||||
|
||||
//cleanup
|
||||
foreach(MeshModel *mp,meshDoc->meshList) {
|
||||
foreach(MeshModel *mp,this->md()->meshList) {
|
||||
meshSetVisibility(mp,true);
|
||||
}
|
||||
ss.counter++;
|
||||
@ -643,11 +643,11 @@ void GLArea::updateLayer()
|
||||
if(iEdit)
|
||||
{
|
||||
assert(lastModelEdited); //if there is an editor last model edited should always be set when start edit is called
|
||||
iEdit->LayerChanged(*meshDoc, *lastModelEdited, this);
|
||||
iEdit->LayerChanged(*this->md(), *lastModelEdited, this);
|
||||
|
||||
//now update the last model edited
|
||||
//TODO this is not the best design.... iEdit should maybe keep track of the model on its own
|
||||
lastModelEdited = meshDoc->mm();
|
||||
lastModelEdited = this->md()->mm();
|
||||
}
|
||||
// if the layer has changed update also the decoration.
|
||||
updateDecoration();
|
||||
@ -658,8 +658,8 @@ void GLArea::updateDecoration()
|
||||
foreach(QAction *p , iDecoratorsList)
|
||||
{
|
||||
MeshDecorateInterface * decorInterface = qobject_cast<MeshDecorateInterface *>(p->parent());
|
||||
decorInterface->endDecorate(p, *meshDoc,this->glas.currentGlobalParamSet,this);
|
||||
decorInterface->startDecorate(p,*meshDoc, this->glas.currentGlobalParamSet,this);
|
||||
decorInterface->endDecorate(p, *this->md(),this->glas.currentGlobalParamSet,this);
|
||||
decorInterface->startDecorate(p,*this->md(), this->glas.currentGlobalParamSet,this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,9 +671,9 @@ void GLArea::setCurrentEditAction(QAction *editAction)
|
||||
|
||||
iEdit = actionToMeshEditMap.value(currentEditor);
|
||||
assert(iEdit);
|
||||
lastModelEdited = meshDoc->mm();
|
||||
if (!iEdit->StartEdit(*meshDoc, this))
|
||||
//iEdit->EndEdit(*(meshDoc->mm()), this);
|
||||
lastModelEdited = this->md()->mm();
|
||||
if (!iEdit->StartEdit(*this->md(), this))
|
||||
//iEdit->EndEdit(*(this->md()->mm()), this);
|
||||
endEdit();
|
||||
else
|
||||
log->Logf(GLLogStream::SYSTEM,"Started Mode %s", qPrintable(currentEditor->text()));
|
||||
@ -813,7 +813,7 @@ void GLArea::wheelEvent(QWheelEvent*e)
|
||||
case Qt::ShiftModifier + Qt::ControlModifier : clipRatioFar = math::Clamp( clipRatioFar*powf(1.2f, notch),0.01f,50.0f); break;
|
||||
case Qt::ControlModifier : clipRatioNear = math::Clamp(clipRatioNear*powf(1.2f, notch),0.01f,50.0f); break;
|
||||
case Qt::AltModifier : glas.pointSize = math::Clamp(glas.pointSize*powf(1.2f, notch),0.01f,150.0f);
|
||||
foreach(MeshModel * mp, meshDoc->meshList)
|
||||
foreach(MeshModel * mp, this->md()->meshList)
|
||||
mp->glw.SetHintParamf(GLW::HNPPointSize,glas.pointSize);
|
||||
break;
|
||||
case Qt::ShiftModifier : fov = math::Clamp(fov*powf(1.2f,notch),5.0f,90.0f); break;
|
||||
@ -887,14 +887,14 @@ void GLArea::initTexture()
|
||||
{
|
||||
if(hasToUpdateTexture)
|
||||
{
|
||||
foreach (MeshModel *mp,meshDoc->meshList)
|
||||
foreach (MeshModel *mp,this->md()->meshList)
|
||||
mp->glw.TMId.clear();
|
||||
|
||||
qDebug("Beware: deleting the texutres could lead to problems for shared textures.");
|
||||
hasToUpdateTexture = false;
|
||||
}
|
||||
|
||||
foreach (MeshModel *mp, meshDoc->meshList)
|
||||
foreach (MeshModel *mp, this->md()->meshList)
|
||||
{
|
||||
if(!mp->cm.textures.empty() && mp->glw.TMId.empty()){
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
@ -1093,9 +1093,9 @@ void GLArea::updateFps(float deltaTime)
|
||||
void GLArea::resetTrackBall()
|
||||
{
|
||||
trackball.Reset();
|
||||
float newScale= 3.0f/meshDoc->bbox().Diag();
|
||||
float newScale= 3.0f/this->md()->bbox().Diag();
|
||||
trackball.track.sca = newScale;
|
||||
trackball.track.tra = -meshDoc->bbox().Center();
|
||||
trackball.track.tra = -this->md()->bbox().Center();
|
||||
update();
|
||||
}
|
||||
|
||||
@ -1128,7 +1128,7 @@ void GLArea::sendViewDir(QString name)
|
||||
|
||||
void GLArea::sendMeshShot(QString name)
|
||||
{
|
||||
Shotf curShot=meshDoc->mm()->cm.shot;
|
||||
Shotf curShot=this->md()->mm()->cm.shot;
|
||||
emit transmitShot(name, curShot);
|
||||
}
|
||||
|
||||
@ -1139,7 +1139,7 @@ void GLArea::sendViewerShot(QString name)
|
||||
}
|
||||
void GLArea::sendRasterShot(QString name)
|
||||
{
|
||||
Shotf curShot= this->meshDoc->rm()->shot;
|
||||
Shotf curShot= this->md()->rm()->shot;
|
||||
emit transmitShot(name, curShot);
|
||||
}
|
||||
|
||||
@ -1171,7 +1171,7 @@ void GLArea::updateMeshSetVisibilities()
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
bool found =false;
|
||||
foreach(MeshModel * mp, meshDoc->meshList)
|
||||
foreach(MeshModel * mp, this->md()->meshList)
|
||||
{
|
||||
if(mp->id() == i.key())
|
||||
{
|
||||
@ -1183,7 +1183,7 @@ void GLArea::updateMeshSetVisibilities()
|
||||
meshVisibilityMap.remove(i.key());
|
||||
}
|
||||
|
||||
foreach(MeshModel * mp, meshDoc->meshList)
|
||||
foreach(MeshModel * mp, this->md()->meshList)
|
||||
{
|
||||
//Insert the new pair in the map; If the key is already in the map, its value will be overwritten
|
||||
meshVisibilityMap.insert(mp->id(),mp->visible);
|
||||
@ -1199,7 +1199,7 @@ void GLArea::updateRasterSetVisibilities()
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
bool found =false;
|
||||
foreach(RasterModel * rp, meshDoc->rasterList)
|
||||
foreach(RasterModel * rp, this->md()->rasterList)
|
||||
{
|
||||
if(rp->id() == i.key())
|
||||
{
|
||||
@ -1211,7 +1211,7 @@ void GLArea::updateRasterSetVisibilities()
|
||||
rasterVisibilityMap.remove(i.key());
|
||||
}
|
||||
|
||||
foreach(RasterModel * rp, meshDoc->rasterList)
|
||||
foreach(RasterModel * rp, this->md()->rasterList)
|
||||
{
|
||||
//Insert the new pair in the map;If the key is already in the map, its value will be overwritten
|
||||
rasterVisibilityMap.insert(rp->id(),rp->visible);
|
||||
@ -1236,9 +1236,9 @@ void GLArea::setIsRaster(bool viewMode){
|
||||
|
||||
void GLArea::loadRaster(int id)
|
||||
{
|
||||
foreach(RasterModel *rm, meshDoc->rasterList)
|
||||
foreach(RasterModel *rm, this->md()->rasterList)
|
||||
if(rm->id()==id){
|
||||
meshDoc->setCurrentRaster(id);
|
||||
this->md()->setCurrentRaster(id);
|
||||
setTarget(rm->currentPlane->image);
|
||||
//load his shot or a default shot
|
||||
|
||||
@ -1265,8 +1265,8 @@ void GLArea::loadRaster(int id)
|
||||
void GLArea::drawTarget() {
|
||||
if(!targetTex) return;
|
||||
|
||||
if(meshDoc->rm()==0) return;
|
||||
QImage &curImg = meshDoc->rm()->currentPlane->image;
|
||||
if(this->md()->rm()==0) return;
|
||||
QImage &curImg = this->md()->rm()->currentPlane->image;
|
||||
float imageRatio = float(curImg.width())/float(curImg.height());
|
||||
float screenRatio = float(this->width())/float(this->height());
|
||||
//set orthogonal view
|
||||
@ -1560,8 +1560,8 @@ QPair<vcg::Shotf,float> GLArea::shotFromTrackball()
|
||||
void GLArea::viewFromCurrentShot(QString kind)
|
||||
{
|
||||
Shotf localShot;
|
||||
if(kind=="Mesh" && meshDoc->mm()) localShot = meshDoc->mm()->cm.shot;
|
||||
if(kind=="Raster" && meshDoc->rm()) localShot = meshDoc->rm()->shot;
|
||||
if(kind=="Mesh" && this->md()->mm()) localShot = this->md()->mm()->cm.shot;
|
||||
if(kind=="Raster" && this->md()->rm()) localShot = this->md()->rm()->shot;
|
||||
if(!localShot.IsValid())
|
||||
{
|
||||
this->log->Logf(GLLogStream::SYSTEM, "Unable to set Shot from current %s",qPrintable(kind));
|
||||
@ -1584,7 +1584,7 @@ void GLArea::loadShot(const QPair<vcg::Shotf,float> &shotAndScale){
|
||||
trackball.Reset();
|
||||
trackball.track.sca = shotAndScale.second;
|
||||
|
||||
/*Point3f point = meshDoc->bbox().Center();
|
||||
/*Point3f point = this->md()->bbox().Center();
|
||||
Point3f p1 = ((trackball.track.Matrix()*(point-trackball.center))- Point3f(0,0,cameraDist));*/
|
||||
shot2Track(shot, cameraDist,trackball);
|
||||
|
||||
@ -1627,9 +1627,9 @@ void GLArea::createOrthoView(QString dir)
|
||||
view.Intrinsics.FocalMm = viewportYMm/(2*tanf(vcg::math::ToRad(fov/2))); //27.846098 equivalente a circa 60 gradi
|
||||
|
||||
trackball.Reset();
|
||||
float newScale= 3.0f/meshDoc->bbox().Diag();
|
||||
float newScale= 3.0f/this->md()->bbox().Diag();
|
||||
trackball.track.sca = newScale;
|
||||
trackball.track.tra = -meshDoc->bbox().Center();
|
||||
trackball.track.tra = -this->md()->bbox().Center();
|
||||
|
||||
vcg::Matrix44f rot;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include "../common/interfaces.h"
|
||||
#include "glarea_setting.h"
|
||||
#include "viewer.h"
|
||||
#include "multiViewer_Container.h"
|
||||
|
||||
#define SSHOT_BYTES_PER_PIXEL 4
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
};
|
||||
|
||||
class MeshModel;
|
||||
class GLArea : public Viewer
|
||||
class GLArea : public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -81,13 +81,21 @@ public:
|
||||
~GLArea();
|
||||
static void initGlobalParameterSet( RichParameterSet * /*globalparam*/);
|
||||
private:
|
||||
|
||||
int id; //the very important unique id of each subwindow.
|
||||
|
||||
public:
|
||||
int getId() {return id;}
|
||||
|
||||
// Layer Management stuff.
|
||||
|
||||
MeshModel *mm(){return meshDoc->mm();}
|
||||
|
||||
|
||||
MultiViewer_Container *mvc()
|
||||
{
|
||||
MultiViewer_Container *localMVC = qobject_cast<MultiViewer_Container *>(this->parent());
|
||||
return localMVC;
|
||||
}
|
||||
|
||||
MeshModel *mm(){ return mvc()->meshDoc.mm();}
|
||||
inline MeshDocument *md() {return &(mvc()->meshDoc);}
|
||||
vcg::Trackball trackball;
|
||||
vcg::Trackball trackball_light;
|
||||
GLLogStream *log;
|
||||
@ -104,7 +112,7 @@ public:
|
||||
|
||||
void updateFps(float deltaTime);
|
||||
|
||||
bool isCurrent() { return mvc->currentId == id;}
|
||||
bool isCurrent() { return mvc()->currentId == this->id;}
|
||||
|
||||
void showTrackBall(bool b) {trackBallVisible = b; update();}
|
||||
bool isHelpVisible() {return helpVisible;}
|
||||
|
||||
@ -78,7 +78,7 @@ LayerDialog::LayerDialog(QWidget *parent ) : QDockWidget(parent)
|
||||
void LayerDialog::keyPressEvent ( QKeyEvent * event )
|
||||
{
|
||||
if(event->key() == Qt::Key_Space )
|
||||
mw->GLA()->meshDoc->advanceCurrentRaster(1);
|
||||
mw->meshDoc()->advanceCurrentRaster(1);
|
||||
}
|
||||
|
||||
void LayerDialog::meshItemClicked (QTreeWidgetItem * item , int col)
|
||||
@ -92,7 +92,7 @@ void LayerDialog::meshItemClicked (QTreeWidgetItem * item , int col)
|
||||
case 0 :
|
||||
{
|
||||
//the user has clicked on one of the eyes
|
||||
MeshDocument *md= mw->GLA()->meshDoc;
|
||||
MeshDocument *md= mw->meshDoc();
|
||||
// NICE TRICK.
|
||||
// If the user has pressed ctrl when clicking on the eye icon, only that layer will remain visible
|
||||
// Very useful for comparing meshes
|
||||
@ -113,7 +113,7 @@ void LayerDialog::meshItemClicked (QTreeWidgetItem * item , int col)
|
||||
|
||||
case 3 :
|
||||
//the user has chosen to switch the layer
|
||||
mw->GLA()->meshDoc->setCurrentMesh(clickedId);
|
||||
mw->meshDoc()->setCurrentMesh(clickedId);
|
||||
break;
|
||||
}
|
||||
//make sure the right row is colored or that they right eye is drawn (open or closed)
|
||||
@ -134,7 +134,7 @@ void LayerDialog::rasterItemClicked (QTreeWidgetItem * item , int col)
|
||||
case 0 :
|
||||
{
|
||||
//the user has clicked on one of the eyes
|
||||
MeshDocument *md= mw->GLA()->meshDoc;
|
||||
MeshDocument *md= mw->meshDoc();
|
||||
|
||||
//Only one raster could be visible
|
||||
foreach(RasterModel *rm, md->rasterList)
|
||||
@ -157,7 +157,7 @@ void LayerDialog::rasterItemClicked (QTreeWidgetItem * item , int col)
|
||||
case 1 :
|
||||
case 2 :
|
||||
case 3 :
|
||||
mw->GLA()->meshDoc->setCurrentRaster(clickedId);
|
||||
mw->meshDoc()->setCurrentRaster(clickedId);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -190,7 +190,7 @@ void LayerDialog::showContextMenu(const QPoint& pos)
|
||||
QTreeWidgetItem *tItem = dynamic_cast<QTreeWidgetItem *>(ui->meshTreeWidget->itemAt(pos.x(),pos.y()));
|
||||
if(mItem){
|
||||
if (mItem->m)
|
||||
mw->GLA()->meshDoc->setCurrentMesh(mItem->m->id());
|
||||
mw->meshDoc()->setCurrentMesh(mItem->m->id());
|
||||
|
||||
foreach (QWidget *widget, QApplication::topLevelWidgets()) {
|
||||
MainWindow* mainwindow = dynamic_cast<MainWindow*>(widget);
|
||||
@ -214,7 +214,7 @@ void LayerDialog::showContextMenu(const QPoint& pos)
|
||||
|
||||
void LayerDialog::removeTag()
|
||||
{
|
||||
MeshDocument *md=mw->GLA()->meshDoc;
|
||||
MeshDocument *md=mw->meshDoc();
|
||||
md->removeTag(removeTagAct->data().toInt());
|
||||
updateTable();
|
||||
}
|
||||
@ -251,7 +251,7 @@ void LayerDialog::updateTable()
|
||||
//The layer dialog cannot be opened unless a new document is opened
|
||||
return;
|
||||
}
|
||||
MeshDocument *md=mw->GLA()->meshDoc;
|
||||
MeshDocument *md=mw->meshDoc();
|
||||
this->setWindowTitle(md->docLabel());
|
||||
|
||||
ui->meshTreeWidget->clear();
|
||||
@ -304,7 +304,7 @@ void LayerDialog::updateTable()
|
||||
rmd->visible =mw->GLA()->rasterVisibilityMap.value(rmd->id());
|
||||
|
||||
RasterTreeWidgetItem *item = new RasterTreeWidgetItem(rmd);
|
||||
if(rmd== mw->GLA()->meshDoc->rm()) {
|
||||
if(rmd== mw->meshDoc()->rm()) {
|
||||
item->setBackground(2,QBrush(Qt::yellow));
|
||||
item->setForeground(2,QBrush(Qt::blue));
|
||||
}
|
||||
@ -514,7 +514,7 @@ DecoratorParamsTreeWidget::DecoratorParamsTreeWidget(QAction* act,MainWindow *mw
|
||||
dialoglayout = new QGridLayout(parent);
|
||||
|
||||
frame = new StdParFrame(parent,mw->GLA());
|
||||
frame->loadFrameContent(tmpSet,mw->GLA()->meshDoc);
|
||||
frame->loadFrameContent(tmpSet,mw->meshDoc());
|
||||
savebut = new QPushButton("Save",parent);
|
||||
resetbut = new QPushButton("Reset",parent);
|
||||
//applybut = new QPushButton("Apply",parent);
|
||||
|
||||
@ -188,7 +188,7 @@ void MainWindow::updateWindowMenu()
|
||||
if(mvc)
|
||||
{
|
||||
setUnsplitAct->setEnabled(mvc->viewerCounter()>1);
|
||||
Viewer* current = mvc->currentView();
|
||||
GLArea* current = mvc->currentView();
|
||||
if(current)
|
||||
{
|
||||
setSplitHAct->setEnabled(current->size().height()/2 > current->minimumSizeHint().height());
|
||||
@ -409,8 +409,8 @@ void MainWindow::setSplit(QAction *qa)
|
||||
//The loading of the raster must be here
|
||||
if(isRaster){
|
||||
glwClone->setIsRaster(true);
|
||||
if(GLA()->meshDoc->rm()->id()>=0)
|
||||
glwClone->loadRaster(GLA()->meshDoc->rm()->id());
|
||||
if(this->meshDoc()->rm()->id()>=0)
|
||||
glwClone->loadRaster(this->meshDoc()->rm()->id());
|
||||
}
|
||||
|
||||
updateMenus();
|
||||
@ -846,7 +846,7 @@ void MainWindow::startFilter()
|
||||
if(filterClassesList.contains("MeshCreation"))
|
||||
{
|
||||
qDebug("MeshCreation");
|
||||
GLA()->meshDoc->addNewMesh("","untitled.ply");
|
||||
meshDoc()->addNewMesh("","untitled.ply");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1438,7 +1438,7 @@ bool MainWindow::openProject(QString fileName)
|
||||
for (int i=0; i<md->meshList.size(); i++)
|
||||
{
|
||||
QString fullPath = md->meshList[i]->fullName();
|
||||
importMeshWithStandardParams(fullPath,GLA()->meshDoc->meshList[i]);
|
||||
importMeshWithStandardParams(fullPath,this->meshDoc()->meshList[i]);
|
||||
}
|
||||
//for (int i=0; i<md->rasterList.size(); i++)
|
||||
//{
|
||||
@ -1469,7 +1469,7 @@ GLArea* MainWindow::newDocument(const QString& projName)
|
||||
connect(mvcont,SIGNAL(updateMainWindowMenus()),this,SLOT(updateMenus()));
|
||||
GLArea *gla=new GLArea(mvcont, ¤tGlobalParams);
|
||||
mvcont->addView(gla, Qt::Horizontal);
|
||||
mdiarea->addSubWindow(gla->mvc);
|
||||
mdiarea->addSubWindow(gla->mvc());
|
||||
if (projName.isEmpty())
|
||||
{
|
||||
static int docCounter = 1;
|
||||
@ -1480,7 +1480,7 @@ GLArea* MainWindow::newDocument(const QString& projName)
|
||||
mvcont->meshDoc.setDocLabel(projName);
|
||||
mvcont->setWindowTitle(mvcont->meshDoc.docLabel());
|
||||
//if(mdiarea->isVisible())
|
||||
gla->mvc->showMaximized();
|
||||
gla->mvc()->showMaximized();
|
||||
return gla;
|
||||
}
|
||||
|
||||
@ -1522,8 +1522,8 @@ bool MainWindow::importRaster(const QString& fileImg)
|
||||
return false;
|
||||
}
|
||||
|
||||
GLA()->meshDoc->setBusy(true);
|
||||
RasterModel *rm= GLA()->meshDoc->addNewRaster();
|
||||
this->meshDoc()->setBusy(true);
|
||||
RasterModel *rm= meshDoc()->addNewRaster();
|
||||
rm->setLabel(fileImg);
|
||||
rm->addPlane(new Plane(rm,fileName,QString("")));
|
||||
meshDoc()->setBusy(false);
|
||||
@ -1586,7 +1586,7 @@ bool MainWindow::importMesh(const QString& fileName, MeshIOInterface *pCurrentIO
|
||||
QMessageBox::warning(this, tr("Opening Problems"), QString("While opening: '%1'\n\n").arg(fileName)+pCurrentIOPlugin->errorMsg());
|
||||
meshDoc()->setBusy(true);
|
||||
if(mdiarea->isVisible())
|
||||
GLA()->mvc->showMaximized();
|
||||
GLA()->mvc()->showMaximized();
|
||||
setCurrentFile(fileName);
|
||||
|
||||
if( mask & vcg::tri::io::Mask::IOM_FACECOLOR) GLA()->setColorMode(GLW::CMPerFace);
|
||||
@ -1697,7 +1697,7 @@ bool MainWindow::open(QString fileName)
|
||||
}
|
||||
int mask = 0;
|
||||
//MeshModel *mm= new MeshModel(gla->meshDoc);
|
||||
MeshModel *mm=GLA()->meshDoc->addNewMesh(qPrintable(fileName),"");
|
||||
MeshModel *mm=meshDoc()->addNewMesh(qPrintable(fileName),"");
|
||||
qb->show();
|
||||
QTime t;t.start();
|
||||
bool open = importMesh(fileName,pCurrentIOPlugin,mm,mask,&prePar);
|
||||
|
||||
@ -15,7 +15,6 @@ DEPENDPATH += $$VCGDIR \
|
||||
HEADERS = ../common/interfaces.h \
|
||||
mainwindow.h \
|
||||
glarea.h \
|
||||
viewer.h \
|
||||
multiViewer_Container.h \
|
||||
glarea_setting.h \
|
||||
plugindialog.h \
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "multiViewer_Container.h"
|
||||
#include "viewer.h"
|
||||
#include "GLArea.h"
|
||||
#include <QMouseEvent>
|
||||
#include "mainwindow.h"
|
||||
|
||||
@ -72,21 +72,21 @@ MultiViewer_Container::MultiViewer_Container(QWidget *parent)
|
||||
}
|
||||
|
||||
MultiViewer_Container::~MultiViewer_Container(){
|
||||
foreach(Viewer* viewer, viewerList)
|
||||
foreach(GLArea* viewer, viewerList)
|
||||
delete viewer;
|
||||
}
|
||||
|
||||
int MultiViewer_Container::getNextViewerId(){
|
||||
int newId=-1;
|
||||
|
||||
for(QVector<Viewer*>::iterator view=viewerList.begin();view!=viewerList.end();++view)
|
||||
for(QVector<GLArea*>::iterator view=viewerList.begin();view!=viewerList.end();++view)
|
||||
if(newId < (*view)->getId()) newId = (*view)->getId();
|
||||
|
||||
return ++newId;
|
||||
}
|
||||
|
||||
|
||||
void MultiViewer_Container::addView(Viewer* viewer,Qt::Orientation orient){
|
||||
void MultiViewer_Container::addView(GLArea* viewer,Qt::Orientation orient){
|
||||
/* The Viewers are organized like a BSP tree.
|
||||
Every new viewer is added within an Horizontal splitter. Its orientation could change according to next insertions.
|
||||
HSplit
|
||||
@ -108,7 +108,7 @@ void MultiViewer_Container::addView(Viewer* viewer,Qt::Orientation orient){
|
||||
}
|
||||
|
||||
else{
|
||||
Viewer* current = currentView();
|
||||
GLArea* current = currentView();
|
||||
Splitter* parentSplitter = qobject_cast<Splitter *>(current->parent());
|
||||
/*
|
||||
CASE 2: Simple insertion inside the parent splitter (right branch). The insertion is on the parent's right branch.
|
||||
@ -201,7 +201,7 @@ void MultiViewer_Container::addView(Viewer* viewer,Qt::Orientation orient){
|
||||
|
||||
void MultiViewer_Container::removeView(int viewerId){
|
||||
for (int i=0; i< viewerList.count(); i++){
|
||||
Viewer* viewer = viewerList.at(i);
|
||||
GLArea* viewer = viewerList.at(i);
|
||||
if (viewer->getId() == viewerId){
|
||||
viewerList.remove(i);
|
||||
Splitter* parentSplitter = qobject_cast<Splitter *>(viewer->parent());
|
||||
@ -255,16 +255,16 @@ void MultiViewer_Container::updateCurrent(int current){
|
||||
emit updateMainWindowMenus();
|
||||
}
|
||||
|
||||
Viewer * MultiViewer_Container::getViewer(int id)
|
||||
GLArea * MultiViewer_Container::getViewer(int id)
|
||||
{
|
||||
foreach ( Viewer* viewer, viewerList)
|
||||
foreach ( GLArea* viewer, viewerList)
|
||||
if (viewer->getId() == id)
|
||||
return viewer;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MultiViewer_Container::getViewerByPicking(QPoint p){
|
||||
foreach ( Viewer* viewer, viewerList){
|
||||
foreach ( GLArea* viewer, viewerList){
|
||||
QPoint pViewer = viewer->mapFromGlobal(p);
|
||||
if(viewer->visibleRegion().contains(pViewer))
|
||||
return viewer->getId();
|
||||
@ -272,7 +272,7 @@ int MultiViewer_Container::getViewerByPicking(QPoint p){
|
||||
return -1;
|
||||
}
|
||||
|
||||
Viewer* MultiViewer_Container::currentView(){
|
||||
GLArea* MultiViewer_Container::currentView(){
|
||||
return getViewer(currentId);
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ int MultiViewer_Container::viewerCounter(){
|
||||
}
|
||||
|
||||
void MultiViewer_Container::updateAllViewer(){
|
||||
foreach ( Viewer* viewer, viewerList)
|
||||
foreach ( GLArea* viewer, viewerList)
|
||||
viewer->update();
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ void MultiViewer_Container::updateTrackballInViewers()
|
||||
if(glArea)
|
||||
{
|
||||
QPair<Shotf,float> shotAndScale = glArea->shotFromTrackball();
|
||||
foreach(Viewer* viewer, viewerList)
|
||||
foreach(GLArea* viewer, viewerList)
|
||||
if(viewer->getId() != currentId){
|
||||
((GLArea*) viewer)->loadShot(shotAndScale);
|
||||
}
|
||||
|
||||
@ -30,9 +30,8 @@
|
||||
#include "../common/meshmodel.h"
|
||||
|
||||
// Class list
|
||||
|
||||
class GLArea;
|
||||
class RichParameterSet;
|
||||
class Viewer;
|
||||
class MultiViewer_Container;
|
||||
|
||||
class Splitter : public QSplitter
|
||||
@ -70,17 +69,17 @@ public:
|
||||
MultiViewer_Container(QWidget *parent);
|
||||
~MultiViewer_Container();
|
||||
|
||||
void addView(Viewer* viewer, Qt::Orientation);
|
||||
void addView(GLArea* viewer, Qt::Orientation);
|
||||
void removeView(int);
|
||||
|
||||
Viewer* currentView();
|
||||
int getNextViewerId();
|
||||
GLArea* currentView();
|
||||
int getNextViewerId();
|
||||
int viewerCounter();
|
||||
|
||||
void updateAllViewer();
|
||||
void update(int id);
|
||||
|
||||
Viewer* getViewer(int id);
|
||||
GLArea* getViewer(int id);
|
||||
int getViewerByPicking(QPoint);
|
||||
|
||||
void updateTrackballInViewers();
|
||||
@ -99,7 +98,7 @@ public slots:
|
||||
void updateCurrent(int current);
|
||||
|
||||
private:
|
||||
QVector<Viewer *> viewerList; /// widgets for the OpenGL contexts and images
|
||||
QVector<GLArea *> viewerList; /// widgets for the OpenGL contexts and images
|
||||
};
|
||||
|
||||
#endif // __MULTIVIEWER_CONTAINER_H__
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
/****************************************************************************
|
||||
* MeshLab o o *
|
||||
* A versatile mesh processing toolbox o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2005 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef __VIEWER_H__
|
||||
#define __VIEWER_H__
|
||||
|
||||
#include <QGLWidget>
|
||||
|
||||
#include "multiViewer_Container.h"
|
||||
|
||||
class Viewer: public QGLWidget
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Viewer(MultiViewer_Container *mvcont): QGLWidget() {
|
||||
mvc = mvcont;
|
||||
id = mvc->getNextViewerId();
|
||||
meshDoc = &(mvc->meshDoc);
|
||||
}
|
||||
virtual ~Viewer(){};
|
||||
int getId() {return id;}
|
||||
|
||||
protected:
|
||||
int id;
|
||||
|
||||
public:
|
||||
MeshDocument *meshDoc;
|
||||
MultiViewer_Container *mvc;
|
||||
|
||||
};
|
||||
|
||||
#endif // __VIEWER_H__
|
||||
Loading…
x
Reference in New Issue
Block a user