Changeset 2152 in ntrip
- Timestamp:
- Dec 31, 2009, 2:13:45 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncfigureppp.cpp
r2151 r2152 100 100 double tMax = tMin + tRange; 101 101 102 double xMin = _pos[0]->xyz[0]; 103 double xMax = _pos[0]->xyz[0]; 104 for (int ii = 1; ii < _pos.size(); ++ii) { 105 if (_pos[ii]->xyz[0] < xMin) { 106 xMin = _pos[ii]->xyz[0]; 102 // Reduced Coordinates 103 // ------------------- 104 double xx[_pos.size()]; 105 double yy[_pos.size()]; 106 double zz[_pos.size()]; 107 108 double xyzMin = 0.0; 109 double xyzMax = 0.0; 110 for (int ii = 0; ii < _pos.size(); ++ii) { 111 xx[ii] = _pos[ii]->xyz[0] - _pos[0]->xyz[0]; 112 yy[ii] = _pos[ii]->xyz[1] - _pos[0]->xyz[1]; 113 zz[ii] = _pos[ii]->xyz[2] - _pos[0]->xyz[2]; 114 if (xx[ii] < xyzMin) { 115 xyzMin = xx[ii]; 107 116 } 108 if (_pos[ii]->xyz[0] > xMax) { 109 xMax = _pos[ii]->xyz[0]; 117 if (xx[ii] > xyzMax) { 118 xyzMax = xx[ii]; 119 } 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]; 110 131 } 111 132 } 112 double x Range = xMax - xMin;133 double xyzRange = xyzMax - xyzMin; 113 134 114 if (x Range > 0.0 && tRange > 0.0) {135 if (xyzRange > 0.0 && tRange > 0.0) { 115 136 116 137 const static double scale0 = 0.8; 117 138 double tOffset = tRange / 10.0; 118 double xOffset = x Range / 10.0;139 double xOffset = xyzRange / 10.0; 119 140 120 141 double tScale = scale0 * frameSize().width() / tRange; 121 double xScale = scale0 * frameSize().height() / x Range;142 double xScale = scale0 * frameSize().height() / xyzRange; 122 143 123 144 QTransform transform; 124 145 transform.scale(tScale, xScale); 125 transform.translate(-tMin+tOffset, -x Min+xOffset);146 transform.translate(-tMin+tOffset, -xyzMin+xOffset); 126 147 painter.setTransform(transform); 127 148 128 149 // x-axis 129 150 // ------ 130 painter.drawLine(QPointF(tMin, x Max), QPointF(tMax, xMax));151 painter.drawLine(QPointF(tMin, xyzMax), QPointF(tMax, xyzMax)); 131 152 132 153 // y-axis 133 154 // ------ 134 painter.drawLine(QPointF(tMin, x Min), QPointF(tMin, xMax));155 painter.drawLine(QPointF(tMin, xyzMin), QPointF(tMin, xyzMax)); 135 156 136 painter.setPen(QColor(Qt::red));137 157 for (int ii = 1; ii < _pos.size(); ++ii) { 138 158 double t1 = _pos[ii-1]->time.gpssec(); 139 159 double t2 = _pos[ii]->time.gpssec(); 140 double x1 = _pos[ii-1]->xyz[0]; 141 double x2 = _pos[ii]->xyz[0]; 142 143 painter.drawLine(QPointF(t1, x1), QPointF(t2, x2)); 160 painter.setPen(QColor(Qt::red)); 161 painter.drawLine(QPointF(t1, xx[ii-1]), QPointF(t2, xx[ii])); 162 painter.setPen(QColor(Qt::green)); 163 painter.drawLine(QPointF(t1, yy[ii-1]), QPointF(t2, yy[ii])); 164 painter.setPen(QColor(Qt::blue)); 165 painter.drawLine(QPointF(t1, zz[ii-1]), QPointF(t2, zz[ii])); 144 166 } 145 167 }
Note:
See TracChangeset
for help on using the changeset viewer.