MapPlot class

The MapPlot class draws outlined and/or filled maps of arbitrary regions of the globe and may be used to map overlay plots into a number of standard projections.


Synopsis

Header file:		ncarg/hlu/MapPlot.h
Class name:		mapPlotClass
Class pointer:		NhlmapPlotClass
Fortran class function:	NHLFMAPPLOTCLASS
Superclass:		Transform
Composite classes:	MapTransObj,PlotManager

Class-defined types

Type name:		NhlTMapBoundarySets
Definition:
typedef enum _NhlMapBoundarySets {
	NhlNOBOUNDARIES	    	    = 0, /* "NoBoundaries"	     */
        NhlGEOPHYSICAL		    = 1, /* "Geophysical"  	     */
	NhlNATIONAL		    = 2, /* "National"		     */
        NhlUSSTATES		    = 3, /* "USStates"		     */
	NhlGEOPHYSICALANDUSSTATES   = 4, /* "GeophysicalAndUSStates" */
        NhlALLBOUNDARIES	    = 5  /* "AllBoundaries"          */
} NhlMapBoundarySets;

Type name:		NhlTSpecifiedFillPriority
Definition:
typedef enum _NhlSpecifiedFillPriority {
	NhlGEOPHYSICALPRIORITY      = 0, /* "GeophysicalPriority" */
        NhlPOLITICALPRIORITY        = 1  /* "PoliticalPriority"   */
} NhlSpecifiedFillPriority;

Type name:		NhlTMapGridMaskMode
Definition:
typedef enum _NhlMapGridMaskMode {
	NhlMASKNONE		    = 0, /* "MaskNone"     */
        NhlMASKOCEAN		    = 1, /* "MaskOcean"    */
	NhlMASKNOTOCEAN		    = 2, /* "MaskNotOcean" */
	NhlMASKLAND		    = 3, /* "MaskLand"     */
	NhlMASKNOTLAND		    = 4, /* "MaskNotLand"  */
	NhlMASKFILLAREA		    = 5, /* "MaskFillArea" */
	NhlMASKMASKAREA		    = 6  /* "MaskMaskArea" */
} NhlMapGridMaskMode;

Type name:		NhlTMapShapeMode
Definition:
typedef enum _NhlMapShapeMode {
	NhlFREEASPECT 		    = 0, /* "FreeAspect" */
	NhlFIXEDASPECTFITBB	    = 1, /* "FixedAspectFitBB" */
	NhlFIXEDASPECTNOFITBB 	    = 2  /* "FixedAspectNoFitBB" */
} NhlMapShapeMode;


Resources

Local resources

