// // File: coordinates.cc // // (C) 2000-2006 Helmut Cantzler // // Licensed under the terms of the Lesser General Public License. // #include #include #include #include "mview.h" #include "coordinates.h" CoordinatesWindow::CoordinatesWindow(MView *parent, Mesh *mesh) : QMainWindow(parent) { CoordinatesWindow::mesh = mesh; QVBox *box = new QVBox(this); box->setMargin(5); box->setSpacing(5); setCentralWidget( box ); textfield = new QMultiLineEdit(box); textfield->setFrameStyle(QFrame::Panel | QFrame::Plain); textfield->setReadOnly(TRUE); QWidget *buttons = new QWidget(box); QHBoxLayout *buttons_layout = new QHBoxLayout(buttons); buttons_layout->setMargin(5); buttons_layout->setSpacing(5); QPushButton* clear = new QPushButton("Clear", buttons); connect(clear, SIGNAL(clicked()), textfield, SLOT(clear())); QPushButton* close = new QPushButton("Close", buttons); connect(close, SIGNAL(clicked()), parent, SLOT(closePick())); close->setFocus(); buttons_layout->addStretch( 10 ); buttons_layout->addWidget( clear ); buttons_layout->addWidget( close ); resize(350, 250); setCaption("Coordinates"); } void CoordinatesWindow::printResult(const Vertex *v, const Edge *e, const Triangle *t) { Vertex org; char line[512]; textfield->moveCursor(QTextEdit::MoveEnd , FALSE); if (v != NULL) { sprintf(line, "\nPoint:\n"); textfield->insert(line); mesh->calc_original_coordinates(v, &org); sprintf(line, " %f %f %f\n", org.x(), org.y(), org.z()); textfield->insert(line); } if (e != NULL) { sprintf(line, "\nEdge:\n"); textfield->insert(line); for (int i=0; i < 2; i++) { mesh->calc_original_coordinates(e->vertices[i], &org); sprintf(line, " %f %f %f\n", org.x(), org.y(), org.z()); textfield->insert(line); } } if (t != NULL) { sprintf(line, "\nTriangle:\n"); textfield->insert(line); for (int i=0; i < 3; i++) { mesh->calc_original_coordinates(t->vertices[i], &org); sprintf(line, " %f %f %f\n", org.x(), org.y(), org.z()); textfield->insert(line); } } }