com.esri.aims.mtier.model.map.layer.renderer
Class SimpleLabelRenderer

java.lang.Object
  extended by com.esri.aims.mtier.model.map.layer.renderer.Renderer
      extended by com.esri.aims.mtier.model.map.layer.renderer.SimpleLabelRenderer
All Implemented Interfaces:
Serializable

public class SimpleLabelRenderer
extends Renderer

This class contains symbols that represents map labeling. The SimpleLabelRenderer object extends the Renderer object.

See Also:
Serialized Form

Field Summary
static String HIGH_WEIGHT
          Defines that the feature has high importance and cannot be labeled over.
static String MED_WEIGHT
          Defines that the feature has medium importance.
static String NO_WEIGHT
          Defines that the feature has no importance and can be labeled over.
static String ONE_LABEL_PER_NAME
          Labels once per feature name.
static String ONE_LABEL_PER_PART
          Labels all parts of a feature in the case of multipart features.
static String ONE_LABEL_PER_SHAPE
          Labels once per feature even if there are multiple segments.
static String PLACE_ABOVE
          Determines the label be placed above the line.
static String PLACE_ABOVE_BELOW
          Determines the label be placed above or below the line.
static String PLACE_BELOW
          Determines the label be placed below the line.
static String PLACE_IN_LINE
          Determines the label be placed anywhere on the line.
static String PLACE_LEFT
          Determines the label be placed to the left of the line.
static String PLACE_LEFT_RIGHT
          Determines the label be placed to the right or left of the line.
static String PLACE_ON_TOP
          Determines the label be placed on top of the line.
static String PLACE_ON_TOP_HORIZONTAL
          Determines the label be placed on top of the line but always horizontal.
static String PLACE_PARALLEL
          Determines the label be placed parallel to the line.
static String PLACE_RIGHT
          Determines the label be placed to the right of the line.
 
Constructor Summary
SimpleLabelRenderer()
          Constructs an instance of a SimpleLabelRenderer object.
 
Method Summary
 String getFeatureWeight()
          Returns the feature weight set for this SimpleLabelRenderer object.
 String getField()
          Returns the field property associated with this SimpleLabelRenderer.
 String getHowManyLabels()
          Returns the value of HowManylabels property set for this SimpleLabelRenderer.
 double getLabelBufferRatio()
          Returns the label buffer ratio set for this SimpleLabelRenderer.
 String getLabelPriorities()
          Returns the label priorities set for this SimpleLabelRenderer.
 String getLabelWeight()
          Returns the label priority associated with this SimpleLabelRenderer.
 String getLineLabelPosition()
          Returns the line label position set for this SimpleLabelRenderer.
 String getRotationalAngles()
          Returns the rotational angle property.
 Symbol getSymbol()
          Returns the Symbol associated with this SimpleLabelRenderer.
 String getType()
          Returns the type of Renderer, "SimpleLabel".
 void setFeatureWeight(String fWeight)
          Used to prioritize the importance of features.
 void setField(String field)
          Sets the given field property for this SimpleLabelRenderer.
 void setHowManyLabels(String hmLabels)
          When set, this property determines how often a feature is labeled.
 void setLabelBufferRatio(double value)
          Sets the label buffer ratio for this SimpleLabelRenderer.
 void setLabelPriorities(String labelPriorities)
          Sets the label priorities for this SimpleLabelRenderer.
 void setLabelWeight(String lWeight)
          Used to prioritize the importance of labels.
 void setLineLabelPosition(String llPosition)
          When set, this property determines where on the line to place the label.
 void setRotationalAngles(String angle)
          Sets the given value as rotational angle.
 void setSymbol(Object symbol)
          Sets the given Symbol object with this SimpleLabelRenderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_WEIGHT

public static final String NO_WEIGHT
Defines that the feature has no importance and can be labeled over.

See Also:
Constant Field Values

MED_WEIGHT

public static final String MED_WEIGHT
Defines that the feature has medium importance.

See Also:
Constant Field Values

HIGH_WEIGHT

public static final String HIGH_WEIGHT
Defines that the feature has high importance and cannot be labeled over.

See Also:
Constant Field Values

ONE_LABEL_PER_NAME

public static final String ONE_LABEL_PER_NAME
Labels once per feature name. When several features share the same name, only one label is shown. For example, if there is more than one polygon with the name "Residential", only one "Residential" polygon is labeled.

See Also:
Constant Field Values

ONE_LABEL_PER_SHAPE

public static final String ONE_LABEL_PER_SHAPE
Labels once per feature even if there are multiple segments. For example, the group of islands that make up Hawaii are only labeled once. If there are other features with the same name, they are also labeled.

See Also:
Constant Field Values

ONE_LABEL_PER_PART

