ALMaSS Rabbit ODdox  1.1
The rabbit model description following ODdox protocol
Landscape Class Reference

The landscape class containing all environmental and topographical data. More...

#include <landscape.h>

Public Member Functions

void FillVegAreaData ()
 
double GetVegArea (int v)
 
void DumpVegAreaData (int a_day)
 
void SkylarkEvaluation (SkTerritories *a_skt)
 
void RodenticidePredatorsEvaluation (RodenticidePredators_Population_Manager *a_rppm)
 
Population_ManagerSupplyThePopManager ()
 Get the pointer to the current main population manager. More...
 
void SetThePopManager (Population_Manager *a_ptr)
 Set the pointer to the current main population manager. More...
 
int SupplyFarmAnimalCensus (int a_farm_ref, int a_LifeStage)
 
int SupplyVegPhase (int a_poly)
 
void SetPolymapping (int a_index, int a_val)
 
int GetPolymapping (int a_index)
 
 ~Landscape (void)
 
 Landscape (void)
 
void SimulationClosingActions ()
 
void Tick (void)
 
void TurnTheWorld (void)
 
int HowManyPonds ()
 Returns the number of ponds in the landscape. More...
 
int SupplyRandomPondIndex ()
 Returns random pond index. More...
 
int SupplyRandomPondRef ()
 Returns random pond polyref. More...
 
int SupplyPondIndex (int a_pondref)
 Returns the index of a pond based on pondref or -1 if not found. More...
 
void SetMaleNewtPresent (int a_InPondIndex)
 Sets a male as being present in a pond. More...
 
bool SupplyMaleNewtPresent (int a_InPondIndex)
 Determines if a male is present in a pond. More...
 
FarmSupplyFarmPtr (int a_owner)
 
FarmManagerSupplyFarmManagerPtr ()
 
int SupplyLargestPolyNumUsed ()
 
bool SupplyShouldSpray ()
 
double SupplyVegDigestabilityVector (unsigned int a_index)
 
double SupplyVegDigestability (int a_polyref)
 
double SupplyVegDigestability (int a_x, int a_y)
 
double SupplyVegHeightVector (unsigned int a_index)
 
double SupplyVegHeight (int a_polyref)
 
double SupplyVegHeight (int a_x, int a_y)
 
double SupplyVegBiomassVector (unsigned int a_index)
 
double SupplyVegBiomass (int a_polyref)
 
double SupplyVegBiomass (int a_x, int a_y)
 
int SupplyVegDensity (int a_polyref)
 
int SupplyVegDensity (int a_x, int a_y)
 
double SupplyWeedBiomass (int a_polyref)
 
double SupplyWeedBiomass (int a_x, int a_y)
 
PollenNectarQuality SupplyPollen (int a_polyref)
 
PollenNectarQuality SupplyPollen (int a_x, int a_y)
 
double SupplyTotalPollen (int a_polyref)
 
double SupplyTotalPollen (int a_x, int a_y)
 
PollenNectarQuality SupplyNectar (int a_polyref)
 
PollenNectarQuality SupplyNectar (int a_x, int a_y)
 
double SupplyTotalNectar (int a_polyref)
 
double SupplyTotalNectar (int a_x, int a_y)
 
bool SupplySkScrapes (int a_polyref)
 
bool SupplyVegPatchy (int a_polyref)
 
bool SupplyVegPatchy (int a_x, int a_y)
 
double SupplyGreenBiomass (int a_polyref)
 
double SupplyGreenBiomass (int a_x, int a_y)
 
double SupplyDeadBiomass (int a_polyref)
 
double SupplyDeadBiomass (int a_x, int a_y)
 
double SupplyLAGreen (int a_polyref)
 
double SupplyLAGreen (int a_x, int a_y)
 
double SupplyLATotal (int a_x, int a_y)
 
double SupplyVegCover (int a_polyref)
 
double SupplyVegCoverVector (unsigned int a_index)
 
double SupplyVegCover (int a_x, int a_y)
 
TTypesOfVegetation SupplyLastSownVeg (int a_polyref)
 
TTypesOfVegetation SupplyLastSownVeg (int a_x, int a_y)
 
TTypesOfVegetation SupplyLastSownVegVector (unsigned int a_index)
 
double SupplyInsects (int a_polyref)
 
double SupplyInsects (int a_x, int a_y)
 
bool SubtractPondLarvalFood (double a_food, int a_polyrefindex)
 Removes larval food from a pond and returns true if it was possible, otherwise false. More...
 
void CheckForPesticideRecord (LE *a_field, TTypesOfPesticideCategory a_pcide)
 Check if needed and record pesticide application. More...
 
double SupplyRodenticide (int a_x, int a_y)
 Gets total rodenticide for a location. More...
 
bool SupplyPesticideDecay (PlantProtectionProducts a_ppp)
 Returns true if there is any pesticide in the system at all at this point. More...
 
double SupplyPesticide (int a_x, int a_y, PlantProtectionProducts a_ppp)
 Gets total pesticide for a location. More...
 
bool SupplyOverspray (int a_x, int a_y)
 Gets the overspray flag. More...
 
double SupplyPesticideP (int a_x, int a_y, PlantProtectionProducts a_ppp)
 Gets plant pesticide for a location. More...
 
double SupplyPesticideS (int a_x, int a_y, PlantProtectionProducts a_ppp)
 Gets soil pesticide for a location. More...
 
double SupplyPesticide (int a_polyref, PlantProtectionProducts a_ppp)
 Gets total pesticide for the centroid of a polygon. More...
 
double SupplyPesticideP (int a_polyref, PlantProtectionProducts a_ppp)
 Gets plant pesticide for the centroid of a polygon. More...
 
double SupplyPesticideS (int a_polyref, PlantProtectionProducts a_ppp)
 Gets soil pesticide for the centroid of a polygon. More...
 
RodenticidePredators_Population_Manager * SupplyRodenticidePredatoryManager ()
 
TTypesOfPesticide SupplyPesticideType (void)
 
GooseFieldListGetGooseFields (double)
 Gets the list of suitable goose foraging fields today. More...
 
void ResetGrainAndMaize ()
 Resets all grain. More...
 
void CalculateOpenness (bool a_realcalc)
 Causes openness to be calulated and stored for all polygons. More...
 
void WriteOpenness (void)
 Stores openness for all polygons to a standard file. More...
 
void ReadOpenness (void)
 Reads openness values from a standard input file for all polygons. 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...
 
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 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 SupplyOpenness (int a_poly)
 Get openness for a polygon. More...
 
int SupplyOpenness (int a_x, int a_y)
 Get openness for a location. More...
 
bool SupplyLEHigh (int a_x, int a_y)
 Tests whether the polygon at a_x,a_y is designated as high. More...
 
polylistSupplyLargeOpenFieldsNearXY (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 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...
 
APoint SupplyCentroid (int a_polyref)
 
APoint SupplyCentroidIndex (int a_polyrefindex)
 
int SupplyCentroidX (int a_polyref)
 
int SupplyCentroidY (int a_polyref)
 
int SupplyCentroidX (int a_x, int a_y)
 
int SupplyCentroidY (int a_x, int a_y)
 
int SupplyFarmIntensity (int a_x, int a_y)
 
int SupplyFarmIntensity (int a_polyref)
 
int SupplyFarmIntensityI (int a_polyindex)
 
TTypesOfLandscapeElement SupplyElementType (int a_polyref)
 
TTypesOfLandscapeElement SupplyElementType (int a_x, int a_y)
 
TTypesOfLandscapeElement SupplyElementTypeCC (int a_x, int a_y)
 
int SupplyCountryDesig (int a_x, int a_y)
 
int SupplyElementSubType (int a_polyref)
 
int SupplyElementSubType (int a_x, int a_y)
 
TTypesOfVegetation SupplyVegType (int a_x, int a_y)
 
TTypesOfVegetation SupplyVegType (int polyref)
 
TTypesOfVegetation SupplyVegTypeVector (unsigned int a_index)
 
int SupplyGrazingPressureVector (unsigned int a_index)
 
int SupplyGrazingPressure (int a_polyref)
 
int SupplyGrazingPressure (int a_x, int a_y)
 
bool SupplyIsCereal (int a_polyref)
 
bool SupplyIsMatureCereal (int a_polyref)
 
bool SupplyIsGrass (int a_polyref)
 
bool SupplyIsGrass2 (TTypesOfVegetation a_vege_type)
 
bool SupplyIsCereal2 (TTypesOfVegetation a_vege_type)
 
bool SupplyHasTramlines (int a_x, int a_y)
 
bool SupplyHasTramlines (int a_polyref)
 
bool SupplyJustMownVector (unsigned int a_index)
 
bool SupplyJustMown (int a_polyref)
 
int SupplyJustSprayedVector (unsigned int a_index)
 
int SupplyJustSprayed (int a_polyref)
 
int SupplyJustSprayed (int a_x, int a_y)
 
int SupplyTreeAge (int a_Polyref)
 
int SupplyTreeAge (int, int)
 
int SupplyVegAge (int a_Polyref)
 
int SupplyVegAge (int a_x, int a_y)
 
int SupplyNumberOfFarms ()
 
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)
 
TTypesOfFarm SupplyFarmType (int a_polyref)
 
TTypesOfFarm SupplyFarmType (int a_x, int a_y)
 
TTypesOfOptFarms SupplyOptFarmType (int a_x, int a_y)
 
int SupplyFarmArea (int a_polyref)
 
double SupplyPolygonAreaVector (int a_polyref)
 Returns the area of a polygon using the vector index as a reference. More...
 
double SupplyPolygonArea (int a_polyref)
 
void SetBirdSeedForage (int a_polyref, double a_fooddensity)
 Sets the grain forage resource as seen from a goose standpoint at a polygon. More...
 
void SetBirdMaizeForage (int a_polyref, double a_fooddensity)
 Sets the maize forage resource as seen from a goose standpoint at a polygon. More...
 
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...
 
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...
 
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...
 
double SupplyBirdMaizeForage (int a_polyref)
 Returns the maize forage resource. More...
 
bool SupplyInStubble (int a_polyref)
 Returns whether its cereal. 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...
 
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 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 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 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 RecordGooseRoostDist (int a_polyref, int a_dist, GooseSpecies a_goose)
 Records the distance to the closest roost of goose species. More...
 
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 GetGooseNumbers (int a_poly)
 This returns the number of geese on the polygon the day before. More...
 
int GetQuarryNumbers (int a_poly)
 This returns the number of geese which are legal quarry 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...
 
int SupplyLastTreatment (int a_polyref, int *a_index)
 
int SupplyLastTreatment (int a_x, int a_y, int *a_index)
 
double GetHareFoodQuality (int a_polygon)
 
double SupplyGlobalRadiation ()
 
double SupplyGlobalRadiation (long a_date)
 
double SupplyRain (void)
 
double SupplyTemp (void)
 
double SupplyHumidity (void)
 
double SupplyMeanTemp (long a_date, unsigned int a_period)
 
double SupplyWind (void)
 
int SupplyWindDirection (void)
 
double SupplySnowDepth (void)
 
bool SupplySnowcover (void)
 
int SupplyDaylength (void)
 
double SupplyRain (long a_date)
 
double SupplyTemp (long a_date)
 
double SupplyWind (long a_date)
 
double SupplyDayDegrees (int a_polyref)
 
double SupplyRainPeriod (long a_date, int a_period)
 
double SupplyWindPeriod (long a_date, int a_period)
 
double SupplyTempPeriod (long a_date, int a_period)
 
bool SupplySnowcover (long a_date)
 
bool IsFieldType (TTypesOfLandscapeElement a_tole)
 
int SupplyPolyRef (int a_x, int a_y)
 
int SupplyPolyRefIndex (int a_x, int a_y)
 
int SupplyPolyRefCC (int a_x, int a_y)
 
int SupplySimAreaWidth (void)
 
int SupplySimAreaHeight (void)
 
int SupplySimAreaMaxExtent (void)
 
int SupplySimAreaMinExtent (void)
 
int SupplyDaylength (long a_date)
 
int SupplyDayInYear (void)
 
int SupplyHour (void)
 Get the hour of the day. More...
 
int SupplyMinute (void)
 Get the minute of the hour. More...
 
unsigned int SupplyNumberOfPolygons (void)
 
TTypesOfLandscapeElement SupplyElementTypeFromVector (unsigned int a_index)
 
int SupplyPolyRefVector (unsigned int a_index)
 
int SupplyPesticideCell (int a_polyref)
 
int SupplyValidX (int a_polyref)
 
int SupplyValidY (int a_polyref)
 
double SupplyPondPesticide (int a_poly_index)
 Get the pesticide concentration per liter from a pond (must be a pond index on calling) More...
 
void CorrectCoords (int &x, int &y)
 Function to prevent wrap around errors with co-ordinates using x/y pair. More...
 
APoint CorrectCoordsPt (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...
 
int CorrectWidth (int x)
 
int CorrectHeight (int y)
 
void SetPolyMaxMinExtents (void)
 
void CalculateCentroids (void)
 
void DumpCentroids (void)
 
void BuildingDesignationCalc ()
 used to calculate whether a building is rural or town - for rodenticide use More...
 
void CentroidSpiralOut (int a_polyref, int &a_x, int &a_y)
 
const char * SupplyVersion (void)
 
void DumpPublicSymbols (const char *a_dumpfile, CfgSecureLevel a_level)
 
void DumpAllSymbolsAndExit (const char *a_dumpfile)
 
bool ReadSymbols (const char *a_cfgfile)
 
void DumpMapInfoByArea (const char *a_filename, bool a_append, bool a_dump_zero_areas, bool a_write_veg_names)
 
void Warn (std::string a_msg1, std::string a_msg2)
 
int * SupplyMagicMapP (int a_x, int a_y)
 
int MagicMapP2PolyRef (int a_magic)
 
int SupplyRoadWidth (int, int)
 
double SupplyTrafficLoad (int a_x, int a_y)
 
double SupplyTrafficLoad (int a_polyref)
 
int SupplyTreeHeight (int, int)
 
int SupplyUnderGrowthWidth (int, int)
 
int SupplyTreeHeight (int)
 
int SupplyUnderGrowthWidth (int)
 
long SupplyGlobalDate (void)
 
int SupplyYear (void)
 
int SupplyYearNumber (void)
 
int SupplyMonth (void)
 
int SupplyDayInMonth (void)
 
double SupplyDaylightProp ()
 
double SupplyNightProp ()
 
void SupplyLEReset (void)
 
int SupplyLENext (void)
 
int SupplyLECount (void)
 
LE_Signal SupplyLESignal (int a_polyref)
 
void SetLESignal (int a_polyref, LE_Signal a_signal)
 
void IncTreatCounter (int a_treat)
 
TTypesOfLandscapeElement TranslateEleTypes (int EleReference)
 
TTypesOfVegetation TranslateVegTypes (int VegReference)
 
LESupplyLEPointer (int a_polyref)
 
int BackTranslateEleTypes (TTypesOfLandscapeElement EleReference)
 
int BackTranslateVegTypes (TTypesOfVegetation VegReference)
 
std::string EventtypeToString (int a_event)
 
std::string PolytypeToString (TTypesOfLandscapeElement a_le_type)
 
std::string VegtypeToString (TTypesOfVegetation a_veg)
 
void InitOsmiaBeeNesting ()
 Read in the Osmia nest density files and allocate to each LE object. More...
 
void UpdateOsmiaNesting ()
 Tesll all LE objects to update their osmia nest status. More...
 
bool SupplyOsmiaNest (int a_x, int a_y)
 Find out whether an osmia nest can be made here. More...
 
void IncOsmiaNest (int a_x, int a_y)
 Reopen the osmia nest here
More...
 
void ReleaseOsmiaNest (int a_x, int a_y)
 Reopen the osmia nest here
More...
 

Protected Member Functions

void GISASCII_Output (string outpfile, int UTMX, int UTMY)
 Write ASCII file of the ALMaSS map. More...
 
void AddGreenElement (LE *a_green)
 
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 PolysValidate (bool a_exit_on_invalid)
 
bool PolysRemoveInvalid (void)
 
void PolysDump (const char *a_filename)
 
void DumpMap (const char *a_filename)
 
void ConsolidatePolys (void)
 
void CountMapSquares (void)
 
void PolysRenumber (void)
 
void RebuildPolyMapping ()
 
void ForceArea (void)
 
void ChangeMapMapping (void)
 
LENewElement (TTypesOfLandscapeElement a_type)
 
void RemoveMissingValues ()
 A method for replacing missing values in the map with corrected ones - slow. More...
 
void TestCropManagement (void)
 
void VegDump (int x, int y)
 
void EventDump (int x, int y, int x2, int y2)
 
void EventDumpPesticides (int x1, int y1)
 
void DegreesDump ()
 Prints the sum of day degrees. See FarmManager::daydegrees. More...
 
bool BorderNeed (TTypesOfLandscapeElement a_letype)
 
void BorderAdd (LE *a_field, TTypesOfLandscapeElement a_type)
 
void BorderRemoval (void)
 
int RemoveSmallPolygons (void)
 Removes small polygons from the map. More...
 
void CreatePondList ()
 Creates a list of pond polygon refs/indexes for easy look up. More...
 
void UnsprayedMarginAdd (LE *a_field)
 
void UnsprayedMarginScan (LE *a_field, int a_width)
 
void BorderScan (LE *a_field, int a_width)
 
bool BorderTest (int a_fieldpoly, int a_borderpoly, int a_x, int a_y)
 
bool StepOneValid (int a_polyindex, int a_x, int a_y, int step)
 
bool UMarginTest (int a_fieldpoly, int a_borderpoly, int a_x, int a_y, int a_width)
 
bool FindValidXY (int a_field, int &a_x, int &a_y)
 
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)
 
void AddBeetleBanks (TTypesOfLandscapeElement a_tole)
 
bool BeetleBankPossible (LE *a_field, TTypesOfLandscapeElement a_tole)
 
void BeetleBankAdd (int x, int y, int angle, int length, LE *a_field, TTypesOfLandscapeElement a_tole)
 
bool FindFieldCenter (LE *a_field, int *x, int *y)
 
int FindLongestAxis (int *x, int *y, int *a_length)
 
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 hb_Add (void)
 
void hb_AddNewHedgebanks (int a_orig_poly_num)
 
int hb_StripingDist (void)
 
void hb_GenerateHBPolys (void)
 
void hb_FindHedges (void)
 
bool hb_FindBoundingBox (int a_poly_num)
 
void hb_UpPolyNumbers (void)
 
void hb_ClearPolygon (int a_poly_num)
 
void hb_PaintBorder (int a_color)
 
bool hb_MapBorder (int a_x, int a_y)
 
bool hb_HasOtherNeighbour (int a_x, int a_y)
 
bool hb_PaintWhoHasNeighbourColor (int a_neighbour_color, int a_new_color)
 
bool hb_HasNeighbourColor (int a_x, int a_y, int a_neighbour_color)
 
void hb_MarkTopFromLocalMax (int a_color)
 
void hb_MarkTheBresenhamWay (void)
 
int hb_MaxUnpaintedNegNeighbour (int a_x, int a_y)
 
void hb_ResetColorBits (void)
 
void hb_RestoreHedgeCore (int a_orig_poly_number)
 
void hb_DownPolyNumbers (void)
 
void hb_Cleanup (void)
 
void DumpMapGraphics (const char *a_filename)
 
void DumpTreatCounters (const char *a_filename)
 
bool CIPELandscapeMaker ()
 

Protected Attributes

int m_treatment_counts [last_treatment]
 
int m_LargestPolyNumUsed
 
vector< int > m_PondIndexList
 List of pond indexes. More...
 
vector< int > m_PondRefsList
 List of pond polyrefs. More...
 
vector< int > hb_hedges
 
vector< LE * > hb_new_hbs
 
int m_x_add [8]
 
int m_y_add [8]
 
int * hb_map
 
int hb_width
 
int hb_height
 
int hb_size
 
int hb_min_x
 
int hb_max_x
 
int hb_min_y
 
int hb_max_y
 
int hb_first_free_poly_num
 
int hb_core_pixels
 
int hb_border_pixels
 
TTypesOfPesticide m_PesticideType
 An attribute to hold the pesticide type being tested, if there is one, if not default is -1. More...
 
bool m_toxShouldSpray
 
int le_signal_index
 

Private Attributes

char m_versioninfo [30]
 
FarmManagerm_FarmManager
 List of all the farms. More...
 
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...
 
RasterMapm_land
 The big map. More...
 
vector< int > m_polymapping
 
PesticideMapm_PesticideMap
 For specialised pesticide recording. More...
 
int m_width
 
int m_height
 
int m_width10
 
int m_height10
 
int m_minmaxextent
 
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...
 
bool m_DoMissingPolygonsManipulations
 
double * l_vegtype_areas
 
Population_Managerm_ThePopManager
 a pointer to the current main population manager More...
 
RodenticideManager * m_RodenticideManager
 
RodenticidePredators_Population_Manager * m_RodenticidePreds
 
Polynomial2CurveClass * m_GooseIntakeRateVSVegetationHeight_PF
 Curve relatning goose intake rates in KJ/min to vegetation height. More...
 
Polynomial2CurveClass * m_GooseIntakeRateVSVegetationHeight_BG
 
Polynomial2CurveClass * m_GooseIntakeRateVSVegetationHeight_GL
 

Detailed Description

The landscape class containing all environmental and topographical data.

Definition at line 112 of file landscape.h.

Constructor & Destructor Documentation

◆ ~Landscape()

Landscape::~Landscape ( void  )

Definition at line 1424 of file Landscape.cpp.

1424  {
1427  }
1428 
1429 #ifdef __RECORDFARMEVENTS
1430  m_farmeventfile->close();
1431  delete m_farmeventfile;
1432 #endif
1433 
1434  for ( unsigned int i = 0; i < m_elems.size(); i++ )
1435  delete m_elems[ i ];
1436 
1437  free( l_vegtype_areas );
1438  delete m_land;
1439  //delete g_rotation;
1440  delete g_crops;
1441  delete g_letype;
1442  delete g_weather;
1443  delete g_date;
1444  delete g_pest;
1446  {
1447  delete m_RodenticideManager;
1448  delete m_RodenticidePreds;
1449  }
1450  delete m_FarmManager;
1451  delete g_msg; // Must be last.
1452 }

References cfg_rodenticide_enable, g_crops, g_date, g_letype, g_msg, g_pest, g_weather, l_map_dump_treatcounts_enable, l_map_dump_treatcounts_file, CfgBool::value(), and CfgStr::value().

◆ Landscape()

Landscape::Landscape ( void  )

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.

Definition at line 814 of file Landscape.cpp.

814  {
815 
818  // Set up operation flags
819  bool didRenumber = false;
820  bool didCalcCentroids = false;
821  bool didConsolidate = false;
822  bool didCalcOpenness = false;
823  bool didCalcOther = false;
827  // Set up globals
828  g_landscape_p = this;
829  for (int i = 1; i <= 2000; i++) {
830  g_SpeedyDivides[i] = 1 / double(i);
831  }
832  int x_add[8] = { 1, 1, 0, -1, -1, -1, 0, 1 }; // W,SW,S,SE,E,NE,N,NW
833  int y_add[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
834  for (int i = 0; i < 8; i++) {
835  m_x_add[i] = x_add[i];
836  m_y_add[i] = y_add[i];
837  }
838 
839 
841 
843  printf("This program uses the Landscape simulator V%s\n", m_versioninfo);
844  }
845 #ifdef __GITVERSION
847  {
848  std::cout << "hash=" << GIT_HASH << ", time=" << COMPILE_TIME << ", branch=" << GIT_BRANCH << std::endl;
849  }
850 #endif
851 
852 
853  // For testing.
854  //g_cfg->DumpPublicSymbols( "publicsymbols.cfg", CFG_PUBLIC );
855  //exit(1);
856 
857  //Pinkfeet
859  //Barnacle
861  //Greylag
863  if (cfg_WriteCurve.value()) {
864  m_GooseIntakeRateVSVegetationHeight_GL->WriteDataFile(10);
865  m_GooseIntakeRateVSVegetationHeight_BG->WriteDataFile(10);
866  m_GooseIntakeRateVSVegetationHeight_PF->WriteDataFile(10);
867  }
868 
869  cout << "Creating Calendar Object" << endl;
870  g_date = new Calendar;
871  cout << "Creating Weather Object" << endl;
873  cout << "Creating LE_TypeClass Object" << endl;
874  g_letype = new LE_TypeClass;
875  cout << "Creating PlantGrowthData Object" << endl;
877  cout << "Creating PollenNectarDevelopmentData Object" << endl;
878  g_nectarpollen = new PollenNectarDevelopmentData("toleALMaSSNectarPollenInput.txt", "tovALMaSSNectarPollenInput.txt", this);
880 
881  // Reset treatment counters.
882  for (int i = 0; i < last_treatment; i++) {
883  m_treatment_counts[i] = 0;
884  }
885  cout << "Creating FarmManager Object" << endl;
886  m_FarmManager = new FarmManager();
887 
888  cout << "Reading polygon reference file" << endl;
890 
891  //this carries out the optimisation
892  if (cfg_OptimisingFarms.value()){
895  }
896 
897  cout << "Creating RasterMap Object" << endl;
898  m_land = new RasterMap(l_map_map_file.value(), this);
899  m_width = m_land->MapWidth();
902  m_width10 = 10 * m_width;
903  m_height10 = 10 * m_height;
905 
906 
907  // Validate polygons, ie. ensure those reference in the
908  // polygon file also shows up in the map.
909  cout << "In PolysValidate" << endl;
910  PolysValidate(false);
911  cout << "In PolysRemoveInvalid" << endl;
913  cout << "Creating ponds" << endl;
914  if (cfg_MaxPondSize.value() > 0) {
915  // This takes any small freshwater and converts it to a pond.
916  for (unsigned int i = 0; i < m_elems.size(); i++) {
917  if (m_elems[i]->GetElementType() == tole_Freshwater) {
918  if (m_elems[i]->GetArea() <= cfg_MaxPondSize.value()) {
919  Pond* pond = new Pond;
920  pond->DoCopy(m_elems[i]);
921  pond->SetALMaSSEleType(g_letype->BackTranslateEleTypes(tole_Pond));
922  pond->SetElementType(tole_Pond);
923  m_elems[i] = dynamic_cast<LE*>(pond);
924  }
925  }
926  }
927  }
928  cout << "In PolysValidate second time" << endl;
929  PolysValidate(true);
930 
937  {
938  cout << "In DoMissingPolygonsManipulations" << endl;
939  // Find big continuous polygons
940  for (unsigned int i = 0; i < m_elems.size(); i++)
941  {
942  if (m_elems[i]->GetElementType() == tole_Missing)
943  {
944  double area = m_elems[i]->GetArea();
945  int areaMinrect = (m_elems[i]->GetMaxX() - m_elems[i]->GetMinX()) * (m_elems[i]->GetMaxY() - m_elems[i]->GetMinY());
946  if ((areaMinrect / area > 4) || (area < 1000))
947  {
948  // Unlikely to be a field, or if so a very narrow odd one. We will assume this is a missing data issue.
949  }
950  else
951  {
952  // Big poly with more than 25% of the included rectangle covered, must be a field of some sort.
953  // create a new wasteland and swap this in to the m_elems, then delete the old missing polygon
954  LE * wl = NewElement(tole_Wasteland);
955  wl->SetPoly(m_elems[i]->GetPoly());
956  wl->SetArea(floor(0.5 + area));
957  wl->SetSoilType(m_elems[i]->GetSoilType());
959  wl->SetCentroid(-1, -1);
960  wl->SetOpenness(0);
961  delete m_elems[i];
962  m_elems[i] = wl;
963  }
964  }
965  }
966  // By here all the big ones should be safely tidied away to wasteland and now we need to deal with the raster map.
968  for (unsigned int i = 0; i < m_elems.size(); i++)
969  {
970  // Now we deal with all the little ones that were not by fields
971  if (m_elems[i]->GetElementType() == tole_Missing)
972  {
973  LE * wl = NewElement(tole_Wasteland);
974  wl->SetPoly(m_elems[i]->GetPoly());
975  wl->SetArea(m_elems[i]->GetArea());
976  wl->SetSoilType(m_elems[i]->GetSoilType());
978  wl->SetCentroid(-1, -1);
979  wl->SetOpenness(0);
980  delete m_elems[i];
981  m_elems[i] = wl;
982  }
983  }
984  cout << "In PolysValidate third time" << endl;
985  PolysValidate(false);
986  if (PolysRemoveInvalid()) {
987  cout << "In PolysValidate fourth time" << endl;
988  PolysValidate(true);
989  }
990  g_msg->Warn("Landscape::Landscape(): Dump and normal exit to follow after resolving missing polygons. ", "");
991  didCalcOther = true;
992  }
993 
994  // ChangeMapMapping() also enters a valid starting
995  // coordinate for the border generating farm method below.
996  cout << "In ChangeMapMapping" << endl;
998 
1002  if ((m_LargestPolyNumUsed != ((int)m_elems.size() - 1)))
1003  {
1004  cout << "In poly renumber" << endl;
1005 
1006  PolysRenumber();
1007  didRenumber = true;
1008  }
1009  // do we want to remove small polygons?
1011  {
1012  cout << "In Landscape::Landscape() Small polygon removal" << endl;
1013  int removed = RemoveSmallPolygons();
1014  g_msg->Warn("Landscape::Landscape(): Dump and normal exit to follow after removing small polygons and map dump. Polygons removed:", removed);
1015  didCalcOther = true;
1016  }
1017  // Do we want to re-write the current files and consolidate polys?
1018  else if (l_map_consolidatepolys.value())
1019  {
1020  cout << "In consolidate polys" << endl;
1021  didConsolidate = true;
1022  ConsolidatePolys();
1023  }
1024  else if (g_map_le_borderremoval.value())
1025  {
1026  cout << "In map_le_borderremoval" << endl;
1027  // Does not use centroids so is safe to use here
1028  BorderRemoval();
1029  CountMapSquares();
1030  ForceArea();
1031  g_msg->Warn(WARN_FILE, "Landscape::Landscape() - BorderRemoval "" map dump to follow.", "");
1032  didCalcOther = true;
1033  }
1034 
1035 
1036  // By the time we reach this point we need to have completed all major polygon removal and are ready to calculate centroids if they are needed. There
1037  // are two reasons for this - 1) that we did not have them in the original polyref file, 2) that we changed the map
1038  if (didConsolidate || didCalcOther || m_NeedCentroidCalculation)
1039  {
1040  PolysValidate(false);
1041  if (PolysRemoveInvalid()) PolysValidate(true);
1042  ChangeMapMapping();
1043  PolysRenumber();
1045  didCalcCentroids = true;
1046  }
1047  if (didConsolidate || didCalcOther || m_NeedCentroidCalculation || didCalcCentroids || l_map_calc_openness.value())
1048  {
1050  else CalculateOpenness(false);
1051  didCalcOpenness = true;
1052  }
1053  if (didCalcCentroids || didConsolidate || didCalcOpenness || didCalcOther || m_NeedCentroidCalculation || didRenumber || !m_FarmManager->GetIsRenumbered())
1054  {
1055  // We need to dump the map and polyrefs
1059  g_msg->Warn(WARN_FILE, "Landscape::Landscape() ""Normal exit after dump.", "Remember to rename the new map and polyref file.");
1060  exit(0);
1061  }
1062 
1063  // Below here we have the more complicated map manipulations. These will need recalculation of centroids and openness after they are run.
1064  // However, we really do not want to get here with invalid centroids, hence forced dump and exit for manipulations up to this point.
1065 
1066  didCalcOther = false;
1067  // Add artificial hedgebanks to the hedges in the landscape,
1068  // if requested.
1069  if (l_map_art_hedgebanks.value()) {
1070  hb_Add();
1071  didCalcOther = true;
1072  }
1073  else if (g_map_le_borders.value())
1074  {
1075  cout << "Generating LE Borders around fields" << endl;
1076  cout << "Border chance = " << g_map_le_border_chance.value() << endl;
1077  cout << "Border width = " << g_map_le_borderwidth.value() << endl;
1078  // Generate border around each *farm* landscape element.
1079  cout << "Setting MaxMin Extents" << endl;
1081  cout << "Adding Borders" << endl;
1082  unsigned sz = (unsigned)m_elems.size();
1083  for (unsigned i = 0; i < sz; i++)
1084  {
1085  if (m_elems[i]->GetBorder() != NULL)
1086  {
1087  // Border around this element, so must be a farm field.
1088  // If the field is too small then ignore it
1089  if (m_elems[i]->GetArea() > g_map_le_borders_min_field_size.value())
1090  {
1092  BorderAdd(m_elems[i], t);
1093  }
1094  }
1095  }
1096  didCalcOther = true;
1097  }
1098  else // Some special code to 'soften' the edges of orchards
1100  {
1101  // Generate border around each *farm* landscape element.
1102  for (unsigned int i = 0; i < m_elems.size(); i++) {
1103  if (m_elems[i]->GetElementType() == tole_Orchard)
1104  {
1106  BorderAdd(m_elems[i], t);
1107  }
1108  }
1109  didCalcOther = true;
1110  }
1111  else
1112  // Unsprayed Margin Code....
1114  {
1115  CountMapSquares();
1116  ForceArea();
1117 
1118  // Generate border around each *farm* landscape element.
1119  for (unsigned int i = 0; i < m_elems.size(); i++)
1120  {
1121  if (m_elems[i]->GetUnsprayedMarginPolyRef() != -1)
1122  {
1123  // But not if the field is too small to have them (<1Ha)
1124  if (m_elems[i]->GetArea() > 10000)
1125  {
1126  // Border around this element, so must be a farm field.
1128  }
1129  else m_elems[i]->SetUnsprayedMarginPolyRef(-1);
1130  }
1131  }
1132  didCalcOther = true;
1133  }
1134  else if (cfg_AddBeetleBanks.value())
1135  {
1136  cout << "Adding beetle banks now" << endl;
1138  didCalcOther = true;
1139  }
1140 
1142  {
1144  }
1145 
1146  if (l_map_dump_enable.value() || didCalcOther)
1147  {
1148  CountMapSquares();
1149  ForceArea();
1150  PolysValidate(false);
1151  if (PolysRemoveInvalid()) PolysValidate(true);
1152  ChangeMapMapping();
1153  PolysRenumber();
1157  cout << "Dumping map" << endl;
1159  cout << "Dumping polygon refs file" << endl;
1161  g_msg->Warn(WARN_FILE, "Landscape::Landscape() ""Normal exit after dump.", "Remember to rename the new map and polyref file.");
1162  exit(0);
1163  }
1164 
1165  /*'''''''''''''''''' CIPE LANDSCAPE MAKER CODE HERE //'''''''''''''''''''''
1166  if ( l_map_CIPEmaker_enable.value() ) {
1167  CIPELandscapeMaker();
1168  if ( l_map_dump_exit.value() ) {
1169  g_msg->Warn( WARN_FILE, "Landscape::Landscape(): ""Normal exit after map dump.", "" );
1170  exit( 0 );
1171  }
1172  }
1173  //'''''''''''''''''' CIPE LANDSCAPE MAKER CODE ABOVE //'''''''''''''''''''''
1174  */
1175  // Set the type of hedgebanks.
1176  int l_subtype = cfg_HedgeSubtypeMinimum.value();
1177  for (unsigned int i = 0; i < m_elems.size(); i++) {
1178  if (m_elems[i]->GetElementType() == tole_HedgeBank) {
1179  m_elems[i]->SetSubType(l_subtype);
1180  if (++l_subtype >= cfg_HedgeSubtypeMaximum.value())
1181  l_subtype = cfg_HedgeSubtypeMinimum.value();
1182  }
1183  }
1184 
1185  // And another to set the type of hedges
1186  // ***CJT*** 2003-12-02
1187  l_subtype = 0;
1188  for (unsigned int i = 0; i < m_elems.size(); i++) {
1189  if (m_elems[i]->GetElementType() == tole_Hedges) {
1190  m_elems[i]->SetSubType(l_subtype);
1191  if (++l_subtype >= 3)
1192  l_subtype = 0;
1193  }
1194  }
1195  // Count up the ponds and store them now we are finished with polygon handling.
1196  CreatePondList();
1197 
1198  cout << "Initiating farm management" << endl;
1200  g_pest = new Pesticide(m_land, this);
1201  m_toxShouldSpray = false; // Flag for special pesticide tests
1203  g_date->Reset();
1204 
1205  /*
1206  if ( g_farm_test_crop.value() ) {
1207  TestCropManagement();
1208  exit( 0 );
1209  }
1210  */
1211 
1212  // Set up treatment flags
1213  // Reset internal state for the LE loop generator.
1214  // Compulsory!
1215  SupplyLEReset();
1216  // Get number of *all* landscape elements.
1217  int l_count = SupplyLECount();
1218 
1219  // Now loop through then.
1220  for (int i = 0; i < l_count; i++) {
1221  // Fetch next LE by its polygon reference number. Alternative
1222  // loop mechanism: This will return -1 at end-of-loop.
1223  int a_poly = SupplyLENext();
1224 
1225  // Skip uninteresting polygons by type, ownership,
1226  // phase of the moon, whatever.
1227  // if ( these_are_not_the_droids_we_are_looking_for( a_poly )) {
1228  if (SupplyElementType(a_poly) != tole_Field)
1229  continue;
1230 
1231  // Example: Set x% of them to ignore insecticide of all types.
1232  if (random(100) < l_map_no_pesticide_fields.value()) {
1233  // Get current signal mask for polygon.
1234  LE_Signal l_signal = SupplyLESignal(a_poly);
1235  // Logical OR in/AND out the signals you are interested in.
1236  // The current signals are at the top of elements.h
1237  //l_signal |= LE_SIG_NO_INSECTICIDE | LE_SIG_NO_SYNG_INSECT | LE_SIG_NO_HERBICIDE | LE_SIG_NO_FUNGICIDE | LE_SIG_NO_GROWTH_REG;
1238  //l_signal |= LE_SIG_NO_INSECTICIDE | LE_SIG_NO_SYNG_INSECT | LE_SIG_NO_HERBICIDE;
1239  // Write the mask back out to the polygon.
1240  SetLESignal(a_poly, l_signal);
1241  }
1242  }
1243 
1244  l_vegtype_areas = (double *)malloc(sizeof(double) * (tov_Undefined + 1));
1245 
1246  if (l_vegtype_areas == NULL) {
1247  g_msg->Warn(WARN_BUG, "Landscape::Landscape(): Out of memory!", "");
1248  exit(1);
1249  }
1250  FILE * outf;
1251  if (cfg_dumpvegjan.value()) {
1252  outf = fopen(cfg_dumpvegjanfile.value(), "w");
1253  if (!outf) {
1254  g_msg->Warn(WARN_FILE, "Landscape::DumpMapInfoByArea(): ""Unable to create file", cfg_dumpvegjanfile.value());
1255  exit(1);
1256  }
1257  else
1258  fclose(outf);
1259  }
1260 
1261  if (cfg_dumpvegjune.value()) {
1262  outf = fopen(cfg_dumpvegjunefile.value(), "w");
1263  if (!outf) {
1264  g_msg->Warn(WARN_FILE, "Landscape::DumpMapInfoByArea(): ""Unable to create file", cfg_dumpvegjunefile.value());
1265  exit(1);
1266  }
1267  else
1268  fclose(outf);
1269  }
1270 
1271 #ifdef __RECORDFARMEVENTS
1272  m_farmeventfile = new ofstream("FarmEvents.txt", ofstream::out);
1273 #endif
1274 
1275 
1276  // Dump veg information if necessary
1277  if (l_map_dump_veg_enable.value()) {
1278  FILE * f;
1279  f = fopen("VegDump.txt", "w");
1280  if (!f) {
1281  g_msg->Warn(WARN_BUG, "Landscape::Landscape(): VegDump.txt could not be created", "");
1282  exit(1);
1283  }
1284  fprintf(f, "Year\tDay\tHeight\tBiomass\tGrazed\tDensity\tCover\tWeedBiomass\ttovNum\tInsectBiomass\tLATotal\tLAGreen\tDigestability\tGreenBiomass\tDeadBiomass\tGooseGrazing\tSpilledGrain\nn");
1285  fclose(f);
1286  }
1288  FILE * f;
1289  f = fopen("EventDump.txt", "w");
1290  if (!f) {
1291  g_msg->Warn(WARN_BUG, "Landscape::Landscape(): EventDump.txt could not be created", "");
1292  exit(1);
1293  }
1294  fclose(f);
1295  }
1296 
1299  }
1300 
1301  if (cfg_DumpFarmAreas.value()){
1303  }
1304 
1305  // If we are testing a pesticide then set the enum attribute
1307 
1310  {
1311  m_RodenticideManager = new RodenticideManager("BaitLocations_input.txt", this);
1312  m_RodenticidePreds = new RodenticidePredators_Population_Manager(this);
1313  }
1314 
1315  // Run a year to remove any start up effects
1316  cout << "Running initial start-up year" << endl;
1317  for (unsigned int i = 0; i < 365; i++) Tick();
1318  //switch the rotation after running the hidden year (only for optimising farms), AM, 030713
1320  // Write ASCII file:
1321  if (l_map_write_ascii.value()) {
1322  int x = l_map_ascii_utm_x.value();
1323  int y = l_map_ascii_utm_y.value();
1324  GISASCII_Output("AsciiLandscape.txt", x, y);
1325  }
1326 }

References LE_TypeClass::BackTranslateEleTypes(), cfg_AddBeetleBanks, cfg_B6A, cfg_B6B, cfg_B6C, cfg_B6D, cfg_B6E, cfg_B6F, cfg_B6G, cfg_B6H, cfg_BeetleBankType, cfg_DumpFarmAreas, cfg_dumpvegjan, cfg_dumpvegjanfile, cfg_dumpvegjune, cfg_dumpvegjunefile, cfg_G6A, cfg_G6B, cfg_G6C, cfg_G6D, cfg_G6E, cfg_G6F, cfg_G6G, cfg_G6H, cfg_HedgeSubtypeMaximum, cfg_HedgeSubtypeMinimum, cfg_MaxPondSize, cfg_OptimiseBedriftsmodelCrops, cfg_OptimisingFarms, cfg_P1A, cfg_P1B, cfg_P1C, cfg_P1D, cfg_P1E, cfg_P1F, cfg_P1G, cfg_P1H, cfg_pesticidemapcellsize, cfg_pesticidemapnoyears, cfg_pesticidemapon, cfg_pesticidemapstartyear, cfg_pesticidemaptype, cfg_pesticidetesttype, cfg_rodenticide_enable, cfg_WriteCurve, LE::DoCopy(), g_crops, g_date, g_landscape_p, g_letype, g_map_le_border_chance, g_map_le_borderremoval, g_map_le_borders, g_map_le_borders_min_field_size, g_map_le_borderstype, g_map_le_borderwidth, g_map_le_unsprayedmargins, g_map_orchards_borders, g_msg, g_nectarpollen, g_pest, g_SpeedyDivides, g_weather, 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_git_version_info, l_map_print_version_info, l_map_removesmallpolygons, l_map_weather_file, l_map_write_ascii, last_treatment, RasterMap::MapWidth(), Calendar::Reset(), LE::SetArea(), LE::SetOpenness(), LE::SetPoly(), LE::SetSoilType(), LE::SetUnsprayedMarginPolyRef(), tole_Field, tole_Freshwater, tole_HedgeBank, tole_Hedges, tole_Missing, tole_Orchard, tole_Pond, tole_Wasteland, tov_Undefined, LE_TypeClass::TranslateEleTypes(), CfgInt::value(), CfgFloat::value(), CfgBool::value(), CfgStr::value(), version_date, version_major, version_minor, version_revision, MapErrorMsg::Warn(), WARN_BUG, and WARN_FILE.

Member Function Documentation

◆ AddBeetleBanks()

void Landscape::AddBeetleBanks ( TTypesOfLandscapeElement  a_tole)
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

Definition at line 2723 of file Landscape.cpp.

2723  {
2731  int BBs=0;
2732  int tx1 = cfg_BeetleBankMinX.value();
2733  int tx2 = cfg_BeetleBankMaxX.value();
2734  int ty1 = cfg_BeetleBankMinY.value();
2735  int ty2 = cfg_BeetleBankMaxY.value();
2736  bool doit = false;
2737  unsigned sz=(unsigned) m_elems.size();
2738  for (unsigned i=0; i<sz; i++)
2739  {
2740  if (m_elems[ i ]->GetElementType() == tole_Field)
2741  {
2742  doit = false;
2743  int cx = m_elems[ i ]->GetCentroidX();
2744  int cy = m_elems[ i ]->GetCentroidY();
2745  if (!cfg_BeetleBankInvert.value())
2746  {
2747  if ((cx >= tx1) && (cy >= ty1) && (cx <= tx2) && (cy <= ty2))
2748  {
2749  doit = true;
2750  }
2751  }
2752  else if ((cx < tx1) || (cy < ty1) || (cx > tx2) || (cy > ty2))
2753  {
2754  doit = true;
2755  }
2756  if (doit)
2757  {
2758  if (random(100)<cfg_BeetleBankChance.value())
2759  {
2760  if (BeetleBankPossible( m_elems[ i ], a_tole) ) BBs++;
2761  }
2762  }
2763  }
2764  }
2765  char str[25];
2766  sprintf(str,"%d",BBs);
2767  g_msg->Warn( WARN_MSG, "Landscape::AddBeetleBanks(): BeetleBanks successfully added:", str );
2768 }

References cfg_BeetleBankChance, cfg_BeetleBankInvert, cfg_BeetleBankMaxX, cfg_BeetleBankMaxY, cfg_BeetleBankMinX, cfg_BeetleBankMinY, g_msg, tole_Field, CfgInt::value(), CfgBool::value(), MapErrorMsg::Warn(), and WARN_MSG.

◆ AddGreenElement()

void Landscape::AddGreenElement ( LE a_green)
protected

◆ AxisLoop() [1/2]

void Landscape::AxisLoop ( int  a_poly,
APoint *  a_cor,
int  a_axis 
)
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.

Definition at line 2898 of file Landscape.cpp.

2898  {
2903  int ap1 = a_polyindex;
2904  while (ap1 == a_polyindex)
2905  {
2906  a_cor->m_x += m_x_add[a_axis];
2907  a_cor->m_y += m_y_add[a_axis];
2908  if (a_cor->m_x >= m_width - 1) { a_cor->m_x = m_width - 1; return; }
2909  if (a_cor->m_y >= m_height - 1) { a_cor->m_y = m_height - 1; return; }
2910  if (a_cor->m_x <= 0) { a_cor->m_x = 0; return; }
2911  if (a_cor->m_y <= 0) { a_cor->m_y = 0; return; }
2912  ap1 = m_land->Get(a_cor->m_x, a_cor->m_y); // NB this returns the m_elemens index not the polyref (ChangeMapMapping has been called by here)
2913  }
2914 }

◆ AxisLoop() [2/2]

void Landscape::AxisLoop ( int  a_poly,
int *  a_x,
int *  a_y,
int  a_axis 
)
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.

Definition at line 2938 of file Landscape.cpp.

2938  {
2943  int ap1 = a_polyindex;
2944  while (ap1 == a_polyindex)
2945  {
2946  *(a_x) += m_x_add[a_axis];
2947  *(a_y) += m_y_add[a_axis];
2948  // Before we try to get a polyindex from the map, check we are still on the world
2949  if (*(a_x) < 0)
2950  {
2951  return;
2952  }
2953  if (*(a_y) < 0)
2954  {
2955  return;
2956  }
2957  if (*(a_x) >= m_width)
2958  {
2959  return;
2960  }
2961  if (*(a_y) >= m_height)
2962  {
2963  return;
2964  }
2965  // OK still in the map, get the polyindex
2966  ap1 = m_land->Get((*a_x), (*a_y)); // NB this returns the m_elemens index not the polyref (ChangeMapMapping has been called by here)
2967  }
2968 }

◆ AxisLoopLtd()

void Landscape::AxisLoopLtd ( int  a_poly,
APoint *  a_cor,
int  a_axis,
int  a_limit 
)
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.

Definition at line 2917 of file Landscape.cpp.

2917  {
2922  int ap1 = a_polyindex;
2923  int count = 0;
2924  while (ap1 == a_polyindex && count<a_limit)
2925  {
2926  a_cor->m_x += m_x_add[a_axis];
2927  a_cor->m_y += m_y_add[a_axis];
2928  if (a_cor->m_x >= m_width - 1) { a_cor->m_x = m_width - 1; return; }
2929  if (a_cor->m_y >= m_height - 1) { a_cor->m_y = m_height - 1; return; }
2930  if (a_cor->m_x <= 0) { a_cor->m_x = 0; return; }
2931  if (a_cor->m_y <= 0) { a_cor->m_y = 0; return; }
2932  ap1 = m_land->Get(a_cor->m_x, a_cor->m_y); // NB this returns the m_elemens index not the polyref (ChangeMapMapping has been called by here)
2933  count++;
2934  }
2935 }

◆ BackTranslateEleTypes()

int Landscape::BackTranslateEleTypes ( TTypesOfLandscapeElement  EleReference)
inline

Definition at line 1662 of file landscape.h.

1663 {
1664  return g_letype->BackTranslateEleTypes( EleReference );
1665 }

References LE_TypeClass::BackTranslateEleTypes(), and g_letype.

◆ BackTranslateVegTypes()

int Landscape::BackTranslateVegTypes ( TTypesOfVegetation  VegReference)
inline

Definition at line 1669 of file landscape.h.

1670 {
1671  return g_letype->BackTranslateVegTypes( VegReference );
1672 }

References LE_TypeClass::BackTranslateVegTypes(), and g_letype.

◆ BeetleBankAdd()

void Landscape::BeetleBankAdd ( int  x,
int  y,
int  angle,
int  length,
LE a_field,
TTypesOfLandscapeElement  a_tole 
)
protected

Definition at line 2971 of file Landscape.cpp.

2971  {
2972  // Need to get a new number
2974  // Make the new landscape element
2975  LE * BeetleBank;
2976  switch (a_tole)
2977  {
2978  case tole_MownGrass:
2980  BeetleBank->SetALMaSSEleType( g_letype->BackTranslateEleTypes( tole_MownGrass ) );
2981  break;
2985  break;
2986  case tole_BeetleBank:
2987  default:
2989  BeetleBank->SetALMaSSEleType( g_letype->BackTranslateEleTypes( tole_BeetleBank ) );
2990  }
2991  BeetleBank->SetVegPatchy(true);
2992  m_polymapping[ m_LargestPolyNumUsed ] = (int) m_elems.size();
2993  m_elems.resize( m_elems.size() + 1 );
2994  m_elems[ m_elems.size() - 1 ] = BeetleBank;
2996  // write lengthx12m to the map at alignment angle
2997  int area=0;
2998  int angle2=0;
2999  int width=cfg_BeetleBankWidth.value();
3000  if (a_angle==0) angle2=2;
3001  int start=(int)(a_length*0.1);
3002  for (int i=start; i<a_length; i++) {
3003  for (int w=0-width; w<width; w++) {
3004  int tx=w*m_x_add[angle2];
3005  int ty=w*m_y_add[angle2];
3006  m_land->Put( tx+a_x+i*m_x_add[a_angle], ty+a_y+i*m_y_add[a_angle], (int) m_elems.size() - 1 );
3007  m_land->Put( tx+a_x-i*m_x_add[a_angle], ty+a_y-i*m_y_add[a_angle], (int) m_elems.size() - 1 );
3008  area+=2;
3009  a_field->AddArea( -2.0 );
3010 
3011  }
3012  }
3013  BeetleBank->SetArea( double(area) );
3014  BeetleBank->SetValidXY( a_x+start*m_x_add[a_angle], a_y+start*m_y_add[a_angle] );
3015  BeetleBank->SetMapValid(true);
3016 
3017 }

References LE::AddArea(), LE_TypeClass::BackTranslateEleTypes(), cfg_BeetleBankWidth, g_letype, m_polymapping, LE::SetArea(), LE::SetMapValid(), LE::SetPoly(), LE::SetValidXY(), VegElement::SetVegPatchy(), start, tole_BeetleBank, tole_MownGrass, tole_PermanentSetaside, and CfgInt::value().

◆ BeetleBankPossible()

bool Landscape::BeetleBankPossible ( LE a_field,
TTypesOfLandscapeElement  a_tole 
)
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

Definition at line 2772 of file Landscape.cpp.

2772  {
2779  int farea=(int)a_field->GetArea();
2780  if (farea<10000) return false;
2781  int cx=a_field->GetCentroidX();
2782  int cy=a_field->GetCentroidY();
2783  // The centroid is the only estimate we have (and it at least should be in the field).
2784  // So start here and find the centre
2785  if (!FindFieldCenter(a_field, &cx, &cy)) return false;
2786  // now get the alignment
2787  int length=0;
2788  int alignment=FindLongestAxis(&cx, &cy, &length);
2789  // reduce length by 20%
2790  length=int(length*0.8);
2791  int area=2*length*cfg_BeetleBankWidth.value(); // 12m wide fixed size
2792  if (area>(farea*cfg_BeetleBankMaxArea.value())) return false;
2793  // Must be small engough so lets draw it
2794  BeetleBankAdd(cx, cy, alignment, length , a_field, a_tole);
2795  return true;
2796 }

References cfg_BeetleBankMaxArea, cfg_BeetleBankWidth, LE::GetArea(), CfgInt::value(), and CfgFloat::value().

◆ BorderAdd()

void Landscape::BorderAdd ( LE a_field,
TTypesOfLandscapeElement  a_type 
)
protected

Definition at line 2347 of file Landscape.cpp.

2347  {
2348  int x = a_field->GetValidX();
2349  int y = a_field->GetValidY();
2350  if ( ( x == -1 ) || ( y == -1 ) ) {
2351  g_msg->Warn( WARN_BUG, "Landscape::BorderAdd(): Uninitialized border coordinate!", "" );
2352  exit( 1 );
2353  }
2354  LE * border = NewElement(a_type);
2355  a_field->SetBorder( border );
2356  m_polymapping[ hb_first_free_poly_num ] = (int) m_elems.size();
2357  m_elems.resize( m_elems.size() + 1 );
2358  m_elems[ m_elems.size() - 1 ] = border;
2359  border->SetPoly( hb_first_free_poly_num++ );
2360  border->SetArea( 0.0 );
2362 }

References g_map_le_borderwidth, g_msg, LE::GetValidX(), LE::GetValidY(), m_polymapping, LE::SetArea(), LE::SetBorder(), LE::SetPoly(), CfgInt::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ BorderNeed()

bool Landscape::BorderNeed ( TTypesOfLandscapeElement  a_letype)
protected

Definition at line 4529 of file Landscape.cpp.

4529  {
4530  static char error_num[20];
4531  bool AddBorder = false;
4532  switch (a_letype) {
4533  // No border is needed toward these neighbouring element types.
4534  case tole_Hedges:
4535  case tole_HedgeBank:
4536  case tole_BeetleBank:
4537  case tole_RoadsideVerge:
4538  case tole_Marsh:
4539  case tole_RiversidePlants:
4541  case tole_OrchardBand:
4542  case tole_MownGrass:
4543  case tole_WaterBufferZone:
4544  break;
4545 
4546  case tole_IndividualTree:
4547  case tole_PlantNursery:
4548  case tole_Vildtager:
4549  case tole_WindTurbine:
4550  case tole_WoodyEnergyCrop:
4551  case tole_WoodlandMargin:
4552  case tole_Pylon:
4553  case tole_NaturalGrassDry:
4554  case tole_Railway:
4555  case tole_FieldBoundary:
4556  case tole_Scrub:
4557  case tole_Field:
4559  case tole_PermPasture:
4562  case tole_PitDisused:
4563  case tole_RiversideTrees:
4564  case tole_DeciduousForest:
4565  case tole_MixedForest:
4566  case tole_YoungForest:
4567  case tole_ConiferousForest:
4568  case tole_StoneWall:
4569  case tole_Fence:
4570  case tole_Garden:
4571  case tole_Track:
4572  case tole_SmallRoad:
4573  case tole_LargeRoad:
4574  case tole_Building:
4575  case tole_ActivePit:
4576  case tole_Pond:
4577  case tole_FishFarm:
4578  case tole_Freshwater:
4579  case tole_River:
4580  case tole_Saltwater:
4581  case tole_Coast:
4582  case tole_BareRock:
4583  case tole_Heath:
4584  case tole_Orchard:
4585  case tole_AmenityGrass:
4586  case tole_Parkland:
4587  case tole_UrbanNoVeg:
4588  case tole_UrbanVeg:
4589  case tole_UrbanPark:
4591  case tole_SandDune:
4592  case tole_Copse:
4593  case tole_NaturalGrassWet:
4594  case tole_RoadsideSlope:
4595  case tole_MetalledPath:
4596  case tole_Carpark:
4597  case tole_Churchyard:
4598  case tole_Saltmarsh:
4599  case tole_Stream:
4600  case tole_HeritageSite:
4601  AddBorder = true;
4602  break;
4603 
4604  default:
4605  sprintf(error_num, "%d", a_letype);
4606  g_msg->Warn(WARN_BUG, "Landscape::BorderNeed(): Unknown element type:", error_num);
4607  exit(1);
4608  }
4609  return AddBorder;
4610 }

References g_msg, tole_ActivePit, tole_AmenityGrass, tole_BareRock, tole_BeetleBank, tole_Building, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_ConiferousForest, tole_Copse, tole_DeciduousForest, tole_Fence, tole_Field, tole_FieldBoundary, tole_FishFarm, tole_Freshwater, tole_Garden, tole_Heath, tole_HedgeBank, tole_Hedges, tole_HeritageSite, tole_IndividualTree, tole_LargeRoad, tole_Marsh, tole_MetalledPath, tole_MixedForest, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_OrchardBand, tole_Parkland, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PitDisused, tole_PlantNursery, tole_Pond, tole_Pylon, tole_Railway, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideSlope, tole_RoadsideVerge, tole_Saltmarsh, tole_Saltwater, tole_SandDune, tole_Scrub, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UnsprayedFieldMargin, tole_UrbanNoVeg, tole_UrbanPark, tole_UrbanVeg, tole_Vildtager, tole_WaterBufferZone, tole_WindTurbine, tole_WoodlandMargin, tole_WoodyEnergyCrop, tole_YoungForest, MapErrorMsg::Warn(), and WARN_BUG.

◆ BorderRemoval()

void Landscape::BorderRemoval ( void  )
protected

Definition at line 2271 of file Landscape.cpp.

2271  {
2272  // This does not need to be efficient, just do the job
2273  for (int x=1; x<(m_width-1); x++)
2274  for (int y=1; y<(m_height-1); y++)
2275  {
2277  if ((tole==tole_FieldBoundary) || (tole==tole_HedgeBank) || (tole==tole_Hedges))
2278  {
2279  if ( SupplyElementType(x-1,y-1) == tole_Field)
2280  {
2281  // Set the x,y location to be this field
2282  int fieldindex = SupplyPolyRefIndex(x-1,y-1);
2283  m_land->Put( x, y, fieldindex );
2284 
2285  }
2286  else
2287  if ( SupplyElementType(x-1,y) == tole_Field)
2288  {
2289  // Set the x,y location to be this field
2290  int fieldindex = SupplyPolyRefIndex(x-1,y);
2291  m_land->Put( x, y, fieldindex );
2292 
2293  }
2294  else
2295  if ( SupplyElementType(x-1,y+1) == tole_Field)
2296  {
2297  // Set the x,y location to be this field
2298  int fieldindex = SupplyPolyRefIndex(x-1,y+1);
2299  m_land->Put( x, y, fieldindex );
2300 
2301  }
2302  else
2303  if ( SupplyElementType(x,y-1) == tole_Field)
2304  {
2305  // Set the x,y location to be this field
2306  int fieldindex = SupplyPolyRefIndex(x,y-1);
2307  m_land->Put( x, y, fieldindex );
2308 
2309  }
2310  else
2311  if ( SupplyElementType(x,y+1) == tole_Field)
2312  {
2313  // Set the x,y location to be this field
2314  int fieldindex = SupplyPolyRefIndex(x,y+1);
2315  m_land->Put( x, y, fieldindex );
2316 
2317  }
2318  else
2319  if ( SupplyElementType(x+1,y-1) == tole_Field)
2320  {
2321  // Set the x,y location to be this field
2322  int fieldindex = SupplyPolyRefIndex(x+1,y-1);
2323  m_land->Put( x, y, fieldindex );
2324 
2325  }
2326  else
2327  if ( SupplyElementType(x+1,y) == tole_Field)
2328  {
2329  // Set the x,y location to be this field
2330  int fieldindex = SupplyPolyRefIndex(x+1,y);
2331  m_land->Put( x, y, fieldindex );
2332 
2333  }
2334  else
2335  if ( SupplyElementType(x+1,y+1) == tole_Field)
2336  {
2337  // Set the x,y location to be this field
2338  int fieldindex = SupplyPolyRefIndex(x+1,y+1);
2339  m_land->Put( x, y, fieldindex );
2340 
2341  }
2342  }
2343  }
2344 }

References tole_Field, tole_FieldBoundary, tole_HedgeBank, and tole_Hedges.

◆ BorderScan()

void Landscape::BorderScan ( LE a_field,
int  a_width 
)
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.

Definition at line 2365 of file Landscape.cpp.

2366 {
2370  LE * border = a_field->GetBorder(); // border is the a border object
2371  int fieldpoly = a_field->GetPoly(); // fieldpoly is the polygon number
2372  int borderpoly = border->GetPoly(); // borderpoly is the polygon number
2373  int borderindex = m_polymapping[ borderpoly ]; // borderindex is the elems index for the border
2374  int fieldindex = m_polymapping[ fieldpoly ]; // fieldindex is the elems index
2375  int test = m_land->Get(a_field->GetCentroidX(), a_field->GetCentroidY());
2376  if (test != fieldindex)
2377  {
2378  g_msg->Warn("Landscape::BorderScan - Border Scan centroid does not return correct polygon index. Index :", fieldindex);
2379  g_msg->Warn(" Returned ", test);
2380  exit(0);
2381  }
2382  int notforever = 50000;
2383  vector<APoint> listoflocs;
2388  for (int wid = 0; wid < a_width; wid++)
2389  {
2390  notforever = 50000;
2391  // These two will be modified through pointer operations in BorderStep().
2392  APoint coord(a_field->GetCentroidX(), a_field->GetCentroidY());
2393  // Find the first edge cell
2394  AxisLoop(fieldindex, &coord, random(8));
2395  while (--notforever > 0)
2396  {
2397  // Check if this position should be made into a border.
2398  if (BorderTest(fieldindex, -99, coord.m_x, coord.m_y))
2399  {
2400  // Add this pixel to the border element in the big map, but using a code for later replacement.
2401  m_land->Put(coord.m_x, coord.m_y, -99); // this puts the elems index into our map in memory
2402  listoflocs.push_back(coord);
2403  a_field->AddArea(-1.0);
2404  if (l_map_exit_on_zero_area.value() && (a_field->GetArea()<1))
2405  {
2406  char polynum[20];
2407  sprintf(polynum, "%d", a_field->GetPoly());
2408  g_msg->Warn(WARN_FILE, "Landscape::BorderScan(): Polygon reached zero area " "when adding border. Poly num: ", polynum);
2409  exit(1);
2410  }
2411  border->AddArea(1.0);
2412  border->SetMapValid(true);
2413  }
2414  // Step to next coordinate. Quit when done.
2415  if (!BorderStep(fieldindex, -99, &coord))
2416  {
2417  break;
2418  }
2419  }
2420  for (std::vector<APoint>::iterator it = listoflocs.begin(); it != listoflocs.end(); ++it)
2421  {
2422  m_land->Put((*it).m_x, (*it).m_y, borderindex);
2423  }
2424  listoflocs.clear();
2425  }
2426 }

References LE::AddArea(), g_msg, LE::GetArea(), LE::GetBorder(), LE::GetPoly(), l_map_exit_on_zero_area, m_polymapping, LE::SetMapValid(), CfgBool::value(), MapErrorMsg::Warn(), and WARN_FILE.

◆ BorderStep() [1/2]

bool Landscape::BorderStep ( int  a_fieldpoly,
int  a_borderpoly,
APoint *  a_coord 
)
protected

Definition at line 2537 of file Landscape.cpp.

2537  {
2538  int index;
2539  int x_add[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
2540  int y_add[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
2541  int width = m_land->MapWidth();
2542  int height = m_land->MapHeight();
2543  int i = 7, counter = 8;
2544  bool running = true;
2545  // First scan for another pixel that belongs to this field.
2546  while (running)
2547  {
2548  if (!((a_coord->m_x) + x_add[i] >= width) && !((a_coord->m_x) + x_add[i] < 0) && !((a_coord->m_y) + y_add[i] >= height) && !((a_coord->m_y) + y_add[i] < 0))
2549  {
2550  index = m_land->Get((a_coord->m_x) + x_add[i], (a_coord->m_y) + y_add[i]);
2551  if (index == a_fieldindex)
2552  {
2553  // Found the first field pixel while scanning around always
2554  // in the same direction.
2555  running = false;
2556  }
2557  }
2558  if (--i < 0) {
2559  // Didn't find any of our pixels. We are in a blind alley. Exit
2560  // gracefully.
2561  return false; // Signal done scanning this field.
2562  }
2563  }
2564 
2565  // Now scan around from our present facing direction and find the border
2566  // (if any).
2567  while (--counter)
2568  {
2569  if (!((a_coord->m_x) + x_add[i] >= width) && !((a_coord->m_x) + x_add[i] < 0) && !((a_coord->m_y) + y_add[i] >= height) && !((a_coord->m_y) + y_add[i] < 0))
2570  {
2571  index = m_land->Get((a_coord->m_x) + x_add[i], (a_coord->m_y) + y_add[i]);
2572  if (index == a_fieldindex)
2573  {
2574  if (--i < 0) i = 7;
2575  continue;
2576  }
2577  }
2578 
2579  // Aha! This pixel is not ours. Step one step in the
2580  // opposite(!) direction. If that pixel is ours, then
2581  // modify hotspot coordinates and exit.
2582  if (++i > 7) i = 0;
2583  if (!((a_coord->m_x) + x_add[i] + 1 > width) && !((a_coord->m_x) + x_add[i] < 0) && !((a_coord->m_y) + y_add[i] + 1 > height) &&
2584  !((a_coord->m_y) + y_add[i] < 0) && (m_land->Get((a_coord->m_x) + x_add[i], (a_coord->m_y) + y_add[i]) == a_fieldindex))
2585  {
2586  (a_coord->m_x) += x_add[i];
2587  (a_coord->m_y) += y_add[i];
2588  return true;
2589  }
2590  }
2591  return false;
2592 }

◆ BorderStep() [2/2]

bool Landscape::BorderStep ( int  a_fieldpoly,
int  a_borderpoly,
int *  a_x,
int *  a_y 
)
protected

Definition at line 2479 of file Landscape.cpp.

2479  {
2480  int index;
2481  int x_add[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
2482  int y_add[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
2483  int width = m_land->MapWidth();
2484  int height = m_land->MapHeight();
2485  int i = 7, counter = 8;
2486  bool running = true;
2487  // First scan for another pixel that belongs to this field.
2488  while (running)
2489  {
2490  if (!((*a_x) + x_add[i] >= width) && !((*a_x) + x_add[i] < 0) && !((*a_y) + y_add[i] >= height) && !((*a_y) + y_add[i] < 0))
2491  {
2492  index = m_land->Get((*a_x) + x_add[i], (*a_y) + y_add[i]);
2493  if (index == a_fieldindex)
2494  {
2495  // Found the first field pixel while scanning around always
2496  // in the same direction.
2497  running = false;
2498  }
2499  }
2500  if (--i < 0) {
2501  // Didn't find any of our pixels. We are in a blind alley. Exit
2502  // gracefully.
2503  return false; // Signal done scanning this field.
2504  }
2505  }
2506 
2507  // Now scan around from our present facing direction and find the border
2508  // (if any).
2509  while (--counter)
2510  {
2511  if (!((*a_x) + x_add[i] >= width) && !((*a_x) + x_add[i] < 0) && !((*a_y) + y_add[i] >= height) && !((*a_y) + y_add[i] < 0))
2512  {
2513  index = m_land->Get((*a_x) + x_add[i], (*a_y) + y_add[i]);
2514  if (index == a_fieldindex)
2515  {
2516  if (--i < 0) i = 7;
2517  continue;
2518  }
2519  }
2520 
2521  // Aha! This pixel is not ours. Step one step in the
2522  // opposite(!) direction. If that pixel is ours, then
2523  // modify hotspot coordinates and exit.
2524  if (++i > 7) i = 0;
2525  if (!((*a_x) + x_add[i] + 1 > width) && !((*a_x) + x_add[i] < 0) && !((*a_y) + y_add[i] + 1 > height) &&
2526  !((*a_y) + y_add[i] < 0) && (m_land->Get((*a_x) + x_add[i], (*a_y) + y_add[i]) == a_fieldindex))
2527  {
2528  (*a_x) += x_add[i];
2529  (*a_y) += y_add[i];
2530  return true;
2531  }
2532  }
2533  return false;
2534 }

◆ BorderTest()

bool Landscape::BorderTest ( int  a_fieldpoly,
int  a_borderpoly,
int  a_x,
int  a_y 
)
protected

Definition at line 2452 of file Landscape.cpp.

2453 {
2454  int index;
2455  int x_add[ 8 ] = { 1, 1, 0, -1, -1, -1, 0, 1 };
2456  int y_add[ 8 ] = { 0, -1, -1, -1, 0, 1, 1, 1 };
2457  int width = m_land->MapWidth();
2458  int height = m_land->MapHeight();
2459  // Scan anti-clockwise from center pixel coordinate.
2460  for ( unsigned int i = 0; i < 8; i++ ) {
2461  if ( ( a_x + x_add[ i ] >= width ) || ( a_x + x_add[ i ] < 0 ) || ( a_y + y_add[ i ] >= height )
2462  || ( a_y + y_add[ i ] < 0 ) ) {
2463  return true;
2464  }
2465  //continue;
2466  index = m_land->Get( a_x + x_add[ i ], a_y + y_add[ i ] );
2467  if ( ( index != a_fieldindex ) && ( index != a_borderindex ) )
2468  {
2469  return true;
2470  // Test removed 1/07/2014 CJT
2471  //if ( BorderNeed( m_elems[ index ]->GetElementType() ) ) return true;
2472  //else return false;
2473  }
2474  }
2475  return false;
2476 }

◆ BuildingDesignationCalc()

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.

Definition at line 3287 of file Landscape.cpp.

3288 {
3293  cout << "In BuildingDesignationCalc" << endl;
3294  for (int p = 0; p< (int)m_elems.size(); p++)
3295  {
3296  TTypesOfLandscapeElement tole = m_elems[p]->GetElementType();
3297  if ( tole == tole_Building)
3298  {
3299  int cx = m_elems[p]->GetCentroidX();
3300  int cy = m_elems[p]->GetCentroidY();
3301  int near = 0;
3302  for (int j = 0; j< (int)m_elems.size(); j++)
3303  {
3304  if (m_elems[j]->GetElementType() == tole_Building)
3305  {
3306  int nx = m_elems[j]->GetCentroidX();
3307  int ny = m_elems[j]->GetCentroidY();
3308  int dx =abs(cx-nx);
3309  int dy =abs(cy-ny);
3310  if ((dx < cfg_mintownbuildingdistance.value()) && (dy < cfg_mintownbuildingdistance.value())) near++;
3311  if (near > cfg_mintownbuildingdistance.value()) break;
3312  }
3313  }
3314  if (near <= cfg_mintownbuildingnumber.value()) m_elems[p]->SetCountryDesignation(1); // Not enough buildings close by, so it is a country building
3315  else m_elems[p]->SetCountryDesignation(0);
3316  }
3317  else if (tole == tole_YoungForest)
3318  {
3319  m_elems[p]->SetCountryDesignation(2);
3320  }
3321  else if ((tole == tole_DeciduousForest) || ( tole == tole_MixedForest) || ( tole == tole_ConiferousForest ) ) m_elems[p]->SetCountryDesignation(3);
3322 
3323  }
3324 }

References cfg_mintownbuildingdistance, cfg_mintownbuildingnumber, tole_Building, tole_ConiferousForest, tole_DeciduousForest, tole_MixedForest, tole_YoungForest, and CfgInt::value().

◆ CalculateCentroids()

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.

Definition at line 3040 of file Landscape.cpp.

3041 {
3047  cout << "In Centroid Calculations" << endl;
3048  // For each polygon
3049  for (int p = 0; p< (int)m_elems.size(); p++)
3050  {
3051  // Calcuate the actual centre
3052  int x1 = m_elems[p]->GetMinX();
3053  int y1 = m_elems[p]->GetMinY();
3054  int x2 = m_elems[p]->GetMaxX();
3055  int y2 = m_elems[p]->GetMaxY();
3056 
3057  int midx = (x1 + x2) / 2;
3058  int midy = (y1 + y2) / 2;
3059  // Now from midx & midy we move outwards in concentric circles until we find a location that matches our polyref.
3060  int polyindex = p; // Change mapmapping has been called by now, so the map contains m_elems indices.
3061  CentroidSpiralOut(polyindex, midx, midy);
3062  // Now we want to be sure that we are in the middle of the polygon not on the edge. This is tricky for complex shaped polygons,
3063  // but we have a stab at it by using the FindLongestAxis method. This puts us in the centre of the longest axis in 8 directions
3064  // from this point
3065  int l;
3066  FindLongestAxis(&midx, &midy, &l);
3067  m_elems[p]->SetCentroid(midx, midy);
3068  }
3070 }

◆ CalculateOpenness()

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

Definition at line 322 of file Landscape.cpp.

323 {
327  cout << "In CalculateOpenness" << endl;
328 
329  for (unsigned int i = 0; i < m_elems.size(); i++)
330  {
331  TTypesOfLandscapeElement tole = m_elems[i]->GetElementType();
332  switch (tole)
333  {
334  case tole_Field:
335  case tole_Marsh:
336  case tole_Scrub:
340  case tole_PermPasture:
343  if (a_realcalc)
344  {
345  cout << i << " ";
346  m_elems[i]->SetOpenness(CalulateFieldOpennessAllCells(i));
347  }
348  else m_elems[i]->SetOpenness(0);
349  break;
350  default:
351  m_elems[i]->SetOpenness(0);
352  break;
353  }
354  }
355  if (a_realcalc) cout << endl;
356 }

References tole_Field, tole_Marsh, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, and tole_Scrub.

◆ CalulateFieldOpennessAllCells()

int Landscape::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.

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.

Definition at line 401 of file Landscape.cpp.

402 {
403  int dline;
404  int d0 = 0;
405  int minX = m_elems[a_pref]->GetMinX();
406  int minY = m_elems[a_pref]->GetMinY();
407  int maxX = m_elems[a_pref]->GetMaxX();
408  int maxY = m_elems[a_pref]->GetMaxY();
409  for (int ax = minX; ax <= maxX; ax+=10)
410  {
411  for (int ay = minY; ay <= maxY; ay+=10)
412  {
413  dline = m_maxextent; // this is the width of the landscape and will always be at least as big as the biggest return value possible
414  // Get a possible point for this field
415  int cx = ax;
416  int cy = ay;
417  if (m_land->Get(ax, ay) == a_pref)
418  {
423  double offsetx = -1;
424  double offsety = -1;
425  double dx = 1.0 / 45.0;
426  double dy = 0.0;
427  for (int deg = 0; deg<90; deg++)
428  {
430  int d1 = LineHighTest(cx, cy, offsetx, offsety);
431  int d2 = LineHighTest(cx, cy, 0 - offsetx, 0 - offsety);
432  int d = d1;
433  if (d1 > d2) d = d2;
434  if (dline > d) dline = d; // get the minimum
435  offsetx = offsetx + dx;
436  offsety = offsety + dy;
437  }
438  offsetx = 1;
439  offsety = 1;
440  dy = 0 - dx;
441  dx = 0;
442  for (int deg = 0; deg<90; deg++)
443  {
445  int d1 = LineHighTest(cx, cy, offsetx, offsety);
446  int d2 = LineHighTest(cx, cy, 0 - offsetx, 0 - offsety);
447  int d = d1;
448  if (d1 > d2) d = d2;
449  if (dline > d) dline = d;
450  offsetx = offsetx + dx;
451  offsety = offsety + dy;
452  }
453  if (dline > d0) d0 = dline; // Get the maximum. Here we might also want to do something like create statistics from the range of dline
454  }
455  }
456  }
457  return d0;
458 }

◆ CalulateFieldOpennessCentroid()

int Landscape::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.

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.

Definition at line 359 of file Landscape.cpp.

360 {
361  // Get the centre point for this field
362  int d0 = m_maxextent; // this is the width of the landscape and will always be at least as big as the biggest return value possible
363  int cx = m_elems[a_pref]->GetCentroidX();
364  int cy = m_elems[a_pref]->GetCentroidY();
365 
367  double offsetx = -1;
368  double offsety = -1;
369  double dx = 1.0 / 45.0;
370  double dy = 0.0;
371  for (int deg = 0; deg<90; deg++)
372  {
374  int d1 = LineHighTest(cx, cy, offsetx, offsety);
375  int d2 = LineHighTest(cx, cy, 0 - offsetx, 0 - offsety);
376  int d = d1;
377  if (d1 > d2) d = d2;
378  if (d0 > d) d0 = d;
379  offsetx = offsetx + dx;
380  offsety = offsety + dy;
381  }
382  offsetx = 1;
383  offsety = 1;
384  dy = 0 - dx;
385  dx = 0;
386  for (int deg = 0; deg<90; deg++)
387  {
389  int d1 = LineHighTest(cx, cy, offsetx, offsety);
390  int d2 = LineHighTest(cx, cy, 0 - offsetx, 0 - offsety);
391  int d = d1;
392  if (d1 > d2) d = d2;
393  if (d0 > d) d0 = d;
394  offsetx = offsetx + dx;
395  offsety = offsety + dy;
396  }
397  return d0;
398 }

◆ CentroidSpiralOut()

void Landscape::CentroidSpiralOut ( int  a_polyref,
int &  a_x,
int &  a_y 
)

Definition at line 3073 of file Landscape.cpp.

3074 {
3075  if (SupplyPolyRefIndex(a_x, a_y) == a_polyref) return; // Found it so return
3076  // Otherwise its not found so we need to start to spiral out
3077  int loop = 1;
3078  int sx = a_x;
3079  int sy = a_y;
3080  do {
3081  a_y = sy - loop;
3082  for (int i = 0 - loop; i <= loop; i++)
3083  {
3084  a_x = sx + i;
3085  CorrectCoords(a_x, a_y);
3086  if (SupplyPolyRefIndex(a_x, a_y) == a_polyref)
3087  return; // Found it so return
3088  }
3089  a_y = sy + loop;
3090  for (int i = 0 - loop; i <= loop; i++)
3091  {
3092  a_x = sx + i;
3093  CorrectCoords(a_x, a_y);
3094  if (SupplyPolyRefIndex(a_x, a_y) == a_polyref)
3095  return; // Found it so return
3096  }
3097  a_x = sx + loop;
3098  for (int j = 0 - (loop - 1); j< loop; j++)
3099  {
3100  a_y = sy + j;
3101  CorrectCoords(a_x, a_y);
3102  if (SupplyPolyRefIndex(a_x, a_y) == a_polyref)
3103  return; // Found it so return
3104  }
3105  a_x = sx - loop;
3106  for (int j = 0 - (loop - 1); j< loop; j++)
3107  {
3108  a_y = sy + j;
3109  CorrectCoords(a_x, a_y);
3110  if (SupplyPolyRefIndex(a_x, a_y) == a_polyref)
3111  return; // Found it so return
3112  }
3113  loop++;
3114  } while (loop<m_minmaxextent); // This stopping rule should hopefully not be needed, it is set very high.
3115  g_msg->Warn("Landscape::CentroidSpiralOut: Failure of centroid main loop. Looking for polygon index ",a_polyref);
3116  a_x = m_elems[a_polyref]->GetMinX();
3117  a_y = m_elems[a_polyref]->GetMinY();
3118 }

References g_msg, and MapErrorMsg::Warn().

◆ ChangeMapMapping()

void Landscape::ChangeMapMapping ( void  )
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.

Definition at line 2130 of file Landscape.cpp.

2130  {
2136  cout << "In Change Map Mapping" << endl;
2137  int mapwidth = m_land->MapWidth();
2138  int mapheight = m_land->MapHeight();
2139  int pest_map_width = mapwidth >> PEST_GRIDSIZE_POW2;
2140  if ( mapwidth & ( PEST_GRIDSIZE - 1 ) ) pest_map_width++;
2141  int oldindex = -1;
2142  for ( int x = 0; x < mapwidth; x++ )
2143  {
2144  for ( int y = 0; y < mapheight; y++ )
2145  {
2146  int polynum = m_land->Get( x, y ); // the polyref e.g. = 1, m_polymapping[ polynum ] = 0
2147  m_elems[ m_polymapping[ polynum ]]->SetMapIndex( m_polymapping[ polynum ] ); // Here we set index in the map to the index in elements, i.e. 0
2148  m_elems[ m_polymapping[ polynum ]]->SetMapValid( true );
2149  // Do the translation.
2150  m_land->Put( x, y, m_polymapping[ polynum ] ); // and now we write this to the map, i.e. 0
2151  // This coordinate is now valid. Throw these coordinates into
2152  // the associated landscape element.
2153  int index = m_polymapping[ SupplyPolyRef( x, y ) ];
2154  if ( index != oldindex )
2155  {
2156  m_elems[ index ]->SetValidXY( x, y );
2157  int l_x = x >> PEST_GRIDSIZE_POW2;
2158  int l_y = y >> PEST_GRIDSIZE_POW2;
2159  int pref = l_y * pest_map_width + l_x;
2160  m_elems[ index ]->SetPesticideCell( pref );
2161  oldindex = index;
2162  }
2163  }
2164  }
2165  RebuildPolyMapping();
2166 /*
2167 // Check that all of the polygons are mentioned in the map.
2168  if ( l_map_check_polygon_xref.value() )
2169  {
2170  for ( unsigned int i = 0; i < m_elems.size(); i++ )
2171  {
2172  if ( !m_elems[ i ]->GetMapValid() ) {
2173  char poly[ 20 ];
2174  sprintf( poly, "%d", m_elems[ i ]->GetPoly() );
2175  g_msg->Warn( WARN_FILE, "Landscape::ChangeMapMapping(): ""Polygon number referenced but not in map file: ", poly );
2176  exit( 1 );
2177  }
2178  }
2179  }
2180 */
2181 }

References m_polymapping, PEST_GRIDSIZE, and PEST_GRIDSIZE_POW2.

◆ CheckForPesticideRecord()

void Landscape::CheckForPesticideRecord ( LE a_field,
TTypesOfPesticideCategory  a_pcide 
)

Check if needed and record pesticide application.

Definition at line 669 of file Landscape.cpp.

670 {
672  {
673  if (cfg_pesticidemaptype.value() == false)
674  {
675  m_PesticideMap->Spray(a_field, a_pcide);
676  }
677  else
678  {
679  if (a_pcide == testpesticide) m_PesticideMap->Spray(a_field, insecticide);
680  }
681  }
682 }

References cfg_pesticidemapon, cfg_pesticidemaptype, insecticide, testpesticide, and CfgBool::value().

Referenced by Farm::FungicideTreat(), OptimisingFarm::FungicideTreat(), Farm::HerbicideTreat(), OptimisingFarm::HerbicideTreat(), Farm::InsecticideTreat(), OptimisingFarm::InsecticideTreat(), Farm::Molluscicide(), and Farm::ProductApplication().

◆ CIPELandscapeMaker()

bool Landscape::CIPELandscapeMaker ( )
protected

◆ ConsolidatePolys()

void Landscape::ConsolidatePolys ( void  )
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.

Definition at line 1329 of file Landscape.cpp.

1330 {
1336  const int TypesToReplace = 16;
1337  TTypesOfLandscapeElement replaceList[TypesToReplace] = {
1338  tole_River,
1342  tole_BareRock,
1344  tole_Carpark,
1346  tole_Coast,
1347  tole_Garden,
1352  tole_SandDune,
1354  };
1355  int foundList[TypesToReplace];
1356  cout << "Consolidating polygons with no special behaviour" << endl;
1357  for (int i = 0; i < TypesToReplace; i++) foundList[i] = -1;
1358  int mapwidth = m_land->MapWidth();
1359  int mapheight = m_land->MapHeight();
1360  for (int x = 0; x < mapwidth; x++)
1361  {
1362  for (int y = 0; y < mapheight; y++)
1363  {
1364  int ele = m_land->Get(x, y);
1365  TTypesOfLandscapeElement tole = m_elems[m_polymapping[ele]]->GetElementType();
1366  for (int t = 0; t < TypesToReplace; t++)
1367  {
1368  if (tole == replaceList[t])
1369  {
1370  // Must do something with this cell
1371  if (foundList[t] == -1) foundList[t] = ele;
1372  else
1373  {
1374  // Need to replace this cell
1375  m_land->Put(x, y, foundList[t]);
1376  }
1377  }
1378  }
1379  }
1380  }
1381  // At this point there should be many polygons that are not in the map. So we need to run the valid test.
1382  g_msg->Warn(WARN_FILE, "Landscape::ConsolidatePolys() - ""Consolidate map dump.", "");
1383 }

References g_msg, m_polymapping, tole_BareRock, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_Garden, tole_HeritageSite, tole_IndividualTree, tole_PlantNursery, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_Saltwater, tole_SandDune, tole_StoneWall, tole_UrbanNoVeg, MapErrorMsg::Warn(), and WARN_FILE.

◆ CorrectCoords()

void Landscape::CorrectCoords ( int &  x,
int &  y 
)
inline

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.

Definition at line 1535 of file landscape.h.

1536 {
1540  x = (m_width10 + x) % m_width;
1541  y = (m_height10 + y) % m_height;
1542 }

References m_height, m_height10, m_width, and m_width10.

◆ CorrectCoordsPointNoWrap()

void Landscape::CorrectCoordsPointNoWrap ( APoint &  a_pt)
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

Definition at line 1555 of file landscape.h.

1556 {
1560  if (a_pt.m_x >= m_width) a_pt.m_x = m_width - 1;
1561  if (a_pt.m_y >= m_height) a_pt.m_y = m_height - 1;
1562  if (a_pt.m_x < 0) a_pt.m_x = 0;
1563  if (a_pt.m_y < 0) a_pt.m_y = 0;
1564 }

References m_height, and m_width.

◆ CorrectCoordsPt()

APoint Landscape::CorrectCoordsPt ( int  x,
int  y 
)
inline

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.

Definition at line 1544 of file landscape.h.

1545 {
1549  APoint pt;
1550  pt.m_x = (m_width10 + x) % m_width;
1551  pt.m_y = (m_height10 + y) % m_height;
1552  return pt;
1553 }

References m_height, m_height10, m_width, and m_width10.

◆ CorrectHeight()

int Landscape::CorrectHeight ( int  y)
inline

Definition at line 1573 of file landscape.h.

1574 {
1575  return (m_height10+y)%m_height;
1576 }

References m_height, and m_height10.

◆ CorrectWidth()

int Landscape::CorrectWidth ( int  x)
inline

Definition at line 1567 of file landscape.h.

1568 {
1569  return (m_width10+x)%m_width;
1570 }

References m_width, and m_width10.

◆ CountMapSquares()

void Landscape::CountMapSquares ( void  )
protected

Definition at line 2040 of file Landscape.cpp.

2040  {
2041  int mapwidth = m_land->MapWidth();
2042  int mapheight = m_land->MapHeight();
2043  for ( unsigned int i = 0; i < m_elems.size(); i++ ) {
2044  m_elems[i]->SetArea(0);
2045  m_elems[ i ]->m_squares_in_map=0;
2046  }
2047 
2048  for ( int x = 0; x < mapwidth; x++ ) {
2049  for ( int y = 0; y < mapheight; y++ ) {
2050  int l_ele = m_land->Get( x, y );
2051  m_elems[ l_ele ]->m_squares_in_map++;
2052  }
2053  }
2054 }

◆ CreatePondList()

void Landscape::CreatePondList ( )
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

Definition at line 2594 of file Landscape.cpp.

2595 {
2597  for (unsigned int i = 0; i < m_elems.size(); i++)
2598  {
2599  if (m_elems[i]->GetElementType() == tole_Pond) {
2600  m_PondIndexList.push_back(i);
2601  m_PondRefsList.push_back(m_elems[i]->GetPoly());
2602  }
2603  }
2604 }

References tole_Pond.

◆ DegreesDump()

void Landscape::DegreesDump ( )
protected

Prints the sum of day degrees. See FarmManager::daydegrees.

Definition at line 1687 of file Landscape.cpp.

1687  {
1688 
1689  ofstream ofile ("Daydegrees.txt", ios::app);
1690  //print degrees
1691  ofile << m_FarmManager->GetDD();
1692  ofile << endl;
1693  ofile.close();
1694 }

◆ DumpAllSymbolsAndExit()

void Landscape::DumpAllSymbolsAndExit ( const char *  a_dumpfile)
inline

Definition at line 785 of file landscape.h.

785  {
786  g_cfg->DumpAllSymbolsAndExit( a_dumpfile );
787  }

References Configurator::DumpAllSymbolsAndExit(), and g_cfg.

◆ DumpCentroids()

void Landscape::DumpCentroids ( void  )

Definition at line 3275 of file Landscape.cpp.

3276 {
3277  ofstream centroidfile("PolygonCentroids.txt", ios::out);
3278  centroidfile<<"Polyref"<<'\t'<<"CX"<<'\t'<<"CY"<<'\t'<<"Type"<<'\t'<<"Area"<<'\t'<<"Country Designation"<<endl;
3279  for (int p = 0; p< (int)m_elems.size(); p++)
3280  {
3281  centroidfile<<m_elems[p]->GetPoly()<<'\t'<<m_elems[p]->GetCentroidX()<<'\t'<<m_elems[p]->GetCentroidY()<<'\t'<<m_elems[p]->GetElementType()<<'\t'<<m_elems[p]->GetArea()<<'\t'<<m_elems[p]->GetCountryDesignation()<<endl;
3282  }
3283  centroidfile.close();
3284 }

◆ DumpMap()

void Landscape::DumpMap ( const char *  a_filename)
protected

Definition at line 1386 of file Landscape.cpp.

1387 {
1388  int * l_map = m_land->GetMagicP(0, 0); // Hmmm - this is a nasty way round the class data protection. Gets a pointer direct to m_map in rastermap.
1389  /* FILE * l_file;
1390  l_file = fopen(a_filename, "wb" );
1391  if ( !l_file ) {
1392  g_msg->Warn( WARN_FILE, "Landscape::DumpMap(): Unable to open file", a_filename );
1393  exit( 0 );
1394  }
1395 
1396  char * l_id = m_land->GetID();
1397 
1398 
1399  fwrite( l_id, 1, 12, l_file );
1400  fwrite( & m_width, 1, sizeof( int ), l_file );
1401  if (cfg_rectangularmaps_on.value() )
1402  {
1403  fwrite( & m_height, 1, sizeof( int ), l_file );
1404  }
1405  for ( int i = 0; i < m_width * m_height; i++ )
1406  {
1407  LE* le = m_elems[m_polymapping[l_map[i]]];
1408  int l_poly = le->GetPoly();
1409  fwrite( & l_poly, 1, sizeof( int ), l_file );
1410  }
1411  fclose( l_file );
1412  */
1413  ofstream OFile( a_filename, ios::binary);
1414  char id[12] = { "LSB2_Format" };
1415  OFile.write(id, 12);
1416  OFile.write((char*)&m_width, sizeof (int));
1417  OFile.write((char*)&m_height, sizeof (int));
1418  OFile.write((char*)l_map, m_width*m_height*sizeof (int));
1419  OFile.close();
1420 }

◆ DumpMapGraphics()

void Landscape::DumpMapGraphics ( const char *  a_filename)
protected

Definition at line 3599 of file Landscape.cpp.

3599  {
3600  unsigned int linesize = m_maxextent * 3;
3601  unsigned char * frame_buffer = (unsigned char *)malloc(sizeof(unsigned char)* linesize);
3602 
3603  if (frame_buffer == NULL) {
3604  g_msg->Warn(WARN_FILE, "Landscape::DumpMapGraphics(): Out of memory!", "");
3605  exit(1);
3606  }
3607 
3608  FILE * l_file = fopen(a_filename, "w");
3609  if (!l_file) {
3610  g_msg->Warn(WARN_FILE, "Landscape::DumpMapGraphics(): ""Unable to open file for writing: %s\n", a_filename);
3611  exit(1);
3612  }
3613 
3614  fprintf(l_file, "P6\n%d %d %d\n", m_width, m_height, 255);
3615 
3616  for (int y = 0; y < m_height; y++) {
3617  int i = 0;
3618  for (int x = 0; x < m_width; x++) {
3619  int eletype = (int)SupplyElementType(x, y);
3620  int localcolor = 16777215 / eletype;
3621 
3622  if (eletype == (int)tole_Field) {
3623  int category;
3624  double hei = SupplyVegHeight(x, y);
3625  if (hei > 50.0) category = 0; else category = (int)(200.0 - (hei * 4.0));
3626  localcolor = ((category * 65536) + 65535);
3627  }
3628 
3629  frame_buffer[i++] = (unsigned char)(localcolor & 0xff);
3630  frame_buffer[i++] = (unsigned char)((localcolor >> 8) & 0xff);
3631  frame_buffer[i++] = (unsigned char)((localcolor >> 16) & 0xff);
3632  }
3633  fwrite(frame_buffer, sizeof(unsigned char), linesize, l_file);
3634  }
3635 
3636  fclose(l_file);
3637 
3638  free(frame_buffer);
3639 }

References g_msg, tole_Field, MapErrorMsg::Warn(), and WARN_FILE.

◆ DumpMapInfoByArea()

void Landscape::DumpMapInfoByArea ( const char *  a_filename,
bool  a_append,
bool  a_dump_zero_areas,
bool  a_write_veg_names 
)

Definition at line 3652 of file Landscape.cpp.

3652  {
3653  FillVegAreaData();
3654  FILE * outf;
3655  if (a_append) {
3656  outf = fopen(a_filename, "a");
3657  if (!outf) {
3658  g_msg->Warn(WARN_FILE, "Landscape::DumpMapInfoByArea(): ""Unable to open file for appending", a_filename);
3659  exit(1);
3660  }
3661  }
3662  else {
3663  outf = fopen(a_filename, "w");
3664  if (!outf) {
3665  g_msg->Warn(WARN_FILE, "Landscape::DumpMapInfoByArea(): ""Unable to open file for writing", a_filename);
3666  exit(1);
3667  }
3668  }
3669 
3670  // Emit element type info.
3671  for (unsigned int i = 0; i < tov_Undefined + 1; i++) {
3672  if (i == tov_OFirstYearDanger)
3673  continue;
3674  if (!a_dump_zero_areas && l_vegtype_areas[i] < 0.5)
3675  continue;
3676 
3677  fprintf(outf, "%6ld\t%3d\t%10.0f", g_date->OldDays() + g_date->DayInYear() - 364, i, l_vegtype_areas[i]);
3678  if (a_write_veg_names)
3679  fprintf(outf, "\t%s\n", VegtypeToString((TTypesOfVegetation)i).c_str()); else
3680  fprintf(outf, "\n");
3681  }
3682 
3683  fclose(outf);
3684 }

References Calendar::DayInYear(), g_date, g_msg, Calendar::OldDays(), tov_OFirstYearDanger, tov_Undefined, MapErrorMsg::Warn(), and WARN_FILE.

◆ DumpPublicSymbols()

void Landscape::DumpPublicSymbols ( const char *  a_dumpfile,
CfgSecureLevel  a_level 
)
inline

Definition at line 781 of file landscape.h.

782  {
783  g_cfg->DumpPublicSymbols( a_dumpfile, a_level );
784  }

References Configurator::DumpPublicSymbols(), and g_cfg.

◆ DumpTreatCounters()

void Landscape::DumpTreatCounters ( const char *  a_filename)
protected

Definition at line 3586 of file Landscape.cpp.

3586  {
3587  FILE * l_file = fopen(a_filename, "w");
3588  if (!l_file) {
3589  g_msg->Warn(WARN_FILE, "Landscape::DumpTreatCounters(): ""Unable to open file for writing: %s\n", a_filename);
3590  exit(1);
3591  }
3592 
3593  for (int i = start; i < last_treatment; i++) {
3594  fprintf(l_file, "%3d %s %10d\n", i, EventtypeToString(i).c_str(), m_treatment_counts[i]);
3595  }
3596  fclose(l_file);
3597 }

References g_msg, last_treatment, start, MapErrorMsg::Warn(), and WARN_FILE.

◆ DumpVegAreaData()

void Landscape::DumpVegAreaData ( int  a_day)

Definition at line 4680 of file Landscape.cpp.

4680  {
4681 
4682  if (cfg_dumpvegjan.value()) {
4683  if ((a_day % 365) == 0) { // Jan 1st
4684  DumpMapInfoByArea(cfg_dumpvegjanfile.value(), true, true, true);
4685  return;
4686  }
4687  }
4688  if (cfg_dumpvegjune.value()) {
4689  if ((a_day % 365) == 152) { // 1st June
4690  DumpMapInfoByArea(cfg_dumpvegjunefile.value(), true, true, true);
4691  }
4692  }
4693 
4694 }

References cfg_dumpvegjan, cfg_dumpvegjanfile, cfg_dumpvegjune, cfg_dumpvegjunefile, CfgBool::value(), and CfgStr::value().

◆ EventDump()

void Landscape::EventDump ( int  x,
int  y,
int  x2,
int  y2 
)
protected

Definition at line 1697 of file Landscape.cpp.

1697  {
1698  FILE * vfile=fopen("EventDump.txt", "a" );
1699  if (!vfile) {
1700  g_msg->Warn( WARN_FILE, "Landscape::EventDump(): Unable to open file", "EventDump.txt" );
1701  exit( 1 );
1702  }
1703  FarmToDo event;
1704  int i = 0;
1705  int day = SupplyDayInYear();
1706  fprintf( vfile, "%d: ", day );
1707  while ( ( event = ( FarmToDo )SupplyLastTreatment( x1, y1, & i ) ) != sleep_all_day ) {
1708  fprintf( vfile, "%d ", event );
1709  }
1710  i = 0;
1711  fprintf( vfile, " - " );
1712  while ( ( event = ( FarmToDo )SupplyLastTreatment( x2, y2, & i ) ) != sleep_all_day ) {
1713  fprintf( vfile, "%d ", event );
1714  }
1715  fprintf( vfile, "\n" );
1716  fclose( vfile );
1717 }

References g_msg, sleep_all_day, MapErrorMsg::Warn(), and WARN_FILE.

◆ EventDumpPesticides()

void Landscape::EventDumpPesticides ( int  x1,
int  y1 
)
protected

Definition at line 1720 of file Landscape.cpp.

1720  {
1721  FILE * vfile=fopen("EventDump.txt", "a" );
1722  if (!vfile) {
1723  g_msg->Warn( WARN_FILE, "Landscape::EventDump(): Unable to open file", "EventDump.txt" );
1724  exit( 1 );
1725  }
1726  FarmToDo a_event;
1727  int i = 0;
1728  int day = this->SupplyGlobalDate();
1729  int herb = 0;
1730  int fung = 0;
1731  int ins = 0;
1732  while ( ( a_event = ( FarmToDo )SupplyLastTreatment( x1, y1, & i ) ) != sleep_all_day ) {
1733  if (a_event == herbicide_treat )
1734  {
1735  herb++;
1736  }
1737  else if (a_event == fungicide_treat ) fung++;
1738  else if (a_event == insecticide_treat) ins++;
1739  }
1740  if (herb+fung+ins >0 ) fprintf( vfile, "%d\t%d\t%d\t%d\n", day, herb, fung, ins );
1741  i = 0;
1742  fclose( vfile );
1743 }

References fungicide_treat, g_msg, herbicide_treat, insecticide_treat, sleep_all_day, MapErrorMsg::Warn(), and WARN_FILE.

◆ EventtypeToString()

std::string Landscape::EventtypeToString ( int  a_event)

Definition at line 3918 of file Landscape.cpp.

3918  {
3919  char error_num[20];
3920 
3921  switch (a_event) {
3922  case start:
3923  return " start";
3924  case sleep_all_day:
3925  return " sleep_all_day";
3926  case autumn_plough:
3927  return " autumn_plough";
3928  case stubble_plough:
3929  return " stubble_plough";
3931  return " stubble_cultivator_heavy";
3933  return " heavy_cultivator_aggregate";
3934  case autumn_harrow:
3935  return " autumn_harrow";
3936  case preseeding_cultivator:
3937  return " preseeding_cultivator";
3939  return " preseeding_cultivator_sow";
3940  case autumn_roll:
3941  return " autumn_roll";
3942  case autumn_sow:
3943  return " autumn_sow";
3944  case winter_plough:
3945  return " winter_plough";
3946  case deep_ploughing:
3947  return " deep_ploughing";
3948  case spring_plough:
3949  return " spring_plough";
3950  case spring_harrow:
3951  return " spring_harrow";
3952  case spring_roll:
3953  return " spring_roll";
3954  case spring_sow:
3955  return " spring_sow";
3956  case spring_sow_with_ferti:
3957  return " spring_sow_with_ferti";
3958  case fp_npks:
3959  return " fp_npks";
3960  case fp_npk:
3961  return " fp_npk";
3962  case fp_pk:
3963  return " fp_pk";
3964  case fp_liquidNH3:
3965  return " fp_liquidNH3";
3966  case fp_slurry:
3967  return " fp_slurry";
3968  case fp_ammoniumsulphate:
3969  return " fp_ammoniumsulphate";
3970  case fp_manganesesulphate:
3971  return " fp_manganesesulphate";
3972  case fp_manure:
3973  return " fp_manure";
3974  case fp_greenmanure:
3975  return " fp_greenmanure";
3976  case fp_sludge:
3977  return " fp_sludge";
3978  case fp_rsm:
3979  return " fp_rsm";
3980  case fp_calcium:
3981  return " fp_calcium";
3982  case fa_npk:
3983  return " fa_npk";
3984  case fa_pk:
3985  return " fa_pk";
3986  case fa_slurry:
3987  return " fa_slurry";
3988  case fa_ammoniumsulphate:
3989  return " fa_ammoniumsulphate";
3990  case fa_manganesesulphate:
3991  return " fa_manganesesulphate";
3992  case fa_manure:
3993  return " fa_manure";
3994  case fa_greenmanure:
3995  return " fa_greenmanure";
3996  case fa_sludge:
3997  return " fa_sludge";
3998  case fa_rsm:
3999  return " fa_rsm";
4000  case fa_calcium:
4001  return " fa_calcium";
4002  case herbicide_treat:
4003  return " herbicide_treat";
4004  case growth_regulator:
4005  return " growth_regulator";
4006  case fungicide_treat:
4007  return " fungicide_treat";
4008  case insecticide_treat:
4009  return " insecticide_treat";
4010  case product_treat:
4011  return "pesticide_product_treat";
4012  case syninsecticide_treat:
4013  return " syninsecticide_treat";
4014  case molluscicide:
4015  return " molluscicide";
4016  case row_cultivation:
4017  return " row_cultivation";
4018  case strigling:
4019  return " strigling";
4020  case flammebehandling:
4021  return " flammebehandling";
4022  case hilling_up:
4023  return " hilling_up";
4024  case water:
4025  return " water";
4026  case swathing:
4027  return " swathing";
4028  case harvest:
4029  return " harvest";
4030  case cattle_out:
4031  return " cattle_out";
4032  case pigs_out:
4033  return " pigs_out";
4034  case cut_to_hay:
4035  return " cut_to_hay";
4036  case cut_to_silage:
4037  return " cut_to_silage";
4038  case straw_chopping:
4039  return " straw_chopping";
4040  case hay_turning:
4041  return " hay_turning";
4042  case hay_bailing:
4043  return " hay_bailing";
4044  case stubble_harrowing:
4045  return " stubble_harrowing";
4047  return "autumn_or_spring_plough";
4048  case burn_straw_stubble:
4049  return " burn_straw_stubble";
4050  case mow:
4051  return " mow";
4052  case cut_weeds:
4053  return " cut_weeds";
4054  case strigling_sow:
4055  return " strigling_sow";
4057  return "PesticideTrialTreatment";
4058  case trial_toxiccontrol:
4059  return " PesticideTrialToxic";
4060  case trial_control:
4061  return " PesticideTrialControl";
4062  case glyphosate:
4063  return " Glyphosate on setaside";
4064  case biocide:
4065  return " biocide";
4066  case strigling_hill:
4067  return " strigling_hill";
4068  case bed_forming:
4069  return " bed_forming";
4070  case flower_cutting:
4071  return " flower_cutting";
4072  case bulb_harvest:
4073  return " bulb_harvest";
4074  case straw_covering:
4075  return " straw_covering";
4076  case straw_removal:
4077  return " straw_removal";
4078  default:
4079  sprintf(error_num, "%d", a_event);
4080  g_msg->Warn(WARN_FILE, "Landscape::EventtypeToString(): Unknown event type:", error_num);
4081  exit(1);
4082  }
4083 }

References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, bed_forming, biocide, bulb_harvest, burn_straw_stubble, cattle_out, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, fa_ammoniumsulphate, fa_calcium, fa_greenmanure, fa_manganesesulphate, fa_manure, fa_npk, fa_pk, fa_rsm, fa_sludge, fa_slurry, flammebehandling, flower_cutting, fp_ammoniumsulphate, fp_calcium, fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_rsm, fp_sludge, fp_slurry, fungicide_treat, g_msg, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, heavy_cultivator_aggregate, herbicide_treat, hilling_up, insecticide_treat, molluscicide, mow, pigs_out, preseeding_cultivator, preseeding_cultivator_sow, product_treat, row_cultivation, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, spring_sow_with_ferti, start, straw_chopping, straw_covering, straw_removal, strigling, strigling_hill, strigling_sow, stubble_cultivator_heavy, stubble_harrowing, stubble_plough, swathing, syninsecticide_treat, trial_control, trial_insecticidetreat, trial_toxiccontrol, MapErrorMsg::Warn(), WARN_FILE, water, and winter_plough.

◆ FillVegAreaData()

void Landscape::FillVegAreaData ( )

Definition at line 3641 of file Landscape.cpp.

3641  {
3642  for (unsigned int i = 0; i < (tov_Undefined + 1); i++) {
3643  l_vegtype_areas[i] = 0.0;
3644  }
3645 
3646  // Sum up statistics on element type.
3647  for (unsigned int i = 0; i < m_elems.size(); i++) {
3648  l_vegtype_areas[m_elems[i]->GetVegType()] += m_elems[i]->GetArea();
3649  }
3650 }

References tov_Undefined.

◆ FindFieldCenter()

bool Landscape::FindFieldCenter ( LE a_field,
int *  x,
int *  y 
)
protected

Definition at line 2799 of file Landscape.cpp.

2799  {
2800  // Start at x,y
2801  // works by selecting the point that is a mean of the co-ords of the centers of 4 axes from this point that are in the field.
2802  // Then do it again, and again until we don't move more than 1m or we have tried too many times
2803  int ourpoly=SupplyPolyRef(*(x),*(y));
2804  if (ourpoly!=a_field->GetPoly()) return false;
2805  int centers[2][8];
2806  int tries=0;
2807  int diff=999;
2808  int x1=*(x);
2809  int y1=*(y);
2810  int centreX=x1;
2811  int centreY=y1;
2812  // NB we might escape without bounds checking here because the polygon number does not wrap round - will only ever be a problem if we go SimX+1,SimY+1
2813  while ((diff>1) & (tries++<100)) {
2814  for (unsigned v=0; v<4; v++) {
2815  x1=centreX;
2816  y1=centreY;
2817  AxisLoop(ourpoly, &x1, &y1, v);
2818  centers[0][v]=x1-m_x_add[v];
2819  centers[1][v]=y1-m_y_add[v];
2820  x1=centreX;
2821  y1=centreY;
2822  AxisLoop(ourpoly, &x1, &y1, v+4);
2823  centers[0][v+4]=x1-m_x_add[v+4];
2824  centers[1][v+4]=y1-m_y_add[v+4];
2825 // centreX+=((centers[0][v]+x1-m_x_add[v+4])/2);
2826 // centreY+=((centers[1][v]+y1-m_y_add[v+4])/2);
2827  }
2828  int oldx=centreX;
2829  int oldy=centreY;
2830  centreX=0;
2831  centreY=0;
2832  for (int h=0; h<8; h++) {
2833  centreX+=centers[0][h];
2834  centreY+=centers[1][h];
2835  }
2836  centreX/=8;
2837  centreY/=8;
2838  diff=abs(oldx-centreX)+abs(oldy-centreY);
2839  }
2840  *(x)=centreX;
2841  *(y)=centreY;
2842  int tourpoly=SupplyPolyRef(*(x),*(y));
2843  if (tourpoly!=ourpoly) {
2844  return false; // can happen eg if there is a pond in the middle of the field
2845  }
2846 
2847  return true;
2848 }

References LE::GetPoly().

◆ FindLongestAxis()

int Landscape::FindLongestAxis ( int *  x,
int *  y,
int *  a_length 
)
protected

Definition at line 2851 of file Landscape.cpp.

2852 {
2853  int ourpoly=SupplyPolyRef(*(a_x),*(a_y));
2854  int dist[4];
2855  int distx[8];
2856  int disty[8];
2857  int found = -1;
2858  *(a_length) = 0;
2859  int dx[8];
2860  int dy[8];
2861  int fx[8];
2862  int fy[8];
2863  for (unsigned v=0; v<8; v++)
2864  {
2865  int x1=*(a_x);
2866  int y1=*(a_y);
2867  AxisLoop(ourpoly, &x1, &y1, v);
2868  x1 -= m_x_add[v];
2869  y1 -= m_y_add[v];
2870  dx[v] = abs(*(a_x)-x1);
2871  dy[v] = abs(*(a_y)-y1);
2872  fx[v] = x1;
2873  fy[v] = y1;
2874  distx[v] = dx[v];
2875  disty[v] = dy[v];
2876  }
2877  for (int di = 0; di < 4; di++)
2878  {
2879  int ddx = distx[di] + distx[di + 4];
2880  int ddy = disty[di] + disty[di + 4];
2881  if (ddx == 0) dist[di] = ddy; else dist[di] = ddx;
2882  if (dist[di] > *(a_length))
2883  {
2884  found = di;
2885  *(a_length) = dist[di];
2886  }
2887  }
2888  if (found == -1) return 0;
2889  // Now need to find the middle of the axis.
2890  int l = (*(a_length) / 2);
2891  if (fx[found] > fx[found + 4]) *(a_x) = fx[found + 4] + m_x_add[found] * l; else *(a_x) = fx[found + 4] - m_x_add[found + 4] * l;
2892  if (fy[found] > fy[found + 4]) *(a_y) = fy[found + 4] + m_y_add[found] * l; else *(a_y) = fy[found + 4] - m_y_add[found + 4] * l;
2893 
2894  return found;
2895 }

◆ FindValidXY()

bool Landscape::FindValidXY ( int  a_field,
int &  a_x,
int &  a_y 
)
protected

Definition at line 2688 of file Landscape.cpp.

2688  {
2689  // From a hopefully sensible starting point this method scans in the
2690  // 8 directions to find a good valid x and y matching a_field
2691  int x_add[ 8 ] = { 1, 1, 0, -1, -1, -1, 0, 1 };
2692  int y_add[ 8 ] = { 0, -1, -1, -1, 0, 1, 1, 1 };
2693  int index;
2694  int nx, ny;
2695  int width = m_land->MapWidth();
2696  int height = m_land->MapHeight();
2697  // Assume it has to within 100m
2698  for ( int i = 0; i < 100; i++ ) {
2699  for ( int l = 0; l < 8; l++ ) {
2700  nx = a_x + x_add[ l ] * i;
2701  ny = a_y + y_add[ l ] * i;
2702  if ( ( nx < width ) && ( nx >= 0 ) && ( ny < height ) && ( ny >= 0 ) ) {
2703  index = m_land->Get( nx, ny );
2704  if ( index == a_field ) {
2705  a_x = a_x + x_add[ l ] * i;
2706  a_y = a_y + y_add[ l ] * i;
2707  return true;
2708  }
2709  }
2710  }
2711  }
2712  return false;
2713 }

◆ ForceArea()

void Landscape::ForceArea ( void  )
protected

Definition at line 2072 of file Landscape.cpp.

2072  {
2073  int l_area_sum = 0;
2074 
2075  for ( unsigned int i = 0; i < m_elems.size(); i++ ) {
2076  m_elems[ i ]->SetArea( ( double )m_elems[ i ]->m_squares_in_map );
2077  if ( m_elems[ i ]->m_squares_in_map > 0 ) {
2078  m_elems[ i ]->SetMapValid( true );
2079  l_area_sum += m_elems[ i ]->m_squares_in_map;
2080  }
2081  }
2082 
2083  if ( l_area_sum != m_width * m_height ) {
2084  g_msg->Warn( WARN_BUG, "Landscape::ForceArea(): Polygon areas doesn't"" sum up to map area!", "" );
2085  exit( 1 );
2086  }
2087 }

References g_msg, MapErrorMsg::Warn(), and WARN_BUG.

◆ GetActualGooseGrazingForage() [1/2]

double Landscape::GetActualGooseGrazingForage ( int  a_polygon,
GooseSpecies  a_goose 
)
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.

Parameters
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)
Returns
KJ/min

Definition at line 607 of file landscape.h.

608  {
609  return m_elems[m_polymapping[a_polygon]]->GetGooseGrazingForage(a_goose);
610  }

References m_elems, and m_polymapping.

◆ GetActualGooseGrazingForage() [2/2]

double Landscape::GetActualGooseGrazingForage ( int  a_x,
int  a_y,
GooseSpecies  a_goose 
)
inline

Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by x,y location.

Parameters
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)
Returns
KJ/min

Definition at line 596 of file landscape.h.

597  {
598  return m_elems[m_land->Get(a_x, a_y)]->GetGooseGrazingForage(a_goose);
599  }

References RasterMap::Get(), m_elems, and m_land.

◆ GetGooseFields()

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.

Definition at line 685 of file Landscape.cpp.

686 {
693  GooseFieldList* alist = new GooseFieldList;
697  GooseFieldListItem gfli;
698  for (unsigned int i = 0; i < m_elems.size(); i++)
699  {
700  if (m_elems[i]->GetOpenness() > a_minopenness)
701  {
702  for (int g = gs_Pinkfoot; g < gs_foobar; g++)
703  {
704  gfli.grass[g] = m_elems[i]->GetGooseGrazingForage((GooseSpecies)g);
705  gfli.geesesp[g] = m_elems[i]->GetGooseSpNosToday((GooseSpecies)g);
706  gfli.geesespTimed[g] = m_elems[i]->GetGooseSpNosTodayTimed((GooseSpecies)g);
707  gfli.roostdists[g] = m_elems[i]->GetGooseRoostDist((GooseSpecies)g);
708  }
709  gfli.grain = m_elems[i]->GetBirdSeed();
710  gfli.maize = m_elems[ i ]->GetBirdMaize();
711  gfli.openness = m_elems[ i ]->GetOpenness();
712  int pref = m_elems[ i ]->GetPoly();
713  gfli.polyref = pref;
714  gfli.geese = m_elems[i]->GetGooseNosToday();
715  gfli.geeseTimed = m_elems[i]->GetGooseNosTodayTimed();
716  gfli.vegtype = m_elems[i]->GetVegType();
717  gfli.vegtypechr = VegtypeToString(m_elems[i]->GetVegType());
718  gfli.vegheight = m_elems[i]->GetVegHeight();
719  gfli.digestability = m_elems[i]->GetDigestability();
720  gfli.vegphase = m_elems[i]->GetVegPhase();
721  gfli.previouscrop = VegtypeToString( m_elems[ i ]->GetPreviousCrop( m_elems[ i ]->GetRotIndex() ) );
722  gfli.lastsownveg = VegtypeToString( m_elems[ i ]->GetLastSownVeg() );
723  alist->push_back(gfli);
724  }
725  }
726  return alist;
727 }

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::roostdists, GooseFieldListItem::vegheight, GooseFieldListItem::vegphase, GooseFieldListItem::vegtype, and GooseFieldListItem::vegtypechr.

◆ GetGooseNumbers() [1/2]

int Landscape::GetGooseNumbers ( int  a_poly)

This returns the number of geese on the polygon the day before.

Definition at line 3383 of file Landscape.cpp.

3383  {
3384  return m_elems[m_polymapping[a_polyref]]->GetGooseNos();
3385  }

References m_polymapping.

◆ GetGooseNumbers() [2/2]

int Landscape::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.

This returns the number of geese on the polygon the day before.

Definition at line 3397 of file Landscape.cpp.

3398  {
3399  return m_elems[m_land->Get(a_x, a_y)]->GetGooseNos();
3400  }

◆ GetHareFoodQuality()

double Landscape::GetHareFoodQuality ( int  a_polygon)
Todo:
Decide where to classify new LE types for hare 1

Definition at line 3403 of file Landscape.cpp.

3404 {
3405  double digest;
3406  TTypesOfLandscapeElement habitat = SupplyElementType(a_polygon);
3407  switch (habitat) {
3408  // Impossible stuff
3409  case tole_Building:
3410  case tole_Pond:
3411  case tole_Freshwater:
3412  case tole_River:
3413  case tole_Saltwater:
3414  case tole_Coast:
3415  case tole_BareRock:
3416  case tole_ConiferousForest:
3417  case tole_DeciduousForest:
3418  case tole_MixedForest:
3419  case tole_SmallRoad:
3420  case tole_LargeRoad:
3421  case tole_ActivePit:
3422  case tole_UrbanNoVeg:
3423  case tole_UrbanPark:
3424  case tole_SandDune:
3425  case tole_Copse:
3426  case tole_Stream:
3427  case tole_MetalledPath:
3428  case tole_Carpark:
3429  case tole_FishFarm:
3430  case tole_Fence:
3431  // EnergyBalance(activity_Foraging, 100); // This is a bug - it penalises for foraging in impossible areas - not intended but not found until after parameter fitting! Removed 28/07/2014
3432  return 0.0;
3433 
3434  // Questionable stuff
3435  case tole_RiversidePlants:
3436  case tole_RiversideTrees:
3437  case tole_Garden:
3438  case tole_Track:
3439  case tole_StoneWall:
3440  case tole_Hedges:
3441  case tole_Marsh:
3442  case tole_PitDisused:
3443  case tole_RoadsideVerge:
3444  case tole_Railway:
3445  case tole_Scrub:
3446  case tole_AmenityGrass:
3447  case tole_Parkland:
3449  case tole_Churchyard:
3450  case tole_HeritageSite:
3451  return 0.25; // was 0.25 being half of access to low digestability stuff
3452  // case tole_MownGrass:
3453  // digest = 0.8; // Added 28/07/2014 this is a way to compensate for the lack of choice when foraging, i.e. the whole area is assumed to be foraged equally.
3455  case tole_Wasteland:
3456  case tole_IndividualTree:
3457  case tole_WoodyEnergyCrop:
3458  case tole_PlantNursery:
3459  case tole_Pylon:
3460  case tole_WindTurbine:
3461  case tole_WoodlandMargin:
3462  case tole_Vildtager:
3463  default:
3464  digest = SupplyVegDigestability(a_polygon);
3465  }
3466 #ifdef __Perfectfood
3467  return 0.8;
3468 #else
3469 #ifdef __YEARLYVARIABLEFOODQUALITY
3470  digest *= m_OurPopulationManager->m_GoodYearBadYear;
3471 #endif
3472  double veg_height;
3473  double access = 1.0;
3474  // double grazedreduction[4] = { 1.0, 0.75, 0.5, 0.25 };
3475  double grazedreduction[4] = { 1.0, 0.8, 0.2, 0.05 };
3476  veg_height = SupplyVegHeight(a_polygon);
3477  double weeds = SupplyWeedBiomass(a_polygon);
3478  if ((veg_height <= 0) && (weeds < 0.1)) return 0.25; // Always something to eat, but not much.
3479 #ifdef __Hare1950s
3480  bool veg_patchy = true;
3481 #else // If it is not the special case of the 1950s
3482  //
3483  bool veg_patchy = SupplyVegPatchy(a_polygon);
3484 #endif
3485  if (veg_patchy)
3486  {
3487  // Patchy vegetation - normally full access
3488  if (veg_height>50)
3489  {
3490  // no food at only at very very tall
3491  access -= ((veg_height - 50)* g_VegHeightForageReduction);
3492  if (access<0) access = 0;
3493  }
3494  }
3495  else
3496  {
3497  if (veg_height>g_FarmIntensivenessH)
3498  {
3499  access -= ((veg_height - g_FarmIntensivenessH)* /* g_FarmIntensiveness * */ g_VegHeightForageReduction);
3500  if (access<0) access = 0;
3501  }
3502  }
3503  return access * digest * grazedreduction[SupplyGrazingPressure(a_polygon)];
3504 #endif
3505 }

References g_FarmIntensivenessH, g_VegHeightForageReduction, tole_ActivePit, tole_AmenityGrass, tole_BareRock, tole_Building, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_ConiferousForest, tole_Copse, tole_DeciduousForest, tole_Fence, tole_FishFarm, tole_Freshwater, tole_Garden, tole_Hedges, tole_HeritageSite, tole_IndividualTree, tole_LargeRoad, tole_Marsh, tole_MetalledPath, tole_MixedForest, tole_Parkland, tole_PitDisused, tole_PlantNursery, tole_Pond, tole_Pylon, tole_Railway, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideVerge, tole_Saltwater, tole_SandDune, tole_Scrub, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UrbanNoVeg, tole_UrbanPark, tole_Vildtager, tole_Wasteland, tole_WindTurbine, tole_WoodlandMargin, and tole_WoodyEnergyCrop.

◆ GetPolymapping()

int Landscape::GetPolymapping ( int  a_index)
inline

Definition at line 183 of file landscape.h.

183 { return m_polymapping[a_index]; }

References m_polymapping.

◆ GetQuarryNumbers()

int Landscape::GetQuarryNumbers ( int  a_poly)

This returns the number of geese which are legal quarry on the polygon the day before.

This returns the number of geese on the polygon the day before.

Definition at line 3390 of file Landscape.cpp.

3390  {
3391  return m_elems[m_polymapping[a_polyref]]->GetQuarryNos();
3392  }

References m_polymapping.

◆ GetVegArea()

double Landscape::GetVegArea ( int  v)
inline

Definition at line 170 of file landscape.h.

170 { return l_vegtype_areas[v]; }

References l_vegtype_areas.

◆ GISASCII_Output()

void Landscape::GISASCII_Output ( string  outpfile,
int  UTMX,
int  UTMY 
)
protected

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).

Parameters
[in]outpfileName of the output file
[in]UTMXUtm x-coordinate of the lower lefthand corner of the map
[in]UTMYUtm y-coordinate of the lower lefthand corner of the map

Definition at line 3507 of file Landscape.cpp.

3507  {
3515  FILE* OFILE;
3516  OFILE = fopen( outpfile.c_str(), "w" );
3517  if (!OFILE) {
3518  g_msg->Warn( WARN_FILE, "Landscape::GISASCII_Output() "
3519  "Unable to open file for writing:",
3520  outpfile );
3521  exit( 1 );
3522  }
3523  char c = '\n';
3524  fprintf(OFILE, "ncols %d\n", m_width);
3525  fprintf(OFILE, "nrows %d\n", m_height);
3526  fprintf(OFILE, "xllcorner %d\n", UTMX );
3527  fprintf(OFILE, "yllcorner %d\n", UTMY );
3528  fprintf(OFILE, "cellsize %d\n", 1 );
3529  fprintf(OFILE, "NODATA_value %d\n", -9999 );
3530  // The polyref loop
3531  if (l_map_ascii_map_entity.value() == 1) {
3532  for (int y = 0; y < m_height; y++) {
3533  for (int x = 0; x < m_width; x++) {
3534  fprintf(OFILE, "%d\t", SupplyPolyRef(x, y));
3535  }
3536  fprintf(OFILE, "%c", c );
3537  }
3538  }
3539  // The element type loop
3540  if (l_map_ascii_map_entity.value() == 2) {
3541  for (int y = 0; y < m_height; y++) {
3542  for (int x = 0; x < m_width; x++) {
3543  fprintf(OFILE, "%d\t", SupplyElementType( x, y ));
3544  }
3545  fprintf( OFILE, "%c", c );
3546  }
3547  }
3548  fclose( OFILE );
3549 }

References g_msg, l_map_ascii_map_entity, CfgInt::value(), MapErrorMsg::Warn(), and WARN_FILE.

◆ GrazeVegetation()

void Landscape::GrazeVegetation ( int  a_poly,
double  a_forage 
)
inline

Removes grazing forage from a poly per m2.

Definition at line 670 of file landscape.h.

670  {
671  m_elems[ m_polymapping[ a_poly ] ]->GrazeVegetation( a_forage, true );
672  }

References m_elems, and m_polymapping.

◆ GrazeVegetationTotal()

void Landscape::GrazeVegetationTotal ( int  a_poly,
double  a_forage 
)
inline

Removes grazing forage from a poly and divides this out per m2.

Definition at line 676 of file landscape.h.

676  {
677  m_elems[ m_polymapping[ a_poly ] ]->GrazeVegetationTotal( a_forage );
678  }

References m_elems, and m_polymapping.

◆ hb_Add()

void Landscape::hb_Add ( void  )
protected

Definition at line 56 of file hedgebanks.cpp.

57 {
58  // Make a local copy of the actual map parameters for speed
59  // purposes. We are going to use these *a lot*.
60  hb_map = m_land->GetMagicP( 0, 0 );
64 
65  //#ifdef HB_TESTING
66  //m_elems[m_polymapping
67  //[hb_map[750 + 600*hb_width]]]->SetElementType( tole_Hedges );
68  //#endif
69 
70  // Generate a list of polygon numbers + HB_MAGIC for all hedge elements
71  // in our current map.
72  hb_FindHedges();
73 
74  // As one lemming at the cliff edge said to the other: "Let's Go!"
75 
76  // For every hedge polygon:
77  printf("Hedges: %d\n", int(hb_hedges.size()));
78  fflush(stdout);
79 
80  double l_inc = 50.0/((double)hb_hedges.size());
81  double l_count = 0.001;
82 
83  for ( unsigned int i=0; i<hb_hedges.size(); i++ ) {
84  l_count += l_inc;
85  if ( l_count > 1.0 ) {
86  l_count = 0.001;
87  printf(".");
88  fflush(stdout);
89  }
90  // Find the enclosing bounding box for our current polygon.
91  if ( ! hb_FindBoundingBox( hb_hedges[i] )) {
92  // Might want to raise a runtime error upon ending here.
93  // The test for hb_FindBoundingBox() fails if we have a polygon
94  // without any pixels in the main map!
95  continue;
96  }
97 
98  // Move all polygon numbers in our bounding box up! by HB_MAGIC
99  // to make room for our 'paint' values in the space below.
101 
103 
104  hb_PaintBorder( 0 );
105 
106  int l_color = 0;
107  while ( hb_PaintWhoHasNeighbourColor( l_color,
108  l_color + 1 )) {
109  l_color++;
110  }
111 
112  double l_percent = (double)hb_core_pixels/
113  ((double)hb_core_pixels+(double)hb_border_pixels);
114 
115  if ( l_percent > l_map_art_hb_core_thres.value()) {
116  // We ought to have at least *some* visible core area
117  // within the polygon, so do a simple scan.
118 
119  // l_color now happens to contain the maximum contour/color value
120  // within our current polygon.
121  int l_min = (int)((double)l_color * l_map_art_hb_width.value());
122  while ( l_color > l_min ) {
123  hb_MarkTopFromLocalMax( l_color );
125  l_color--;
126  }
127  } else {
128  // Very thin hedge (1->2 meters),
129  // use special border case scan when adding hedge banks.
131  }
132 
134 
135  // All the previous steps were just preparations.
136  // Now do the serious stuff.
138 
139 #ifdef HB_TESTING
140  // Sanity check.
141  for ( int j=0; j<hb_size; j++ ) {
142  if ( m_polymapping[ hb_map[ j ] - HB_MAGIC ] == -1 ) {
143  printf("Oh dear!\n");
144  exit(1);
145  }
146  }
147 
148  char ffname[24];
149  sprintf( ffname, "test%02d.ppm", i);
150 #endif
151 
152  // Restore order to the map before continuing.
154 
155 #ifdef HB_TESTING
156  hb_dump_map( 0, hb_width, 0, hb_height, ffname, false );
157 #endif
158  }
159 
160  printf("\n");
161 #ifdef HB_TESTING
162  // Quick reminder.
163  for ( unsigned int i=0; i<m_elems.size(); i++ ) {
164  if ( m_elems[i]->GetArea() < 0.9 &&
165  m_elems[i]->GetElementType() != tole_FieldBoundary ) {
166  // Note: Field boundaries have not been scanned yet at this point,
167  // so they will have a zero area right here and now.
168  printf("Warning: Polygon %6d of type %s came up with area %3.2f!\n",
169  m_elems[i]->GetPoly(),
170  PolytypeToString( m_elems[i]->GetElementType() ),
171  m_elems[i]->GetArea() );
172  }
173  }
174  exit(0);
175 #endif
176 }

References RasterMap::GetMagicP(), hb_AddNewHedgebanks(), hb_border_pixels, hb_ClearPolygon(), hb_core_pixels, hb_DownPolyNumbers(), hb_FindBoundingBox(), hb_FindHedges(), hb_hedges, hb_height, HB_MAGIC, hb_map, hb_MarkTheBresenhamWay(), hb_MarkTopFromLocalMax(), hb_PaintBorder(), hb_PaintWhoHasNeighbourColor(), hb_ResetColorBits(), hb_RestoreHedgeCore(), hb_size, hb_UpPolyNumbers(), hb_width, l_map_art_hb_core_thres, l_map_art_hb_width, m_elems, m_land, m_polymapping, RasterMap::MapHeight(), RasterMap::MapWidth(), PolytypeToString(), tole_FieldBoundary, and CfgFloat::value().

◆ hb_AddNewHedgebanks()

void Landscape::hb_AddNewHedgebanks ( int  a_orig_poly_num)
protected

Definition at line 198 of file hedgebanks.cpp.

199 {
201 
202  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++ ) {
203  for ( int l_x=hb_min_x; l_x<=hb_max_x; l_x++ ) {
204  int i = l_y*hb_width + l_x;
205  int l_val = hb_map[ i ];
206  if ( l_val >= 0 && l_val < HB_MAGIC ) {
207  hb_map[ i ] = hb_StripingDist() + HB_MAGIC;
208  /*
209  m_elems[m_polymapping[hb_map[ i ]-HB_MAGIC]]->AddArea( 1.0 );
210  m_elems[m_polymapping[hb_map[ i ]-HB_MAGIC]]->m_squares_in_map++;
211  m_elems[m_polymapping[a_orig_poly_num]]->AddArea( -1.0 );
212  if ( m_elems[m_polymapping[a_orig_poly_num]]->GetArea() < 0.0 ) {
213  printf("%d %d !!!\n", l_x, l_y );
214  exit(1);
215  }
216  */
217  //m_elems[m_polymapping[a_orig_poly_num]]->m_squares_in_map--;
218  }
219  }
220  }
221 }

References hb_GenerateHBPolys(), HB_MAGIC, hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, hb_StripingDist(), and hb_width.

Referenced by hb_Add().

◆ hb_Cleanup()

void Landscape::hb_Cleanup ( void  )
protected

◆ hb_ClearPolygon()

void Landscape::hb_ClearPolygon ( int  a_poly_num)
protected

Definition at line 413 of file hedgebanks.cpp.

414 {
415  // 'Paint' every pixel which belongs to the current polygon with the
416  // value HB_MAGIC_COLOR.
417  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++ ) {
418  for ( int l_x=hb_min_x; l_x<=hb_max_x; l_x++ ) {
419  int l_coord = l_y*hb_width + l_x;
420  if ( hb_map[ l_coord ] == a_poly_num ) {
421  hb_map[ l_coord ] = HB_MAGIC_COLOR;
422  }
423  }
424  }
425 }

References HB_MAGIC_COLOR, hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, and hb_width.

Referenced by hb_Add().

◆ hb_DownPolyNumbers()

void Landscape::hb_DownPolyNumbers ( void  )
protected

Definition at line 715 of file hedgebanks.cpp.

716 {
717  for ( int i=0; i<hb_size; i++ ) {
718  if ( hb_map[ i ] >= HB_MAGIC ) {
719  hb_map[ i ] -= HB_MAGIC;
720  }
721  }
722 }

References HB_MAGIC, hb_map, and hb_size.

Referenced by hb_Add().

◆ hb_FindBoundingBox()

bool Landscape::hb_FindBoundingBox ( int  a_poly_num)
protected

Definition at line 243 of file hedgebanks.cpp.

244 {
245  hb_min_x = hb_width + 1;
246  hb_max_x = -1;
247 
248  hb_min_y = hb_height + 1;
249  hb_max_y = -1;
250 
251  bool l_found = false;
252 
253  // Search for every pixel which belongs to the current polygon, and
254  // min and max values for x and y. Values are inclusive.
255  for ( int l_y=0; l_y<hb_height; l_y++ ) {
256  for ( int l_x=0; l_x<hb_width; l_x++ ) {
257  if ( hb_map[ l_y*hb_width + l_x ] == a_poly_num ) {
258  l_found = true;
259  if ( l_x < hb_min_x)
260  hb_min_x = l_x;
261  else if ( l_x > hb_max_x)
262  hb_max_x = l_x;
263  if ( l_y < hb_min_y)
264  hb_min_y = l_y;
265  else if ( l_y > hb_max_y)
266  hb_max_y = l_y;
267  }
268  }
269  }
270 
271  return l_found;
272 }

References hb_height, hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, and hb_width.

Referenced by hb_Add().

◆ hb_FindHedges()

void Landscape::hb_FindHedges ( void  )
protected

Definition at line 276 of file hedgebanks.cpp.

277 {
278  for ( unsigned int i=0; i<m_elems.size(); i++ ) {
279  if ( tole_Hedges == m_elems[i]->GetElementType() ) {
280  hb_hedges.resize( hb_hedges.size() + 1 );
281  hb_hedges[ hb_hedges.size() - 1 ] =
282  m_elems[i]->GetPoly();
283  }
284  }
285 }

References hb_hedges, m_elems, and tole_Hedges.

Referenced by hb_Add().

◆ hb_GenerateHBPolys()

void Landscape::hb_GenerateHBPolys ( void  )
protected

Definition at line 180 of file hedgebanks.cpp.

181 {
182  hb_new_hbs.resize( l_map_art_hb_nums.value() );
183 
184  for ( int i =0; i<l_map_art_hb_nums.value(); i++ ) {
186  hb_new_hbs[ i ]->SetArea( 0.0 );
187  hb_new_hbs[ i ]->SetSubType( i );
188  m_elems.resize( m_elems.size() + 1 );
189  m_elems[ m_elems.size() - 1 ] = hb_new_hbs[ i ];
191  (int) m_elems.size() - 1;
192  hb_new_hbs[ i ]->SetPoly( hb_first_free_poly_num++ );
193  }
194 }

References hb_first_free_poly_num, hb_new_hbs, l_map_art_hb_nums, m_elems, m_polymapping, NewElement(), tole_HedgeBank, and CfgInt::value().

Referenced by hb_AddNewHedgebanks().

◆ hb_HasNeighbourColor()

bool Landscape::hb_HasNeighbourColor ( int  a_x,
int  a_y,
int  a_neighbour_color 
)
inlineprotected

Definition at line 452 of file hedgebanks.cpp.

454 {
455  bool l_neighbour_has_color = false;
456  bool loop=false;
457 
458  do {
459  a_x -= 1;
460  a_y -= 1;
461  if ( a_x >= 0 && a_y >= 0 &&
462  hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
463  l_neighbour_has_color = true;
464  break;
465  }
466 
467  a_x++;
468  if ( hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
469  l_neighbour_has_color = true;
470  break;
471  }
472 
473  a_x++;
474  if ( a_x < hb_width &&
475  hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
476  l_neighbour_has_color = true;
477  break;
478  }
479 
480  a_x -= 2;
481  a_y += 1;
482  if ( a_x >= 0 &&
483  hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
484  l_neighbour_has_color = true;
485  break;
486  }
487 
488  a_x += 2;
489  if ( a_x < hb_width &&
490  hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
491  l_neighbour_has_color = true;
492  break;
493  }
494 
495  a_x -= 2;
496  a_y += 1;
497 
498  if ( a_y >= hb_height )
499  break;
500 
501  if ( a_x >= 0 &&
502  hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
503  l_neighbour_has_color = true;
504  break;
505  }
506 
507  a_x++;
508  if ( hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
509  l_neighbour_has_color = true;
510  break;
511  }
512 
513  a_x++;
514  if ( a_x < hb_width &&
515  hb_map[ a_x + a_y*hb_width ] == a_neighbour_color ) {
516  l_neighbour_has_color = true;
517  break;
518  }
519  } while ( loop ); // was while (false) CJT 16-05-06
520 
521  return l_neighbour_has_color;
522 }

References hb_height, hb_map, and hb_width.

Referenced by hb_PaintWhoHasNeighbourColor().

◆ hb_HasOtherNeighbour()

bool Landscape::hb_HasOtherNeighbour ( int  a_x,
int  a_y 
)
inlineprotected

Definition at line 339 of file hedgebanks.cpp.

340 {
341  bool l_has_neighbour = false;
342  bool loop=false;
343 
344  // Who said C++ needs the goto statement? ;-)
345  do {
346  a_x -= 1;
347  a_y -= 1;
348 
349  if ( hb_MapBorder( a_x, a_y ) ||
350  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
351  l_has_neighbour = true;
352  break;
353  }
354 
355  a_x++;
356  if ( hb_MapBorder( a_x, a_y ) ||
357  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
358  l_has_neighbour = true;
359  break;
360  }
361 
362  a_x++;
363  if ( hb_MapBorder( a_x, a_y ) ||
364  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
365  l_has_neighbour = true;
366  break;
367  }
368 
369  a_x -= 2;
370  a_y += 1;
371  if ( hb_MapBorder( a_x, a_y ) ||
372  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
373  l_has_neighbour = true;
374  break;
375  }
376 
377  a_x += 2;
378  if ( hb_MapBorder( a_x, a_y ) ||
379  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
380  l_has_neighbour = true;
381  break;
382  }
383 
384  a_x -= 2;
385  a_y += 1;
386 
387  if ( hb_MapBorder( a_x, a_y ) ||
388  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
389  l_has_neighbour = true;
390  break;
391  }
392 
393  a_x++;
394  if ( hb_MapBorder( a_x, a_y ) ||
395  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
396  l_has_neighbour = true;
397  break;
398  }
399 
400  a_x++;
401  if ( hb_MapBorder( a_x, a_y ) ||
402  hb_map[ a_x + a_y*hb_width ] >= HB_MAGIC ) {
403  l_has_neighbour = true;
404  break;
405  }
406  } while ( loop ); // was while (false) CJT 16-05-06
407 
408  return l_has_neighbour;
409 }

References HB_MAGIC, hb_map, hb_MapBorder(), and hb_width.

Referenced by hb_PaintBorder().

◆ hb_MapBorder()

bool Landscape::hb_MapBorder ( int  a_x,
int  a_y 
)
inlineprotected

Definition at line 325 of file hedgebanks.cpp.

326 {
327  if ( a_x < 0 ||
328  a_y < 0 ||
329  a_x >= hb_width ||
330  a_y >= hb_height ) {
331  return true;
332  }
333 
334  return false;
335 }

References hb_height, and hb_width.

Referenced by hb_HasOtherNeighbour().

◆ hb_MarkTheBresenhamWay()

void Landscape::hb_MarkTheBresenhamWay ( void  )
protected

Definition at line 629 of file hedgebanks.cpp.

630 {
631  double l_hb = l_map_art_hb_width.value()*10000.0;
632  double l_up = 10000.0 - l_hb;
633  bool l_is_hb = true;
634  double l_length = (double)(random( (int)l_hb )) * 0.0001 *
636  double l_hb_remain = 0.0;
637  double l_up_remain = 0.0;
638 
639  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++) {
640  // Note: The missing update of l_x below is intentional.
641  for ( int l_x=hb_min_x; l_x<=hb_max_x; ) {
642  int l_coord = l_y*hb_width + l_x;
643  if ( hb_map[ l_coord ] < HB_MAGIC ) {
644  // 'Painting' with a negative value turns a pixel into
645  // hedgebank 'core', ie. hedge!
646 
647  // Paint segment length with appropriate type.
648  if ( l_length >= 1.0 ) {
649  if ( l_is_hb ) {
650  hb_map[ l_coord ] = 0;
651  } else {
652  hb_map[ l_coord ] = -1;
653  }
654  l_length -= 1.0;
655  l_x++;
656  } else {
657  // Change state.
658  if ( l_is_hb ) {
659  l_is_hb = false;
660  l_hb_remain = l_length;
661  l_length = (double)(random( (int)l_up )) * 0.0001 *
662  l_map_art_hb_seg_len.value() + l_up_remain;
663  } else {
664  l_is_hb = true;
665  l_up_remain = l_length;
666  l_length = (double)(random( (int)l_hb )) * 0.0001 *
667  l_map_art_hb_seg_len.value() + l_hb_remain;
668  }
669  }
670  } else {
671  // Pixel not part of the hedge, just update the coordinate.
672  l_x++;
673  }
674  }
675  }
676 }

References HB_MAGIC, hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, hb_width, l_map_art_hb_seg_len, l_map_art_hb_width, and CfgFloat::value().

Referenced by hb_Add().

◆ hb_MarkTopFromLocalMax()

void Landscape::hb_MarkTopFromLocalMax ( int  a_color)
protected

Definition at line 679 of file hedgebanks.cpp.

680 {
681  // Sweep through the map. If we find a pixel, which has a value
682  // equal to a_color and *not* a negative neighbour, then mark it as
683  // negative with an absolute value equal to the number of steps from
684  // here and out to the center/perimeter polygons border, calculated
685  // as the given percentage.
686 
687  // If one or more negative numbers are found among the neighbours,
688  // some that were not marked during this round, then assign a
689  // negative value equal to the minimum found plus one.
690 
691  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++ ) {
692  for ( int l_x=hb_min_x; l_x<=hb_max_x; l_x++ ) {
693  int l_coord = l_y*hb_width + l_x;
694  int l_max;
695  if ( hb_map[ l_coord ] == a_color ) {
696  l_max = hb_MaxUnpaintedNegNeighbour( l_x, l_y );
697  if ( l_max < 0 ) {
698  if ( ++l_max < 0 ) {
699  hb_map[ l_coord ] = l_max;
700  } else {
701  // l_max was precisely -1
702  hb_map[ l_coord ] = -1;
703  }
704  } else {
705  // We are a local maxima.
706  hb_map[ l_coord ] = -a_color;
707  }
708  hb_map[ l_coord ] ^= HB_MAGIC_PAINTER_BIT;
709  }
710  }
711  }
712 }

References HB_MAGIC_PAINTER_BIT, hb_map, hb_max_x, hb_max_y, hb_MaxUnpaintedNegNeighbour(), hb_min_x, hb_min_y, and hb_width.

Referenced by hb_Add().

◆ hb_MaxUnpaintedNegNeighbour()

int Landscape::hb_MaxUnpaintedNegNeighbour ( int  a_x,
int  a_y 
)
inlineprotected

Definition at line 548 of file hedgebanks.cpp.

550 {
551  int l_max_neg = 0;
552  int l_val;
553  bool loop=false; // This is just to avoid the warning about constant expression if we use: do {...} while (false)
554 
555  do {
556  a_x -= 1;
557  a_y -= 1;
558  if ( a_x >= 0 && a_y >= 0 ) {
559  l_val = hb_map[ a_x + a_y*hb_width ];
560  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
561  l_max_neg = l_val;
562  }
563  }
564 
565  a_x++;
566  l_val = hb_map[ a_x + a_y*hb_width ];
567  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
568  l_max_neg = l_val;
569  }
570 
571  a_x++;
572  if ( a_x < hb_width ) {
573  l_val = hb_map[ a_x + a_y*hb_width ];
574  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
575  l_max_neg = l_val;
576  }
577  }
578 
579  a_x -= 2;
580  a_y += 1;
581  if ( a_x >= 0 ) {
582  l_val = hb_map[ a_x + a_y*hb_width ];
583  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
584  l_max_neg = l_val;
585  }
586  }
587 
588  a_x += 2;
589  if ( a_x < hb_width ) {
590  l_val = hb_map[ a_x + a_y*hb_width ];
591  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
592  l_max_neg = l_val;
593  }
594  }
595 
596  a_x -= 2;
597  a_y += 1;
598 
599  if ( a_y >= hb_height )
600  break;
601 
602  if ( a_x >= 0 ) {
603  l_val = hb_map[ a_x + a_y*hb_width ];
604  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
605  l_max_neg = l_val;
606  }
607  }
608 
609  a_x++;
610  l_val = hb_map[ a_x + a_y*hb_width ];
611  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
612  l_max_neg = l_val;
613  }
614 
615  a_x++;
616  if ( a_x < hb_width ) {
617  l_val = hb_map[ a_x + a_y*hb_width ];
618  if ( l_val < l_max_neg && (l_val & HB_MAGIC_PAINTER_BIT)) {
619  l_max_neg = l_val;
620  }
621  }
622  } while ( loop );
623 
624  return l_max_neg;
625 }

References hb_height, HB_MAGIC_PAINTER_BIT, hb_map, and hb_width.

Referenced by hb_MarkTopFromLocalMax().

◆ hb_PaintBorder()

void Landscape::hb_PaintBorder ( int  a_color)
protected

Definition at line 429 of file hedgebanks.cpp.

430 {
431  hb_border_pixels = 0;
432  hb_core_pixels = 0;
433  // Paint every pixel which belongs to the current polygon, and which
434  // does have a neighbour *not* equal to HB_MAGIC_COLOR (our marker value).
435  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++ ) {
436  for ( int l_x=hb_min_x; l_x<=hb_max_x; l_x++ ) {
437  int l_coord = l_y*hb_width + l_x;
438  if ( hb_map[ l_coord ] == HB_MAGIC_COLOR ) {
439  if ( hb_HasOtherNeighbour( l_x, l_y )) {
440  hb_map[ l_coord ] = a_color;
442  } else {
443  hb_core_pixels++;
444  }
445  }
446  }
447  }
448 }

References hb_border_pixels, hb_core_pixels, hb_HasOtherNeighbour(), HB_MAGIC_COLOR, hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, and hb_width.

Referenced by hb_Add().

◆ hb_PaintWhoHasNeighbourColor()

bool Landscape::hb_PaintWhoHasNeighbourColor ( int  a_neighbour_color,
int  a_new_color 
)
protected

Definition at line 526 of file hedgebanks.cpp.

528 {
529  // Paint every pixel which belongs to the current polygon, and which
530  // has a neighbour with a color equal to a_neighbour_color.
531 
532  bool l_at_least_one = false;
533  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++ ) {
534  for ( int l_x=hb_min_x; l_x<=hb_max_x; l_x++ ) {
535  if ( hb_map[l_y*hb_width + l_x] == HB_MAGIC_COLOR &&
536  hb_HasNeighbourColor( l_x, l_y, a_neighbour_color )) {
537  hb_map[l_y*hb_width + l_x] = a_new_color;
538  l_at_least_one = true;
539  }
540  }
541  }
542 
543  return l_at_least_one;
544 }

References hb_HasNeighbourColor(), HB_MAGIC_COLOR, hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, and hb_width.

Referenced by hb_Add().

◆ hb_ResetColorBits()

void Landscape::hb_ResetColorBits ( void  )
protected

Definition at line 298 of file hedgebanks.cpp.

299 {
300  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++ ) {
301  for ( int l_x=hb_min_x; l_x<=hb_max_x; l_x++ ) {
302  int l_coord = l_y*hb_width + l_x;
303  if ( hb_map[l_coord] < 0 )
304  hb_map[l_coord] |= HB_MAGIC_PAINTER_BIT;
305  }
306  }
307 }

References HB_MAGIC_PAINTER_BIT, hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, and hb_width.

Referenced by hb_Add().

◆ hb_RestoreHedgeCore()

void Landscape::hb_RestoreHedgeCore ( int  a_orig_poly_number)
protected

Definition at line 311 of file hedgebanks.cpp.

312 {
313  for ( int l_y=hb_min_y; l_y<=hb_max_y; l_y++ ) {
314  for ( int l_x=hb_min_x; l_x<=hb_max_x; l_x++ ) {
315  int l_coord = l_y*hb_width + l_x;
316  if ( hb_map[l_coord] < 0 ) {
317  hb_map[l_coord] = a_orig_poly_number;
318  }
319  }
320  }
321 }

References hb_map, hb_max_x, hb_max_y, hb_min_x, hb_min_y, and hb_width.

Referenced by hb_Add().

◆ hb_StripingDist()

int Landscape::hb_StripingDist ( void  )
protected

Definition at line 225 of file hedgebanks.cpp.

226 {
227  // Striping distribution function for the new hedgebanks.
228  static LE* l_curr_ele = NULL;
229 
230  if ( !l_curr_ele ) {
231  l_curr_ele = hb_new_hbs[ random( l_map_art_hb_nums.value()) ];
232  return l_curr_ele->GetPoly();
233  }
234 
235  if ( random(100) < l_map_art_hb_tran_prob.value() )
236  l_curr_ele = hb_new_hbs[ random( l_map_art_hb_nums.value()) ];
237 
238  return l_curr_ele->GetPoly();
239 }

References LE::GetPoly(), hb_new_hbs, l_map_art_hb_nums, l_map_art_hb_tran_prob, and CfgInt::value().

Referenced by hb_AddNewHedgebanks().

◆ hb_UpPolyNumbers()

void Landscape::hb_UpPolyNumbers ( void  )
protected

Definition at line 289 of file hedgebanks.cpp.

290 {
291  for ( int i=0; i<hb_size; i++ ) {
292  hb_map[ i ] += HB_MAGIC;
293  }
294 }

References HB_MAGIC, hb_map, and hb_size.

Referenced by hb_Add().

◆ HowManyPonds()

int Landscape::HowManyPonds ( )
inline

Returns the number of ponds in the landscape.

Definition at line 336 of file landscape.h.

336 { return int(m_PondIndexList.size()); }

References m_PondIndexList.

◆ IncOsmiaNest()

void Landscape::IncOsmiaNest ( int  a_x,
int  a_y 
)
inline

Reopen the osmia nest here

Definition at line 866 of file landscape.h.

866  {
867  m_elems[m_land->Get(a_x, a_y)]->IncOsmiaNesting();
868  }

References RasterMap::Get(), m_elems, and m_land.

◆ IncTreatCounter()

void Landscape::IncTreatCounter ( int  a_treat)

Definition at line 3575 of file Landscape.cpp.

3575  {
3576  if (a_treat < 0 || a_treat >= last_treatment) {
3577  char errornum[20];
3578  sprintf(errornum, "%d", a_treat);
3579  g_msg->Warn(WARN_BUG, "Landscape::IncTreatCounter(): Index"" out of range!", errornum);
3580  exit(1);
3581  }
3582  m_treatment_counts[a_treat] ++;
3583 }

References g_msg, last_treatment, MapErrorMsg::Warn(), and WARN_BUG.

Referenced by LE::SetLastTreatment().

◆ InitOsmiaBeeNesting()

void Landscape::InitOsmiaBeeNesting ( )

Read in the Osmia nest density files and allocate to each LE object.

Reads in an input file Ela and provides a max nest number to each instance of LE* in the m_elems vector

Definition at line 4697 of file Landscape.cpp.

4698 {
4700  array<int, tole_Foobar> tole_ref;
4701  array<double, tole_Foobar> maxOsmiaNests;
4702  array<double, tole_Foobar> minOsmiaNests;
4703  fstream ifile(cfg_OsmiaNestByLE_Datafile.value(), ios::in);
4704  if (!ifile.is_open()) {
4705  g_msg->Warn("Cannot open file: ", cfg_OsmiaNestByLE_Datafile.value());
4706  exit(1);
4707  }
4708  // Read the file tole type by tole type - here we can't rely on the order but need the tole number
4709  int length;
4710  ifile >> length;
4711  if (length != tole_Foobar) {
4712  g_msg->Warn("Inconsistent file length with tole_Foobar: ", int(tole_Foobar));
4713  exit(1);
4714  }
4715  // read the file
4716  for (int i = 0; i < length; i++)
4717  {
4718  ifile >> tole_ref[i] >> minOsmiaNests[i] >> maxOsmiaNests[i];
4719  }
4720  ifile.close();
4721  for (unsigned int e = 0; e < m_elems.size(); e++) {
4722  int eletype = m_elems[e]->GetALMaSSEleType();
4723  // first find the eletype
4724  int found = -1;
4725  for (int j = 0; j < length; j++)
4726  {
4727  if (tole_ref[j] == eletype) {
4728  found = j;
4729  break;
4730  }
4731  }
4732  if (found == -1) {
4733  g_msg->Warn("Inconsistent file data, missing tole type ref: ", eletype);
4734  exit(1);
4735  }
4736  // We have the ref type, so now calculate the number of nests and set it
4737  m_elems[e]->SetMaxOsmiaNests(minOsmiaNests[found] + double(g_rand_uni() * (maxOsmiaNests[found] - minOsmiaNests[found])));
4738  }
4739 }

References cfg_OsmiaNestByLE_Datafile, g_msg, g_rand_uni(), tole_Foobar, CfgStr::value(), and MapErrorMsg::Warn().

◆ IsFieldType()

bool Landscape::IsFieldType ( TTypesOfLandscapeElement  a_tole)
inline

Definition at line 727 of file landscape.h.

727  {
728  if ((a_tole == tole_Field)
729  || (a_tole == tole_Orchard)
730  || (a_tole == tole_PermanentSetaside)
731  || (a_tole == tole_PermPasture)
732  || (a_tole == tole_PermPastureLowYield)
733  || (a_tole == tole_PermPastureTussocky)
734  || (a_tole == tole_PermPastureTussockyWet)
735  || (a_tole == tole_Vildtager)
736  || (a_tole == tole_YoungForest)
737  || (a_tole == tole_WoodyEnergyCrop)
738  ) return true;
739  return false;
740  }

References tole_Field, tole_Orchard, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PermPastureTussockyWet, tole_Vildtager, tole_WoodyEnergyCrop, and tole_YoungForest.

◆ LineHighTest()

int Landscape::LineHighTest ( int  a_cx,
int  a_cy,
double  a_offsetx,
double  a_offsety 
)
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.

Returns
d1 is the distance from cx,cy to the obstruction. Runs out a line along a vector set by offsetx & offsety, from cx & cy until it meets too many high elements.

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

Definition at line 461 of file Landscape.cpp.

462 {
467  int d1=-1;
468  int counter = 1;
469  bool found = false;
470  while (!found)
471  {
473  int x = (int) (a_cx + a_offsetx * counter);
474  int y = (int) (a_cy + a_offsety * counter);
475  if (x<1 || x >= (m_width-2) || y<1 || y >= (m_height-2)) return counter;
478  if ((tole == tole_LargeRoad) || (tole == tole_SmallRoad) || (tole == tole_HedgeBank)) return counter;
479  if (SupplyLEHigh(x,y))
480  {
481  x = (int) (a_cx + a_offsetx * (counter+1));
482  y = (int) (a_cy + a_offsety * (counter+1));
483  if (SupplyLEHigh(x,y)) found = true;
484  d1=counter;
485  }
486  counter++;
487  }
488  return d1;
489 }

References tole_HedgeBank, tole_LargeRoad, and tole_SmallRoad.

◆ MagicMapP2PolyRef()

int Landscape::MagicMapP2PolyRef ( int  a_magic)
inline

Definition at line 1516 of file landscape.h.

1517 {
1518  return m_elems[ a_magic ]->GetPoly();
1519 }

References m_elems.

◆ NewElement()

LE * Landscape::NewElement ( TTypesOfLandscapeElement  a_type)
protected

Definition at line 3688 of file Landscape.cpp.

3688  {
3689  LE * elem;
3690  static char error_num[20];
3691 
3692  switch (a_type) {
3693  case tole_Hedges:
3694  elem = new Hedges;
3695  break;
3696  case tole_HedgeBank:
3697  elem = new HedgeBank;
3698  break;
3699  case tole_BeetleBank:
3700  elem = new BeetleBank;
3701  break;
3702  case tole_RoadsideVerge:
3703  elem = new RoadsideVerge;
3704  break;
3705  case tole_Railway:
3706  elem = new Railway;
3707  break;
3708  case tole_FieldBoundary:
3709  elem = new FieldBoundary;
3710  break;
3711  case tole_Marsh:
3712  elem = new Marsh;
3713  break;
3714  case tole_Orchard:
3715  elem = new Orchard;
3716  break;
3717  case tole_OrchardBand:
3718  elem = new OrchardBand;
3719  break;
3720  case tole_MownGrass:
3721  elem = new MownGrass;
3722  break;
3723  case tole_Heath:
3724  elem = new Heath;
3725  break;
3726  case tole_Scrub:
3727  elem = new Scrub;
3728  break;
3729  case tole_Field:
3730  elem = new Field;
3731  break;
3733  elem = new PermanentSetaside;
3734  break;
3735  case tole_PermPasture:
3736  elem = new PermPasture;
3737  break;
3739  elem = new PermPastureLowYield;
3740  break;
3742  elem = new PermPastureTussocky;
3743  break;
3744  case tole_NaturalGrassDry:
3745  elem = new NaturalGrassDry;
3746  break;
3747  case tole_UnknownGrass:
3748  elem = new NaturalGrassDry;
3749  break;
3750  case tole_RiversidePlants:
3751  elem = new RiversidePlants;
3752  break;
3753  case tole_PitDisused:
3754  elem = new PitDisused;
3755  break;
3756  case tole_RiversideTrees:
3757  elem = new RiversideTrees;
3758  break;
3759  case tole_DeciduousForest:
3760  elem = new DeciduousForest;
3761  break;
3762  case tole_MixedForest:
3763  elem = new MixedForest;
3764  break;
3765  case tole_YoungForest:
3766  elem = new YoungForest;
3767  break;
3768  case tole_ConiferousForest:
3769  elem = new ConiferousForest;
3770  break;
3771  case tole_StoneWall:
3772  elem = new StoneWall;
3773  break;
3774  case tole_Fence:
3775  elem = new Fence;
3776  break;
3777  case tole_Garden:
3778  elem = new Garden;
3779  break;
3780  case tole_Track:
3781  elem = new Track;
3782  break;
3783  case tole_SmallRoad:
3784  elem = new SmallRoad;
3785  break;
3786  case tole_LargeRoad:
3787  elem = new LargeRoad;
3788  break;
3789  case tole_Building:
3790  elem = new Building;
3791  break;
3792  case tole_ActivePit:
3793  elem = new ActivePit;
3794  break;
3795  case tole_Freshwater:
3796  elem = new Freshwater;
3797  break;
3798  case tole_Pond:
3799  elem = new Pond;
3800  break;
3801  case tole_River:
3802  elem = new River;
3803  break;
3804  case tole_Saltwater:
3805  elem = new Saltwater;
3806  break;
3807  case tole_Coast:
3808  elem = new Coast;
3809  break;
3810  case tole_BareRock:
3811  elem = new BareRock;
3812  break;
3813  case tole_AmenityGrass:
3814  elem = new AmenityGrass;
3815  break;
3816  case tole_Parkland:
3817  elem = new Parkland;
3818  break;
3819  case tole_UrbanNoVeg:
3820  elem = new UrbanNoVeg;
3821  break;
3822  case tole_UrbanPark:
3823  elem = new UrbanPark;
3824  break;
3826  elem = new BuiltUpWithParkland;
3827  break;
3828  case tole_SandDune:
3829  elem = new SandDune;
3830  break;
3831  case tole_Copse:
3832  elem = new Copse;
3833  break;
3834  case tole_RoadsideSlope:
3835  elem = new RoadsideSlope;
3836  break;
3837  case tole_MetalledPath:
3838  elem = new MetalledPath;
3839  break;
3840  case tole_Carpark:
3841  elem = new Carpark;
3842  break;
3843  case tole_Churchyard:
3844  elem = new Churchyard;
3845  break;
3846  case tole_NaturalGrassWet:
3847  elem = new NaturalGrassWet;
3848  break;
3849  case tole_Saltmarsh:
3850  elem = new Saltmarsh;
3851  break;
3852  case tole_Stream:
3853  elem = new Stream;
3854  break;
3855  case tole_HeritageSite:
3856  elem = new HeritageSite;
3857  break;
3859  elem = new UnsprayedFieldMargin;
3860  break;
3861  case tole_Wasteland:
3862  elem = new Wasteland;
3863  break;
3864  case tole_IndividualTree:
3865  elem = new IndividualTree;
3866  break;
3867  case tole_PlantNursery:
3868  elem = new PlantNursery;
3869  break;
3870  case tole_Vildtager:
3871  elem = new Vildtager;
3872  break;
3873  case tole_WindTurbine:
3874  elem = new WindTurbine;
3875  break;
3876  case tole_WoodyEnergyCrop:
3877  elem = new WoodyEnergyCrop;
3878  break;
3879  case tole_WoodlandMargin:
3880  elem = new WoodlandMargin;
3881  break;
3882  case tole_Pylon:
3883  elem = new Pylon;
3884  break;
3885  case tole_FishFarm:
3886  elem = new FishFarm;
3887  break;
3888  case tole_Missing:
3889  elem = new LE; // These should never be actually used.
3890  break;
3891  case tole_Chameleon:
3892  elem = new ChameleonLE;
3893  break;
3894  case tole_DrainageDitch:
3895  elem = new DrainageDitch;
3896  break;
3897  case tole_UrbanVeg:
3898  elem = new UrbanVeg;
3899  break;
3900  case tole_WaterBufferZone:
3901  elem = new WaterBufferZone;
3902  break;
3903  case tole_Canal:
3904  elem = new Canal;
3905  break;
3906  default:
3907  sprintf(error_num, "%d", a_type);
3908  g_msg->Warn(WARN_FILE, "Landscape::NewElement(): Unknown landscape element requested:", error_num);
3909  exit(1);
3910  } //switch
3911 
3912  elem->SetALMaSSEleType(g_letype->BackTranslateEleTypes(a_type));
3913  elem->SetElementType(a_type);
3915  return elem;
3916 }

References LE_TypeClass::BackTranslateEleTypes(), g_letype, g_msg, LE::SetPollenNectarData(), tole_ActivePit, tole_AmenityGrass, tole_BareRock, tole_BeetleBank, tole_Building, tole_BuiltUpWithParkland, tole_Canal, tole_Carpark, tole_Chameleon, tole_Churchyard, tole_Coast, tole_ConiferousForest, tole_Copse, tole_DeciduousForest, tole_DrainageDitch, tole_Fence, tole_Field, tole_FieldBoundary, tole_FishFarm, tole_Freshwater, tole_Garden, tole_Heath, tole_HedgeBank, tole_Hedges, tole_HeritageSite, tole_IndividualTree, tole_LargeRoad, tole_Marsh, tole_MetalledPath, tole_Missing, tole_MixedForest, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_OrchardBand, tole_Parkland, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PitDisused, tole_PlantNursery, tole_Pond, tole_Pylon, tole_Railway, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideSlope, tole_RoadsideVerge, tole_Saltmarsh, tole_Saltwater, tole_SandDune, tole_Scrub, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UnknownGrass, tole_UnsprayedFieldMargin, tole_UrbanNoVeg, tole_UrbanPark, tole_UrbanVeg, tole_Vildtager, tole_Wasteland, tole_WaterBufferZone, tole_WindTurbine, tole_WoodlandMargin, tole_WoodyEnergyCrop, tole_YoungForest, MapErrorMsg::Warn(), and WARN_FILE.

Referenced by hb_GenerateHBPolys().

◆ PolysDump()

void Landscape::PolysDump ( const char *  a_filename)
protected

Definition at line 1803 of file Landscape.cpp.

1804 {
1805  ofstream outf(a_filename, ios::out);
1806  int l_num_polys = 0;
1807 
1808  if (!outf.is_open()) {
1809  g_msg->Warn(WARN_FILE, "Landscape::PolysDump(): Unable to open file", a_filename);
1810  exit(1);
1811  }
1812 
1813  // Count up number if active polygons in our list.
1814  unsigned sz = (unsigned)m_elems.size();
1815  for (unsigned int i = 0; i < sz; i++) {
1816  if (m_elems[i]->GetMapValid())
1817  l_num_polys++;
1818  }
1819 
1820  outf << l_num_polys << endl;
1821  outf << "PolyType" << '\t' << "PolyRefNum" << '\t' << "Area" << '\t' << "FarmRef" << '\t' << "UnSprayedMarginRef" << '\t' << "SoilType" << '\t' << "Openness" << '\t' << "CentroidX" << '\t' << "CentroidY" << endl;
1822 
1823  /*
1824  if ( l_map_renumberpolys.value() )
1825  {
1826  RenumberPolys( true );
1827  }
1828  */
1829  // Now we can output the file
1830  for (unsigned int i = 0; i < m_elems.size(); i++)
1831  {
1832  if (m_elems[i]->GetMapValid())
1833  {
1834  outf << m_elems[i]->GetALMaSSEleType() << '\t' << m_elems[i]->GetPoly() << '\t' << m_elems[i]->GetArea() << '\t' <<
1835  m_elems[i]->GetOwnerFile() << '\t' << m_elems[i]->GetUnsprayedMarginPolyRef() << '\t' << m_elems[i]->GetSoilType() << '\t' << m_elems[i]->GetOpenness()
1836  << '\t' << m_elems[i]->GetCentroidX() << '\t' << m_elems[i]->GetCentroidY() << endl;
1837  }
1838  }
1839  outf.close();
1840 }

References g_msg, MapErrorMsg::Warn(), and WARN_FILE.

◆ PolysRemoveInvalid()

bool Landscape::PolysRemoveInvalid ( void  )
protected

PolysValidate or ChangeMapMapping must be called after this method

Definition at line 1772 of file Landscape.cpp.

1773 {
1777  bool didsomething = false;
1778  vector < LE * > l_temp;
1779  cout << "Tidying up the polygon map in PolysRemoveInvalid" << endl;
1780  unsigned int sz= (int) m_elems.size();
1781  for ( unsigned int i = 0; i < sz; i++ ) {
1782  if ( m_elems[ i ]->GetMapValid() ) {
1783  unsigned int j = (int) l_temp.size();
1784  l_temp.resize( j + 1 );
1785  l_temp[ j ] = m_elems[ i ];
1786  } else {
1787  // cout << "Deleted m_elems index:" << m_polymapping[ m_elems[ i ]->GetPoly() ] << " Polynumber :" << m_elems[ i ]->GetPoly() << BackTranslateEleTypes(m_elems[ i ]->GetElementType()) << endl;
1788  m_polymapping[ m_elems[ i ]->GetPoly() ] = -1;
1789  delete m_elems[ i ];
1790  didsomething = true;
1791  }
1792  }
1793 
1794  for ( unsigned int i = 0; i < l_temp.size(); i++ ) {
1795  m_elems[ i ] = l_temp[ i ];
1796  }
1797  m_elems.resize( l_temp.size() );
1799  return didsomething;
1800 }

References m_polymapping.

◆ PolysRenumber()

void Landscape::PolysRenumber ( void  )
protected

Definition at line 2057 of file Landscape.cpp.

2058 {
2059  cout << "In Landscape::Landscape() Polygon renumber." << endl;
2060  for (unsigned int i = 0; i < m_elems.size(); i++)
2061  {
2062  // Need to reset the poly number
2063  int index = m_elems[i]->GetMapIndex(); // This is the number currently in the map matrix
2064  m_elems[i]->SetPoly(index); // The map index and the polygon number are now one and the same
2065  m_polymapping[index] = i; // The polymapping is now linked via index to the m_elems index (i)
2066  }
2067  m_LargestPolyNumUsed = (int) m_elems.size()-1;
2068  g_msg->Warn(WARN_FILE, "Landscape::Landscape() ""Map to be dumped due to polygon renumber", "");
2069 }

References g_msg, m_polymapping, MapErrorMsg::Warn(), and WARN_FILE.

◆ PolysValidate()

void Landscape::PolysValidate ( bool  a_exit_on_invalid)
protected

Definition at line 1746 of file Landscape.cpp.

1746  {
1747  // First loop just sets the MapValid as false (and checks for a major screw-up if this elemenent does not exist even in the list
1748  for ( unsigned int i = 0; i < m_elems.size(); i++ ) {
1749  m_elems[ i ]->SetMapValid( false );
1750  if ( m_polymapping[ m_elems[ i ]->GetPoly() ] == -1 ) {
1751  char l_err[ 20 ];
1752  sprintf( l_err, "%d", m_elems[ i ]->GetPoly() );
1753  g_msg->Warn( WARN_FILE, "Landscape::PolysValidate(): Invalid polymapping ", l_err );
1754  exit( 1 );
1755  }
1756  }
1757  // Now go through the whole map and for each polygon found set MapValid as true.
1759  if ( a_exit_on_invalid ) {
1760  for ( unsigned int i = 0; i < m_elems.size(); i++ ) {
1761  if ( !m_elems[ i ]->GetMapValid() ) {
1762  char l_err[ 20 ];
1763  sprintf( l_err, "%d", m_elems[ i ]->GetPoly() );
1764  g_msg->Warn( WARN_FILE, "Landscape::PolysValidate(): Invalid polygon ", l_err );
1765  exit( 0 );
1766  }
1767  }
1768  }
1769 }

References g_msg, m_polymapping, MapErrorMsg::Warn(), and WARN_FILE.

◆ PolytypeToString()

std::string Landscape::PolytypeToString ( TTypesOfLandscapeElement  a_le_type)

Definition at line 4087 of file Landscape.cpp.

4087  {
4088  char error_num[20];
4089 
4090  switch (a_le_type) {
4091  case tole_Hedges:
4092  return " Hedge";
4093  case tole_RoadsideVerge:
4094  return " Roadside Verge";
4095  case tole_Railway:
4096  return " Railway";
4097  case tole_FieldBoundary:
4098  return " Field Boundary";
4099  case tole_Marsh:
4100  return " Marsh";
4101  case tole_Scrub:
4102  return " Scrub";
4103  case tole_Field:
4104  return " Field";
4106  return " PermPastureTussocky";
4108  return " Permanent Setaside";
4109  case tole_PermPasture:
4110  return " Permanent Pasture";
4112  return " PermPastureLowYield";
4113  case tole_NaturalGrassDry:
4114  return " Natural Grass";
4115  case tole_NaturalGrassWet:
4116  return " Natural Grass Wet";
4117  case tole_RiversidePlants:
4118  return " Riverside Plants";
4119  case tole_PitDisused:
4120  return " Pit Disused";
4121  case tole_RiversideTrees:
4122  return " Riverside Trees";
4123  case tole_DeciduousForest:
4124  return " Deciduous Forest";
4125  case tole_MixedForest:
4126  return " Mixed Forest";
4127  case tole_ConiferousForest:
4128  return " Coniferous Forest";
4129  case tole_YoungForest:
4130  return " Young Forest";
4131  case tole_StoneWall:
4132  return " Stone Wall";
4133  case tole_Garden:
4134  return " Garden";
4135  case tole_Track:
4136  return " Track";
4137  case tole_SmallRoad:
4138  return " Small Road";
4139  case tole_LargeRoad:
4140  return " Large Road";
4141  case tole_Building:
4142  return " Building";
4143  case tole_ActivePit:
4144  return " Active Pit";
4145  case tole_Pond:
4146  return " Pond";
4147  case tole_Freshwater:
4148  return " Fresh Water";
4149  case tole_River:
4150  return " River";
4151  case tole_Saltwater:
4152  return " Saltwater";
4153  case tole_Coast:
4154  return " Coast";
4155  case tole_BareRock:
4156  return " Bare Rock";
4157  case tole_HedgeBank:
4158  return " Hedgebank";
4159  case tole_Heath:
4160  return " Heath";
4161  case tole_Orchard:
4162  return " Orchard";
4163  case tole_OrchardBand:
4164  return " Orchard Band";
4165  case tole_MownGrass:
4166  return " Mown Grass";
4168  return " UnsprayedFieldMargin";
4169  case tole_AmenityGrass:
4170  return " AmenityGrass";
4171  case tole_Parkland:
4172  return " Parkland";
4173  case tole_UrbanNoVeg:
4174  return " UrbanNoVeg";
4175  case tole_UrbanVeg:
4176  return " UrbanVeg";
4177  case tole_UrbanPark:
4178  return " UrbanPark";
4180  return " BuiltUpWithParkland";
4181  case tole_SandDune:
4182  return " SandDune";
4183  case tole_Copse:
4184  return " Copse";
4185  case tole_RoadsideSlope:
4186  return " RoadsideSlope";
4187  case tole_MetalledPath:
4188  return " MetalledPath";
4189  case tole_Carpark:
4190  return " Carpark";
4191  case tole_Churchyard:
4192  return " Churchyard";
4193  case tole_Saltmarsh:
4194  return " Saltmarsh";
4195  case tole_Stream:
4196  return " Stream";
4197  case tole_HeritageSite:
4198  return " HeritageSite";
4199  case tole_BeetleBank: //141
4200  return " Beetle Bank";
4201  case tole_UnknownGrass:
4202  return " Unknown Grass";
4203  case tole_Wasteland:
4204  return " Waste/Building Land";
4205  case tole_IndividualTree:
4206  return " IndividualTree";
4207  case tole_PlantNursery:
4208  return " PlantNursery";
4209  case tole_Vildtager:
4210  return " Vildtager";
4211  case tole_WindTurbine:
4212  return " WindTurbine";
4213  case tole_WoodyEnergyCrop:
4214  return " WoodyEnergyCrop";
4215  case tole_WoodlandMargin:
4216  return " WoodlandMargin";
4217  case tole_Pylon:
4218  return " Pylon";
4219  case tole_FishFarm:
4220  return " FishFarm";
4221  case tole_Fence:
4222  return " Fence";
4223  case tole_WaterBufferZone:
4224  return " Unsprayed buffer zone around water";
4225  case tole_Foobar:
4226  default:
4227  sprintf(error_num, "%d", a_le_type);
4228  g_msg->Warn(WARN_FILE, "Landscape::PolytypeToString(): Unknown event type:", error_num);
4229  exit(1);
4230  }
4231 }

References g_msg, tole_ActivePit, tole_AmenityGrass, tole_BareRock, tole_BeetleBank, tole_Building, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_ConiferousForest, tole_Copse, tole_DeciduousForest, tole_Fence, tole_Field, tole_FieldBoundary, tole_FishFarm, tole_Foobar, tole_Freshwater, tole_Garden, tole_Heath, tole_HedgeBank, tole_Hedges, tole_HeritageSite, tole_IndividualTree, tole_LargeRoad, tole_Marsh, tole_MetalledPath, tole_MixedForest, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_OrchardBand, tole_Parkland, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PitDisused, tole_PlantNursery, tole_Pond, tole_Pylon, tole_Railway, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideSlope, tole_RoadsideVerge, tole_Saltmarsh, tole_Saltwater, tole_SandDune, tole_Scrub, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UnknownGrass, tole_UnsprayedFieldMargin, tole_UrbanNoVeg, tole_UrbanPark, tole_UrbanVeg, tole_Vildtager, tole_Wasteland, tole_WaterBufferZone, tole_WindTurbine, tole_WoodlandMargin, tole_WoodyEnergyCrop, tole_YoungForest, MapErrorMsg::Warn(), and WARN_FILE.

Referenced by hb_Add().

◆ ReadOpenness()

void Landscape::ReadOpenness ( void  )

Reads openness values from a standard input file for all polygons.

◆ ReadPolys()

void Landscape::ReadPolys ( const char *  a_polyfile)
protected

◆ ReadPolys2()

void Landscape::ReadPolys2 ( const char *  a_polyfile)
protected

reads in polygon information. Version 2 including centroid and openness information

The polygon file consists of 9 columns:

  1. Polygon Number 2. Type 3. Area as a double 4. Owner (-1 = now owner), 5- -1 or unsprayed margin polynum
    , column 6 is soil type (-1 if not used), column 7 is the polygon openness score (-1 if unset), 8 is the x-coordinate of the centroid, and 9 is the y-coordinate of the centroid. If either of these centroid coords are -1, then the centroid calculation will be forced.
    If this is to be used then cfg_map_usesoiltypes needs to be set as true (default true).

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.

Definition at line 1892 of file Landscape.cpp.

1893 {
1900  // Need to figure out if the farms are already renumbered - as the Farm manager
1901  bool farmsrenum = m_FarmManager->GetIsRenumbered();
1902 
1903  int NoPolygons;
1904  string rubbish = ""; //put here the names of the parameters;
1905  ifstream ifile(a_polyfile);
1906  if (!ifile.is_open()) {
1907  g_msg->Warn(WARN_FILE, "Landscape::ReadPolys(): Unable to open file", a_polyfile);
1908  std::exit(1);
1909  }
1910  char error_num[20];
1911  // First read the number of polygons
1912  ifile >> NoPolygons;
1913  m_elems.resize(NoPolygons);
1915  for (int i = 0; i < 9; i++){ ifile >> rubbish; }
1919  int np = NoPolygons;
1920  if (NoPolygons < 10000) np = 10000; // this is just to cope with old maps with < 10000 polygons that do not follow the rules for new maps
1921  m_polymapping.resize(np * 2);
1922 
1923  // Set all mappings to unused.
1924  for (int i = 0; i < np * 2; i++) {
1925  m_polymapping[i] = -1;
1926  }
1927 
1928  int ElemIndex = 0;
1929 
1930  for (int x = 0; x < NoPolygons; x++)
1931  {
1932  int PolyNum, Owner, PolyType, RealPolyType, URef, SoilType, openness, Centroid_x, Centroid_y;
1934  float Area;
1935  ifile >> PolyType >> PolyNum >> Area >> Owner >> URef >> SoilType >> openness >> Centroid_x >> Centroid_y;
1936  // Here we make some tests to check input validity
1937  if ((SoilType > 16) || (PolyNum<0))
1938  {
1939  std::sprintf(error_num, "%d", NoPolygons);
1940  g_msg->Warn(WARN_FILE, "Landscape::ReadPolys(): Polygon file empty before "
1941  "reading number of specified polygons (old polygon file format?):", error_num);
1942  std::exit(1);
1943  }
1944 
1945  // Owner is the farm number or -1. If farms have not been renumbered then this needs mapped to the index in the list of farms.
1946  // Because we create this sequentially in Farm.cpp we have a constant index.
1947  if ((-1 != Owner) && !farmsrenum)
1948  {
1949  // Need to replace the Owner with the new renumbered ref.
1950  Owner = m_FarmManager->GetRenumberedFarmRef(Owner);
1951  }
1952 
1953  RealPolyType = PolyType;
1955  if (PolyType == 150)
1956  {
1957  PolyType = l_map_chameleon_replace_num.value();
1958  }
1959 
1960  Type = g_letype->TranslateEleTypes(PolyType);
1961  if (Type == tole_Missing)
1962  {
1964  }
1965  if (-1 == m_polymapping[PolyNum])
1966  {
1967  // First time we have encountered this polygon number.
1968  // Borders are not mapped in this list.
1969  m_polymapping[PolyNum] = ElemIndex;
1970  LE * newland = NewElement(Type);
1971  m_elems[ElemIndex++] = newland;
1972  newland->SetPoly(PolyNum);
1973  newland->SetMapIndex(PolyNum);
1974  newland->SetArea(floor(0.5 + Area));
1975  newland->SetALMaSSEleType(RealPolyType);
1976  newland->SetSoilType(SoilType);
1977  newland->SetUnsprayedMarginPolyRef(URef);
1978  newland->SetCentroid(Centroid_x,Centroid_y);
1979  newland->SetOpenness(openness);
1980  // Just for fun, or maybe because we might need it later, remember the actual largest polynum used
1981  if (PolyNum>m_LargestPolyNumUsed) m_LargestPolyNumUsed = PolyNum;
1982  // Now set any centroid or openness recalcuation flags
1983  if ((Centroid_x < 0) || (Centroid_y < 0)) m_NeedCentroidCalculation= true;
1984  if (openness < 0) m_NeedOpennessCalculation = true;
1985  // Two types of possible errors: Landscape element that is a field,
1986  // but doesn't belong to a farm, or a farm element not of type field.
1987  // Check for both cases.
1988  if (-1 == Owner && (Type == tole_Field || Type == tole_YoungForest || Type == tole_Orchard || Type == tole_PermPastureTussocky || Type == tole_PermPasture || Type == tole_PermanentSetaside || Type == tole_PermPastureLowYield || Type == tole_WoodyEnergyCrop || Type == tole_Vildtager || Type == tole_PlantNursery)) {
1989  // No owner but field polygon.
1990  sprintf(error_num, "%d", PolyNum);
1991  g_msg->Warn(WARN_FILE, "Landscape::ReadPolys(): Farm polygon does not belong to a farm:", error_num);
1992  exit(1);
1993  }
1994  if (-1 != Owner && Type != tole_Field && Type != tole_YoungForest && Type != tole_Orchard && Type != tole_PermPastureTussocky && Type != tole_PermPasture && Type != tole_PermanentSetaside && Type != tole_PermPastureLowYield && Type != tole_WoodyEnergyCrop && Type != tole_Vildtager && Type != tole_PlantNursery) {
1995  // An owner but not field elements.
1996  sprintf(error_num, "%d", PolyNum);
1997  g_msg->Warn(WARN_FILE, "Landscape::ReadPolys(): Farm polygon does not have element type tole_Field:", error_num);
1998  exit(1);
1999  }
2000 
2001  if (-1 != Owner)
2002  {
2003  m_FarmManager->ConnectFarm(Owner);
2004  m_FarmManager->AddField(Owner, newland, Owner);
2005  if (g_map_le_borders.value())
2006  {
2007  if (random(100) < g_map_le_border_chance.value())
2008  {
2009  // This is a farm element, so signal adding a border.
2010  newland->SetBorder((LE *)1);
2011  }
2012  }
2013  // Code to generate unsprayed margins....
2014  if (newland->GetElementType() == tole_Field)
2015  {
2017  {
2018  if (random(100) < g_map_le_unsprayedmargins_chance.value())
2019  {
2020  // This is a farm field, so signal adding a margin
2021  newland->SetUnsprayedMarginPolyRef(1);
2022  }
2023  }
2024  }
2025  // ..to here
2026  }
2027  }
2028  else {
2029  sprintf(error_num, "%d", PolyNum);
2030  g_msg->Warn(WARN_FILE, "Landscape::ReadPolys(): Duplicate polygon in file", error_num);
2031  exit(1);
2032  }
2033  }
2034  ifile.close();
2036  hb_first_free_poly_num = m_elems[NoPolygons - 1]->GetPoly() + 1;
2037 }

References g_letype, g_map_le_border_chance, g_map_le_borders, g_map_le_unsprayedmargins, g_map_le_unsprayedmargins_chance, g_msg, l_map_chameleon_replace_num, m_polymapping, LE::SetArea(), LE::SetBorder(), LE::SetMapIndex(), LE::SetOpenness(), LE::SetPoly(), LE::SetSoilType(), LE::SetUnsprayedMarginPolyRef(), tole_Field, tole_Missing, tole_Orchard, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PlantNursery, tole_Vildtager, tole_WoodyEnergyCrop, tole_YoungForest, LE_TypeClass::TranslateEleTypes(), CfgInt::value(), CfgBool::value(), MapErrorMsg::Warn(), and WARN_FILE.

◆ ReadSymbols()

bool Landscape::ReadSymbols ( const char *  a_cfgfile)
inline

Definition at line 788 of file landscape.h.

788  {
789  return g_cfg->ReadSymbols( a_cfgfile );
790  }

References g_cfg, and Configurator::ReadSymbols().

◆ RebuildPolyMapping()

void Landscape::RebuildPolyMapping ( )
inlineprotected

Definition at line 213 of file landscape.h.

214  { // Rebuild m_polymapping.
215  unsigned int sz = (int)m_elems.size();
216  for (unsigned int i = 0; i < sz; i++)
217  {
218  m_polymapping[m_elems[i]->GetMapIndex()] = i;
219  }
220  }

References m_elems, and m_polymapping.

◆ RecordGooseNumbers()

void Landscape::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()

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

Definition at line 3328 of file Landscape.cpp.

3329 {
3335  int day = SupplyDayInYear();
3336  m_elems[m_polymapping[a_polyref]]->SetGooseNos(a_number, day);
3337 }

References m_polymapping.

◆ RecordGooseNumbersTimed()

void Landscape::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()

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()

Definition at line 3341 of file Landscape.cpp.

3342 {
3347  int day = SupplyDayInYear();
3348  m_elems[m_polymapping[a_polyref]]->SetGooseNosTimed(a_number, day);
3349 }

References m_polymapping.

◆ RecordGooseRoostDist()

void Landscape::RecordGooseRoostDist ( int  a_polyref,
int  a_dist,
GooseSpecies  a_goose 
)

Records the distance to the closest roost of goose species.

This records the distance to the closest roost for a goose species.

Definition at line 3373 of file Landscape.cpp.

3373  {
3377  m_elems[m_polymapping[a_polyref]]->SetGooseRoostDist(a_dist, a_goose);
3378  }

References m_polymapping.

◆ RecordGooseSpNumbers()

void Landscape::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()

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

Definition at line 3352 of file Landscape.cpp.

3352  {
3359  int day = SupplyDayInYear();
3360  m_elems[m_polymapping[a_polyref]]->SetGooseSpNos(a_number, day, a_goose);
3361  }

References m_polymapping.

◆ RecordGooseSpNumbersTimed()

void Landscape::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()

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()

Definition at line 3363 of file Landscape.cpp.

3363  {
3369  int day = SupplyDayInYear();
3370  m_elems[m_polymapping[a_polyref]]->SetGooseSpNosTimed(a_number, day, a_goose);
3371  }

References m_polymapping.

◆ ReleaseOsmiaNest()

void Landscape::ReleaseOsmiaNest ( int  a_x,
int  a_y 
)
inline

Reopen the osmia nest here

Definition at line 871 of file landscape.h.

871  {
872  m_elems[m_land->Get(a_x, a_y)]->ReleaseOsmiaNest();
873  }

References RasterMap::Get(), m_elems, and m_land.

◆ RemoveMissingValues()

void Landscape::RemoveMissingValues ( void  )
protected

A method for replacing missing values in the map with corrected ones - slow.

Definition at line 2090 of file Landscape.cpp.

2091 {
2092  bool found; // the flag for something left to work with
2093  int mapwidth = m_land->MapWidth();
2094  int mapheight = m_land->MapHeight();
2095  int counter = 0;
2096  do
2097  {
2098  found = false; counter++;
2099  for (int x = 1; x < mapwidth-1; x++)
2100  {
2101  for (int y = 1; y < mapheight-1; y++)
2102  {
2103  int apoly = m_land->Get(x,y);
2104  if (m_elems[m_polymapping[apoly]]->GetElementType() == tole_Missing)
2105  {
2106  m_land->MissingCellReplace(x, y, true);
2107  }
2108  }
2109  }
2110  counter++;
2111  } while (counter<50);
2112  // Now we only have the edges to deal with
2113  for (int x = 0; x < mapwidth; x++)
2114  {
2115  for (int y = 0; y < mapheight; y++)
2116  {
2117  int apoly = m_land->Get(x, y);
2118  if (m_elems[m_polymapping[apoly]]->GetElementType() == tole_Missing)
2119  {
2120  found = true;
2121  counter++;
2122  m_land->MissingCellReplaceWrap(x, y, true);
2123  }
2124  }
2125  }
2126  // Now we the ones that are not next to fields to deal with
2127 }

References m_polymapping, and tole_Missing.

◆ RemoveSmallPolygons()

int Landscape::RemoveSmallPolygons ( void  )
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:

  • Linear features: Isolated cells of these are possible, but they should not be separate polygons. These need to be joined together to form bigger, if not contiguous polygons
  • other 1m cell polygons need to be removed and replaced with the most common surrounding cell
  • Field polygons: If they are less than 1000m2 then they are assumed to be grassland

Definition at line 2184 of file Landscape.cpp.

2185 {
2199  // To be sure we first count the map squares
2200  CountMapSquares();
2201  // Then force the area to match the counted squares
2202  ForceArea();
2203  // Next find polygons that don't match other rules and are single cells - remove these
2204  int removed = 0;
2205  for (int i = 0; i < m_elems.size(); i++)
2206  {
2207  TTypesOfLandscapeElement tole = m_elems[i]->GetElementType();
2208  int area = int(m_elems[i]->GetArea());
2209  if (area == 1)
2210  {
2211  switch (tole)
2212  {
2213  case tole_FieldBoundary:
2214  case tole_HedgeBank:
2215  case tole_Hedges:
2216  case tole_IndividualTree:
2217  case tole_MetalledPath:
2218  case tole_River:
2219  case tole_RiversidePlants:
2220  case tole_RiversideTrees:
2221  case tole_RoadsideSlope:
2222  case tole_RoadsideVerge:
2223  case tole_SmallRoad:
2224  case tole_StoneWall:
2225  case tole_Fence:
2226  case tole_Stream:
2227  case tole_Track:
2229  case tole_WaterBufferZone:
2230  // These could be part of a bigger polygon, so leave them alone for now.
2231  break;
2232  default:
2233  // Get rid of this one.
2234  APoint pt = m_elems[i]->GetCentroid();
2235  // Just check that the centroid is correct
2236  int poly = m_elems[i]->GetPoly();
2237  if (poly != i)
2238  {
2239  g_msg->Warn(WARN_FILE, "Landscape::RemoveSmallPolygons: Centroid not in polygon: ", i);
2240  exit(99);
2241  }
2242  // The next line just fixes the map, and replaces the cell value
2243  if (m_land->CellReplacementNeighbour(pt.m_x, pt.m_y, poly) == 1) {
2244  // Now we need to remove the polygon. This means we must also rebuild the map later.
2245  m_elems[i]->SetMapValid(false);
2246  removed++;
2247  }
2248  }
2249  }
2250  // Field removal below 100m2
2251  else if (tole == tole_Field)
2252  {
2253  if (area < 100) {
2254  // Need to copy the useful information to new grassland element and switch that one in, removing the field.
2255  NaturalGrassDry* grass = new NaturalGrassDry;
2256  grass->DoCopy(m_elems[i]);
2257  grass->SetALMaSSEleType(g_letype->BackTranslateEleTypes(tole_NaturalGrassDry));
2258  grass->SetElementType(tole_NaturalGrassDry);
2259  grass->SetOwner(NULL,-1,-1);
2260  delete m_elems[i]; // remove the old LE
2261  m_elems[i] = dynamic_cast<LE*>(grass);
2262  }
2263  }
2264  }
2266  ChangeMapMapping();
2267  return removed;
2268 }

References LE_TypeClass::BackTranslateEleTypes(), LE::DoCopy(), g_letype, g_msg, LE::SetOwner(), tole_Fence, tole_Field, tole_FieldBoundary, tole_HedgeBank, tole_Hedges, tole_IndividualTree, tole_MetalledPath, tole_NaturalGrassDry, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideSlope, tole_RoadsideVerge, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UnsprayedFieldMargin, tole_WaterBufferZone, MapErrorMsg::Warn(), and WARN_FILE.

◆ ResetGrainAndMaize()

void Landscape::ResetGrainAndMaize ( )

Resets all grain.

To avoid grain from previous years sticking onto fields and confusing the goose foraging model, we make a hard reset of everything.

Definition at line 730 of file Landscape.cpp.

731 {
736  for (unsigned int i = 0; i < m_elems.size(); i++)
737  {
738  m_elems[i]->SetBirdSeed(0.0);
739  m_elems[i]->SetBirdMaize(0.0);
740  }
741 }

◆ RodenticidePredatorsEvaluation()

void Landscape::RodenticidePredatorsEvaluation ( RodenticidePredators_Population_Manager *  a_rppm)

Definition at line 3032 of file Landscape.cpp.

3033 {
3034  for (unsigned i=0; i<m_elems.size(); i++) {
3035  a_rppm->PreCachePoly(m_elems[i]->GetPoly());
3036  }
3037 }

◆ SetBirdMaizeForage()

void Landscape::SetBirdMaizeForage ( int  a_polyref,
double  a_fooddensity 
)
inline

Sets the maize forage resource as seen from a goose standpoint at a polygon.

Definition at line 535 of file landscape.h.

535  {
536  m_elems[ m_polymapping[ a_polyref ] ]->SetBirdMaize( a_fooddensity );
537  }

References m_elems, and m_polymapping.

◆ SetBirdSeedForage()

void Landscape::SetBirdSeedForage ( int  a_polyref,
double  a_fooddensity 
)
inline

Sets the grain forage resource as seen from a goose standpoint at a polygon.

Definition at line 528 of file landscape.h.

529  {
530  m_elems[m_polymapping[a_polyref]]->SetBirdSeed(a_fooddensity);
531  }

References m_elems, and m_polymapping.

◆ SetLESignal()

void Landscape::SetLESignal ( int  a_polyref,
LE_Signal  a_signal 
)

Definition at line 3570 of file Landscape.cpp.

3570  {
3571  m_elems[m_polymapping[a_polyref]]->SetSignal(a_signal);
3572 }

References m_polymapping.

◆ SetMaleNewtPresent()

void Landscape::SetMaleNewtPresent ( int  a_InPondIndex)
inline

Sets a male as being present in a pond.

Definition at line 349 of file landscape.h.

349 { m_elems[a_InPondIndex]->SetMaleNewtPresent(true); }

References m_elems.

◆ SetPolymapping()

void Landscape::SetPolymapping ( int  a_index,
int  a_val 
)
inline

Definition at line 182 of file landscape.h.

182 { m_polymapping[a_index] = a_val; }

References m_polymapping.

◆ SetPolyMaxMinExtents()

void Landscape::SetPolyMaxMinExtents ( void  )

Definition at line 1622 of file Landscape.cpp.

1623 {
1624  // All polygon manipulation is settled now we need to give the polygons some information about themselves
1625  // This takes a little time but save time later one
1626  cout << "Setting max min polygon extents" << endl;
1627  int mwidth = m_land->MapWidth();
1628  int mheight = m_land->MapHeight();
1629  for ( int x = 0; x < mwidth; x++ ) {
1630  for ( int y = 0; y < mheight; y++ ) {
1631  int polyindex = m_land->Get( x, y );
1632  // Mark that we have seen this polygon.
1633  unsigned int ele_ref= polyindex;
1634  if (m_elems[m_polymapping[ele_ref]]->GetMaxX() < x) m_elems[m_polymapping[ele_ref]]->SetMaxX(x);
1635  if (m_elems[m_polymapping[ele_ref]]->GetMaxY() < y) m_elems[m_polymapping[ele_ref]]->SetMaxY(y);
1636  if (m_elems[m_polymapping[ele_ref]]->GetMinX() > x) m_elems[m_polymapping[ele_ref]]->SetMinX(x);
1637  if (m_elems[m_polymapping[ele_ref]]->GetMinY() > y) m_elems[m_polymapping[ele_ref]]->SetMinY(y);
1638  m_elems[m_polymapping[ele_ref]]->SetMapValid(true);
1639  }
1640  }
1641 }

References m_polymapping.

◆ SetThePopManager()

void Landscape::SetThePopManager ( Population_Manager a_ptr)
inline

Set the pointer to the current main population manager.

Definition at line 177 of file landscape.h.

177 { m_ThePopManager = a_ptr; }

References m_ThePopManager.

◆ SimulationClosingActions()

void Landscape::SimulationClosingActions ( )

These are the things that are needed to be done after the simulation ends, but before landscape objects are deleted.

Definition at line 1455 of file Landscape.cpp.

1456 {
1461  if(cfg_OptimisingFarms.value()){
1463  }
1464 }

References cfg_OptimisingFarms, and CfgBool::value().

◆ SkylarkEvaluation()

void Landscape::SkylarkEvaluation ( SkTerritories *  a_skt)

Definition at line 3025 of file Landscape.cpp.

3025  {
3026  for (unsigned i=0; i<m_elems.size(); i++) {
3027  a_skt->PreCachePoly(m_elems[i]->GetPoly());
3028  }
3029 }

◆ StepOneValid()

bool Landscape::StepOneValid ( int  a_polyindex,
int  a_x,
int  a_y,
int  step 
)
protected

Definition at line 2429 of file Landscape.cpp.

2430 {
2431  int index;
2432  int x_add[ 8 ] = { 1*a_step, 1*a_step, 0, -1*a_step, -1*a_step, -1*a_step, 0, 1*a_step };
2433  int y_add[ 8 ] = { 0, -1*a_step, -1*a_step, -1*a_step, 0, 1*a_step, 1*a_step, 1*a_step };
2434  int width = m_land->MapWidth();
2435  int height = m_land->MapHeight();
2436  // Scan anti-clockwise from center pixel coordinate.
2437  for ( unsigned int i = 0; i < 8; i++ ) {
2438  if ( ( a_x + x_add[ i ] < width ) && ( a_x + x_add[ i ] >= 0 ) && ( a_y + y_add[ i ] < height ) && ( a_y + y_add[ i ] >= 0 ) )
2439  {
2440  index = m_land->Get( a_x + x_add[ i ], a_y + y_add[ i ] );
2441  if ( index == a_polyindex )
2442  {
2443  m_elems[a_polyindex]->SetValidXY(a_x + x_add[ i ], a_y + y_add[ i ]);
2444  return true;
2445  }
2446  }
2447  }
2448  return false;
2449 }

◆ SubtractPondLarvalFood()

bool Landscape::SubtractPondLarvalFood ( double  a_food,
int  a_polyrefindex 
)

Removes larval food from a pond and returns true if it was possible, otherwise false.

Definition at line 664 of file Landscape.cpp.

664  {
665  return dynamic_cast<Pond*>(m_elems[a_polyrefindex])->SubtractLarvalFood(a_food);
666 }

◆ SupplyBirdMaizeForage() [1/2]

double Landscape::SupplyBirdMaizeForage ( int  a_polyref)
inline

Returns the maize forage resource.

Definition at line 628 of file landscape.h.

628  {
629  return m_elems[m_polymapping[a_polyref]]->GetBirdMaize();
630  }

References m_elems, and m_polymapping.

◆ SupplyBirdMaizeForage() [2/2]

double Landscape::SupplyBirdMaizeForage ( int  a_x,
int  a_y 
)
inline

Returns the maize forage resource as seen from a goose standpoint at an x,y location.

Definition at line 640 of file landscape.h.

640  {
641  return m_elems[ m_land->Get( a_x, a_y ) ]->GetBirdMaize();
642  }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyBirdSeedForage() [1/2]

double Landscape::SupplyBirdSeedForage ( int  a_polyref)
inline

Returns the grain forage resource.

Definition at line 614 of file landscape.h.

615  {
616  return m_elems[m_polymapping[a_polyref]]->GetBirdSeed();
617  }

References m_elems, and m_polymapping.

◆ SupplyBirdSeedForage() [2/2]

double Landscape::SupplyBirdSeedForage ( int  a_x,
int  a_y 
)
inline

Returns the grain forage resource as seen from a goose standpoint at an x,y location.

Definition at line 621 of file landscape.h.

622  {
623  return m_elems[m_polymapping[m_land->Get(a_x, a_y)]]->GetBirdSeed();
624  }

References RasterMap::Get(), m_elems, m_land, and m_polymapping.

◆ SupplyCentroid()

APoint Landscape::SupplyCentroid ( int  a_polyref)

Definition at line 766 of file Landscape.cpp.

766  {
767  return m_elems[ m_polymapping[ a_polyref ] ]->GetCentroid();
768 }

References m_polymapping.

◆ SupplyCentroidIndex()

APoint Landscape::SupplyCentroidIndex ( int  a_polyrefindex)

Definition at line 771 of file Landscape.cpp.

771  {
772  return m_elems[ a_polyrefindex ]->GetCentroid();
773 }

◆ SupplyCentroidX() [1/2]

int Landscape::SupplyCentroidX ( int  a_polyref)
inline

Definition at line 470 of file landscape.h.

470  {
471  return m_elems[ m_polymapping[ a_polyref ] ]->GetCentroidX();
472  }

References m_elems, and m_polymapping.

◆ SupplyCentroidX() [2/2]

int Landscape::SupplyCentroidX ( int  a_x,
int  a_y 
)
inline

Definition at line 474 of file landscape.h.

474 { return m_elems[ m_land->Get( a_x, a_y )]->GetCentroidX(); }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyCentroidY() [1/2]

int Landscape::SupplyCentroidY ( int  a_polyref)
inline

Definition at line 473 of file landscape.h.

473 { return m_elems[m_polymapping[ a_polyref ]]->GetCentroidY(); }

References m_elems, and m_polymapping.

◆ SupplyCentroidY() [2/2]

int Landscape::SupplyCentroidY ( int  a_x,
int  a_y 
)
inline

Definition at line 475 of file landscape.h.

475 { return m_elems[ m_land->Get( a_x, a_y )]->GetCentroidY(); }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyCountryDesig()

int Landscape::SupplyCountryDesig ( int  a_x,
int  a_y 
)
inline

Definition at line 1132 of file landscape.h.

1133 {
1134  return m_elems[ m_land->Get( a_x, a_y ) ]->GetCountryDesignation();
1135 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyDayDegrees()

double Landscape::SupplyDayDegrees ( int  a_polyref)
inline

Definition at line 1326 of file landscape.h.

1327 {
1328  return m_elems[ m_polymapping[ a_polyref ]]->GetDayDegrees();
1329 }

References m_elems, and m_polymapping.

◆ SupplyDayInMonth()

int Landscape::SupplyDayInMonth ( void  )
inline

Definition at line 1606 of file landscape.h.

1607 {
1608  return g_date->GetDayInMonth();
1609 }

References g_date, and Calendar::GetDayInMonth().

◆ SupplyDayInYear()

◆ SupplyDaylength() [1/2]

int Landscape::SupplyDaylength ( long  a_date)
inline

Definition at line 1523 of file landscape.h.

1524 {
1525  return g_date->DayLength( a_date );
1526 }

References Calendar::DayLength(), and g_date.

◆ SupplyDaylength() [2/2]

int Landscape::SupplyDaylength ( void  )
inline

Definition at line 1530 of file landscape.h.

1531 {
1532  return g_date->DayLength();
1533 }

References Calendar::DayLength(), and g_date.

◆ SupplyDaylightProp()

double Landscape::SupplyDaylightProp ( )
inline

Definition at line 825 of file landscape.h.

825 { return g_date->GetDaylightProportion(); }

References g_date, and Calendar::GetDaylightProportion().

◆ SupplyDeadBiomass() [1/2]

double Landscape::SupplyDeadBiomass ( int  a_polyref)
inline

Definition at line 1029 of file landscape.h.

1030 {
1031  return m_elems[ m_polymapping[ a_polyref ]]->GetDeadBiomass();
1032 }

References m_elems, and m_polymapping.

◆ SupplyDeadBiomass() [2/2]

double Landscape::SupplyDeadBiomass ( int  a_x,
int  a_y 
)
inline

Definition at line 1034 of file landscape.h.

1035 {
1036  return m_elems[ m_land->Get( a_x, a_y ) ]->GetDeadBiomass();
1037 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyElementSubType() [1/2]

int Landscape::SupplyElementSubType ( int  a_polyref)
inline

Definition at line 1121 of file landscape.h.

1122 {
1123  return m_elems[ m_polymapping[ a_polyref ]]->GetSubType();
1124 }

References m_elems, and m_polymapping.

◆ SupplyElementSubType() [2/2]

int Landscape::SupplyElementSubType ( int  a_x,
int  a_y 
)
inline

Definition at line 1126 of file landscape.h.

1127 {
1128  return m_elems[ m_land->Get( a_x, a_y ) ]->GetSubType();
1129 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyElementType() [1/2]

TTypesOfLandscapeElement Landscape::SupplyElementType ( int  a_polyref)
inline

Definition at line 1110 of file landscape.h.

1111 {
1112  return m_elems[ m_polymapping[ a_polyref ]]->GetElementType();
1113 }

References m_elems, and m_polymapping.

Referenced by Rabbit_Population_Manager::AssessPctForage(), Pesticide::ElementIsWater(), and Rabbit_Population_Manager::WarrenLegalPos().

◆ SupplyElementType() [2/2]

TTypesOfLandscapeElement Landscape::SupplyElementType ( int  a_x,
int  a_y 
)
inline

Definition at line 1115 of file landscape.h.

1116 {
1117  return m_elems[ m_land->Get( a_x, a_y ) ]->GetElementType();
1118 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyElementTypeCC()

TTypesOfLandscapeElement Landscape::SupplyElementTypeCC ( int  a_x,
int  a_y 
)
inline

Definition at line 1139 of file landscape.h.

1140 {
1141  a_x = (a_x + m_width10) % m_width;
1142  a_y = (a_y + m_height10) % m_height;
1143  return m_elems[ m_land->Get( a_x, a_y ) ]->GetElementType();
1144 }

References RasterMap::Get(), m_elems, m_height, m_height10, m_land, m_width, and m_width10.

◆ SupplyElementTypeFromVector()

TTypesOfLandscapeElement Landscape::SupplyElementTypeFromVector ( unsigned int  a_index)
inline

Definition at line 1104 of file landscape.h.

1105 {
1106  return m_elems[ a_index ]->GetElementType();
1107 }

References m_elems.

◆ SupplyFarmAnimalCensus()

int Landscape::SupplyFarmAnimalCensus ( int  a_farm_ref,
int  a_LifeStage 
)

Definition at line 745 of file Landscape.cpp.

746 {
747  return m_ThePopManager->FarmAnimalCensus(a_farm_ref, a_LifeStage);
748 }

Referenced by FarmManager::FarmManagement().

◆ SupplyFarmArea()

int Landscape::SupplyFarmArea ( int  a_polyref)
inline

Definition at line 1206 of file landscape.h.

1207 {
1208  return m_elems[ m_polymapping[ a_polyref ]]->GetOwner()->GetArea();
1209 }

References m_elems, and m_polymapping.

◆ SupplyFarmIntensity() [1/2]

int Landscape::SupplyFarmIntensity ( int  a_polyref)

Definition at line 761 of file Landscape.cpp.

761  {
762  return m_elems[ m_polymapping[ a_polyref ]]->GetOwner()->GetIntensity();
763 }

References m_polymapping.

◆ SupplyFarmIntensity() [2/2]

int Landscape::SupplyFarmIntensity ( int  a_x,
int  a_y 
)

Definition at line 756 of file Landscape.cpp.

756  {
757  return m_elems[ m_land->Get( a_x, a_y ) ]->GetOwner()->GetIntensity();
758 }

Referenced by VegElement::DoDevelopment(), and VegElement::RecalculateBugsNStuff().

◆ SupplyFarmIntensityI()

int Landscape::SupplyFarmIntensityI ( int  a_polyindex)

Definition at line 751 of file Landscape.cpp.

751  {
752  return m_elems[ a_polyindex ]->GetOwner()->GetIntensity();
753 }

◆ SupplyFarmManagerPtr()

FarmManager* Landscape::SupplyFarmManagerPtr ( )
inline

Definition at line 353 of file landscape.h.

353 { return m_FarmManager; }

References m_FarmManager.

◆ SupplyFarmOwner() [1/2]

int Landscape::SupplyFarmOwner ( int  a_polyref)
inline

Definition at line 1158 of file landscape.h.

1159 {
1160  return m_elems[ m_polymapping[ a_polyref ]]->GetOwnerFile();
1161 }

References m_elems, and m_polymapping.

◆ SupplyFarmOwner() [2/2]

int Landscape::SupplyFarmOwner ( int  a_x,
int  a_y 
)
inline

Definition at line 1152 of file landscape.h.

1152  {
1153  return m_elems[ m_land->Get( a_x, a_y ) ]->GetOwnerFile();
1154 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyFarmOwnerIndex() [1/2]

int Landscape::SupplyFarmOwnerIndex ( int  a_polyref)
inline

Definition at line 1172 of file landscape.h.

1173 {
1174  return m_elems[ m_polymapping[ a_polyref ]]->GetOwnerIndex();
1175 }

References m_elems, and m_polymapping.

◆ SupplyFarmOwnerIndex() [2/2]

int Landscape::SupplyFarmOwnerIndex ( int  a_x,
int  a_y 
)
inline

Definition at line 1165 of file landscape.h.

1166 {
1167  return m_elems[ m_land->Get( a_x, a_y ) ]->GetOwnerIndex();
1168 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyFarmPtr()

Farm* Landscape::SupplyFarmPtr ( int  a_owner)
inline

Definition at line 352 of file landscape.h.

352 { return m_FarmManager->GetFarmPtr(a_owner); }

References FarmManager::GetFarmPtr(), and m_FarmManager.

◆ SupplyFarmType() [1/2]

TTypesOfFarm Landscape::SupplyFarmType ( int  a_polyref)
inline

Definition at line 1179 of file landscape.h.

1180 {
1181  return m_elems[ m_polymapping[ a_polyref ]]->GetOwner()->GetType();
1182 }

References m_elems, and m_polymapping.

◆ SupplyFarmType() [2/2]

TTypesOfFarm Landscape::SupplyFarmType ( int  a_x,
int  a_y 
)
inline

Definition at line 1186 of file landscape.h.

1187 {
1188  return m_elems[ m_land->Get( a_x, a_y ) ]->GetOwner()->GetType();
1189 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyGlobalDate()

long Landscape::SupplyGlobalDate ( void  )
inline

Definition at line 1621 of file landscape.h.

1622 {
1623  return g_date->Date();
1624 }

References Calendar::Date(), and g_date.

Referenced by Rabbit_Female::st_EvaluateTerritory(), Rabbit_Female::st_GiveBirth(), and Rabbit_Warren::UpdateForageInformation().

◆ SupplyGlobalRadiation() [1/2]

double Landscape::SupplyGlobalRadiation ( )
inline

Definition at line 1341 of file landscape.h.

1342 {
1343  return g_weather->GetGlobalRadiation( );
1344 }

References g_weather, and Weather::GetGlobalRadiation().

Referenced by VegElement::RecalculateBugsNStuff().

◆ SupplyGlobalRadiation() [2/2]

double Landscape::SupplyGlobalRadiation ( long  a_date)
inline

Definition at line 1346 of file landscape.h.

1347 {
1348  return g_weather->GetGlobalRadiation( a_date );
1349 }

References g_weather, and Weather::GetGlobalRadiation().

◆ SupplyGooseGrazingForageH() [1/2]

double Landscape::SupplyGooseGrazingForageH ( double  a_height,
GooseSpecies  a_goose 
)
inline

Returns the leaf forage resource as seen from a goose standpoint at a polygon based on the height only.

Parameters
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)
Returns
KJ/min

Definition at line 541 of file landscape.h.

542  {
548  if (a_goose == gs_Pinkfoot)
549  {
550  return m_GooseIntakeRateVSVegetationHeight_PF->GetY( a_height );
551  }
552  if (a_goose == gs_Barnacle)
553  {
554  if (a_height == 0.0) return 0.0;
555  else return m_GooseIntakeRateVSVegetationHeight_BG->GetY(a_height);
556  }
557  if (a_goose == gs_Greylag)
558  {
559  return m_GooseIntakeRateVSVegetationHeight_GL->GetY(a_height);
560  }
561  Warn("Landscape::SupplyGooseGrazingForage", "Unknown Goose Type");
562  exit(1);
563  }

References m_GooseIntakeRateVSVegetationHeight_BG, m_GooseIntakeRateVSVegetationHeight_GL, m_GooseIntakeRateVSVegetationHeight_PF, and Warn().

Referenced by VegElement::CalcGooseForageResources().

◆ SupplyGooseGrazingForageH() [2/2]

double Landscape::SupplyGooseGrazingForageH ( int  a_polygon,
GooseSpecies  a_goose 
)
inline

Returns the leaf forage resource as seen from a goose standpoint at a polygon referenced by number based on height only.

Parameters
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)
Returns
KJ/min

Definition at line 567 of file landscape.h.

568  {
574  if (a_goose == gs_Pinkfoot)
575  {
576  return m_GooseIntakeRateVSVegetationHeight_PF->GetY(m_elems[m_polymapping[a_polygon]]->GetVegHeight());
577  }
578  if (a_goose == gs_Barnacle)
579  {
580  return m_GooseIntakeRateVSVegetationHeight_BG->GetY(m_elems[m_polymapping[a_polygon]]->GetVegHeight());
581  }
582  if (a_goose == gs_Greylag)
583  {
584  return m_GooseIntakeRateVSVegetationHeight_GL->GetY(m_elems[m_polymapping[a_polygon]]->GetVegHeight());
585  }
586  Warn("Landscape::SupplyGooseGrazingForage", "Unknown Goose Type");
587  exit(1);
588  }

References m_elems, m_GooseIntakeRateVSVegetationHeight_BG, m_GooseIntakeRateVSVegetationHeight_GL, m_GooseIntakeRateVSVegetationHeight_PF, m_polymapping, and Warn().

◆ SupplyGrazingPressure() [1/2]

int Landscape::SupplyGrazingPressure ( int  a_polyref)
inline

Definition at line 1227 of file landscape.h.

1228 {
1229  return m_elems[ m_polymapping[ a_polyref ] ]->GetCattleGrazing();
1230 }

References m_elems, and m_polymapping.

◆ SupplyGrazingPressure() [2/2]

int Landscape::SupplyGrazingPressure ( int  a_x,
int  a_y 
)
inline

Definition at line 1239 of file landscape.h.

1240 {
1241  return m_elems[ m_land->Get( a_x, a_y ) ]->GetCattleGrazing();
1242 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyGrazingPressureVector()

int Landscape::SupplyGrazingPressureVector ( unsigned int  a_index)
inline

Definition at line 1232 of file landscape.h.

1233 {
1234  return m_elems[ a_index ]->GetCattleGrazing();
1235 }

References m_elems.

◆ SupplyGreenBiomass() [1/2]

double Landscape::SupplyGreenBiomass ( int  a_polyref)
inline

Definition at line 1017 of file landscape.h.

1018 {
1019  return m_elems[ m_polymapping[ a_polyref ]]->GetGreenBiomass();
1020 }

References m_elems, and m_polymapping.

◆ SupplyGreenBiomass() [2/2]

double Landscape::SupplyGreenBiomass ( int  a_x,
int  a_y 
)
inline

Definition at line 1022 of file landscape.h.

1023 {
1024  return m_elems[ m_land->Get( a_x, a_y ) ]->GetGreenBiomass();
1025 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyHasTramlines() [1/2]

bool Landscape::SupplyHasTramlines ( int  a_polyref)
inline

Definition at line 1246 of file landscape.h.

1247 {
1248  return m_elems[ m_polymapping[ a_polyref ] ]->HasTramlines();
1249 }

References m_elems, and m_polymapping.

◆ SupplyHasTramlines() [2/2]

bool Landscape::SupplyHasTramlines ( int  a_x,
int  a_y 
)
inline

Definition at line 1252 of file landscape.h.

1253 {
1254  return m_elems[ m_land->Get( a_x, a_y ) ]->HasTramlines();
1255 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyHour()

int Landscape::SupplyHour ( void  )
inline

Get the hour of the day.

Definition at line 1586 of file landscape.h.

1586  {
1587  return g_date->GetHour();
1588 }

References g_date, and Calendar::GetHour().

◆ SupplyHumidity()

double Landscape::SupplyHumidity ( void  )
inline

Definition at line 1393 of file landscape.h.

1394 {
1395  return g_weather->GetHumidity();
1396 }

References g_weather, and Weather::GetHumidity().

◆ SupplyInsects() [1/2]

double Landscape::SupplyInsects ( int  a_polyref)
inline

Definition at line 1088 of file landscape.h.

1089 {
1090  return m_elems[ m_polymapping[ a_polyref ]]->GetInsectPop();
1091 }

References m_elems, and m_polymapping.

◆ SupplyInsects() [2/2]

double Landscape::SupplyInsects ( int  a_x,
int  a_y 
)
inline

Definition at line 1093 of file landscape.h.

1094 {
1095  return m_elems[ m_land->Get( a_x, a_y ) ]->GetInsectPop();
1096 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyInStubble()

bool Landscape::SupplyInStubble ( int  a_polyref)
inline

Returns whether its cereal.

Definition at line 634 of file landscape.h.

634  {
635  return m_elems[m_polymapping[a_polyref]]->GetStubble();
636  }

References m_elems, and m_polymapping.

◆ SupplyIsCereal()

bool Landscape::SupplyIsCereal ( int  a_polyref)
inline

Definition at line 1300 of file landscape.h.

1301 {
1302  return m_elems[m_polymapping[a_polyref]]->IsCereal();
1303 }

References m_elems, and m_polymapping.

◆ SupplyIsCereal2()

bool Landscape::SupplyIsCereal2 ( TTypesOfVegetation  a_vege_type)

Definition at line 532 of file Landscape.cpp.

533 {
534  switch (a_vege_type)
535  {
536  case tov_SpringBarley:
537  case tov_SpringBarleySpr:
538  case tov_WinterBarley:
539  case tov_SpringWheat:
540  case tov_WinterWheat:
541  case tov_WinterRye:
542  case tov_Oats:
543  case tov_Triticale:
551  case tov_OWinterBarley:
553  case tov_OWinterRye:
557  case tov_OSpringBarley:
560  case tov_OWinterWheat:
561  case tov_OOats:
562  case tov_OTriticale:
563  case tov_WWheatPControl:
572  case tov_PLWinterWheat:
573  case tov_PLWinterBarley:
574  case tov_PLWinterRye:
576  case tov_PLSpringWheat:
577  case tov_PLSpringBarley:
578  case tov_NLWinterWheat:
579  case tov_NLSpringBarley:
580  return true;
581  default: return false;
582 }
583 }

References tov_AgroChemIndustryCereal, tov_NLSpringBarley, tov_NLWinterWheat, tov_Oats, tov_OOats, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyExt, tov_OSpringBarleyGrass, tov_OSpringBarleyPigs, tov_OTriticale, tov_OWinterBarley, tov_OWinterBarleyExt, tov_OWinterRye, tov_OWinterWheat, tov_OWinterWheatUndersown, tov_PLSpringBarley, tov_PLSpringWheat, tov_PLWinterBarley, tov_PLWinterRye, tov_PLWinterTriticale, tov_PLWinterWheat, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyGrass, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleyPTreatment, tov_SpringBarleySeed, tov_SpringBarleySKManagement, tov_SpringBarleySpr, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringWheat, tov_Triticale, tov_WinterBarley, tov_WinterRye, tov_WinterWheat, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, and tov_WWheatPTreatment.

◆ SupplyIsGrass()

bool Landscape::SupplyIsGrass ( int  a_polyref)
inline

Definition at line 1310 of file landscape.h.

1311 {
1312  return m_elems[ m_polymapping[ a_polyref ] ]->IsGrass();
1313 }

References m_elems, and m_polymapping.

◆ SupplyIsGrass2()

bool Landscape::SupplyIsGrass2 ( TTypesOfVegetation  a_vege_type)

◆ SupplyIsMatureCereal()

bool Landscape::SupplyIsMatureCereal ( int  a_polyref)
inline

Definition at line 1305 of file landscape.h.

1306 {
1307  return m_elems[m_polymapping[a_polyref]]->IsMatureCereal();
1308 }

References m_elems, and m_polymapping.

◆ SupplyJustMown()

bool Landscape::SupplyJustMown ( int  a_polyref)
inline

Definition at line 1263 of file landscape.h.

1264 {
1265  return m_elems[ m_polymapping[ a_polyref ] ]->IsRecentlyMown();
1266 }

References m_elems, and m_polymapping.

◆ SupplyJustMownVector()

bool Landscape::SupplyJustMownVector ( unsigned int  a_index)
inline

Definition at line 1258 of file landscape.h.

1259 {
1260  return m_elems[ a_index ]->IsRecentlyMown();
1261 }

References m_elems.

◆ SupplyJustSprayed() [1/2]

int Landscape::SupplyJustSprayed ( int  a_polyref)
inline

Definition at line 1275 of file landscape.h.

1276 {
1277  return m_elems[ m_polymapping[ a_polyref ] ]->IsRecentlySprayed();
1278 }

References m_elems, and m_polymapping.

◆ SupplyJustSprayed() [2/2]

int Landscape::SupplyJustSprayed ( int  a_x,
int  a_y 
)
inline

Definition at line 1280 of file landscape.h.

1281 {
1282  return m_elems[ m_land->Get( a_x, a_y ) ]->IsRecentlySprayed();
1283 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyJustSprayedVector()

int Landscape::SupplyJustSprayedVector ( unsigned int  a_index)
inline

Definition at line 1270 of file landscape.h.

1271 {
1272  return m_elems[ a_index ]->IsRecentlySprayed();
1273 }

References m_elems.

◆ SupplyLAGreen() [1/2]

double Landscape::SupplyLAGreen ( int  a_polyref)
inline

Definition at line 1041 of file landscape.h.

1042 {
1043  return m_elems[ m_polymapping[ a_polyref ]]->GetLAGreen();
1044 }

References m_elems, and m_polymapping.

◆ SupplyLAGreen() [2/2]

double Landscape::SupplyLAGreen ( int  a_x,
int  a_y 
)
inline

Definition at line 1010 of file landscape.h.

1011 {
1012  return m_elems[ m_land->Get( a_x, a_y ) ]->GetLAGreen();
1013 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyLargeOpenFieldsNearXY()

polylist * Landscape::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.

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!

Definition at line 782 of file Landscape.cpp.

783 {
792  polylist* p_list = new polylist;
793  unsigned sz = (unsigned) m_elems.size();
794  for (unsigned i=0; i<sz; i++)
795  {
796  if ( m_elems[i]->GetOpenness() > a_openness)
797  {
798  APoint pt = m_elems[i]->GetCentroid();
799  int dx, dy;
800  if (a_x>pt.m_x) dx = a_x-pt.m_x; else dx = pt.m_x-a_x;
801  if (a_y>pt.m_y) dy = a_y-pt.m_y; else dy = pt.m_y-a_y;
802  dx++; dy++; // prevents crash with maths below.
804  int dist;
806  if (dx>dy) dist = dx + (dy * dy) /(2 * dx); else dist = dy + (dx * dx) /(2 * dy);
807  if (dist<=a_range) p_list->push_back( m_elems[i]->GetPoly());
808  }
809  }
810  return p_list;
811 }

◆ SupplyLargestPolyNumUsed()

int Landscape::SupplyLargestPolyNumUsed ( )
inline

Definition at line 355 of file landscape.h.

355 { return m_LargestPolyNumUsed; }

References m_LargestPolyNumUsed.

◆ SupplyLastSownVeg() [1/2]

TTypesOfVegetation Landscape::SupplyLastSownVeg ( int  a_polyref)
inline

Definition at line 1068 of file landscape.h.

1069 {
1070  return m_elems[m_polymapping[a_polyref]]->GetLastSownVeg();
1071 }

References m_elems, and m_polymapping.

◆ SupplyLastSownVeg() [2/2]

TTypesOfVegetation Landscape::SupplyLastSownVeg ( int  a_x,
int  a_y 
)
inline

Definition at line 1073 of file landscape.h.

1074 {
1075  return m_elems[m_land->Get(a_x, a_y)]->GetLastSownVeg();
1076 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyLastSownVegVector()

TTypesOfVegetation Landscape::SupplyLastSownVegVector ( unsigned int  a_index)
inline

Definition at line 1063 of file landscape.h.

1064 {
1065  return m_elems[a_index]->GetLastSownVeg();
1066 }

References m_elems.

◆ SupplyLastTreatment() [1/2]

int Landscape::SupplyLastTreatment ( int  a_polyref,
int *  a_index 
)
inline

Definition at line 1331 of file landscape.h.

1332 {
1333  return m_elems[ m_polymapping[ a_polyref ]]->GetLastTreatment( a_index );
1334 }

References m_elems, and m_polymapping.

◆ SupplyLastTreatment() [2/2]

int Landscape::SupplyLastTreatment ( int  a_x,
int  a_y,
int *  a_index 
)
inline

Definition at line 1336 of file landscape.h.

1337 {
1338  return m_elems[ m_land->Get( a_x, a_y ) ]->GetLastTreatment( a_index );
1339 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyLATotal()

double Landscape::SupplyLATotal ( int  a_x,
int  a_y 
)
inline

Definition at line 1004 of file landscape.h.

1005 {
1006  return m_elems[ m_land->Get( a_x, a_y ) ]->GetLATotal();
1007 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyLECount()

int Landscape::SupplyLECount ( void  )

Definition at line 3562 of file Landscape.cpp.

3562  {
3563  return (int)m_elems.size();
3564 }

◆ SupplyLEHigh()

bool Landscape::SupplyLEHigh ( int  a_x,
int  a_y 
)
inline

Tests whether the polygon at a_x,a_y is designated as high.

Definition at line 455 of file landscape.h.

455 { return m_elems[ m_land->Get( a_x, a_y ) ]->GetHigh(); }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyLENext()

int Landscape::SupplyLENext ( void  )

Definition at line 3555 of file Landscape.cpp.

3555  {
3556  if ((unsigned int)le_signal_index == m_elems.size()) {
3557  return -1;
3558  }
3559  return m_elems[le_signal_index++]->GetPoly();
3560 }

◆ SupplyLEPointer()

LE * Landscape::SupplyLEPointer ( int  a_polyref)
inline

Definition at line 1099 of file landscape.h.

1100 {
1101  return m_elems[ m_polymapping[ a_polyref ]];
1102 }

References m_elems, and m_polymapping.

Referenced by Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), Farm::BedForming(), Farm::Biocide(), Farm::BulbHarvest(), Farm::BurnStrawStubble(), Farm::CattleIsOut(), Farm::CattleIsOutLow(), Farm::CattleOut(), Farm::CattleOutLowGrazing(), Farm::CutOrch(), Farm::CutToHay(), Farm::CutToSilage(), Farm::CutWeeds(), Farm::DeepPlough(), Field::DoDevelopment(), Farm::FA_AmmoniumSulphate(), Farm::FA_Calcium(), Farm::FA_GreenManure(), Farm::FA_ManganeseSulphate(), Farm::FA_Manure(), Farm::FA_NPK(), Farm::FA_NPKS(), Farm::FA_PK(), Farm::FA_RSM(), Farm::FA_Sludge(), Farm::FA_Slurry(), Farm::FlowerCutting(), Farm::FP_AmmoniumSulphate(), Farm::FP_Calcium(), Farm::FP_GreenManure(), Farm::FP_LiquidNH3(), Farm::FP_ManganeseSulphate(), Farm::FP_Manure(), Farm::FP_NPK(), Farm::FP_NPKS(), Farm::FP_PK(), Farm::FP_RSM(), Farm::FP_Sludge(), Farm::FP_Slurry(), Farm::Harvest(), OptimisingFarm::Harvest(), Farm::HarvestLong(), Farm::HayBailing(), Farm::HayTurning(), Farm::HeavyCultivatorAggregate(), Farm::HillingUp(), Rabbit_Warren::InitEvaluation(), Farm::PigsAreOut(), Farm::PigsAreOutForced(), Farm::PigsOut(), Farm::PreseedingCultivator(), Farm::PreseedingCultivatorSow(), Farm::RowCultivation(), VegElement::SetVegType(), Farm::ShallowHarrow(), Farm::SleepAllDay(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringRoll(), Farm::SpringSow(), Farm::SpringSowWithFerti(), Farm::StrawChopping(), Farm::StrawCovering(), Farm::StrawRemoval(), Farm::Strigling(), Farm::StriglingHill(), Farm::StriglingSow(), Farm::StubbleCultivatorHeavy(), Farm::StubbleHarrowing(), Farm::StubblePlough(), Farm::Swathing(), UnsprayedMarginScan(), Farm::Water(), and Farm::WinterPlough().

◆ SupplyLEReset()

void Landscape::SupplyLEReset ( void  )

Definition at line 3551 of file Landscape.cpp.

3551  {
3552  le_signal_index = 0;
3553 }

◆ SupplyLESignal()

LE_Signal Landscape::SupplyLESignal ( int  a_polyref)

Definition at line 3566 of file Landscape.cpp.

3566  {
3567  return m_elems[m_polymapping[a_polyref]]->GetSignal();
3568 }

References m_polymapping.

◆ SupplyMagicMapP()

int * Landscape::SupplyMagicMapP ( int  a_x,
int  a_y 
)
inline

Definition at line 1509 of file landscape.h.

1510 {
1511  return m_land->GetMagicP( a_x, a_y );
1512 }

References RasterMap::GetMagicP(), and m_land.

◆ SupplyMaleNewtPresent()

bool Landscape::SupplyMaleNewtPresent ( int  a_InPondIndex)
inline

Determines if a male is present in a pond.

Definition at line 351 of file landscape.h.

351 { return m_elems[a_InPondIndex]->IsMaleNewtPresent(); }

References m_elems.

◆ SupplyMeanTemp()

double Landscape::SupplyMeanTemp ( long  a_date,
unsigned int  a_period 
)
inline

Definition at line 1372 of file landscape.h.

1373 {
1374  return g_weather->GetMeanTemp( a_date, a_period );
1375 }

References g_weather, and Weather::GetMeanTemp().

◆ SupplyMinute()

int Landscape::SupplyMinute ( void  )
inline

Get the minute of the hour.

Definition at line 1592 of file landscape.h.

1592  {
1593  return g_date->GetMinute();
1594 }

References g_date, and Calendar::GetMinute().

◆ SupplyMonth()

int Landscape::SupplyMonth ( void  )
inline

Definition at line 1601 of file landscape.h.

1602 {
1603  return g_date->GetMonth();
1604 }

References g_date, and Calendar::GetMonth().

◆ SupplyNectar() [1/2]

PollenNectarQuality Landscape::SupplyNectar ( int  a_polyref)
inline

Definition at line 381 of file landscape.h.

381 { return m_elems[a_polyref]->GetNectar(); };

References m_elems.

◆ SupplyNectar() [2/2]

PollenNectarQuality Landscape::SupplyNectar ( int  a_x,
int  a_y 
)
inline

Definition at line 382 of file landscape.h.

382 { return m_elems[m_land->Get(a_x, a_y)]->GetNectar(); };

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyNightProp()

double Landscape::SupplyNightProp ( )
inline

Definition at line 826 of file landscape.h.

826 { return 1.0-g_date->GetDaylightProportion(); }

References g_date, and Calendar::GetDaylightProportion().

◆ SupplyNumberOfFarms()

int Landscape::SupplyNumberOfFarms ( )
inline

Definition at line 1148 of file landscape.h.

1148  {
1149  return m_FarmManager->GetNoFarms();
1150 }

References FarmManager::GetNoFarms(), and m_FarmManager.

◆ SupplyNumberOfPolygons()

unsigned int Landscape::SupplyNumberOfPolygons ( void  )
inline

Definition at line 1461 of file landscape.h.

1462 {
1463  return (unsigned int) m_elems.size();
1464 }

References m_elems.

◆ SupplyOpenness() [1/2]

int Landscape::SupplyOpenness ( int  a_poly)
inline

Get openness for a polygon.

Definition at line 451 of file landscape.h.

451 { return m_elems[m_polymapping[ a_poly ]]->GetOpenness(); }

References m_elems, and m_polymapping.

◆ SupplyOpenness() [2/2]

int Landscape::SupplyOpenness ( int  a_x,
int  a_y 
)
inline

Get openness for a location.

Definition at line 453 of file landscape.h.

453 { return m_elems[ m_land->Get( a_x, a_y )]->GetOpenness(); }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyOptFarmType()

TTypesOfOptFarms Landscape::SupplyOptFarmType ( int  a_x,
int  a_y 
)
inline

Definition at line 1191 of file landscape.h.

1192 {
1193  OptimisingFarm * opf;
1194  opf = dynamic_cast<OptimisingFarm*>(m_elems[ m_land->Get( a_x, a_y ) ]->GetOwner());
1195  return opf-> Get_farmType();
1196 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyOsmiaNest()

bool Landscape::SupplyOsmiaNest ( int  a_x,
int  a_y 
)
inline

Find out whether an osmia nest can be made here.

Definition at line 861 of file landscape.h.

861  {
862  return m_elems[m_land->Get(a_x, a_y)]->GetOsmiaNest();
863  }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyOverspray()

bool Landscape::SupplyOverspray ( int  a_x,
int  a_y 
)

Gets the overspray flag.

Definition at line 599 of file Landscape.cpp.

600 {
601  return m_elems[m_land->Get(a_x, a_y)]->GetSprayedToday();
602 }

◆ SupplyPesticide() [1/2]

double Landscape::SupplyPesticide ( int  a_polyref,
PlantProtectionProducts  a_ppp 
)

Gets total pesticide for the centroid of a polygon.

Definition at line 627 of file Landscape.cpp.

627  {
628  if (!l_pest_enable_pesticide_engine.value()) return 0.0;
629  double pp;
630 #ifdef __DETAILED_PESTICIDE_FATE
631  pp = g_pest->SupplyPesticideS(a_polyref, a_ppp);
632  pp += g_pest->SupplyPesticideP(a_polyref, a_ppp);
633 #else
634  pp = g_pest->SupplyPesticide(a_polyref, a_ppp);
635 #endif
636  return pp;
637 }

References g_pest, l_pest_enable_pesticide_engine, Pesticide::SupplyPesticide(), and CfgBool::value().

◆ SupplyPesticide() [2/2]

double Landscape::SupplyPesticide ( int  a_x,
int  a_y,
PlantProtectionProducts  a_ppp 
)

Gets total pesticide for a location.

Definition at line 586 of file Landscape.cpp.

586  {
587  double pp;
588 #ifdef __DETAILED_PESTICIDE_FATE
589  // This should be avoided if possible because it is inefficient
590  pp = g_pest->SupplyPesticideS(a_x, a_y, a_ppp);
591  pp += g_pest->SupplyPesticideP(a_x, a_y, a_ppp);
592 #else
593  pp = g_pest->SupplyPesticide(a_x, a_y, a_ppp);
594 #endif
595  return pp;
596 }

References g_pest, and Pesticide::SupplyPesticide().

Referenced by Pond::CalcPondPesticide(), and Rabbit_Warren::UpdatePesticide().

◆ SupplyPesticideCell()

int Landscape::SupplyPesticideCell ( int  a_polyref)
inline

Definition at line 1468 of file landscape.h.

1469 {
1470  return m_elems[ m_polymapping[ a_polyref ] ]->GetPesticideCell();
1471 }

References m_elems, and m_polymapping.

Referenced by Pesticide::SupplyPesticide().

◆ SupplyPesticideDecay()

bool Landscape::SupplyPesticideDecay ( PlantProtectionProducts  a_ppp)

Returns true if there is any pesticide in the system at all at this point.

Definition at line 776 of file Landscape.cpp.

777 {
778  return g_pest->GetAnythingToDecay(a_ppp);
779 }

References g_pest, and Pesticide::GetAnythingToDecay().

Referenced by Rabbit_Warren::UpdatePesticide().

◆ SupplyPesticideP() [1/2]

double Landscape::SupplyPesticideP ( int  a_polyref,
PlantProtectionProducts  a_ppp 
)

Gets plant pesticide for the centroid of a polygon.

Definition at line 652 of file Landscape.cpp.

652  {
653  if (!l_pest_enable_pesticide_engine.value()) return 0.0;
654  double pp;
655 #ifdef __DETAILED_PESTICIDE_FATE
656  pp = g_pest->SupplyPesticideP(a_polyref, a_ppp);
657 #else
658  pp = g_pest->SupplyPesticide(a_polyref, a_ppp);
659 #endif
660  return pp;
661 }

References g_pest, l_pest_enable_pesticide_engine, Pesticide::SupplyPesticide(), and CfgBool::value().

◆ SupplyPesticideP() [2/2]

double Landscape::SupplyPesticideP ( int  a_x,
int  a_y,
PlantProtectionProducts  a_ppp 
)

Gets plant pesticide for a location.

Definition at line 605 of file Landscape.cpp.

605  {
606  double pp;
607 #ifdef __DETAILED_PESTICIDE_FATE
608  pp = g_pest->SupplyPesticideP(a_x, a_y, a_ppp);
609 #else
610  pp = g_pest->SupplyPesticide(a_x, a_y, a_ppp);
611 #endif
612  return pp;
613 }

References g_pest, and Pesticide::SupplyPesticide().

◆ SupplyPesticideS() [1/2]

double Landscape::SupplyPesticideS ( int  a_polyref,
PlantProtectionProducts  a_ppp 
)

Gets soil pesticide for the centroid of a polygon.

Definition at line 640 of file Landscape.cpp.

640  {
641  if (!l_pest_enable_pesticide_engine.value()) return 0.0;
642  double pp;
643 #ifdef __DETAILED_PESTICIDE_FATE
644  pp = g_pest->SupplyPesticideS(a_polyref, a_ppp);
645 #else
646  pp = g_pest->SupplyPesticide(a_polyref, a_ppp);
647 #endif
648  return pp;
649 }

References g_pest, l_pest_enable_pesticide_engine, Pesticide::SupplyPesticide(), and CfgBool::value().

◆ SupplyPesticideS() [2/2]

double Landscape::SupplyPesticideS ( int  a_x,
int  a_y,
PlantProtectionProducts  a_ppp 
)

Gets soil pesticide for a location.

Definition at line 616 of file Landscape.cpp.

616  {
617  double pp;
618 #ifdef __DETAILED_PESTICIDE_FATE
619  pp = g_pest->SupplyPesticideS(a_x, a_y, a_ppp);
620 #else
621  pp = g_pest->SupplyPesticide(a_x, a_y, a_ppp);
622 #endif
623  return pp;
624 }

References g_pest, and Pesticide::SupplyPesticide().

◆ SupplyPesticideType()

◆ SupplyPollen() [1/2]

PollenNectarQuality Landscape::SupplyPollen ( int  a_polyref)
inline

Definition at line 377 of file landscape.h.

377 { return m_elems[a_polyref]->GetPollen(); };

References m_elems.

◆ SupplyPollen() [2/2]

PollenNectarQuality Landscape::SupplyPollen ( int  a_x,
int  a_y 
)
inline

Definition at line 378 of file landscape.h.

378 { return m_elems[m_land->Get(a_x, a_y)]->GetPollen(); };

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyPolygonArea()

double Landscape::SupplyPolygonArea ( int  a_polyref)
inline

Definition at line 523 of file landscape.h.

523 { return m_elems[ m_polymapping[ a_polyref ]]->GetArea(); }

References m_elems, and m_polymapping.

◆ SupplyPolygonAreaVector()

double Landscape::SupplyPolygonAreaVector ( int  a_polyref)
inline

Returns the area of a polygon using the vector index as a reference.

Definition at line 1200 of file landscape.h.

1201 {
1202  return m_elems[ a_polyref ]->GetArea();
1203 }

References m_elems.

◆ SupplyPolyRef()

int Landscape::SupplyPolyRef ( int  a_x,
int  a_y 
)
inline

◆ SupplyPolyRefCC()

int Landscape::SupplyPolyRefCC ( int  a_x,
int  a_y 
)
inline

Definition at line 1500 of file landscape.h.

1501 {
1502  a_x = (a_x + m_width10) % m_width;
1503  a_y = (a_y + m_height10) % m_height;
1504  return m_elems[ m_land->Get( a_x, a_y )]->GetPoly();
1505 }

References RasterMap::Get(), m_elems, m_height, m_height10, m_land, m_width, and m_width10.

◆ SupplyPolyRefIndex()

int Landscape::SupplyPolyRefIndex ( int  a_x,
int  a_y 
)
inline

Definition at line 1493 of file landscape.h.

1494 {
1495  return m_land->Get( a_x, a_y );
1496 }

References RasterMap::Get(), and m_land.

◆ SupplyPolyRefVector()

int Landscape::SupplyPolyRefVector ( unsigned int  a_index)
inline

Definition at line 1451 of file landscape.h.

1452 {
1453  return m_elems[ a_index ]->GetPoly();
1454 }

References m_elems.

◆ SupplyPondIndex()

int Landscape::SupplyPondIndex ( int  a_pondref)
inline

Returns the index of a pond based on pondref or -1 if not found.

Definition at line 342 of file landscape.h.

342  {
343  for (int i = 0; i < m_PondIndexList.size(); i++) {
344  if (m_PondRefsList[i] == a_pondref) return m_PondIndexList[i];
345  }
346  return -1;
347  }

References m_PondIndexList, and m_PondRefsList.

◆ SupplyPondPesticide()

double Landscape::SupplyPondPesticide ( int  a_poly_index)
inline

Get the pesticide concentration per liter from a pond (must be a pond index on calling)

Definition at line 761 of file landscape.h.

761 { return dynamic_cast<Pond*>(m_elems[a_poly_index])->SupplyPondPesticide(); }

References m_elems.

◆ SupplyRain() [1/2]

double Landscape::SupplyRain ( long  a_date)
inline

Definition at line 1358 of file landscape.h.

1359 {
1360  return g_weather->GetRain( a_date );
1361 }

References g_weather, and Weather::GetRain().

◆ SupplyRain() [2/2]

double Landscape::SupplyRain ( void  )
inline

Definition at line 1365 of file landscape.h.

1366 {
1367  return g_weather->GetRain();
1368 }

References g_weather, and Weather::GetRain().

Referenced by Rabbit_Population_Manager::DoFirst(), and Pesticide::Tick().

◆ SupplyRainPeriod()

double Landscape::SupplyRainPeriod ( long  a_date,
int  a_period 
)
inline

Definition at line 1351 of file landscape.h.

1352 {
1353  return g_weather->GetRainPeriod( a_date, a_period );
1354 }

References g_weather, and Weather::GetRainPeriod().

◆ SupplyRandomPondIndex()

int Landscape::SupplyRandomPondIndex ( )

Returns random pond index.

Definition at line 2606 of file Landscape.cpp.

2606  {
2607  return m_PondIndexList[int(g_rand_uni()*m_PondIndexList.size())];
2608 }

References g_rand_uni().

◆ SupplyRandomPondRef()

int Landscape::SupplyRandomPondRef ( )

Returns random pond polyref.

Definition at line 2610 of file Landscape.cpp.

2610  {
2611  if (m_PondIndexList.size()>0) return m_PondRefsList[int(g_rand_uni()*m_PondIndexList.size())];
2612  return -1;
2613 }

References g_rand_uni().

◆ SupplyRoadWidth()

int Landscape::SupplyRoadWidth ( int  ,
int   
)
inline

Definition at line 811 of file landscape.h.

811 {return 0;}

◆ SupplyRodenticide()

double Landscape::SupplyRodenticide ( int  a_x,
int  a_y 
)

Gets total rodenticide for a location.

Definition at line 492 of file Landscape.cpp.

492  {
494  {
495  double pp;
496  pp = m_RodenticideManager->GetRodenticide(a_x, a_y);
497  return pp;
498  }
499  return 0;
500 }

References cfg_rodenticide_enable, and CfgBool::value().

◆ SupplyRodenticidePredatoryManager()

RodenticidePredators_Population_Manager* Landscape::SupplyRodenticidePredatoryManager ( )
inline

Definition at line 432 of file landscape.h.

432 { return m_RodenticidePreds; }

References m_RodenticidePreds.

◆ SupplyShouldSpray()

bool Landscape::SupplyShouldSpray ( )
inline

Definition at line 357 of file landscape.h.

357 {return m_toxShouldSpray;}

References m_toxShouldSpray.

Referenced by Orchard::DoDevelopment(), and OrchardBand::DoDevelopment().

◆ SupplySimAreaHeight()

int Landscape::SupplySimAreaHeight ( void  )
inline

Definition at line 1637 of file landscape.h.

1638 {
1639  return m_height;
1640 }

References m_height.

Referenced by TAnimal::CorrectWrapRound(), Rabbit_Warren::InitEvaluation(), and Population_Manager::Population_Manager().

◆ SupplySimAreaMaxExtent()

int Landscape::SupplySimAreaMaxExtent ( void  )
inline

Definition at line 1642 of file landscape.h.

1643 {
1644  return m_maxextent;
1645 }

References m_maxextent.

◆ SupplySimAreaMinExtent()

int Landscape::SupplySimAreaMinExtent ( void  )

◆ SupplySimAreaWidth()

int Landscape::SupplySimAreaWidth ( void  )
inline

Definition at line 1632 of file landscape.h.

1633 {
1634  return m_width;
1635 }

References m_width.

Referenced by TAnimal::CorrectWrapRound(), Rabbit_Warren::InitEvaluation(), and Rabbit_Population_Manager::Rabbit_Population_Manager().

◆ SupplySkScrapes()

bool Landscape::SupplySkScrapes ( int  a_polyref)
inline

Definition at line 981 of file landscape.h.

982 {
983  return m_elems[ m_polymapping[ a_polyref ]]->GetSkScrapes();
984 }

References m_elems, and m_polymapping.

◆ SupplySnowcover() [1/2]

bool Landscape::SupplySnowcover ( long  a_date)
inline

Definition at line 1430 of file landscape.h.

1431 {
1432  return g_weather->GetSnow( a_date );
1433 }

References g_weather, and Weather::GetSnow().

◆ SupplySnowcover() [2/2]

bool Landscape::SupplySnowcover ( void  )
inline

Definition at line 1437 of file landscape.h.

1438 {
1439  return g_weather->GetSnow();
1440 }

References g_weather, and Weather::GetSnow().

◆ SupplySnowDepth()

double Landscape::SupplySnowDepth ( void  )
inline

Definition at line 1444 of file landscape.h.

1445 {
1446  return g_weather->GetSnowDepth();
1447 }

References g_weather, and Weather::GetSnowDepth().

◆ SupplySoilType()

int Landscape::SupplySoilType ( int  a_x,
int  a_y 
)
inline

Returns the soil type in ALMaSS types reference numbers.

Definition at line 460 of file landscape.h.

460  {
461  return m_elems[ m_land->Get( a_x, a_y ) ]->GetSoilType( );
462  }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplySoilTypeR()

int Landscape::SupplySoilTypeR ( int  a_x,
int  a_y 
)
inline

Returns the soil type in rabbit warren reference numbers.

Definition at line 464 of file landscape.h.

464  {
465  return m_elems[ m_land->Get( a_x, a_y ) ]->GetSoilTypeR( );
466  }

References RasterMap::Get(), m_elems, and m_land.

Referenced by Rabbit_Population_Manager::PreProcessWarrenLocations().

◆ SupplyTemp() [1/2]

double Landscape::SupplyTemp ( long  a_date)
inline

Definition at line 1379 of file landscape.h.

1380 {
1381  return g_weather->GetTemp( a_date );
1382 }

References g_weather, and Weather::GetTemp().

◆ SupplyTemp() [2/2]

double Landscape::SupplyTemp ( void  )
inline

Definition at line 1386 of file landscape.h.

1387 {
1388  return g_weather->GetTemp();
1389 }

References g_weather, and Weather::GetTemp().

Referenced by Rabbit_Population_Manager::DoFirst(), and VegElement::RecalculateBugsNStuff().

◆ SupplyTempPeriod()

double Landscape::SupplyTempPeriod ( long  a_date,
int  a_period 
)
inline

Definition at line 1410 of file landscape.h.

1411 {
1412  return g_weather->GetTempPeriod( a_date, a_period );
1413 }

References g_weather, and Weather::GetTempPeriod().

Referenced by Rabbit_Population_Manager::CheckForRabbitBreedingConditions().

◆ SupplyThePopManager()

Population_Manager* Landscape::SupplyThePopManager ( )
inline

Get the pointer to the current main population manager.

Definition at line 175 of file landscape.h.

175 { return m_ThePopManager; }

References m_ThePopManager.

◆ SupplyTotalNectar() [1/2]

double Landscape::SupplyTotalNectar ( int  a_polyref)
inline

Definition at line 383 of file landscape.h.

383 { return m_elems[a_polyref]->GetTotalNectar(); };

References m_elems.

◆ SupplyTotalNectar() [2/2]

double Landscape::SupplyTotalNectar ( int  a_x,
int  a_y 
)
inline

Definition at line 384 of file landscape.h.

384 { return m_elems[m_land->Get(a_x, a_y)]->GetTotalNectar(); };

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyTotalPollen() [1/2]

double Landscape::SupplyTotalPollen ( int  a_polyref)
inline

Definition at line 379 of file landscape.h.

379 { return m_elems[a_polyref]->GetTotalPollen(); };

References m_elems.

◆ SupplyTotalPollen() [2/2]

double Landscape::SupplyTotalPollen ( int  a_x,
int  a_y 
)
inline

Definition at line 380 of file landscape.h.

380 { return m_elems[m_land->Get(a_x, a_y)]->GetTotalPollen(); };

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyTrafficLoad() [1/2]

double Landscape::SupplyTrafficLoad ( int  a_polyref)
inline

Definition at line 1287 of file landscape.h.

1288 {
1289  return m_elems[ m_polymapping[ a_polyref ] ]->GetTrafficLoad();
1290 }

References m_elems, and m_polymapping.

◆ SupplyTrafficLoad() [2/2]

double Landscape::SupplyTrafficLoad ( int  a_x,
int  a_y 
)
inline

Definition at line 1293 of file landscape.h.

1294 {
1295  return m_elems[ m_land->Get( a_x, a_y ) ]->GetTrafficLoad();
1296 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyTreeAge() [1/2]

int Landscape::SupplyTreeAge ( int  a_Polyref)
inline

Definition at line 1315 of file landscape.h.

1316 {
1317  return 1;
1318 }

◆ SupplyTreeAge() [2/2]

int Landscape::SupplyTreeAge ( int  ,
int   
)
inline

Definition at line 509 of file landscape.h.

509 {return 0;}

◆ SupplyTreeHeight() [1/2]

int Landscape::SupplyTreeHeight ( int  )
inline

Definition at line 816 of file landscape.h.

816 {return 0;}

◆ SupplyTreeHeight() [2/2]

int Landscape::SupplyTreeHeight ( int  ,
int   
)
inline

Definition at line 814 of file landscape.h.

814 {return 0;}

◆ SupplyUnderGrowthWidth() [1/2]

int Landscape::SupplyUnderGrowthWidth ( int  )
inline

Definition at line 817 of file landscape.h.

817 {return 0;}

◆ SupplyUnderGrowthWidth() [2/2]

int Landscape::SupplyUnderGrowthWidth ( int  ,
int   
)
inline

Definition at line 815 of file landscape.h.

815 {return 0;}

◆ SupplyValidX()

int Landscape::SupplyValidX ( int  a_polyref)
inline

Definition at line 1474 of file landscape.h.

1475 {
1476  return m_elems[ m_polymapping[ a_polyref ] ]->GetValidX();
1477 }

References m_elems, and m_polymapping.

◆ SupplyValidY()

int Landscape::SupplyValidY ( int  a_polyref)
inline

Definition at line 1481 of file landscape.h.

1482 {
1483  return m_elems[ m_polymapping[ a_polyref ] ]->GetValidY();
1484 }

References m_elems, and m_polymapping.

◆ SupplyVegAge() [1/2]

int Landscape::SupplyVegAge ( int  a_Polyref)
inline

Definition at line 1078 of file landscape.h.

1079 {
1080  return m_elems[ m_polymapping[ a_polyref ]]->GetVegAge();
1081 }

References m_elems, and m_polymapping.

◆ SupplyVegAge() [2/2]

int Landscape::SupplyVegAge ( int  a_x,
int  a_y 
)
inline

Definition at line 1083 of file landscape.h.

1084 {
1085  return m_elems[m_land->Get(a_x, a_y)]->GetVegAge();
1086 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegBiomass() [1/2]

double Landscape::SupplyVegBiomass ( int  a_polyref)
inline

Definition at line 953 of file landscape.h.

954 {
955  return m_elems[ m_polymapping[ a_polyref ]]->GetVegBiomass();
956 }

References m_elems, and m_polymapping.

◆ SupplyVegBiomass() [2/2]

double Landscape::SupplyVegBiomass ( int  a_x,
int  a_y 
)
inline

Definition at line 958 of file landscape.h.

959 {
960  return m_elems[ m_land->Get( a_x, a_y ) ]->GetVegBiomass();
961 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegBiomassVector()

double Landscape::SupplyVegBiomassVector ( unsigned int  a_index)
inline

Definition at line 948 of file landscape.h.

949 {
950  return m_elems[ a_index ]->GetVegBiomass();
951 }

References m_elems.

◆ SupplyVegCover() [1/2]

double Landscape::SupplyVegCover ( int  a_polyref)
inline

Definition at line 1048 of file landscape.h.

1049 {
1050  return m_elems[ m_polymapping[ a_polyref ]]->GetVegCover();
1051 }

References m_elems, and m_polymapping.

Referenced by Pesticide::MainMapDecay().

◆ SupplyVegCover() [2/2]

double Landscape::SupplyVegCover ( int  a_x,
int  a_y 
)
inline

Definition at line 1058 of file landscape.h.

1059 {
1060  return m_elems[ m_land->Get( a_x, a_y ) ]->GetVegCover();
1061 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegCoverVector()

double Landscape::SupplyVegCoverVector ( unsigned int  a_index)
inline

Definition at line 1053 of file landscape.h.

1054 {
1055  return m_elems[ a_index ]->GetVegCover();
1056 }

References m_elems.

◆ SupplyVegDensity() [1/2]

int Landscape::SupplyVegDensity ( int  a_polyref)
inline

Definition at line 975 of file landscape.h.

976 {
977  return m_elems[ m_polymapping[ a_polyref ]]->GetVegDensity();
978 }

References m_elems, and m_polymapping.

◆ SupplyVegDensity() [2/2]

int Landscape::SupplyVegDensity ( int  a_x,
int  a_y 
)
inline

Definition at line 998 of file landscape.h.

999 {
1000  return m_elems[ m_land->Get( a_x, a_y ) ]->GetVegDensity();
1001 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegDigestability() [1/2]

double Landscape::SupplyVegDigestability ( int  a_polyref)
inline

Definition at line 919 of file landscape.h.

920 {
921  return m_elems[ m_polymapping[ a_polyref ]]->GetDigestability();
922 }

References m_elems, and m_polymapping.

Referenced by Rabbit_Warren::UpdateForageInformation().

◆ SupplyVegDigestability() [2/2]

double Landscape::SupplyVegDigestability ( int  a_x,
int  a_y 
)
inline

Definition at line 925 of file landscape.h.

926 {
927  return m_elems[ m_land->Get( a_x, a_y ) ]->GetDigestability();
928 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegDigestabilityVector()

double Landscape::SupplyVegDigestabilityVector ( unsigned int  a_index)
inline

Definition at line 914 of file landscape.h.

915 {
916  return m_elems[ a_index ]->GetDigestability();
917 }

References m_elems.

◆ SupplyVegHeight() [1/2]

double Landscape::SupplyVegHeight ( int  a_polyref)
inline

Definition at line 936 of file landscape.h.

937 {
938  return m_elems[ m_polymapping[ a_polyref ]]->GetVegHeight();
939 }

References m_elems, and m_polymapping.

Referenced by Rabbit_Warren::UpdateForageInformation().

◆ SupplyVegHeight() [2/2]

double Landscape::SupplyVegHeight ( int  a_x,
int  a_y 
)
inline

Definition at line 941 of file landscape.h.

942 {
943  return m_elems[ m_land->Get( a_x, a_y ) ]->GetVegHeight();
944 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegHeightVector()

double Landscape::SupplyVegHeightVector ( unsigned int  a_index)
inline

Definition at line 931 of file landscape.h.

932 {
933  return m_elems[ a_index ]->GetVegHeight();
934 }

References m_elems.

◆ SupplyVegPatchy() [1/2]

bool Landscape::SupplyVegPatchy ( int  a_polyref)
inline

Definition at line 986 of file landscape.h.

987 {
988  return m_elems[ m_polymapping[ a_polyref ]]->GetVegPatchy();
989 }

References m_elems, and m_polymapping.

◆ SupplyVegPatchy() [2/2]

bool Landscape::SupplyVegPatchy ( int  a_x,
int  a_y 
)
inline

Definition at line 992 of file landscape.h.

993 {
994  return m_elems[ m_land->Get( a_x, a_y ) ]->GetVegPatchy();
995 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegPhase()

int Landscape::SupplyVegPhase ( int  a_poly)
inline

Definition at line 179 of file landscape.h.

179  {
180  return m_elems[m_polymapping[a_poly]]->GetVegPhase();
181  }

References m_elems, and m_polymapping.

◆ SupplyVegType() [1/2]

TTypesOfVegetation Landscape::SupplyVegType ( int  a_x,
int  a_y 
)
inline

Definition at line 1321 of file landscape.h.

1322 {
1323  return m_elems[ m_land->Get( a_x, a_y ) ]->GetVegType();
1324 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyVegType() [2/2]

TTypesOfVegetation Landscape::SupplyVegType ( int  polyref)
inline

Definition at line 1214 of file landscape.h.

1215 {
1216  return m_elems[ m_polymapping[ a_polyref ] ]->GetVegType();
1217 }

References m_elems, and m_polymapping.

◆ SupplyVegTypeVector()

TTypesOfVegetation Landscape::SupplyVegTypeVector ( unsigned int  a_index)
inline

Definition at line 1220 of file landscape.h.

1221 {
1222  return m_elems[ a_index ]->GetVegType();
1223 }

References m_elems.

◆ SupplyVersion()

const char* Landscape::SupplyVersion ( void  )
inline

Definition at line 778 of file landscape.h.

778 { return m_versioninfo; }

References m_versioninfo.

◆ SupplyWeedBiomass() [1/2]

double Landscape::SupplyWeedBiomass ( int  a_polyref)
inline

Definition at line 964 of file landscape.h.

965 {
966  return m_elems[ m_polymapping[ a_polyref ]]->GetWeedBiomass();
967 }

References m_elems, and m_polymapping.

◆ SupplyWeedBiomass() [2/2]

double Landscape::SupplyWeedBiomass ( int  a_x,
int  a_y 
)
inline

Definition at line 970 of file landscape.h.

971 {
972  return m_elems[ m_land->Get( a_x, a_y ) ]->GetWeedBiomass();
973 }

References RasterMap::Get(), m_elems, and m_land.

◆ SupplyWind() [1/2]

double Landscape::SupplyWind ( long  a_date)
inline

Definition at line 1400 of file landscape.h.

1401 {
1402  return g_weather->GetWind( a_date );
1403 }

References g_weather, and Weather::GetWind().

◆ SupplyWind() [2/2]

double Landscape::SupplyWind ( void  )
inline

Definition at line 1417 of file landscape.h.

1418 {
1419  return g_weather->GetWind();
1420 }

References g_weather, and Weather::GetWind().

◆ SupplyWindDirection()

int Landscape::SupplyWindDirection ( void  )
inline

Definition at line 1423 of file landscape.h.

1424 {
1425  return g_weather->GetWindDirection();
1426 }

References g_weather, and Weather::GetWindDirection().

Referenced by Pesticide::DailyQueueProcess().

◆ SupplyWindPeriod()

double Landscape::SupplyWindPeriod ( long  a_date,
int  a_period 
)
inline

Definition at line 1405 of file landscape.h.

1406 {
1407  return g_weather->GetWindPeriod( a_date, a_period );
1408 }

References g_weather, and Weather::GetWindPeriod().

◆ SupplyYear()

int Landscape::SupplyYear ( void  )
inline

◆ SupplyYearNumber()

int Landscape::SupplyYearNumber ( void  )
inline

◆ TestCropManagement()

void Landscape::TestCropManagement ( void  )
protected

◆ Tick()

void Landscape::Tick ( void  )

If the farmer decision making model is on, the function:

  • calls FarmManager::ActualProfit() function on March 1st each year starting from the 2nd year of the simulation
  • starting from the 7th year, it saves the previous year's crop set for each farm and calls the FarmManager::ChooseDecisionMode_for_farms() function
  • saves all crop prices as last year prices (needed if crop prices are not constant)
  • saves the number of day degrees in a period March 1st - November 1st. See FarmManager::daydegrees.
  • modifies energy maize price each year if the model is run with energy maize.

Definition at line 1467 of file Landscape.cpp.

1467  {
1476  g_date->Tick();
1477  g_weather->Tick();
1478 
1479  // Remember todays LAItotal for veg elements
1480  for (unsigned int i = 0; i < m_elems.size(); i++) {
1481  m_elems[ i ]->StoreLAItotal();
1482  }
1483 
1484  // Update the growth curve phases if needed.
1485  if (g_date->JanFirst()) {
1486  if (g_rand_uni() > 0.5) {
1487  m_FarmManager->SetSpilledGrain( true );
1488  }
1489  else m_FarmManager->SetSpilledGrain( false );
1490  for (unsigned int i = 0; i < m_elems.size(); i++) {
1491  m_elems[ i ]->SetGrowthPhase( janfirst );
1492  }
1493  }
1494  else if (g_date->MarchFirst()) {
1495  for (unsigned int i = 0; i < m_elems.size(); i++) {
1496  m_elems[ i ]->SetGrowthPhase( marchfirst );
1497  m_elems[i]->SetStubble(false);
1498  }
1499  // Check and see if the pesticide engine flag should be set
1501  m_toxShouldSpray = true;
1502  else m_toxShouldSpray = false;
1503  }
1504 
1505 
1506  // Grow the green stuff and let the bugs have some too.
1507  for (unsigned int i = 0; i < m_elems.size(); i++) {
1508  m_elems[ i ]->Tick();
1509  m_elems[ i ]->DoDevelopment();
1510  }
1511 
1512  //call ActualProfit function, then save this year's crop prices - for the next year's expected results calculation, then change price
1513  if (cfg_OptimisingFarms.value()) {
1514  if (!cfg_OptimiseBedriftsmodelCrops.value()) { //do this just in almass crop mode
1515 
1516  if (g_date->DayInYear() == g_date->DayInYear( 1, 03 ) && g_date->GetYearNumber()>1) { //March 1st - do the accounting; 1 corresponds to 0 in the visual version year counter.
1517 
1519 
1520  //print the m_cropTotals
1521  ofstream ofile2( "CropDistribution.txt", ios::app );
1522  // the distibution of crops from last year!
1523  int last_year = g_date->GetYearNumber() - 1;
1524  ofile2 << last_year << '\t';
1525  for (int c = 0; c < m_FarmManager->pm_data->Get_noCrops(); c++) ofile2 << m_FarmManager->Get_cropTotals( c ) << '\t';
1526  ofile2 << endl;
1527  //restart the m_cropTotals:
1528  for (int i = 0; i < (int)m_FarmManager->Get_cropTotals_size(); i++) {
1529  m_FarmManager->Set_cropTotals( i, 0 );
1530  }
1531 
1532  if (g_date->GetYearNumber() > 7) { //it's been 6 years since the first accounting was carried out (5 would be enough, but exclude one year to avoid start up effects)
1533  m_FarmManager->Save_last_years_crops_for_farms(); //saves m_rotational_crops in m_rotational_crops_visible
1535  }
1536 
1537  }
1538 
1539  //save the last year crop price;
1540  if (g_date->GetYearNumber() > 1 && g_date->DayInYear() == g_date->DayInYear( 1, 03 )) {
1541  for (int f = 0; f < (toof_Foobar * tos_Foobar); f++) { //need to save the price for all farm types and soil types, so just run through the whole vector;
1542  int no_crops = m_FarmManager->pm_data->Get_cropTypes_almass_size();
1543  for (int c = 0; c < no_crops; c++) {
1544  double old_price = m_FarmManager->pm_data->Get_sellingPrice( tov_Undefined*f + m_FarmManager->pm_data->Get_cropTypes_almass( c ) ); //get the current price
1546  }
1547  }
1548  }
1549  //-----
1550 
1551 
1552  if (cfg_MaizeEnergy.value()) { //modify energy maize price
1553 
1554  if (g_date->DayInYear() == g_date->DayInYear( 1, 03 ) && g_date->GetYearNumber() != 0) { //print the price once a year
1555  ofstream ofileEM( "Maize_energy_price_yearly.txt", ios::app );
1556  int year = g_date->GetYearNumber();
1557  ofileEM << year << '\t';
1559  ofileEM << endl;
1560  ofileEM.close();
1561  }
1562 
1563  //changing price according to the input file EM_price.txt
1564  if (g_date->DayInYear() == g_date->DayInYear( 1, 03 ) && g_date->GetYearNumber() > 0) {//exclude the hidden year
1565  for (int f = 0; f < (toof_Foobar * tos_Foobar); f++) { //need to change the price for all farm types and soil types
1566  double new_price = m_FarmManager->pm_data->Get_emaize_price( g_date->GetYearNumber() );
1568  }
1569  }
1570  }// if energy maize
1571 
1572  }//almass crop mode
1573  }//optimising farms
1574 
1575  /* Testing removal - may cause issues with increasing or decreasing permanent vegetation
1576  if ( g_date->DayInYear() == g_date->DayInYear( 1, 11 ) ) {
1577  // Set all elements to smooth curve transition mode at November 1st.
1578  for ( unsigned int i = 0; i < m_elems.size(); i++ ) {
1579  m_elems[ i ]->ForceGrowthInitialize();
1580  }
1581  //save the day degrees - used for crops that are not harvested instead of biomass to determine yield; done on Nov 1st
1582  //m_FarmManager->SetDD (SupplyTempPeriod( g_date->Date(), 245)); // from Nov 1 - 245 days back till March 1;
1583  //DegreesDump();
1584  }
1585  */
1586 
1587  if (cfg_pesticidemapon.value())
1590  if (g_date->GetDayInMonth() == 1)
1591  //if (g_date->DayInYear() == cfg_pesticidemapdayinyear.value())
1593  else {
1597  }
1598 
1599  // Put the farmers to work.
1601 
1602 
1603  // Update pesticide information.
1604  g_pest->Tick();
1605 
1606  // Update rodenticide information if we are using this
1607  if (cfg_rodenticide_enable.value()) {
1608  m_RodenticideManager->Tick();
1609  m_RodenticidePreds->Tick();
1610  }
1611 
1612  // Dump event information if necessary
1616  //EventDumpPesticides( l_map_dump_event_x1.value(), l_map_dump_event_y1.value() );
1617 
1618 
1619 }

References cfg_MaizeEnergy, cfg_OptimiseBedriftsmodelCrops, cfg_OptimisingFarms, cfg_pesticidemapnoyears, cfg_pesticidemapon, cfg_pesticidemapstartyear, cfg_pesticidemaptype, cfg_productapplicendyear, cfg_productapplicstartyear, cfg_rodenticide_enable, Calendar::DayInYear(), g_date, g_pest, g_rand_uni(), g_weather, Calendar::GetDayInMonth(), Calendar::GetYearNumber(), janfirst, Calendar::JanFirst(), l_map_dump_event_enable, l_map_dump_event_x1, l_map_dump_event_x2, l_map_dump_event_y1, l_map_dump_event_y2, l_map_dump_veg_enable, l_map_dump_veg_x, l_map_dump_veg_y, l_pest_enable_pesticide_engine, marchfirst, Calendar::MarchFirst(), Calendar::Tick(), Pesticide::Tick(), Weather::Tick(), toof_Foobar, tos_Foobar, tov_Maize, tov_Undefined, CfgInt::value(), and CfgBool::value().

Referenced by TurnTheWorld().

◆ TranslateEleTypes()

TTypesOfLandscapeElement Landscape::TranslateEleTypes ( int  EleReference)
inline

Definition at line 1648 of file landscape.h.

1649 {
1650  return g_letype->TranslateEleTypes( EleReference );
1651 }

References g_letype, and LE_TypeClass::TranslateEleTypes().

◆ TranslateVegTypes()

TTypesOfVegetation Landscape::TranslateVegTypes ( int  VegReference)
inline

Definition at line 1655 of file landscape.h.

1656 {
1657  return g_letype->TranslateVegTypes( VegReference );
1658 }

References g_letype, and LE_TypeClass::TranslateVegTypes().

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ TurnTheWorld()

void Landscape::TurnTheWorld ( void  )
inline

Definition at line 905 of file landscape.h.

906 {
907  Tick();
908 }

References Tick().

◆ UMarginTest()

bool Landscape::UMarginTest ( int  a_fieldpoly,
int  a_borderpoly,
int  a_x,
int  a_y,
int  a_width 
)
protected

Definition at line 2669 of file Landscape.cpp.

2669  {
2670  int index;
2671  int x_add[ 8 ] = { 1*a_width, 1*a_width, 0, -1*a_width, -1*a_width, -1*a_width, 0, 1*a_width };
2672  int y_add[ 8 ] = { 0, -1*a_width, -1*a_width, -1*a_width, 0, 1*a_width, 1*a_width, 1*a_width };
2673  int width = m_land->MapWidth();
2674  int height = m_land->MapHeight();
2675  // Scan anti-clockwise from center pixel coordinate.
2676  for ( unsigned int i = 0; i < 8; i++ ) {
2677  if ( ( a_x + x_add[ i ] >= width ) || ( a_x + x_add[ i ] < 0 ) || ( a_y + y_add[ i ] >= height )
2678  || ( a_y + y_add[ i ] < 0 ) ) {
2679  return true;
2680  }
2681  //continue;
2682  index = m_land->Get( a_x + x_add[ i ], a_y + y_add[ i ] );
2683  if ( ( index != a_fieldindex ) && ( index != a_marginindex ) ) return true;
2684  }
2685  return false;
2686 }

◆ UnsprayedMarginAdd()

void Landscape::UnsprayedMarginAdd ( LE a_field)
protected

Definition at line 2617 of file Landscape.cpp.

2617  {
2618  int x = a_field->GetValidX();
2619  int y = a_field->GetValidY();
2620  if ( ( x == -1 ) || ( y == -1 ) ) {
2621  // Tripping this probably means it is not a field
2622  g_msg->Warn( WARN_BUG, "Landscape::UnsprayedMarginAdd(): Uninitialized border coordinate!", "" );
2623  exit( 1 );
2624  }
2625  LE * umargin = NewElement( tole_UnsprayedFieldMargin );
2626  m_polymapping[ hb_first_free_poly_num ] = (int) m_elems.size();
2627  m_elems.resize( m_elems.size() + 1 );
2628  m_elems[ m_elems.size() - 1 ] = umargin;
2630  umargin->SetPoly( hb_first_free_poly_num++ );
2631  umargin->SetArea( 0.0 );
2632 
2633  for ( int q = 0; q < l_map_umargin_width.value(); q++ )
2634  UnsprayedMarginScan( a_field, q + 1 );
2635 }

References g_msg, LE::GetValidX(), LE::GetValidY(), l_map_umargin_width, m_polymapping, LE::SetArea(), LE::SetPoly(), LE::SetUnsprayedMarginPolyRef(), tole_UnsprayedFieldMargin, CfgInt::value(), MapErrorMsg::Warn(), and WARN_BUG.

◆ UnsprayedMarginScan()

void Landscape::UnsprayedMarginScan ( LE a_field,
int  a_width 
)
protected

Definition at line 2638 of file Landscape.cpp.

2638  {
2639  LE * umargin = g_landscape_p->SupplyLEPointer( a_field->GetUnsprayedMarginPolyRef() );
2640  int fieldpoly = a_field->GetPoly();
2641  int borderpoly = umargin->GetPoly();
2642  int borderindex = m_polymapping[ borderpoly ];
2643  int fieldindex = m_polymapping[ fieldpoly ];
2644  int notforever = 5000;
2645 
2646  // These two will be modified through pointer operations
2647  // in BorderStep().
2648  int x = a_field->GetValidX();
2649  int y = a_field->GetValidY();
2650  // Now the problem is that GetValid does not always return a valid co-ord!
2651  // so we need to search for one
2652  if ( !FindValidXY( fieldindex, x, y ) ) return;
2653 
2654  while ( --notforever ) {
2655  // Check if this position should be made into a border.
2656  if ( UMarginTest( fieldindex, borderindex, x, y, a_width ) ) {
2657  // Add this pixel to the border element in the big map.
2658  m_land->Put( x, y, borderindex );
2659  a_field->AddArea( -1.0 );
2660  umargin->AddArea( 1.0 );
2661  };
2662  // Step to next coordinate. Quit when done.
2663  if ( !BorderStep( fieldindex, borderindex, & x, & y ) )
2664  return;
2665  }
2666 }

References LE::AddArea(), g_landscape_p, LE::GetPoly(), LE::GetUnsprayedMarginPolyRef(), LE::GetValidX(), LE::GetValidY(), m_polymapping, and SupplyLEPointer().

◆ UpdateOsmiaNesting()

void Landscape::UpdateOsmiaNesting ( )
inline

Tesll all LE objects to update their osmia nest status.

Definition at line 856 of file landscape.h.

856  {
857  for (unsigned int s = 0; s < m_elems.size(); s++) m_elems[s]->UpdateOsmiaNesting();
858  }

References m_elems.

◆ VegDump()

void Landscape::VegDump ( int  x,
int  y 
)
protected

Definition at line 1644 of file Landscape.cpp.

1644  {
1645  FILE * vfile=fopen("VegDump.txt", "a" );
1646  if (!vfile) {
1647  g_msg->Warn( WARN_FILE, "Landscape::VegDump(): Unable to open file", "VegDump.txt" );
1648  exit( 1 );
1649  }
1650  //int year = SupplyYearNumber();
1651  int year = g_date->GetYear();
1652  int day = SupplyDayInYear();
1653  double hei = SupplyVegHeight( x, y );
1654  double bio = SupplyVegBiomass( x, y );
1655  double cover = SupplyVegCover( x, y );
1656  double density = bio / ( hei + 1 );
1657  double weeds = SupplyWeedBiomass( x, y );
1658  double insects = SupplyInsects( x, y );
1659  double LATotal = SupplyLATotal(x, y);
1660  double LAGreen = SupplyLAGreen(x, y);
1661  double digest = SupplyVegDigestability(x, y);
1662  double GreenBiomass = SupplyGreenBiomass(x,y);
1663  double DeadBiomass = SupplyDeadBiomass(x,y);
1664  int grazed = SupplyGrazingPressure(x, y);
1665  double ggraze = GetActualGooseGrazingForage(m_land->Get(x, y), gs_Pinkfoot);
1666  int VegType = BackTranslateVegTypes(SupplyVegType(x, y));
1667  double grain = SupplyBirdSeedForage(x, y);
1668 
1669  fprintf( vfile, "%d\t%d\t%g\t%g\t%d\t%g\t%g\t%g\t%i\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\n", year, day, hei, bio, grazed, density, cover, weeds, VegType, insects, LATotal, LAGreen, digest, GreenBiomass, DeadBiomass, ggraze, grain );
1670  /*
1671  y += 100;
1672  x += 100;
1673  hei = SupplyVegHeight( x, y );
1674  bio = SupplyVegBiomass( x, y );
1675  cover = SupplyVegCover( x, y );
1676  density = bio / ( hei + 1 );
1677  weeds = SupplyWeedBiomass( x, y );
1678  VegType = SupplyVegType( x, y );
1679  insects = SupplyInsects( x, y );
1680  digest = SupplyVegDigestability(x,y);
1681  fprintf( vfile, "%g\t%g\t%g\t%g\t%g\t%i\t%g\t%g\n", hei, bio, density, cover, weeds, VegType, insects, digest );
1682  */
1683  fclose( vfile );
1684 }

References g_date, g_msg, Calendar::GetYear(), MapErrorMsg::Warn(), and WARN_FILE.

◆ VegtypeToString()

std::string Landscape::VegtypeToString ( TTypesOfVegetation  a_veg)

Definition at line 4235 of file Landscape.cpp.

4235  {
4236  char error_num[20];
4237 
4238  switch (a_veg) {
4239  case tov_Carrots:
4240  return "Carrots ";
4241  case tov_BroadBeans:
4242  return "BroadBeans ";
4243  case tov_FodderGrass:
4244  return "FodderGrass ";
4246  return "CloverGrassGrazed1 ";
4248  return "CloverGrassGrazed2 ";
4249  case tov_FieldPeas:
4250  return "FieldPeas ";
4251  case tov_FieldPeasSilage:
4252  return "FieldPeasSilage ";
4253  case tov_FodderBeet:
4254  return "FodderBeet ";
4255  case tov_SugarBeet:
4256  return "SugarBeet ";
4257  case tov_OFodderBeet:
4258  return "OFodderBeet ";
4259  case tov_Lawn:
4260  return "Lawn ";
4261  case tov_Maize:
4262  return "Maize ";
4263  case tov_MaizeSilage:
4264  return "MaizeSilage ";
4265  case tov_OMaizeSilage:
4266  return "OMaizeSilage ";
4267  case tov_NaturalGrass:
4268  return "NaturalGrass ";
4269  case tov_NoGrowth:
4270  return "NoGrowth ";
4271  case tov_None:
4272  return "None ";
4273  case tov_OrchardCrop:
4274  return "OrchardCrop ";
4275  case tov_Oats:
4276  return "Oats ";
4278  return "OBarleyPeaCloverGrass";
4279  case tov_OCarrots:
4280  return "OCarrots ";
4282  return "OCloverGrassGrazed1 ";
4284  return "OCloverGrassGrazed2 ";
4286  return "OCloverGrassSilage1 ";
4287  case tov_OFieldPeas:
4288  return "OFieldPeas ";
4289  case tov_OFieldPeasSilage:
4290  return "OFieldPeasSilage ";
4291  case tov_OFirstYearDanger:
4292  return "OFirstYearDanger ";
4293  case tov_OGrazingPigs:
4294  return "OGrazingPigs ";
4295  case tov_OOats:
4296  return "OOats ";
4298  return "OPermanentGrassGrazed";
4299  case tov_OPotatoes:
4300  return "OPotatoes ";
4301  case tov_OSBarleySilage:
4302  return "OSBarleySilage ";
4303  case tov_OSeedGrass1:
4304  return "OSeedGrass1 ";
4305  case tov_OSeedGrass2:
4306  return "OSeedGrass2 ";
4307  case tov_OSetaside:
4308  return "OSetaside ";
4309  case tov_OSpringBarley:
4310  return "OSpringBarley ";
4311  case tov_OSpringBarleyExt:
4312  return "OSpringBarleyExt ";
4314  return "OSpringBarleyClover ";
4316  return "OSpringBarleyGrass ";
4317  case tov_OSpringBarleyPigs:
4318  return "OSpringBarleyPigs ";
4319  case tov_OTriticale:
4320  return "OTriticale ";
4321  case tov_OWinterBarley:
4322  return "OWinterBarley ";
4323  case tov_OWinterBarleyExt:
4324  return "OWinterBarleyExt ";
4325  case tov_OWinterRape:
4326  return "OWinterRape ";
4327  case tov_OWinterRye:
4328  return "OWinterRye ";
4330  return "OWinterWheatUndersown";
4331  case tov_OWinterWheat:
4332  return "OWinterWheat";
4334  return "OWinterWheatUsowExt ";
4336  return "PermanentGrassGrazed ";
4338  return "PermanentGrassLowYield";
4340  return "PermanentGrassTussocky";
4341  case tov_PermanentSetaside:
4342  return "PermanentSetaside ";
4343  case tov_Potatoes:
4344  return "PotatoesEat ";
4345  case tov_PotatoesIndustry:
4346  return "PotatoesIndustry ";
4347  case tov_SeedGrass1:
4348  return "SeedGrass1 ";
4349  case tov_SeedGrass2:
4350  return "SeedGrass2 ";
4351  case tov_Setaside:
4352  return "Setaside ";
4353  case tov_SpringBarley:
4354  return "SpringBarley ";
4355  case tov_SpringBarleySpr:
4356  return "SpringBarleySpr ";
4358  return "SpringBarleyPTreat ";
4360  return "SpringBarleySKMan ";
4362  return "SprBarleyCloverGrass ";
4363  case tov_SpringBarleyGrass:
4364  return "SpringBarleyGrass ";
4365  case tov_SpringBarleySeed:
4366  return "SpringBarleySeed ";
4368  return "SpringBarleySilage ";
4369  case tov_SpringRape:
4370  return "SpringRape ";
4371  case tov_SpringWheat:
4372  return "SpringWheat ";
4374  return "AgroChemIndustry Cereal ";
4375  case tov_Triticale:
4376  return "Triticale ";
4377  case tov_WinterBarley:
4378  return "WinterBarley ";
4379  case tov_WinterRape:
4380  return "WinterRape ";
4381  case tov_WinterRye:
4382  return "WinterRye ";
4383  case tov_WinterWheat:
4384  return "WinterWheat ";
4385  case tov_WinterWheatShort:
4386  return "WinterWheatShort ";
4387  case tov_WWheatPControl:
4388  return "P Trial Control ";
4390  return "P Trial Toxic Control";
4391  case tov_WWheatPTreatment:
4392  return "P Trial Treatment ";
4393  case tov_Undefined:
4394  return "Undefined ";
4396  return "WWStrigling ";
4398  return "WWStriglingSingle ";
4400  return "WWStriglingCulm ";
4402  return "SBPCGStrigling ";
4404  return "SBarleyStrigling ";
4406  return "SBarleyStriglingSgl ";
4408  return "SBarleyStriglingCulm ";
4409  case tov_MaizeStrigling:
4410  return "MaizseStrigling ";
4412  return "WRapeStrigling ";
4414  return "WRyeStrigling ";
4416  return "WBStrigling ";
4418  return "FieldPeasStrigling ";
4420  return "SBPeaCloverGrassStr ";
4421  case tov_YoungForest:
4422  return "Young Forest ";
4423  case tov_Wasteland:
4424  return "Wasteland ";
4425  case tov_Heath:
4426  return "Heath/Grass ";
4427  case tov_PlantNursery:
4428  return "Plant Nursery ";
4429  case tov_NorwegianPotatoes:
4430  return "Norwegian Potatoes ";
4431  case tov_NorwegianOats:
4432  return "Norwegian Oats ";
4434  return "Norwegian Spr. Barley";
4435 
4436  case tov_WaterBufferZone:
4437  return "Unsprayed buffer zone around water";
4438 
4439  case tov_PLWinterWheat:
4440  return "Polish Winter Wheat ";
4441  case tov_PLWinterRape:
4442  return "Polish Winter Rape ";
4443  case tov_PLWinterBarley:
4444  return "Polish Winter Barley ";
4445  case tov_PLWinterTriticale:
4446  return "Polish Winter Triticale ";
4447  case tov_PLWinterRye:
4448  return "Polish Winter Rye ";
4449  case tov_PLSpringWheat:
4450  return "Polish Spring Wheat ";
4451  case tov_PLSpringBarley:
4452  return "Polish Spring Barley ";
4453  case tov_PLMaize:
4454  return "Polish Maize ";
4455  case tov_PLMaizeSilage:
4456  return "Polish Maize Silage ";
4457  case tov_PLPotatoes:
4458  return "Polish Potatoes ";
4459  case tov_PLBeet:
4460  return "Polish Beet ";
4461  case tov_PLFodderLucerne1:
4462  return "Polish Fodder Lucerne first year ";
4463  case tov_PLFodderLucerne2:
4464  return "Polish Fodder Lucerne second/third year ";
4465  case tov_PLCarrots:
4466  return "Polish Carrots ";
4467  case tov_PLSpringBarleySpr:
4468  return "Polish Spring Barley with Spring Plough ";
4469  case tov_PLWinterWheatLate:
4470  return "Polish Winter Wheat late sown ";
4471  case tov_PLBeetSpr:
4472  return "Polish Beet with Spring Plough ";
4473  case tov_PLBeans:
4474  return "Polish Beans ";
4475 
4476  case tov_NLBeet:
4477  return "Dutch Beet ";
4478  case tov_NLCarrots:
4479  return "Dutch Carrots ";
4480  case tov_NLMaize:
4481  return "Dutch Maize ";
4482  case tov_NLPotatoes:
4483  return "Dutch Potatoes ";
4484  case tov_NLSpringBarley:
4485  return "Dutch Spring Barley ";
4486  case tov_NLWinterWheat:
4487  return "Dutch Winter Wheat ";
4488  case tov_NLCabbage:
4489  return "Dutch Cabbage ";
4490  case tov_NLTulips:
4491  return "Dutch Tulips ";
4492  case tov_NLGrassGrazed1:
4493  return "Dutch TemporalGrassGrazed1 ";
4495  return "Dutch TemporalGrassGrazed1 after catch crop ";
4496  case tov_NLGrassGrazed2:
4497  return "Dutch TemporalGrassGrazed2 ";
4498  case tov_NLGrassGrazedLast:
4499  return "Dutch TemporalGrassGrazedLast ";
4501  return "Dutch PermanentGrassGrazed ";
4502  case tov_NLBeetSpring:
4503  return "Dutch Beet after catch crop ";
4504  case tov_NLCarrotsSpring:
4505  return "Dutch Carrots after catch crop ";
4506  case tov_NLMaizeSpring:
4507  return "Dutch Maize after catch crop ";
4508  case tov_NLPotatoesSpring:
4509  return "Dutch Potatoes after catch crop ";
4511  return "Dutch Spring Barley after catch crop ";
4512  case tov_NLCabbageSpring:
4513  return "Dutch Cabbage after catch crop ";
4514  case tov_NLCatchPeaCrop:
4515  return "Dutch Catch Pea Crop ";
4516 
4518  return "Dummy Crop for Testing of Pesticide Sparying Distribution ";
4519 
4520  default:
4521  sprintf(error_num, "%d", a_veg);
4522  g_msg->Warn(WARN_FILE, "Landscape::VegtypeToString(): Unknown event type:", error_num);
4523  exit(1);
4524  }
4525 }

References g_msg, tov_AgroChemIndustryCereal, tov_BroadBeans, tov_Carrots, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_DummyCropPestTesting, tov_FieldPeas, tov_FieldPeasSilage, tov_FieldPeasStrigling, tov_FodderBeet, tov_FodderGrass, tov_Heath, tov_Lawn, tov_Maize, tov_MaizeSilage, tov_MaizeStrigling, tov_NaturalGrass, tov_NLBeet, tov_NLBeetSpring, tov_NLCabbage, tov_NLCabbageSpring, tov_NLCarrots, tov_NLCarrotsSpring, tov_NLCatchPeaCrop, tov_NLGrassGrazed1, tov_NLGrassGrazed1Spring, tov_NLGrassGrazed2, tov_NLGrassGrazedLast, tov_NLMaize, tov_NLMaizeSpring, tov_NLPermanentGrassGrazed, tov_NLPotatoes, tov_NLPotatoesSpring, tov_NLSpringBarley, tov_NLSpringBarleySpring, tov_NLTulips, tov_NLWinterWheat, tov_NoGrowth, tov_None, tov_NorwegianOats, tov_NorwegianPotatoes, tov_NorwegianSpringBarley, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OCarrots, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OCloverGrassSilage1, tov_OFieldPeas, tov_OFieldPeasSilage, tov_OFirstYearDanger, tov_OFodderBeet, tov_OGrazingPigs, tov_OMaizeSilage, tov_OOats, tov_OPermanentGrassGrazed, tov_OPotatoes, tov_OrchardCrop, tov_OSBarleySilage, tov_OSeedGrass1, tov_OSeedGrass2, tov_OSetaside, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyExt, tov_OSpringBarleyGrass, tov_OSpringBarleyPigs, tov_OTriticale, tov_OWinterBarley, tov_OWinterBarleyExt, tov_OWinterRape, tov_OWinterRye, tov_OWinterWheat, tov_OWinterWheatUndersown, tov_OWinterWheatUndersownExt, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_PlantNursery, tov_PLBeans, tov_PLBeet, tov_PLBeetSpr, tov_PLCarrots, tov_PLFodderLucerne1, tov_PLFodderLucerne2, tov_PLMaize, tov_PLMaizeSilage, tov_PLPotatoes, tov_PLSpringBarley, tov_PLSpringBarleySpr, tov_PLSpringWheat, tov_PLWinterBarley, tov_PLWinterRape, tov_PLWinterRye, tov_PLWinterTriticale, tov_PLWinterWheat, tov_PLWinterWheatLate, tov_Potatoes, tov_PotatoesIndustry, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyCloverGrassStrigling, tov_SpringBarleyGrass, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleyPTreatment, tov_SpringBarleySeed, tov_SpringBarleySilage, tov_SpringBarleySKManagement, tov_SpringBarleySpr, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringRape, tov_SpringWheat, tov_SugarBeet, tov_Triticale, tov_Undefined, tov_Wasteland, tov_WaterBufferZone, tov_WinterBarley, tov_WinterBarleyStrigling, tov_WinterRape, tov_WinterRapeStrigling, tov_WinterRye, tov_WinterRyeStrigling, tov_WinterWheat, tov_WinterWheatShort, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, tov_WWheatPTreatment, tov_YoungForest, MapErrorMsg::Warn(), and WARN_FILE.

◆ Warn()

◆ WriteOpenness()

void Landscape::WriteOpenness ( void  )

Stores openness for all polygons to a standard file.

Member Data Documentation

◆ hb_border_pixels

int Landscape::hb_border_pixels
protected

Definition at line 276 of file landscape.h.

Referenced by hb_Add(), and hb_PaintBorder().

◆ hb_core_pixels

int Landscape::hb_core_pixels
protected

Definition at line 275 of file landscape.h.

Referenced by hb_Add(), and hb_PaintBorder().

◆ hb_first_free_poly_num

int Landscape::hb_first_free_poly_num
protected

Definition at line 274 of file landscape.h.

Referenced by hb_GenerateHBPolys().

◆ hb_hedges

vector<int> Landscape::hb_hedges
protected

Definition at line 263 of file landscape.h.

Referenced by hb_Add(), and hb_FindHedges().

◆ hb_height

int Landscape::hb_height
protected

◆ hb_map

◆ hb_max_x

◆ hb_max_y

◆ hb_min_x

◆ hb_min_y

◆ hb_new_hbs

vector<LE*> Landscape::hb_new_hbs
protected

Definition at line 264 of file landscape.h.

Referenced by hb_GenerateHBPolys(), and hb_StripingDist().

◆ hb_size

int Landscape::hb_size
protected

Definition at line 271 of file landscape.h.

Referenced by hb_Add(), hb_DownPolyNumbers(), and hb_UpPolyNumbers().

◆ hb_width

◆ l_vegtype_areas

double* Landscape::l_vegtype_areas
private

Definition at line 153 of file landscape.h.

Referenced by GetVegArea().

◆ le_signal_index

int Landscape::le_signal_index
protected

Definition at line 319 of file landscape.h.

◆ m_DoMissingPolygonsManipulations

bool Landscape::m_DoMissingPolygonsManipulations
private

Flag to signal that missing polygons exist

Definition at line 150 of file landscape.h.

◆ m_elems

vector<LE*> Landscape::m_elems
private

List of all landscape elements. The index is a sequential number, to get the polynum look this number up in m_polymapping.

Definition at line 122 of file landscape.h.

Referenced by GetActualGooseGrazingForage(), GrazeVegetation(), GrazeVegetationTotal(), hb_Add(), hb_FindHedges(), hb_GenerateHBPolys(), IncOsmiaNest(), MagicMapP2PolyRef(), RebuildPolyMapping(), ReleaseOsmiaNest(), SetBirdMaizeForage(), SetBirdSeedForage(), SetMaleNewtPresent(), SupplyBirdMaizeForage(), SupplyBirdSeedForage(), SupplyCentroidX(), SupplyCentroidY(), SupplyCountryDesig(), SupplyDayDegrees(), SupplyDeadBiomass(), SupplyElementSubType(), SupplyElementType(), SupplyElementTypeCC(), SupplyElementTypeFromVector(), SupplyFarmArea(), SupplyFarmOwner(), SupplyFarmOwnerIndex(), SupplyFarmType(), SupplyGooseGrazingForageH(), SupplyGrazingPressure(), SupplyGrazingPressureVector(), SupplyGreenBiomass(), SupplyHasTramlines(), SupplyInsects(), SupplyInStubble(), SupplyIsCereal(), SupplyIsGrass(), SupplyIsMatureCereal(), SupplyJustMown(), SupplyJustMownVector(), SupplyJustSprayed(), SupplyJustSprayedVector(), SupplyLAGreen(), SupplyLastSownVeg(), SupplyLastSownVegVector(), SupplyLastTreatment(), SupplyLATotal(), SupplyLEHigh(), SupplyLEPointer(), SupplyMaleNewtPresent(), SupplyNectar(), SupplyNumberOfPolygons(), SupplyOpenness(), SupplyOptFarmType(), SupplyOsmiaNest(), SupplyPesticideCell(), SupplyPollen(), SupplyPolygonArea(), SupplyPolygonAreaVector(), SupplyPolyRef(), SupplyPolyRefCC(), SupplyPolyRefVector(), SupplyPondPesticide(), SupplySkScrapes(), SupplySoilType(), SupplySoilTypeR(), SupplyTotalNectar(), SupplyTotalPollen(), SupplyTrafficLoad(), SupplyValidX(), SupplyValidY(), SupplyVegAge(), SupplyVegBiomass(), SupplyVegBiomassVector(), SupplyVegCover(), SupplyVegCoverVector(), SupplyVegDensity(), SupplyVegDigestability(), SupplyVegDigestabilityVector(), SupplyVegHeight(), SupplyVegHeightVector(), SupplyVegPatchy(), SupplyVegPhase(), SupplyVegType(), SupplyVegTypeVector(), SupplyWeedBiomass(), and UpdateOsmiaNesting().

◆ m_FarmManager

FarmManager* Landscape::m_FarmManager
private

List of all the farms.

Definition at line 119 of file landscape.h.

Referenced by SupplyFarmManagerPtr(), SupplyFarmPtr(), and SupplyNumberOfFarms().

◆ m_GooseIntakeRateVSVegetationHeight_BG

Polynomial2CurveClass* Landscape::m_GooseIntakeRateVSVegetationHeight_BG
private

Definition at line 161 of file landscape.h.

Referenced by SupplyGooseGrazingForageH().

◆ m_GooseIntakeRateVSVegetationHeight_GL

Polynomial2CurveClass* Landscape::m_GooseIntakeRateVSVegetationHeight_GL
private

Definition at line 162 of file landscape.h.

Referenced by SupplyGooseGrazingForageH().

◆ m_GooseIntakeRateVSVegetationHeight_PF

Polynomial2CurveClass* Landscape::m_GooseIntakeRateVSVegetationHeight_PF
private

Curve relatning goose intake rates in KJ/min to vegetation height.

Definition at line 160 of file landscape.h.

Referenced by SupplyGooseGrazingForageH().

◆ m_height

◆ m_height10

int Landscape::m_height10
private

◆ m_land

◆ m_LargestPolyNumUsed

int Landscape::m_LargestPolyNumUsed
protected

Definition at line 194 of file landscape.h.

Referenced by SupplyLargestPolyNumUsed().

◆ m_maxextent

int Landscape::m_maxextent
private

Definition at line 143 of file landscape.h.

Referenced by SupplySimAreaMaxExtent().

◆ m_minmaxextent

int Landscape::m_minmaxextent
private

Definition at line 142 of file landscape.h.

◆ m_NeedCentroidCalculation

bool Landscape::m_NeedCentroidCalculation
private

a flag to ensure centroid calculation on object construction

Definition at line 146 of file landscape.h.

◆ m_NeedOpennessCalculation

bool Landscape::m_NeedOpennessCalculation
private

a flag to ensure openness calculation on object construction

Definition at line 148 of file landscape.h.

◆ m_PesticideMap

PesticideMap* Landscape::m_PesticideMap
private

For specialised pesticide recording.

Definition at line 133 of file landscape.h.

◆ m_PesticideType

TTypesOfPesticide Landscape::m_PesticideType
protected

An attribute to hold the pesticide type being tested, if there is one, if not default is -1.

Definition at line 278 of file landscape.h.

Referenced by SupplyPesticideType().

◆ m_polymapping

◆ m_PondIndexList

vector<int> Landscape::m_PondIndexList
protected

List of pond indexes.

Definition at line 197 of file landscape.h.

Referenced by HowManyPonds(), and SupplyPondIndex().

◆ m_PondRefsList

vector<int> Landscape::m_PondRefsList
protected

List of pond polyrefs.

Definition at line 199 of file landscape.h.

Referenced by SupplyPondIndex().

◆ m_RodenticideManager

RodenticideManager* Landscape::m_RodenticideManager
private

Definition at line 157 of file landscape.h.

◆ m_RodenticidePreds

RodenticidePredators_Population_Manager* Landscape::m_RodenticidePreds
private

Definition at line 158 of file landscape.h.

Referenced by SupplyRodenticidePredatoryManager().

◆ m_ThePopManager

Population_Manager* Landscape::m_ThePopManager
private

a pointer to the current main population manager

Definition at line 155 of file landscape.h.

Referenced by SetThePopManager(), and SupplyThePopManager().

◆ m_toxShouldSpray

bool Landscape::m_toxShouldSpray
protected

Definition at line 317 of file landscape.h.

Referenced by SupplyShouldSpray().

◆ m_treatment_counts

int Landscape::m_treatment_counts[last_treatment]
protected

Definition at line 193 of file landscape.h.

◆ m_versioninfo

char Landscape::m_versioninfo[30]
private

Definition at line 115 of file landscape.h.

Referenced by SupplyVersion().

◆ m_width

◆ m_width10

int Landscape::m_width10
private

◆ m_x_add

int Landscape::m_x_add[8]
protected

Definition at line 266 of file landscape.h.

◆ m_y_add

int Landscape::m_y_add[8]
protected

Definition at line 267 of file landscape.h.


The documentation for this class was generated from the following files:
version_major
static const int version_major
Definition: Landscape.cpp:49
LE_TypeClass::BackTranslateEleTypes
int BackTranslateEleTypes(TTypesOfLandscapeElement EleReference)
Definition: elements.cpp:3610
insecticide_treat
Definition: treatment.h:74
cfg_BeetleBankType
static CfgInt cfg_BeetleBankType("BBANK_TYPE", CFG_CUSTOM,(int) tole_BeetleBank)
Landscape::CalculateCentroids
void CalculateCentroids(void)
Definition: Landscape.cpp:3040
tov_AgroChemIndustryCereal
Definition: tov_declaration.h:55
cfg_B6B
CfgFloat cfg_B6B
tov_OSpringBarleyClover
Definition: tov_declaration.h:46
tole_HedgeBank
Definition: tole_declaration.h:68
tole_UrbanNoVeg
Definition: tole_declaration.h:78
Landscape::m_PondRefsList
vector< int > m_PondRefsList
List of pond polyrefs.
Definition: landscape.h:199
Landscape::hb_max_x
int hb_max_x
Definition: landscape.h:272
Landscape::m_versioninfo
char m_versioninfo[30]
Definition: landscape.h:115
tov_SpringBarleyStrigling
Definition: tov_declaration.h:58
Landscape::hb_width
int hb_width
Definition: landscape.h:269
tov_PLWinterWheatLate
Definition: tov_declaration.h:85
Landscape::hb_MarkTopFromLocalMax
void hb_MarkTopFromLocalMax(int a_color)
Definition: hedgebanks.cpp:679
cfg_dumpvegjan
CfgBool cfg_dumpvegjan("G_VEGAREASJAN_ON", CFG_CUSTOM, false)
tov_PLSpringWheat
Definition: tov_declaration.h:75
tov_NLSpringBarley
Definition: tov_declaration.h:93
Landscape::SupplyVegDigestability
double SupplyVegDigestability(int a_polyref)
Definition: landscape.h:919
FarmManager::GetRenumberedFarmRef
int GetRenumberedFarmRef(int a_farmref)
Returns the farm ref index for a farmref.
Definition: farm.h:1888
tole_Saltwater
Definition: tole_declaration.h:66
l_map_dump_veg_enable
static CfgBool l_map_dump_veg_enable("MAP_DUMP_VEG_ENABLE", CFG_CUSTOM, true)
FarmManager::Get_cropTotals
double Get_cropTotals(int i)
Definition: farm.h:1837
HeritageSite
Definition: elements.h:1304
Landscape::SupplyLEPointer
LE * SupplyLEPointer(int a_polyref)
Definition: landscape.h:1099
tov_NLMaizeSpring
Definition: tov_declaration.h:102
ConiferousForest
Definition: elements.h:961
cfg_B6F
CfgFloat cfg_B6F
GooseFieldListItem::grass
double grass[gs_foobar]
Definition: landscape.h:91
Landscape::DumpMapInfoByArea
void DumpMapInfoByArea(const char *a_filename, bool a_append, bool a_dump_zero_areas, bool a_write_veg_names)
Definition: Landscape.cpp:3652
g_map_le_borderwidth
CfgInt g_map_le_borderwidth("MAP_LE_BORDER_WIDTH", CFG_CUSTOM, 1)
tov_Oats
Definition: tov_declaration.h:40
tole_UnsprayedFieldMargin
Definition: tole_declaration.h:72
tov_OWinterBarley
Definition: tov_declaration.h:47
tole_UrbanVeg
Definition: tole_declaration.h:103
LE::SetOwner
void SetOwner(Farm *a_owner, int a_owner_num, int a_owner_index)
Definition: elements.h:219
strigling
Definition: treatment.h:77
GooseFieldListItem::lastsownveg
std::string lastsownveg
Definition: landscape.h:98
tov_NLPotatoes
Definition: tov_declaration.h:92
tole_Missing
Definition: tole_declaration.h:109
CfgStr::value
const char * value(void)
Definition: configurator.h:152
hay_bailing
Definition: treatment.h:89
Landscape::SupplyGreenBiomass
double SupplyGreenBiomass(int a_polyref)
Definition: landscape.h:1017
l_map_art_hb_tran_prob
static CfgInt l_map_art_hb_tran_prob("MAP_ART_HB_TRAN_PROB", CFG_CUSTOM, 30)
flower_cutting
Definition: treatment.h:109
Calendar::GetYear
int GetYear(void)
Definition: calendar.h:67
autumn_roll
Definition: treatment.h:38
DrainageDitch
Definition: elements.h:1239
l_map_dump_event_x2
static CfgInt l_map_dump_event_x2("MAP_DUMP_EVENT_XB", CFG_CUSTOM, 4333)
HB_MAGIC_COLOR
#define HB_MAGIC_COLOR
Definition: hedgebanks.cpp:39
spring_sow_with_ferti
Definition: treatment.h:103
FarmManager::FindNeighbours
void FindNeighbours()
Finds all OptimisingFarms' neighbours and saves them in the farm's OptimisingFarm::m_neighbours vecto...
Definition: farm.cpp:4657
Landscape::m_RodenticidePreds
RodenticidePredators_Population_Manager * m_RodenticidePreds
Definition: landscape.h:158
tole_Building
Definition: tole_declaration.h:62
l_map_dump_treatcounts_file
static CfgStr l_map_dump_treatcounts_file("MAP_DUMP_TREATCOUNTS_FILE", CFG_CUSTOM, "treatment_counts.txt")
cfg_BeetleBankMinY
CfgInt cfg_BeetleBankMinY("BBANK_MINY", CFG_CUSTOM, 0)
Landscape::SupplyLATotal
double SupplyLATotal(int a_x, int a_y)
Definition: landscape.h:1004
g_landscape_p
Landscape * g_landscape_p
Definition: Landscape.cpp:258
Landscape::DumpMap
void DumpMap(const char *a_filename)
Definition: Landscape.cpp:1386
cfg_P1H
CfgStr cfg_P1H
Landscape::hb_new_hbs
vector< LE * > hb_new_hbs
Definition: landscape.h:264
tole_Freshwater
Definition: tole_declaration.h:64
GooseFieldListItem::vegheight
double vegheight
Definition: landscape.h:94
tov_OPermanentGrassGrazed
Definition: tov_declaration.h:44
Landscape::hb_MapBorder
bool hb_MapBorder(int a_x, int a_y)
Definition: hedgebanks.cpp:325
g_map_le_borders_min_field_size
CfgInt g_map_le_borders_min_field_size("MAP_LE_BORDERS_MIN_FIELD_SIZE", CFG_CUSTOM, 10000)
LE::GetArea
double GetArea(void)
Definition: elements.h:196
l_map_dump_event_x1
static CfgInt l_map_dump_event_x1("MAP_DUMP_EVENT_XA", CFG_CUSTOM, 4287)
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: landscape.h:1321
Landscape::hb_PaintBorder
void hb_PaintBorder(int a_color)
Definition: hedgebanks.cpp:429
Orchard
Definition: elements.h:992
NaturalGrassWet
Definition: elements.h:874
g_pest
class Pesticide * g_pest
Definition: pesticide.cpp:92
Landscape::SupplyElementType
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: landscape.h:1110
tole_Parkland
Definition: tole_declaration.h:77
Railway
Definition: elements.h:920
Landscape::PolysDump
void PolysDump(const char *a_filename)
Definition: Landscape.cpp:1803
tole_StoneWall
Definition: tole_declaration.h:56
Copse
Definition: elements.h:947
cfg_pesticidemapstartyear
CfgInt cfg_pesticidemapstartyear("PEST_MAP_STARTYEAR", CFG_CUSTOM, 0)
The first simulation year the pesticide is mapped.
cfg_MaizeEnergy
CfgBool cfg_MaizeEnergy
If set to true, the energy maize crop is included in the simulation.
tole_RiversidePlants
Definition: tole_declaration.h:49
tole_FishFarm
Definition: tole_declaration.h:102
tov_PLSpringBarleySpr
Definition: tov_declaration.h:84
GooseFieldListItem::geeseTimed
int geeseTimed
Definition: landscape.h:85
Landscape::VegtypeToString
std::string VegtypeToString(TTypesOfVegetation a_veg)
Definition: Landscape.cpp:4235
Landscape::RemoveSmallPolygons
int RemoveSmallPolygons(void)
Removes small polygons from the map.
Definition: Landscape.cpp:2184
RasterMap::MapHeight
int MapHeight(void)
Definition: rastermap.h:53
tole_Garden
Definition: tole_declaration.h:58
Landscape::UMarginTest
bool UMarginTest(int a_fieldpoly, int a_borderpoly, int a_x, int a_y, int a_width)
Definition: Landscape.cpp:2669
Landscape::SupplyLECount
int SupplyLECount(void)
Definition: Landscape.cpp:3562
tov_OOats
Definition: tov_declaration.h:44
cfg_B6H
CfgStr cfg_B6H
Pesticide::SupplyPesticide
double SupplyPesticide(int a_x, int a_y, PlantProtectionProducts a_ppp)
Definition: pesticide.h:329
tole_Churchyard
Definition: tole_declaration.h:86
cfg_pesticidemapon
CfgBool cfg_pesticidemapon("PEST_MAP_ON", CFG_CUSTOM, false)
Flag determining whether we are using the pesticide map.
fa_ammoniumsulphate
Definition: treatment.h:65
DataForOptimisation::Get_sellingPrice
double Get_sellingPrice(int i)
Definition: farm.h:648
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: calendar.h:68
tole_RoadsideSlope
Definition: tole_declaration.h:83
autumn_harrow
Definition: treatment.h:37
FarmManager::ChooseDecisionMode_for_farms
void ChooseDecisionMode_for_farms()
Calls OptimisingFarm::ChooseDecisionMode for all optimising farms.
Definition: farm.cpp:3444
Landscape::BorderStep
bool BorderStep(int a_fieldpoly, int a_borderpoly, int *a_x, int *a_y)
Definition: Landscape.cpp:2479
Landscape::hb_FindBoundingBox
bool hb_FindBoundingBox(int a_poly_num)
Definition: hedgebanks.cpp:243
Landscape::m_height
int m_height
Definition: landscape.h:139
polylist
vector< unsigned > polylist
Definition: farm.h:207
Landscape::SupplyLAGreen
double SupplyLAGreen(int a_polyref)
Definition: landscape.h:1041
tole_MixedForest
Definition: tole_declaration.h:53
g_map_le_borders
CfgBool g_map_le_borders("MAP_LE_BORDERS", CFG_CUSTOM, false)
Calendar::GetHour
int GetHour(void)
Definition: calendar.h:71
preseeding_cultivator
Definition: treatment.h:39
cfg_G6H
CfgStr cfg_G6H
Landscape::hb_AddNewHedgebanks
void hb_AddNewHedgebanks(int a_orig_poly_num)
Definition: hedgebanks.cpp:198
tov_OSetaside
Definition: tov_declaration.h:46
tov_PLMaizeSilage
Definition: tov_declaration.h:78
cfg_BeetleBankChance
static CfgInt cfg_BeetleBankChance("BBANK_CHANCE", CFG_CUSTOM, 100)
tov_OTriticale
Definition: tov_declaration.h:47
Landscape::hb_MaxUnpaintedNegNeighbour
int hb_MaxUnpaintedNegNeighbour(int a_x, int a_y)
Definition: hedgebanks.cpp:548
Landscape::RemoveMissingValues
void RemoveMissingValues()
A method for replacing missing values in the map with corrected ones - slow.
Definition: Landscape.cpp:2090
flammebehandling
Definition: treatment.h:78
cfg_WriteCurve
CfgBool cfg_WriteCurve
GooseFieldListItem::previouscrop
std::string previouscrop
Definition: landscape.h:97
tov_MaizeStrigling
Definition: tov_declaration.h:58
Landscape::VegDump
void VegDump(int x, int y)
Definition: Landscape.cpp:1644
g_letype
class LE_TypeClass * g_letype
Definition: elements.cpp:277
Landscape::GISASCII_Output
void GISASCII_Output(string outpfile, int UTMX, int UTMY)
Write ASCII file of the ALMaSS map.
Definition: Landscape.cpp:3507
Pond
Ponds are defined as freshwater bodies between 25m2 and 5000m2. For newts the effective size is limit...
Definition: elements.h:1183
Parkland
Definition: elements.h:1082
LE::GetPoly
int GetPoly(void)
Returns the polyref number for this polygon.
Definition: elements.h:189
g_nectarpollen
PollenNectarDevelopmentData * g_nectarpollen
Definition: Landscape.cpp:241
RasterMap::Get
int Get(int a_x, int a_y)
Definition: rastermap.h:81
DataForOptimisation::Get_noCrops
int Get_noCrops()
Definition: farm.h:669
UnsprayedFieldMargin
Definition: elements.h:894
FarmManager::DumpFarmrefs
void DumpFarmrefs()
dumps the farmrefs file to a standard named file
Definition: farm.cpp:2997
Landscape::CorrectCoords
void CorrectCoords(int &x, int &y)
Function to prevent wrap around errors with co-ordinates using x/y pair.
Definition: landscape.h:1535
autumn_sow
Definition: treatment.h:41
tov_OWinterWheatUndersown
Definition: tov_declaration.h:49
tole_Copse
Definition: tole_declaration.h:82
Landscape::SupplyGrazingPressure
int SupplyGrazingPressure(int a_polyref)
Definition: landscape.h:1227
tov_Undefined
Definition: tov_declaration.h:114
cfg_HedgeSubtypeMaximum
CfgInt cfg_HedgeSubtypeMaximum("HEDGE_SUBTYPEMAXIMUM", CFG_CUSTOM, 3)
tole_UnknownGrass
Definition: tole_declaration.h:91
glyphosate
Definition: treatment.h:102
Wasteland
Definition: elements.h:881
ChameleonLE
Definition: elements.h:1034
LE::SetSoilType
void SetSoilType(int a_st)
Definition: elements.h:287
harvest
Definition: treatment.h:82
Landscape::m_width
int m_width
Definition: landscape.h:138
LE::SetBorder
void SetBorder(LE *a_border)
Definition: elements.h:320
tov_FieldPeasStrigling
Definition: tov_declaration.h:56
Landscape::hb_core_pixels
int hb_core_pixels
Definition: landscape.h:275
tole_BareRock
Definition: tole_declaration.h:75
tov_WinterBarleyStrigling
Definition: tov_declaration.h:59
FarmManager::InitFarms
void InitFarms()
Calls OptimisingFarm::Init for all optimising farms.
Definition: farm.cpp:3014
tole_Saltmarsh
Definition: tole_declaration.h:88
tov_NLBeetSpring
Definition: tov_declaration.h:100
cfg_P1F
CfgFloat cfg_P1F
cfg_BeetleBankMaxArea
static CfgFloat cfg_BeetleBankMaxArea("BBANK_MAXAREA", CFG_CUSTOM, 0.05)
Coast
Definition: elements.h:1245
l_map_dump_event_y2
static CfgInt l_map_dump_event_y2("MAP_DUMP_EVENT_YB", CFG_CUSTOM, 2889)
Landscape::BackTranslateVegTypes
int BackTranslateVegTypes(TTypesOfVegetation VegReference)
Definition: landscape.h:1669
PermPastureTussocky
Definition: elements.h:754
Landscape::hb_DownPolyNumbers
void hb_DownPolyNumbers(void)
Definition: hedgebanks.cpp:715
tov_PLFodderLucerne1
Definition: tov_declaration.h:81
Freshwater
Definition: elements.h:1160
g_VegHeightForageReduction
double g_VegHeightForageReduction
tov_WinterWheat
Definition: tov_declaration.h:55
fp_slurry
Definition: treatment.h:52
Pesticide
Definition: pesticide.h:106
IndividualTree
Definition: elements.h:954
LE::GetValidX
int GetValidX(void)
Definition: elements.h:330
PEST_GRIDSIZE_POW2
#define PEST_GRIDSIZE_POW2
Definition: pesticide.h:39
tov_OCloverGrassSilage1
Definition: tov_declaration.h:43
l_map_dump_map_file
CfgStr l_map_dump_map_file("MAP_DUMP_MAP_FILE", CFG_CUSTOM, "dump.lsb")
Calendar
Definition: calendar.h:38
SandDune
Definition: elements.h:1124
tov_PermanentGrassTussocky
Definition: tov_declaration.h:49
HedgeBank
Definition: elements.h:779
tole_Railway
Definition: tole_declaration.h:39
l_map_dump_event_y1
static CfgInt l_map_dump_event_y1("MAP_DUMP_EVENT_YA", CFG_CUSTOM, 2909)
tov_PLWinterTriticale
Definition: tov_declaration.h:73
GooseFieldListItem::polyref
int polyref
Definition: landscape.h:82
tov_Heath
Definition: tov_declaration.h:66
MownGrass
Definition: elements.h:1015
l_map_map_file
static CfgStr l_map_map_file("MAP_MAP_FILE", CFG_CUSTOM, "map.lsb")
tole_RoadsideVerge
Definition: tole_declaration.h:38
Calendar::GetMonth
int GetMonth(void)
Definition: calendar.h:69
fp_rsm
Definition: treatment.h:58
tole_Pylon
Definition: tole_declaration.h:96
fa_sludge
Definition: treatment.h:68
tov_OCloverGrassGrazed2
Definition: tov_declaration.h:43
tov_PLPotatoes
Definition: tov_declaration.h:79
fa_rsm
Definition: treatment.h:69
tov_NLCabbage
Definition: tov_declaration.h:95
Saltmarsh
Definition: elements.h:849
tov_PLBeet
Definition: tov_declaration.h:80
WARN_BUG
Definition: maperrormsg.h:34
PlantNursery
Definition: elements.h:1064
DataForOptimisation::Set_sellingPrice
void Set_sellingPrice(double a_value, int i)
Definition: farm.h:647
cfg_OptimisingFarms
CfgBool cfg_OptimisingFarms
If set to true, the farmer decision making model is active.
tole_WoodlandMargin
Definition: tole_declaration.h:98
fp_greenmanure
Definition: treatment.h:56
cfg_P1D
CfgFloat cfg_P1D
Calendar::GetDayInMonth
int GetDayInMonth(void)
Definition: calendar.h:72
Calendar::DayLength
int DayLength(void)
Definition: calendar.h:63
start
Definition: treatment.h:32
tov_PermanentSetaside
Definition: tov_declaration.h:49
tole_WindTurbine
Definition: tole_declaration.h:97
l_map_dump_event_enable
static CfgBool l_map_dump_event_enable("MAP_DUMP_EVENT_ENABLE", CFG_CUSTOM, false)
tole_ActivePit
Definition: tole_declaration.h:63
l_map_cropcurves_file
static CfgStr l_map_cropcurves_file("MAP_CROPCURVES_FILE", CFG_CUSTOM, "curves.pre")
straw_removal
Definition: treatment.h:112
GooseFieldListItem::geesesp
int geesesp[gs_foobar]
Definition: landscape.h:84
insecticide
Definition: landscape.h:63
RasterMap::Put
void Put(int a_x, int a_y, int a_elem)
Definition: rastermap.h:57
PesticideMap::DumpPMapF
bool DumpPMapF()
Definition: pesticide.h:405
hay_turning
Definition: treatment.h:88
tov_Lawn
Definition: tov_declaration.h:63
l_map_dump_veg_x
static CfgInt l_map_dump_veg_x("MAP_DUMP_VEG_X", CFG_CUSTOM, 100)
tov_NLSpringBarleySpring
Definition: tov_declaration.h:104
LE::SetUnsprayedMarginPolyRef
void SetUnsprayedMarginPolyRef(int a_unsprayedmargin)
Definition: elements.h:322
bulb_harvest
Definition: treatment.h:110
Landscape::FillVegAreaData
void FillVegAreaData()
Definition: Landscape.cpp:3641
tov_PLWinterRye
Definition: tov_declaration.h:74
cfg_G6B
CfgFloat cfg_G6B
tov_OSpringBarley
Definition: tov_declaration.h:46
straw_covering
Definition: treatment.h:111
Landscape::m_polymapping
vector< int > m_polymapping
Definition: landscape.h:130
cfg_pesticidemapnoyears
CfgInt cfg_pesticidemapnoyears("PEST_MAP_NOYEARS", CFG_CUSTOM, 1)
The numer of years of pesticide mapping.
tov_Setaside
Definition: tov_declaration.h:50
cfg_pesticidetesttype
CfgInt cfg_pesticidetesttype("PESTICIDETESTYPE", CFG_CUSTOM, -1)
MetalledPath
Definition: elements.h:1280
Landscape::hb_FindHedges
void hb_FindHedges(void)
Definition: hedgebanks.cpp:276
heavy_cultivator_aggregate
Definition: treatment.h:108
Landscape::PolytypeToString
std::string PolytypeToString(TTypesOfLandscapeElement a_le_type)
Definition: Landscape.cpp:4087
Pesticide::Tick
void Tick(void)
Definition: pesticide.cpp:97
tov_OrchardCrop
Definition: tov_declaration.h:65
Saltwater
Definition: elements.h:1152
water
Definition: treatment.h:80
PesticideMap::Spray
void Spray(LE *a_element_sprayed, TTypesOfPesticideCategory a_type)
Definition: pesticide.cpp:854
tov_SpringBarleySeed
Definition: tov_declaration.h:52
Weather::GetWind
double GetWind(long a_date)
Definition: weather.h:425
Carpark
Definition: elements.h:1286
tov_SpringBarleySKManagement
Definition: tov_declaration.h:65
g_map_le_unsprayedmargins_chance
CfgInt g_map_le_unsprayedmargins_chance("MAP_LE_UMARGIN_CHANCE", CFG_CUSTOM, 25)
RiversideTrees
Definition: elements.h:908
cfg_mintownbuildingnumber
static CfgInt cfg_mintownbuildingnumber("MAP_MINTOWNBUILDINGNUMBER", CFG_CUSTOM, 6)
Landscape::m_PesticideMap
PesticideMap * m_PesticideMap
For specialised pesticide recording.
Definition: landscape.h:133
cfg_DumpFarmAreas
CfgBool cfg_DumpFarmAreas
If set to true, an output file with farm areas is produced.
fp_liquidNH3
Definition: treatment.h:51
Landscape::SupplyWeedBiomass
double SupplyWeedBiomass(int a_polyref)
Definition: landscape.h:964
tov_WWheatPToxicControl
Definition: tov_declaration.h:55
tole_MownGrass
Definition: tole_declaration.h:74
tov_NLMaize
Definition: tov_declaration.h:91
molluscicide
Definition: treatment.h:75
tov_OWinterWheat
Definition: tov_declaration.h:66
FarmManager::GetFarmPtr
Farm * GetFarmPtr(int a_owner)
Returns the pointer to a farm with a specific number.
Definition: farm.h:1766
l_map_consolidatepolys
static CfgBool l_map_consolidatepolys("MAP_CONSOLIDATEPOLYS", CFG_CUSTOM, false)
Used to consolidate polygons with no special behaviour into a single polygon of that type.
tov_SpringBarleyStriglingCulm
Definition: tov_declaration.h:62
LE::SetOpenness
void SetOpenness(int a_openness)
Records the openness statistic for this polygon.
Definition: elements.h:380
l_map_dump_veg_y
static CfgInt l_map_dump_veg_y("MAP_DUMP_VEG_Y", CFG_CUSTOM, 100)
tov_FieldPeasSilage
Definition: tov_declaration.h:65
burn_straw_stubble
Definition: treatment.h:92
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni(g_generator, g_uni_dist)
Weather::Tick
void Tick(void)
Definition: weather.cpp:58
tov_OCarrots
Definition: tov_declaration.h:43
tole_YoungForest
Definition: tole_declaration.h:55
cfg_AddBeetleBanks
static CfgBool cfg_AddBeetleBanks("BBANKS_ADD", CFG_CUSTOM, false)
Landscape::SupplyDeadBiomass
double SupplyDeadBiomass(int a_polyref)
Definition: landscape.h:1029
l_map_exit_on_zero_area
static CfgBool l_map_exit_on_zero_area("MAP_EXIT_ON_ZERO_AREA", CFG_CUSTOM, true)
tov_OWinterWheatUndersownExt
Definition: tov_declaration.h:63
tole_Stream
Definition: tole_declaration.h:89
tov_NLGrassGrazedLast
Definition: tov_declaration.h:108
RasterMap::GetMagicP
int * GetMagicP(int a_x, int a_y)
Definition: rastermap.h:74
PitDisused
Definition: elements.h:1144
l_map_calc_openness
static CfgBool l_map_calc_openness("MAP_CALC_OPENNESS", CFG_CUSTOM, false)
tole_Foobar
Definition: tole_declaration.h:111
HB_MAGIC
#define HB_MAGIC
Definition: hedgebanks.cpp:38
Calendar::Tick
void Tick(void)
Definition: calendar.cpp:141
tov_OBarleyPeaCloverGrass
Definition: tov_declaration.h:41
tole_ConiferousForest
Definition: tole_declaration.h:54
tos_Foobar
Definition: farm.h:290
tov_WinterWheatShort
Definition: tov_declaration.h:56
g_msg
class MapErrorMsg * g_msg
Definition: maperrormsg.cpp:41
Pylon
Definition: elements.h:1052
tov_SpringBarleyGrass
Definition: tov_declaration.h:52
Landscape::m_FarmManager
FarmManager * m_FarmManager
List of all the farms.
Definition: landscape.h:119
Landscape::SetPolyMaxMinExtents
void SetPolyMaxMinExtents(void)
Definition: Landscape.cpp:1622
Calendar::GetDaylightProportion
double GetDaylightProportion(void)
Definition: calendar.h:73
cfg_G6F
CfgFloat cfg_G6F
tov_NorwegianOats
Definition: tov_declaration.h:68
cfg_B6D
CfgFloat cfg_B6D
GooseFieldListItem::vegtype
TTypesOfVegetation vegtype
Definition: landscape.h:92
tole_LargeRoad
Definition: tole_declaration.h:61
Landscape::RebuildPolyMapping
void RebuildPolyMapping()
Definition: landscape.h:213
GooseFieldListItem::roostdists
int roostdists[gs_foobar]
Definition: landscape.h:87
WoodlandMargin
Definition: elements.h:967
LE_TypeClass::TranslateEleTypes
TTypesOfLandscapeElement TranslateEleTypes(int EleReference)
Definition: elements.cpp:2995
Landscape::BorderAdd
void BorderAdd(LE *a_field, TTypesOfLandscapeElement a_type)
Definition: Landscape.cpp:2347
Landscape::Tick
void Tick(void)
Definition: Landscape.cpp:1467
fp_pk
Definition: treatment.h:50
l_map_poly_file
static CfgStr l_map_poly_file("MAP_POLY_FILE", CFG_CUSTOM, "polygonrefs.txt")
cfg_BeetleBankInvert
CfgBool cfg_BeetleBankInvert("BBANK_INVERT", CFG_CUSTOM, false)
testpesticide
Definition: landscape.h:63
fa_npk
Definition: treatment.h:61
cattle_out
Definition: treatment.h:83
cfg_pesticidemapcellsize
CfgInt cfg_pesticidemapcellsize("PEST_MAP_CELLSIZE", CFG_CUSTOM, 10)
The output cell size for pesticides - a performance penalty if this does not match the pesticide cell...
cfg_B6G
CfgFloat cfg_B6G
LE::AddArea
void AddArea(double a_area_diff)
Definition: elements.h:316
Weather::GetSnowDepth
double GetSnowDepth(void)
Get the current snow depth.
Definition: weather.h:431
tov_YoungForest
Definition: tov_declaration.h:60
Landscape::UnsprayedMarginAdd
void UnsprayedMarginAdd(LE *a_field)
Definition: Landscape.cpp:2617
tov_OWinterBarleyExt
Definition: tov_declaration.h:65
Landscape::m_maxextent
int m_maxextent
Definition: landscape.h:143
tov_NorwegianSpringBarley
Definition: tov_declaration.h:68
Pesticide::GetAnythingToDecay
bool GetAnythingToDecay(PlantProtectionProducts a_ppp)
Definition: pesticide.h:228
tov_SpringBarleySilage
Definition: tov_declaration.h:52
Landscape::m_RodenticideManager
RodenticideManager * m_RodenticideManager
Definition: landscape.h:157
Landscape::GetActualGooseGrazingForage
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,...
Definition: landscape.h:596
Weather::GetTemp
double GetTemp(long a_date)
Get the temperature on a particular date.
Definition: weather.h:417
tov_NLGrassGrazed1Spring
Definition: tov_declaration.h:107
MixedForest
Definition: elements.h:974
fp_npk
Definition: treatment.h:49
DataForOptimisation::Get_cropTypes_almass
TTypesOfVegetation Get_cropTypes_almass(int i)
Definition: farm.h:663
Landscape::ReadPolys2
void ReadPolys2(const char *a_polyfile)
reads in polygon information. Version 2 including centroid and openness information
Definition: Landscape.cpp:1892
PesticideMap::DumpPMapI
bool DumpPMapI()
Definition: pesticide.h:403
cfg_G6G
CfgFloat cfg_G6G
PesticideMap::DumpPMapH
bool DumpPMapH()
Definition: pesticide.h:404
stubble_harrowing
Definition: treatment.h:90
Landscape::PolysRenumber
void PolysRenumber(void)
Definition: Landscape.cpp:2057
LE_TypeClass
Definition: elements.h:70
tov_DummyCropPestTesting
Definition: tov_declaration.h:112
tole_Marsh
Definition: tole_declaration.h:41
Landscape::UnsprayedMarginScan
void UnsprayedMarginScan(LE *a_field, int a_width)
Definition: Landscape.cpp:2638
g_cfg
class Configurator * g_cfg
Definition: configurator.cpp:49
TTypesOfVegetation
TTypesOfVegetation
Definition: tov_declaration.h:30
cfg_OsmiaNestByLE_Datafile
static CfgStr cfg_OsmiaNestByLE_Datafile("OSMIA_NESTBYLEDATAFILE", CFG_CUSTOM, "OsmiaNestsByHabitat.txt")
tole_OrchardBand
Definition: tole_declaration.h:73
tov_SpringRape
Definition: tov_declaration.h:53
stubble_plough
Definition: treatment.h:35
autumn_plough
Definition: treatment.h:34
tole_Pond
Definition: tole_declaration.h:101
AmenityGrass
Definition: elements.h:1076
BeetleBank
Definition: elements.h:787
FarmManager::ActualProfit
void ActualProfit()
Calls OptimisingFarm::ActualProfit for all optimising farms.
Definition: farm.cpp:3433
Configurator::ReadSymbols
bool ReadSymbols(const char *a_cfgfile)
Definition: configurator.cpp:201
Calendar::Date
long Date(void)
Definition: calendar.h:57
tov_PotatoesIndustry
Definition: tov_declaration.h:50
Calendar::Reset
void Reset(void)
Definition: calendar.cpp:40
fp_manure
Definition: treatment.h:55
Landscape::m_GooseIntakeRateVSVegetationHeight_GL
Polynomial2CurveClass * m_GooseIntakeRateVSVegetationHeight_GL
Definition: landscape.h:162
tov_SpringBarleyPTreatment
Definition: tov_declaration.h:63
cfg_G6A
CfgFloat cfg_G6A
strigling_sow
Definition: treatment.h:95
tov_FodderGrass
Definition: tov_declaration.h:62
Landscape::m_DoMissingPolygonsManipulations
bool m_DoMissingPolygonsManipulations
Definition: landscape.h:150
tov_PLBeetSpr
Definition: tov_declaration.h:86
tov_PlantNursery
Definition: tov_declaration.h:66
tov_NLCatchPeaCrop
Definition: tov_declaration.h:106
tov_Carrots
Definition: tov_declaration.h:31
cfg_P1A
CfgFloat cfg_P1A
Weather::GetHumidity
double GetHumidity(void)
Get the humidity score today.
Definition: weather.h:421
Configurator::DumpPublicSymbols
void DumpPublicSymbols(const char *a_dumpfile, CfgSecureLevel a_level)
Definition: configurator.cpp:590
l_map_art_hb_width
static CfgFloat l_map_art_hb_width("MAP_ART_HB_WIDTH", CFG_CUSTOM, 0.3)
tov_NLCarrotsSpring
Definition: tov_declaration.h:101
FarmManager::PrintFinalResults
void PrintFinalResults()
At the end of a simulation it prints results on crop distribution, pesticide and fertilizer usage.
Definition: farm.cpp:4741
tole_PermPasture
Definition: tole_declaration.h:47
Landscape::hb_first_free_poly_num
int hb_first_free_poly_num
Definition: landscape.h:274
WaterBufferZone
Definition: elements.h:808
l_map_dump_poly_file
CfgStr l_map_dump_poly_file("MAP_DUMP_POLY_FILE", CFG_CUSTOM, "dump_polyrefs.txt")
Landscape::m_PondIndexList
vector< int > m_PondIndexList
List of pond indexes.
Definition: landscape.h:197
Landscape::AddBeetleBanks
void AddBeetleBanks(TTypesOfLandscapeElement a_tole)
Definition: Landscape.cpp:2723
Weather::GetMeanTemp
double GetMeanTemp(long a_date, unsigned int a_period)
Definition: weather.cpp:120
Landscape::BorderScan
void BorderScan(LE *a_field, int a_width)
Definition: Landscape.cpp:2365
tov_NLPotatoesSpring
Definition: tov_declaration.h:103
FarmManager::FarmManagement
void FarmManagement()
Runs the daily farm management for each farm, but also calculates annual spilled grain and maize.
Definition: farm.cpp:2707
FishFarm
Definition: elements.h:1166
FarmManager::Save_last_years_crops_for_farms
void Save_last_years_crops_for_farms()
Calls OptimisingFarm::Save_last_years_crops for all optimising farms.
Definition: farm.cpp:3456
tov_SpringBarleyCloverGrass
Definition: tov_declaration.h:52
cfg_B6A
CfgFloat cfg_B6A
cfg_B6E
CfgBool cfg_B6E
winter_plough
Definition: treatment.h:42
tov_WinterRape
Definition: tov_declaration.h:53
tov_OGrazingPigs
Definition: tov_declaration.h:44
tov_SugarBeet
Definition: tov_declaration.h:66
Hedges
Definition: elements.h:768
Landscape::SupplyLESignal
LE_Signal SupplyLESignal(int a_polyref)
Definition: Landscape.cpp:3566
l_map_print_version_info
static CfgBool l_map_print_version_info("MAP_PRINT_VERSION_INFO", CFG_CUSTOM, true)
Landscape::SupplyVegPatchy
bool SupplyVegPatchy(int a_polyref)
Definition: landscape.h:986
BuiltUpWithParkland
Definition: elements.h:1118
DataForOptimisation::Set_sellingPrice_lastyr
void Set_sellingPrice_lastyr(double a_value, int i)
Definition: farm.h:649
l_map_art_hb_seg_len
static CfgFloat l_map_art_hb_seg_len("MAP_ART_HB_SEG_LEN", CFG_CUSTOM, 100.0)
FarmManager::AddField
void AddField(int a_OwnerIndex, LE *a_newland, int a_Owner)
Definition: farm.cpp:2741
Landscape::BeetleBankAdd
void BeetleBankAdd(int x, int y, int angle, int length, LE *a_field, TTypesOfLandscapeElement a_tole)
Definition: Landscape.cpp:2971
tov_NLBeet
Definition: tov_declaration.h:89
tov_NorwegianPotatoes
Definition: tov_declaration.h:68
GooseFieldListItem::maize
double maize
Definition: landscape.h:90
tole_PermanentSetaside
Definition: tole_declaration.h:46
tov_OSBarleySilage
Definition: tov_declaration.h:56
Landscape::hb_StripingDist
int hb_StripingDist(void)
Definition: hedgebanks.cpp:225
HB_MAGIC_PAINTER_BIT
#define HB_MAGIC_PAINTER_BIT
Definition: hedgebanks.cpp:40
Calendar::OldDays
long OldDays(void)
Definition: calendar.h:60
tole_Canal
Definition: tole_declaration.h:106
tov_SpringBarleyPeaCloverGrassStrigling
Definition: tov_declaration.h:60
tov_PermanentGrassGrazed
Definition: tov_declaration.h:49
tole_UrbanPark
Definition: tole_declaration.h:79
Landscape::LineHighTest
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...
Definition: Landscape.cpp:461
Landscape::m_treatment_counts
int m_treatment_counts[last_treatment]
Definition: landscape.h:193
cfg_MaxPondSize
static CfgInt cfg_MaxPondSize("MAP_MAXPONDSIZE", CFG_CUSTOM, 5000)
If freshwater area is below this it is designated a pond.
LE::SetPoly
void SetPoly(int a_poly)
Definition: elements.h:226
Landscape::hb_RestoreHedgeCore
void hb_RestoreHedgeCore(int a_orig_poly_number)
Definition: hedgebanks.cpp:311
Landscape::m_PesticideType
TTypesOfPesticide m_PesticideType
An attribute to hold the pesticide type being tested, if there is one, if not default is -1.
Definition: landscape.h:278
Landscape::m_toxShouldSpray
bool m_toxShouldSpray
Definition: landscape.h:317
Landscape::hb_HasNeighbourColor
bool hb_HasNeighbourColor(int a_x, int a_y, int a_neighbour_color)
Definition: hedgebanks.cpp:452
tov_CloverGrassGrazed2
Definition: tov_declaration.h:33
DataForOptimisation::Get_emaize_price
double Get_emaize_price(int i)
Definition: farm.h:672
FarmManager::GetNoFarms
int GetNoFarms()
Definition: farm.h:1900
Canal
Definition: elements.h:1227
tole_Track
Definition: tole_declaration.h:59
tov_WWheatPControl
Definition: tov_declaration.h:55
Landscape::CountMapSquares
void CountMapSquares(void)
Definition: Landscape.cpp:2040
PollenNectarDevelopmentData
A standard class to manage a range of pollen and nectar development curves based on indexed rates.
Definition: plants.h:224
tov_PLWinterRape
Definition: tov_declaration.h:71
cfg_productapplicendyear
CfgInt cfg_productapplicendyear("PEST_PROCTAPPLICENDYEAR", CFG_CUSTOM,-1)
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
RoadsideVerge
Definition: elements.h:795
Landscape::hb_PaintWhoHasNeighbourColor
bool hb_PaintWhoHasNeighbourColor(int a_neighbour_color, int a_new_color)
Definition: hedgebanks.cpp:526
RasterMap::MissingCellReplace
bool MissingCellReplace(int a_x, int a_y, bool a_fieldsonly)
A method for removing missing polygons.
Definition: rastermap.cpp:273
Stream
Definition: elements.h:1298
tov_PLBeans
Definition: tov_declaration.h:87
tov_SpringBarleyCloverGrassStrigling
Definition: tov_declaration.h:58
Landscape::hb_height
int hb_height
Definition: landscape.h:270
fp_sludge
Definition: treatment.h:57
Landscape::m_y_add
int m_y_add[8]
Definition: landscape.h:267
straw_chopping
Definition: treatment.h:87
Landscape::m_width10
int m_width10
Definition: landscape.h:140
tov_Potatoes
Definition: tov_declaration.h:50
fungicide_treat
Definition: treatment.h:73
deep_ploughing
Definition: treatment.h:43
tov_WinterRyeStrigling
Definition: tov_declaration.h:59
preseeding_cultivator_sow
Definition: treatment.h:40
Weather::GetWindPeriod
double GetWindPeriod(long a_date, unsigned int a_period)
Definition: weather.cpp:262
tov_PLWinterBarley
Definition: tov_declaration.h:72
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: landscape.h:1596
Landscape::hb_UpPolyNumbers
void hb_UpPolyNumbers(void)
Definition: hedgebanks.cpp:289
cfg_G6C
CfgFloat cfg_G6C
Landscape::hb_MarkTheBresenhamWay
void hb_MarkTheBresenhamWay(void)
Definition: hedgebanks.cpp:629
Landscape::SupplyVegBiomass
double SupplyVegBiomass(int a_polyref)
Definition: landscape.h:953
cfg_rodenticide_enable
CfgBool cfg_rodenticide_enable("RODENTICIDE_ENABLE", CFG_CUSTOM, false)
Landscape::DumpTreatCounters
void DumpTreatCounters(const char *a_filename)
Definition: Landscape.cpp:3586
PEST_GRIDSIZE
#define PEST_GRIDSIZE
Definition: pesticide.h:40
FarmManager::Switch_rotation
void Switch_rotation()
Switches OptimisingFarms Farm::m_rotation to the list of all possible rotational crops.
Definition: farm.cpp:4942
tov_WinterWheatStriglingCulm
Definition: tov_declaration.h:62
mow
Definition: treatment.h:93
fa_pk
Definition: treatment.h:62
WARN_MSG
Definition: maperrormsg.h:38
Landscape::hb_max_y
int hb_max_y
Definition: landscape.h:273
tov_NLTulips
Definition: tov_declaration.h:96
tov_WinterRapeStrigling
Definition: tov_declaration.h:59
SmallRoad
Definition: elements.h:1266
Landscape::SupplyBirdSeedForage
double SupplyBirdSeedForage(int a_polyref)
Returns the grain forage resource.
Definition: landscape.h:614
l_map_no_pesticide_fields
static CfgInt l_map_no_pesticide_fields("MAP_NO_PESTICIDE_FIELDS", CFG_CUSTOM, 0)
ActivePit
Definition: elements.h:1251
Landscape::FindLongestAxis
int FindLongestAxis(int *x, int *y, int *a_length)
Definition: Landscape.cpp:2851
spring_harrow
Definition: treatment.h:45
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Definition: landscape.h:1616
RoadsideSlope
Definition: elements.h:818
tole_NaturalGrassWet
Definition: tole_declaration.h:87
PermPasture
Definition: elements.h:740
Landscape::hb_GenerateHBPolys
void hb_GenerateHBPolys(void)
Definition: hedgebanks.cpp:180
Field
Definition: elements.h:727
tov_OMaizeSilage
Definition: tov_declaration.h:65
Landscape::SupplyVegCover
double SupplyVegCover(int a_polyref)
Definition: landscape.h:1048
tole_Orchard
Definition: tole_declaration.h:71
l_map_write_ascii
static CfgBool l_map_write_ascii("MAP_WRITE_ASCII", CFG_CUSTOM, false)
Used if an ASCII file for use in GIS applications should be written.
tole_MetalledPath
Definition: tole_declaration.h:84
tov_Maize
Definition: tov_declaration.h:36
Landscape::hb_hedges
vector< int > hb_hedges
Definition: landscape.h:263
LE_Signal
unsigned int LE_Signal
Definition: elements.h:35
l_pest_enable_pesticide_engine
CfgBool l_pest_enable_pesticide_engine
Used to turn on or off the PPP functionality of ALMaSS.
g_SpeedyDivides
double g_SpeedyDivides[2001]
A generally useful array of fast divide calculators by multiplication.
Definition: Landscape.cpp:250
Landscape::ChangeMapMapping
void ChangeMapMapping(void)
Definition: Landscape.cpp:2130
tov_OWinterRape
Definition: tov_declaration.h:47
tov_WWheatPTreatment
Definition: tov_declaration.h:55
l_map_ascii_utm_x
static CfgInt l_map_ascii_utm_x("MAP_ASCII_UTM_X", CFG_CUSTOM, 0)
If we write an ASCII file provide UTM-x of lower lefthand corner.
tole_SandDune
Definition: tole_declaration.h:81
Churchyard
Definition: elements.h:1292
CfgFloat::value
double value(void)
Definition: configurator.h:118
g_crops
class PlantGrowthData * g_crops
Definition: plants.cpp:41
tole_WoodyEnergyCrop
Definition: tole_declaration.h:94
UrbanPark
Definition: elements.h:1100
cfg_P1B
CfgFloat cfg_P1B
Landscape::hb_ClearPolygon
void hb_ClearPolygon(int a_poly_num)
Definition: hedgebanks.cpp:413
LE::SetValidXY
void SetValidXY(int a_valid_x, int a_valid_y)
Definition: elements.h:325
tov_FieldPeas
Definition: tov_declaration.h:34
tov_SpringBarleyStriglingSingle
Definition: tov_declaration.h:60
tov_BroadBeans
Definition: tov_declaration.h:66
Weather::GetSnow
bool GetSnow(long a_date)
Definition: weather.cpp:132
cfg_mintownbuildingdistance
static CfgInt cfg_mintownbuildingdistance("MAP_MINTOWNBUILDINGDISTANCE", CFG_CUSTOM, 100)
PermanentSetaside
Definition: elements.h:761
Landscape::m_land
RasterMap * m_land
The big map.
Definition: landscape.h:125
Landscape::FindFieldCenter
bool FindFieldCenter(LE *a_field, int *x, int *y)
Definition: Landscape.cpp:2799
LE::SetMapValid
void SetMapValid(bool a_valid)
Definition: elements.h:227
PlantGrowthData
Definition: plants.h:81
LE_TypeClass::TranslateVegTypes
TTypesOfVegetation TranslateVegTypes(int VegReference)
Definition: elements.cpp:3088
tov_Wasteland
Definition: tov_declaration.h:66
hilling_up
Definition: treatment.h:79
LargeRoad
Definition: elements.h:1257
tov_NLGrassGrazed1
Definition: tov_declaration.h:97
Landscape::EventtypeToString
std::string EventtypeToString(int a_event)
Definition: Landscape.cpp:3918
GooseFieldListItem
A list item entry of field polygon reference numbers with associated openness and goose food scores.
Definition: landscape.h:80
tole_River
Definition: tole_declaration.h:65
Landscape::m_NeedCentroidCalculation
bool m_NeedCentroidCalculation
a flag to ensure centroid calculation on object construction
Definition: landscape.h:146
tov_OSeedGrass1
Definition: tov_declaration.h:46
FarmManager::ConnectFarm
int ConnectFarm(int a_owner)
Definition: farm.cpp:2752
biocide
Definition: treatment.h:104
Landscape::hb_min_x
int hb_min_x
Definition: landscape.h:272
Landscape::ForceArea
void ForceArea(void)
Definition: Landscape.cpp:2072
Population_Manager::FarmAnimalCensus
unsigned int FarmAnimalCensus(unsigned int a_farm, unsigned int a_typeofanimal)
Definition: PopulationManager.cpp:1261
tov_OFodderBeet
Definition: tov_declaration.h:65
cfg_P1E
CfgBool cfg_P1E
tov_NLWinterWheat
Definition: tov_declaration.h:94
l_map_art_hb_core_thres
static CfgFloat l_map_art_hb_core_thres("MAP_ART_HB_STRIPE_THRES", CFG_CUSTOM, 0.4)
tole_Scrub
Definition: tole_declaration.h:42
LE::SetPollenNectarData
void SetPollenNectarData(int a_almasstype)
sets the pollen and nectar information
Definition: elements.cpp:605
BareRock
Definition: elements.h:1130
WindTurbine
Definition: elements.h:1058
fa_calcium
Definition: treatment.h:70
tov_PLMaize
Definition: tov_declaration.h:77
tov_OCloverGrassGrazed1
Definition: tov_declaration.h:43
Landscape::CreatePondList
void CreatePondList()
Creates a list of pond polygon refs/indexes for easy look up.
Definition: Landscape.cpp:2594
syninsecticide_treat
Definition: treatment.h:99
fa_manure
Definition: treatment.h:66
cfg_BeetleBankWidth
static CfgInt cfg_BeetleBankWidth("BBANK_WIDTH", CFG_CUSTOM, 4)
tole_PermPastureTussocky
Definition: tole_declaration.h:45
tov_OSpringBarleyPigs
Definition: tov_declaration.h:47
cfg_pesticidemaptype
CfgBool cfg_pesticidemaptype("PEST_MAP_TYPE", CFG_CUSTOM, false)
True for specific pesticide, false for general pesticides.
fp_npks
Definition: treatment.h:48
row_cultivation
Definition: treatment.h:76
Landscape::SupplyInsects
double SupplyInsects(int a_polyref)
Definition: landscape.h:1088
RiversidePlants
Definition: elements.h:861
Landscape::m_GooseIntakeRateVSVegetationHeight_BG
Polynomial2CurveClass * m_GooseIntakeRateVSVegetationHeight_BG
Definition: landscape.h:161
tov_SpringBarleySpr
Definition: tov_declaration.h:66
River
Definition: elements.h:1221
l_map_ascii_utm_y
static CfgInt l_map_ascii_utm_y("MAP_ASCII_UTM_Y", CFG_CUSTOM, 0)
If we write an ASCII file provide UTM-y of lower lefthand corner.
Landscape::BorderRemoval
void BorderRemoval(void)
Definition: Landscape.cpp:2271
Landscape::hb_size
int hb_size
Definition: landscape.h:271
g_map_le_borderstype
CfgInt g_map_le_borderstype("MAP_LE_BORDERSTYPE", CFG_CUSTOM, 160)
DataForOptimisation::Get_cropTypes_almass_size
int Get_cropTypes_almass_size()
Definition: farm.h:664
trial_insecticidetreat
Definition: treatment.h:96
Landscape::BeetleBankPossible
bool BeetleBankPossible(LE *a_field, TTypesOfLandscapeElement a_tole)
Definition: Landscape.cpp:2772
LE
Definition: elements.h:81
tov_PLSpringBarley
Definition: tov_declaration.h:76
Landscape::CalculateOpenness
void CalculateOpenness(bool a_realcalc)
Causes openness to be calulated and stored for all polygons.
Definition: Landscape.cpp:322
l_map_removesmallpolygons
static CfgBool l_map_removesmallpolygons("MAP_REMOVESMALLPOLYGONS", CFG_CUSTOM, false)
Vildtager
Definition: elements.h:914
tov_PermanentGrassLowYield
Definition: tov_declaration.h:63
Track
Definition: elements.h:1274
Landscape::SupplyVegHeight
double SupplyVegHeight(int a_polyref)
Definition: landscape.h:936
tov_WinterWheatStrigling
Definition: tov_declaration.h:59
tole_Field
Definition: tole_declaration.h:43
FarmManager::GetDD
double GetDD(void)
Returnes day degrees for the period March 1st - November 1st. Used for determining yields of crops th...
Definition: farm.h:1835
tole_PermPastureTussockyWet
Definition: tole_declaration.h:100
tov_WinterWheatStriglingSingle
Definition: tov_declaration.h:62
tole_FieldBoundary
Definition: tole_declaration.h:40
g_map_le_border_chance
CfgInt g_map_le_border_chance("MAP_LE_BORDER_CHANCE", CFG_CUSTOM, 25)
tole_PermPastureLowYield
Definition: tole_declaration.h:44
last_treatment
Definition: treatment.h:113
Landscape::le_signal_index
int le_signal_index
Definition: landscape.h:319
GooseFieldListItem::geese
int geese
Definition: landscape.h:83
Garden
Definition: elements.h:1040
Landscape::SupplyLEHigh
bool SupplyLEHigh(int a_x, int a_y)
Tests whether the polygon at a_x,a_y is designated as high.
Definition: landscape.h:455
tole_WaterBufferZone
Definition: tole_declaration.h:108
cfg_BeetleBankMinX
CfgInt cfg_BeetleBankMinX("BBANK_MINX", CFG_CUSTOM, 0)
Weather::GetTempPeriod
double GetTempPeriod(long a_date, unsigned int a_period)
Definition: weather.cpp:272
GooseFieldListItem::vegtypechr
std::string vegtypechr
Definition: landscape.h:93
WARN_FILE
Definition: maperrormsg.h:37
GooseFieldListItem::geesespTimed
int geesespTimed[gs_foobar]
Definition: landscape.h:86
Landscape::CalulateFieldOpennessAllCells
int CalulateFieldOpennessAllCells(int a_pref)
Provides a measure of the shortest distance in 360 degree, e-g- looking NE % SW before tall obstacles...
Definition: Landscape.cpp:401
fp_ammoniumsulphate
Definition: treatment.h:54
Landscape::hb_ResetColorBits
void hb_ResetColorBits(void)
Definition: hedgebanks.cpp:298
stubble_cultivator_heavy
Definition: treatment.h:36
tole_RiversideTrees
Definition: tole_declaration.h:51
Weather::GetGlobalRadiation
double GetGlobalRadiation(long a_date)
Definition: weather.h:414
l_map_dump_enable
static CfgBool l_map_dump_enable("MAP_DUMP_ENABLE", CFG_CUSTOM, false)
OrchardBand
Definition: elements.h:1004
tov_PLCarrots
Definition: tov_declaration.h:83
UrbanNoVeg
Definition: elements.h:1088
tov_WinterBarley
Definition: tov_declaration.h:53
FarmManager::InitiateManagement
void InitiateManagement(void)
Definition: farm.cpp:2733
spring_plough
Definition: treatment.h:44
fa_greenmanure
Definition: treatment.h:67
VegElement::SetVegPatchy
virtual void SetVegPatchy(bool p)
Definition: elements.h:585
version_revision
static const int version_revision
Definition: Landscape.cpp:51
tov_NaturalGrass
Definition: tov_declaration.h:37
cfg_dumpvegjanfile
CfgStr cfg_dumpvegjanfile("G_VEGAREASJAN_FILENAME", CFG_CUSTOM, "DUMPVEG_JAN.TXT")
l_map_ascii_map_entity
static CfgInt l_map_ascii_map_entity("MAP_ASCII_MAP_ENTITY", CFG_CUSTOM, 1)
If we write an ASCII file what should be the mapped entity? 1 = polyref, 2 = elementype.
TTypesOfLandscapeElement
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
LE::DoCopy
void DoCopy(const LE *a_Le)
a copy function to be used because a copy constuctor won't work
Definition: elements.cpp:372
tole_IndividualTree
Definition: tole_declaration.h:93
Marsh
Definition: elements.h:843
g_map_le_unsprayedmargins
CfgBool g_map_le_unsprayedmargins("MAP_LE_UNSPRAYEDMARGINS", CFG_CUSTOM, false)
l_map_dump_gfx_file
static CfgStr l_map_dump_gfx_file("MAP_DUMP_GFX_FILE", CFG_CUSTOM, "dump.ppm")
FarmManager::DumpFarmAreas
void DumpFarmAreas()
Definition: farm.cpp:1964
tov_SeedGrass2
Definition: tov_declaration.h:50
Landscape::BorderTest
bool BorderTest(int a_fieldpoly, int a_borderpoly, int a_x, int a_y)
Definition: Landscape.cpp:2452
tov_WaterBufferZone
Definition: tov_declaration.h:110
fp_calcium
Definition: treatment.h:59
Landscape::m_GooseIntakeRateVSVegetationHeight_PF
Polynomial2CurveClass * m_GooseIntakeRateVSVegetationHeight_PF
Curve relatning goose intake rates in KJ/min to vegetation height.
Definition: landscape.h:160
RasterMap::MissingCellReplaceWrap
bool MissingCellReplaceWrap(int a_x, int a_y, bool a_fieldsonly)
A method for removing missing polygons - tests for edge conditions.
Definition: rastermap.cpp:302
Landscape::hb_border_pixels
int hb_border_pixels
Definition: landscape.h:276
Scrub
Definition: elements.h:833
tole_PitDisused
Definition: tole_declaration.h:50
tov_MaizeSilage
Definition: tov_declaration.h:62
RasterMap::CellReplacementNeighbour
int CellReplacementNeighbour(int a_x, int a_y, int a_polyref)
A method for helping remove tiny polygons.
Definition: rastermap.cpp:225
trial_toxiccontrol
Definition: treatment.h:97
spring_roll
Definition: treatment.h:46
tov_NoGrowth
Definition: tov_declaration.h:38
tole_Wasteland
Definition: tole_declaration.h:92
DeciduousForest
Definition: elements.h:940
fa_manganesesulphate
Definition: treatment.h:64
tov_OPotatoes
Definition: tov_declaration.h:44
tole_HeritageSite
Definition: tole_declaration.h:90
Heath
Definition: elements.h:855
GooseFieldListItem::digestability
double digestability
Definition: landscape.h:95
bed_forming
Definition: treatment.h:106
cut_weeds
Definition: treatment.h:94
Landscape::NewElement
LE * NewElement(TTypesOfLandscapeElement a_type)
Definition: Landscape.cpp:3688
CfgInt::value
int value(void)
Definition: configurator.h:98
tole_PlantNursery
Definition: tole_declaration.h:95
GooseFieldListItem::openness
double openness
Definition: landscape.h:88
Landscape::PolysRemoveInvalid
bool PolysRemoveInvalid(void)
Definition: Landscape.cpp:1772
StoneWall
Definition: elements.h:1136
cfg_productapplicstartyear
CfgInt cfg_productapplicstartyear("PEST_PROCTAPPLICSTARTYEAR", CFG_CUSTOM, 9999999)
Landscape::m_LargestPolyNumUsed
int m_LargestPolyNumUsed
Definition: landscape.h:194
Landscape::SupplyLEReset
void SupplyLEReset(void)
Definition: Landscape.cpp:3551
Landscape::AxisLoop
void AxisLoop(int a_poly, int *a_x, int *a_y, int a_axis)
Definition: Landscape.cpp:2938
FarmManager::Save_diff_farm_types_areas
void Save_diff_farm_types_areas()
Calculates and saves total areas of all optimising farms and specific farm types.
Definition: farm.cpp:3404
FarmManager::GetIsRenumbered
bool GetIsRenumbered()
Returns the flag for renumbering.
Definition: farm.h:1886
fp_manganesesulphate
Definition: treatment.h:53
tole_DrainageDitch
Definition: tole_declaration.h:105
WoodyEnergyCrop
Definition: elements.h:986
tov_OSeedGrass2
Definition: tov_declaration.h:46
cfg_P1C
CfgFloat cfg_P1C
PesticideMap
Definition: pesticide.h:369
herbicide_treat
Definition: treatment.h:71
Landscape::DumpMapGraphics
void DumpMapGraphics(const char *a_filename)
Definition: Landscape.cpp:3599
Landscape::CentroidSpiralOut
void CentroidSpiralOut(int a_polyref, int &a_x, int &a_y)
Definition: Landscape.cpp:3073
LE::GetUnsprayedMarginPolyRef
int GetUnsprayedMarginPolyRef(void)
Definition: elements.h:319
janfirst
Definition: plants.h:52
NaturalGrassDry
Definition: elements.h:867
FarmManager::pm_data
DataForOptimisation * pm_data
Pointer to the DataForOptimisation.
Definition: farm.h:1876
Landscape::UpdateOsmiaNesting
void UpdateOsmiaNesting()
Tesll all LE objects to update their osmia nest status.
Definition: landscape.h:856
FieldBoundary
Definition: elements.h:888
YoungForest
Definition: elements.h:980
OptimisingFarm
A farm that carries out crop, pesticide and fertilizer planning using simplified optimisation or othe...
Definition: farm.h:2028
g_map_orchards_borders
CfgBool g_map_orchards_borders("MAP_ORCHARDS_BORDERS", CFG_CUSTOM, false)
tov_NLGrassGrazed2
Definition: tov_declaration.h:98
LE::SetArea
void SetArea(double a_area)
Definition: elements.h:229
tov_OFieldPeasSilage
Definition: tov_declaration.h:56
RasterMap
Definition: rastermap.h:40
growth_regulator
Definition: treatment.h:72
Calendar::DayInYear
int DayInYear(void)
Definition: calendar.h:58
cut_to_silage
Definition: treatment.h:86
product_treat
Definition: treatment.h:101
tov_SpringWheat
Definition: tov_declaration.h:53
cfg_G6E
CfgBool cfg_G6E
tov_SpringBarley
Definition: tov_declaration.h:52
Landscape::BuildingDesignationCalc
void BuildingDesignationCalc()
used to calculate whether a building is rural or town - for rodenticide use
Definition: Landscape.cpp:3287
FarmManager::SetSpilledGrain
void SetSpilledGrain(bool a_spilledgrain)
Set m_SpilledGrain which is the flag for either 2013 (true) or 2014 (false) spilled grain distributio...
Definition: farm.h:1828
LE_TypeClass::BackTranslateVegTypes
int BackTranslateVegTypes(TTypesOfVegetation VegReference)
Definition: elements.cpp:3345
FarmToDo
FarmToDo
Definition: treatment.h:31
tov_OWinterRye
Definition: tov_declaration.h:49
tole_Carpark
Definition: tole_declaration.h:85
Landscape::m_minmaxextent
int m_minmaxextent
Definition: landscape.h:142
tov_NLCarrots
Definition: tov_declaration.h:90
g_date
class Calendar * g_date
Definition: calendar.cpp:38
g_FarmIntensivenessH
double g_FarmIntensivenessH
PermPastureLowYield
Definition: elements.h:747
Calendar::MarchFirst
bool MarchFirst(void)
Definition: calendar.h:75
tov_OFirstYearDanger
Definition: tov_declaration.h:44
tole_DeciduousForest
Definition: tole_declaration.h:52
Landscape::hb_map
int * hb_map
Definition: landscape.h:268
GooseFieldList
std::vector< GooseFieldListItem > GooseFieldList
A list of GooseFieldListItem s.
Definition: landscape.h:103
tov_CloverGrassGrazed1
Definition: tov_declaration.h:32
tole_Hedges
Definition: tole_declaration.h:37
LE::GetBorder
LE * GetBorder(void)
Definition: elements.h:317
version_date
static const char * version_date
Definition: Landscape.cpp:52
Landscape::m_x_add
int m_x_add[8]
Definition: landscape.h:266
pigs_out
Definition: treatment.h:84
Landscape::hb_Add
void hb_Add(void)
Definition: hedgebanks.cpp:56
tov_OFieldPeas
Definition: tov_declaration.h:43
Landscape::m_ThePopManager
Population_Manager * m_ThePopManager
a pointer to the current main population manager
Definition: landscape.h:155
tov_FodderBeet
Definition: tov_declaration.h:35
cfg_dumpvegjune
CfgBool cfg_dumpvegjune("G_VEGAREASJUNE_ON", CFG_CUSTOM, false)
Weather::GetRain
double GetRain(long a_date)
Definition: weather.h:423
Landscape::SupplyLastTreatment
int SupplyLastTreatment(int a_polyref, int *a_index)
Definition: landscape.h:1331
trial_control
Definition: treatment.h:98
tov_WinterRye
Definition: tov_declaration.h:55
tov_PLFodderLucerne2
Definition: tov_declaration.h:82
l_map_print_git_version_info
CfgBool l_map_print_git_version_info("MAP_PRINT_GIT_VERSION_INFO", CFG_CUSTOM, false)
Should git version info be printed to file and console?
Landscape::hb_min_y
int hb_min_y
Definition: landscape.h:273
l_map_art_hb_nums
static CfgInt l_map_art_hb_nums("MAP_ART_HB_NUMS", CFG_CUSTOM, 3)
Landscape::SupplyPolyRefIndex
int SupplyPolyRefIndex(int a_x, int a_y)
Definition: landscape.h:1493
tov_Triticale
Definition: tov_declaration.h:53
FarmManager::Get_cropTotals_size
int Get_cropTotals_size()
Definition: farm.h:1840
Weather::GetWindDirection
int GetWindDirection(void)
Definition: weather.h:427
Landscape::PolysValidate
void PolysValidate(bool a_exit_on_invalid)
Definition: Landscape.cpp:1746
l_map_dump_treatcounts_enable
static CfgBool l_map_dump_treatcounts_enable("MAP_DUMP_TREATCOUNTS_ENABLE", CFG_CUSTOM, false)
tov_PLWinterWheat
Definition: tov_declaration.h:70
Landscape::SupplyLENext
int SupplyLENext(void)
Definition: Landscape.cpp:3555
tole_Vildtager
Definition: tole_declaration.h:99
version_minor
static const int version_minor
Definition: Landscape.cpp:50
GooseFieldListItem::grain
double grain
Definition: landscape.h:89
cut_to_hay
Definition: treatment.h:85
toof_Foobar
Definition: farm.h:283
RasterMap::MapWidth
int MapWidth(void)
Definition: rastermap.h:52
Landscape::FindValidXY
bool FindValidXY(int a_field, int &a_x, int &a_y)
Definition: Landscape.cpp:2688
spring_sow
Definition: treatment.h:47
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
Calendar::JanFirst
bool JanFirst(void)
Definition: calendar.h:74
l_map_chameleon_replace_num
static CfgInt l_map_chameleon_replace_num("MAP_CHAMELEON_REPLACE_NUM", CFG_CUSTOM, 58)
sleep_all_day
Definition: treatment.h:33
tole_Chameleon
Definition: tole_declaration.h:110
Weather
Definition: weather.h:385
FarmManager
The Farm Manager class.
Definition: farm.h:1706
CfgBool::value
bool value(void)
Definition: configurator.h:135
cfg_G6D
CfgFloat cfg_G6D
tov_NLPermanentGrassGrazed
Definition: tov_declaration.h:99
Fence
Definition: elements.h:1171
Landscape::m_elems
vector< LE * > m_elems
List of all landscape elements. The index is a sequential number, to get the polynum look this number...
Definition: landscape.h:122
tole_AmenityGrass
Definition: tole_declaration.h:76
GooseFieldListItem::vegphase
int vegphase
Definition: landscape.h:96
cfg_B6C
CfgFloat cfg_B6C
TTypesOfPesticide
TTypesOfPesticide
Definition: landscape.h:65
cfg_BeetleBankMaxX
CfgInt cfg_BeetleBankMaxX("BBANK_MAXX", CFG_CUSTOM, 100000)
tole_NaturalGrassDry
Definition: tole_declaration.h:48
Landscape::m_height10
int m_height10
Definition: landscape.h:141
autumn_or_spring_plough
Definition: treatment.h:91
cfg_HedgeSubtypeMinimum
CfgInt cfg_HedgeSubtypeMinimum("HEDGE_SUBTYPEMINIMUM", CFG_CUSTOM, 0)
tole_BeetleBank
Definition: tole_declaration.h:69
Landscape::m_NeedOpennessCalculation
bool m_NeedOpennessCalculation
a flag to ensure openness calculation on object construction
Definition: landscape.h:148
Landscape::SupplyPolyRef
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1488
tov_SeedGrass1
Definition: tov_declaration.h:50
cfg_dumpvegjunefile
CfgStr cfg_dumpvegjunefile("G_VEGAREASJUNE_FILENAME", CFG_CUSTOM, "DUMPVEG_JUNE.TXT")
Landscape::EventDump
void EventDump(int x, int y, int x2, int y2)
Definition: Landscape.cpp:1697
LE::GetValidY
int GetValidY(void)
Definition: elements.h:331
strigling_hill
Definition: treatment.h:105
tov_OSpringBarleyGrass
Definition: tov_declaration.h:46
g_weather
class Weather * g_weather
Definition: weather.cpp:41
LE::SetMapIndex
void SetMapIndex(int a_map_index)
Definition: elements.h:191
cfg_OptimiseBedriftsmodelCrops
CfgBool cfg_OptimiseBedriftsmodelCrops
If set to true, the original farm optimisation model's crop set is used in the farmer decision making...
Configurator::DumpAllSymbolsAndExit
void DumpAllSymbolsAndExit(const char *a_dumpfile)
Definition: configurator.cpp:601
FarmManager::Set_cropTotals
void Set_cropTotals(int i, double value)
Definition: farm.h:1839
tole_Coast
Definition: tole_declaration.h:67
cfg_P1G
CfgFloat cfg_P1G
tole_BuiltUpWithParkland
Definition: tole_declaration.h:80
Landscape::l_vegtype_areas
double * l_vegtype_areas
Definition: landscape.h:153
cfg_BeetleBankMaxY
CfgInt cfg_BeetleBankMaxY("BBANK_MAXY", CFG_CUSTOM, 100000)
fa_slurry
Definition: treatment.h:63
Landscape::SupplyGlobalDate
long SupplyGlobalDate(void)
Definition: landscape.h:1621
swathing
Definition: treatment.h:81
tole_SmallRoad
Definition: tole_declaration.h:60
UrbanVeg
Definition: elements.h:1094
Building
Definition: elements.h:1046
l_map_dump_gfx_enable
static CfgBool l_map_dump_gfx_enable("MAP_DUMP_GFX_ENABLE", CFG_CUSTOM, false)
g_map_le_borderremoval
CfgBool g_map_le_borderremoval("MAP_LE_BORDERREMOVAL", CFG_CUSTOM, false)
Landscape::hb_HasOtherNeighbour
bool hb_HasOtherNeighbour(int a_x, int a_y)
Definition: hedgebanks.cpp:339
tov_None
Definition: tov_declaration.h:39
Landscape::SetLESignal
void SetLESignal(int a_polyref, LE_Signal a_signal)
Definition: Landscape.cpp:3570
tole_Fence
Definition: tole_declaration.h:57
Weather::GetRainPeriod
double GetRainPeriod(long a_date, unsigned int a_period)
Definition: weather.cpp:253
l_map_weather_file
static CfgStr l_map_weather_file("MAP_WEATHER_FILE", CFG_CUSTOM, "weather.pre")
l_map_art_hedgebanks
static CfgBool l_map_art_hedgebanks("MAP_ART_HEDGEBANKS", CFG_CUSTOM, false)
tov_OSpringBarleyExt
Definition: tov_declaration.h:63
marchfirst
Definition: plants.h:54
l_map_umargin_width
static CfgInt l_map_umargin_width("MAP_UMARGINWIDTH", CFG_CUSTOM, 12)
Landscape::ConsolidatePolys
void ConsolidatePolys(void)
Definition: Landscape.cpp:1329
tole_Heath
Definition: tole_declaration.h:70
tov_NLCabbageSpring
Definition: tov_declaration.h:105
Calendar::GetMinute
int GetMinute(void)
Definition: calendar.h:70