Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions RDFPlugin/CRDFPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ auto CRDFPlugin::LoadDrawingSettings(const std::optional<std::shared_ptr<CRDFScr
PLOGV << SETTING_HIGH_ALTITUDE << ": " << currentDrawSettings->highAltitude;
}
}
auto cstrMinPrecision = GetSetting(SETTING_MIN_PRECISION);
if (cstrMinPrecision.size())
{
int parsedPrecision = std::stoi(cstrMinPrecision);
if (parsedPrecision >= 0) {
currentDrawSettings->minPrecision = parsedPrecision;
PLOGV << SETTING_MIN_PRECISION << ": " << currentDrawSettings->minPrecision;
}
}
auto cstrLowPrecision = GetSetting(SETTING_LOW_PRECISION);
if (cstrLowPrecision.size())
{
Expand Down Expand Up @@ -443,6 +452,12 @@ auto CRDFPlugin::LoadDrawingStyle(const std::string& styleName) -> bool
PLOGV << SETTING_HIGH_ALTITUDE << ": " << currentDrawSettings->highAltitude;
}
}
else if (key == SETTING_MIN_PRECISION) {
if (val >= 0) {
currentDrawSettings->minPrecision = val;
PLOGV << SETTING_MIN_PRECISION << ": " << currentDrawSettings->minPrecision;
}
}
else if (key == SETTING_LOW_PRECISION) {
currentDrawSettings->lowPrecision = val;
PLOGV << SETTING_LOW_PRECISION << ": " << currentDrawSettings->lowPrecision;
Expand Down Expand Up @@ -565,8 +580,12 @@ auto CRDFPlugin::GenerateDrawPosition(const std::string& callsign) -> RDFCommon:
}
radius = offset;
}
if (offset > 0) { // add random offset
double distance = abs(disDistance(rdGenerator)) / 3.0 * offset;
if (offset > 0) {
double effectiveOffset = offset;
if (minPrecision > 0 && effectiveOffset < minPrecision) {
effectiveOffset = minPrecision;
}
double distance = abs(disDistance(rdGenerator)) / 3.0 * effectiveOffset;
double bearing = disBearing(rdGenerator);
RDFCommon::AddOffset(pos, bearing, distance);
}
Expand Down
6 changes: 6 additions & 0 deletions RDFPlugin/CRDFScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ auto CRDFScreen::OnCompileCommand(const char* sCommandLine) -> bool
return true;
}
int bufferPrecision;
if (sscanf_s(cmd.c_str(), "PRECISION M%d", &bufferPrecision) == 1) {
if (bufferPrecision >= 0) {
SaveDrawSetting(SETTING_MIN_PRECISION, "Precision (min)", std::to_string(bufferPrecision), asr);
return true;
}
}
if (sscanf_s(cmd.c_str(), "PRECISION L%d", &bufferPrecision) == 1) {
if (bufferPrecision >= 0) {
SaveDrawSetting(SETTING_LOW_PRECISION, "Precision (low)", std::to_string(bufferPrecision), asr);
Expand Down
3 changes: 3 additions & 0 deletions RDFPlugin/RDFCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ constexpr auto SETTING_CONCURRENT_RGB = "ConcurrentTransmissionRGB";
constexpr auto SETTING_CIRCLE_RADIUS = "Radius";
constexpr auto SETTING_THRESHOLD = "Threshold";
constexpr auto SETTING_PRECISION = "Precision";
constexpr auto SETTING_MIN_PRECISION = "MinPrecision";
constexpr auto SETTING_LOW_ALTITUDE = "LowAltitude";
constexpr auto SETTING_HIGH_ALTITUDE = "HighAltitude";
constexpr auto SETTING_LOW_PRECISION = "LowPrecision";
Expand Down Expand Up @@ -83,6 +84,7 @@ namespace RDFCommon {
int circleThreshold;
int lowAltitude;
int highAltitude;
int minPrecision;
int lowPrecision;
int highPrecision;
bool drawController;
Expand All @@ -96,6 +98,7 @@ namespace RDFCommon {
circleThreshold = -1; // Default: -1 (always use pixel)
circlePrecision = 0; // Default: no offset (nautical miles), range: [0, +inf)
lowAltitude = 0; // Default: 0 (feet)
minPrecision = 0; // Default: 0 (nautical miles), range: [0, +inf)
lowPrecision = 0; // Default: 0 (nautical miles), range: [0, +inf)
highAltitude = 0; // Default: 0 (feet)
highPrecision = 0; // Default: 0 (nautical miles), range: [0, +inf)
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ This table shows all RDF drawing parameters. All entries allow per-ASR configura
+ `[Keyword]` and `[Value]` are the same as above.
+ Settings will be saved to ASR file.
+ E.g. `.RDF ASR DRAW 0` will disable RDF in current ASR.

+ `.RDF STYLE [Style Name]`
+ Designed for pre-defined scenarios and real-time switching.
+ Requires an **RDFStyle.json** file next to DLL file. [JSON format](#example---style)
+ `[Style Name]` is case-sensitive and must be exact match.
+ Re-application is needed after hot-editting JSON file.
+ STYLE settings will not be saved when exiting EuroScope.
+ Use `.RDF STYLE OFF/0` or enter empty style name (keep the trailing ` `) to cancel style.
+ Style will be cancelled when:
+ using `.RDF STYLE OFF/0`.
+ using empty style name but keep the trailing space.
+ JSON file is broken or any error occurs.
+ Re-application is needed after editting JSON file.
+ STYLE settings will not be saved when exiting EuroScope. For lasting effect use per-ASR settings or plugin settings instead.

### Random Offset Schematic

Expand Down