+---------------------------------------------------------------+
|			MapPlot Resource Set			|
|---------------------------------------------------------------|
| NAME				TYPE			ACCESS	|
|	CLASS				DEFAULT			|
|===============================================================|
| mpDataBaseVersion             NhlTString              G       |
|       MpDataBaseVersion               "NCARG_4.0"             |
|---------------------------------------------------------------|
| mpShapeMode                   NhlTMapShapeMode        RCSG    |
|       MpShapeMode                     "FixedAspectFitBB"      |
|---------------------------------------------------------------|
| mpAreaNames                   NhlTStringGenArray      RCSG    |
|       MpAreaNames                     <array>                 |
|---------------------------------------------------------------|
| mpAreaTypes                   NhlTIntegerGenArray     G       |
|       MpAreaTypes                     <array>                 |
|---------------------------------------------------------------|
| mpFixedAreaGroups             NhlTIntegerGenArray     G       |
|       MpFixedAreaGroups               <array>                 |
|---------------------------------------------------------------|
| mpDynamicAreaGroups           NhlTIntegerGenArray     RCSG    |
|       MpDynamicAreaGroups             <array>                 |
|---------------------------------------------------------------|
| mpAreaGroupCount              NhlTInteger             RCSG    |
|       MpAreaGroupCount                10                      |
|---------------------------------------------------------------|
| mpOutlineOn                   NhlTBoolean             RCSG    |
|       MpOutlineOn                     True                    |
|---------------------------------------------------------------|
| mpOutlineDrawOrder            NhlTDrawOrder           RCSG    |
|       MpOutlineDrawOrder              "PostDraw"              |
|---------------------------------------------------------------|
| mpOutlineBoundarySets         NhlTMapBoundarySets     RCSG    |
|       MpOutlineBoundarySets           "Geophysical"           |
|---------------------------------------------------------------|
| mpOutlineSpecifiers           NhlTStringGenArray      RCSG    |
|       MpOutlineSpecifiers             <array>                 |
|---------------------------------------------------------------|
| mpAreaMaskingOn               NhlTBoolean             RCSG    |
|       MpAreaMaskingOn                 False                   |
|---------------------------------------------------------------|
| mpMaskAreaSpecifiers          NhlTStringGenArray      RCSG    |
|       MpMaskAreaSpecifiers            <array>                 |
|---------------------------------------------------------------|
| mpFillOn                      NhlTBoolean             RCSG    |
|       MpFillOn                        False                   |
|---------------------------------------------------------------|
| mpFillDrawOrder               NhlTDrawOrder           RCSG    |
|       MpFillDrawOrder                 "Draw"                  |
|---------------------------------------------------------------|
| mpFillBoundarySets            NhlTMapBoundarySets     RCSG    |
|       MpFillBoundarySets              "Geophysical"           |
|---------------------------------------------------------------|
| mpFillPatternBackground       NhlTColorIndex          RCSG    |
|       MpFillPatternBackground         "Background"            |
|---------------------------------------------------------------|
| mpMonoFillColor               NhlTBoolean             RCSG    |
|       MpMonoFillColor                 False                   |
|---------------------------------------------------------------|
| mpFillColor                   NhlTColorIndex          RCSG    |
|       MpFillColor                     "Foreground"            |
|---------------------------------------------------------------|
| mpFillColors                  NhlTColorIndexGenArray  RCSG    |
|       MpFillColors                    <array>                 |
|---------------------------------------------------------------|
| mpMonoFillPattern             NhlTBoolean             RCSG    |
|       MpMonoFillPattern               True                    |
|---------------------------------------------------------------|
| mpFillPattern                 NhlTFillIndex           RCSG    |
|       MpFillPattern                   "SolidFill"             |
|---------------------------------------------------------------|
| mpFillPatterns                NhlTFillIndexGenArray   RCSG    |
|       MpFillPatterns                  <array>                 |
|---------------------------------------------------------------|
| mpMonoFillScale               NhlTBoolean             RCSG    |
|       MpMonoFillScale                 True                    |
|---------------------------------------------------------------|
| mpFillScaleF                  NhlTFloat               RCSG    |
|       MpFillScaleF                    1.0                     |
|---------------------------------------------------------------|
| mpFillScales                  NhlTFloatGenArray       RCSG    |
|       MpFillScales                    <array>                 |
|---------------------------------------------------------------|
| mpFillAreaSpecifiers          NhlTStringGenArray      RCSG    |
|       MpFillAreaSpecifiers            <array>                 |
|---------------------------------------------------------------|
| mpSpecifiedFillDirectIndexing NhlTBoolean             RCSG    |
|       MpSpecifiedFillDirectIndexing   False                   |
|---------------------------------------------------------------|
| mpSpecifiedFillPriority       NhlTSpecifiedFillPriority RCSG  |
|       MpSpecifiedFillPriority         "GeophysicalPriority"   |
|---------------------------------------------------------------|
| mpSpecifiedFillColors         NhlTColorIndexGenArray  RCSG    |
|       MpSpecifiedFillColors           <dynamic array>         |
|---------------------------------------------------------------|
| mpSpecifiedFillPatterns       NhlTFillIndexGenArray   RCSG    |
|       MpSpecifiedFillPatterns         <dynamic array>         |
|---------------------------------------------------------------|
| mpSpecifiedFillScales         NhlTFloatGenArray       RCSG    |
|       MpSpecifiedFillScales           <dynamic array>         |
|---------------------------------------------------------------|
| mpDefaultFillColor            NhlTColorIndex          RCSG    |
|       MpDefaultFillColor              106                     |
|---------------------------------------------------------------|
| mpDefaultFillPattern          NhlTFillIndex           RCSG    |
|       MpDefaultFillPattern            "SolidFill"             |
|---------------------------------------------------------------|
| mpDefaultFillScaleF           NhlTFloat               RCSG    |
|       MpDefaultFillScaleF             1.0                     |
|---------------------------------------------------------------|
| mpOceanFillColor              NhlTColorIndex          RCSG    |
|       MpOceanFillColor                104                     |
|---------------------------------------------------------------|
| mpOceanFillPattern            NhlTFillIndex           RCSG    |
|       MpOceanFillPattern              "SolidFill"             |
|---------------------------------------------------------------|
| mpOceanFillScaleF             NhlTFloat               RCSG    |
|       MpOceanFillScaleF               1.0                     |
|---------------------------------------------------------------|
| mpLandFillColor               NhlTColorIndex          RCSG    |
|       MpLandFillColor                 57                      |
|---------------------------------------------------------------|
| mpLandFillPattern             NhlTFillIndex           RCSG    |
|       MpLandFillPattern               "SolidFill"             |
|---------------------------------------------------------------|
| mpLandFillScaleF              NhlTFloat               RCSG    |
|       MpLandFillScaleF                1.0                     |
|---------------------------------------------------------------|
| mpInlandWaterFillColor        NhlTColorIndex          RCSG    |
|       MpInlandWaterFillColor          104                     |
|---------------------------------------------------------------|
| mpInlandWaterFillPattern      NhlTFillIndex           RCSG    |
|       MpInlandWaterFillPattern        "SolidFill"             |
|---------------------------------------------------------------|
| mpInlandWaterFillScaleF       NhlTFloat               RCSG    |
|       MpInlandWaterFillScaleF         1.0                     |
|---------------------------------------------------------------|
| mpGeophysicalLineColor        NhlTColorIndex          RCSG    |
|       MpGeophysicalLineColor          "Foreground             |
|---------------------------------------------------------------|
| mpGeophysicalLineDashPattern  NhlTDashIndex           RCSG    |
|       MpGeophysicalLineDashPattern    "SolidLine"             |
|---------------------------------------------------------------|
| mpGeophysicalLineDashSegLenF  NhlTFloat               RCSG    |
|       MpGeophysicalLineDashSegLenF    <dynamic>               |
|---------------------------------------------------------------|
| mpGeophysicalLineThicknessF   NhlTFloat               RCSG    |
|       MpGeophysicalLineThicknessF     1.0                     |
|---------------------------------------------------------------|
| mpUSStateLineColor            NhlTColorIndex          RCSG    |
|       MpUSStateLineColor              "Foreground"            |
|---------------------------------------------------------------|
| mpUSStateLineDashPattern      NhlTDashIndex           RCSG    |
|       MpUSStateLineDashPattern        "SolidLine"             |
|---------------------------------------------------------------|
| mpUSStateLineDashSegLenF      NhlTFloat               RCSG    |
|       MpUSStateLineDashSegLenF        <dynamic>               |
|---------------------------------------------------------------|
| mpUSStateLineThicknessF       NhlTFloat               RCSG    |
|       MpUSStateLineThicknessF         1.0                     |
|---------------------------------------------------------------|
| mpNationalLineColor           NhlTColorIndex          RCSG    |
|       MpNationalLineColor             "Foreground"            |
|---------------------------------------------------------------|
| mpNationalLineDashPattern     NhlTDashIndex           RCSG    |
|       MpNationalLineDashPattern       "SolidLine"             |
|---------------------------------------------------------------|
| mpNationalLineDashSegLenF     NhlTFloat               RCSG    |
|       MpNationalLineDashSegLenF       <dynamic>               |
|---------------------------------------------------------------|
| mpNationalLineThicknessF      NhlTFloat               RCSG    |
|       MpNationalLineThicknessF        1.0                     |
|---------------------------------------------------------------|
| mpGridAndLimbOn               NhlTBoolean             RCSG    |
|       MpGridAndLimbOn                 True                    |
|---------------------------------------------------------------|
| mpGridAndLimbDrawOrder        NhlTDrawOrder           RCSG    |
|       MpGridAndLimbDrawOrder          "PostDraw"              |
|---------------------------------------------------------------|
| mpGridSpacingF                NhlTFloat               RCSG    |
|       MpGridSpacingF                  0.1                     |
|---------------------------------------------------------------|
| mpGridMaskMode                NhlTMapGridMaskMode     RCSG    |
|       MpGridMaskMode                  "MaskNone"              |
|---------------------------------------------------------------|
| mpGridLineColor               NhlTColorIndex          RCSG    |
|       MpGridLineColor                 "Foreground"            |
|---------------------------------------------------------------|
| mpGridLineDashPattern         NhlTDashIndex           RCSG    |
|       MpGridLineDashPattern           "SolidLine"             |
|---------------------------------------------------------------|
| mpGridLineDashSegLenF         NhlTFloat               RCSG    |
|       MpGridLineDashSegLenF           <dynamic>               |
|---------------------------------------------------------------|
| mpGridLineThicknessF          NhlTFloat               RCSG    |
|       MpGridLineThicknessF            1.0                     |
|---------------------------------------------------------------|
| mpLimbLineColor               NhlTColorIndex          RCSG    |
|       MpLimbLineColor                 "Foreground"            |
|---------------------------------------------------------------|
| mpLimbLineDashPattern         NhlTDashIndex           RCSG    |
|       MpLimbLineDashPattern           "SolidLine"             |
|---------------------------------------------------------------|
| mpLimbLineDashSegLenF         NhlTFloat               RCSG    |
|       MpLimbLineDashSegLenF           <dynamic>               |
|---------------------------------------------------------------|
| mpLimbLineThicknessF          NhlTFloat               RCSG    |
|       MpLimbLineThicknessF            1.0                     |
|---------------------------------------------------------------|
| mpPerimOn                     NhlTBoolean             RCSG    |
|       MpPerimOn                       True                    |
|---------------------------------------------------------------|
| mpPerimDrawOrder              NhlTDrawOrder           RCSG    |
|       MpPerimDrawOrder                "Draw"                  |
|---------------------------------------------------------------|
| mpPerimLineColor              NhlTColorIndex          RCSG    |
|       MpPerimLineColor                "Foreground"            |
|---------------------------------------------------------------|
| mpPerimLineDashPattern        NhlTDashIndex           RCSG    |
|       MpPerimLineDashPattern          "SolidLine"             |
|---------------------------------------------------------------|
| mpPerimLineDashSegLenF        NhlTFloat               RCSG    |
|       MpPerimLineDashSegLenF          <dynamic>               |
|---------------------------------------------------------------|
| mpPerimLineThicknessF         NhlTFloat               RCSG    |
|       MpPerimLineThicknessF           1.0                     |
|---------------------------------------------------------------|
| mpLabelsOn                    NhlTBoolean             RCSG    |
|       MpLabelsOn                      True                    |
|---------------------------------------------------------------|
| mpLabelDrawOrder              NhlTDrawOrder           RCSG    |
|       MpLabelDrawOrder                "PostDraw"              |
|---------------------------------------------------------------|
| mpLabelFontHeightF            NhlTFloat               RCSG    |
|       MpLabelFontHeightF              <dynamic>               |
|---------------------------------------------------------------|
| mpLabelFontColor              NhlTColorIndex          RCSG    |
|       MpLabelFontColor                True                    |
+---------------------------------------------------------------+

