MCPcopy Create free account
hub / github.com/Kitware/VTK / ComputeDORange

Method ComputeDORange

Rendering/Annotation/vtkXYPlotActor.cxx:1606–1762  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1604
1605//------------------------------------------------------------------------------
1606void vtkXYPlotActor::ComputeDORange(double xrange[2], double yrange[2], double* lengths)
1607{
1608 int i;
1609 vtkDataObject* dobj;
1610 vtkFieldData* field;
1611 int doNum, numColumns;
1612 vtkIdType numTuples, numRows, num, ptId, maxNum;
1613 double maxLength = 0.;
1614 double x = 0.;
1615 double y = 0.;
1616 double xPrev = 0.;
1617 vtkDataArray* array;
1618
1619 // NOTE: FieldData can have non-numeric arrays. However, XY plot can only
1620 // work on numeric arrays ( or vtkDataArray subclasses ).
1621
1622 xrange[0] = yrange[0] = VTK_DOUBLE_MAX;
1623 xrange[1] = yrange[1] = -VTK_DOUBLE_MAX;
1624 maxNum = 0;
1625 int numDOs = this->DataObjectInputConnectionHolder->GetNumberOfInputConnections(0);
1626 for (doNum = 0; doNum < numDOs; doNum++)
1627 {
1628 vtkAlgorithmOutput* port = this->DataObjectInputConnectionHolder->GetInputConnection(0, doNum);
1629 vtkAlgorithm* alg = port->GetProducer();
1630 int portIdx = port->GetIndex();
1631 dobj = alg->GetOutputDataObject(portIdx);
1632
1633 lengths[doNum] = 0.;
1634 field = dobj->GetFieldData();
1635 numColumns = field->GetNumberOfComponents(); // number of "columns"
1636 // numColumns includes the components for non-numeric arrays as well.
1637 for (numRows = VTK_ID_MAX, i = 0; i < field->GetNumberOfArrays(); i++)
1638 {
1639 array = field->GetArray(i);
1640 if (!array)
1641 {
1642 // non-numeric array, skip.
1643 continue;
1644 }
1645 numTuples = array->GetNumberOfTuples();
1646 numRows = std::min(numTuples, numRows);
1647 }
1648
1649 num = (this->DataObjectPlotMode == VTK_XYPLOT_ROW ? numColumns : numRows);
1650
1651 if (this->XValues != VTK_XYPLOT_INDEX)
1652 {
1653 // gather the information to form a plot
1654 for (ptId = 0; ptId < num; ptId++)
1655 {
1656 int status = 0;
1657
1658 if (this->DataObjectPlotMode == VTK_XYPLOT_ROW)
1659 {
1660 // x = field->GetComponent( this->XComponent->GetValue( doNum ), ptId );
1661 status = ::vtkXYPlotActorGetComponent(field, this->XComponent->GetValue(doNum), ptId, &x);
1662 }
1663 else // if ( this->DataObjectPlotMode == VTK_XYPLOT_COLUMN )

Callers 1

RenderOpaqueGeometryMethod · 0.95

Calls 15

GetProducerMethod · 0.80
minFunction · 0.50
maxFunction · 0.50
log10Function · 0.50
GetInputConnectionMethod · 0.45
GetIndexMethod · 0.45
GetOutputDataObjectMethod · 0.45
GetFieldDataMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetNumberOfArraysMethod · 0.45

Tested by

no test coverage detected