- else if(mode==ROTATE)
- {
- float a = atan2(gpointer.y-center.y, gpointer.x-center.x);
- angle += a-rot_origin;
- rot_origin = a;
-
- wrap_rot = angle;
- for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
- {
- float c = cos(angle);
- float s = sin(angle);
- i->track->set_position(Point(center.x+c*i->pos.x-s*i->pos.y, center.y+s*i->pos.x+c*i->pos.y, center.z*i->pos.z));
- i->track->set_rotation(angle+i->rot);
- }
- }
- else if(mode==ELEVATE)
- {
- float dz = (y-elev_origin)/1000.;
-
- signal_status.emit(format("Elevation: %+.0fmm (%.0fmm)", dz*1000, (center.z+dz)*1000));
-
- wrap_pos.z = center.z+dz;
- for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
- i->track->set_position(Point(center.x+i->pos.x, center.y+i->pos.y, center.z+i->pos.z+dz));
-
- for(set<Track *>::iterator i=neighbors.begin(); i!=neighbors.end(); ++i)
- (*i)->check_slope();
- }
-}
-
-void Manipulator::render()
-{
- glPushMatrix();
- glTranslatef(wrap_pos.x, wrap_pos.y, wrap_pos.z);
- glRotatef(wrap_rot*180/M_PI, 0, 0, 1);
-
- glLineWidth(2);
- glColor4f(0, 1, 0, 0.5);
- for(list<TrackWrap>::iterator i=wrap.begin(); i!=wrap.end(); ++i)
- {
- glPushMatrix();
- glTranslatef(i->pos.x, i->pos.y, i->pos.z);
- glRotatef(i->rot*180/M_PI, 0, 0, 1);
-
- glBegin(GL_LINE_LOOP);
- glVertex2f(-i->width/2, -i->height/2);
- glVertex2f(i->width/2, -i->height/2);
- glVertex2f(i->width/2, i->height/2);
- glVertex2f(-i->width/2, i->height/2);
- glEnd();
-
- glPopMatrix();
- }
-
- glPopMatrix();