------------------------------------------------------------------------------
| 1103 | |
| 1104 | //------------------------------------------------------------------------------ |
| 1105 | void vtkCubeAxesActor::BuildAxes(vtkViewport* viewport) |
| 1106 | { |
| 1107 | if ((this->GetMTime() < this->BuildTime.GetMTime()) && !this->StickyAxes) |
| 1108 | { |
| 1109 | this->AutoScale(viewport); |
| 1110 | return; |
| 1111 | } |
| 1112 | |
| 1113 | this->SetNonDependentAttributes(); |
| 1114 | |
| 1115 | // Reset range in case of bounds type changed |
| 1116 | if (this->LastUseOrientedBounds != this->UseOrientedBounds) |
| 1117 | { |
| 1118 | this->XAxisRange[0] = this->XAxisRange[1] = VTK_DOUBLE_MAX; |
| 1119 | this->YAxisRange[0] = this->YAxisRange[1] = VTK_DOUBLE_MAX; |
| 1120 | this->ZAxisRange[0] = this->ZAxisRange[1] = VTK_DOUBLE_MAX; |
| 1121 | this->LastUseOrientedBounds = this->UseOrientedBounds; |
| 1122 | } |
| 1123 | |
| 1124 | // determine the bounds to use (input, prop, or user-defined) |
| 1125 | double bounds[6]; |
| 1126 | if (this->UseOrientedBounds != 0) |
| 1127 | { |
| 1128 | this->GetOrientedBounds(bounds); |
| 1129 | } |
| 1130 | else |
| 1131 | { |
| 1132 | if (this->StickyAxes) |
| 1133 | { |
| 1134 | this->GetViewportLimitedBounds(viewport, bounds); |
| 1135 | } |
| 1136 | else |
| 1137 | { |
| 1138 | this->GetBounds(bounds); |
| 1139 | } |
| 1140 | } |
| 1141 | |
| 1142 | // Setup the axes for plotting |
| 1143 | double xCoords[NUMBER_OF_ALIGNED_AXIS][6]; |
| 1144 | double yCoords[NUMBER_OF_ALIGNED_AXIS][6]; |
| 1145 | double zCoords[NUMBER_OF_ALIGNED_AXIS][6]; |
| 1146 | |
| 1147 | // these arrays are accessed by 'location': mm, mX, XX, or Xm. |
| 1148 | int mm1[4] = { 0, 0, 1, 1 }; |
| 1149 | int mm2[4] = { 0, 1, 1, 0 }; |
| 1150 | |
| 1151 | // Compute axes end-points |
| 1152 | int i; |
| 1153 | for (i = 0; i < NUMBER_OF_ALIGNED_AXIS; i++) |
| 1154 | { |
| 1155 | if (this->UseAxisOrigin == 0) |
| 1156 | { |
| 1157 | xCoords[i][0] = bounds[0] * this->AxisBaseForX[0] + |
| 1158 | bounds[2 + mm1[i]] * this->AxisBaseForY[0] + bounds[4 + mm2[i]] * this->AxisBaseForZ[0]; |
| 1159 | xCoords[i][1] = bounds[0] * this->AxisBaseForX[1] + |
| 1160 | bounds[2 + mm1[i]] * this->AxisBaseForY[1] + bounds[4 + mm2[i]] * this->AxisBaseForZ[1]; |
| 1161 | xCoords[i][2] = bounds[0] * this->AxisBaseForX[2] + |
| 1162 | bounds[2 + mm1[i]] * this->AxisBaseForY[2] + bounds[4 + mm2[i]] * this->AxisBaseForZ[2]; |
no test coverage detected