Composite resources

MapTransObj resources

You can access all MapTransObj resources except for the following disabled resource: The MapTransObj resources define the projection and the portion of the world map visible within the NDC viewport.

PlotManager resources

If tfPlotManagerOn is True when a MapPlot object is created, you can access all PlotManager resources except that attempts to set pmTickMarkDisplayMode to a value other NoCreate will result in a warning, since tick marks have not yet been implemented for map projections. Except for TickMark resources, you can also access resources for the PlotManager composite annotation objects. However, the PlotManager object modifies the access and behavior of some of the resources belonging to these objects, as follows:

Superclass resources

You can access all resources defined by the superclasses of the MapPlot object class, including:

Description

The MapPlot object renders maps of the world in any of 10 different projections. It allows you to limit the projected view to a portion of the globe, and to choose individually or by group which of the 583 areas defined in the MapPlot database you want to appear. You can outline areas, you can fill areas, or you can mask areas, allowing previously rendered plot elements to remain visible.

You can use MapPlot as a base plot on which one or more plot objects, such as a ContourPlot object, are overlaid, thereby transforming its elements into the current map projection. You can also control the order of drawing of MapPlot elements relative to each other and to the elements of any overlaid plot objects. Using these facilities, you can limit overlay plots to the geographical boundaries for which their data have meaning. For instance, you can confine a contour plot of ocean temperatures to areas representing only the ocean. Note that unlike most plot objects, you cannot add the MapPlot as an overlay of another base plot. It can, however, be used as an annotation plot

