Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Media3D / MaterialGroup.cs / 1 / MaterialGroup.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Material group
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows.Markup;
using MS.Internal;
using MS.Internal.Media3D;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Media3D
{
///
/// Material group
///
[ContentProperty("Children")]
public sealed partial class MaterialGroup : Material
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Default constructor.
///
public MaterialGroup() {}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
#endregion Public Methods
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
#region Internal Methods
// If a child changes or is added/removed to this,
// that will fire changed which will mark the GeometryModel3D
// containing this as DirtyForPreCompute which will
// cause PreCompute() to be called on us.
//
// Thus, we don't need to override OnChanged() and update
// _requiresRealization here in MaterialGroup.
internal override bool PreCompute()
{
_requiresRealization = false;
MaterialCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
// Can't early exit on first 'true' because PreCompute
// does work that's necessary for every Material that
// has text in it
_requiresRealization |= children.Internal_GetItem(i).PreCompute();
}
}
return _requiresRealization;
}
internal override void UpdateRealizations(
RealizationContext ctx,
ref Rect bounds
)
{
Debug.Assert(_requiresRealization);
MaterialCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
Material material = children.Internal_GetItem(i);
if (material.RequiresRealization)
{
material.UpdateRealizations(ctx, ref bounds);
}
}
}
}
#endregion Internal Methods
//-----------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
internal override bool RequiresRealization
{
get
{
return _requiresRealization;
}
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private bool _requiresRealization = false;
#endregion Private Fields
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Material group
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows.Markup;
using MS.Internal;
using MS.Internal.Media3D;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Media3D
{
///
/// Material group
///
[ContentProperty("Children")]
public sealed partial class MaterialGroup : Material
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Default constructor.
///
public MaterialGroup() {}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
#endregion Public Methods
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
#region Internal Methods
// If a child changes or is added/removed to this,
// that will fire changed which will mark the GeometryModel3D
// containing this as DirtyForPreCompute which will
// cause PreCompute() to be called on us.
//
// Thus, we don't need to override OnChanged() and update
// _requiresRealization here in MaterialGroup.
internal override bool PreCompute()
{
_requiresRealization = false;
MaterialCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
// Can't early exit on first 'true' because PreCompute
// does work that's necessary for every Material that
// has text in it
_requiresRealization |= children.Internal_GetItem(i).PreCompute();
}
}
return _requiresRealization;
}
internal override void UpdateRealizations(
RealizationContext ctx,
ref Rect bounds
)
{
Debug.Assert(_requiresRealization);
MaterialCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
Material material = children.Internal_GetItem(i);
if (material.RequiresRealization)
{
material.UpdateRealizations(ctx, ref bounds);
}
}
}
}
#endregion Internal Methods
//-----------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
internal override bool RequiresRealization
{
get
{
return _requiresRealization;
}
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private bool _requiresRealization = false;
#endregion Private Fields
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DocumentReference.cs
- MsmqInputMessage.cs
- OdbcEnvironmentHandle.cs
- DescendantOverDescendantQuery.cs
- CellLabel.cs
- SqlTypeConverter.cs
- FileRegion.cs
- TypeLibConverter.cs
- WebReference.cs
- ExpressionParser.cs
- TemplateXamlParser.cs
- PasswordRecovery.cs
- ActivityLocationReferenceEnvironment.cs
- SpStreamWrapper.cs
- Currency.cs
- cookie.cs
- MsmqIntegrationMessagePool.cs
- XDRSchema.cs
- _ProxyChain.cs
- PeerCredentialElement.cs
- PagerStyle.cs
- WebEventTraceProvider.cs
- DocumentSequenceHighlightLayer.cs
- ForwardPositionQuery.cs
- CellIdBoolean.cs
- StringCollection.cs
- RegexCompiler.cs
- ObjectManager.cs
- X509Certificate2Collection.cs
- DebugView.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- TreeWalkHelper.cs
- Parser.cs
- PrimitiveSchema.cs
- ConfigUtil.cs
- HtmlWindowCollection.cs
- ParseHttpDate.cs
- InputMethod.cs
- VectorKeyFrameCollection.cs
- ObjectDataSourceFilteringEventArgs.cs
- FormsAuthenticationUserCollection.cs
- FunctionMappingTranslator.cs
- HtmlImage.cs
- TypeListConverter.cs
- PassportPrincipal.cs
- WebPartConnectionsEventArgs.cs
- BitmapEffectCollection.cs
- SqlErrorCollection.cs
- MouseCaptureWithinProperty.cs
- QueryOperationResponseOfT.cs
- HtmlTable.cs
- AccessedThroughPropertyAttribute.cs
- TableCellCollection.cs
- DataSourceHelper.cs
- InvalidDataException.cs
- GeometryModel3D.cs
- DispatcherExceptionEventArgs.cs
- EntityStoreSchemaFilterEntry.cs
- NumberSubstitution.cs
- UrlAuthFailedErrorFormatter.cs
- SecurityPermission.cs
- CurrentChangingEventManager.cs
- EdmRelationshipRoleAttribute.cs
- AndCondition.cs
- XmlNamespaceDeclarationsAttribute.cs
- GroupItem.cs
- TableItemPatternIdentifiers.cs
- CodeTypeReferenceExpression.cs
- SerializationAttributes.cs
- WindowsGraphics2.cs
- FocusWithinProperty.cs
- DataGridViewRowPrePaintEventArgs.cs
- XXXInfos.cs
- ColorContext.cs
- WebPartDisplayModeEventArgs.cs
- TableAdapterManagerGenerator.cs
- AndCondition.cs
- AdvancedBindingEditor.cs
- QueuePropertyVariants.cs
- SkewTransform.cs
- CookieProtection.cs
- DSACryptoServiceProvider.cs
- ZoneIdentityPermission.cs
- DataSourceSelectArguments.cs
- WindowsAuthenticationEventArgs.cs
- filewebresponse.cs
- InfoCardTrace.cs
- ComponentChangingEvent.cs
- InternalEnumValidator.cs
- XamlVector3DCollectionSerializer.cs
- RecommendedAsConfigurableAttribute.cs
- MediaContext.cs
- RoutedEventConverter.cs
- BrowserCapabilitiesCompiler.cs
- ComplexBindingPropertiesAttribute.cs
- CopyNodeSetAction.cs
- StringSource.cs
- DependencyObjectPropertyDescriptor.cs
- VarRefManager.cs
- ParserHooks.cs