public static final String ONE_LABEL_PER_PART
Labels all parts of a feature in the case of multipart features. For instance, the State of Hawaii consists of several islands, but they are grouped together as one polygon feature. Each island is labeled.

See Also:
Constant Field Values

PLACE_ABOVE

public static final String PLACE_ABOVE
Determines the label be placed above the line.

See Also:
Constant Field Values

PLACE_BELOW

public static final String PLACE_BELOW
Determines the label be placed below the line.

See Also:
Constant Field Values

PLACE_ON_TOP

public static final String PLACE_ON_TOP
Determines the label be placed on top of the line.

See Also:
Constant Field Values

PLACE_LEFT

public static final String PLACE_LEFT
Determines the label be placed to the left of the line.

See Also:
Constant Field Values

PLACE_RIGHT

public static final String PLACE_RIGHT
Determines the label be placed to the right of the line.

See Also:
Constant Field Values

PLACE_ABOVE_BELOW

public static final String PLACE_ABOVE_BELOW
Determines the label be placed above or below the line.

See Also:
Constant Field Values

PLACE_LEFT_RIGHT

public static final String PLACE_LEFT_RIGHT
Determines the label be placed to the right or left of the line.

See Also:
Constant Field Values

PLACE_IN_LINE

public static final String PLACE_IN_LINE
Determines the label be placed anywhere on the line.

See Also:
Constant Field Values

PLACE_PARALLEL

public static final String PLACE_PARALLEL
Determines the label be placed parallel to the line.

See Also:
Constant Field Values

PLACE_ON_TOP_HORIZONTAL

public static final String PLACE_ON_TOP_HORIZONTAL
Determines the label be placed on top of the line but always horizontal.

See Also:
Constant Field Values
Constructor Detail

SimpleLabelRenderer

public SimpleLabelRenderer()
Constructs an instance of a SimpleLabelRenderer object. Example:
SimpleLabelRenderer simpleLabel = new SimpleLabelRenderer();

Method Detail

getType

public String getType()
Returns the type of Renderer, "SimpleLabel".

Specified by:
getType in class Renderer
Returns:
String

setSymbol

public void setSymbol(Object symbol)
Sets the given Symbol object with this SimpleLabelRenderer. Example:
 TextSymbol text = new TextSymbol();
 text.setFont("tahoma");
 simpleLabel.setSymbol(text);
 

Parameters:
symbol - the Symbol object.
See Also:
getSymbol()

setField

public void setField(String field)
Sets the given field property for this SimpleLabelRenderer. Example:
 text.setField("Lakes");
 

Parameters:
field - Field containing text for labeling features. The field can be in the layer table or in the joined table.
See Also:
getField()

getField

public String getField()
Returns the field property associated with this SimpleLabelRenderer. Example:
 String field = text.getField();
 

Returns:
the field property containing text for labeling features. The field can be in the layer table or in the joined table.
See Also:
setField(java.lang.String)

setFeatureWeight

public void setFeatureWeight(String fWeight)
Used to prioritize the importance of features. The feature weight determines how important the feature labeled is for the label placement algorithm. For example, if NO_WEIGHT is specified, then the feature has no importance and can be labeled over. If HIGH_WEIGHT is specified, then the label has high importance and cannot be labelled over.

Note that giving importance to features increases the complexity of the labeling problem and also the processing time. Example:

 simpleLabel.setFeatureWeight("NO_WEIGHT");
 

Parameters:
fWeight - the feature weight - NO_WEIGHT, MED_WEIGHT, or HIGH_WEIGHT.
See Also:
getFeatureWeight()

getFeatureWeight

public String getFeatureWeight()
Returns the feature weight set for this SimpleLabelRenderer object. Example:
 String fWeight = simpleLabel.getFeatureWeight();
 

Returns:
String
See Also:
setFeatureWeight(java.lang.String)

setLabelWeight

public void setLabelWeight(String lWeight)
Used to prioritize the importance of labels. The label weight is usually set to high_weight. Example:
simpleLabel.setLabelWeight("med_weight");

Parameters:
lWeight - the label weight value.
See Also:
getLabelWeight()

getLabelWeight

public String getLabelWeight()
Returns the label priority associated with this SimpleLabelRenderer. Example:
String labelWeight = simpleLabel.getLabelWeight();

Returns:
the label priority as string
See Also:
setLabelWeight(java.lang.String)

setLabelBufferRatio

public void setLabelBufferRatio(double value)
Sets the label buffer ratio for this SimpleLabelRenderer. This property sets the buffer around the label. when this is set, no labels overlap within the buffer range.

Parameters:
value - the label buffer ratio value. The ratio is a fraction of the height or width of the rectangle (whichever is smaller) compared to the width of the buffer. For example, a ratio of 0.0 means no buffer, and a ratio of 1.0 means the buffer is twice the size of the label (the label width equals the buffer width). A negative ratio causes the buffer to be smaller than the label. This can be used to allow labels to overlap. Example:
 simpleLabel.setLabelBufferRatio(25.0); 
