更新到0.6.0.2

This commit is contained in:
2026-07-06 08:47:33 +08:00
parent e29a5178b7
commit 97d41a1385
473 changed files with 156342 additions and 5 deletions
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b23e7ea809c2b0b49909def88736de81
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,124 @@
namespace DrawXXL
{
using UnityEngine;
using System.Collections.Generic;
using System.IO;
public class InternalDXXL_ChartToCSVfileWriter
{
public static string default_csvFileName = "DrawXXL_chart";
public void ExportToCSVfile(ChartLines lines, string fileName)
{
if (fileName == null || fileName == "")
{
fileName = default_csvFileName;
}
string pathPlusFileNameInclFileTypeEnding = Create_pathPlusFileNameInclFileTypeEnding(fileName);
int maxFilesWithSameName = 1000000;
bool hasFoundValidFilename = false;
int sequentialNumberOfSameFilename = -1;
for (int i = 0; i < maxFilesWithSameName; i++)
{
if (File.Exists(pathPlusFileNameInclFileTypeEnding))
{
sequentialNumberOfSameFilename = i + 1;
pathPlusFileNameInclFileTypeEnding = Create_pathPlusFileNameInclFileTypeEnding(fileName + "(" + sequentialNumberOfSameFilename + ")");
}
else
{
hasFoundValidFilename = true;
break;
}
}
if (hasFoundValidFilename == false)
{
Debug.LogError("Generating CSV file failed: Too many files with same name (of '" + fileName + "').");
return;
}
StreamWriter streamWriter = null;
try
{
List<ChartLine> allLinesWithAtLeastOneDataPoint_validOrInvalid = lines.Get_all_hiddenAndUnhiddenLines_withAtLeastOneValidOrInvalidDatapoint(out int numberOfDatapoints_inLongestLine, false);
streamWriter = new StreamWriter(pathPlusFileNameInclFileTypeEnding);
//Line names:
for (int i_line = 0; i_line < allLinesWithAtLeastOneDataPoint_validOrInvalid.Count; i_line++)
{
string lineName = allLinesWithAtLeastOneDataPoint_validOrInvalid[i_line].GetNameCompound(false);
if (i_line < (allLinesWithAtLeastOneDataPoint_validOrInvalid.Count - 1))
{
streamWriter.Write("\"x of " + lineName + "\",\"y of " + lineName + "\",");
}
else
{
streamWriter.WriteLine("\"x of " + lineName + "\",\"y of " + lineName + "\"");
}
}
//data points:
for (int i_datapoint = 0; i_datapoint < numberOfDatapoints_inLongestLine; i_datapoint++)
{
for (int i_line = 0; i_line < allLinesWithAtLeastOneDataPoint_validOrInvalid.Count; i_line++)
{
if (i_datapoint < allLinesWithAtLeastOneDataPoint_validOrInvalid[i_line].dataPoints.Count)
{
if (i_line < (allLinesWithAtLeastOneDataPoint_validOrInvalid.Count - 1))
{
streamWriter.Write("\"" + allLinesWithAtLeastOneDataPoint_validOrInvalid[i_line].dataPoints[i_datapoint].xValue + "\",\"" + allLinesWithAtLeastOneDataPoint_validOrInvalid[i_line].dataPoints[i_datapoint].yValue + "\",");
}
else
{
streamWriter.WriteLine("\"" + allLinesWithAtLeastOneDataPoint_validOrInvalid[i_line].dataPoints[i_datapoint].xValue + "\",\"" + allLinesWithAtLeastOneDataPoint_validOrInvalid[i_line].dataPoints[i_datapoint].yValue + "\"");
}
}
else
{
if (i_line < (allLinesWithAtLeastOneDataPoint_validOrInvalid.Count - 1))
{
streamWriter.Write(",,");
}
else
{
streamWriter.WriteLine(",");
}
}
}
}
}
catch
{
Debug.LogError("Writing CSV file failed.");
}
finally
{
try
{
streamWriter.Close();
if (sequentialNumberOfSameFilename == (-1))
{
Debug.Log("The file '" + fileName + ".csv' was generated.");
}
else
{
Debug.Log("The file '" + fileName + "(" + sequentialNumberOfSameFilename + ").csv' was generated.");
}
}
catch
{
Debug.LogError("Closing the new CSV file failed.");
}
}
}
string Create_pathPlusFileNameInclFileTypeEnding(string fileName)
{
return (Application.dataPath + "/" + fileName + ".csv");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 71041864ca5542b429191d71a08545b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,389 @@
namespace DrawXXL
{
using UnityEngine;
public class InternalDXXL_DataPointOfChartLine
{
public enum ValidState { isValid, isNaN_atX, isNaN_atY, isPositiveInfinity_atX, isPositiveInfinity_atY, isNegativeInfinity_atX, isNegativeInfinity_atY, isPlaceholderDuringPhasesWhereThisLineOfListDidntExistsDueToListChangedItsCount_existsOnlyToStayInXSyncWithOtherLinesOfList }
///[Set during point creation]:
public float xValue; //-> is only expected to be "invalid" when using an "AddXYValue()"-function (which doesn't use the automatic x-value-source). So it is not expected for complexer data types (like Vector/Quaternion/Color, which consist of more than 1 line), and also it is not expected for anything that comes from "AddValues_eachIndexIsALine" where many lines are grouped.
public float yValue;
public ValidState validState; //if both values (x and y) are "NaN" (or Infintiy) then this is set to the "_atX" variants.
public int i_ofThisPointInsideContainingLine;
public ChartLine line_thisPointIsPartOf;
public bool hasLittleEmphasizingCircleAroundPoint = false;
public bool forceConnectionLineToLowAlpha;
///[Set during drawing]:
public bool isInsideChartRect;
public bool isInsideChartsXSpan;
public bool isDrawn;
public int i_ofPrecedingPointFromWhichLineCanBeDrawn;
public Vector3 positionInWorldSpace;
public Vector3 positionInWorldSpace_atYHeightOfValidPrecedingPoint;
public Vector3 positionInWorldSpace_atYHeightOfLowerEndOf_rgbColorUnderlay;
public Vector3 positionInWorldSpace_atYHeightOfUpperEndOf_rgbColorUnderlay;
//Others:
static float alphaFactor_indicatingVertConnectionLines = 0.2f;
static float alphaFactor_indicatingNonExistingValues = 0.25f;
public void DetermineIfAndHowPointIsDrawn(float valueMarkingLowerEndOf_XAxis, float valueMarkingUpperEndOf_XAxis, float valueMarkingLowerEndOf_YAxis, float valueMarkingUpperEndOf_YAxis, int i_ofTheMostCurrentDrawnPoint, bool thereHaveBeenValidPointsOutsideTheDrawnChartArea_sinceMostCurrentDrawnPoint)
{
if (validState == ValidState.isValid)
{
isInsideChartRect = true;
if (xValue < valueMarkingLowerEndOf_XAxis) { isInsideChartRect = false; }
if (xValue > valueMarkingUpperEndOf_XAxis) { isInsideChartRect = false; }
if (yValue < valueMarkingLowerEndOf_YAxis) { isInsideChartRect = false; }
if (yValue > valueMarkingUpperEndOf_YAxis) { isInsideChartRect = false; }
bool isInDrawnArea = isInsideChartRect || line_thisPointIsPartOf.Chart_thisLineIsPartOf.drawValuesOutsideOfChartArea;
isDrawn = isInDrawnArea;
i_ofPrecedingPointFromWhichLineCanBeDrawn = i_ofTheMostCurrentDrawnPoint;
if ((line_thisPointIsPartOf.Chart_thisLineIsPartOf.drawValuesOutsideOfChartArea == false) && thereHaveBeenValidPointsOutsideTheDrawnChartArea_sinceMostCurrentDrawnPoint)
{
i_ofPrecedingPointFromWhichLineCanBeDrawn = -1;
}
positionInWorldSpace = line_thisPointIsPartOf.Chart_thisLineIsPartOf.ChartSpace_to_WorldSpace(new Vector2(xValue, yValue));
}
else
{
isInsideChartRect = false;
isDrawn = false;
}
}
public void DetermineIfAndHowPointIsDrawn_forRGBColorUnderlay(float valueMarkingLowerEndOf_XAxis, float valueMarkingUpperEndOf_XAxis, float valueMarkingLowerEndOf_YAxis, float valueMarkingUpperEndOf_YAxis)
{
//-> is only called for valid datapoints
isInsideChartsXSpan = true;
if (xValue < valueMarkingLowerEndOf_XAxis) { isInsideChartsXSpan = false; }
if (xValue > valueMarkingUpperEndOf_XAxis) { isInsideChartsXSpan = false; }
float yGap_toXAxis = 0.01f * (valueMarkingUpperEndOf_YAxis - valueMarkingLowerEndOf_YAxis);
positionInWorldSpace_atYHeightOfLowerEndOf_rgbColorUnderlay = line_thisPointIsPartOf.Chart_thisLineIsPartOf.ChartSpace_to_WorldSpace(new Vector2(xValue, valueMarkingLowerEndOf_YAxis + yGap_toXAxis));
positionInWorldSpace_atYHeightOfUpperEndOf_rgbColorUnderlay = line_thisPointIsPartOf.Chart_thisLineIsPartOf.ChartSpace_to_WorldSpace(new Vector2(xValue, valueMarkingUpperEndOf_YAxis));
}
public void DrawConnectionLineFromPrecedingPoint(Vector3 worldPos_ofPrecedingDrawnPoint, float yValue_ofPrecedingDrawnPoint_inChartSpace, bool lineFromPrecedingDrawnPoint_shouldBeLowerAlphaIndicatingAnInvalidPhase, float absLineWidth_worldSpace, Vector3 amplitudeDir_forNonZeroWidthLines, float durationInSec, bool hiddenByNearerObjects)
{
switch (line_thisPointIsPartOf.lineConnectionsType)
{
case ChartLine.LineConnectionsType.straightFromPointToPoint:
DrawLineFromPrecedingToCurrPoint(worldPos_ofPrecedingDrawnPoint, lineFromPrecedingDrawnPoint_shouldBeLowerAlphaIndicatingAnInvalidPhase, absLineWidth_worldSpace, amplitudeDir_forNonZeroWidthLines, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.LineConnectionsType.horizPlateauTillNextPoint:
DrawHorizLineFromPrecedingPointThenLowAlphaVertToCurrent(worldPos_ofPrecedingDrawnPoint, yValue_ofPrecedingDrawnPoint_inChartSpace, lineFromPrecedingDrawnPoint_shouldBeLowerAlphaIndicatingAnInvalidPhase, absLineWidth_worldSpace, amplitudeDir_forNonZeroWidthLines, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.LineConnectionsType.invisible:
break;
default:
break;
}
}
void DrawLineFromPrecedingToCurrPoint(Vector3 worldPos_ofPrecedingDrawnPoint, bool lineFromPrecedingDrawnPoint_shouldBeLowerAlphaIndicatingAnInvalidPhase, float absLineWidth_worldSpace, Vector3 amplitudeDir_forNonZeroWidthLines, float durationInSec, bool hiddenByNearerObjects)
{
if (lineFromPrecedingDrawnPoint_shouldBeLowerAlphaIndicatingAnInvalidPhase || forceConnectionLineToLowAlpha)
{
DrawLineFromPrecedingToCurrPoint_lowAlphaIndicatingNonExistingValues(worldPos_ofPrecedingDrawnPoint, durationInSec, hiddenByNearerObjects);
}
else
{
DrawLineFromPrecedingToCurrPoint_fullAlpha(worldPos_ofPrecedingDrawnPoint, absLineWidth_worldSpace, amplitudeDir_forNonZeroWidthLines, durationInSec, hiddenByNearerObjects);
}
}
void DrawLineFromPrecedingToCurrPoint_fullAlpha(Vector3 worldPos_ofPrecedingDrawnPoint, float absLineWidth_worldSpace, Vector3 amplitudeDir_forNonZeroWidthLines, float durationInSec, bool hiddenByNearerObjects)
{
Line_fadeableAnimSpeed.InternalDraw(worldPos_ofPrecedingDrawnPoint, positionInWorldSpace, line_thisPointIsPartOf.Color, absLineWidth_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, amplitudeDir_forNonZeroWidthLines, true, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
}
void DrawLineFromPrecedingToCurrPoint_lowAlphaIndicatingNonExistingValues(Vector3 worldPos_ofPrecedingDrawnPoint, float durationInSec, bool hiddenByNearerObjects)
{
Color color_loweredAlpha = UtilitiesDXXL_Colors.Get_color_butWithAdjustedAlpha(line_thisPointIsPartOf.Color, alphaFactor_indicatingNonExistingValues);
Line_fadeableAnimSpeed.InternalDraw(worldPos_ofPrecedingDrawnPoint, positionInWorldSpace, color_loweredAlpha, 0.0f, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, default(Vector3), false, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
}
void DrawHorizLineFromPrecedingPointThenLowAlphaVertToCurrent(Vector3 worldPos_ofPrecedingDrawnPoint, float yValue_ofPrecedingDrawnPoint_inChartSpace, bool lineFromPrecedingDrawnPoint_shouldBeLowerAlphaIndicatingAnInvalidPhase, float absLineWidth_worldSpace, Vector3 amplitudeDir_forNonZeroWidthLines, float durationInSec, bool hiddenByNearerObjects)
{
if (lineFromPrecedingDrawnPoint_shouldBeLowerAlphaIndicatingAnInvalidPhase || forceConnectionLineToLowAlpha)
{
DrawHorizLineFromPrecedingPointThenLowAlphaVertToCurrent_lowAlphaConfigIndicatingNonExistingValues(worldPos_ofPrecedingDrawnPoint, yValue_ofPrecedingDrawnPoint_inChartSpace, durationInSec, hiddenByNearerObjects);
}
else
{
DrawHorizLineFromPrecedingPointThenLowAlphaVertToCurrent_defaultAlphaConfig(worldPos_ofPrecedingDrawnPoint, yValue_ofPrecedingDrawnPoint_inChartSpace, absLineWidth_worldSpace, amplitudeDir_forNonZeroWidthLines, durationInSec, hiddenByNearerObjects);
}
}
void DrawHorizLineFromPrecedingPointThenLowAlphaVertToCurrent_defaultAlphaConfig(Vector3 worldPos_ofPrecedingDrawnPoint, float yValue_ofPrecedingDrawnPoint_inChartSpace, float absLineWidth_worldSpace, Vector3 amplitudeDir_forNonZeroWidthLines, float durationInSec, bool hiddenByNearerObjects)
{
//horiz Line:
CalcWorldPosAtYHeightOfValidPrecedingPoint(yValue_ofPrecedingDrawnPoint_inChartSpace);
Line_fadeableAnimSpeed.InternalDraw(worldPos_ofPrecedingDrawnPoint, positionInWorldSpace_atYHeightOfValidPrecedingPoint, line_thisPointIsPartOf.Color, absLineWidth_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, amplitudeDir_forNonZeroWidthLines, true, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
//vert Line:
Color color_ofVertConnectionLine = UtilitiesDXXL_Colors.Get_color_butWithAdjustedAlpha(line_thisPointIsPartOf.Color, alphaFactor_indicatingVertConnectionLines);
Line_fadeableAnimSpeed.InternalDraw(positionInWorldSpace_atYHeightOfValidPrecedingPoint, positionInWorldSpace, color_ofVertConnectionLine, 0.0f, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, default(Vector3), false, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
}
void DrawHorizLineFromPrecedingPointThenLowAlphaVertToCurrent_lowAlphaConfigIndicatingNonExistingValues(Vector3 worldPos_ofPrecedingDrawnPoint, float yValue_ofPrecedingDrawnPoint_inChartSpace, float durationInSec, bool hiddenByNearerObjects)
{
//horiz Line:
CalcWorldPosAtYHeightOfValidPrecedingPoint(yValue_ofPrecedingDrawnPoint_inChartSpace);
Color colorHoriz_loweredAlpha = UtilitiesDXXL_Colors.Get_color_butWithAdjustedAlpha(line_thisPointIsPartOf.Color, alphaFactor_indicatingNonExistingValues);
Line_fadeableAnimSpeed.InternalDraw(worldPos_ofPrecedingDrawnPoint, positionInWorldSpace_atYHeightOfValidPrecedingPoint, colorHoriz_loweredAlpha, 0.0f, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, default(Vector3), false, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
//vert Line:
Color color_ofVertConnectionLine = UtilitiesDXXL_Colors.Get_color_butWithAdjustedAlpha(line_thisPointIsPartOf.Color, alphaFactor_indicatingVertConnectionLines);
Color colorVert_loweredAlpha = UtilitiesDXXL_Colors.Get_color_butWithAdjustedAlpha(color_ofVertConnectionLine, 0.5f);
Line_fadeableAnimSpeed.InternalDraw(positionInWorldSpace_atYHeightOfValidPrecedingPoint, positionInWorldSpace, colorVert_loweredAlpha, 0.0f, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, default(Vector3), false, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
}
void CalcWorldPosAtYHeightOfValidPrecedingPoint(float yValue_ofPrecedingDrawnPoint_inChartSpace)
{
positionInWorldSpace_atYHeightOfValidPrecedingPoint = line_thisPointIsPartOf.Chart_thisLineIsPartOf.ChartSpace_to_WorldSpace(new Vector2(xValue, yValue_ofPrecedingDrawnPoint_inChartSpace));
}
public void DrawPointVisualization(float absSizeOfPointVisualization_inWorldSpace, float absLineWidth_forLineItself_worldSpace, float absLineWidth_forPointVisualisators_worldSpace, Vector3 amplitudeDir_forNonZeroWidthLines, float durationInSec, bool hiddenByNearerObjects)
{
TryDrawLittleEmphasizingCircleAroundPoint(absLineWidth_forLineItself_worldSpace, durationInSec, hiddenByNearerObjects);
if (validState == ValidState.isValid)
{
DrawVerticalFillLineFromXAxisToPoint(durationInSec, hiddenByNearerObjects);
float halfAbsSizeOfPointVisualization_inWorldSpace;
bool filledWithSpokes;
int numberOfCornersOfStarShape;
switch (line_thisPointIsPartOf.dataPointVisualization)
{
case ChartLine.DataPointVisualization.invisible:
break;
case ChartLine.DataPointVisualization.cross:
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
//horiz crossline:
Vector3 leftCrossEnd_worldSpace = positionInWorldSpace - line_thisPointIsPartOf.Chart_thisLineIsPartOf.xAxis.AxisVector_normalized_inWorldSpace * halfAbsSizeOfPointVisualization_inWorldSpace;
Vector3 rightCrossEnd_worldSpace = positionInWorldSpace + line_thisPointIsPartOf.Chart_thisLineIsPartOf.xAxis.AxisVector_normalized_inWorldSpace * halfAbsSizeOfPointVisualization_inWorldSpace;
Line_fadeableAnimSpeed.InternalDraw(leftCrossEnd_worldSpace, rightCrossEnd_worldSpace, line_thisPointIsPartOf.Color, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, amplitudeDir_forNonZeroWidthLines, true, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
//vert crossline:
Vector3 lowerCrossEnd_worldSpace = positionInWorldSpace - line_thisPointIsPartOf.Chart_thisLineIsPartOf.yAxis.AxisVector_normalized_inWorldSpace * halfAbsSizeOfPointVisualization_inWorldSpace;
Vector3 upperCrossEnd_worldSpace = positionInWorldSpace + line_thisPointIsPartOf.Chart_thisLineIsPartOf.yAxis.AxisVector_normalized_inWorldSpace * halfAbsSizeOfPointVisualization_inWorldSpace;
Line_fadeableAnimSpeed.InternalDraw(lowerCrossEnd_worldSpace, upperCrossEnd_worldSpace, line_thisPointIsPartOf.Color, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, amplitudeDir_forNonZeroWidthLines, true, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
break;
case ChartLine.DataPointVisualization.cross45deg:
float halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace * UtilitiesDXXL_Math.inverseSqrtOf2_precalced;
//horiz crossline:
Vector3 lowLeftCrossEnd_worldSpace = positionInWorldSpace - line_thisPointIsPartOf.Chart_thisLineIsPartOf.xAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace - line_thisPointIsPartOf.Chart_thisLineIsPartOf.yAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace;
Vector3 topRightCrossEnd_worldSpace = positionInWorldSpace + line_thisPointIsPartOf.Chart_thisLineIsPartOf.xAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace + line_thisPointIsPartOf.Chart_thisLineIsPartOf.yAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace;
Line_fadeableAnimSpeed.InternalDraw(lowLeftCrossEnd_worldSpace, topRightCrossEnd_worldSpace, line_thisPointIsPartOf.Color, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, amplitudeDir_forNonZeroWidthLines, true, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
//vert crossline:
Vector3 topLeftCrossEnd_worldSpace = positionInWorldSpace - line_thisPointIsPartOf.Chart_thisLineIsPartOf.xAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace + line_thisPointIsPartOf.Chart_thisLineIsPartOf.yAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace;
Vector3 lowRightCrossEnd_worldSpace = positionInWorldSpace + line_thisPointIsPartOf.Chart_thisLineIsPartOf.xAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace - line_thisPointIsPartOf.Chart_thisLineIsPartOf.yAxis.AxisVector_normalized_inWorldSpace * halfAbsLengthOfCrossLines_projectedOntoChartAxis_inWorldSpace;
Line_fadeableAnimSpeed.InternalDraw(topLeftCrossEnd_worldSpace, lowRightCrossEnd_worldSpace, line_thisPointIsPartOf.Color, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, amplitudeDir_forNonZeroWidthLines, true, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
break;
case ChartLine.DataPointVisualization.square:
filledWithSpokes = false;
DrawShapes.Square(positionInWorldSpace, absSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.squareCrossed:
filledWithSpokes = true;
DrawShapes.Square(positionInWorldSpace, absSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.triangle:
filledWithSpokes = false;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Triangle(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.triangleCrossed:
filledWithSpokes = true;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Triangle(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.pentagon:
filledWithSpokes = false;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Pentagon(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.pentagonCrossed:
filledWithSpokes = true;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Pentagon(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.circle:
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
filledWithSpokes = false;
DrawShapes.Decagon(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.circleFilled:
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
filledWithSpokes = true;
DrawShapes.Decagon(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.star4corners:
filledWithSpokes = false;
numberOfCornersOfStarShape = 4;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Star(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, numberOfCornersOfStarShape, 0.5f, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.star4CornersCrossed:
filledWithSpokes = true;
numberOfCornersOfStarShape = 4;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Star(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, numberOfCornersOfStarShape, 0.5f, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.star5corners:
filledWithSpokes = false;
numberOfCornersOfStarShape = 5;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Star(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, numberOfCornersOfStarShape, 0.5f, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.star5CornersCrossed:
filledWithSpokes = true;
numberOfCornersOfStarShape = 5;
halfAbsSizeOfPointVisualization_inWorldSpace = 0.5f * absSizeOfPointVisualization_inWorldSpace;
DrawShapes.Star(positionInWorldSpace, halfAbsSizeOfPointVisualization_inWorldSpace, line_thisPointIsPartOf.Color, numberOfCornersOfStarShape, 0.5f, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, absLineWidth_forPointVisualisators_worldSpace, null, DrawBasics.LineStyle.solid, 1.0f, filledWithSpokes, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.heart:
float heartIconSize = absSizeOfPointVisualization_inWorldSpace * 1.25f;
int strokeWidth_asPPMofSize_ofHeartIcon = CalcIconWidth_asPPMofSize(heartIconSize, absLineWidth_forPointVisualisators_worldSpace);
DrawBasics.Icon(positionInWorldSpace, DrawBasics.IconType.heart, line_thisPointIsPartOf.Color, heartIconSize, null, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, strokeWidth_asPPMofSize_ofHeartIcon, false, durationInSec, hiddenByNearerObjects);
break;
case ChartLine.DataPointVisualization.customIconSymbol:
float iconSize = absSizeOfPointVisualization_inWorldSpace * 1.35f;
int strokeWidth_asPPMofSize = CalcIconWidth_asPPMofSize(iconSize, absLineWidth_forPointVisualisators_worldSpace);
DrawBasics.Icon(positionInWorldSpace, line_thisPointIsPartOf.customIconAsDatapointVisualization, line_thisPointIsPartOf.Color, iconSize, null, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, strokeWidth_asPPMofSize, false, durationInSec, hiddenByNearerObjects);
break;
default:
break;
}
}
}
int CalcIconWidth_asPPMofSize(float iconSize, float absLineWidth_forPointVisualisators_worldSpace)
{
if (UtilitiesDXXL_Math.ApproximatelyZero(absLineWidth_forPointVisualisators_worldSpace))
{
return 0;
}
else
{
return Mathf.RoundToInt((absLineWidth_forPointVisualisators_worldSpace / iconSize) * 1000000.0f);
}
}
void DrawVerticalFillLineFromXAxisToPoint(float durationInSec, bool hiddenByNearerObjects)
{
if (UtilitiesDXXL_Math.ApproximatelyZero(line_thisPointIsPartOf.Alpha_ofVerticalAreaFillLines) == false)
{
if (line_thisPointIsPartOf.Alpha_ofVerticalAreaFillLines > 0.0f)
{
Color colorOfVertLine = UtilitiesDXXL_Colors.Get_color_butWithAdjustedAlpha(line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Alpha_ofVerticalAreaFillLines);
Vector2 positionsVertProjectionOntoXAxis_inChartSpace = new Vector2(xValue, line_thisPointIsPartOf.Chart_thisLineIsPartOf.yAxis.ValueMarkingLowerEndOfTheAxis);
Vector3 positionsVertProjectionOntoXAxis_inWorldSpace = line_thisPointIsPartOf.Chart_thisLineIsPartOf.ChartSpace_to_WorldSpace(positionsVertProjectionOntoXAxis_inChartSpace);
Line_fadeableAnimSpeed.InternalDraw(positionInWorldSpace, positionsVertProjectionOntoXAxis_inWorldSpace, colorOfVertLine, 0.0f, null, DrawBasics.LineStyle.solid, 1.0f, 0.0f, null, default(Vector3), false, 0.0f, 0.0f, 0.0f, durationInSec, hiddenByNearerObjects, false, false);
}
}
}
void TryDrawLittleEmphasizingCircleAroundPoint(float absLineWidth_worldSpace, float durationInSec, bool hiddenByNearerObjects)
{
if (hasLittleEmphasizingCircleAroundPoint)
{
float radius = line_thisPointIsPartOf.Chart_thisLineIsPartOf.Height_inWorldSpace * 0.005f + 0.5f * absLineWidth_worldSpace;
DrawShapes.Decagon(positionInWorldSpace, radius, line_thisPointIsPartOf.Color, line_thisPointIsPartOf.Chart_thisLineIsPartOf.InternalRotation, 0.0f, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, false, false, durationInSec, hiddenByNearerObjects);
}
}
public bool HasAPrecedingPointFromWhichLineCanBeDrawn()
{
//needs "DetermineIfAndHowPointIsDrawn" called beforehand
return (i_ofPrecedingPointFromWhichLineCanBeDrawn >= 0);
}
public string GetInvalidTypeString()
{
switch (validState)
{
case ValidState.isValid:
return "Is valid: " + GetStringTheDisplaysTheXandYvalue();
case ValidState.isNaN_atX:
return GetStringTheDisplaysTheXandYvalue();
case ValidState.isNaN_atY:
return GetStringTheDisplaysTheXandYvalue();
case ValidState.isPositiveInfinity_atX:
return GetStringTheDisplaysTheXandYvalue();
case ValidState.isPositiveInfinity_atY:
return GetStringTheDisplaysTheXandYvalue();
case ValidState.isNegativeInfinity_atX:
return GetStringTheDisplaysTheXandYvalue();
case ValidState.isNegativeInfinity_atY:
return GetStringTheDisplaysTheXandYvalue();
case ValidState.isPlaceholderDuringPhasesWhereThisLineOfListDidntExistsDueToListChangedItsCount_existsOnlyToStayInXSyncWithOtherLinesOfList:
return "Collection index didn't exist at 'AddValues_eachIndexIsALine()'-call (Length/Count was too small).";
default:
return "[<color=#ce0e0eFF><icon=logMessageError></color> ValidState of " + validState + " not implemented]";
}
}
string GetStringTheDisplaysTheXandYvalue()
{
return "x = " + xValue + " / y = " + yValue;
}
public static ValidState GetValidStateOf_datapointToBeCreated(bool newDatapoint_isPlaceholderDuringPhasesWhereThisLineOfListDidntExistsDueToListChangedItsCount_existsOnlyToStayInXSyncWithOtherLinesOfList, float xValue, float yValue)
{
ValidState validStateOfNewDataPoint = ValidState.isValid;
if (newDatapoint_isPlaceholderDuringPhasesWhereThisLineOfListDidntExistsDueToListChangedItsCount_existsOnlyToStayInXSyncWithOtherLinesOfList)
{
validStateOfNewDataPoint = ValidState.isPlaceholderDuringPhasesWhereThisLineOfListDidntExistsDueToListChangedItsCount_existsOnlyToStayInXSyncWithOtherLinesOfList;
}
else
{
if (float.IsNaN(xValue))
{
validStateOfNewDataPoint = ValidState.isNaN_atX;
}
else
{
if (float.IsPositiveInfinity(xValue))
{
validStateOfNewDataPoint = ValidState.isPositiveInfinity_atX;
}
else
{
if (float.IsNegativeInfinity(xValue))
{
validStateOfNewDataPoint = ValidState.isNegativeInfinity_atX;
}
else
{
if (float.IsNaN(yValue))
{
validStateOfNewDataPoint = ValidState.isNaN_atY;
}
else
{
if (float.IsPositiveInfinity(yValue))
{
validStateOfNewDataPoint = ValidState.isPositiveInfinity_atY;
}
else
{
if (float.IsNegativeInfinity(yValue))
{
validStateOfNewDataPoint = ValidState.isNegativeInfinity_atY;
}
}
}
}
}
}
}
return validStateOfNewDataPoint;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ea7c7f5c3b5bf064d9a53823137fecd3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,107 @@
namespace DrawXXL
{
using UnityEngine;
public class InternalDXXL_HorizontalThresholdLine
{
float yPosition;
bool lineItselfCountsToLowerArea;
ChartLine line_thisThresholdIsPartOf;
public InternalDXXL_HorizontalThresholdLine(float yPosition, ChartLine line_thisThresholdIsPartOf, bool lineItselfCountsToLowerArea)
{
this.yPosition = yPosition;
this.line_thisThresholdIsPartOf = line_thisThresholdIsPartOf;
this.lineItselfCountsToLowerArea = lineItselfCountsToLowerArea;
}
public PointOfInterest CheckIntersection(InternalDXXL_DataPointOfChartLine previousDataPoint, InternalDXXL_DataPointOfChartLine currDataPoint)
{
if (previousDataPoint.validState == InternalDXXL_DataPointOfChartLine.ValidState.isValid && currDataPoint.validState == InternalDXXL_DataPointOfChartLine.ValidState.isValid)
{
if (lineItselfCountsToLowerArea)
{
//lineItselfCountsTo-LOWER-area:
if (previousDataPoint.yValue <= yPosition)
{
if (currDataPoint.yValue > yPosition)
{
return CreateIntersectionPoint(previousDataPoint, currDataPoint);
}
}
else
{
if (currDataPoint.yValue <= yPosition)
{
return CreateIntersectionPoint(previousDataPoint, currDataPoint);
}
}
}
else
{
//lineItselfCountsTo-HIGHER-area:
if (previousDataPoint.yValue < yPosition)
{
if (currDataPoint.yValue >= yPosition)
{
return CreateIntersectionPoint(previousDataPoint, currDataPoint);
}
}
else
{
if (currDataPoint.yValue < yPosition)
{
return CreateIntersectionPoint(previousDataPoint, currDataPoint);
}
}
}
}
return null;
}
PointOfInterest CreateIntersectionPoint(InternalDXXL_DataPointOfChartLine previousDataPoint, InternalDXXL_DataPointOfChartLine currDataPoint)
{
previousDataPoint.hasLittleEmphasizingCircleAroundPoint = true;
currDataPoint.hasLittleEmphasizingCircleAroundPoint = true;
float x_ofIntersectionPos;
if (line_thisThresholdIsPartOf.lineConnectionsType == ChartLine.LineConnectionsType.horizPlateauTillNextPoint)
{
x_ofIntersectionPos = currDataPoint.xValue;
}
else
{
InternalDXXL_Line2D line2D_betweenDataPoints = new InternalDXXL_Line2D();
Vector2 previousDataPoint_asV2 = new Vector2(previousDataPoint.xValue, previousDataPoint.yValue);
Vector2 currDataPoint_asV2 = new Vector2(currDataPoint.xValue, currDataPoint.yValue);
line2D_betweenDataPoints.Recalc_line_throughTwoPoints_returnSteepForVertLines(previousDataPoint_asV2, currDataPoint_asV2);
x_ofIntersectionPos = line2D_betweenDataPoints.GetXatY(yPosition);
}
Color colorOfGeneratedIntersectionPoints = UtilitiesDXXL_Colors.GetSimilarColorWithSlightlyOtherBrightnessValue(line_thisThresholdIsPartOf.Color);
colorOfGeneratedIntersectionPoints.a = 1.0f;
string notificationText;
if (previousDataPoint.yValue < currDataPoint.yValue)
{
Color risingFlankColor = Color.Lerp(UtilitiesDXXL_Colors.green_boolTrue, colorOfGeneratedIntersectionPoints, 0.18f);
notificationText = "Line '" + line_thisThresholdIsPartOf.Name + "':<br><color=#" + ColorUtility.ToHtmlStringRGBA(risingFlankColor) + ">" + DrawText.MarkupIcon(DrawBasics.IconType.arrowUp) + "</color>Rising flank intersects threshold at<br>x = " + x_ofIntersectionPos + " / y = " + yPosition + "<br>Data point before intersection:<br>x = " + previousDataPoint.xValue + " / y = " + previousDataPoint.yValue + "<br>Data point after intersection:<br>x = " + currDataPoint.xValue + " / y = " + currDataPoint.yValue;
}
else
{
Color fallingFlankColor = Color.Lerp(UtilitiesDXXL_Colors.red_boolFalse, colorOfGeneratedIntersectionPoints, 0.18f);
notificationText = "Line '" + line_thisThresholdIsPartOf.Name + "':<br><color=#" + ColorUtility.ToHtmlStringRGBA(fallingFlankColor) + ">" + DrawText.MarkupIcon(DrawBasics.IconType.arrowDown) + "</color>Falling flank intersects threshold at<br>x = " + x_ofIntersectionPos + " / y = " + yPosition + "<br>Data point before intersection:<br>x = " + previousDataPoint.xValue + " / y = " + previousDataPoint.yValue + "<br>Data point after intersection:<br>x = " + currDataPoint.xValue + " / y = " + currDataPoint.yValue;
}
PointOfInterest pointOfInterest_thatIndicatesTheThresholdCrossing = new PointOfInterest(x_ofIntersectionPos, yPosition, colorOfGeneratedIntersectionPoints, line_thisThresholdIsPartOf.Chart_thisLineIsPartOf, line_thisThresholdIsPartOf, notificationText);
pointOfInterest_thatIndicatesTheThresholdCrossing.drawTextBoxIfPointIsOutsideOfChartArea = true;
pointOfInterest_thatIndicatesTheThresholdCrossing.isDeletedOnClear = true;
pointOfInterest_thatIndicatesTheThresholdCrossing.forceColorOfParent = false;
pointOfInterest_thatIndicatesTheThresholdCrossing.xValue.lineStyle = DrawBasics.LineStyle.invisible;
pointOfInterest_thatIndicatesTheThresholdCrossing.yValue.lineStyle = DrawBasics.LineStyle.invisible;
return pointOfInterest_thatIndicatesTheThresholdCrossing;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38f65caec75b17548b15445629b00abb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
namespace DrawXXL
{
public struct InternalDXXL_HorizontalThresholdLineInitializer
{
public float yPositionOfThresholdToCreate;
public bool lineItselfCountsToLowerArea;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5cb7905e96a371f46b115fe814ce96c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,247 @@
namespace DrawXXL
{
using System;
using UnityEngine;
[Serializable]
public class InternalDXXL_LineSpecsForChartInspector
{
static int default_numberOfDisplayedDatapointsInArray = 7;
public static bool lineCompoundNames_haveSpaces_betweenTheNamePartConnectingMinus = true;
public ChartLine line_theseSpecsBelongTo;
public bool currentHideLineState;
public bool currentHideCursorXState_duringComponentInspectionPhase = true;
public bool currentHideCursorYState_duringComponentInspectionPhase = false;
public Color lineColor;
public ChartLine.LineConnectionsType connectionsType;
public ChartLine.DataPointVisualization dataPointVisualization;
[Range(0.002f, 0.3f)] public float dataPointVisualization_size;
[Range(0.0f, 1.0f)] public float alpha_ofVertFillLines;
[Range(0.0f, 0.2f)] public float lineWidth;
public string linesCompoundName;
[SerializeField] int numberOfDisplayedDatapointsInArray = default_numberOfDisplayedDatapointsInArray;
[SerializeField] InternalDXXL_NeighboringDatapointForChartInspector[] neighboringDatapointValues;
[SerializeField] int i_insideShortenedForInspectorArray_markingTheValueAtCursor;
[SerializeField] bool lineSection_isExpanded = false;
[SerializeField] bool datapointValuesSection_isExpanded = false;
int i_ofValueInsideLinesDatapointListThatIsXNearestToCursor;
public bool hasValidDatapointThatIsXNearestToCursor = false;
public Vector2 posInChartspace_ofDatapointThatIsNearestToCursor;
public int i_ofThisLineSpec_insideChartInspectorsLinesSpecsArray;
public void TryRefill_arrayWithNeighboringDatapointValues()
{
TryReconstruct_arrayWithNeighboringDatapointValues();
if (lineSection_isExpanded && datapointValuesSection_isExpanded)
{
for (int i_currentlyFilledSlot_inShortenedInspectorArray = 0; i_currentlyFilledSlot_inShortenedInspectorArray < neighboringDatapointValues.Length; i_currentlyFilledSlot_inShortenedInspectorArray++)
{
if (hasValidDatapointThatIsXNearestToCursor)
{
int slotsDiffernceToCursorSlot = i_currentlyFilledSlot_inShortenedInspectorArray - i_insideShortenedForInspectorArray_markingTheValueAtCursor;
int i_insideLinesDatapointList = i_ofValueInsideLinesDatapointListThatIsXNearestToCursor + slotsDiffernceToCursorSlot;
if (i_insideLinesDatapointList < 0 || i_insideLinesDatapointList >= line_theseSpecsBelongTo.dataPoints.Count)
{
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].x = float.NaN;
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].y = float.NaN;
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].deltaSincePrecedingY = float.NaN;
}
else
{
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].x = line_theseSpecsBelongTo.dataPoints[i_insideLinesDatapointList].xValue;
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].y = line_theseSpecsBelongTo.dataPoints[i_insideLinesDatapointList].yValue;
if (i_insideLinesDatapointList < 1)
{
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].deltaSincePrecedingY = float.NaN;
}
else
{
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].deltaSincePrecedingY = line_theseSpecsBelongTo.dataPoints[i_insideLinesDatapointList].yValue - line_theseSpecsBelongTo.dataPoints[i_insideLinesDatapointList - 1].yValue;
}
}
}
else
{
//Obtainment of "i_ofValueInsideLinesDatapointListThatIsXNearestToCursor" failed:
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].x = float.NaN;
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].y = float.NaN;
neighboringDatapointValues[i_currentlyFilledSlot_inShortenedInspectorArray].deltaSincePrecedingY = float.NaN;
}
}
}
}
void TryReconstruct_arrayWithNeighboringDatapointValues()
{
numberOfDisplayedDatapointsInArray = Mathf.Max(numberOfDisplayedDatapointsInArray, 3);
numberOfDisplayedDatapointsInArray = Mathf.Min(numberOfDisplayedDatapointsInArray, 200); //-> why not exporting to CSV if many datapoints are needed? The editor will have performance problems with higher values
if (numberOfDisplayedDatapointsInArray != neighboringDatapointValues.Length) { Reconstruct_arrayWithNeighboringDatapointValues(); }
}
public void Reconstruct_arrayWithNeighboringDatapointValues()
{
neighboringDatapointValues = new InternalDXXL_NeighboringDatapointForChartInspector[numberOfDisplayedDatapointsInArray];
i_insideShortenedForInspectorArray_markingTheValueAtCursor = Mathf.RoundToInt(0.5f * (neighboringDatapointValues.Length - 1));
for (int i = 0; i < neighboringDatapointValues.Length; i++)
{
neighboringDatapointValues[i] = new InternalDXXL_NeighboringDatapointForChartInspector();
}
}
public void Recalc_posThatIsXNearestToCursor(float xValueOfCursor_inChartspace)
{
Calc_i_ofValueInsideLinesDatapointListThatIsXNearestToCursor(xValueOfCursor_inChartspace);
hasValidDatapointThatIsXNearestToCursor = (i_ofValueInsideLinesDatapointListThatIsXNearestToCursor >= 0);
if (hasValidDatapointThatIsXNearestToCursor)
{
posInChartspace_ofDatapointThatIsNearestToCursor = new Vector2(line_theseSpecsBelongTo.dataPoints[i_ofValueInsideLinesDatapointListThatIsXNearestToCursor].xValue, line_theseSpecsBelongTo.dataPoints[i_ofValueInsideLinesDatapointListThatIsXNearestToCursor].yValue);
}
else
{
posInChartspace_ofDatapointThatIsNearestToCursor = new Vector2(xValueOfCursor_inChartspace, 0.5f);
}
}
void Calc_i_ofValueInsideLinesDatapointListThatIsXNearestToCursor(float xValueOfCursor_inChartspace)
{
if (line_theseSpecsBelongTo.AllXValuesCameFromAutomaticSource)
{
//performance saving assumption: the x values always rise
int i_nearestBelowCursor = -1;
int i_nearestAboveCursor = line_theseSpecsBelongTo.dataPoints.Count;
RestrictPossibleCandidates(10000, out i_nearestBelowCursor, out i_nearestAboveCursor, i_nearestBelowCursor, i_nearestAboveCursor, xValueOfCursor_inChartspace);
RestrictPossibleCandidates(1000, out i_nearestBelowCursor, out i_nearestAboveCursor, i_nearestBelowCursor, i_nearestAboveCursor, xValueOfCursor_inChartspace);
RestrictPossibleCandidates(100, out i_nearestBelowCursor, out i_nearestAboveCursor, i_nearestBelowCursor, i_nearestAboveCursor, xValueOfCursor_inChartspace);
RestrictPossibleCandidates(10, out i_nearestBelowCursor, out i_nearestAboveCursor, i_nearestBelowCursor, i_nearestAboveCursor, xValueOfCursor_inChartspace);
if ((i_nearestBelowCursor < 0) && (i_nearestAboveCursor >= line_theseSpecsBelongTo.dataPoints.Count))
{
//pre-checks that restrict the datapoint candidates failed:
i_ofValueInsideLinesDatapointListThatIsXNearestToCursor = Get_i_datapointThatIsXNearestToCursor_viaBruteForceCheckAllDatapoints(xValueOfCursor_inChartspace);
}
else
{
if (i_nearestBelowCursor == i_nearestAboveCursor) { i_ofValueInsideLinesDatapointListThatIsXNearestToCursor = i_nearestBelowCursor; return; }
//cursor is left of whole line:
if (i_nearestAboveCursor <= 0) { i_ofValueInsideLinesDatapointListThatIsXNearestToCursor = 0; return; }
//cursor is right of whole line:
if (i_nearestBelowCursor >= (line_theseSpecsBelongTo.dataPoints.Count - 1)) { i_ofValueInsideLinesDatapointListThatIsXNearestToCursor = (line_theseSpecsBelongTo.dataPoints.Count - 1); return; }
i_nearestBelowCursor = Mathf.Max(i_nearestBelowCursor, 0);
i_nearestAboveCursor = Mathf.Min(i_nearestAboveCursor, (line_theseSpecsBelongTo.dataPoints.Count - 1));
i_ofValueInsideLinesDatapointListThatIsXNearestToCursor = Get_i_datapointThatIsXNearestToCursor_ofDatapointSpan(xValueOfCursor_inChartspace, i_nearestBelowCursor, i_nearestAboveCursor);
}
}
else
{
//no assumption that the x values always rise:
i_ofValueInsideLinesDatapointListThatIsXNearestToCursor = Get_i_datapointThatIsXNearestToCursor_viaBruteForceCheckAllDatapoints(xValueOfCursor_inChartspace);
}
}
void RestrictPossibleCandidates(int indexDistanceBetweenEachCheckedDatapoint, out int i_nearestBelowCursor, out int i_nearestAboveCursor, int i_nearestBelowCursor_atStartOfCheck, int i_nearestAboveCursor_atStartOfCheck, float xValueOfCursor_inChartspace)
{
i_nearestBelowCursor = i_nearestBelowCursor_atStartOfCheck;
i_nearestAboveCursor = i_nearestAboveCursor_atStartOfCheck;
indexDistanceBetweenEachCheckedDatapoint = Mathf.Max(indexDistanceBetweenEachCheckedDatapoint, 1);
for (int i_currentlyCheckedDatapoint = i_nearestBelowCursor_atStartOfCheck; i_currentlyCheckedDatapoint <= i_nearestAboveCursor_atStartOfCheck;)
{
if (i_currentlyCheckedDatapoint >= 0 && i_currentlyCheckedDatapoint < line_theseSpecsBelongTo.dataPoints.Count)
{
if (line_theseSpecsBelongTo.dataPoints[i_currentlyCheckedDatapoint].validState == InternalDXXL_DataPointOfChartLine.ValidState.isValid)
{
if (line_theseSpecsBelongTo.dataPoints[i_currentlyCheckedDatapoint].xValue < xValueOfCursor_inChartspace)
{
i_nearestBelowCursor = i_currentlyCheckedDatapoint;
}
else
{
i_nearestAboveCursor = i_currentlyCheckedDatapoint;
break;
}
}
}
i_currentlyCheckedDatapoint = i_currentlyCheckedDatapoint + indexDistanceBetweenEachCheckedDatapoint;
}
}
int Get_i_datapointThatIsXNearestToCursor_viaBruteForceCheckAllDatapoints(float xValueOfCursor_inChartspace)
{
return Get_i_datapointThatIsXNearestToCursor_ofDatapointSpan(xValueOfCursor_inChartspace, 0, line_theseSpecsBelongTo.dataPoints.Count - 1);
}
int Get_i_datapointThatIsXNearestToCursor_ofDatapointSpan(float xValueOfCursor_inChartspace, int i_lowSpanEnd, int i_highSpanEnd)
{
//Debug.Log("span: <b>" + (i_highSpanEnd - i_lowSpanEnd) + "</b> i_lowSpanEnd : "+ i_lowSpanEnd + " i_highSpanEnd: "+ i_highSpanEnd);
int i_ofCurrentlyNearest = -1;
float absDistance_ofCurrentlyNearest = float.PositiveInfinity;
for (int i_currentlyCheckedDatapoint = i_lowSpanEnd; i_currentlyCheckedDatapoint <= i_highSpanEnd; i_currentlyCheckedDatapoint++)
{
if (line_theseSpecsBelongTo.dataPoints[i_currentlyCheckedDatapoint].validState == InternalDXXL_DataPointOfChartLine.ValidState.isValid)
{
//some aggressive inlining:
float absDistanceToCursor = line_theseSpecsBelongTo.dataPoints[i_currentlyCheckedDatapoint].xValue - xValueOfCursor_inChartspace;
if (absDistanceToCursor < 0.0f)
{
absDistanceToCursor = -absDistanceToCursor;
}
if (absDistanceToCursor < absDistance_ofCurrentlyNearest)
{
absDistance_ofCurrentlyNearest = absDistanceToCursor;
i_ofCurrentlyNearest = i_currentlyCheckedDatapoint;
}
}
}
return i_ofCurrentlyNearest;
}
public void DrawCursorNearestPoint(float sizeOfDatapointVisualization, bool hiddenByNearerObjects)
{
if (currentHideLineState == false)
{
if ((currentHideCursorXState_duringComponentInspectionPhase == false) || (currentHideCursorYState_duringComponentInspectionPhase == false))
{
if (hasValidDatapointThatIsXNearestToCursor)
{
ChartDrawing parentChart = line_theseSpecsBelongTo.Chart_thisLineIsPartOf;
if (parentChart.IsInsideDrawnChartArea(posInChartspace_ofDatapointThatIsNearestToCursor) || parentChart.drawValuesOutsideOfChartArea)
{
Vector3 position_worldSpace = parentChart.ChartSpace_to_WorldSpace(posInChartspace_ofDatapointThatIsNearestToCursor);
float sizeOfMarkingCross = parentChart.Height_inWorldSpace * (0.01f + 0.6f * sizeOfDatapointVisualization);
Color datapointColor = line_theseSpecsBelongTo.Color;
DrawBasics.Point(position_worldSpace, datapointColor, sizeOfMarkingCross, parentChart.InternalRotation, 0.0f, null, datapointColor, false, false, true, 0.0f, hiddenByNearerObjects);
float circleRadius = 0.14f * sizeOfMarkingCross;
DrawShapes.Decagon(position_worldSpace, circleRadius, datapointColor, parentChart.InternalRotation, 0.0f, null, DrawBasics.LineStyle.solid, 1.0f, DrawBasics.LineStyle.invisible, false, false, 0.0f, hiddenByNearerObjects);
float textSize = 0.3f * sizeOfMarkingCross;
float dimensionSpecifyingTextSize = textSize * 0.5f;
Color color_ofDimensionSpecifier = UtilitiesDXXL_Colors.Get_color_butWithAdjustedAlpha(datapointColor, 0.4f);
if (currentHideCursorYState_duringComponentInspectionPhase == false)
{
UtilitiesDXXL_Text.WriteFramed(" y=", position_worldSpace, color_ofDimensionSpecifier, dimensionSpecifyingTextSize, parentChart.InternalRotation, DrawText.TextAnchorDXXL.LowerLeftOfFirstLine, DrawBasics.LineStyle.invisible, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, parentChart.autoFlipAllText_toFitObsererCamera, 0.0f, hiddenByNearerObjects);
UtilitiesDXXL_Text.WriteFramed(" " + posInChartspace_ofDatapointThatIsNearestToCursor.y, position_worldSpace, datapointColor, textSize, parentChart.InternalRotation, DrawText.TextAnchorDXXL.LowerLeftOfFirstLine, DrawBasics.LineStyle.invisible, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, parentChart.autoFlipAllText_toFitObsererCamera, 0.0f, hiddenByNearerObjects);
}
if (currentHideCursorXState_duringComponentInspectionPhase == false)
{
Vector3 textDir_forXText_normalized = parentChart.yAxis.AxisVector_normalized_inWorldSpace;
Vector3 textUp_forXText_normalized = -parentChart.xAxis.AxisVector_normalized_inWorldSpace;
UtilitiesDXXL_Text.Write(" x=", position_worldSpace, color_ofDimensionSpecifier, dimensionSpecifyingTextSize, textDir_forXText_normalized, textUp_forXText_normalized, DrawText.TextAnchorDXXL.LowerLeftOfFirstLine, DrawBasics.LineStyle.invisible, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, parentChart.autoFlipAllText_toFitObsererCamera, 0.0f, hiddenByNearerObjects, false, false, true);
UtilitiesDXXL_Text.Write(" " + posInChartspace_ofDatapointThatIsNearestToCursor.x, position_worldSpace, datapointColor, textSize, textDir_forXText_normalized, textUp_forXText_normalized, DrawText.TextAnchorDXXL.LowerLeftOfFirstLine, DrawBasics.LineStyle.invisible, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, parentChart.autoFlipAllText_toFitObsererCamera, 0.0f, hiddenByNearerObjects, false, false, true);
}
}
}
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 17d8a010df19ac94abcdc1b898f79166
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
namespace DrawXXL
{
using System;
[Serializable]
public struct InternalDXXL_NeighboringDatapointForChartInspector
{
public float x;
public float y;
public float deltaSincePrecedingY;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e0462d2ff3fca04fb36e93d040db7a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
namespace DrawXXL
{
public class InternalDXXL_TurningPoint //This is "class" instead of "struct" because it should be nullable
{
public PointOfInterest pointOfInterest_thatRepresentsThisTurningPoint;
public bool isTheEndOfAPlateau;
public bool isTheMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bff8d6ed15c7bc947a984463baadaa55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,393 @@
namespace DrawXXL
{
using UnityEngine;
using System.Collections.Generic;
public class InternalDXXL_TurningPointDetector
{
List<InternalDXXL_TurningPoint> allUpperTurningPoints = new List<InternalDXXL_TurningPoint>();
List<InternalDXXL_TurningPoint> allLowerTurningPoints = new List<InternalDXXL_TurningPoint>();
List<InternalDXXL_TurningPoint> turningPoints_thatHighlightOnlyTheOverallHighestYValue = new List<InternalDXXL_TurningPoint>();
List<InternalDXXL_TurningPoint> turningPoints_thatHighlightOnlyTheOverallLowestYValue = new List<InternalDXXL_TurningPoint>();
int i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau;
int i_ofDatapoint_thatIsCurrentCandidateFor_endOfMaxPlateau;
int i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau;
int i_ofDatapoint_thatIsCurrentCandidateFor_endOfMinPlateau;
int i_ofPrecedingDatapoint;
ChartLine line_thisDetectorIsPartOf;
public InternalDXXL_TurningPointDetector(ChartLine line_thisDetectorIsPartOf)
{
this.line_thisDetectorIsPartOf = line_thisDetectorIsPartOf;
DiscardPrecedingPointsFromComparison();
}
public void Clear()
{
allUpperTurningPoints.Clear();
allLowerTurningPoints.Clear();
turningPoints_thatHighlightOnlyTheOverallHighestYValue.Clear();
turningPoints_thatHighlightOnlyTheOverallLowestYValue.Clear();
DiscardPrecedingPointsFromComparison();
}
public void DiscardPrecedingPointsFromComparison()
{
i_ofPrecedingDatapoint = -1;
i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau = -1;
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMaxPlateau = -1;
i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau = -1;
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMinPlateau = -1;
}
public void AddNewDatapoint(int i_newDatapoint)
{
if (line_thisDetectorIsPartOf.dataPoints[i_newDatapoint].validState == InternalDXXL_DataPointOfChartLine.ValidState.isValid)
{
if (i_ofPrecedingDatapoint >= 0)
{
CheckMaxPlateau(i_newDatapoint);
CheckMinPlateau(i_newDatapoint);
}
i_ofPrecedingDatapoint = i_newDatapoint;
}
else
{
//New datapoint is invalid:
DiscardPrecedingPointsFromComparison();
}
}
void CheckMaxPlateau(int i_newDatapoint)
{
if (line_thisDetectorIsPartOf.dataPoints[i_newDatapoint].yValue > line_thisDetectorIsPartOf.dataPoints[i_ofPrecedingDatapoint].yValue)
{
i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau = i_newDatapoint;
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMaxPlateau = i_newDatapoint;
}
else
{
if (line_thisDetectorIsPartOf.dataPoints[i_newDatapoint].yValue == line_thisDetectorIsPartOf.dataPoints[i_ofPrecedingDatapoint].yValue)
{
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMaxPlateau = i_newDatapoint;
}
else
{
if (i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau > 0)
{
CreateTurningPoint_atMaxPlateau();
}
i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau = -1;
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMaxPlateau = -1;
}
}
}
void CreateTurningPoint_atMaxPlateau()
{
bool isPlateauConsistingOfTwoInsteadOfOnlyOnePointOfInterest = (i_ofDatapoint_thatIsCurrentCandidateFor_endOfMaxPlateau != i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau);
//string labelText_atVertLine = isPlateauConsistingOfTwoInsteadOfOnlyOnePointOfInterest ? "start of max" : null; //->would be too packed in many situations
InternalDXXL_TurningPoint turningPoint_atStartOfMaxPlateau = CreateTurningPoint(i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau, "max", false);
InternalDXXL_TurningPoint turningPoint_atEndOfMaxPlateau = null;
if (isPlateauConsistingOfTwoInsteadOfOnlyOnePointOfInterest)
{
turningPoint_atEndOfMaxPlateau = CreateTurningPoint(i_ofDatapoint_thatIsCurrentCandidateFor_endOfMaxPlateau, null, true);
}
bool addToListWithOverallHighestTurningPoints = CompareWith_overallHighestValues();
allUpperTurningPoints.Add(turningPoint_atStartOfMaxPlateau);
if (addToListWithOverallHighestTurningPoints) { turningPoints_thatHighlightOnlyTheOverallHighestYValue.Add(turningPoint_atStartOfMaxPlateau); }
line_thisDetectorIsPartOf.AddPointOfInterest(turningPoint_atStartOfMaxPlateau.pointOfInterest_thatRepresentsThisTurningPoint);
if (turningPoint_atEndOfMaxPlateau != null)
{
allUpperTurningPoints.Add(turningPoint_atEndOfMaxPlateau);
if (addToListWithOverallHighestTurningPoints) { turningPoints_thatHighlightOnlyTheOverallHighestYValue.Add(turningPoint_atEndOfMaxPlateau); }
line_thisDetectorIsPartOf.AddPointOfInterest(turningPoint_atEndOfMaxPlateau.pointOfInterest_thatRepresentsThisTurningPoint);
}
}
bool CompareWith_overallHighestValues()
{
if (turningPoints_thatHighlightOnlyTheOverallHighestYValue.Count > 0)
{
if (line_thisDetectorIsPartOf.dataPoints[i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau].yValue > turningPoints_thatHighlightOnlyTheOverallHighestYValue[0].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position)
{
turningPoints_thatHighlightOnlyTheOverallHighestYValue.Clear();
return true;
}
else
{
if (line_thisDetectorIsPartOf.dataPoints[i_ofDatapoint_thatIsCurrentCandidateFor_startOfMaxPlateau].yValue == turningPoints_thatHighlightOnlyTheOverallHighestYValue[0].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position)
{
return true;
}
else
{
return false;
}
}
}
else
{
return true;
}
}
void CheckMinPlateau(int i_newDatapoint)
{
if (line_thisDetectorIsPartOf.dataPoints[i_newDatapoint].yValue < line_thisDetectorIsPartOf.dataPoints[i_ofPrecedingDatapoint].yValue)
{
i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau = i_newDatapoint;
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMinPlateau = i_newDatapoint;
}
else
{
if (line_thisDetectorIsPartOf.dataPoints[i_newDatapoint].yValue == line_thisDetectorIsPartOf.dataPoints[i_ofPrecedingDatapoint].yValue)
{
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMinPlateau = i_newDatapoint;
}
else
{
if (i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau > 0)
{
CreateTurningPointOf_atMinPlateau();
}
i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau = -1;
i_ofDatapoint_thatIsCurrentCandidateFor_endOfMinPlateau = -1;
}
}
}
void CreateTurningPointOf_atMinPlateau()
{
bool isPlateauConsistingOfTwoInsteadOfOnlyOnePointOfInterest = (i_ofDatapoint_thatIsCurrentCandidateFor_endOfMinPlateau != i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau);
//string labelText_atVertLine = isPlateauConsistingOfTwoInsteadOfOnlyOnePointOfInterest ? "start of min" : null;//->would be too packed in many situations
InternalDXXL_TurningPoint turningPoint_atStartOfMinPlateau = CreateTurningPoint(i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau, "min", false);
InternalDXXL_TurningPoint turningPoint_atEndOfMinPlateau = null;
if (isPlateauConsistingOfTwoInsteadOfOnlyOnePointOfInterest)
{
turningPoint_atEndOfMinPlateau = CreateTurningPoint(i_ofDatapoint_thatIsCurrentCandidateFor_endOfMinPlateau, null, true);
}
bool addToListWithOverallLowestTurningPoints = CompareWith_overallLowestValues();
allLowerTurningPoints.Add(turningPoint_atStartOfMinPlateau);
if (addToListWithOverallLowestTurningPoints) { turningPoints_thatHighlightOnlyTheOverallLowestYValue.Add(turningPoint_atStartOfMinPlateau); }
line_thisDetectorIsPartOf.AddPointOfInterest(turningPoint_atStartOfMinPlateau.pointOfInterest_thatRepresentsThisTurningPoint);
if (turningPoint_atEndOfMinPlateau != null)
{
allLowerTurningPoints.Add(turningPoint_atEndOfMinPlateau);
if (addToListWithOverallLowestTurningPoints) { turningPoints_thatHighlightOnlyTheOverallLowestYValue.Add(turningPoint_atEndOfMinPlateau); }
line_thisDetectorIsPartOf.AddPointOfInterest(turningPoint_atEndOfMinPlateau.pointOfInterest_thatRepresentsThisTurningPoint);
}
}
bool CompareWith_overallLowestValues()
{
if (turningPoints_thatHighlightOnlyTheOverallLowestYValue.Count > 0)
{
if (line_thisDetectorIsPartOf.dataPoints[i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau].yValue < turningPoints_thatHighlightOnlyTheOverallLowestYValue[0].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position)
{
turningPoints_thatHighlightOnlyTheOverallLowestYValue.Clear();
return true;
}
else
{
if (line_thisDetectorIsPartOf.dataPoints[i_ofDatapoint_thatIsCurrentCandidateFor_startOfMinPlateau].yValue == turningPoints_thatHighlightOnlyTheOverallLowestYValue[0].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position)
{
return true;
}
else
{
return false;
}
}
}
else
{
return true;
}
}
InternalDXXL_TurningPoint CreateTurningPoint(int i_ofDatapointWhereToCreate, string labelText_atHorizLine, bool isEndOfPlateau)
{
float position_x = line_thisDetectorIsPartOf.dataPoints[i_ofDatapointWhereToCreate].xValue;
float position_y = line_thisDetectorIsPartOf.dataPoints[i_ofDatapointWhereToCreate].yValue;
PointOfInterest createdPointOfInterest = new PointOfInterest(position_x, position_y, DrawBasics.defaultColor, line_thisDetectorIsPartOf.Chart_thisLineIsPartOf, line_thisDetectorIsPartOf, null);
createdPointOfInterest.drawTextBoxIfPointIsOutsideOfChartArea = false;
createdPointOfInterest.isDeletedOnClear = true;
createdPointOfInterest.forceColorOfParent = true;
//createdPointOfInterest.xValue.labelText = labelText_atVertLine;
createdPointOfInterest.xValue.labelText = null;
createdPointOfInterest.xValue.drawCoordinateAsText = true;
createdPointOfInterest.xValue.lineExtent = DimensionOf_PointOfInterest.LineExtent.axisToPoint;
createdPointOfInterest.xValue.linestylePatternScaleFactor = 0.8f;
createdPointOfInterest.yValue.labelText = labelText_atHorizLine + " = " + line_thisDetectorIsPartOf.dataPoints[i_ofDatapointWhereToCreate].yValue;
createdPointOfInterest.yValue.drawCoordinateAsText = false;
createdPointOfInterest.yValue.lineExtent = DimensionOf_PointOfInterest.LineExtent.axisToPoint;
InternalDXXL_TurningPoint createdTurningPoint = new InternalDXXL_TurningPoint();
createdTurningPoint.pointOfInterest_thatRepresentsThisTurningPoint = createdPointOfInterest;
createdTurningPoint.isTheEndOfAPlateau = isEndOfPlateau;
return createdTurningPoint;
}
public void SetIfVisualizationIsDisplayed()
{
SetIfVisualizationOfYMaximumTurningPointsIsDisplayed();
SetIfVisualizationOfYMinimumTurningPointsIsDisplayed();
SetIfVisualizationOfSingleHighestValueIsDisplayed();
SetIfVisualizationOfSingleLowestValueIsDisplayed();
}
void SetIfVisualizationOfYMaximumTurningPointsIsDisplayed()
{
if (line_thisDetectorIsPartOf.markAllYMaximumTurningPoints)
{
SetVisibleState_forListOf_pointsOfInterest(true, allUpperTurningPoints, true, false);
}
else
{
SetVisibleState_forListOf_pointsOfInterest(false, allUpperTurningPoints, true, false);
}
}
void SetIfVisualizationOfYMinimumTurningPointsIsDisplayed()
{
if (line_thisDetectorIsPartOf.markAllYMinimumTurningPoints)
{
SetVisibleState_forListOf_pointsOfInterest(true, allLowerTurningPoints, false, false);
}
else
{
SetVisibleState_forListOf_pointsOfInterest(false, allLowerTurningPoints, false, false);
}
}
void SetIfVisualizationOfSingleHighestValueIsDisplayed()
{
if (line_thisDetectorIsPartOf.markAllYMaximumTurningPoints == false)
{
//-> all turningPoints are turned to invisible, if arriving here
if (UtilitiesDXXL_Math.ApproximatelyZero(line_thisDetectorIsPartOf.alpha_ofMaxiumumYValueMarker) == false)
{
SetVisibleState_forListOf_pointsOfInterest(true, turningPoints_thatHighlightOnlyTheOverallHighestYValue, true, true);
}
}
}
void SetIfVisualizationOfSingleLowestValueIsDisplayed()
{
if (line_thisDetectorIsPartOf.markAllYMinimumTurningPoints == false)
{
//-> all turningPoints are turned to invisible, if arriving here
if (UtilitiesDXXL_Math.ApproximatelyZero(line_thisDetectorIsPartOf.alpha_ofMinimumYValueMarker) == false)
{
SetVisibleState_forListOf_pointsOfInterest(true, turningPoints_thatHighlightOnlyTheOverallLowestYValue, false, true);
}
}
}
void SetVisibleState_forListOf_pointsOfInterest(bool shouldBeVisible, List<InternalDXXL_TurningPoint> concernedTurningPoints, bool isHighTurningPoint_notLow, bool forceInvisibleIfItIsNotTheMostExtremePointOfTheWholeLine)
{
if (shouldBeVisible)
{
MarkPointsIfTheyAre_theMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight(concernedTurningPoints);
for (int i = 0; i < concernedTurningPoints.Count; i++)
{
if (isHighTurningPoint_notLow)
{
//high turning points:
if (forceInvisibleIfItIsNotTheMostExtremePointOfTheWholeLine)
{
//-> The first and the last datapoint or datapoints beside invalid values can be more extreme but don't count as turning points
float yOfTurningPoint = concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position;
if (yOfTurningPoint < line_thisDetectorIsPartOf.HighestYValue) { continue; }
}
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.xValue.color = new Color(1, 1, 1, line_thisDetectorIsPartOf.alpha_ofMaxiumumYValueMarker); //-> only for setting alpha. The actual color gets forced from lineParent
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.yValue.color = new Color(1, 1, 1, line_thisDetectorIsPartOf.alpha_ofMaxiumumYValueMarker); //-> only for setting alpha. The actual color gets forced from lineParent
}
else
{
//low turning points:
if (forceInvisibleIfItIsNotTheMostExtremePointOfTheWholeLine)
{
//-> The first and the last datapoint or datapoints beside invalid values can be more extreme but don't count as turning points
float yOfTurningPoint = concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position;
if (yOfTurningPoint > line_thisDetectorIsPartOf.LowestYValue) { continue; }
}
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.xValue.color = new Color(1, 1, 1, line_thisDetectorIsPartOf.alpha_ofMinimumYValueMarker); //-> only for setting alpha. The actual color gets forced from lineParent
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.yValue.color = new Color(1, 1, 1, line_thisDetectorIsPartOf.alpha_ofMinimumYValueMarker); //-> only for setting alpha. The actual color gets forced from lineParent
}
DrawBasics.LineStyle linestyle_forHorizLine = DrawBasics.LineStyle.solid;
if (concernedTurningPoints[i].isTheEndOfAPlateau) { linestyle_forHorizLine = DrawBasics.LineStyle.invisible; }
if (concernedTurningPoints[i].isTheMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight == false) { linestyle_forHorizLine = DrawBasics.LineStyle.invisible; } //-> This prevents multiple points at the same yHeight from adding up their alpha from the horizontal low alpha turningPointMarkerLines until it is almost alpha=1 and is not distinguishable anymore from the dataLine itself.
if (line_thisDetectorIsPartOf.disableMinMaxYVisualizers_dueTo_lineRepresentsBoolValues) { linestyle_forHorizLine = DrawBasics.LineStyle.invisible; }
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.xValue.lineStyle = DrawBasics.LineStyle.dashed;
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.yValue.lineStyle = linestyle_forHorizLine;
}
}
else
{
for (int i = 0; i < concernedTurningPoints.Count; i++)
{
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.xValue.lineStyle = DrawBasics.LineStyle.invisible;
concernedTurningPoints[i].pointOfInterest_thatRepresentsThisTurningPoint.yValue.lineStyle = DrawBasics.LineStyle.invisible;
}
}
}
void MarkPointsIfTheyAre_theMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight(List<InternalDXXL_TurningPoint> concernedTurningPoints)
{
for (int i_currCheckedTurningPoint = 0; i_currCheckedTurningPoint < concernedTurningPoints.Count; i_currCheckedTurningPoint++)
{
if (concernedTurningPoints[i_currCheckedTurningPoint].isTheEndOfAPlateau)
{
concernedTurningPoints[i_currCheckedTurningPoint].isTheMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight = false;
continue;
}
else
{
concernedTurningPoints[i_currCheckedTurningPoint].isTheMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight = true;
}
for (int i_currLowerComparedTurningPoint = 0; i_currLowerComparedTurningPoint < i_currCheckedTurningPoint; i_currLowerComparedTurningPoint++)
{
if (concernedTurningPoints[i_currLowerComparedTurningPoint].isTheEndOfAPlateau)
{
continue;
}
else
{
float y_ofCurrCheckedTurningPoint = concernedTurningPoints[i_currCheckedTurningPoint].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position;
float y_ofCurrLowerComparedTurningPoint = concernedTurningPoints[i_currLowerComparedTurningPoint].pointOfInterest_thatRepresentsThisTurningPoint.yValue.position;
if (UtilitiesDXXL_Math.CheckIf_twoFloatsAreApproximatelyEqual(y_ofCurrCheckedTurningPoint, y_ofCurrLowerComparedTurningPoint))
{
float x_ofCurrCheckedTurningPoint = concernedTurningPoints[i_currCheckedTurningPoint].pointOfInterest_thatRepresentsThisTurningPoint.xValue.position;
float x_ofCurrLowerComparedTurningPoint = concernedTurningPoints[i_currLowerComparedTurningPoint].pointOfInterest_thatRepresentsThisTurningPoint.xValue.position;
if (x_ofCurrCheckedTurningPoint > x_ofCurrLowerComparedTurningPoint)
{
concernedTurningPoints[i_currLowerComparedTurningPoint].isTheMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight = false;
}
else
{
concernedTurningPoints[i_currCheckedTurningPoint].isTheMostRightOf_theNonPlataueEndTurningPointsAtSameYHeight = false;
break;
}
}
}
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e7190062bd9564f4eb7527ea9c08d402
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a7bf68dbb34f7c041bb4f776bea9575f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,163 @@
namespace DrawXXL
{
public class UtilitiesDXXL_ChartLine
{
public delegate bool IsDrawnBecause_theSingleComponentOfMulticomponentData_thisLineRepresents_isEnabledChecker(DataComponentsThatAreDrawn dataComponentsThatAreDrawn);
//Non-multiComponentData:
public static bool DoDrawBecauseLineDoesntRepresentMultiComponentData(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return true;
}
//Vector2:
public static bool DrawIf_vector2_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector2_x;
}
public static bool DrawIf_vector2_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector2_y;
}
//Vector3:
public static bool DrawIf_vector3_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector3_x;
}
public static bool DrawIf_vector3_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector3_y;
}
public static bool DrawIf_vector3_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector3_z;
}
//Vector4:
public static bool DrawIf_vector4_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector4_x;
}
public static bool DrawIf_vector4_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector4_y;
}
public static bool DrawIf_vector4_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector4_z;
}
public static bool DrawIf_vector4_w_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.vector4_w;
}
//Color:
public static bool DrawIf_color_r_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.color_r;
}
public static bool DrawIf_color_g_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.color_g;
}
public static bool DrawIf_color_b_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.color_b;
}
public static bool DrawIf_color_a_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.color_a;
}
//Rotation:
public static bool DrawIf_rotation_eulerX_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.rotation_eulerX;
}
public static bool DrawIf_rotation_eulerY_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.rotation_eulerY;
}
public static bool DrawIf_rotation_eulerZ_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.rotation_eulerZ;
}
//Transform:
public static bool DrawIf_localPosition_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localPosition_x;
}
public static bool DrawIf_localPosition_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localPosition_y;
}
public static bool DrawIf_localPosition_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localPosition_z;
}
public static bool DrawIf_localEulerAngle_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localEulerAngle_x;
}
public static bool DrawIf_localEulerAngle_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localEulerAngle_y;
}
public static bool DrawIf_localEulerAngle_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localEulerAngle_z;
}
public static bool DrawIf_localScale_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localScale_x;
}
public static bool DrawIf_localScale_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localScale_y;
}
public static bool DrawIf_localScale_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.localScale_z;
}
public static bool DrawIf_globalPosition_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.globalPosition_x;
}
public static bool DrawIf_globalPosition_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.globalPosition_y;
}
public static bool DrawIf_globalPosition_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.globalPosition_z;
}
public static bool DrawIf_globalEulerAngle_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.globalEulerAngle_x;
}
public static bool DrawIf_globalEulerAngle_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.globalEulerAngle_y;
}
public static bool DrawIf_globalEulerAngle_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.globalEulerAngle_z;
}
public static bool DrawIf_lossyScale_x_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.lossyScale_x;
}
public static bool DrawIf_lossyScale_y_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.lossyScale_y;
}
public static bool DrawIf_lossyScale_z_isEnabled(DataComponentsThatAreDrawn dataComponentsThatAreDrawn)
{
return dataComponentsThatAreDrawn.lossyScale_z;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c62dec88fec09a3458a145bf8261f5c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: