mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-19 19:14:42 +00:00
edit_pickpoints plugin:
- added support for mesh with double precision attributes - removed some warnings
This commit is contained in:
parent
040974b902
commit
3fddf93c97
@ -87,8 +87,8 @@ void EditPickPointsPlugin::Decorate(MeshModel &mm, GLArea *gla, QPainter *painte
|
||||
}
|
||||
|
||||
//We have to calculate the position here because it doesnt work in the mouseEvent functions for some reason
|
||||
Point3f pickedPoint;
|
||||
if (moveSelectPoint && Pick<Point3f>(currentMousePosition.x(),gla->height()-currentMousePosition.y(),pickedPoint)){
|
||||
Point3m pickedPoint;
|
||||
if (moveSelectPoint && Pick<Point3m>(currentMousePosition.x(),gla->height()-currentMousePosition.y(),pickedPoint)){
|
||||
/* qDebug("Found point for move %i %i -> %f %f %f",
|
||||
currentMousePosition.x(),
|
||||
currentMousePosition.y(),
|
||||
@ -98,7 +98,7 @@ void EditPickPointsPlugin::Decorate(MeshModel &mm, GLArea *gla, QPainter *painte
|
||||
pickPointsDialog->selectOrMoveThisPoint(pickedPoint);
|
||||
|
||||
moveSelectPoint = false;
|
||||
} else if(registerPoint && Pick<Point3f>(currentMousePosition.x(),gla->height()-currentMousePosition.y(),pickedPoint))
|
||||
} else if(registerPoint && Pick<Point3m>(currentMousePosition.x(),gla->height()-currentMousePosition.y(),pickedPoint))
|
||||
{
|
||||
/* qDebug("Found point for add %i %i -> %f %f %f",
|
||||
currentMousePosition.x(),
|
||||
@ -108,8 +108,7 @@ void EditPickPointsPlugin::Decorate(MeshModel &mm, GLArea *gla, QPainter *painte
|
||||
|
||||
//find the normal of the face we just clicked
|
||||
CFaceO *face;
|
||||
bool result = GLPickTri<CMeshO>::PickClosestFace(currentMousePosition.x(),gla->height()-currentMousePosition.y(),
|
||||
mm.cm, face);
|
||||
bool result = GLPickTri<CMeshO>::PickClosestFace(currentMousePosition.x(),gla->height()-currentMousePosition.y(),mm.cm, face);
|
||||
|
||||
if(!result){
|
||||
qDebug() << "find nearest face failed!";
|
||||
@ -173,7 +172,7 @@ bool EditPickPointsPlugin::StartEdit(MeshModel &mm, GLArea *gla )
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditPickPointsPlugin::EndEdit(MeshModel &mm, GLArea *gla)
|
||||
void EditPickPointsPlugin::EndEdit(MeshModel &mm, GLArea * /*gla*/)
|
||||
{
|
||||
//qDebug() << "EndEdit Pick Points: " << mm.fileName.c_str() << " ..." << mm.cm.fn;
|
||||
|
||||
@ -272,13 +271,12 @@ void EditPickPointsPlugin::mouseReleaseEvent(QMouseEvent *event, MeshModel &mm,
|
||||
}
|
||||
|
||||
void EditPickPointsPlugin::drawPickedPoints(
|
||||
std::vector<PickedPointTreeWidgetItem*> &pointVector, vcg::Box3f &boundingBox, QPainter *painter)
|
||||
std::vector<PickedPointTreeWidgetItem*> &pointVector, Box3m &boundingBox, QPainter *painter)
|
||||
{
|
||||
assert(glArea);
|
||||
|
||||
vcg::Point3f size = boundingBox.Dim();
|
||||
Point3m size = boundingBox.Dim();
|
||||
//how we scale the object indicating the normal at each selected point
|
||||
float scaleFactor = (size[0]+size[1]+size[2])/90.0;
|
||||
Scalarm scaleFactor = (size[0]+size[1]+size[2])/90.0;
|
||||
|
||||
//qDebug() << "scaleFactor: " << scaleFactor;
|
||||
|
||||
@ -302,7 +300,7 @@ void EditPickPointsPlugin::drawPickedPoints(
|
||||
PickedPointTreeWidgetItem * item = pointVector[i];
|
||||
//if the point has been set (it may not be if a template has been loaded)
|
||||
if(item->isActive()){
|
||||
Point3f point = item->getPoint();
|
||||
Point3m point = item->getPoint();
|
||||
glColor(Color4b::Blue);
|
||||
glLabel::render(painter,point, QString(item->getName()));
|
||||
|
||||
@ -330,29 +328,26 @@ void EditPickPointsPlugin::drawPickedPoints(
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
Point3f yaxis;
|
||||
yaxis[0] = 0;
|
||||
yaxis[1] = 1;
|
||||
yaxis[2] = 0;
|
||||
Point3m yaxis(Scalarm(0),Scalarm(1),Scalarm(0));
|
||||
|
||||
for(int i = 0; i < pointVector.size(); ++i)
|
||||
{
|
||||
PickedPointTreeWidgetItem * item = pointVector[i];
|
||||
//if the point has been set (it may not be if a template has been loaded)
|
||||
if(item->isActive()){
|
||||
Point3f point = item->getPoint();
|
||||
Point3m point = item->getPoint();
|
||||
|
||||
if(showNormal)
|
||||
{
|
||||
Point3f normal = item->getNormal();
|
||||
Point3m normal = item->getNormal();
|
||||
|
||||
if(showPin)
|
||||
{
|
||||
//dot product
|
||||
float angle = (Angle(normal,yaxis) * 180.0 / PI);
|
||||
Scalarm angle = (Angle(normal,yaxis) * 180.0 / PI);
|
||||
|
||||
//cross product
|
||||
Point3f axis = yaxis^normal;
|
||||
Point3m axis = yaxis^normal;
|
||||
//qDebug() << "angle: " << angle << " x" << axis[0] << " y" << axis[1] << " z" << axis[2];
|
||||
|
||||
//bluegreen and a little clear
|
||||
@ -412,7 +407,6 @@ void EditPickPointsPlugin::drawPickedPoints(
|
||||
if(item->isSelected() ) glColor4f(0.0f, 1.0f, 0.0f, 0.7f);
|
||||
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
} else
|
||||
{
|
||||
@ -424,15 +418,13 @@ void EditPickPointsPlugin::drawPickedPoints(
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
glColor(Color4b::Red);
|
||||
glArea->renderText(point[0], point[1], point[2], QString(item->getName()) );
|
||||
//glArea->renderText(point[0], point[1], point[2], QString(item->getName()) );
|
||||
}
|
||||
}
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glPopAttrib();
|
||||
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
//basically copied from void AlignPairWidget::drawPickedPoints in editalign plugin
|
||||
//Draws all the picked points on the screen
|
||||
//boundingBox - gives some indication how to scale the normal flags
|
||||
void drawPickedPoints(std::vector<PickedPointTreeWidgetItem*> &pointVector, vcg::Box3f &boundingBox, QPainter *painter);
|
||||
void drawPickedPoints(std::vector<PickedPointTreeWidgetItem*> &pointVector, Box3m &boundingBox, QPainter *painter);
|
||||
|
||||
private:
|
||||
//the current place the mouse clicked
|
||||
|
||||
@ -63,17 +63,22 @@ const QString PickedPoints::False = "0";
|
||||
const std::string PickedPoints::Key = "PickedPoints";
|
||||
|
||||
|
||||
PickedPoints::PickedPoints(){
|
||||
pointVector = new std::vector<PickedPoint *>();
|
||||
PickedPoints::PickedPoints()
|
||||
:pointVector()
|
||||
{
|
||||
}
|
||||
|
||||
PickedPoints::~PickedPoints(){
|
||||
delete pointVector;
|
||||
PickedPoints::~PickedPoints()
|
||||
{
|
||||
for(size_t ii = 0; ii < pointVector.size();++ii)
|
||||
delete pointVector[ii];
|
||||
pointVector.clear();
|
||||
|
||||
}
|
||||
|
||||
bool PickedPoints::open(QString filename){
|
||||
QDomDocument doc;
|
||||
pointVector->clear();
|
||||
pointVector.clear();
|
||||
|
||||
QFile file(filename);
|
||||
|
||||
@ -106,7 +111,7 @@ bool PickedPoints::open(QString filename){
|
||||
QString y = element.attribute(yCoordinate);
|
||||
QString z = element.attribute(zCoordinate);
|
||||
|
||||
vcg::Point3f point(x.toFloat(), y.toFloat(), z.toFloat());
|
||||
Point3m point(x.toDouble(), y.toDouble(), z.toDouble());
|
||||
|
||||
QString presentString = element.attribute(active);
|
||||
bool present = true;
|
||||
@ -165,12 +170,12 @@ bool PickedPoints::save(QString filename, QString dataFileName){
|
||||
dataTag.appendChild(data);
|
||||
|
||||
//create an element for each point
|
||||
for (int i = 0; i < pointVector->size(); ++i) {
|
||||
PickedPoint *pickedPoint = pointVector->at(i);
|
||||
for (int i = 0; i < pointVector.size(); ++i) {
|
||||
PickedPoint *pickedPoint = pointVector.at(i);
|
||||
|
||||
QDomElement tag = doc.createElement(pointElementName);
|
||||
|
||||
vcg::Point3f point = pickedPoint->point;
|
||||
Point3m point = pickedPoint->point;
|
||||
|
||||
tag.setAttribute(xCoordinate, point[0] );
|
||||
tag.setAttribute(yCoordinate, point[1] );
|
||||
@ -197,42 +202,41 @@ bool PickedPoints::save(QString filename, QString dataFileName){
|
||||
return true;
|
||||
}
|
||||
|
||||
void PickedPoints::addPoint(QString name, vcg::Point3f point, bool present){
|
||||
assert(pointVector);
|
||||
|
||||
void PickedPoints::addPoint(QString name, Point3m point, bool present)
|
||||
{
|
||||
PickedPoint *pickedPoint = new PickedPoint(name, point, present);
|
||||
pointVector->push_back(pickedPoint);
|
||||
pointVector.push_back(pickedPoint);
|
||||
}
|
||||
|
||||
std::vector<PickedPoint*> * PickedPoints::getPickedPointVector()
|
||||
std::vector<PickedPoint*>& PickedPoints::getPickedPointVector()
|
||||
{
|
||||
return pointVector;
|
||||
}
|
||||
|
||||
std::vector<vcg::Point3f> * PickedPoints::getPoint3fVector()
|
||||
std::vector<Point3m> * PickedPoints::getPoint3Vector()
|
||||
{
|
||||
std::vector<vcg::Point3f> *points = new std::vector<vcg::Point3f>();
|
||||
std::vector<Point3m> *points = new std::vector<Point3m>();
|
||||
|
||||
for(int i = 0; i < pointVector->size(); i++)
|
||||
for(size_t i = 0; i < pointVector.size(); i++)
|
||||
{
|
||||
if(pointVector->at(i)->present )
|
||||
points->push_back(pointVector->at(i)->point);
|
||||
if(pointVector.at(i)->present )
|
||||
points->push_back(pointVector.at(i)->point);
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
void PickedPoints::translatePoints(vcg::Matrix44f &translation)
|
||||
void PickedPoints::translatePoints(Matrix44m &translation)
|
||||
{
|
||||
for(int i = 0; i < pointVector->size(); i++)
|
||||
for(size_t i = 0; i < pointVector.size(); i++)
|
||||
{
|
||||
PickedPoint* temp = pointVector->at(i);
|
||||
PickedPoint* temp = pointVector.at(i);
|
||||
|
||||
//qDebug() << " point was x" << temp->point[0] << " y " << temp->point[1] << " z " << temp->point[2];
|
||||
|
||||
vcg::Point4f inputPoint(temp->point[0], temp->point[1], temp->point[2], 1);
|
||||
Point4m inputPoint(temp->point[0], temp->point[1], temp->point[2], 1);
|
||||
|
||||
vcg::Point4f resultPoint = translation * inputPoint;
|
||||
Point4m resultPoint = translation * inputPoint;
|
||||
|
||||
temp->point[0] = resultPoint[0];
|
||||
temp->point[1] = resultPoint[1];
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
class PickedPoint
|
||||
{
|
||||
public:
|
||||
PickedPoint(QString _name, vcg::Point3f _point, bool _present){
|
||||
PickedPoint(QString _name, Point3m _point, bool _present){
|
||||
name = _name;
|
||||
point = _point;
|
||||
present = _present;
|
||||
@ -52,7 +52,7 @@ public:
|
||||
bool present;
|
||||
|
||||
//point
|
||||
vcg::Point3f point;
|
||||
Point3m point;
|
||||
};
|
||||
|
||||
class PickedPoints
|
||||
@ -70,16 +70,16 @@ public:
|
||||
bool save(QString filename, QString dataFileName);
|
||||
|
||||
//add a point to the map
|
||||
void addPoint(QString name, vcg::Point3f point, bool present);
|
||||
void addPoint(QString name, Point3m point, bool present);
|
||||
|
||||
std::vector<PickedPoint*> * getPickedPointVector();
|
||||
std::vector<PickedPoint*>& getPickedPointVector();
|
||||
|
||||
//get a vector containing only active points
|
||||
std::vector<vcg::Point3f> * getPoint3fVector();
|
||||
std::vector<Point3m> * getPoint3Vector();
|
||||
|
||||
//translate each point using the matrix
|
||||
//if the mesh moves you can then translate the points useing this function
|
||||
void translatePoints(vcg::Matrix44f &translation);
|
||||
void translatePoints(Matrix44m &translation);
|
||||
|
||||
//get the suggested filename for the points. will be based on the mesh's filename
|
||||
static QString getSuggestedPickedPointsFileName(const MeshModel &meshModel);
|
||||
@ -99,7 +99,7 @@ public:
|
||||
private:
|
||||
|
||||
//data
|
||||
std::vector<PickedPoint*> *pointVector;
|
||||
std::vector<PickedPoint*> pointVector;
|
||||
|
||||
//the template that was used to pick these points
|
||||
//will be "" if no template was used
|
||||
|
||||
@ -58,7 +58,6 @@ public:
|
||||
{
|
||||
unifGrid.Set(m->face.begin(),m->face.end());
|
||||
markerFunctor.SetMesh(m);
|
||||
|
||||
dist_upper_bound = m->bbox.Diag()/10.0f;
|
||||
}
|
||||
}
|
||||
@ -69,14 +68,14 @@ public:
|
||||
|
||||
MarkerFace markerFunctor;
|
||||
|
||||
float dist_upper_bound;
|
||||
Scalarm dist_upper_bound;
|
||||
|
||||
CMeshO::FaceType * getFace(vcg::Point3f &p)
|
||||
CMeshO::FaceType * getFace(Point3m &p)
|
||||
{
|
||||
assert(m);
|
||||
// the results
|
||||
vcg::Point3f closestPt;
|
||||
float dist = dist_upper_bound;
|
||||
Point3m closestPt;
|
||||
Scalarm dist = dist_upper_bound;
|
||||
const CMeshO::CoordType &startPt = p;
|
||||
|
||||
// compute distance between startPt and the mesh S2
|
||||
@ -93,7 +92,7 @@ public:
|
||||
};
|
||||
|
||||
PickedPointTreeWidgetItem::PickedPointTreeWidgetItem(
|
||||
vcg::Point3f &intputPoint, CMeshO::FaceType::NormalType &faceNormal,
|
||||
Point3m &intputPoint, CMeshO::FaceType::NormalType &faceNormal,
|
||||
QString name, bool _active) : QTreeWidgetItem(1001)
|
||||
{
|
||||
//name
|
||||
@ -114,7 +113,7 @@ QString PickedPointTreeWidgetItem::getName(){
|
||||
return text(0);
|
||||
}
|
||||
|
||||
void PickedPointTreeWidgetItem::setPointAndNormal(vcg::Point3f &intputPoint, CMeshO::FaceType::NormalType &faceNormal)
|
||||
void PickedPointTreeWidgetItem::setPointAndNormal(Point3m &intputPoint, CMeshO::FaceType::NormalType &faceNormal)
|
||||
{
|
||||
point[0] = intputPoint[0];
|
||||
point[1] = intputPoint[1];
|
||||
@ -136,11 +135,11 @@ void PickedPointTreeWidgetItem::setPointAndNormal(vcg::Point3f &intputPoint, CMe
|
||||
setText(3, tempString);
|
||||
}
|
||||
|
||||
vcg::Point3f PickedPointTreeWidgetItem::getPoint(){
|
||||
Point3m PickedPointTreeWidgetItem::getPoint(){
|
||||
return point;
|
||||
}
|
||||
|
||||
vcg::Point3f PickedPointTreeWidgetItem::getNormal(){
|
||||
Point3m PickedPointTreeWidgetItem::getNormal(){
|
||||
return normal;
|
||||
}
|
||||
|
||||
@ -258,7 +257,7 @@ PickPointsDialog::~PickPointsDialog()
|
||||
delete getClosestFace;
|
||||
}
|
||||
|
||||
void PickPointsDialog::addMoveSelectPoint(Point3f point, CMeshO::FaceType::NormalType faceNormal)
|
||||
void PickPointsDialog::addMoveSelectPoint(Point3m point, CMeshO::FaceType::NormalType faceNormal)
|
||||
{
|
||||
if(currentMode == ADD_POINT)
|
||||
{
|
||||
@ -323,7 +322,7 @@ void PickPointsDialog::recordNextPointForUndo()
|
||||
recordPointForUndo = true;
|
||||
}
|
||||
|
||||
void PickPointsDialog::selectOrMoveThisPoint(Point3f point){
|
||||
void PickPointsDialog::selectOrMoveThisPoint(Point3m point){
|
||||
qDebug() << "point is: " << point[0] << " " << point[1] << " " << point[2];
|
||||
|
||||
//the item closest to the given point
|
||||
@ -331,22 +330,22 @@ void PickPointsDialog::selectOrMoveThisPoint(Point3f point){
|
||||
|
||||
//the smallest distance from the given point to one in the list
|
||||
//so far....
|
||||
float minDistanceSoFar = -1.0;
|
||||
Scalarm minDistanceSoFar = -1.0;
|
||||
|
||||
for(int i = 0; i < pickedPointTreeWidgetItemVector.size(); i++){
|
||||
PickedPointTreeWidgetItem *item =
|
||||
pickedPointTreeWidgetItemVector.at(i);
|
||||
|
||||
Point3f tempPoint = item->getPoint();
|
||||
Point3m tempPoint = item->getPoint();
|
||||
|
||||
//qDebug() << "tempPoint is: " << tempPoint[0] << " " << tempPoint[1] << " " << tempPoint[2];
|
||||
|
||||
float temp = sqrt(pow(point[0]-tempPoint[0],2) +
|
||||
pow(point[1]-tempPoint[1],2) +
|
||||
pow(point[2]-tempPoint[2],2));
|
||||
Scalarm temp = std::sqrt(std::pow(point[0]-tempPoint[0],2) +
|
||||
std::pow(point[1]-tempPoint[1],2) +
|
||||
std::pow(point[2]-tempPoint[2],2));
|
||||
//qDebug() << "distance is: " << temp;
|
||||
|
||||
if(minDistanceSoFar < 0 || minDistanceSoFar > temp){
|
||||
if(minDistanceSoFar < Scalarm(0) || minDistanceSoFar > temp){
|
||||
minDistanceSoFar = temp;
|
||||
closestItem = item;
|
||||
}
|
||||
@ -377,7 +376,7 @@ bool PickPointsDialog::drawNormalAsPin()
|
||||
return ui.pinRadioButton->isChecked();
|
||||
}
|
||||
|
||||
void PickPointsDialog::addPoint(vcg::Point3f &point, QString &name, bool present)
|
||||
void PickPointsDialog::addPoint(Point3m &point, QString &name, bool present)
|
||||
{
|
||||
//bool result = GLPickTri<CMeshO>::PickNearestFace(currentMousePosition.x(),gla->height()-currentMousePosition.y(),
|
||||
// mm.cm, face);
|
||||
@ -401,12 +400,12 @@ void PickPointsDialog::addPoint(vcg::Point3f &point, QString &name, bool present
|
||||
addTreeWidgetItemForPoint(point, name, face->N(), present);
|
||||
else
|
||||
{
|
||||
vcg::Point3f faceNormal;
|
||||
Point3m faceNormal;
|
||||
addTreeWidgetItemForPoint(point, name, faceNormal, present);
|
||||
}
|
||||
}
|
||||
|
||||
PickedPointTreeWidgetItem * PickPointsDialog::addTreeWidgetItemForPoint(vcg::Point3f &point, QString &name, CMeshO::FaceType::NormalType &faceNormal, bool present)
|
||||
PickedPointTreeWidgetItem * PickPointsDialog::addTreeWidgetItemForPoint(Point3m &point, QString &name, CMeshO::FaceType::NormalType &faceNormal, bool present)
|
||||
{
|
||||
PickedPointTreeWidgetItem *widgetItem =
|
||||
new PickedPointTreeWidgetItem(point, faceNormal, name, present);
|
||||
@ -490,8 +489,8 @@ void PickPointsDialog::loadPickPointsTemplate(QString filename)
|
||||
PickPointsTemplate::load(filename, &pointNameVector);
|
||||
|
||||
for(int i = 0; i < pointNameVector.size(); i++){
|
||||
vcg::Point3f point;
|
||||
vcg::Point3f faceNormal;
|
||||
Point3m point;
|
||||
Point3m faceNormal;
|
||||
PickedPointTreeWidgetItem *widgetItem =
|
||||
addTreeWidgetItemForPoint(point, pointNameVector.at(i), faceNormal, false);
|
||||
widgetItem->clearPoint();
|
||||
@ -533,6 +532,7 @@ void PickPointsDialog::setCurrentMeshModel(MeshModel *newMeshModel, GLArea *gla)
|
||||
//make sure we start in pick mode
|
||||
togglePickMode(true);
|
||||
|
||||
meshModel->updateDataMask(MeshModel::MM_FACEMARK);
|
||||
//set up the
|
||||
getClosestFace->init(&(meshModel->cm));
|
||||
|
||||
@ -549,11 +549,11 @@ void PickPointsDialog::setCurrentMeshModel(MeshModel *newMeshModel, GLArea *gla)
|
||||
const QString &name = pickedPoints->getTemplateName();
|
||||
setTemplateName(name);
|
||||
|
||||
std::vector<PickedPoint*> * pickedPointVector = pickedPoints->getPickedPointVector();
|
||||
std::vector<PickedPoint*>& pickedPointVector = pickedPoints->getPickedPointVector();
|
||||
|
||||
PickedPoint *point;
|
||||
for(int i = 0; i < pickedPointVector->size(); i++){
|
||||
point = pickedPointVector->at(i);
|
||||
for(size_t i = 0; i < pickedPointVector.size(); i++){
|
||||
point = pickedPointVector.at(i);
|
||||
|
||||
addPoint(point->point, point->name, point->present);
|
||||
}
|
||||
@ -747,10 +747,10 @@ void PickPointsDialog::loadPoints(QString filename){
|
||||
const QString &name = pickedPoints.getTemplateName();
|
||||
setTemplateName(name);
|
||||
|
||||
std::vector<PickedPoint*> *points = pickedPoints.getPickedPointVector();
|
||||
std::vector<PickedPoint*>& points = pickedPoints.getPickedPointVector();
|
||||
|
||||
for(int i = 0; i < points->size(); i++){
|
||||
PickedPoint *pickedPoint = points->at(i);
|
||||
for(size_t i = 0; i < points.size(); i++){
|
||||
PickedPoint *pickedPoint = points.at(i);
|
||||
|
||||
addPoint(pickedPoint->point, pickedPoint->name, pickedPoint->present);
|
||||
}
|
||||
@ -879,8 +879,8 @@ void PickPointsDialog::addPointToTemplate()
|
||||
if(!templateLoaded)
|
||||
setTemplateName("new Template");
|
||||
|
||||
vcg::Point3f point;
|
||||
vcg::Point3f faceNormal;
|
||||
Point3m point;
|
||||
Point3m faceNormal;
|
||||
QString name("new point");
|
||||
PickedPointTreeWidgetItem *widgetItem =
|
||||
addTreeWidgetItemForPoint(point, name, faceNormal, false);
|
||||
@ -892,8 +892,8 @@ void PickPointsDialog::undo()
|
||||
{
|
||||
if(NULL != lastPointToMove)
|
||||
{
|
||||
vcg::Point3f tempPoint = lastPointToMove->getPoint();
|
||||
vcg::Point3f tempNormal = lastPointToMove->getNormal();
|
||||
Point3m tempPoint = lastPointToMove->getPoint();
|
||||
Point3m tempNormal = lastPointToMove->getNormal();
|
||||
|
||||
lastPointToMove->setPointAndNormal(lastPointPosition, lastPointNormal);
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class PickedPointTreeWidgetItem : public QTreeWidgetItem
|
||||
public:
|
||||
//used when a point has just been picked and
|
||||
//gives it an integer name
|
||||
PickedPointTreeWidgetItem(vcg::Point3f &intputPoint, CMeshO::FaceType::NormalType &faceNormal,
|
||||
PickedPointTreeWidgetItem(Point3m &intputPoint, CMeshO::FaceType::NormalType &faceNormal,
|
||||
QString name, bool _active);
|
||||
|
||||
//set the name
|
||||
@ -58,13 +58,13 @@ public:
|
||||
QString getName();
|
||||
|
||||
//change the point and normal
|
||||
void setPointAndNormal(vcg::Point3f &intputPoint, CMeshO::FaceType::NormalType &faceNormal);
|
||||
void setPointAndNormal(Point3m &intputPoint, CMeshO::FaceType::NormalType &faceNormal);
|
||||
|
||||
//return the Point3f
|
||||
vcg::Point3f getPoint();
|
||||
//return the Point3m
|
||||
Point3m getPoint();
|
||||
|
||||
//get the normal
|
||||
vcg::Point3f getNormal();
|
||||
Point3m getNormal();
|
||||
|
||||
//clear the ponint datas
|
||||
void clearPoint();
|
||||
@ -81,10 +81,10 @@ public:
|
||||
|
||||
private:
|
||||
//the point
|
||||
vcg::Point3f point;
|
||||
Point3m point;
|
||||
|
||||
//the normal of this point
|
||||
vcg::Point3f normal;
|
||||
Point3m normal;
|
||||
|
||||
//whether this point is active
|
||||
//inactive points are not drawn and when saved this is indicated
|
||||
@ -105,10 +105,10 @@ public:
|
||||
enum Mode { ADD_POINT, MOVE_POINT, SELECT_POINT };
|
||||
|
||||
//do soemthing with the point that was just picked(could be add,moving or select)
|
||||
void addMoveSelectPoint(vcg::Point3f point, CMeshO::FaceType::NormalType faceNormal);
|
||||
void addMoveSelectPoint(Point3m point, CMeshO::FaceType::NormalType faceNormal);
|
||||
|
||||
//we need to move the point closest to this one or select it depending on the mode
|
||||
void selectOrMoveThisPoint(vcg::Point3f point);
|
||||
void selectOrMoveThisPoint(Point3m point);
|
||||
|
||||
//return the vector
|
||||
//useful if you want to draw the points
|
||||
@ -140,10 +140,10 @@ private:
|
||||
|
||||
//add a new point and call it something
|
||||
//bool present tells us if the point has been picked yet
|
||||
void addPoint(vcg::Point3f &point, QString &name, bool present);
|
||||
void addPoint(Point3m &point, QString &name, bool present);
|
||||
|
||||
//handle everything involved with adding a point to the tree widget
|
||||
PickedPointTreeWidgetItem * addTreeWidgetItemForPoint(vcg::Point3f &point, QString &name, CMeshO::FaceType::NormalType &faceNormal, bool present);
|
||||
PickedPointTreeWidgetItem * addTreeWidgetItemForPoint(Point3m &point, QString &name, CMeshO::FaceType::NormalType &faceNormal, bool present);
|
||||
|
||||
//load the points from a file
|
||||
void loadPoints(QString filename);
|
||||
@ -200,8 +200,8 @@ private:
|
||||
|
||||
//variables needed for undo
|
||||
PickedPointTreeWidgetItem *lastPointToMove;
|
||||
vcg::Point3f lastPointPosition;
|
||||
vcg::Point3f lastPointNormal;
|
||||
Point3m lastPointPosition;
|
||||
Point3m lastPointNormal;
|
||||
bool recordPointForUndo;
|
||||
|
||||
QString templateWorkingDirectory;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user