Exemplo n.º 1
0
        public void AddItem(string name, PointCloudVisualizationData memberData)
        {
            bool success = false;

            if (Variables.Count > 0)
            {
                var variable = Variables[Variables.Count - 1];
                if (variable.Name == null || variable.Name == "")
                {
                    variable            = new ObservedVariable(name);
                    variable.MemberData = memberData;
                    ResetAt(variable, Variables.Count - 1);
                    SelectItem(Variables.Count - 1);
                    UpdateItem(Variables.Count - 1);
                    success = true;
                }
            }

            if (!success)
            {
                var variable = new ObservedVariable(name);
                variable.MemberData = memberData;
                ResetAt(variable, Variables.Count);
                SelectItem(Variables.Count - 1);
            }

            ResetAt(new ObservedVariable(), Variables.Count);
        }
Exemplo n.º 2
0
        public static PointCloud Load(string name, PointCloudVisualizationData memberData)
        {
            int size = memberData.size;

            string positionPtr = "((float*)" + memberData.positionPtr + ")";

            return(GetPointCloud(size, positionPtr, null));
        }
        PointCloudVisualizationData parseMembers(DkmSuccessEvaluationResult eval)
        {
            PointCloudVisualizationData members = new PointCloudVisualizationData();

            {
                Regex pattern = new Regex(@"\[size\]=(\d+)");
                Match match   = pattern.Match(eval.Value);
                if (match.Groups.Count > 1)
                {
                    members.size = int.Parse(match.Groups[1].Value);
                }
                else
                {
                    members.size = 0;
                }
            }
            {
                Regex pattern = new Regex(@"\[positions\]=(0x[0-9A-Fa-f]+)");
                Match match   = pattern.Match(eval.Value);

                if (match.Groups.Count > 1)
                {
                    members.positionPtr = match.Groups[1].Value;
                }
                else
                {
                    members.positionPtr = null;
                }
            }
            {
                Regex pattern = new Regex(@"\[normals\]=(0x[0-9A-Fa-f]+)");
                Match match   = pattern.Match(eval.Value);

                if (match.Groups.Count > 1)
                {
                    members.normalPtr = match.Groups[1].Value;
                }
                else
                {
                    members.normalPtr = null;
                }
            }
            {
                Regex pattern = new Regex(@"\[precision\]=(\w+)");
                Match match   = pattern.Match(eval.Value);

                if (match.Groups.Count > 1)
                {
                    if (match.Groups[1].Value == "float")
                    {
                        members.precision = PointCloudPrecisionType.Float;
                    }
                    else if (match.Groups[1].Value == "double")
                    {
                        members.precision = PointCloudPrecisionType.Double;
                    }
                    else
                    {
                        members.precision = PointCloudPrecisionType.Unknown;
                    }
                }
                else
                {
                    members.precision = PointCloudPrecisionType.Float;
                }
            }
            {
                Regex pattern = new Regex(@"\[dimension\]=(\d+)");
                Match match   = pattern.Match(eval.Value);

                if (match.Groups.Count > 1)
                {
                    members.dimension = int.Parse(match.Groups[1].Value);
                    if (members.dimension != 3 && members.dimension != 2)
                    {
                        members.dimension = 0;
                    }
                }
                else
                {
                    members.dimension = 3;
                }
            }


            return(members);
        }