Open Simulator Terrain Editor BRIGADOON-0007
Edit Terrain Files for Open Simulator Regions
Loading...
Searching...
No Matches
AreaCalculator Class Reference

#include <areacalculator.h>

Inheritance diagram for AreaCalculator:
[legend]
Collaboration diagram for AreaCalculator:
[legend]

Public Slots

void LowerXChanged (int NewValue)
void LowerYChanged (int NewValue)
void UpperXChanged (int NewValue)
void UpperYChanged (int NewValue)
void WorldXChanged (int NewValue)
void WorldYChanged (int NewValue)
void Regionx1Pressed (void)
void Regionx4Pressed (void)
void Regionx16Pressed (void)
void AutoCalcChanged (Qt::CheckState)
void IncludeNewRegion (REMOTE_REGION_ADDRESS Location)

Signals

void SendWorldArea (REMOTE_WORLD_SIZE WorldArea)
void SendWorldSides (REMOTE_WORLD_SIDES world_sides)
void SendLogEntry (REMOTE_LOG_ENTRY LogEntry)
 Send Log Entry via the Signal-Slot Method.

Public Member Functions

 AreaCalculator (QObject *parent=nullptr)

Private Member Functions

void FindWorldLimits (void)
void CalculateWorldArea (void)
void LogAdd (LOGGING_SEVERITY Severity, LOGGING_MODE Mode, QString Message)

Private Attributes

int lower_x
int lower_y
int upper_x
int upper_y
int world_x_size
int world_y_size
int region_size
int region_multiplier
int side_additive
bool auto_calc_size

Detailed Description

Definition at line 25 of file areacalculator.h.

Constructor & Destructor Documentation

◆ AreaCalculator()

AreaCalculator::AreaCalculator ( QObject * parent = nullptr)
explicit

Member Function Documentation

◆ AutoCalcChanged

void AreaCalculator::AutoCalcChanged ( Qt::CheckState State)
slot

Definition at line 3 of file areacalculator.cpp.

4{
5 auto_calc_size = (bool)State;
7 {
10 }
11}
void CalculateWorldArea(void)
void FindWorldLimits(void)

References auto_calc_size, CalculateWorldArea(), and FindWorldLimits().

Here is the call graph for this function:

◆ CalculateWorldArea()

void AreaCalculator::CalculateWorldArea ( void )
private

Definition at line 60 of file areacalculator.cpp.

61{
62 int world_block = world_x_size * world_y_size;
63 int region_count = world_block;
64 float world_area = (float)world_block * region_size;
65 REMOTE_WORLD_SIZE remote_world_size;
66
67 remote_world_size.WorldArea = world_area;
68 remote_world_size.WorldRegionCount = region_count;
69
70 emit SendWorldArea(remote_world_size);
71}
void SendWorldArea(REMOTE_WORLD_SIZE WorldArea)

References region_size, SendWorldArea(), world_x_size, world_y_size, REMOTE_WORLD_SIZE::WorldArea, and REMOTE_WORLD_SIZE::WorldRegionCount.

Referenced by AutoCalcChanged(), Regionx16Pressed(), Regionx1Pressed(), Regionx4Pressed(), WorldXChanged(), and WorldYChanged().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindWorldLimits()

void AreaCalculator::FindWorldLimits ( void )
private

Definition at line 97 of file areacalculator.cpp.

98{
99 REMOTE_WORLD_SIDES world_sides;
100
101 // Check that None of the Limits are currently 0
102 if ((lower_x != 0) && (upper_x != 0) && (lower_y != 0) && (upper_y != 0))
103 {
104 world_sides.WorldXSize = upper_x - lower_x + side_additive + 1;
105 world_sides.WorldYSize = upper_y - lower_y + side_additive + 1;
106 }
107 else
108 {
109 world_sides.WorldXSize = 0;
110 world_sides.WorldYSize = 0;
111 }
112
113 emit SendWorldSides(world_sides);
114}
void SendWorldSides(REMOTE_WORLD_SIDES world_sides)

References lower_x, lower_y, SendWorldSides(), side_additive, upper_x, upper_y, REMOTE_WORLD_SIDES::WorldXSize, and REMOTE_WORLD_SIDES::WorldYSize.

Referenced by AutoCalcChanged(), LowerXChanged(), LowerYChanged(), UpperXChanged(), and UpperYChanged().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IncludeNewRegion

void AreaCalculator::IncludeNewRegion ( REMOTE_REGION_ADDRESS Location)
slot

Definition at line 125 of file areacalculator.cpp.

126{
127 auto_calc_size = true;
128
129 if ((lower_x == 0) || Location.RegionXLocation < lower_x) LowerXChanged(Location.RegionXLocation);
130 if (Location.RegionXLocation > upper_x) UpperXChanged(Location.RegionXLocation);
132
133 if ((lower_y == 0) || Location.RegionYLocation < lower_y) LowerYChanged(Location.RegionYLocation);
134 if (Location.RegionYLocation > upper_y) UpperYChanged(Location.RegionYLocation);
136}
void UpperXChanged(int NewValue)
void LowerYChanged(int NewValue)
void UpperYChanged(int NewValue)
void LowerXChanged(int NewValue)

References auto_calc_size, lower_x, lower_y, LowerXChanged(), LowerYChanged(), REMOTE_REGION_ADDRESS::RegionXLocation, REMOTE_REGION_ADDRESS::RegionYLocation, side_additive, upper_x, upper_y, UpperXChanged(), and UpperYChanged().

Here is the call graph for this function:

◆ LogAdd()

void AreaCalculator::LogAdd ( LOGGING_SEVERITY Severity,
LOGGING_MODE Mode,
QString Message )
private

Definition at line 116 of file areacalculator.cpp.