MapPlot supports grids representing latitude and longitude. You can mask the grids independently of area masking. Also supported are labels for some key features of the world map, including the poles, the equator, the Grenwich Meridian and the International DateLine. Finally, you can draw a perimeter, either rectangular or elliptical, around the projected map area.

MapPlot elements

There are six basic elements provided by MapPlot:
Outlines
Map boundary outlines are turned on by default. Turn them off by setting mpOutlineOn to False. The drawing order is specified using mpOutlineDrawOrder.
Fill
Map area fill is turned off by default. Turn it on by setting mpFillOn to True. The drawing order is specified using mpFillDrawOrder.
Masking
Masking is turned off by default. Turn it on by setting mpAreaMaskingOn. When masking is turned on, areas specified by name in the mpMaskAreaSpecifiers array resource remain empty when fill drawing occurs.
Grid and limb lines
Grid and limb lines are turned on by default. Turn them off by setting mpGridAndLimbOn to False. The drawing order is specified using mpGridAndLimbDrawOrder.
Perimeter line
The perimeter line is turned on by default. Turn it off by setting mpPerimOn to False. The drawing order is specified using mpPerimDrawOrder.
Labels
Labels are turned on by default. Turn them off by setting mpLabelsOn to False. The drawing order is specified using mpLabelDrawOrder.

