for (ChartEntity ce : entities.getEntities()) {
if (ce instanceof DataItemEntity) {
DataItemEntity e = (DataItemEntity) ce;
boolean match;
if (e.getArea() instanceof Rectangle2D) {
Rectangle2D entityRect = (Rectangle2D) e.getArea();
// use fast rectangle to rectangle test
if (this.intersectionMode) {
match = selection.intersects(entityRect);
} else {
match = selection.contains(entityRect);
}
} else {
// general shape test
Area selectionShape = new Area(selection);
Area entityShape = new Area(e.getArea());
// fast test if completely inside the solution must be true
if (selectionShape.contains(entityShape.getBounds())) {
match = true;
} else {