IReport is added
This commit is contained in:
@@ -12,16 +12,16 @@ namespace FieldVisualizer.Services.ColorServices
|
||||
const byte Alpha = 0xff;
|
||||
public static Color GetColorByValue(IValueRange range, IColorMap map, double val)
|
||||
{
|
||||
if (range.TopValue == range.BottomValue || map.Colors.Count == 0) { return map.Colors[0]; }
|
||||
double minVal = range.BottomValue - 1e-15d*(Math.Abs(range.BottomValue));
|
||||
double maxVal = range.TopValue + 1e-15d * (Math.Abs(range.TopValue));
|
||||
if (range.TopValue == minVal || map.Colors.Count == 0) { return map.Colors[0]; }
|
||||
if (val > maxVal || val < minVal) { return Colors.Gray; }
|
||||
if (val == minVal) { return map.Colors[0]; }
|
||||
if (val == maxVal) { return map.Colors[map.Colors.Count - 1]; }
|
||||
|
||||
double valPerc = (val - minVal) / (maxVal - minVal);// value%
|
||||
//if (valPerc == 1d)
|
||||
//{ return map.Colors[map.Colors.Count - 1]; }
|
||||
if (valPerc >= 1d)
|
||||
{ return map.Colors[map.Colors.Count - 1]; }
|
||||
double colorPerc = 1d / (map.Colors.Count - 1d); // % of each block of color. the last is the "100% Color"
|
||||
double blockOfColor = valPerc / colorPerc;// the integer part repersents how many block to skip
|
||||
int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using FieldVisualizer.Entities.Values.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Services.PrimitiveServices
|
||||
{
|
||||
public static class TestPrimitivesOperation
|
||||
{
|
||||
public static List<IPrimitiveSet> AddTestPrimitives()
|
||||
{
|
||||
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||
int imax = 100;
|
||||
int jmax = 100;
|
||||
PrimitiveSet primitiveSet = new PrimitiveSet();
|
||||
primitiveSets.Add(primitiveSet);
|
||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||
primitiveSet.ValuePrimitives = primitives;
|
||||
IValuePrimitive primitive;
|
||||
for (int i = 0; i < imax; i++)
|
||||
{
|
||||
for (int j = 0; j < jmax; j++)
|
||||
{
|
||||
primitive = new RectanglePrimitive() { Height = 10, Width = 20, CenterX = 20 * i, CenterY = 10 * j, Value = -(i + j) };
|
||||
primitives.Add(primitive);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
primitive = new CirclePrimitive() { Diameter = 150, CenterX = -200 * i, CenterY = -100 * j, Value = i * 100 + j * 200 };
|
||||
primitives.Add(primitive);
|
||||
}
|
||||
}
|
||||
primitiveSet = new PrimitiveSet();
|
||||
primitives = new List<IValuePrimitive>();
|
||||
primitive = new RectanglePrimitive() { Height = 100, Width = 200, CenterX = 0, CenterY = 0, Value = 100 };
|
||||
primitives.Add(primitive);
|
||||
primitive = new CirclePrimitive() { Diameter = 50, CenterX = 0, CenterY = 0, Value = -100 };
|
||||
primitives.Add(primitive);
|
||||
primitiveSet.ValuePrimitives = primitives;
|
||||
primitiveSets.Add(primitiveSet);
|
||||
return primitiveSets;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user