Controlling the MapPlot transformation

The MapPlot object itself contains the resources that control the rendering of plot features such as area outlines and fill, but you control the projection, its center, and how much of the globe is to appear using resources belonging to the MapPlot's composite MapTransObj transformation object. Note that it is possible to overlay another plot object on a MapPlot object using one of the projections provided by the MapTransObj, and have no MapPlot elements appear in the plot. You would simply turn off each MapPlot element that is drawn by default. That is, you would set the resources mpOutlineOn, mpGridAndLimbOn, mpPerimOn, and mpLabelsOn to False.

The map projections provided by the MapTransObj must retain their intrinsic shape in order to be considered "correct" projections. However, in some situations you may not care whether this shape is preserved. The MapPlot object provides a resource, mpShapeMode, that allows you to decide whether or not to preserve the shape intrinsic to the projection. Moreover, if shape is to be preserved, you can decide whether you want to shrink the MapPlot viewport to fit around the projected area, which is centered in the originally specified viewport; or whether you want the viewport to remain as originally specified, even if the projected area cannot completely fill the space.

The MapPlot database

The MapPlot database currently contains 583 areas uniquely identified by name. Although the names are unique, the areas they refer to are not necessarily. An area may overlap one or more other areas' extents. For instance, the area "North-and-South-America" overlaps the continental portion of all countries of the Americas, and "US-Lake-Superior" provides a higher resolution outline of basically the same area as "Lake-Superior". Consider the area name as the primary key to the data.

The current version of the database is several years out of date. Since it can be expected to change from time to time, both to accommodate the current political realities and also to incorporate higher resolution data, MapPlot provides a means of maintaining compatibility, based on a string resource, mpDataBaseVersion, that allows the user to specify the version of the database required.

Area names

You can retrieve a list of all the area names in the MapPlot database using the resource mpAreaNames. The list is stored in a fixed order. By setting the mpAreaNames resource you can change an area's name at runtime, but the boundary it describes remains fixed and always has the same element number within the mpAreaNames array. In addition to a name, each area has a type. Each area also belongs to two area groups that are used to determine its fill attributes.

Area types

You can retrieve an area's type using the read-only integer array resource mpAreaTypes. The elements of this array have the same ordering as the mpAreaNames array. There are 8 types, numbered from 0, as follows: The division between large islands and small islands is arbitrary; its purpose is to make it easy to create small scale maps with a less cluttered appearance and some savings of processing time. Each area has only one type and its geophysical properties are considered first. In other words, areas are classified as mpNational only if they form a proper subset of a geophysical entity. For instance, Bolivia is of type mpNational because it is part, but not the whole, of the geophysical area North-and-South-America. On the other hand, Australia is both a geophysical entity (a continent) and a country, therefore its type is mpContinent. You do not use the area types directly to control the operation of MapPlot; however knowledge of an area's type is useful for understanding the MapPlot object's operation.

Pre-defined string constants

Somewhat related to the area types are the pre-defined string constants that specify areas by catagory. You use these strings when setting area specifier string array resources. Here are the constant strings (which MapPlot handles in case-insensitive manner): Unlike area types, the area catagories described by these string constants can overlap. The catagory "Islands", for instance, includes all the members of "LargeIslands" and "SmallIslands". On the other hand, note that all members of the set "LargeIslands" are of type mpLargeIsland, so knowing an area's type can help you figure out whether it is a member of a particular constant string catagory. The string "NullArea" specifies no area at all; it is the default value of all the area specifier array resources.

