GLG Toolkit, Java Class Library  Version 4.6

This group contains methods that may be used for handling coordinate conversions and GIS queries when a GLG GIS Object is used to display a map inside the GLG drawing. More...

Detailed Description

This group contains methods that may be used for handling coordinate conversions and GIS queries when a GLG GIS Object is used to display a map inside the GLG drawing.

Functions

boolean GISConvert (String resource_name, GlgCoordType coord_type, boolean coord_to_lat_lon, GlgPoint in_point, GlgPoint out_point)
 Performs coordinate conversion from the GIS coordinates of the GIS Object to the GLG coordinates of the drawing and visa versa. More...
 
GlgObject GISCreateSelection (String resource_name, String layers, double x, double y, GlmLabelSelectionMode select_labels)
 Returns a message object containing information about GIS features located at a specified position on the map. More...
 
GlgDouble GISGetElevation (String resource_name, String layer_name, double lon, double lat)
 Returns an elevation of a lat/lon point on a map. More...
 
static void GlmConvert (GlgProjectionType projection, boolean stretch, GlgCoordType coord_type, boolean coord_to_lat_lon, GlgPoint center, GlgPoint extent, double angle, double min_x, double max_x, double min_y, double max_y, GlgPoint in_point, GlgPoint out_point)
 A low level method that performs coordinate conversion from the GIS coordinates of a map to the GLG coordinates of the drawing and visa versa without the help of a GLG GIS Object. More...
 

Function Documentation

◆ GISConvert()

boolean GISConvert ( String  resource_name,
GlgCoordType  coord_type,
boolean  coord_to_lat_lon,
GlgPoint  in_point,
GlgPoint  out_point 
)

Performs coordinate conversion from the GIS coordinates of the GIS Object to the GLG coordinates of the drawing and visa versa.

Parameters
resource_nameThe resource path of a child GIS object whose coordinate system to use for conversion, or null to use the GIS object the method is invoked on. The resource path is relative to the invoking object.
coord_typeThe type of the GLG coordinate system to convert to or from:
coord_to_lat_lon
  • true to convert from GLG coordinates to GIS longitude and latitude
  • false to convert the GIS longitude and latitude to GLG coordinates.
in_pointGlgPoint containing input values (x/y in the selected coordinate system or lon/lat).
out_pointGlgPoint that will receive converted output values (x/y in the selected coordinate system or lon/lat).
Returns
Success or failure status.

When converting from X/Y to lat/lon coordinates in the ORTHOGRAPHIC projection, the Z coordinate is set to a negative value for points on the invisible part of the globe or outside the globe area, and to zero for points on the edge of the globe. Coordinates of the returned point may be outside of the visible portion of the map for all projections.

This method performs coordinate conversion using the current settings of the GIS object, which must be set up and rendered.

The GlmConvert method may be used to perform coordinate conversion between GIS and GLG coordinates without the use of the GIS object, which could be done before the drawing is rendered, without a drawing at all, or without a GIS object being present.

◆ GISCreateSelection()

GlgObject GISCreateSelection ( String  resource_name,
String  layers,
double  x,
double  y,
GlmLabelSelectionMode  select_labels 
)

Returns a message object containing information about GIS features located at a specified position on the map.

This method provides a high-level interface to the map server's GlmGetSelection function and may be used to query GIS selection at the point selected by the mouse click.

Parameters
resource_nameThe resource path of a child GIS object to query or null to query the GIS object the method is invoked on.
layersA list of layers to query.
x,yCoordinates of a point in the screen coordinates of a viewport that contains the GIS object.
select_labelsSpecifies the label selection mode, can have the following values:
  • GIS_LBL_SEL_NONE - GIS features' labels are not considered for the GIS selection.
  • GIS_LBL_SEL_IN_TILE_PRECISION - enables labels to be considered for the GIS selection. For a faster selection, this option does not check labels that belong to GIS features in a different tile but extend to the current tile.
  • GIS_LBL_SEL_MAX_PRECISION - enables labels to be considered for the GIS selection and performs selection with the maximum label precision.

    The layer's settings have precedence over the select_labels parameter. The labels will be considered for selection only for the layers that do not override it by setting their LABEL SELECTION MODE=NONE in the layer's LIF file. If LABEL SELECTION MODE=INTILE, the labels will always be considered using the IN_TILE precision.
Returns

A message object containing information about the selected GIS features.

Refer to the GlmGetSelection section of the GLG Map Server Reference Manual for information on the structure of the returned message object.

◆ GISGetElevation()

GlgDouble GISGetElevation ( String  resource_name,
String  layer_name,
double  lon,
double  lat 
)

Returns an elevation of a lat/lon point on a map.

This method may be used to query elevation at the point selected by the mouse click.

The returned value is in the units (such as meters or feet) defined by the elevation data file.

Parameters
resource_nameThe resource path of a child GIS object to query or null to query the GIS object the method is invoked on.
layer_nameThe name of the layer with elevation data to query.
lon,latThe lon/lat coordinates of a point on the map.
Returns
  • Elevation value if elevation data for the requested lat/lon location exist
  • null if the point is outside of the map in the ORTHOGRAPHIC projection, or if there is no elevation data for the specified location.

◆ GlmConvert()

static void GlmConvert ( GlgProjectionType  projection,
boolean  stretch,
GlgCoordType  coord_type,
boolean  coord_to_lat_lon,
GlgPoint  center,
GlgPoint  extent,
double  angle,
double  min_x,
double  max_x,
double  min_y,
double  max_y,
GlgPoint  in_point,
GlgPoint  out_point 
)
static

A low level method that performs coordinate conversion from the GIS coordinates of a map to the GLG coordinates of the drawing and visa versa without the help of a GLG GIS Object.

Since the method does not rely on a GIS Object being displayed and set up, it may be used before the drawing is rendered, without a drawing at all, or without a GIS object being present.

When converting from X/Y to lat/lon coordinates in the ORTHOGRAPHIC projection, the Z coordinate is set to a negative value for points on the invisible part of the globe or outside the globe area, and to zero for points on the edge of the globe. Coordinates of the returned point may be outside of the visible portion of the map for all projections.

Parameters
projectionA GIS map projection: RECTANGULAR_PROJECTION or ORTHOGRAPHIC_PROJECTION.
stretchSpecifies if the map preserves the X/Y ratio (false) or not (true).
coord_typeThe type of the GLG coordinate system to convert to or from:
coord_to_lat_lon
  • true to convert from GLG coordinates to GIS longitude and latitude
  • false to convert from GIS longitude and latitude to GLG coordinates.
centerGlgPoint containing lat/lon coordinates of the map center. The Z coordinate must be set to 0.
extentGlgPoint containing X and Y extent of the map in the selected projection: in degrees for the RECTANGULAR projection or in meters for ORTHOGRAPHIC. The Z extent must be set to 0. Refer to the GIS Object section on of the GLG User's Guide and Builder Reference Manual for more details.
angleA map rotation angle in degrees.
min_x,max_x,min_y,max_yA map extent in the selected coordinate system. To get X/Y coordinates relative to the map image origin, use min_x=0, min_y=0, max_x=image_width, max_y=image_height.
in_pointGlgPoint containing coordinate values to be converted (x/y in the selected coordinate system or lon/lat).
out_pointGlgPoint that will receive converted coordinate values (x/y in the selected coordinate system or lon/lat).