MapXtreme for Java styles and annotations

Source: Internet
Author: User
Annotations: can be used to enhance map functionality and to provide users with the correct messages. Annotations are not limited to adding text to illustrate the characteristics of a map
The Getlabelrendition method returns the style properties of the metafile callout.
The Labelproperties class contains methods that control how to draw annotations for each layer. The method in this class enables you to control the content, visibility, appearance, and relative importance of annotations.
Labelproperties Labelprop = Mylayer.getlabelproperties ();
Rendition labelrend = Labelprop.getrendition ();
Labelrend.setvalue (rendition.font_weight, 2f);
Labelrend.setvalue (Rendition.symbol_foreground, color.red);
Labelrend.setvalue (Rendition.font_style, Rendition.FontStyle.ITALIC);
Labelprop.setrendition (Labelrend);
Callout text
The attributes that are associated with the map entity. These two elements are dynamically linked. If the underlying property changes, the callout text also changes accordingly.
Callout expression
MapXtreme Java uses an information column, static text, or a combination of both to annotate an entity. The callout expression is a Java String object, consists of (1) static text (in a double quote transfer character (\) and displayed for each callout), (2) One or more column names for the data source (the value of the data source is read at run time and displayed on the callout).
For example, to create a callout with the static text "POP:" for the actual population value named pop_2000 column. You can use the following methods:

Labelprops.setlabelexpression ("Pop:" + pop_2000)


Styles: All entities in a map display specific visible features, such as color or symbol type. The corresponding feature is also called a style. Including the many display property entities that use the JAVA2D API rendering capabilities are rendered by using information such as color, line width, fill pattern, and symbol style. These styles are returned by calling the Getrendition method of the Feature interface. Each entity callout can be used to provide a predefined rendition object to describe the annotations for each entity. The style API supports three categories of properties: Padding, single fill, and symbols.
Padding properties
A range can be filled with either an entity color or a symbol. To set a color, you can specify a Java color object that represents the desired color. For example:
Rendition rend = new Renditionimpl ();
Rend.setvalue (Rendition.fill, color.red);
One-Pen fill properties
The single fill property controls how the edges of a line or range are displayed. These properties control a single pen fill pattern, line width, segment connection points and endpoints, dashed mode, and more.
The Rendition.stroke property controls the pattern that is used when drawing a line or edge. The property value is an entity color, a style or gradient that specifies the symbol pattern. This is very similar to the Rendition.fill attribute described earlier. When the value is a style similar to the Fill property, the symbolic property of the style is used to create the symbol that you want to use for the fragment fill of the line. Usually, the symbol padding on the line is only meaningful at Stroke_width > 1 o'clock.
Rendition.stroke_width controls the width of the line (in points) and rendition.stroke_opacity, opacity (0.0 is transparent, and 1.0 is opaque).
Rendition rend = new Renditionimpl ();
Rend.setvalue (Rendition.stroke, color.red);
Rend.setvalue (Rendition.stroke_width, 3.2f);
Rend.setvalue (rendition.stroke_opacity, 0.3f);
Symbol attributes: fonts, images, and vectors
In addition to the mark point location, symbols in MapXtreme Java can perform numerous operations. As described above, a symbol can be used as a style to fill an area, a wider line, or a line marker. Symbols can be grouped into three types: fonts, images, and vectors.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.