Boundary sets and area specifiers

The MapPlot object has two types of resources for specifying areas. The first type, supported for outlines and fill, uses resources of type NhlTMapBoundarySets to specify very generally the area sets to be used. The second type, supported for outlines, fill and area masking, allows you to specify group of areas by catagory and individual areas by name using string array type resources. For outlines and fill, it is often convenient to use both resource types to complete the specification of the areas desired.

The areas in the MapPlot database are actually a concatentation of three distinct boundary sets. The first set contains geophysical boundaries; the second is a union of the geophysical set with interior national boundaries; the third contains (at a higher resolution) the boundaries of the U.S. States. You can specify that MapPlot draw any combination of the three sets (including none of them) using resources of type NhlTMapBoundarySets. For outlines and fill these resources are mpOutlineBoundarySets and mpFillBoundarySets.

The string array resources allow individual specification of areas and area catagories. To the basic boundary specification (which might well be NoBoundaries), you add other areas you want to outline or fill and subtract areas you want to mask. You do this using string array specifier resources, of which there are three: mpOutlineSpecifiers, mpFillAreaSpecifiers, and mpMaskAreaSpecifiers. The specifier strings you use for these resources may be any of the MapPlot pre-defined string constants, explicit names from the MapPlot database, or matching substrings. All specifier strings are case-insensitive.

Substring matching

You form a matching substring by placing the wildcard character, '*', at either or both ends of the character group you want to match. For instance, the substring "canada*" matches all entries in the database beginning with the name "Canada", and "*lake*" would match all entries with the letters "lake" (any case) anywhere in the name.

Outlines

By default, MapPlot draws area outlines but you can turn them off by setting mpOutlineOn to False. You establish the basic set of outlines to use by choosing a value for the NhlTMapBoundarySets type resource mpOutlineBoundarySets. If you wish, you can then add to the basic outline set by specifying other areas using the resource mpOutlineSpecifiers. Unlike fill, the current version of MapPlot does not allow individual control of the lines defining the boundary of a particular area. However, you can set outline attributes for three general boundary catagories, depending on which of the three basic datasets the line belongs to: geophysical, national, or U.S. States. MapPlot supports line color, line dash pattern, line dash segment length, and line thickness for each catagory.

Area fill

Since area fill is more compute intensive, and may not be appropriate for many simple plotting tasks, MapPlot turns it off by default. Set mpFillOn to True to turn it on. MapPlot fill has more options than outlines, and thus is a bit more complicated to explain. Like outlines, you establish a basic set of fill areas using the NhlTMapBoundarySets type resource mpFillBoundarySets. To this set you can add other fill areas using the string array resource, mpFillAreaSpecifiers.

Normally MapPlot determines the fill attributes for each area based on its group memberships within the fixed and dynamic area group arrays. However, for areas specified explicitly in the mpFillAreaSpecifiers array, you can override the usual fill attribute choices and pick the fill attributes explicitly. This will be explained further below.

Area groups

MapPlot defines a set of area groups that it uses determine the "normal" fill attributes assigned to each filled area. By default there are 10 area groups, arranged as follows:

Group 0: Default group
Determines the fill attributes for areas that fall within the map projection boundaries, but otherwise are neither specified as fill areas nor as mask areas.
Group 1: Ocean group
Determines the fill attributes for the world oceans.
Group 2: Land group
Determines the fill attributes for continents and islands.
Group 3: Inland water group
Determines the fill attributes for lakes, inland seas, and all other bodies of water except the ocean.
Groups 4 through 9 (default) through 255 (maximum): Dynamic groups
By default, MapPlot assigns areas to the dynamic groups in such as way as to ensure that adjoining areas never belong to the same group, and therefore have distinct fill attributes. However, the user may add more dynamic groups and reassign memberships in order to achieve any desired distribution of fill attributes.

MapPlot maintains two arrays of these area groups, accessible through the integer array resources mpFixedAreaGroups and mpDynamicAreaGroups. Both arrays are keyed to the mpAreaNames array, and within each array, the value of each element represents the area group assigned to an area. Most areas are assigned to different groups in the two area group areas, but in a number of cases, (all areas representing water bodies, for instance), MapPlot assigns an area to the same group in both arrays.

