internal static SceneElement ApplyChildren(SceneElement destinationElement, Dictionary <IPropertyId, List <SceneNode> > storedChildren, Size size) { SceneElement sceneElement = (SceneElement)null; foreach (KeyValuePair <IPropertyId, List <SceneNode> > keyValuePair in storedChildren) { IPropertyId childProperty = keyValuePair.Key; ReferenceStep referenceStep = childProperty as ReferenceStep; if (referenceStep != null) { childProperty = (IPropertyId)SceneNodeObjectSet.FilterProperty((SceneNode)destinationElement, referenceStep) ?? (IPropertyId)destinationElement.DefaultContentProperty; } if (childProperty != null) { ISceneNodeCollection <SceneNode> collectionForProperty = destinationElement.GetCollectionForProperty(childProperty); if (collectionForProperty != null) { sceneElement = destinationElement; List <SceneNode> list = keyValuePair.Value; if (collectionForProperty.FixedCapacity.HasValue && list.Count > collectionForProperty.FixedCapacity.Value - collectionForProperty.Count) { SceneNode sceneNode = destinationElement.ViewModel.CreateSceneNode(PlatformTypes.Grid); if (ProjectNeutralTypes.Viewbox.IsAssignableFrom((ITypeId)destinationElement.Type) && !size.IsEmpty) { sceneNode.SetValue(BaseFrameworkElement.WidthProperty, (object)size.Width); sceneNode.SetValue(BaseFrameworkElement.HeightProperty, (object)size.Height); } collectionForProperty.Add(sceneNode); collectionForProperty = sceneNode.GetCollectionForProperty((IPropertyId)sceneNode.DefaultContentProperty); sceneElement = sceneNode as SceneElement; } if (ProjectNeutralTypes.Viewbox.IsAssignableFrom((ITypeId)destinationElement.Type)) { destinationElement.SetValue(ViewboxElement.StretchProperty, (object)Stretch.Fill); } foreach (SceneNode sceneNode in list) { collectionForProperty.Add(sceneNode); } } } } return(sceneElement); }
private void ReverseGradientStopsHandler() { PropertyValueEditorCommands.get_BeginTransaction().Execute((object)null, (IInputElement)this.BrushEditor); if (!this.BasisProperty.IsValueLocal) { this.BasisProperty.DoSetLocalValue(); } Dictionary <double, List <GradientStopEditor> > dictionary = new Dictionary <double, List <GradientStopEditor> >(); foreach (GradientStopEditor gradientStopEditor in (IEnumerable)this.GradientStops) { if (!dictionary.ContainsKey(gradientStopEditor.Offset)) { dictionary.Add(gradientStopEditor.Offset, new List <GradientStopEditor>()); } dictionary[gradientStopEditor.Offset].Add(gradientStopEditor); } SceneNodeObjectSet sceneNodeObjectSet = this.BasisProperty.SceneNodeObjectSet; foreach (KeyValuePair <double, List <GradientStopEditor> > keyValuePair in dictionary) { double key = keyValuePair.Key; List <GradientStopEditor> list = keyValuePair.Value; bool flag = list.Count > 1; bool isMixed = false; for (int index = 0; index < list.Count; ++index) { list[index].Offset = RoundingHelper.RoundScale(1.0 - key); if (flag && index < list.Count / 2) { GradientStopEditor gradientStopEditor1 = list[index]; GradientStopEditor gradientStopEditor2 = list[list.Count - 1 - index]; DocumentNode valueAsDocumentNode1 = gradientStopEditor1.ColorProperty.GetLocalValueAsDocumentNode(false, out isMixed); DocumentNode valueAsDocumentNode2 = gradientStopEditor2.ColorProperty.GetLocalValueAsDocumentNode(false, out isMixed); gradientStopEditor1.ColorProperty.SetValue((object)valueAsDocumentNode2); gradientStopEditor2.ColorProperty.SetValue((object)valueAsDocumentNode1); } } } PropertyValueEditorCommands.get_CommitTransaction().Execute((object)null, (IInputElement)this.BrushEditor); this.RebuildModel(-1); }
public void ApplyAmbientProperties(SceneNode node) { if (node == null || !Enumerable.Any <ITypeId>((IEnumerable <ITypeId>)AmbientPropertyManager.SupportedTypes, (Func <ITypeId, bool>)(type => type.IsAssignableFrom((ITypeId)node.Type))) || this.suppressApplyCount > 0) { return; } foreach (ReferenceStep referenceStep in this.GetResolvedAmbientProperties()) { bool strictTypeCheck = true; PropertyReference propertyReference = SceneNodeObjectSet.FilterProperty(node, new PropertyReference(referenceStep), strictTypeCheck); if (propertyReference != null) { object valueToSet = this.InternalGetAmbientValue(referenceStep, node); DocumentNode documentNode1 = valueToSet as DocumentNode; if (documentNode1 != null) { DocumentNode documentNode2 = documentNode1.Clone(node.DocumentContext); DocumentCompositeNode documentCompositeNode = documentNode2 as DocumentCompositeNode; if (documentCompositeNode != null) { documentCompositeNode.ClearValue((IPropertyId)documentCompositeNode.Type.Metadata.NameProperty); } foreach (DocumentNode documentNode3 in documentNode2.SelectDescendantNodes((Predicate <DocumentNode>)(nodePredicate => nodePredicate.Parent.IsNameProperty((IPropertyId)nodePredicate.SitePropertyKey)))) { documentNode3.Parent.ClearValue((IPropertyId)documentNode3.SitePropertyKey); } valueToSet = (object)documentNode2; } if (valueToSet == DependencyProperty.UnsetValue) { node.ClearValueAsWpf(propertyReference); } else { node.SetValueAsWpf(propertyReference, valueToSet); } } } }
public EmissiveMaterialEditor(SceneNodeObjectSet objectSet, PropertyReference materialReference) : base(objectSet, materialReference) { this.ColorProperty = objectSet.CreateSceneNodeProperty(materialReference.Append(MaterialNode.EmissiveColorProperty), (AttributeCollection)null); this.BrushProperty = objectSet.CreateSceneNodeProperty(materialReference.Append(MaterialNode.EmissiveBrushProperty), (AttributeCollection)null); }
protected MaterialBaseEditor(SceneNodeObjectSet objectSet, PropertyReference materialReference) { this.materialProperty = objectSet.CreateSceneNodeProperty(materialReference, (AttributeCollection)null); }
public TransformSceneNodeProperty(SceneNodeObjectSet objectSet, PropertyReference propertyReference, AttributeCollection attributes) : base(objectSet, propertyReference, attributes) { }
public ReferenceStep FilterProperty(ITypeResolver typeResolver, IType type, ReferenceStep referenceStep) { return(SceneNodeObjectSet.FilterProperty(typeResolver, type, referenceStep)); }
public PropertyReference FilterProperty(ITypeResolver typeResolver, IType type, PropertyReference propertyReference) { return(SceneNodeObjectSet.FilterProperty(typeResolver, type, propertyReference)); }
public ReferenceStep FilterProperty(SceneNode node, ReferenceStep referenceStep) { return(SceneNodeObjectSet.FilterProperty(node, referenceStep)); }
public PropertyReference FilterProperty(SceneNode node, PropertyReference propertyReference) { return(SceneNodeObjectSet.FilterProperty(node, propertyReference)); }
internal RegistrationPointModel(SceneNodeObjectSet objectSet) { this.objectSet = objectSet; }
public ResourcePaneSceneNodeProperty(SceneNodeObjectSet objectSet, PropertyReference propertyReference, AttributeCollection attributeCollection, Type valueType, ITypeResolver typeResolver) : base(objectSet, propertyReference, attributeCollection, valueType, typeResolver) { }