Exemplo n.º 1
0
        public CircleFeatureVisual(CircleFeatureCurve featureCurve, double thickness = 0.01)
        {
            Contract.Requires(thickness > 0);
            Contract.Requires(featureCurve != null);
            Contract.Ensures(object.ReferenceEquals(featureCurve, FeatureCurve));

            this.featureCurve = featureCurve;
            this.thickness    = thickness;

            var emissiveMaterial = new EmissiveMaterial();

            emissiveMaterial.Bind(
                EmissiveMaterial.BrushProperty,
                () => featureCurve.IsSelected,
                isSelected => isSelected ? Brushes.DarkOrange : Brushes.Black);

            var material = new MaterialGroup();

            material.Children.Add(new DiffuseMaterial {
                Brush = Brushes.Black
            });
            material.Children.Add(emissiveMaterial);

            model3d          = new GeometryModel3D();
            model3d.Material = model3d.BackMaterial = material;
            Content          = model3d;

            Update();
        }
        private static EmissiveMaterial CreateEmissiveMaterial(SnappedPrimitive snappedPrimitive)
        {
            var frontEmissivePart = new EmissiveMaterial();

            frontEmissivePart.Bind(
                EmissiveMaterial.BrushProperty,
                () => snappedPrimitive.IsSelected,
                flag => flag ? Brushes.LightGray : Brushes.Gray);
            return(frontEmissivePart);
        }