- Timestamp:
- Dec 31, 2009, 2:27:59 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncfigureppp.cpp
r2152 r2153 63 63 void bncFigurePPP::slotNewPosition(bncTime time, double x, double y, double z){ 64 64 65 const static int MAXNUMPOS = 1000;65 const static int MAXNUMPOS = 300; 66 66 67 67 QMutexLocker locker(&_mutex); … … 106 106 double zz[_pos.size()]; 107 107 108 double xyzMin = 0.0;109 108 double xyzMax = 0.0; 110 109 for (int ii = 0; ii < _pos.size(); ++ii) { … … 112 111 yy[ii] = _pos[ii]->xyz[1] - _pos[0]->xyz[1]; 113 112 zz[ii] = _pos[ii]->xyz[2] - _pos[0]->xyz[2]; 114 if ( xx[ii] < xyzMin) {115 xyzM in = xx[ii];113 if (fabs(xx[ii]) > xyzMax) { 114 xyzMax = fabs(xx[ii]); 116 115 } 117 if ( xx[ii]> xyzMax) {118 xyzMax = xx[ii];116 if (fabs(yy[ii]) > xyzMax) { 117 xyzMax = fabs(yy[ii]); 119 118 } 120 if (yy[ii] < xyzMin) { 121 xyzMin = yy[ii]; 122 } 123 if (yy[ii] > xyzMax) { 124 xyzMax = yy[ii]; 125 } 126 if (zz[ii] < xyzMin) { 127 xyzMin = zz[ii]; 128 } 129 if (zz[ii] > xyzMax) { 130 xyzMax = zz[ii]; 119 if (fabs(zz[ii]) > xyzMax) { 120 xyzMax = fabs(zz[ii]); 131 121 } 132 122 } 133 double xyzRange = xyzMax - xyzMin;123 double xyzRange = 2.0 * xyzMax; 134 124 135 125 if (xyzRange > 0.0 && tRange > 0.0) { … … 137 127 const static double scale0 = 0.8; 138 128 double tOffset = tRange / 10.0; 139 double xOffset = xyzRange / 10.0; 140 129 double xyzOffset = tRange / 10.0; 141 130 double tScale = scale0 * frameSize().width() / tRange; 142 131 double xScale = scale0 * frameSize().height() / xyzRange; … … 144 133 QTransform transform; 145 134 transform.scale(tScale, xScale); 146 transform.translate(-tMin+tOffset, -xyzMin+xOffset);135 transform.translate(-tMin+tOffset, xyzMax/2.0 + xyzOffset); 147 136 painter.setTransform(transform); 148 137 149 138 // x-axis 150 139 // ------ 151 painter.drawLine(QPointF(tMin, xyzMax), QPointF(tMax,xyzMax));140 painter.drawLine(QPointF(tMin, 0.0), QPointF(tMax, 0.0)); 152 141 153 142 // y-axis 154 143 // ------ 155 painter.drawLine(QPointF(tMin, xyzMin), QPointF(tMin, xyzMax));144 painter.drawLine(QPointF(tMin, -xyzMax), QPointF(tMin, xyzMax)); 156 145 157 146 for (int ii = 1; ii < _pos.size(); ++ii) {
Note:
See TracChangeset
for help on using the changeset viewer.