diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-05 10:55:51 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-05 10:55:51 +0200 |
| commit | a9c3b16522c1aab52a6f4c6d6441f889fe4cb679 (patch) | |
| tree | efcc931ce936a970dd853e0ddbeeed2d8a49760d | |
| parent | 6561bc7a1beb1cd16a137b99208bbc76ee62e0a8 (diff) | |
| download | Tango-a9c3b16522c1aab52a6f4c6d6441f889fe4cb679.tar.gz Tango-a9c3b16522c1aab52a6f4c6d6441f889fe4cb679.zip | |
Implemented unit testing for ColorLib.
28 files changed, 721 insertions, 218 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex e2dc922b3..ac22e06a7 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex ed8f048fc..3a9731df2 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/PMR/Messages/ColorLab/CalibrationData.proto b/Software/PMR/Messages/ColorLab/CalibrationData.proto new file mode 100644 index 000000000..0d32af8a2 --- /dev/null +++ b/Software/PMR/Messages/ColorLab/CalibrationData.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "CalibrationPoint.proto"; + +package Tango.PMR.ColorLab; +option java_package = "com.twine.tango.pmr.colorlab"; + + +message CalibrationData +{ + repeated CalibrationPoint CalibrationPoints = 1; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/ColorLab/ConversionInput.proto b/Software/PMR/Messages/ColorLab/ConversionInput.proto index c83ed14cd..9b04af4f3 100644 --- a/Software/PMR/Messages/ColorLab/ConversionInput.proto +++ b/Software/PMR/Messages/ColorLab/ConversionInput.proto @@ -4,7 +4,7 @@ package Tango.PMR.ColorLab; option java_package = "com.twine.tango.pmr.colorlab"; import "InputColor.proto"; -import "CalibrationPoint.proto"; +import "CalibrationData.proto"; message ConversionInput { @@ -14,6 +14,6 @@ message ConversionInput InputColor Input = 4; bytes ForwardData = 5; bytes InverseData = 6; - repeated CalibrationPoint CalibrationData = 7; + CalibrationData CalibrationData = 7; double SegmentLength = 8; }
\ No newline at end of file diff --git a/Software/PMR/Messages/ColorLab/InputColor.proto b/Software/PMR/Messages/ColorLab/InputColor.proto index 422366f80..abc07d267 100644 --- a/Software/PMR/Messages/ColorLab/InputColor.proto +++ b/Software/PMR/Messages/ColorLab/InputColor.proto @@ -25,10 +25,10 @@ message InputColor double A = 11; double B = 12; - double V0 = 13; - double V1 = 14; - double V2 = 15; - double V3 = 16; + double CV = 13; + double MV = 14; + double YV = 15; + double KV = 16; double V4 = 17; double V5 = 18; double V6 = 19; diff --git a/Software/PMR/Messages/ColorLab/OutputColor.proto b/Software/PMR/Messages/ColorLab/OutputColor.proto index cdc759e93..3896648ae 100644 --- a/Software/PMR/Messages/ColorLab/OutputColor.proto +++ b/Software/PMR/Messages/ColorLab/OutputColor.proto @@ -10,10 +10,10 @@ message OutputColor int32 Green = 2; int32 Blue = 3; - double V0 = 4; - double V1 = 5; - double V2 = 6; - double V3 = 7; + double CV = 4; + double MV = 5; + double YV = 6; + double KV = 7; double V4 = 8; double V5 = 9; double V6 = 10; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 22e162c0e..4be818a3e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -1150,7 +1150,7 @@ <Setter.Value> <StackPanel Orientation="Horizontal"> <ContentControl Style="{StaticResource numberBorder}" Foreground="Gray" Width="50" Height="50" Margin="10 0 0 0"> - <mahapps:NumericUpDown FontSize="14" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding L, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="-100" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown FontSize="14" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding L, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="0" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> <mahapps:NumericUpDown.Resources> <Style TargetType="TextBox"/> </mahapps:NumericUpDown.Resources> @@ -1158,7 +1158,7 @@ </ContentControl> <ContentControl Style="{StaticResource numberBorder}" Foreground="#FF8A8A" Width="50" Height="50" Margin="10 0 0 0"> - <mahapps:NumericUpDown FontSize="14" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding A, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="-100" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown FontSize="14" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding A, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="-128" Maximum="128" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> <mahapps:NumericUpDown.Resources> <Style TargetType="TextBox"/> </mahapps:NumericUpDown.Resources> @@ -1166,7 +1166,7 @@ </ContentControl> <ContentControl Style="{StaticResource numberBorder}" Foreground="#92FF92" Width="50" Height="50" Margin="10 0 0 0"> - <mahapps:NumericUpDown FontSize="14" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding B, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="-100" Maximum="100" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown FontSize="14" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding B, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="-128" Maximum="128" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> <mahapps:NumericUpDown.Resources> <Style TargetType="TextBox"/> </mahapps:NumericUpDown.Resources> diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp index 03637e750..97ed7d048 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp @@ -41,6 +41,10 @@ size_t Tango::ColorLib::ColorConverter::ForwardConvert(uint8_t * input_buffer, s color->green = 2; color->blue = 3; + color->has_red = true; + color->has_green = true; + color->has_blue = true; + suggestions[i] = color; } diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/CalibrationData.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/CalibrationData.pb-c.c new file mode 100644 index 000000000..16d4bba56 --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/CalibrationData.pb-c.c @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: CalibrationData.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "CalibrationData.pb-c.h" +void calibration_data__init + (CalibrationData *message) +{ + static const CalibrationData init_value = CALIBRATION_DATA__INIT; + *message = init_value; +} +size_t calibration_data__get_packed_size + (const CalibrationData *message) +{ + assert(message->base.descriptor == &calibration_data__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t calibration_data__pack + (const CalibrationData *message, + uint8_t *out) +{ + assert(message->base.descriptor == &calibration_data__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t calibration_data__pack_to_buffer + (const CalibrationData *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &calibration_data__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +CalibrationData * + calibration_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (CalibrationData *) + protobuf_c_message_unpack (&calibration_data__descriptor, + allocator, len, data); +} +void calibration_data__free_unpacked + (CalibrationData *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &calibration_data__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor calibration_data__field_descriptors[1] = +{ + { + "CalibrationPoints", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(CalibrationData, n_calibrationpoints), + offsetof(CalibrationData, calibrationpoints), + &calibration_point__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned calibration_data__field_indices_by_name[] = { + 0, /* field[0] = CalibrationPoints */ +}; +static const ProtobufCIntRange calibration_data__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor calibration_data__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "CalibrationData", + "CalibrationData", + "CalibrationData", + "", + sizeof(CalibrationData), + 1, + calibration_data__field_descriptors, + calibration_data__field_indices_by_name, + 1, calibration_data__number_ranges, + (ProtobufCMessageInit) calibration_data__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/CalibrationData.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/CalibrationData.pb-c.h new file mode 100644 index 000000000..993056a04 --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/CalibrationData.pb-c.h @@ -0,0 +1,73 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: CalibrationData.proto */ + +#ifndef PROTOBUF_C_CalibrationData_2eproto__INCLUDED +#define PROTOBUF_C_CalibrationData_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "CalibrationPoint.pb-c.h" + +typedef struct _CalibrationData CalibrationData; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _CalibrationData +{ + ProtobufCMessage base; + size_t n_calibrationpoints; + CalibrationPoint **calibrationpoints; +}; +#define CALIBRATION_DATA__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&calibration_data__descriptor) \ + , 0,NULL } + + +/* CalibrationData methods */ +void calibration_data__init + (CalibrationData *message); +size_t calibration_data__get_packed_size + (const CalibrationData *message); +size_t calibration_data__pack + (const CalibrationData *message, + uint8_t *out); +size_t calibration_data__pack_to_buffer + (const CalibrationData *message, + ProtobufCBuffer *buffer); +CalibrationData * + calibration_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void calibration_data__free_unpacked + (CalibrationData *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*CalibrationData_Closure) + (const CalibrationData *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor calibration_data__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_CalibrationData_2eproto__INCLUDED */ diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c index 8df9d0bb7..7fbeb8d03 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c @@ -129,11 +129,11 @@ static const ProtobufCFieldDescriptor conversion_input__field_descriptors[8] = { "CalibrationData", 7, - PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, - offsetof(ConversionInput, n_calibrationdata), + 0, /* quantifier_offset */ offsetof(ConversionInput, calibrationdata), - &calibration_point__descriptor, + &calibration_data__descriptor, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h index 15ef192de..101f82b7d 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h @@ -15,7 +15,7 @@ PROTOBUF_C__BEGIN_DECLS #endif #include "InputColor.pb-c.h" -#include "CalibrationPoint.pb-c.h" +#include "CalibrationData.pb-c.h" typedef struct _ConversionInput ConversionInput; @@ -39,14 +39,13 @@ struct _ConversionInput ProtobufCBinaryData forwarddata; protobuf_c_boolean has_inversedata; ProtobufCBinaryData inversedata; - size_t n_calibrationdata; - CalibrationPoint **calibrationdata; + CalibrationData *calibrationdata; protobuf_c_boolean has_segmentlength; double segmentlength; }; #define CONVERSION_INPUT__INIT \ { PROTOBUF_C_MESSAGE_INIT (&conversion_input__descriptor) \ - , 0, 0, 0, 0, 0, 0, NULL, 0, {0,NULL}, 0, {0,NULL}, 0,NULL, 0, 0 } + , 0, 0, 0, 0, 0, 0, NULL, 0, {0,NULL}, 0, {0,NULL}, NULL, 0, 0 } /* ConversionInput methods */ diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.c index 46cbadad2..2e5424bd8 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.c +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.c @@ -199,48 +199,48 @@ static const ProtobufCFieldDescriptor input_color__field_descriptors[21] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V0", + "CV", 13, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(InputColor, has_v0), - offsetof(InputColor, v0), + offsetof(InputColor, has_cv), + offsetof(InputColor, cv), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V1", + "MV", 14, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(InputColor, has_v1), - offsetof(InputColor, v1), + offsetof(InputColor, has_mv), + offsetof(InputColor, mv), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V2", + "YV", 15, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(InputColor, has_v2), - offsetof(InputColor, v2), + offsetof(InputColor, has_yv), + offsetof(InputColor, yv), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V3", + "KV", 16, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(InputColor, has_v3), - offsetof(InputColor, v3), + offsetof(InputColor, has_kv), + offsetof(InputColor, kv), NULL, NULL, 0, /* flags */ @@ -312,22 +312,22 @@ static const unsigned input_color__field_indices_by_name[] = { 11, /* field[11] = B */ 8, /* field[8] = Black */ 4, /* field[4] = Blue */ + 12, /* field[12] = CV */ 0, /* field[0] = ColorSpace */ 5, /* field[5] = Cyan */ 3, /* field[3] = Green */ + 15, /* field[15] = KV */ 9, /* field[9] = L */ 1, /* field[1] = Length */ + 13, /* field[13] = MV */ 6, /* field[6] = Magenta */ 20, /* field[20] = PantonCode */ 2, /* field[2] = Red */ - 12, /* field[12] = V0 */ - 13, /* field[13] = V1 */ - 14, /* field[14] = V2 */ - 15, /* field[15] = V3 */ 16, /* field[16] = V4 */ 17, /* field[17] = V5 */ 18, /* field[18] = V6 */ 19, /* field[19] = V7 */ + 14, /* field[14] = YV */ 7, /* field[7] = Yellow */ }; static const ProtobufCIntRange input_color__number_ranges[1 + 1] = diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.h index 8c27cc66b..d9f67383a 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.h +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputColor.pb-c.h @@ -51,14 +51,14 @@ struct _InputColor double a; protobuf_c_boolean has_b; double b; - protobuf_c_boolean has_v0; - double v0; - protobuf_c_boolean has_v1; - double v1; - protobuf_c_boolean has_v2; - double v2; - protobuf_c_boolean has_v3; - double v3; + protobuf_c_boolean has_cv; + double cv; + protobuf_c_boolean has_mv; + double mv; + protobuf_c_boolean has_yv; + double yv; + protobuf_c_boolean has_kv; + double kv; protobuf_c_boolean has_v4; double v4; protobuf_c_boolean has_v5; diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.c index 2625a45f8..35d507fac 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.c +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.c @@ -91,48 +91,48 @@ static const ProtobufCFieldDescriptor output_color__field_descriptors[13] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V0", + "CV", 4, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(OutputColor, has_v0), - offsetof(OutputColor, v0), + offsetof(OutputColor, has_cv), + offsetof(OutputColor, cv), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V1", + "MV", 5, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(OutputColor, has_v1), - offsetof(OutputColor, v1), + offsetof(OutputColor, has_mv), + offsetof(OutputColor, mv), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V2", + "YV", 6, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(OutputColor, has_v2), - offsetof(OutputColor, v2), + offsetof(OutputColor, has_yv), + offsetof(OutputColor, yv), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "V3", + "KV", 7, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_DOUBLE, - offsetof(OutputColor, has_v3), - offsetof(OutputColor, v3), + offsetof(OutputColor, has_kv), + offsetof(OutputColor, kv), NULL, NULL, 0, /* flags */ @@ -213,18 +213,18 @@ static const ProtobufCFieldDescriptor output_color__field_descriptors[13] = }; static const unsigned output_color__field_indices_by_name[] = { 2, /* field[2] = Blue */ + 3, /* field[3] = CV */ 1, /* field[1] = Green */ + 6, /* field[6] = KV */ 11, /* field[11] = Length */ + 4, /* field[4] = MV */ 12, /* field[12] = ProcessParametersTableIndex */ 0, /* field[0] = Red */ - 3, /* field[3] = V0 */ - 4, /* field[4] = V1 */ - 5, /* field[5] = V2 */ - 6, /* field[6] = V3 */ 7, /* field[7] = V4 */ 8, /* field[8] = V5 */ 9, /* field[9] = V6 */ 10, /* field[10] = V7 */ + 5, /* field[5] = YV */ }; static const ProtobufCIntRange output_color__number_ranges[1 + 1] = { diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.h index c80c0e418..0c794c46c 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.h +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/OutputColor.pb-c.h @@ -32,14 +32,14 @@ struct _OutputColor int32_t green; protobuf_c_boolean has_blue; int32_t blue; - protobuf_c_boolean has_v0; - double v0; - protobuf_c_boolean has_v1; - double v1; - protobuf_c_boolean has_v2; - double v2; - protobuf_c_boolean has_v3; - double v3; + protobuf_c_boolean has_cv; + double cv; + protobuf_c_boolean has_mv; + double mv; + protobuf_c_boolean has_yv; + double yv; + protobuf_c_boolean has_kv; + double kv; protobuf_c_boolean has_v4; double v4; protobuf_c_boolean has_v5; diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj index 58c610ef3..4b9ffd3a2 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj @@ -149,6 +149,7 @@ </ItemGroup> <ItemGroup> <ClInclude Include="ColorConverter.h" /> + <ClInclude Include="PMR\ColorLab\CalibrationData.pb-c.h" /> <ClInclude Include="PMR\ColorLab\CalibrationPoint.pb-c.h" /> <ClInclude Include="PMR\ColorLab\ColorSpace.pb-c.h" /> <ClInclude Include="PMR\ColorLab\ConversionInput.pb-c.h" /> @@ -167,6 +168,7 @@ <ItemGroup> <ClCompile Include="ColorConverter.cpp" /> <ClCompile Include="Exports.cpp" /> + <ClCompile Include="PMR\ColorLab\CalibrationData.pb-c.c" /> <ClCompile Include="PMR\ColorLab\CalibrationPoint.pb-c.c" /> <ClCompile Include="PMR\ColorLab\ColorSpace.pb-c.c" /> <ClCompile Include="PMR\ColorLab\ConversionInput.pb-c.c" /> diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters index 871011841..e10d4b7c5 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters @@ -66,6 +66,9 @@ <ClInclude Include="PMR\ColorLab\CalibrationPoint.pb-c.h"> <Filter>PMR</Filter> </ClInclude> + <ClInclude Include="PMR\ColorLab\CalibrationData.pb-c.h"> + <Filter>PMR</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="PMR\Common\ErrorCode.pb-c.c"> @@ -113,5 +116,8 @@ <ClCompile Include="PMR\ColorLab\ColorSpace.pb-c.c"> <Filter>PMR</Filter> </ClCompile> + <ClCompile Include="PMR\ColorLab\CalibrationData.pb-c.c"> + <Filter>PMR</Filter> + </ClCompile> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs index 79353e7cc..c18f2cc26 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs @@ -35,9 +35,12 @@ namespace Tango.Core.Helpers if (_dispatcher == null) { LogManager.Log(new NullReferenceException("The UI dispatcher was not set!")); + action(); + } + else + { + _dispatcher.BeginInvoke(action); } - - _dispatcher.BeginInvoke(action); } /// <summary> @@ -49,9 +52,12 @@ namespace Tango.Core.Helpers if (_dispatcher == null) { LogManager.Log(new NullReferenceException("The UI dispatcher was not set!")); + action(); + } + else + { + _dispatcher.Invoke(action); } - - _dispatcher.Invoke(action); } /// <summary> diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Cat.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Cat.cs new file mode 100644 index 000000000..50c1c52a6 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Cat.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.ColorLab; + +namespace Tango.Integration.Observables +{ + public partial class Cat + { + public CalibrationData GetCalibrationData() + { + return CalibrationData.Parser.ParseFrom(Data); + } + + public CalibrationData CreateDemoCalibrationData() + { + CalibrationData data = new CalibrationData(); + + for (int i = 0; i < 10; i++) + { + for (int j = 0; j < 10; j++) + { + data.CalibrationPoints.Add(new CalibrationPoint() + { + X = i, Y = j + }); + } + } + + return data; + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index db4a8bd72..ae6147aff 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -159,6 +159,7 @@ <Compile Include="Observables\ObservablesContext.cs" /> <Compile Include="Observables\ObservablesEntitiesAdapter.cs" /> <Compile Include="Observables\ObservablesEntitiesAdapterExtension.cs" /> + <Compile Include="Observables\Partials\Cat.cs" /> <Compile Include="Printing\BrushStop.cs" /> <Compile Include="Observables\Partials\Configuration.cs" /> <Compile Include="Observables\Partials\Machine.cs" /> diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/CalibrationData.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/CalibrationData.cs new file mode 100644 index 000000000..8af16441b --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/CalibrationData.cs @@ -0,0 +1,153 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: CalibrationData.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.ColorLab { + + /// <summary>Holder for reflection information generated from CalibrationData.proto</summary> + public static partial class CalibrationDataReflection { + + #region Descriptor + /// <summary>File descriptor for CalibrationData.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CalibrationDataReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChVDYWxpYnJhdGlvbkRhdGEucHJvdG8SElRhbmdvLlBNUi5Db2xvckxhYhoW", + "Q2FsaWJyYXRpb25Qb2ludC5wcm90byJSCg9DYWxpYnJhdGlvbkRhdGESPwoR", + "Q2FsaWJyYXRpb25Qb2ludHMYASADKAsyJC5UYW5nby5QTVIuQ29sb3JMYWIu", + "Q2FsaWJyYXRpb25Qb2ludEIeChxjb20udHdpbmUudGFuZ28ucG1yLmNvbG9y", + "bGFiYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.CalibrationPointReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.CalibrationData), global::Tango.PMR.ColorLab.CalibrationData.Parser, new[]{ "CalibrationPoints" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class CalibrationData : pb::IMessage<CalibrationData> { + private static readonly pb::MessageParser<CalibrationData> _parser = new pb::MessageParser<CalibrationData>(() => new CalibrationData()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<CalibrationData> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.ColorLab.CalibrationDataReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CalibrationData() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CalibrationData(CalibrationData other) : this() { + calibrationPoints_ = other.calibrationPoints_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CalibrationData Clone() { + return new CalibrationData(this); + } + + /// <summary>Field number for the "CalibrationPoints" field.</summary> + public const int CalibrationPointsFieldNumber = 1; + private static readonly pb::FieldCodec<global::Tango.PMR.ColorLab.CalibrationPoint> _repeated_calibrationPoints_codec + = pb::FieldCodec.ForMessage(10, global::Tango.PMR.ColorLab.CalibrationPoint.Parser); + private readonly pbc::RepeatedField<global::Tango.PMR.ColorLab.CalibrationPoint> calibrationPoints_ = new pbc::RepeatedField<global::Tango.PMR.ColorLab.CalibrationPoint>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Tango.PMR.ColorLab.CalibrationPoint> CalibrationPoints { + get { return calibrationPoints_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CalibrationData); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CalibrationData other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!calibrationPoints_.Equals(other.calibrationPoints_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= calibrationPoints_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + calibrationPoints_.WriteTo(output, _repeated_calibrationPoints_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += calibrationPoints_.CalculateSize(_repeated_calibrationPoints_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CalibrationData other) { + if (other == null) { + return; + } + calibrationPoints_.Add(other.calibrationPoints_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + calibrationPoints_.AddEntriesFrom(input, _repeated_calibrationPoints_codec); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs index c011b6b4d..e2d7342b2 100644 --- a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs @@ -23,16 +23,16 @@ namespace Tango.PMR.ColorLab { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChVDb252ZXJzaW9uSW5wdXQucHJvdG8SElRhbmdvLlBNUi5Db2xvckxhYhoQ", - "SW5wdXRDb2xvci5wcm90bxoWQ2FsaWJyYXRpb25Qb2ludC5wcm90byLzAQoP", - "Q29udmVyc2lvbklucHV0Eg8KB1RocmVhZEwYASABKAESDwoHVGhyZWFkQRgC", - "IAEoARIPCgdUaHJlYWRCGAMgASgBEi0KBUlucHV0GAQgASgLMh4uVGFuZ28u", - "UE1SLkNvbG9yTGFiLklucHV0Q29sb3ISEwoLRm9yd2FyZERhdGEYBSABKAwS", - "EwoLSW52ZXJzZURhdGEYBiABKAwSPQoPQ2FsaWJyYXRpb25EYXRhGAcgAygL", - "MiQuVGFuZ28uUE1SLkNvbG9yTGFiLkNhbGlicmF0aW9uUG9pbnQSFQoNU2Vn", - "bWVudExlbmd0aBgIIAEoAUIeChxjb20udHdpbmUudGFuZ28ucG1yLmNvbG9y", - "bGFiYgZwcm90bzM=")); + "SW5wdXRDb2xvci5wcm90bxoVQ2FsaWJyYXRpb25EYXRhLnByb3RvIvIBCg9D", + "b252ZXJzaW9uSW5wdXQSDwoHVGhyZWFkTBgBIAEoARIPCgdUaHJlYWRBGAIg", + "ASgBEg8KB1RocmVhZEIYAyABKAESLQoFSW5wdXQYBCABKAsyHi5UYW5nby5Q", + "TVIuQ29sb3JMYWIuSW5wdXRDb2xvchITCgtGb3J3YXJkRGF0YRgFIAEoDBIT", + "CgtJbnZlcnNlRGF0YRgGIAEoDBI8Cg9DYWxpYnJhdGlvbkRhdGEYByABKAsy", + "Iy5UYW5nby5QTVIuQ29sb3JMYWIuQ2FsaWJyYXRpb25EYXRhEhUKDVNlZ21l", + "bnRMZW5ndGgYCCABKAFCHgocY29tLnR3aW5lLnRhbmdvLnBtci5jb2xvcmxh", + "YmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.InputColorReflection.Descriptor, global::Tango.PMR.ColorLab.CalibrationPointReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.InputColorReflection.Descriptor, global::Tango.PMR.ColorLab.CalibrationDataReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.ConversionInput), global::Tango.PMR.ColorLab.ConversionInput.Parser, new[]{ "ThreadL", "ThreadA", "ThreadB", "Input", "ForwardData", "InverseData", "CalibrationData", "SegmentLength" }, null, null, null) })); @@ -71,7 +71,7 @@ namespace Tango.PMR.ColorLab { Input = other.input_ != null ? other.Input.Clone() : null; forwardData_ = other.forwardData_; inverseData_ = other.inverseData_; - calibrationData_ = other.calibrationData_.Clone(); + CalibrationData = other.calibrationData_ != null ? other.CalibrationData.Clone() : null; segmentLength_ = other.segmentLength_; } @@ -148,12 +148,13 @@ namespace Tango.PMR.ColorLab { /// <summary>Field number for the "CalibrationData" field.</summary> public const int CalibrationDataFieldNumber = 7; - private static readonly pb::FieldCodec<global::Tango.PMR.ColorLab.CalibrationPoint> _repeated_calibrationData_codec - = pb::FieldCodec.ForMessage(58, global::Tango.PMR.ColorLab.CalibrationPoint.Parser); - private readonly pbc::RepeatedField<global::Tango.PMR.ColorLab.CalibrationPoint> calibrationData_ = new pbc::RepeatedField<global::Tango.PMR.ColorLab.CalibrationPoint>(); + private global::Tango.PMR.ColorLab.CalibrationData calibrationData_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Tango.PMR.ColorLab.CalibrationPoint> CalibrationData { + public global::Tango.PMR.ColorLab.CalibrationData CalibrationData { get { return calibrationData_; } + set { + calibrationData_ = value; + } } /// <summary>Field number for the "SegmentLength" field.</summary> @@ -186,7 +187,7 @@ namespace Tango.PMR.ColorLab { if (!object.Equals(Input, other.Input)) return false; if (ForwardData != other.ForwardData) return false; if (InverseData != other.InverseData) return false; - if(!calibrationData_.Equals(other.calibrationData_)) return false; + if (!object.Equals(CalibrationData, other.CalibrationData)) return false; if (SegmentLength != other.SegmentLength) return false; return true; } @@ -200,7 +201,7 @@ namespace Tango.PMR.ColorLab { if (input_ != null) hash ^= Input.GetHashCode(); if (ForwardData.Length != 0) hash ^= ForwardData.GetHashCode(); if (InverseData.Length != 0) hash ^= InverseData.GetHashCode(); - hash ^= calibrationData_.GetHashCode(); + if (calibrationData_ != null) hash ^= CalibrationData.GetHashCode(); if (SegmentLength != 0D) hash ^= SegmentLength.GetHashCode(); return hash; } @@ -236,7 +237,10 @@ namespace Tango.PMR.ColorLab { output.WriteRawTag(50); output.WriteBytes(InverseData); } - calibrationData_.WriteTo(output, _repeated_calibrationData_codec); + if (calibrationData_ != null) { + output.WriteRawTag(58); + output.WriteMessage(CalibrationData); + } if (SegmentLength != 0D) { output.WriteRawTag(65); output.WriteDouble(SegmentLength); @@ -264,7 +268,9 @@ namespace Tango.PMR.ColorLab { if (InverseData.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeBytesSize(InverseData); } - size += calibrationData_.CalculateSize(_repeated_calibrationData_codec); + if (calibrationData_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(CalibrationData); + } if (SegmentLength != 0D) { size += 1 + 8; } @@ -297,7 +303,12 @@ namespace Tango.PMR.ColorLab { if (other.InverseData.Length != 0) { InverseData = other.InverseData; } - calibrationData_.Add(other.calibrationData_); + if (other.calibrationData_ != null) { + if (calibrationData_ == null) { + calibrationData_ = new global::Tango.PMR.ColorLab.CalibrationData(); + } + CalibrationData.MergeFrom(other.CalibrationData); + } if (other.SegmentLength != 0D) { SegmentLength = other.SegmentLength; } @@ -339,7 +350,10 @@ namespace Tango.PMR.ColorLab { break; } case 58: { - calibrationData_.AddEntriesFrom(input, _repeated_calibrationData_codec); + if (calibrationData_ == null) { + calibrationData_ = new global::Tango.PMR.ColorLab.CalibrationData(); + } + input.ReadMessage(calibrationData_); break; } case 65: { diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/InputColor.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/InputColor.cs index e901fa265..0ac5d1b0d 100644 --- a/Software/Visual_Studio/Tango.PMR/ColorLab/InputColor.cs +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/InputColor.cs @@ -28,14 +28,14 @@ namespace Tango.PMR.ColorLab { "IAEoARILCgNSZWQYAyABKAUSDQoFR3JlZW4YBCABKAUSDAoEQmx1ZRgFIAEo", "BRIMCgRDeWFuGAYgASgBEg8KB01hZ2VudGEYByABKAESDgoGWWVsbG93GAgg", "ASgBEg0KBUJsYWNrGAkgASgBEgkKAUwYCiABKAESCQoBQRgLIAEoARIJCgFC", - "GAwgASgBEgoKAlYwGA0gASgBEgoKAlYxGA4gASgBEgoKAlYyGA8gASgBEgoK", - "AlYzGBAgASgBEgoKAlY0GBEgASgBEgoKAlY1GBIgASgBEgoKAlY2GBMgASgB", + "GAwgASgBEgoKAkNWGA0gASgBEgoKAk1WGA4gASgBEgoKAllWGA8gASgBEgoK", + "AktWGBAgASgBEgoKAlY0GBEgASgBEgoKAlY1GBIgASgBEgoKAlY2GBMgASgB", "EgoKAlY3GBQgASgBEhIKClBhbnRvbkNvZGUYFSABKAVCHgocY29tLnR3aW5l", "LnRhbmdvLnBtci5jb2xvcmxhYmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.ColorSpaceReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.InputColor), global::Tango.PMR.ColorLab.InputColor.Parser, new[]{ "ColorSpace", "Length", "Red", "Green", "Blue", "Cyan", "Magenta", "Yellow", "Black", "L", "A", "B", "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7", "PantonCode" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.InputColor), global::Tango.PMR.ColorLab.InputColor.Parser, new[]{ "ColorSpace", "Length", "Red", "Green", "Blue", "Cyan", "Magenta", "Yellow", "Black", "L", "A", "B", "CV", "MV", "YV", "KV", "V4", "V5", "V6", "V7", "PantonCode" }, null, null, null) })); } #endregion @@ -78,10 +78,10 @@ namespace Tango.PMR.ColorLab { l_ = other.l_; a_ = other.a_; b_ = other.b_; - v0_ = other.v0_; - v1_ = other.v1_; - v2_ = other.v2_; - v3_ = other.v3_; + cV_ = other.cV_; + mV_ = other.mV_; + yV_ = other.yV_; + kV_ = other.kV_; v4_ = other.v4_; v5_ = other.v5_; v6_ = other.v6_; @@ -226,47 +226,47 @@ namespace Tango.PMR.ColorLab { } } - /// <summary>Field number for the "V0" field.</summary> - public const int V0FieldNumber = 13; - private double v0_; + /// <summary>Field number for the "CV" field.</summary> + public const int CVFieldNumber = 13; + private double cV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V0 { - get { return v0_; } + public double CV { + get { return cV_; } set { - v0_ = value; + cV_ = value; } } - /// <summary>Field number for the "V1" field.</summary> - public const int V1FieldNumber = 14; - private double v1_; + /// <summary>Field number for the "MV" field.</summary> + public const int MVFieldNumber = 14; + private double mV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V1 { - get { return v1_; } + public double MV { + get { return mV_; } set { - v1_ = value; + mV_ = value; } } - /// <summary>Field number for the "V2" field.</summary> - public const int V2FieldNumber = 15; - private double v2_; + /// <summary>Field number for the "YV" field.</summary> + public const int YVFieldNumber = 15; + private double yV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V2 { - get { return v2_; } + public double YV { + get { return yV_; } set { - v2_ = value; + yV_ = value; } } - /// <summary>Field number for the "V3" field.</summary> - public const int V3FieldNumber = 16; - private double v3_; + /// <summary>Field number for the "KV" field.</summary> + public const int KVFieldNumber = 16; + private double kV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V3 { - get { return v3_; } + public double KV { + get { return kV_; } set { - v3_ = value; + kV_ = value; } } @@ -350,10 +350,10 @@ namespace Tango.PMR.ColorLab { if (L != other.L) return false; if (A != other.A) return false; if (B != other.B) return false; - if (V0 != other.V0) return false; - if (V1 != other.V1) return false; - if (V2 != other.V2) return false; - if (V3 != other.V3) return false; + if (CV != other.CV) return false; + if (MV != other.MV) return false; + if (YV != other.YV) return false; + if (KV != other.KV) return false; if (V4 != other.V4) return false; if (V5 != other.V5) return false; if (V6 != other.V6) return false; @@ -377,10 +377,10 @@ namespace Tango.PMR.ColorLab { if (L != 0D) hash ^= L.GetHashCode(); if (A != 0D) hash ^= A.GetHashCode(); if (B != 0D) hash ^= B.GetHashCode(); - if (V0 != 0D) hash ^= V0.GetHashCode(); - if (V1 != 0D) hash ^= V1.GetHashCode(); - if (V2 != 0D) hash ^= V2.GetHashCode(); - if (V3 != 0D) hash ^= V3.GetHashCode(); + if (CV != 0D) hash ^= CV.GetHashCode(); + if (MV != 0D) hash ^= MV.GetHashCode(); + if (YV != 0D) hash ^= YV.GetHashCode(); + if (KV != 0D) hash ^= KV.GetHashCode(); if (V4 != 0D) hash ^= V4.GetHashCode(); if (V5 != 0D) hash ^= V5.GetHashCode(); if (V6 != 0D) hash ^= V6.GetHashCode(); @@ -444,21 +444,21 @@ namespace Tango.PMR.ColorLab { output.WriteRawTag(97); output.WriteDouble(B); } - if (V0 != 0D) { + if (CV != 0D) { output.WriteRawTag(105); - output.WriteDouble(V0); + output.WriteDouble(CV); } - if (V1 != 0D) { + if (MV != 0D) { output.WriteRawTag(113); - output.WriteDouble(V1); + output.WriteDouble(MV); } - if (V2 != 0D) { + if (YV != 0D) { output.WriteRawTag(121); - output.WriteDouble(V2); + output.WriteDouble(YV); } - if (V3 != 0D) { + if (KV != 0D) { output.WriteRawTag(129, 1); - output.WriteDouble(V3); + output.WriteDouble(KV); } if (V4 != 0D) { output.WriteRawTag(137, 1); @@ -521,16 +521,16 @@ namespace Tango.PMR.ColorLab { if (B != 0D) { size += 1 + 8; } - if (V0 != 0D) { + if (CV != 0D) { size += 1 + 8; } - if (V1 != 0D) { + if (MV != 0D) { size += 1 + 8; } - if (V2 != 0D) { + if (YV != 0D) { size += 1 + 8; } - if (V3 != 0D) { + if (KV != 0D) { size += 2 + 8; } if (V4 != 0D) { @@ -592,17 +592,17 @@ namespace Tango.PMR.ColorLab { if (other.B != 0D) { B = other.B; } - if (other.V0 != 0D) { - V0 = other.V0; + if (other.CV != 0D) { + CV = other.CV; } - if (other.V1 != 0D) { - V1 = other.V1; + if (other.MV != 0D) { + MV = other.MV; } - if (other.V2 != 0D) { - V2 = other.V2; + if (other.YV != 0D) { + YV = other.YV; } - if (other.V3 != 0D) { - V3 = other.V3; + if (other.KV != 0D) { + KV = other.KV; } if (other.V4 != 0D) { V4 = other.V4; @@ -678,19 +678,19 @@ namespace Tango.PMR.ColorLab { break; } case 105: { - V0 = input.ReadDouble(); + CV = input.ReadDouble(); break; } case 113: { - V1 = input.ReadDouble(); + MV = input.ReadDouble(); break; } case 121: { - V2 = input.ReadDouble(); + YV = input.ReadDouble(); break; } case 129: { - V3 = input.ReadDouble(); + KV = input.ReadDouble(); break; } case 137: { diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/OutputColor.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/OutputColor.cs index 0228171bc..48cb82582 100644 --- a/Software/Visual_Studio/Tango.PMR/ColorLab/OutputColor.cs +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/OutputColor.cs @@ -24,15 +24,15 @@ namespace Tango.PMR.ColorLab { string.Concat( "ChFPdXRwdXRDb2xvci5wcm90bxISVGFuZ28uUE1SLkNvbG9yTGFiIswBCgtP", "dXRwdXRDb2xvchILCgNSZWQYASABKAUSDQoFR3JlZW4YAiABKAUSDAoEQmx1", - "ZRgDIAEoBRIKCgJWMBgEIAEoARIKCgJWMRgFIAEoARIKCgJWMhgGIAEoARIK", - "CgJWMxgHIAEoARIKCgJWNBgIIAEoARIKCgJWNRgJIAEoARIKCgJWNhgKIAEo", + "ZRgDIAEoBRIKCgJDVhgEIAEoARIKCgJNVhgFIAEoARIKCgJZVhgGIAEoARIK", + "CgJLVhgHIAEoARIKCgJWNBgIIAEoARIKCgJWNRgJIAEoARIKCgJWNhgKIAEo", "ARIKCgJWNxgLIAEoARIOCgZMZW5ndGgYDCABKAESIwobUHJvY2Vzc1BhcmFt", "ZXRlcnNUYWJsZUluZGV4GA0gASgFQh4KHGNvbS50d2luZS50YW5nby5wbXIu", "Y29sb3JsYWJiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.OutputColor), global::Tango.PMR.ColorLab.OutputColor.Parser, new[]{ "Red", "Green", "Blue", "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7", "Length", "ProcessParametersTableIndex" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.OutputColor), global::Tango.PMR.ColorLab.OutputColor.Parser, new[]{ "Red", "Green", "Blue", "CV", "MV", "YV", "KV", "V4", "V5", "V6", "V7", "Length", "ProcessParametersTableIndex" }, null, null, null) })); } #endregion @@ -66,10 +66,10 @@ namespace Tango.PMR.ColorLab { red_ = other.red_; green_ = other.green_; blue_ = other.blue_; - v0_ = other.v0_; - v1_ = other.v1_; - v2_ = other.v2_; - v3_ = other.v3_; + cV_ = other.cV_; + mV_ = other.mV_; + yV_ = other.yV_; + kV_ = other.kV_; v4_ = other.v4_; v5_ = other.v5_; v6_ = other.v6_; @@ -116,47 +116,47 @@ namespace Tango.PMR.ColorLab { } } - /// <summary>Field number for the "V0" field.</summary> - public const int V0FieldNumber = 4; - private double v0_; + /// <summary>Field number for the "CV" field.</summary> + public const int CVFieldNumber = 4; + private double cV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V0 { - get { return v0_; } + public double CV { + get { return cV_; } set { - v0_ = value; + cV_ = value; } } - /// <summary>Field number for the "V1" field.</summary> - public const int V1FieldNumber = 5; - private double v1_; + /// <summary>Field number for the "MV" field.</summary> + public const int MVFieldNumber = 5; + private double mV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V1 { - get { return v1_; } + public double MV { + get { return mV_; } set { - v1_ = value; + mV_ = value; } } - /// <summary>Field number for the "V2" field.</summary> - public const int V2FieldNumber = 6; - private double v2_; + /// <summary>Field number for the "YV" field.</summary> + public const int YVFieldNumber = 6; + private double yV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V2 { - get { return v2_; } + public double YV { + get { return yV_; } set { - v2_ = value; + yV_ = value; } } - /// <summary>Field number for the "V3" field.</summary> - public const int V3FieldNumber = 7; - private double v3_; + /// <summary>Field number for the "KV" field.</summary> + public const int KVFieldNumber = 7; + private double kV_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double V3 { - get { return v3_; } + public double KV { + get { return kV_; } set { - v3_ = value; + kV_ = value; } } @@ -242,10 +242,10 @@ namespace Tango.PMR.ColorLab { if (Red != other.Red) return false; if (Green != other.Green) return false; if (Blue != other.Blue) return false; - if (V0 != other.V0) return false; - if (V1 != other.V1) return false; - if (V2 != other.V2) return false; - if (V3 != other.V3) return false; + if (CV != other.CV) return false; + if (MV != other.MV) return false; + if (YV != other.YV) return false; + if (KV != other.KV) return false; if (V4 != other.V4) return false; if (V5 != other.V5) return false; if (V6 != other.V6) return false; @@ -261,10 +261,10 @@ namespace Tango.PMR.ColorLab { if (Red != 0) hash ^= Red.GetHashCode(); if (Green != 0) hash ^= Green.GetHashCode(); if (Blue != 0) hash ^= Blue.GetHashCode(); - if (V0 != 0D) hash ^= V0.GetHashCode(); - if (V1 != 0D) hash ^= V1.GetHashCode(); - if (V2 != 0D) hash ^= V2.GetHashCode(); - if (V3 != 0D) hash ^= V3.GetHashCode(); + if (CV != 0D) hash ^= CV.GetHashCode(); + if (MV != 0D) hash ^= MV.GetHashCode(); + if (YV != 0D) hash ^= YV.GetHashCode(); + if (KV != 0D) hash ^= KV.GetHashCode(); if (V4 != 0D) hash ^= V4.GetHashCode(); if (V5 != 0D) hash ^= V5.GetHashCode(); if (V6 != 0D) hash ^= V6.GetHashCode(); @@ -293,21 +293,21 @@ namespace Tango.PMR.ColorLab { output.WriteRawTag(24); output.WriteInt32(Blue); } - if (V0 != 0D) { + if (CV != 0D) { output.WriteRawTag(33); - output.WriteDouble(V0); + output.WriteDouble(CV); } - if (V1 != 0D) { + if (MV != 0D) { output.WriteRawTag(41); - output.WriteDouble(V1); + output.WriteDouble(MV); } - if (V2 != 0D) { + if (YV != 0D) { output.WriteRawTag(49); - output.WriteDouble(V2); + output.WriteDouble(YV); } - if (V3 != 0D) { + if (KV != 0D) { output.WriteRawTag(57); - output.WriteDouble(V3); + output.WriteDouble(KV); } if (V4 != 0D) { output.WriteRawTag(65); @@ -347,16 +347,16 @@ namespace Tango.PMR.ColorLab { if (Blue != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Blue); } - if (V0 != 0D) { + if (CV != 0D) { size += 1 + 8; } - if (V1 != 0D) { + if (MV != 0D) { size += 1 + 8; } - if (V2 != 0D) { + if (YV != 0D) { size += 1 + 8; } - if (V3 != 0D) { + if (KV != 0D) { size += 1 + 8; } if (V4 != 0D) { @@ -394,17 +394,17 @@ namespace Tango.PMR.ColorLab { if (other.Blue != 0) { Blue = other.Blue; } - if (other.V0 != 0D) { - V0 = other.V0; + if (other.CV != 0D) { + CV = other.CV; } - if (other.V1 != 0D) { - V1 = other.V1; + if (other.MV != 0D) { + MV = other.MV; } - if (other.V2 != 0D) { - V2 = other.V2; + if (other.YV != 0D) { + YV = other.YV; } - if (other.V3 != 0D) { - V3 = other.V3; + if (other.KV != 0D) { + KV = other.KV; } if (other.V4 != 0D) { V4 = other.V4; @@ -447,19 +447,19 @@ namespace Tango.PMR.ColorLab { break; } case 33: { - V0 = input.ReadDouble(); + CV = input.ReadDouble(); break; } case 41: { - V1 = input.ReadDouble(); + MV = input.ReadDouble(); break; } case 49: { - V2 = input.ReadDouble(); + YV = input.ReadDouble(); break; } case 57: { - V3 = input.ReadDouble(); + KV = input.ReadDouble(); break; } case 65: { diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 87f7c61e2..a066230b9 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -47,6 +47,7 @@ <Compile Include="..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="ColorLab\CalibrationData.cs" /> <Compile Include="ColorLab\CalibrationPoint.cs" /> <Compile Include="ColorLab\ColorSpace.cs" /> <Compile Include="ColorLab\ConversionInput.cs" /> diff --git a/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs new file mode 100644 index 000000000..e5ef944e5 --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs @@ -0,0 +1,104 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Runtime.InteropServices; +using Tango.PMR.ColorLab; +using Tango.DAL.Remote.DB; +using Tango.Integration.Observables; +using System.Linq; +using Google.Protobuf; +using Tango.PMR; + +namespace Tango.UnitTesting +{ + [TestClass] + [TestCategory("Color Lab")] + public class ColorLib_TST + { + [DllImport("Tango.ColorLib.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ForwardConvert")] + public static extern int ForwardConvert(IntPtr data, int size, ref IntPtr output); + + [DllImport("Tango.ColorLib.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "InverseConvert")] + public static extern int InverseConvert(IntPtr data, int size, ref IntPtr output); + + [TestMethod] + public void Convert_Color_To_Volumes() + { + ConversionInput conversionInput = new ConversionInput(); + + conversionInput.Input = new InputColor(); + + conversionInput.SegmentLength = 100; + + conversionInput.Input.Red = 255; + conversionInput.Input.Green = 0; + conversionInput.Input.Blue = 0; + + conversionInput.ThreadL = 100; + conversionInput.ThreadA = 0.00526049995830391; + conversionInput.ThreadB = -0.010408184525267927; + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var cct = db.Ccts.FirstOrDefault(); + + Assert.IsNotNull(cct); + + conversionInput.ForwardData = ByteString.CopyFrom(cct.ForwardData); + conversionInput.InverseData = ByteString.CopyFrom(cct.InverseData); + + var cat = db.Cats.FirstOrDefault(); + + Assert.IsNotNull(cat); + + conversionInput.CalibrationData = cat.CreateDemoCalibrationData(); + } + + + NativePMR<ConversionInput, ConversionOutput> nativePMR = new NativePMR<ConversionInput, ConversionOutput>(ForwardConvert); + ConversionOutput output = nativePMR.Invoke(conversionInput); + + Assert.IsTrue(output.Suggestions.Count > 0); + } + + [TestMethod] + public void Convert_Volumes_To_Color() + { + ConversionInput conversionInput = new ConversionInput(); + + conversionInput.Input = new InputColor(); + + conversionInput.SegmentLength = 100; + + conversionInput.Input.CV = 10; + conversionInput.Input.MV = 20; + conversionInput.Input.YV = 30; + conversionInput.Input.KV = 0; + + conversionInput.ThreadL = 100; + conversionInput.ThreadA = 0.00526049995830391; + conversionInput.ThreadB = -0.010408184525267927; + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var cct = db.Ccts.FirstOrDefault(); + + Assert.IsNotNull(cct); + + conversionInput.ForwardData = ByteString.CopyFrom(cct.ForwardData); + conversionInput.InverseData = ByteString.CopyFrom(cct.InverseData); + + var cat = db.Cats.FirstOrDefault(); + + Assert.IsNotNull(cat); + + conversionInput.CalibrationData = cat.CreateDemoCalibrationData(); + } + + + NativePMR<ConversionInput, ConversionOutput> nativePMR = new NativePMR<ConversionInput, ConversionOutput>(InverseConvert); + ConversionOutput output = nativePMR.Invoke(conversionInput); + + Assert.IsTrue(output.Suggestions.Count > 0); + } + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 07bdafca7..a797f629d 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -84,6 +84,7 @@ <Compile Include="DAL_TST.cs" /> <Compile Include="Synchronization_TST.cs" /> <Compile Include="CodeGeneration_TST.cs" /> + <Compile Include="ColorLib_TST.cs" /> </ItemGroup> <ItemGroup> <None Include="App.config" /> |