The mpFixedAreaGroups array is sometimes known as the geophysical group array, because it provides the indexes that allow you to distinguish land areas from water areas. As its name implies, you cannot modify the mpFixedAreaGroups resource. Within this array, based on area type, MapPlot assigns each area in the database either to the Ocean group, to the Land group, or to the InlandWater group (i.e. to groups 1, 2 or 3).

The mpDynamicAreaGroups array is sometimes called the political group array, since the default assignment of dynamic area group numbers guarantees that adjoining politically distinct areas belong to different area groups. However, you are free to assign area groups within the dynamic area group array in any way you please. You may use all the available area groups from 1 through the current value of mpAreaGroupCount.

Setting fill attributes based on area groups

The elements of the array resources used to set fill color, fill pattern, and fill scale are indexed through the area group numbers. In other words, the first element of each of these arrays defines a fill attribute for group 0, the second an attribute for group 1, and so forth. For convenience, you can also access the fill attribute resources of groups 0 through 4 using a set of resources with names corresponding to the area group name. These resources have names with the following prefixes: mpDefault..., mpOcean..., mpLand..., and mpInlandWater.... You can think of these resources as aliases for the corresponding array resource element. When an array resource and a named alias resource accessing one of its elements are set in the same SetValues call the named alias resource overrides.

Each of the three basic fill attributes supported by MapPlot, fill color, fill pattern, and fill pattern scale factor, provides both a scalar resource that you can use if you want to set all area groups to the same value, and an array resource that you use if you want to set each area group individually. The scalar fill attribute resources are mpFillColor, mpFillPattern, and mpFillScaleF. The array resources names, formed by pluralizing the scalar resource names (after removing the 'F' suffix, if present) are mpFillColors, mpFillPatterns, and mpFillScales. The boolean resources, mpMonoFillColor, mpMonoFillPattern, and mpMonoFillScale, specify use of the scalar resources when set to True, and the array resources when set False. Note that if a Mono resource is set True, the named alias resources applying to that attribute are ignored, since they are, after all, only aliases for particular elements of the array resource.

For each attribute that has the Mono resource set False, MapPlot finds a group number for each area either from the fixed area group array or the dynamic area group array and uses that number as an index into the appropriate array resource. How does MapPlot decide when to index based on the fixed area group number and when to index based on the dynamic area group number? For fill areas specified using only the mpFillBoundarySets resource, MapPlot chooses between the area group arrays as follows:

NoBoundaries
Neither area group array is used. Each area is assigned fill attributes using the default group number (0) as an index.
Geophysical
Each area is assigned fill attributes using its mpFixedAreaGroups group numbers as an index.
National
Each area is assigned fill attributes using its mpDynamicAreaGroups group number as an index.
USStates
If the area belongs within the USStates dataset it is assigned fill attributes using its mpDynamicAreaGroups group number as an index. Otherwise it is assigned fill attributes using the default group number (0) as an index.
GeophysicalAndUSStates
If the area belongs within the USStates dataset it is assigned fill attributes using its mpDynamicAreaGroups group number as an index. Otherwise it is assigned fill attributes using its mpFixedAreaGroups group number as an index.
AllBoundaries
Each area is assigned fill attributes using its mpDynamicAreaGroups group number as an index.
For areas specified in the mpFillAreaSpecifiers array, you may explicitly set the fill attributes individually as explained in the next section. However, whenever a fill attribute is not explicitly set MapPlot uses a group number either from the fixed or the dynamic area group arrays as an index into the fill attribute array resources. In this case, the choice is based on the setting of the mpSpecifiedFillPriority resource. If mpSpecifiedFillPriority has the value GeophysicalPriority MapPlot picks an index from the mpFixedAreaGroups array to determine fill attributes. Otherwise, it picks an index from the mpDynamicAreaGroups array. You may reverse the fill priority for individual areas within the mpFillAreaSpecifiers array by prepending the exclamation mark character ('!') to the area's specifier string. For instance, if mpSpecifiedFillPriority is set to PoliticalPriority but you want Australia to be displayed using its geophysical color, you would set the appropriate mpFillAreaSpecifiers element to the value "!australia".

Explicitly setting fill attributes

