Example #1
0
        private void TrafficLight(object sender, RoutedEventArgs e)
        {
            if (_prevStyler == null)
            {
                _prevStyler = _xpWindow.DrawingControl.DefaultLayerStyler;
            }
            var ls2 = new TrafficLightStyler((IfcStore)Model, this)
            {
                UseAmber = _useAmber,
                UseBlue  = _useBlue
            };

            ls2.SetColors(
                XbimColour.FromString(Settings.Default.ColorPass),
                XbimColour.FromString(Settings.Default.ColorFail),
                XbimColour.FromString(Settings.Default.ColorWarning),
                XbimColour.FromString(Settings.Default.ColorNonApplicable)
                );

            ls2.SetFilters(
                SelectedConcepts(),
                SelectedExchangeRequirements(),
                SelectedIfcClasses()
                );

            _xpWindow.DrawingControl.DefaultLayerStyler = ls2;

            // then reload
            _xpWindow.DrawingControl.ReloadModel(DrawingControl3D.ModelRefreshOptions.ViewPreserveAll);
        }
Example #2
0
        private void ColorGroupChanged(object sender, SelectionChangedEventArgs e)
        {
            XbimColour col = null;
            var        sel = CmbColorGroup.SelectedItem as ComboBoxItem;

            if (sel?.Tag == null)
            {
                return;
            }
            var tag = sel.Tag.ToString();

            switch (tag)
            {
            case "F":
                col = XbimColour.FromString(Settings.Default.ColorFail);
                break;

            case "P":
                col = XbimColour.FromString(Settings.Default.ColorPass);
                break;

            case "W":
                col = XbimColour.FromString(Settings.Default.ColorWarning);
                break;

            case "N/A":
                col = XbimColour.FromString(Settings.Default.ColorNonApplicable);
                break;
            }
            if (col == null)
            {
                return;
            }
            try
            {
                SliderR.Value = col.Red * 255;
                SliderG.Value = col.Green * 255;
                SliderB.Value = col.Blue * 255;
                SliderA.Value = col.Alpha * 255;
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }
        }
        public void CanPersistColour()
        {
            var c        = new XbimColour(0.3f, 0.4f, 0.5f, 0.6f);
            var asString = c.ToString();
            var c2       = XbimColour.FromString(asString);
            var isEqual  = c2.Equals(c);

            Assert.IsTrue(isEqual, "XbimColour ToString Persistency failed.");

            var custom = "R:0.3 G:0.4 B:0.5 A:0.6";

            c2      = XbimColour.FromString(custom);
            isEqual = c2.Equals(c);
            Assert.IsTrue(isEqual, "XbimColour ToString Persistency failed.");

            custom  = "R:0,3 G:0,4 B:0,5 A:0,6";
            c2      = XbimColour.FromString(custom);
            isEqual = c2.Equals(c);
            Assert.IsTrue(isEqual, "XbimColour ToString Persistency failed.");
        }