43 HULL_POINTS_FROM_CSO_LIST
49 const std::map < int, SbVec2f>& labelBoxes,
69 struct LabelBoundingBox
74 bool overlaps(
const LabelBoundingBox& labelBoundingBox)
const
78 const MLdouble bb1v1x = labelBoundingBox.upper[0] - augment;
79 const MLdouble bb1v1y = labelBoundingBox.upper[1] - augment;
80 const MLdouble bb1v2x = labelBoundingBox.upper[0] + augment + labelBoundingBox.width;
81 const MLdouble bb1v2y = labelBoundingBox.upper[1] + augment + labelBoundingBox.height;
83 const MLdouble bb2v1x = upper[0] - augment;
84 const MLdouble bb2v1y = upper[1] - augment;
85 const MLdouble bb2v2x = upper[0] + width + augment;
86 const MLdouble bb2v2y = upper[1] + height + augment;
89 const MLdouble minX = (bb1v1x > bb2v1x) ? bb1v1x : bb2v1x;
90 const MLdouble minY = (bb1v1y > bb2v1y) ? bb1v1y : bb2v1y;
93 const MLdouble maxX = (bb1v2x < bb2v2x) ? bb1v2x : bb2v2x;
94 const MLdouble maxY = (bb1v2y < bb2v2y) ? bb1v2y : bb2v2y;
99 result = result && (minX <= maxX);
100 result = result && (minY <= maxY);
106 void computeDeviceConvexHullOfAllCSOs(
const std::vector<CSODrawCSOInfos>& drawCSOInfos,
107 boost::geometry::model::polygon < Point2D >& convexHull);
108 void computeCSODevicePositions(
const std::vector<CSODrawCSOInfos>& drawCSOInfos,
110 bool seedPointIsInSlicePlane(CSO* cso,
int index,
const CSODrawView2DInfos& view2DInfos)
const;
113 boost::geometry::model::polygon<Point2D>& convexHull)
const;
115 void offsetConvexHull(boost::geometry::model::polygon < Point2D >& convexHull,
const Point2D& centroidOfHull,
float deviceOffset)
const;
116 static float computeMaxDistanceOfConvexHullFromCentroid(
const boost::geometry::model::polygon < Point2D >& convexHull,
const Point2D& centroidOfHull);
117 void computeLabelRays(
size_t numCSOs,
float rayLength,
const Point2D& centroidOfHull, std::vector <Point2D>& labelRayEndPositions)
const;
118 static void computeLabelSlotPositions(
const boost::geometry::model::polygon < Point2D >& convexHull,
const Point2D& centroidOfHull,
119 const std::vector <Point2D>& labelRayEndPositions, std::vector <Point2D>& labelSlotPositions );
121 std::vector < std::pair < int, int> > computeNearestCSOForLabelPositionSlot(
const std::vector <Point2D>& labelSlotPositions,
const std::vector<unsigned int>& csoIds);
122 void computeCSOToSlotDistanceMatrix(
const std::vector <Point2D>& labelSlotPositions,
const std::vector<unsigned int>& csoIds, std::vector < std::vector < float > >& csoSlotDistancesMatrix);
124 static float computeMinDistanceCSOToSlot(
const std::vector<Point2D>& csoDevicePositions,
const Point2D& slotPosition);
125 void setLabelPositionsForCSOs(
const std::vector< std::pair< int, int > >& csoToSlotMapping,
126 const std::vector<unsigned int>& csoIds,
127 const std::map< int, SbVec2f>& labelBoxes,
128 const std::vector<Point2D>& labelSlotPositions,
130 static SbVec2f getLabelBoxForCSO(
const std::map < int, SbVec2f >& labelBoxes,
int csoId);
132 void avoidLabelOverlap(
const std::map < int, SbVec2f >& labelBoxes);
134 void setupLabelBoundingBoxes(
const std::map< int, SbVec2f >& labelBoxes, std::map< int, LabelBoundingBox >& labelBoundingBoxes );
135 static bool boundingBoxHasOverlap(
int csoId,
const LabelBoundingBox& labelBoundingBox,
const std::map< int, LabelBoundingBox >& labelBoundingBoxes );
136 bool moveLabelOutwards(LabelBoundingBox& labelBoundingBox);
138 std::map <unsigned int, Point2D> _labelPositions;
139 std::map <unsigned int, std::vector<Point2D> > _csoDevicePositions;
140 CSOListPtr _hullCSOList;
142 Point2D _centroidOfConvexHull;