|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface defines a layer object.
A layer stores a lot of features which have the same type of default geometry. GeographyLayer controls all the properties which determine how to display a layer.
For example, if you want to hide the layer, you can use setLayerVisible(false). If you want to change the style of the layer, you should use setLayerComplexStyle(...) to set new style.
A layer is an aggregation of a collection of features, a Style. Through a layer object, you can access the attributes' names, features, and event the specific property of the layer style.
Field Summary | |
static java.lang.String |
IMAGELAYER_NAME
|
Method Summary | |
void |
addCustomRule(java.lang.String attributeName,
int operator,
java.lang.Object value,
java.awt.Color strokeColor,
double width,
java.awt.Color fillColor,
double alpha)
Adds a rule to a GeographyLayer. |
void |
clearRules()
|
GeographyFeature[] |
getAllFeatures()
Gets all the GeographyFeatures of the layer. |
double |
getAlpha()
Gets the alpha value of the style which has been set to the layer. |
java.lang.String |
getAttributeName()
Gets the name of the attribute which is used as the label. |
GeographyFeature[] |
getFeatures(double longitude,
double latitude)
Gets the features which geometric shape contains the coordinates. |
java.util.Collection |
getFeaturesByAttribute(java.lang.String attributename,
java.lang.Object value)
Gets the features referring to the specified attribute's value. |
java.lang.String |
getFeatureTypeName()
Gets the name of the feature type. |
java.awt.Color |
getFillColor()
Gets the color used to fill the layer. |
java.awt.Font |
getFont()
Gets the font used to paint the label. |
java.awt.Color |
getFontColor()
Gets the color used to paint the label. |
java.awt.geom.Rectangle2D |
getLayerBounds()
Gets the bound of the layer. |
java.lang.String |
getLayerGeometryTypeName()
Gets the name of the layer's geometry type. |
java.lang.String[] |
getLayerPropertiesNames()
Gets the names of all the properties stored in the layer. |
int |
getScaleFactor()
Gets the scale factor of the layer. |
java.awt.Color |
getStrokeColor()
Gets the stroke color used to paint the layer. |
double |
getStrokeWidth()
Gets the stroke width used to paint the layer. |
java.lang.String |
getTitle()
Gets the title of the GeographyLayer. |
boolean |
isLabelVisible()
Determines whether the label can be visible. |
boolean |
isPermittedVisible()
Indicates whether the layer's visibility gets the permission. |
boolean |
isScaleVisible()
Indicates whether the layer can be visible under some scale of the map. |
boolean |
isVisible()
Indicates whether the layer is visible. |
void |
removeRules()
Removes all the custom rules, and clears all the custom styles of the features stored in the layer. |
void |
setAlpha(double alpha)
Sets the alpha of the style which is set to the layer. |
void |
setAttributeName(java.lang.String attributeName)
Defines which attribute is used to as the label and the attribute is specified by the attribute name. |
void |
setFillColor(java.awt.Color fillColor)
Sets the color used to fill the layer. |
void |
setFont(java.awt.Font font)
Sets the font used to paint the label. |
void |
setFontColor(java.awt.Color fontColor)
Sets the color used to paint the label. |
void |
setLabelVisible(java.lang.String attributeName,
boolean visible)
Defines if the specified attribute used as the label is visible. |
void |
setLabelVisible(java.lang.String attributeName,
boolean visible,
java.awt.Color fontColor,
java.awt.Font font)
Defines if the specified attribute used as the label is visible. |
void |
setLayerBounds(double minLongitude,
double minLatitude,
double maxLongitude,
double maxLatitude)
|
void |
setLayerComplexStyle(java.awt.Color strokeColor,
java.awt.Color fillColor,
double width,
double alpha,
boolean needText,
java.awt.Font font,
java.awt.Color fontColor,
boolean withHalo,
java.awt.Color haloColor,
java.lang.String property)
Sets the style of the Layer. |
void |
setLayerComplexStyle(java.awt.Color strokeColor,
java.awt.Color fillColor,
double width,
double alpha,
boolean needText,
java.awt.Font font,
java.awt.Color fontColor,
java.lang.String property)
Sets the style of the Layer. |
void |
setScaleFactor(int scaleFactor)
Sets the scale factor of the layer. |
void |
setScaleVisible(boolean value)
Sets the scale factor of the layer. |
void |
setStrokeColor(java.awt.Color strokeColor)
Sets the stroke color used to paint the layer |
void |
setStrokeWidth(double strokeWidth)
Sets the stroke width used to paint the layer. |
void |
setVisibilityPermission(boolean value)
Sets the permission of the layer's visibility. |
void |
setVisible(boolean value)
Decides whether the layer is visible. |
void |
updateDisplay()
After add the rules to a GeographyLayer, you will have to invoke this method, otherwise, what you have added into the layer will not works. |
Field Detail |
public static final java.lang.String IMAGELAYER_NAME
Method Detail |
public java.lang.String getTitle()
public boolean isVisible()
setVisible(boolean)
,
setVisibilityPermission(boolean)
,
isPermittedVisible()
,
setScaleFactor(int)
,
getScaleFactor()
,
setScaleVisible(boolean)
,
isScaleVisible()
public void setVisible(boolean value)
value
- true if you want to set the layer visible, false otherwise.isVisible()
,
setVisibilityPermission(boolean)
,
isPermittedVisible()
,
setScaleFactor(int)
,
getScaleFactor()
,
setScaleVisible(boolean)
,
isScaleVisible()
public boolean isPermittedVisible()
isVisible()
,
setVisible(boolean)
,
setVisibilityPermission(boolean)
,
setScaleFactor(int)
,
getScaleFactor()
,
setScaleVisible(boolean)
,
isScaleVisible()
public void setVisibilityPermission(boolean value)
There are two factors influencing the visibility of the layer. One is the visibility permission, and the other is
scale factorsetScaleFactor(int)
. The following table explains the relationships between the factors and the
layer's visibility. If the layer gets the permission and the scale of the map is smaller than the layer's
scaleFactor, the layer will be visible.
-------------------------------------------------------- | isLayerVisible | isPermittedVisible | isScaleVisible | -------------------------------------------------------- | TRUE | TRUE | TRUE | -------------------------------------------------------- | FALSE | FALSE | TRUE | -------------------------------------------------------- | FALSE | TRUE | FALSE | -------------------------------------------------------- | FALSE | FALSE | FALSE | --------------------------------------------------------
value
- the permission value.isVisible()
,
setVisible(boolean)
,
isPermittedVisible()
,
setScaleFactor(int)
,
getScaleFactor()
,
setScaleVisible(boolean)
,
isScaleVisible()
public void setScaleFactor(int scaleFactor)
There is a private property named scale factor in layer object. The property is used to determine whether the layer can be visible under the current scale of the map. If the factor is more than current scale of the map, the layer will be visible if it has the visibility permission at the same time. Otherwise the layer will be invisible. For example:
If we set the scale factor as 10000 by invoking the method setScaleFactor(int)
, and the current scale of the
map is 1:20000, and the layer has the visibility permission, the layer will be invisible.Otherwise,is the factor
is changed to 30000, the layer will be visible.
scaleFactor
- the scale factor you want to set.isVisible()
,
setVisible(boolean)
,
setVisibilityPermission(boolean)
,
isPermittedVisible()
,
getScaleFactor()
,
setScaleVisible(boolean)
,
isScaleVisible()
public int getScaleFactor()
isVisible()
,
setVisible(boolean)
,
isPermittedVisible()
,
setVisibilityPermission(boolean)
,
setScaleFactor(int)
,
setScaleVisible(boolean)
,
isScaleVisible()
public void setScaleVisible(boolean value)
By default, a GeographyLayer object monitor the changing of the scale of a map. The layer will be set visible or invisible automatically by comparing current scale of the map and the scale factor of the layer. If you want to monitor the changing of the scale of a map or the changing of the scale factor of a layer, don't forget to artificially invoke setScaleVisible after comparing the scale of the map and the scale factor of the layer.
value
- the specified scale factor.isVisible()
,
setVisible(boolean)
,
setVisibilityPermission(boolean)
,
isPermittedVisible()
,
setScaleFactor(int)
,
getScaleFactor()
,
isScaleVisible()
public boolean isScaleVisible()
isVisible()
,
setVisible(boolean)
,
setVisibilityPermission(boolean)
,
isPermittedVisible()
,
setScaleFactor(int)
,
getScaleFactor()
,
setScaleVisible(boolean)
public java.lang.String getLayerGeometryTypeName()
public java.lang.String getFeatureTypeName()
public java.lang.String[] getLayerPropertiesNames()
public void setLayerComplexStyle(java.awt.Color strokeColor, java.awt.Color fillColor, double width, double alpha, boolean needText, java.awt.Font font, java.awt.Color fontColor, java.lang.String property)
strokeColor
- the color of the stroke.fillColor
- the color used to fill the geometric shape.width
- the width of the stroke.alpha
- the alpha value used to fill the geometric shape.needText
- defines if the label should be displayed.font
- the font used by the label.fontColor
- the color of the font.property
- the name of the property, which you want to be displayed as labels.public void setLayerComplexStyle(java.awt.Color strokeColor, java.awt.Color fillColor, double width, double alpha, boolean needText, java.awt.Font font, java.awt.Color fontColor, boolean withHalo, java.awt.Color haloColor, java.lang.String property)
strokeColor
- the color of the stroke.fillColor
- the color used to fill the geometric shape.width
- the width of the stroke.alpha
- the alpha value used to fill the geometric shape.needText
- defines if the label should be displayed.font
- the font used by the label.fontColor
- the color of the font.withHalo
- defines if the label has a halohaloColor
- specify the color used to render the label's haloproperty
- the name of the property, which you want to be displayed as labels.public void addCustomRule(java.lang.String attributeName, int operator, java.lang.Object value, java.awt.Color strokeColor, double width, java.awt.Color fillColor, double alpha)
For example:
There are a lot of features in a GeographyLayer.They have the same attribute named "NAME", but have different attribute values.There is one feature and the value of the "NAME" attribute is "New York". If the feature is supposed to be painted in green color, filled with red color, and be transparent described by a alpha value, you can use layer.addCustomRule("NAME",TWaverGisConst.OPERATOR_EQUAL, "New York",Color.GREEN,1,Color.RED,0.5). After that, you should invoke layer.updateDisplay to display your settings.
attributeName
- the attribute name which you want to refer to.operator
- the type to compare the attribute's values. You should use the following choices:value
- the attribute's value used to be compared with.strokeColor
- the color used to paint the feature.width
- the width of the stroke.fillColor
- the color used to fill the feature.alpha
- the alpha value used to fill the feature.TWaverGisConst.OPERATOR_NULL
,
TWaverGisConst.OPERATOR_LESSOREQUAL
,
TWaverGisConst.OPERATOR_LESS
,
TWaverGisConst.OPERATOR_GREATER
,
TWaverGisConst.OPERATOR_GREATEROREQUAL
,
TWaverGisConst.OPERATOR_EQUAL
public void removeRules()
public void updateDisplay()
public void clearRules()
public GeographyFeature[] getAllFeatures()
public GeographyFeature[] getFeatures(double longitude, double latitude)
longitude
- the longitude coordinate.latitude
- the latitude coordinate.
public java.util.Collection getFeaturesByAttribute(java.lang.String attributename, java.lang.Object value)
attributename
- the name of a attribute.value
- the value of the attribute.
public java.lang.String getAttributeName()
public void setAttributeName(java.lang.String attributeName)
attributeName
- the specified attribute name.public double getAlpha()
public void setAlpha(double alpha)
alpha
- the specified alpha value.public double getStrokeWidth()
public void setStrokeWidth(double strokeWidth)
strokeWidth
- the specified width.public java.awt.Color getFillColor()
public void setFillColor(java.awt.Color fillColor)
fillColor
- the specified color used to fill the layer.public java.awt.Font getFont()
public void setFont(java.awt.Font font)
font
- the specified font used to paint the labelpublic java.awt.Color getFontColor()
public void setFontColor(java.awt.Color fontColor)
fontColor
- the specified color used to paint the label.public java.awt.Color getStrokeColor()
public void setStrokeColor(java.awt.Color strokeColor)
strokeColor
- the specified stroke color used to paint the layerpublic void setLabelVisible(java.lang.String attributeName, boolean visible)
attributeName
- the specified attribute used as the label.visible
- if true, makes the label is visible, otherwise, hides the label.public void setLabelVisible(java.lang.String attributeName, boolean visible, java.awt.Color fontColor, java.awt.Font font)
attributeName
- the specified attribute used as the label.visible
- if true, makes the label is visible;otherwise, hides the label.fontColor
- a Color object used to render the label.font
- a Font object used to render the label.public boolean isLabelVisible()
public java.awt.geom.Rectangle2D getLayerBounds()
For example: Rectange2D layerBound = getLayerBounds(); System.out.println(layerBound.getMinx());
public void setLayerBounds(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |