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

Method CreateLabels

Rendering/Core/vtkLabeledContourMapper.cxx:787–827  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

785
786//------------------------------------------------------------------------------
787bool vtkLabeledContourMapper::CreateLabels(vtkActor*)
788{
789 typedef std::vector<LabelMetric> MetricVector;
790 typedef std::vector<LabelInfo> InfoVector;
791
792 std::vector<InfoVector>::const_iterator outerLabels = this->Internal->LabelInfos.begin();
793 std::vector<InfoVector>::const_iterator outerLabelsEnd = this->Internal->LabelInfos.end();
794
795 // count the number of labels:
796 vtkIdType numLabels = 0;
797 while (outerLabels != outerLabelsEnd)
798 {
799 numLabels += static_cast<vtkIdType>((outerLabels++)->size());
800 }
801
802 if (!this->AllocateTextActors(numLabels))
803 {
804 vtkErrorMacro(<< "Error while allocating text actors.");
805 return false;
806 }
807
808 outerLabels = this->Internal->LabelInfos.begin();
809 MetricVector::const_iterator metrics = this->Internal->LabelMetrics.begin();
810 MetricVector::const_iterator metricsEnd = this->Internal->LabelMetrics.end();
811 vtkTextActor3D** actor = this->TextActors;
812 vtkTextActor3D** actorEnd = this->TextActors + this->NumberOfUsedTextActors;
813
814 while (metrics != metricsEnd && outerLabels != outerLabelsEnd && actor != actorEnd)
815 {
816 for (InfoVector::const_iterator label = outerLabels->begin(), labelEnd = outerLabels->end();
817 label != labelEnd; ++label)
818 {
819 this->Internal->BuildLabel(*actor, *metrics, *label);
820 ++actor;
821 }
822 ++metrics;
823 ++outerLabels;
824 }
825
826 return true;
827}
828
829//------------------------------------------------------------------------------
830bool vtkLabeledContourMapper::ApplyStencil(vtkRenderer*, vtkActor*)

Callers 1

RenderMethod · 0.95

Calls 5

AllocateTextActorsMethod · 0.95
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
BuildLabelMethod · 0.45

Tested by

no test coverage detected