You can explicitly set the fill attributes of areas specified in the mpFillAreaSpecifiers array, using the array resources mpSpecifiedFillColors, mpSpecifiedFillPatterns, and mpSpecifiedFillScales. Each element of the specified fill attribute arrays provide an attribute value for the corresponding element of the mpFillAreaSpecifiers array. Explicit specification of fill attributes overrides fill attribute selection based on area group memberships. Explicit specification also overrides the Mono flag. Therefore, you can easily highlight an individual area by explicitly setting, for example, the appropriate element of mpSpecifiedFillPatterns to a unique pattern while the remaining areas are all set perhaps to SolidFill, as determined by the value of the mpFillPattern resource.

If you want to explcitly specify the attributes of only certain of the areas specified in the mpFillAreaSpecifiers, while others base their fill attributes on area group memberships as discussed in the previous section, there are special values you can assign to indicate an "unset" value. For mpSpecifiedFillColors use the special color index NoColor (-1); for mpSpecifiedFillPatterns the special fill pattern index NoPattern (-1); and for mpSpecifiedFillScales use the otherwise invalid value, 0.0.

By default, the specified fill attribute arrays directly set the attribute. In other words, the value of an element of mpSpecifiedFillColors represents an HLU color index, the value of an element of mpSpecifiedFillPatterns represents an HLU pattern index, and the value of an element of mpSpecifiedFillScales is a floating point number representing a fill scaling factor. However, if you set the resource mpSpecifiedFillDirectIndexing False, the values of these array elements are converted to integers and treated as group numbers. This facility allows you to use the specified fill attribute arrays to specify the fill attributes of an area indirectly by temporarily changing its group membership.

Area masking

MapPlot allows you to specify areas or groups of areas that are to remain unfilled or masked. You enable and disable area masking using the resource, mpAreaMaskingOn. You specify individual areas or area catagories that you want to mask using the string array resource, mpMaskAreaSpecifiers.

Masking and fill precedence

Since there is a potential for fill and masking specifications to conflict with each other, MapPlot has established an order of precedence for these specifiers. Explicitly named areas take precedence over area groups specified using mpFillBoundarySets or any of the pre-defined constants. Small areas take precedence over enclosing larger areas. Otherwise masking takes precedence over filling. Note that if the mpFillBoundarySets resource is set to the value Noboundaries, it is possible that areas within the map projection may remain unspecified either as filled or masked. MapPlot fills these areas using the default fill attributes.

Grid and limb line

By default MapPlot turns on the map grid and, where appropriate, the limb line; you can turn it off by setting the resource mpGridAndLimbOn False. The resource mpGridSpacingF specifies the distance in degrees between grid lines both for longitude and for latitude. You can turn on grid masking and choose how to select the areas where grid lines do not appear with the NhlTMapGridMaskMode resource mpGridMaskMode. Note that grid masking operates independently of area masking, although it is possible to mask the grid over masked areas if you set mpGridMaskMode to MaskMaskArea.

You can set the line attributes for the grid and limb lines independently. Grid attributes are controlled using the resources mpGridLineColor, mpGridLineDashPattern, mpGridLineDashSegLenF, and mpGridLineThicknessF. You set limb line attributes using mpLimbLineColor, mpLimbLineDashPattern, mpLimbLineDashSegLenF, and mpLimbLineThicknessF.

Labels

MapPlot draws labels by default but you can turn them off by setting the mpLabelsOn resource to False. When labels are turned on the text "NP", "SP", "EQ", "GM", and "ID" is written at the positions of respectively the North Pole, the South Pole, the Equator, the Greenwich Meridian, and the International Dateline. You can control the size of labels using the resources mpLabelFontHeightF and their color using mpLabelFontColor. Currently no other resources are available for labels.

Perimeter

By default, MapPlot draws a rectangular perimeter around the projected map area, but you can turn it off by setting the boolean resource mpPerimOn False. If you set the MapTransObj resource, mpEllipticalBoundary, True, the perimeter will be elliptical instead of rectangular. You can set line attributes for the perimeter using the resources mpPerimLineColor, mpPerimLineDashPattern, mpPerimLineDashSegLenF, and mpPerimLineThicknessF

Support functions

The MapPlot object does not define any support functions, but inherits all the support functions available to its Transform superclass.

Status

5: Eventually you should be able to add groups of points that define your own areas, give them arbitrary names and add these areas to the area names array.

6: The resource mpAreaTypes needs to be made into an enumerated resource.


See also


Copyright

Copyright 1987,1988,1989,1991,1993,1994,1995
University Corporation for Atmospheric Research
All Rights Reserved

Reference Manual Control Panel

NG4 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.18 $ $Date: 1995/07/26 23:30:04 $