ALMaSS Rodenticide Model ODdox
1.0
|
The landscape class containing all environmental and topographical data. More...
#include <landscape.h>
Public Member Functions | |
int | BackTranslateEleTypes (TTypesOfLandscapeElement EleReference) |
int | BackTranslateVegTypes (TTypesOfVegetation VegReference) |
void | BuildingDesignationCalc () |
used to calculate whether a building is rural or town - for rodenticide use More... | |
void | CalculateCentroids (void) |
void | CalculateOpenness (bool a_realcalc) |
Causes openness to be calulated and stored for all polygons. More... | |
int | CalulateFieldOpennessAllCells (int a_pref) |
Provides a measure of the shortest distance in 360 degree, e-g- looking NE % SW before tall obstacles are encountered at both ends. Checks all field 1m2. More... | |
int | CalulateFieldOpennessCentroid (int a_pref) |
Provides a measure of the shortest distance in 360 degree, e-g- looking NE % SW before tall obstacles are encountered at both ends. Searches from centroid. More... | |
void | CentroidSpiralOut (int a_polyref, int &a_x, int &a_y) |
void | CentroidSpiralOutBlocks (int a_polyref, int &a_x, int &a_y) |
void | CorrectCoords (int &x, int &y) |
Function to prevent wrap around errors with co-ordinates using x/y pair. More... | |
void | CorrectCoordsPointNoWrap (APoint &a_pt) |
Function to prevent wrap around errors with co-ordinates using a APoint. More... | |
APoint | CorrectCoordsPt (int x, int y) |
Function to prevent wrap around errors with co-ordinates using x/y pair. More... | |
int | CorrectHeight (int y) |
int | CorrectWidth (int x) |
void | DumpAllSymbolsAndExit (const char *a_dumpfile) |
void | DumpCentroids (void) |
void | DumpMapInfoByArea (const char *a_filename, bool a_append, bool a_dump_zero_areas, bool a_write_veg_names) |
void | DumpPublicSymbols (const char *a_dumpfile, CfgSecureLevel a_level) |
void | DumpVegAreaData (int a_day) |
std::string | EventtypeToString (int a_event) |
void | FillVegAreaData () |
double | GetActualGooseGrazingForage (int a_x, int a_y, GooseSpecies a_goose) |
Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by x,y location. More... | |
double | GetActualGooseGrazingForage (int a_polygon, GooseSpecies a_goose) |
Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by x,y location The amount of food avaiable as grazing resource based on the vegetation height is species specific. More... | |
GooseFieldList * | GetGooseFields (double) |
Gets the list of suitable goose foraging fields today. More... | |
int | GetGooseNumbers (int a_poly) |
This returns the number of geese on the polygon the day before. More... | |
int | GetGooseNumbers (int a_x, int a_y) |
This returns the number of geese on the polygon specifed by a_x, a_y the day before. More... | |
double | GetHareFoodQuality (int a_polygon) |
double | GetVegArea (int v) |
void | GrazeVegetation (int a_poly, double a_forage) |
Removes grazing forage from a poly per m2. More... | |
void | GrazeVegetationTotal (int a_poly, double a_forage) |
Removes grazing forage from a poly and divides this out per m2. More... | |
int | HowManyPonds () |
Returns the number of ponds in the landscape. More... | |
void | IncTreatCounter (int a_treat) |
bool | IsFieldType (TTypesOfLandscapeElement a_tole) |
Landscape (const char *a_configfile, const char *a_errorfile) | |
int | LineHighTest (int a_cx, int a_cy, double a_offsetx, double a_offsety) |
Provides a measure of the shortest distance in using a vector from a_cx,a_cy unitl tall obstacles are encountered in both +ve & -ve directions. More... | |
int | MagicMapP2PolyRef (int a_magic) |
std::string | PolytypeToString (TTypesOfLandscapeElement a_le_type) |
void | ReadOpenness (void) |
Reads openness values from a standard input file for all polygons. More... | |
bool | ReadSymbols (const char *a_cfgfile) |
void | RecordGooseNumbers (int a_poly, int a_number) |
This records the number of geese on the polygon the day before. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers() More... | |
void | RecordGooseNumbersTimed (int a_poly, int a_number) |
This records the number of geese on the polygon the day before at a predefined time. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers() More... | |
void | RecordGooseSpNumbers (int a_poly, int a_number, GooseSpecies a_goose) |
This records the number of geese of each species on the polygon the day before. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers() More... | |
void | RecordGooseSpNumbersTimed (int a_poly, int a_number, GooseSpecies a_goose) |
This records the number of geese of each species on the polygon the day before at a predefined time. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers() More... | |
void | RodenticidePredatorsEvaluation (RodenticidePredators_Population_Manager *a_rppm) |
void | SetBirdMaizeForage (int a_polyref, double a_fooddensity) |
Sets the maize forage resource as seen from a goose standpoint at a polygon. More... | |
void | SetBirdSeedForage (int a_polyref, double a_fooddensity) |
Sets the grain forage resource as seen from a goose standpoint at a polygon. More... | |
void | SetLESignal (int a_polyref, LE_Signal a_signal) |
void | SetMaleNewtPresent (int a_InPondIndex) |
Sets a male as being present in a pond. More... | |
void | SetPolyMaxMinExtents (void) |
void | SetThePopManager (Population_Manager *a_ptr) |
Set the pointer to the current main population manager. More... | |
void | SimulationClosingActions () |
void | SkylarkEvaluation (SkTerritories *a_skt) |
bool | SubtractPondLarvalFood (double a_food, int a_polyrefindex) |
Removes larval food from a pond and returns true if it was possible, otherwise false. More... | |
double | SupplyBirdMaizeForage (int a_polyref) |
Returns the maize forage resource. More... | |
double | SupplyBirdMaizeForage (int a_x, int a_y) |
Returns the maize forage resource as seen from a goose standpoint at an x,y location. More... | |
double | SupplyBirdSeedForage (int a_polyref) |
Returns the grain forage resource. More... | |
double | SupplyBirdSeedForage (int a_x, int a_y) |
Returns the grain forage resource as seen from a goose standpoint at an x,y location. More... | |
APoint | SupplyCentroid (int a_polyref) |
APoint | SupplyCentroidIndex (int a_polyrefindex) |
int | SupplyCentroidX (int a_polyref) |
int | SupplyCentroidX (int a_x, int a_y) |
int | SupplyCentroidY (int a_polyref) |
int | SupplyCentroidY (int a_x, int a_y) |
int | SupplyCountryDesig (int a_x, int a_y) |
double | SupplyDayDegrees (int a_polyref) |
int | SupplyDayInMonth (void) |
int | SupplyDayInYear (void) |
int | SupplyDaylength (void) |
int | SupplyDaylength (long a_date) |
double | SupplyDaylightProp () |
double | SupplyDeadBiomass (int a_polyref) |
double | SupplyDeadBiomass (int a_x, int a_y) |
int | SupplyElementSubType (int a_polyref) |
int | SupplyElementSubType (int a_x, int a_y) |
TTypesOfLandscapeElement | SupplyElementType (int a_polyref) |
TTypesOfLandscapeElement | SupplyElementType (int a_x, int a_y) |
TTypesOfLandscapeElement | SupplyElementTypeCC (int a_x, int a_y) |
TTypesOfLandscapeElement | SupplyElementTypeFromVector (unsigned int a_index) |
int | SupplyFarmAnimalCensus (int a_farm_ref, int a_LifeStage) |
int | SupplyFarmArea (int a_polyref) |
int | SupplyFarmIntensity (int a_x, int a_y) |
int | SupplyFarmIntensity (int a_polyref) |
int | SupplyFarmIntensityI (int a_polyindex) |
FarmManager * | SupplyFarmManagerPtr () |
int | SupplyFarmOwner (int a_x, int a_y) |
int | SupplyFarmOwner (int a_polyref) |
int | SupplyFarmOwnerIndex (int a_x, int a_y) |
int | SupplyFarmOwnerIndex (int a_polyref) |
Farm * | SupplyFarmPtr (int a_owner) |
TTypesOfFarm | SupplyFarmType (int a_polyref) |
TTypesOfFarm | SupplyFarmType (int a_x, int a_y) |
long | SupplyGlobalDate (void) |
double | SupplyGlobalRadiation () |
double | SupplyGlobalRadiation (long a_date) |
double | SupplyGooseGrazingForageH (double a_height, GooseSpecies a_goose) |
Returns the leaf forage resource as seen from a goose standpoint at a polygon based on the height only. More... | |
double | SupplyGooseGrazingForageH (int a_polygon, GooseSpecies a_goose) |
Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by number based on height only. More... | |
int | SupplyGrazingPressure (int a_polyref) |
int | SupplyGrazingPressure (int a_x, int a_y) |
int | SupplyGrazingPressureVector (unsigned int a_index) |
double | SupplyGreenBiomass (int a_polyref) |
double | SupplyGreenBiomass (int a_x, int a_y) |
bool | SupplyHasTramlines (int a_x, int a_y) |
bool | SupplyHasTramlines (int a_polyref) |
int | SupplyHour (void) |
Get the hour of the day. More... | |
double | SupplyHumidity (void) |
double | SupplyInsects (int a_polyref) |
double | SupplyInsects (int a_x, int a_y) |
bool | SupplyIsCereal (int a_polyref) |
bool | SupplyIsGrass (int a_polyref) |
bool | SupplyIsMatureCereal (int a_polyref) |
bool | SupplyJustMown (int a_polyref) |
bool | SupplyJustMownVector (unsigned int a_index) |
int | SupplyJustSprayed (int a_polyref) |
int | SupplyJustSprayed (int a_x, int a_y) |
int | SupplyJustSprayedVector (unsigned int a_index) |
double | SupplyLAGreen (int a_polyref) |
double | SupplyLAGreen (int a_x, int a_y) |
polylist * | SupplyLargeOpenFieldsNearXY (int x, int y, int range, int a_openness) |
Returns a pointer to a list of polygonrefs to large open fields within a range of location x,y. More... | |
int | SupplyLargestPolyNumUsed () |
TTypesOfVegetation | SupplyLastSownVeg (int a_polyref) |
TTypesOfVegetation | SupplyLastSownVeg (int a_x, int a_y) |
TTypesOfVegetation | SupplyLastSownVegVector (unsigned int a_index) |
int | SupplyLastTreatment (int a_polyref, int *a_index) |
int | SupplyLastTreatment (int a_x, int a_y, int *a_index) |
double | SupplyLATotal (int a_x, int a_y) |
int | SupplyLECount (void) |
bool | SupplyLEHigh (int a_x, int a_y) |
Tests whether the polygon at a_x,a_y is designated as high. More... | |
int | SupplyLENext (void) |
LE * | SupplyLEPointer (int a_polyref) |
void | SupplyLEReset (void) |
LE_Signal | SupplyLESignal (int a_polyref) |
int * | SupplyMagicMapP (int a_x, int a_y) |
bool | SupplyMaleNewtPresent (int a_InPondIndex) |
Determines if a male is present in a pond. More... | |
double | SupplyMeanTemp (long a_date, unsigned int a_period) |
int | SupplyMinute (void) |
Get the minute of the hour. More... | |
int | SupplyMonth (void) |
double | SupplyNightProp () |
int | SupplyNumberOfFarms () |
unsigned int | SupplyNumberOfPolygons (void) |
int | SupplyOpenness (int a_poly) |
Get openness for a polygon. More... | |
int | SupplyOpenness (int a_x, int a_y) |
Get openness for a location. More... | |
TTypesOfOptFarms | SupplyOptFarmType (int a_x, int a_y) |
double | SupplyPesticide (int a_x, int a_y) |
Gets total pesticide for a location. More... | |
double | SupplyPesticide (int a_polyref) |
Gets total pesticide for the centroid of a polygon. More... | |
int | SupplyPesticideCell (int a_polyref) |
bool | SupplyPesticideDecay () |
Returns true if there is any pesticide in the system at all at this point. More... | |
double | SupplyPesticideP (int a_x, int a_y) |
Gets plant pesticide for a location. More... | |
double | SupplyPesticideP (int a_polyref) |
Gets plant pesticide for the centroid of a polygon. More... | |
double | SupplyPesticideS (int a_x, int a_y) |
Gets soil pesticide for a location. More... | |
double | SupplyPesticideS (int a_polyref) |
Gets soil pesticide for the centroid of a polygon. More... | |
TTypesOfPesticide | SupplyPesticideType (void) |
double | SupplyPolygonArea (int a_polyref) |
double | SupplyPolygonAreaVector (int a_polyref) |
Returns the area of a polygon using the vector index as a reference. More... | |
int | SupplyPolyRef (int a_x, int a_y) |
int | SupplyPolyRefCC (int a_x, int a_y) |
int | SupplyPolyRefIndex (int a_x, int a_y) |
int | SupplyPolyRefVector (unsigned int a_index) |
int | SupplyPondIndex (int a_pondref) |
Returns the index of a pond based on pondref or -1 if not found. More... | |
double | SupplyPondPesticide (int a_poly_index) |
Get the pesticide concentration per liter from a pond (must be a pond index on calling) More... | |
double | SupplyRain (void) |
double | SupplyRain (long a_date) |
double | SupplyRainPeriod (long a_date, int a_period) |
int | SupplyRandomPondIndex () |
Returns random pond index. More... | |
int | SupplyRandomPondRef () |
Returns random pond polyref. More... | |
int | SupplyRoadWidth (int, int) |
double | SupplyRodenticide (int a_x, int a_y) |
Gets total rodenticide for a location. More... | |
RodenticidePredators_Population_Manager * | SupplyRodenticidePredatoryManager () |
bool | SupplyShouldSpray () |
int | SupplySimAreaHeight (void) |
int | SupplySimAreaMaxExtent (void) |
int | SupplySimAreaMinExtent (void) |
int | SupplySimAreaWidth (void) |
bool | SupplySkScrapes (int a_polyref) |
bool | SupplySnowcover (void) |
bool | SupplySnowcover (long a_date) |
double | SupplySnowDepth (void) |
int | SupplySoilType (int a_x, int a_y) |
Returns the soil type in ALMaSS types reference numbers. More... | |
int | SupplySoilTypeR (int a_x, int a_y) |
Returns the soil type in rabbit warren reference numbers. More... | |
double | SupplyTemp (void) |
double | SupplyTemp (long a_date) |
double | SupplyTempPeriod (long a_date, int a_period) |
Population_Manager * | SupplyThePopManager () |
Get the pointer to the current main population manager. More... | |
double | SupplyTrafficLoad (int a_x, int a_y) |
double | SupplyTrafficLoad (int a_polyref) |
int | SupplyTreeAge (int a_Polyref) |
int | SupplyTreeAge (int, int) |
int | SupplyTreeHeight (int, int) |
int | SupplyTreeHeight (int) |
int | SupplyUnderGrowthWidth (int, int) |
int | SupplyUnderGrowthWidth (int) |
int | SupplyValidX (int a_polyref) |
int | SupplyValidY (int a_polyref) |
int | SupplyVegAge (int a_Polyref) |
int | SupplyVegAge (int a_x, int a_y) |
double | SupplyVegBiomass (int a_polyref) |
double | SupplyVegBiomass (int a_x, int a_y) |
double | SupplyVegBiomassVector (unsigned int a_index) |
double | SupplyVegCover (int a_polyref) |
double | SupplyVegCover (int a_x, int a_y) |
double | SupplyVegCoverVector (unsigned int a_index) |
int | SupplyVegDensity (int a_polyref) |
int | SupplyVegDensity (int a_x, int a_y) |
double | SupplyVegDigestability (int a_polyref) |
double | SupplyVegDigestability (int a_x, int a_y) |
double | SupplyVegDigestabilityVector (unsigned int a_index) |
double | SupplyVegHeight (int a_polyref) |
double | SupplyVegHeight (int a_x, int a_y) |
double | SupplyVegHeightVector (unsigned int a_index) |
bool | SupplyVegPatchy (int a_polyref) |
bool | SupplyVegPatchy (int a_x, int a_y) |
int | SupplyVegPhase (int a_poly) |
TTypesOfVegetation | SupplyVegType (int a_x, int a_y) |
TTypesOfVegetation | SupplyVegType (int polyref) |
TTypesOfVegetation | SupplyVegTypeVector (unsigned int a_index) |
const char * | SupplyVersion (void) |
double | SupplyWeedBiomass (int a_polyref) |
double | SupplyWeedBiomass (int a_x, int a_y) |
double | SupplyWind (void) |
double | SupplyWind (long a_date) |
int | SupplyWindDirection (void) |
double | SupplyWindPeriod (long a_date, int a_period) |
int | SupplyYear (void) |
int | SupplyYearNumber (void) |
void | Tick (void) |
TTypesOfLandscapeElement | TranslateEleTypes (int EleReference) |
TTypesOfVegetation | TranslateVegTypes (int VegReference) |
void | TurnTheWorld (void) |
std::string | VegtypeToString (TTypesOfVegetation a_veg) |
void | Warn (std::string a_msg1, std::string a_msg2) |
void | WriteOpenness (void) |
Stores openness for all polygons to a standard file. More... | |
~Landscape (void) | |
Protected Member Functions | |
void | AddBeetleBanks (TTypesOfLandscapeElement a_tole) |
void | AddGreenElement (LE *a_green) |
int | AddToClusterList (int *, int *, int *, int *, int *) |
void | AxisLoop (int a_poly, int *a_x, int *a_y, int a_axis) |
void | AxisLoop (int a_poly, APoint *a_cor, int a_axis) |
void | AxisLoopLtd (int a_poly, APoint *a_cor, int a_axis, int a_limit) |
void | BeetleBankAdd (int x, int y, int angle, int length, LE *a_field, TTypesOfLandscapeElement a_tole) |
bool | BeetleBankPossible (LE *a_field, TTypesOfLandscapeElement a_tole) |
void | BorderAdd (LE *a_field, TTypesOfLandscapeElement a_type) |
bool | BorderNeed (TTypesOfLandscapeElement a_letype) |
void | BorderRemoval (void) |
void | BorderScan (LE *a_field, int a_width) |
bool | BorderStep (int a_fieldpoly, int a_borderpoly, int *a_x, int *a_y) |
bool | BorderStep (int a_fieldpoly, int a_borderpoly, APoint *a_coord) |
bool | BorderTest (int a_fieldpoly, int a_borderpoly, int a_x, int a_y) |
void | ChangeMapMapping (void) |
bool | CIPELandscapeMaker () |
void | ConsolidatePolys (void) |
void | CountMapSquares (void) |
void | CreatePondList () |
Creates a list of pond polygon refs/indexes for easy look up. More... | |
void | DegreesDump () |
Prints the sum of day degrees. See #FarmManager::daydegrees. More... | |
void | DumpMap (const char *a_filename) |
void | DumpMapGraphics (const char *a_filename) |
void | DumpTreatCounters (const char *a_filename) |
void | EventDump (int x, int y, int x2, int y2) |
void | EventDumpPesticides (int x1, int y1) |
bool | FindFieldCenter (LE *a_field, int *x, int *y) |
int | FindLongestAxis (int *x, int *y, int *a_length) |
bool | FindValidXY (int a_field, int &a_x, int &a_y) |
void | ForceArea (void) |
APoint | GetNextSeed (int) |
void | GISASCII_Output (string outpfile, int UTMX, int UTMY) |
Write ASCII file of the ALMaSS map. More... | |
void | hb_Add (void) |
void | hb_AddNewHedgebanks (int a_orig_poly_num) |
void | hb_Cleanup (void) |
void | hb_ClearPolygon (int a_poly_num) |
void | hb_DownPolyNumbers (void) |
bool | hb_FindBoundingBox (int a_poly_num) |
void | hb_FindHedges (void) |
void | hb_GenerateHBPolys (void) |
bool | hb_HasNeighbourColor (int a_x, int a_y, int a_neighbour_color) |
bool | hb_HasOtherNeighbour (int a_x, int a_y) |
bool | hb_MapBorder (int a_x, int a_y) |
void | hb_MarkTheBresenhamWay (void) |
void | hb_MarkTopFromLocalMax (int a_color) |
int | hb_MaxUnpaintedNegNeighbour (int a_x, int a_y) |
void | hb_PaintBorder (int a_color) |
bool | hb_PaintWhoHasNeighbourColor (int a_neighbour_color, int a_new_color) |
void | hb_ResetColorBits (void) |
void | hb_RestoreHedgeCore (int a_orig_poly_number) |
int | hb_StripingDist (void) |
void | hb_UpPolyNumbers (void) |
void | MakeCluster (void) |
Reset all polygons natural grazing level to zero. More... | |
void | ModifyPolyRef (int *) |
LE * | NewElement (TTypesOfLandscapeElement a_type) |
void | PolysDump (const char *a_filename) |
void | PolysRemoveInvalid (void) |
void | PolysRenumber (void) |
void | PolysValidate (bool a_exit_on_invalid) |
APoint | RandomLocation (void) |
void | ReadInput (int *, int *, int *, APoint *) |
void | ReadPolys (const char *a_polyfile) |
void | ReadPolys2 (const char *a_polyfile) |
reads in polygon information. Version 2 including centroid and openness information More... | |
void | RebuildPolyMapping () |
void | RemoveMissingValues () |
A method for replacing missing values in the map with corrected ones - slow. More... | |
int | RemoveSmallPolygons (void) |
Removes small polygons from the map. More... | |
bool | StepOneValid (int a_polyindex, int a_x, int a_y, int step) |
void | TestCropManagement (void) |
bool | UMarginTest (int a_fieldpoly, int a_borderpoly, int a_x, int a_y, int a_width) |
void | UnsprayedMarginAdd (LE *a_field) |
void | UnsprayedMarginScan (LE *a_field, int a_width) |
void | VegDump (int x, int y) |
Protected Attributes | |
int | hb_border_pixels |
int | hb_core_pixels |
int | hb_first_free_poly_num |
vector< int > | hb_hedges |
int | hb_height |
int * | hb_map |
int | hb_max_x |
int | hb_max_y |
int | hb_min_x |
int | hb_min_y |
vector< LE * > | hb_new_hbs |
int | hb_size |
int | hb_width |
int | le_signal_index |
int | m_LargestPolyNumUsed |
TTypesOfPesticide | m_PesticideType |
An attribute to hold the pesticide type being tested, if there is one, if not default is -1. More... | |
vector< int > | m_PondIndexList |
List of pond indexes. More... | |
vector< int > | m_PondRefsList |
List of pond polyrefs. More... | |
bool | m_toxShouldSpray |
int | m_treatment_counts [last_treatment] |
int | m_x_add [8] |
int | m_y_add [8] |
Private Attributes | |
double * | l_vegtype_areas |
bool | m_DoMissingPolygonsManipulations |
vector< LE * > | m_elems |
List of all landscape elements. The index is a sequential number, to get the polynum look this number up in m_polymapping. More... | |
FarmManager * | m_FarmManager |
List of all the farms. More... | |
Polynomial2CurveClass * | m_GooseIntakeRateVSVegetationHeight_BG |
Polynomial2CurveClass * | m_GooseIntakeRateVSVegetationHeight_GL |
Polynomial2CurveClass * | m_GooseIntakeRateVSVegetationHeight_PF |
Curve relatning goose intake rates in KJ/min to vegetation height. More... | |
int | m_height |
int | m_height10 |
RasterMap * | m_land |
The big map. More... | |
int | m_maxextent |
bool | m_NeedCentroidCalculation |
a flag to ensure centroid calculation on object construction More... | |
bool | m_NeedOpennessCalculation |
a flag to ensure openness calculation on object construction More... | |
RodenticideManager * | m_RodenticideManager |
RodenticidePredators_Population_Manager * | m_RodenticidePreds |
Population_Manager * | m_ThePopManager |
a pointer to the current main population manager More... | |
char | m_versioninfo [30] |
int | m_width |
int | m_width10 |
The landscape class containing all environmental and topographical data.
Landscape::~Landscape | ( | void | ) |
References cfg_rodenticide_enable(), g_letype, g_pest, l_map_dump_treatcounts_enable(), and l_map_dump_treatcounts_file().
Landscape::Landscape | ( | const char * | a_configfile, |
const char * | a_errorfile | ||
) |
If the farmer decision making model is on, the #FarmManager::InitFarms() is called here to initialise the farms. The #FarmManager::FindNeighbours() function is called.
Next job after checking the basic map validity is to deal with any missing polygon information This is done by identifying the polygons that are large contiguous areas and making them wasteland. The rest are left and nibbled away to join adjacent polygons. This is a time consuming operation so is only done if there have been any missing info polygons found.
To be sure we have enough space to do map manipulations if required, then the polygons need to be renumbered - unless they are done already.
Rodenticide handling code. If enabled then rodenticide mapping provides access to predicted relative density of poisoned rodents per unit area.
References cfg_AddBeetleBanks(), cfg_BeetleBankType(), cfg_dumpvegjan(), cfg_dumpvegjanfile(), cfg_dumpvegjune(), cfg_dumpvegjunefile(), cfg_HedgeSubtypeMaximum(), cfg_HedgeSubtypeMinimum(), cfg_MaxPondSize(), cfg_pesticidetesttype(), cfg_rodenticide_enable(), LE::DoCopy(), g_letype, g_pest, l_map_art_hedgebanks(), l_map_ascii_utm_x(), l_map_ascii_utm_y(), l_map_calc_openness(), l_map_consolidatepolys(), l_map_cropcurves_file(), l_map_dump_enable(), l_map_dump_event_enable(), l_map_dump_gfx_enable(), l_map_dump_gfx_file(), l_map_dump_map_file(), l_map_dump_poly_file(), l_map_dump_veg_enable(), l_map_map_file(), l_map_no_pesticide_fields(), l_map_poly_file(), l_map_print_version_info(), l_map_removesmallpolygons(), l_map_weather_file(), l_map_write_ascii(), random(), LE::SetALMaSSEleType(), LE::SetArea(), LE::SetCentroid(), LE::SetElementType(), LE::SetOpenness(), LE::SetPoly(), LE::SetSoilType(), and LE::SetUnsprayedMarginPolyRef().
|
protected |
Beetle-bank addition - tests whether we can add a bank to this field, and then decides where to put it an adds it.
For each element, if it is a field then assess whether should have a beetle bank. This will depend on whether it is in the region defined for adding the bank, and a probability. This code requires polygon centroids to be active, either calculated or via l_map_read_openness == true.
To provide for more flexibilty, a tole_type is passed, and beetlebanks may be created of this tole_type instead of tole_BeetleBank
References cfg_BeetleBankChance(), cfg_BeetleBankInvert(), cfg_BeetleBankMaxX(), cfg_BeetleBankMaxY(), cfg_BeetleBankMinX(), cfg_BeetleBankMinY(), and random().
|
protected |
Starting at a_x,a_y each location is tested along a vector given by m_x_add & m_y_add until we step outside the polygon. a_x & a_y are modified on return.
Starting at a_x,a_y each location is tested along a vector given by m_x_add & m_y_add until we step outside the polygon. a_x & a_y are modified on return.
References APoint::m_x, and APoint::m_y.
Starting at a_x,a_y each location is tested along a vector given by m_x_add & m_y_add until we step outside the polygon. a_x & a_y are modified on return.
References APoint::m_x, and APoint::m_y.
|
inline |
References LE_TypeClass::BackTranslateEleTypes(), and g_letype.
|
inline |
References LE_TypeClass::BackTranslateVegTypes(), and g_letype.
|
protected |
References LE::AddArea(), LE_TypeClass::BackTranslateEleTypes(), cfg_BeetleBankWidth(), g_letype, LE::SetALMaSSEleType(), LE::SetArea(), LE::SetMapValid(), LE::SetPoly(), LE::SetValidXY(), and LE::SetVegPatchy().
|
protected |
Beetle bank placement rules are:
No bank if the total bank area is going to be >=5% of the field area
No bank if the field is < 1Ha
No bank if the breadth of the field is < 100m
References cfg_BeetleBankMaxArea(), cfg_BeetleBankWidth(), LE::GetArea(), LE::GetCentroidX(), and LE::GetCentroidY().
|
protected |
References LE::GetValidX(), LE::GetValidY(), LE::SetArea(), LE::SetBorder(), and LE::SetPoly().
|
protected |
|
protected |
Requires centroid calculation before calling this method. Centroids must be inside the polygon and valid.
Loop through this procedure the width of the margin times. Each time a dummy margin is added using polyref=-99 and all locations this is done are remembered. Then later all positions covered by -99 are replaced with the real polygon index.
References LE::AddArea(), LE::GetArea(), LE::GetBorder(), LE::GetCentroidX(), LE::GetCentroidY(), LE::GetPoly(), l_map_exit_on_zero_area(), random(), and LE::SetMapValid().
References APoint::m_x, and APoint::m_y.
void Landscape::BuildingDesignationCalc | ( | ) |
used to calculate whether a building is rural or town - for rodenticide use
Runs through all elements and identifies the ones where rodenticide bait may be placed. If it is a building then we count the number of buildings near to it and designate it town if there are more than cfg_mintownbuildingnumber.
References cfg_mintownbuildingdistance(), and cfg_mintownbuildingnumber().
void Landscape::CalculateCentroids | ( | void | ) |
Finds a location inside each polygon as a roughly calculated centre point. The point will be within the polygon. This also uses the stored Max/Min coordinates for each polygon that form a rectangle around it.
void Landscape::CalculateOpenness | ( | bool | a_realcalc | ) |
Causes openness to be calulated and stored for all polygons.
First must calculate centroid. Runs through the list of elements and any that are marsh, field, or pasture will have an openness score calculated
Provides a measure of the shortest distance in 360 degree, e-g- looking NE % SW before tall obstacles are encountered at both ends. Checks all field 1m2.
Starts with North West and moves round the points of the compass 180 degrees. For each point tested we want the minimum length found, but between points we are interested in the max
runs a line out and also in 180 degrees, two lines.
runs a line out and also in 180 degrees, two lines.
Provides a measure of the shortest distance in 360 degree, e-g- looking NE % SW before tall obstacles are encountered at both ends. Searches from centroid.
Starts with North West and moves round the points of the compass 180 degrees.
runs a line out and also in 180 degrees, two lines.
runs a line out and also in 180 degrees, two lines.
References APoint::m_x, and APoint::m_y.
|
protected |
Our map is an array of polygon indentifiers, where we really want to know the associated landscape element of a X-Y coordinate pair.
Changing this to m_elems[] indices will save us one redirection when inquiring information from the landscape, and only costs us the fixed translation step performed here at startup.
|
protected |
|
protected |
Runs through the map checking each cell for polygon type. If it is in our replace list then it re-written as the first instance of that polygon type encountered. All subsequent instances of that type are then deleted.
replaceList contains the types of all tole types with no behaviour that can be consolidated. This list needs to be kept up-to-date.
Function to prevent wrap around errors with co-ordinates using x/y pair.
m_width10 & m_height10 are used to avoid problems with co-ordinate values that are very large. Problems will only occur if coords passed are >10x the world width or height.
|
inline |
Function to prevent wrap around errors with co-ordinates using a APoint.
This just cuts off extremes of coordinate values so that the point stays in landscape. Can't use a modulus or we get wrap around, and in this case we don't want that
References APoint::m_x, and APoint::m_y.
Function to prevent wrap around errors with co-ordinates using x/y pair.
m_width10 & m_height10 are used to avoid problems with co-ordinate values that are very large. Problems will only occur if coords passed are >10x the world width or height.
References APoint::m_x, and APoint::m_y.
|
protected |
|
protected |
Creates a list of pond polygon refs/indexes for easy look up.
Just creates an unordered list of polyref numbers and m_elems indices for all ponds. This is for easy look-up by e.g. newts
|
protected |
Prints the sum of day degrees. See #FarmManager::daydegrees.
|
inline |
void Landscape::DumpCentroids | ( | void | ) |
|
protected |
|
protected |
void Landscape::DumpMapInfoByArea | ( | const char * | a_filename, |
bool | a_append, | ||
bool | a_dump_zero_areas, | ||
bool | a_write_veg_names | ||
) |
|
inline |
|
protected |
void Landscape::DumpVegAreaData | ( | int | a_day | ) |
References cfg_dumpvegjan(), cfg_dumpvegjanfile(), cfg_dumpvegjune(), and cfg_dumpvegjunefile().
Referenced by RunTheSim().
std::string Landscape::EventtypeToString | ( | int | a_event | ) |
void Landscape::FillVegAreaData | ( | ) |
References LE::GetPoly().
|
protected |
Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by x,y location.
a_x | [in] The x-coordinate in a polygon we are interested in (assumed grass or cereals). This needs to be checked before calling |
a_y | [in] The x-coordinate in a polygon we are interested in (assumed grass or cereals). This needs to be checked before calling |
a_goose | [in] Is the type of goose calling which is needed to determine how to assess the value of the current forage availability (ie its different for different types of geese) |
|
inline |
Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by x,y location The amount of food avaiable as grazing resource based on the vegetation height is species specific.
a_polygon | [in] The polygon refence number for the polygon we are interested in (assumed grass or cereals). This needs to be checked before calling |
a_goose | [in] Is the type of goose calling which is needed to determine how to assess the value of the current forage availability (ie its different for different types of geese) |
GooseFieldList * Landscape::GetGooseFields | ( | double | a_minopenness | ) |
Gets the list of suitable goose foraging fields today.
Here we need to go through all possible goose feeding locations to find out if they have any forage in them, and then create a list of those to return.
To make this efficient we need to have a list of fields.
First must calculate centroid. Runs through the list of elements and any that have an openness score bigger than our target are saved.
References GooseFieldListItem::digestability, GooseFieldListItem::geese, GooseFieldListItem::geesesp, GooseFieldListItem::geesespTimed, GooseFieldListItem::geeseTimed, GooseFieldListItem::grain, GooseFieldListItem::grass, GooseFieldListItem::lastsownveg, GooseFieldListItem::maize, GooseFieldListItem::openness, GooseFieldListItem::polyref, GooseFieldListItem::previouscrop, GooseFieldListItem::vegheight, GooseFieldListItem::vegphase, GooseFieldListItem::vegtype, and GooseFieldListItem::vegtypechr.
This returns the number of geese on the polygon the day before.
This returns the number of geese on the polygon specifed by a_x, a_y the day before.
This returns the number of geese on the polygon the day before.
double Landscape::GetHareFoodQuality | ( | int | a_polygon | ) |
References g_FarmIntensivenessH.
|
inline |
References DumpVegAreaData().
Write ASCII file of the ALMaSS map.
Here we write a ASCII file of the current map. Useful when visualizing output from simulations. The function will output the entity that is defined in the config: l_map_ascii_map_entity. The default is polyref number (l_map_ascii_map_entity = 1).
[in] | outpfile | Name of the output file |
[in] | UTMX | Utm x-coordinate of the lower lefthand corner of the map |
[in] | UTMY | Utm y-coordinate of the lower lefthand corner of the map |
References l_map_ascii_map_entity().
|
inline |
Removes grazing forage from a poly per m2.
|
inline |
Removes grazing forage from a poly and divides this out per m2.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
Returns the number of ponds in the landscape.
void Landscape::IncTreatCounter | ( | int | a_treat | ) |
Referenced by LE::SetLastTreatment().
|
inline |
Provides a measure of the shortest distance in using a vector from a_cx,a_cy unitl tall obstacles are encountered in both +ve & -ve directions.
Will only stop when two consecutive squares return 'high'.
The criteria for threat or non-open are based on geese and include tall objects and roads
|
protected |
Reset all polygons natural grazing level to zero.
Inc volegrazing at x,y Get volegrazing at x,y Calculate all vole grazing densities
|
protected |
|
protected |
References LE::SetALMaSSEleType(), and LE::SetElementType().
|
protected |
|
protected |
PolysValidate or ChangeMapMapping must be called after this method
|
protected |
|
protected |
std::string Landscape::PolytypeToString | ( | TTypesOfLandscapeElement | a_le_type | ) |
|
protected |
void Landscape::ReadOpenness | ( | void | ) |
Reads openness values from a standard input file for all polygons.
|
protected |
|
protected |
reads in polygon information. Version 2 including centroid and openness information
The polygon file consists of 9 columns:
As of December 2014 there is a header row of information to be skipped here
As of July 2013 we have the need to use really big maps, hence polygon reference numbers need to be kept within reasonable bounds. It is now a requirement that any polyref number is < twice the total number of polygons in the file.
This is a quick way to replace one type with another for some simulations, polygon type 150 therefore has some special uses
With the polygons renumbered, we can safely set the hb_first_free_poly_num to the number of polygons we have.
References g_letype, LE::GetElementType(), l_map_chameleon_replace_num(), random(), LE::SetALMaSSEleType(), LE::SetArea(), LE::SetBorder(), LE::SetCentroid(), LE::SetOpenness(), LE::SetPoly(), LE::SetSoilType(), LE::SetUnsprayedMarginPolyRef(), and LE_TypeClass::TranslateEleTypes().
|
inline |
|
inlineprotected |
This records the number of geese on the polygon the day before. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
This records the number of geese on the polygon the day before. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
Note that the record is the for the day before because this method is called by DoFirst, so there are no geese today
This records the number of geese on the polygon the day before at a predefined time. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
This records the number of geese on the polygon the day before at a predefined time. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
This records the number of geese of each species on the polygon the day before. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
This records the number of geese on the polygon the day before by species. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
Note that the record is the for the day before because this method is called by DoFirst, so there are no geese today
This records the number of geese of each species on the polygon the day before at a predefined time. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
This records the number of geese on the polygon the day before at a predefined time by species. To prevent lots of unnecessary clearing of values two values are saved, the number and simulation day - on reading the simulation day number can be used to modify the return value - see GetGooseNumbers()
|
protected |
A method for replacing missing values in the map with corrected ones - slow.
|
protected |
Removes small polygons from the map.
The method removes small polygons from the map and joins them with polygons that are close too them - there different rules depending on the type of polygon we have. Some small polygons can be legal, others need something done. Field polygons with management also have some minimum restrictions which are different from normal polygons.
This method is not written for efficiency, so simple brute force approaches are taken - it will take time to execute.
Rules:
References APoint::m_x, and APoint::m_y.
void Landscape::RodenticidePredatorsEvaluation | ( | RodenticidePredators_Population_Manager * | a_rppm | ) |
References RodenticidePredators_Population_Manager::PreCachePoly().
Referenced by RodenticidePredators_Population_Manager::CreatHabitatQualGrid().
|
inline |
Sets the maize forage resource as seen from a goose standpoint at a polygon.
|
inline |
Sets the grain forage resource as seen from a goose standpoint at a polygon.
|
inline |
Sets a male as being present in a pond.
void Landscape::SetPolyMaxMinExtents | ( | void | ) |
|
inline |
Set the pointer to the current main population manager.
Referenced by main().
void Landscape::SimulationClosingActions | ( | ) |
These are the things that are needed to be done after the simulation ends, but before landscape objects are deleted.
Referenced by CloseDownSim().
void Landscape::SkylarkEvaluation | ( | SkTerritories * | a_skt | ) |
bool Landscape::SubtractPondLarvalFood | ( | double | a_food, |
int | a_polyrefindex | ||
) |
Removes larval food from a pond and returns true if it was possible, otherwise false.
|
inline |
Returns the maize forage resource.
Returns the maize forage resource as seen from a goose standpoint at an x,y location.
|
inline |
Returns the grain forage resource.
Returns the grain forage resource as seen from a goose standpoint at an x,y location.
References GooseFieldListItem::polyref.
|
inline |
|
inline |
Referenced by RunTheSim().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by RodenticidePredators_Population_Manager::EvaluatePoly(), and MovementMap::Init().
|
inline |
Referenced by VegElement::DoDevelopment(), and VegElement::RecalculateBugsNStuff().
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by VegElement::RecalculateBugsNStuff().
|
inline |
|
inline |
Returns the leaf forage resource as seen from a goose standpoint at a polygon based on the height only.
a_height | [in] The vegetation height (assumed grass or cereals). This needs to be checked before calling |
a_goose | [in] Is the type of goose calling which is needed to determine how to assess the value of the current forage availability (ie its different for different types of geese) |
Referenced by VegElement::RecalculateBugsNStuff().
|
inline |
Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by number based on height only.
a_polygon | [in] The polygon refence number for the polygon we are interested in (assumed grass or cereals). This needs to be checked before calling |
a_goose | [in] Is the type of goose calling which is needed to determine how to assess the value of the current forage availability (ie its different for different types of geese) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns a pointer to a list of polygonrefs to large open fields within a range of location x,y.
There is a limit of 1000 polygons to return. There are probably more speed efficient ways to do this, but the simplest is to simply trawl through the list of polygons and pull out each polygon with an openness score > a_openness - then see if the centroid is within range. NB calling method must delete the polylist* passed back!
18/12/2013 this method has been rendered obselete by changes to hunters referring to famers rather than a co-ordinate and range.
Calculates distance from location a_x, a_y. This is done using an approximation to pythagorus to avoid a speed problem.
NB this will crash if either a_dy or a_dx are zero!
References APoint::m_x, and APoint::m_y.
|
inline |
|
inline |
|
inline |
int Landscape::SupplyLECount | ( | void | ) |
Tests whether the polygon at a_x,a_y is designated as high.
int Landscape::SupplyLENext | ( | void | ) |
Referenced by Field::DoDevelopment(), and UnsprayedMarginScan().
void Landscape::SupplyLEReset | ( | void | ) |
|
inline |
Determines if a male is present in a pond.
|
inline |
|
inline |
|
inline |
Referenced by RunTheSim().
|
inline |
References g_map.
|
inline |
|
inline |
Get openness for a polygon.
Get openness for a location.
Gets total pesticide for a location.
References g_pest.
Referenced by Pond::CalcPondPesticide().
double Landscape::SupplyPesticide | ( | int | a_polyref | ) |
Gets total pesticide for the centroid of a polygon.
References g_pest.
bool Landscape::SupplyPesticideDecay | ( | ) |
double Landscape::SupplyPesticideP | ( | int | a_polyref | ) |
Gets plant pesticide for the centroid of a polygon.
References g_pest.
double Landscape::SupplyPesticideS | ( | int | a_polyref | ) |
Gets soil pesticide for the centroid of a polygon.
References g_pest.
|
inline |
|
inline |
|
inline |
Returns the area of a polygon using the vector index as a reference.
Referenced by Pond::CalcPondPesticide(), and RodenticidePredators_Population_Manager::CreatHabitatQualGrid().
Returns the index of a pond based on pondref or -1 if not found.
|
inline |
Get the pesticide concentration per liter from a pond (must be a pond index on calling)
References SupplyPondPesticide().
Referenced by SupplyPondPesticide().
|
inline |
|
inline |
int Landscape::SupplyRandomPondIndex | ( | ) |
Returns random pond index.
References g_rand_uni().
int Landscape::SupplyRandomPondRef | ( | ) |
Returns random pond polyref.
References g_rand_uni().
Gets total rodenticide for a location.
References cfg_rodenticide_enable().
|
inline |
|
inline |
Referenced by Orchard::DoDevelopment(), and OrchardBand::DoDevelopment().
|
inline |
|
inline |
int Landscape::SupplySimAreaMinExtent | ( | void | ) |
|
inline |
Referenced by TAnimal::CorrectWrapRound(), RodenticidePredators_Population_Manager::CreatHabitatQualGrid(), IDMap< TAnimal * >::IDMap(), IDMapScaled::IDMapScaled(), MovementMap::Init(), MovementMap16::Init(), MovementMap::MovementMap(), MovementMap16::MovementMap16(), and RodenticideManager::RodenticideManager().
|
inline |
|
inline |
|
inline |
Returns the soil type in ALMaSS types reference numbers.
Returns the soil type in rabbit warren reference numbers.
|
inline |
Referenced by VegElement::RecalculateBugsNStuff().
|
inline |
|
inline |
|
inline |
Get the pointer to the current main population manager.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
void Landscape::Tick | ( | void | ) |
If the farmer decision making model is on, the function:
References cfg_productapplicendyear(), cfg_productapplicstartyear(), cfg_rodenticide_enable(), g_pest, g_rand_uni(), l_map_dump_event_enable(), l_map_dump_event_x1(), l_map_dump_event_y1(), l_map_dump_veg_enable(), l_map_dump_veg_x(), and l_map_dump_veg_y().
|
inline |
References g_letype, and LE_TypeClass::TranslateEleTypes().
|
inline |
References g_letype, and LE_TypeClass::TranslateVegTypes().
|
inline |
Referenced by RunTheSim().
|
protected |
|
protected |
References LE::GetValidX(), LE::GetValidY(), l_map_umargin_width(), LE::SetArea(), LE::SetPoly(), and LE::SetUnsprayedMarginPolyRef().
References LE::AddArea(), LE::GetPoly(), LE::GetUnsprayedMarginPolyRef(), LE::GetValidX(), LE::GetValidY(), and SupplyLEPointer().
std::string Landscape::VegtypeToString | ( | TTypesOfVegetation | a_veg | ) |
|
inline |
Referenced by GetProbeInput_ini(), and RodenticidePredators_Population_Manager::ReadHabitatValues().
void Landscape::WriteOpenness | ( | void | ) |
Stores openness for all polygons to a standard file.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
private |
Flag to signal that missing polygons exist
|
private |
List of all landscape elements. The index is a sequential number, to get the polynum look this number up in m_polymapping.
|
private |
List of all the farms.
|
private |
|
private |
|
private |
Curve relatning goose intake rates in KJ/min to vegetation height.
|
private |
|
private |
|
private |
The big map.
|
protected |
|
private |
|
private |
a flag to ensure centroid calculation on object construction
|
private |
a flag to ensure openness calculation on object construction
|
protected |
An attribute to hold the pesticide type being tested, if there is one, if not default is -1.
|
protected |
List of pond indexes.
|
protected |
List of pond polyrefs.
|
private |
|
private |
|
private |
a pointer to the current main population manager
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
protected |
|
protected |