public class GeographicTextRenderer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
GeographicTextRenderer.OrderedText |
Constructor and Description |
---|
GeographicTextRenderer() |
Modifier and Type | Method and Description |
---|---|
protected java.awt.Color |
applyOpacity(java.awt.Color color,
double opacity) |
protected void |
beginRendering(DrawContext dc) |
protected double[] |
computeDistanceScaleAndOpacity(DrawContext dc,
GeographicTextRenderer.OrderedText ot) |
protected java.awt.geom.Point2D.Float |
computeDrawPoint(DrawContext dc,
java.awt.geom.Rectangle2D rect,
Vec4 screenPoint)
Computes the final draw point for the given rectangle lower left corner and target screen point.
|
protected java.awt.geom.Rectangle2D |
computeExpandedBounds(java.awt.geom.Rectangle2D bounds,
int margin) |
protected double |
computeLookAtDistance(DrawContext dc) |
protected java.awt.geom.Rectangle2D |
computeScaledBounds(java.awt.geom.Rectangle2D bounds,
double scale) |
protected java.awt.geom.Rectangle2D |
computeTextBounds(DrawContext dc,
GeographicTextRenderer.OrderedText uText,
double scale) |
protected Vec4 |
drawText(DrawContext dc,
GeographicTextRenderer.OrderedText uText,
double scale,
double opacity) |
protected void |
endRendering(DrawContext dc) |
int |
getCullTextMargin()
Get the empty margin that surrounds a text item when considering it's bounding rectangle during text culling -
see
setCullTextEnabled(boolean) . |
double |
getDistanceMaxScale()
Get the maximum scale that can be applied to a text item when it gets closer to the eye than the view lookat
point - screen center.
|
double |
getDistanceMinOpacity()
Get the minimum opacity that can be applied to a text item when it gets farther away from the eye than the view
lookat point - screen center.
|
double |
getDistanceMinScale()
Get the minimum scale that can be applied to a text item when it gets farther away from the eye than the view
lookat point - screen center.
|
java.lang.String |
getEffect()
Get the effect used to decorate the text.
|
boolean |
isCullTextEnabled()
Determines whether overlapping text are culled.
|
protected static boolean |
isTextValid(GeographicText text,
boolean checkPosition) |
void |
render(DrawContext dc,
GeographicText text,
Vec4 textPoint) |
void |
render(DrawContext dc,
java.lang.Iterable<GeographicText> text) |
void |
setCullTextEnabled(boolean cullText)
Set whether overlapping text should be culled.
|
void |
setCullTextMargin(int margin)
Set the empty margin that surrounds a text item when considering it's bounding rectangle during text culling -
see
setCullTextEnabled(boolean) . |
protected void |
setDepthFunc(DrawContext dc,
GeographicTextRenderer.OrderedText uText,
Vec4 screenPoint) |
void |
setDistanceMaxScale(double scale)
Set the maximum scale that can be applied to a text item when it gets closer to the eye than the view lookat
point - screen center.
|
void |
setDistanceMinOpacity(double opacity)
Set the minimum opacity that can be applied to a text item when it gets farther away from the eye than the view
lookat point - screen center.
|
void |
setDistanceMinScale(double scale)
Set the minimum scale that can be applied to a text item when it gets farther away from the eye than the view
lookat point - screen center.
|
void |
setEffect(java.lang.String effect)
Set the effect used to decorate the text.
|
protected java.awt.Color applyOpacity(java.awt.Color color, double opacity)
protected void beginRendering(DrawContext dc)
protected double[] computeDistanceScaleAndOpacity(DrawContext dc, GeographicTextRenderer.OrderedText ot)
protected java.awt.geom.Point2D.Float computeDrawPoint(DrawContext dc, java.awt.geom.Rectangle2D rect, Vec4 screenPoint)
null
the text will not be drawn.dc
- the current DrawContext
rect
- the text rectangle to draw.screenPoint
- the projected screen point the text relates to.null
.protected java.awt.geom.Rectangle2D computeExpandedBounds(java.awt.geom.Rectangle2D bounds, int margin)
protected double computeLookAtDistance(DrawContext dc)
protected java.awt.geom.Rectangle2D computeScaledBounds(java.awt.geom.Rectangle2D bounds, double scale)
protected java.awt.geom.Rectangle2D computeTextBounds(DrawContext dc, GeographicTextRenderer.OrderedText uText, double scale) throws java.lang.Exception
java.lang.Exception
protected Vec4 drawText(DrawContext dc, GeographicTextRenderer.OrderedText uText, double scale, double opacity) throws java.lang.Exception
java.lang.Exception
protected void endRendering(DrawContext dc)
public int getCullTextMargin()
setCullTextEnabled(boolean)
. The smaller the margin, the closer text items can get before being
considered as overlapping.public double getDistanceMaxScale()
public double getDistanceMinOpacity()
public double getDistanceMinScale()
public java.lang.String getEffect()
AVKey.TEXT_EFFECT_SHADOW
(default), AVKey.TEXT_EFFECT_OUTLINE
or AVKey.TEXT_EFFECT_NONE
.public boolean isCullTextEnabled()
true
text items are sorted front to back
according to their respective priority rather then back to front, and will be drawn only if they do not overlap
an already drawn text. If false
all text will be drawn back to front whether they overlap or not.true
if overlapping text are culled.protected static boolean isTextValid(GeographicText text, boolean checkPosition)
public void render(DrawContext dc, GeographicText text, Vec4 textPoint)
public void render(DrawContext dc, java.lang.Iterable<GeographicText> text)
public void setCullTextEnabled(boolean cullText)
true
text items will be sorted front to back
according to their respective priority rather then back to front, and will be drawn only if they do not overlap
an already drawn text. If false
all text will be drawn back to front whether they overlap or not.cullText
- true
if overlapping text should be culled.public void setCullTextMargin(int margin)
setCullTextEnabled(boolean)
. The smaller the margin, the closer text items can get before being
considered as overlapping.margin
- the empty margin that surrounds a text item - in pixels.protected void setDepthFunc(DrawContext dc, GeographicTextRenderer.OrderedText uText, Vec4 screenPoint)
public void setDistanceMaxScale(double scale)
scale
- the maximum scale that can be applied to a text item when it closer to the eye.public void setDistanceMinOpacity(double opacity)
opacity
- the minimum opacity that can be applied to a text item when it gets away from the eye.public void setDistanceMinScale(double scale)
scale
- the minimum scale that can be applied to a text item when it gets away from the eye.public void setEffect(java.lang.String effect)
AVKey.TEXT_EFFECT_SHADOW
(default), AVKey.TEXT_EFFECT_OUTLINE
or AVKey.TEXT_EFFECT_NONE
.effect
- the effect to use for text rendering.