Unigine.Plugins.IG.Region Class
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to- Sim
SDK edition to use it.
You should upgrade to
This class is used to manage weather regions for the IG. Each region contains one or multiple layers each comprising a vertical profile. The main layer always exists in the region and cannot be deleted. It is a base layer used to define weather parameters for the region, such as visibility range, temperature, humidity, etc.
IG plugin must be loaded.
There are three types of weather regions available:
- Global - representing atmospheric layers, which have no distinct horizontal boundaries. Atmospheric effects are observed anywhere within the vertical range.
- Local Rectangle - they have the same set of parameters (visibility, coverage, wind) as Global ones but atmospheric effects for them are restricted to a certain area defined by a rectangle.
- Local Polygon - they have the same set of parameters (visibility, coverage, wind) as Global ones but atmospheric effects for them are restricted to a certain area defined by a polygon.
Global meteo conditions are managed via the Meteo class.
Region Class
Enums
REGION_TYPE#
Properties
float Rotation#
The angle of rotation of the weather region around the Z axis.
dvec2 WorldPosition#
The world coordinates of the weather region's position.
double TransitionSize#
The width of the transition area around the borders of the weather region. The effects of the region fade out gradually within this area.
double ShapeRectangleRadius#
The corner radius of the rectangle. This parameter defines the shape of a rounded rectangle.
dvec2 ShapeSize#
The size of the rectangle that defines or encloses the shape of the weather region as a two-component vector.
int NumLayers#
The total number of layers of the region.
WeatherLayer MainLayer#
The main weather layer of the region. It is a base layer, that is used to define weather parameters, such as visibility range, temperature, humidity, etc. The main layer always exists in the region and cannot be deleted.
bool Enabled#
The value indicating if the weather region is currently enabled.
long ID#
The ID of the region.
Members
WeatherLayer * CreateLayer ( long layer_id, WeatherLayerType type ) #
Creates a new weather layer for the region. In case a layer with the specified ID exists and has a different type, it will be replaced with the new one.Arguments
- long layer_id - ID of the layer to be created.
- WeatherLayerType type - Type of the layer to be created, one of the following values:
- Plugins::IG::WeatherLayerType::LAYER_BASE - base layer.
- Plugins::IG::WeatherLayerType::LAYER_CLOUD - cloud layer.
- Plugins::IG::WeatherLayerType::LAYER_PRECIPITATION - precipitation layer.
Return value
New weather layer if it is created successfully; otherwise, nullptr.WeatherLayer GetLayer ( long layer_id ) #
Returns a weather layer by its ID.Arguments
- long layer_id - Weather layer ID.
Return value
Weather layer with the specified ID if it exists, otherwise nullptr.bool RemoveLayer ( long layer_id ) #
Removes a weather layer with the specified ID.Arguments
- long layer_id - Weather layer ID.
Return value
true if the weather layer is created successfully; otherwise, false.void findWeatherLayers ( vec3 geo_pos, Vector<MeteoPositionParam>& vector ) #
Returns the list of all layers (base, clouds, precipitation) of the weather region containing the specified position (and thus affecting it) along with their corresponding impact factors (as MeteoPositionParam structure).Arguments
- vec3 geo_pos - Geocoordinates of the point for which all affecting layers are to be found.
- Vector<MeteoPositionParam>& vector - The list of all layers in the weather region containing the specified position (and thus affecting it) along with their corresponding impact factors (as MeteoPositionParam structure).
bool SetShapeAsRectangle ( dvec2 size, double corner_radius = 0 ) #
Sets the shape of a rectangle weather region using the specified width, height, and corner radius.Arguments
- dvec2 size - Vector combining width and height of the rectangle, in units (W, H).
- double corner_radius - Corner radius of the rectangle, in units. This parameter enables you to create a rounded rectangle.This value cannot be greater than half size.
Return value
true if the shape of the region is set successfully; otherwise, false.bool SetShapeAsPolygon ( vec2[] points, ushort[] indices ) #
Sets the shape of a polygon weather region using the specified sets of vertex coordinates and their indices.Arguments
- vec2[] points - Array of polygon vertex coordinates.
- ushort[] indices - Array of vertex indices defining a polygon.
Return value
true if the shape of the region is set successfully; otherwise, false.bool SetShapeAsPolygon ( dvec2[] geo_points ) #
Sets the shape of a polygon weather region as a set of geocoordinates of points.Arguments
- dvec2[] geo_points - Array of geocoordinates of points forming a polygon.
Return value
true if the shape of the region is set successfully; otherwise, false.void SetGeoPosition ( dvec2 geo_pos ) #
Sets new geocoordinates for the weather region's position.Arguments
- dvec2 geo_pos - Geocoordinates of the weather region's position (Lat, Lon).
float GetImpact ( dvec2 world_pos ) #
Returns a value indicating the degree of impact of the region at the specified point depending on whether it is completely inside, outside, or somewhere within the transition area.Arguments
- dvec2 world_pos - World coordinates (Cartesian) of the point to be ckecked.
Return value
Value indicating the degree of impact of the region at the specified point:- 0 - completely outside the region (and transition area)
- 1 - inside the region
- (0 < x < 1) - within the transition area
Last update:
2022-10-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)