Class CMLayerGraticule extends CM2Layer
CMLayerGraticule
by: Jim Graham
This class required a level of complexity beyond what I initially expected.
The problem is that we have to:
- Draw graticule lines based on the zoom level, projection, and area viewed
- Paint coordinates along the border based on where the graticules intersect with the border
- Paint coordinates along the outside of the graticule grid if it is visible (i.e. does not
intersect with the border.
Settings used are:
- Style: for lines
- TextStyle: for labels in the map
Graticles are made visible by setting the overall style to transparent. The graticules must be drawn to get the intersections for the exterior and border
Copyright (C) 2020, Humboldt State University, Jim Graham
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see
.
Settings Group: Graticule
Setting |
Name |
Type |
Options |
Default |
Comments |
East |
East |
CMTYPE_FLOAT |
|
180 |
|
West |
West |
CMTYPE_FLOAT |
|
-180 |
|
North |
North |
CMTYPE_FLOAT |
|
90 |
|
South |
South |
CMTYPE_FLOAT |
|
-90 |
|
Spacing |
Spacing |
CMTYPE_FLOAT |
|
200 |
/ desired spacing for the graticules in pixels |
DegreeSpacing |
Degree Spacing |
CMTYPE_FLOAT |
|
-1 |
only implemented for 3d |
TextSpacing |
Text Spacing |
CMTYPE_FLOAT |
|
360 |
only implemented for 3d |
Settings Group: Border
Setting |
Name |
Type |
Options |
Default |
Comments |
strokeStyle |
Line Style |
CMTYPE_CSS_STYLE |
|
rgb(0,0,0) |
|
fillStyle |
Fill Style |
CMTYPE_CSS_STYLE |
|
rgb(255,255,255) |
|
lineWidth |
Width |
CMTYPE_INTEGER |
|
3 |
|
BorderWidth |
Border Width |
CMTYPE_FLOAT |
|
12 |
|
Settings Group: BorderText
Setting |
Name |
Type |
Options |
Default |
Comments |
font |
Font |
CMTYPE_FONT |
|
14px Arial |
|
strokeStyle |
Line Style |
CMTYPE_CSS_STYLE |
|
rgb(0,0,0) |
|
lineWidth |
Width |
CMTYPE_INTEGER |
|
1 |
|
fillStyle |
Fill Style |
CMTYPE_CSS_STYLE |
|
rgb(0,0,0) |
|