private void AddAnnotation(Annotation annot)
 {
     if (!_hidden && Annotations != null && !Annotations.Contains(annot))
     {
         Annotations.Add(annot);
     }
 }
Esempio n. 2
0
 private void AddAnnotationIfNotPresent(string annotation)
 {
     if (!Annotations.Contains(annotation))
     {
         Annotations.Add(annotation);
     }
 }
        public void CreateUI()
        {
            AnnotationValue.PropertyChanged += new PropertyChangedEventHandler(OnResourcePropertyChanged);

            if (IsTexture)
            {
                UIElement = new ImagePicker(this);
            }
            else if (DataType.IsBool() && IsScalar)
            {
                UIElement = PropertyHelpers.CreateCheckBox(this, "Value", Value);
            }
            else if (!DataType.IsBool() && IsScalar && (IsSNorm || IsUNorm ||
                                                        (Annotations?.Contains(new KeyValuePair <string, string>("UIWidget", "Slider")) ?? false)))
            {
                object val = Value;
                if (val == null)
                {
                    if (DataType.IsIntegral())
                    {
                        Value = 0;
                    }
                    else
                    {
                        Value = 0.0;
                    }
                }
                UIElement = PropertyHelpers.CreateSlider(this, "Value", this, val);
            }
            else if (!IsMatrix && (Columns == 3 || Columns == 4) &&
                     (Annotations?.Contains(new KeyValuePair <string, string>("UIWidget", "Color")) ?? false))
            {
                UIElement = PropertyHelpers.CreateColorPicker(this, "Value", (Columns == 4) ? true : false, Value);
            }
            else if (IsScalar)
            {
                UIElement = PropertyHelpers.CreateSpinner(this, "Value", this, Value);
            }
            else
            {
                UIElement = new DropdownVecMatProperty(this);
            }
        }
        public void ShowAnnotations()
        {
            if (!_hidden)
            {
                return;
            }

            if (Annotations != null)
            {
                foreach (SelectedObjectRecord record in _selectedObjects)
                {
                    if (!Annotations.Contains(record.Annot))
                    {
                        Annotations.Add(record.Annot);
                    }
                    if (!Annotations.Contains(record.OriginAnnot))
                    {
                        Annotations.Add(record.OriginAnnot);
                    }
                }
            }

            _hidden = false;
        }