117{
118 REMOTE_LOG_ENTRY log_entry;
119 log_entry.Severity = Severity;
120 log_entry.Mode = Mode;
121 log_entry.Message = Message;
122 emit SendLogEntry(log_entry);
123}
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
Send Log Entry via the Signal-Slot Method.
LOGGING_MODE Mode
Definition logger.h:61
QString Message
Definition logger.h:63
LOGGING_SEVERITY Severity
Definition logger.h:62

References REMOTE_LOG_ENTRY::Message, REMOTE_LOG_ENTRY::Mode, SendLogEntry(), and REMOTE_LOG_ENTRY::Severity.

Here is the call graph for this function:

◆ LowerXChanged

void AreaCalculator::LowerXChanged ( int NewValue)
slot

Definition at line 24 of file areacalculator.cpp.

25{
26 lower_x = NewValue;
28}

References auto_calc_size, FindWorldLimits(), and lower_x.

Referenced by IncludeNewRegion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LowerYChanged

void AreaCalculator::LowerYChanged ( int NewValue)
slot

Definition at line 30 of file areacalculator.cpp.

31{
32 lower_y = NewValue;
34}

References auto_calc_size, FindWorldLimits(), and lower_y.

Referenced by IncludeNewRegion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Regionx16Pressed

void AreaCalculator::Regionx16Pressed ( void )
slot

Definition at line 89 of file areacalculator.cpp.

90{
91 region_size = 1048576;
93 side_additive = 3;
95}

References CalculateWorldArea(), region_multiplier, region_size, and side_additive.

Here is the call graph for this function:

◆ Regionx1Pressed

void AreaCalculator::Regionx1Pressed ( void )
slot

Definition at line 73 of file areacalculator.cpp.

74{
75 region_size = 65536;
77 side_additive = 0;
79}

References CalculateWorldArea(), region_multiplier, region_size, and side_additive.

Here is the call graph for this function:

◆ Regionx4Pressed

void AreaCalculator::Regionx4Pressed ( void )
slot

Definition at line 81 of file areacalculator.cpp.

82{
83 region_size = 262144;
85 side_additive = 1;
87}

References CalculateWorldArea(), region_multiplier, region_size, and side_additive.

Here is the call graph for this function:

◆ SendLogEntry

void AreaCalculator::SendLogEntry ( REMOTE_LOG_ENTRY LogEntry)
signal

Send Log Entry via the Signal-Slot Method.

Parameters
LogEntryStructure holding the Log Entry parameters

Referenced by LogAdd().

Here is the caller graph for this function:

◆ SendWorldArea

void AreaCalculator::SendWorldArea ( REMOTE_WORLD_SIZE WorldArea)
signal

Referenced by CalculateWorldArea().

Here is the caller graph for this function:

◆ SendWorldSides

void AreaCalculator::SendWorldSides ( REMOTE_WORLD_SIDES world_sides)
signal

Referenced by FindWorldLimits().

Here is the caller graph for this function:

◆ UpperXChanged

void AreaCalculator::UpperXChanged ( int NewValue)
slot

Definition at line 36 of file areacalculator.cpp.

37{
38 upper_x = NewValue + side_additive;
40}

References auto_calc_size, FindWorldLimits(), side_additive, and upper_x.

Referenced by IncludeNewRegion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpperYChanged

void AreaCalculator::UpperYChanged ( int NewValue)
slot

Definition at line 42 of file areacalculator.cpp.

43{
44 upper_y = NewValue + side_additive;
46}

References auto_calc_size, FindWorldLimits(), side_additive, and upper_y.

Referenced by IncludeNewRegion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WorldXChanged

void AreaCalculator::WorldXChanged ( int NewValue)
slot

Definition at line 48 of file areacalculator.cpp.

49{
50 world_x_size = NewValue;
52}

References CalculateWorldArea(), and world_x_size.

Here is the call graph for this function:

◆ WorldYChanged

void AreaCalculator::WorldYChanged ( int NewValue)
slot

Definition at line 54 of file areacalculator.cpp.

55{
56 world_y_size = NewValue;
58}

References CalculateWorldArea(), and world_y_size.

Here is the call graph for this function:

Field Documentation

◆ auto_calc_size

bool AreaCalculator::auto_calc_size
private

◆ lower_x

int AreaCalculator::lower_x
private

Definition at line 45 of file areacalculator.h.

Referenced by AreaCalculator(), FindWorldLimits(), IncludeNewRegion(), and LowerXChanged().

◆ lower_y

int AreaCalculator::lower_y
private

Definition at line 46 of file areacalculator.h.

Referenced by AreaCalculator(), FindWorldLimits(), IncludeNewRegion(), and LowerYChanged().

◆ region_multiplier

int AreaCalculator::region_multiplier
private

◆ region_size

int AreaCalculator::region_size
private

◆ side_additive

int AreaCalculator::side_additive
private

◆ upper_x

int AreaCalculator::upper_x
private

Definition at line 47 of file areacalculator.h.

Referenced by AreaCalculator(), FindWorldLimits(), IncludeNewRegion(), and UpperXChanged().

◆ upper_y

int AreaCalculator::upper_y
private

Definition at line 48 of file areacalculator.h.

Referenced by AreaCalculator(), FindWorldLimits(), IncludeNewRegion(), and UpperYChanged().

◆ world_x_size

int AreaCalculator::world_x_size
private

Definition at line 50 of file areacalculator.h.

Referenced by AreaCalculator(), CalculateWorldArea(), and WorldXChanged().

◆ world_y_size

int AreaCalculator::world_y_size
private

Definition at line 51 of file areacalculator.h.

Referenced by AreaCalculator(), CalculateWorldArea(), and WorldYChanged().


The documentation for this class was generated from the following files: