Package gov.nasa.worldwind.util
Class PlacemarkClutterFilter
- java.lang.Object
-
- gov.nasa.worldwind.util.PlacemarkClutterFilter
-
- All Implemented Interfaces:
ClutterFilter
public class PlacemarkClutterFilter extends java.lang.Object implements ClutterFilter
Provides a clutter filter that rearrangesPointPlacemark
labels to avoid overlap. When placemarks overlap, only their label and a line to their position are drawn. The placemark's icon is not drawn for overlapping placemarks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
PlacemarkClutterFilter.DeclutteredLabel
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.awt.geom.Rectangle2D>
rectList
Holds the rectangles of the regions already drawn.protected java.util.Map<java.awt.geom.Rectangle2D,java.util.List<Declutterable>>
shapeMap
Maintains a list of regions and the shapes associated with each region.
-
Constructor Summary
Constructors Constructor Description PlacemarkClutterFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addShape(java.awt.geom.Rectangle2D rectangle, Declutterable shape)
Adds a shape to the internal shape map.void
apply(DrawContext dc, java.util.List<Declutterable> shapes)
Applies the filter for a specified list ofDeclutterable
shapes.protected void
clear()
Release all the resources used in the most recent filter application.protected java.awt.geom.Rectangle2D
intersects(java.awt.geom.Rectangle2D rectangle)
Indicates whether a specified region intersects a region in the filter.protected void
render(DrawContext dc)
Draws the decluttered shape representation.
-
-
-
Field Detail
-
rectList
protected java.util.List<java.awt.geom.Rectangle2D> rectList
Holds the rectangles of the regions already drawn.
-
shapeMap
protected java.util.Map<java.awt.geom.Rectangle2D,java.util.List<Declutterable>> shapeMap
Maintains a list of regions and the shapes associated with each region.
-
-
Method Detail
-
apply
public void apply(DrawContext dc, java.util.List<Declutterable> shapes)
Description copied from interface:ClutterFilter
Applies the filter for a specified list ofDeclutterable
shapes.- Specified by:
apply
in interfaceClutterFilter
- Parameters:
dc
- the current draw context.shapes
- the shapes to declutter.
-
clear
protected void clear()
Release all the resources used in the most recent filter application.
-
intersects
protected java.awt.geom.Rectangle2D intersects(java.awt.geom.Rectangle2D rectangle)
Indicates whether a specified region intersects a region in the filter.- Parameters:
rectangle
- the region to test.- Returns:
- the intersected region if the input region intersects one or more other regions in the filter, otherwise false.
-
addShape
protected void addShape(java.awt.geom.Rectangle2D rectangle, Declutterable shape)
Adds a shape to the internal shape map.- Parameters:
rectangle
- the rectangle to associate the shape with.shape
- the shape to associate with the specified rectangle.
-
render
protected void render(DrawContext dc)
Draws the decluttered shape representation. For shapes that are notPointPlacemark
s, the first non- placemark shape is drawn in addition to the placemark representation. This causes this filter to produce the same results for non-placemark shapes as doesBasicClutterFilter
.- Parameters:
dc
- the current draw context.
-
-