See Also:
getLabelBufferRatio()

getLabelBufferRatio

public double getLabelBufferRatio()
Returns the label buffer ratio set for this SimpleLabelRenderer. Example:
 double labelBufferRatio = simpleLabel.getLabelBufferRatio();
 

Returns:
the label buffer ratio
See Also:
setLabelBufferRatio(double)

setLabelPriorities

public void setLabelPriorities(String labelPriorities)
Sets the label priorities for this SimpleLabelRenderer. When set, this property determines where to place the label around the point. The attribute accepts different weights for each of eight positions around the point. Each position corresponds to the positions as shown below:

    1  2  3
    8  X  4
    7  6  5  
In each position, the user can prioritize the importance of that position from 0 upwards. 0 signifies that the label should not be placed in that position. 1 means that this is an acceptable position for the label, and all higher numbers represent lesser priorities for that position. For example, "1,0,1,0,0,0,0,0" means that only the first and third label positions will be taken into account when labeling. In another example, "1,2,3,0,1,0,0,0" means try to label at the first and fifth position; if not, then put the label at the second position; if not, then put it at the third position; if this is not possible, then don't label it.
Another option is to place a label on top of points rather than around points. To do this, use the property "PlaceOnTopHorizontal" for the label priority. Example:
simpleLabel.setLabelPriorities("0,0,0,0,0,0,0,0");

Parameters:
labelPriorities - the label priorities value.
See Also:
getLabelPriorities()

getLabelPriorities

public String getLabelPriorities()
Returns the label priorities set for this SimpleLabelRenderer. Example:
String labelPriorities = simpleLabel.getLabelPriorities();

Returns:
the label priority value.
See Also:
setLabelPriorities(java.lang.String)

setRotationalAngles

public void setRotationalAngles(String angle)
Sets the given value as rotational angle. Rotational angles are possible angles that the label can be placed at, relative to the labeled point. By default, labels are always placed horizontally.
Label priorities always take precedence over rotational angles. If you find that your labels are not rotating as expected, remove the labelpriorities attribute if present. Alternatively, you can set all the labelpriorities to "0". Example:
simpleLabel.setRotationalAngles(45,30);

Parameters:
angle - the angle value.
See Also:
getRotationalAngles()

getRotationalAngles

public String getRotationalAngles()
Returns the rotational angle property. Example:
String rotationalAngles = simpleLabel.getRotationalAngles();

Returns:
String
See Also:
setRotationalAngles(java.lang.String)

setHowManyLabels

public void setHowManyLabels(String hmLabels)
When set, this property determines how often a feature is labeled. Example:
simpleLabel.setHowManyLabels(simpleLabel.ONE_LABEL_PER_NAME);

Parameters:
hmLabels - defines the property as ONE_LABEL_PER_NAME/ONE_LABEL_PER_PART /ONE_LABEL_PER_SHAPE
See Also:
getHowManyLabels()

getHowManyLabels

public String getHowManyLabels()
Returns the value of HowManylabels property set for this SimpleLabelRenderer. Example:
String howmanylabels = simpleLabel.getHowManyLabels();

Returns:
the property value.
See Also:
setHowManyLabels(java.lang.String)

setLineLabelPosition

public void setLineLabelPosition(String llPosition)
When set, this property determines where on the line to place the label. You can choose from the following options:
  • PLACE_ABOVE - Place above the line.
  • PLACE_BELOW - Place below the line.
  • PLACE_ON_TOP - Place on the line.
  • PLACE_LEFT - Place at the left side of the line.
  • PLACE_RIGHT - Place at the right side of the line.
  • PLACE_ABOVE_BELOW - Place above or below the line.
  • PLACE_LEFT_RIGHT - Place at either side of the line.
  • PLACE_IN_LINE - Place anywhere on the line.
  • PLACE_PARALLEL - Place parallel to the line.
  • PLACE_ON_TOP_HORIZONTAL - Place label on top of the line but always horizontal. Example:
    simpleLabel.setLineLabelPosition(simpleLabel.PLACE_ABOVE);

    Parameters:
    llPosition - the line label value.
    See Also:
    getLineLabelPosition()

  • getLineLabelPosition

    public String getLineLabelPosition()
    Returns the line label position set for this SimpleLabelRenderer. Example:
    String lineLabel = simpleLabel.getLineLabelPosition();

    Returns:
    String
    See Also:
    setLineLabelPosition(java.lang.String)

    getSymbol

    public Symbol getSymbol()
    Returns the Symbol associated with this SimpleLabelRenderer. Example:
    Symbol symbol = SimpleLabelRenderer.getSymbol();

    Returns:
    the symbol object
    See Also:
    setSymbol(java.lang.Object)