Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- FixedSOMGroup.cs
- SamlAuthorizationDecisionClaimResource.cs
- ExtensionFile.cs
- DataGridViewLinkCell.cs
- QueryGenerator.cs
- ListBox.cs
- PropertyChangedEventManager.cs
- DropDownList.cs
- InputLangChangeRequestEvent.cs
- OdbcCommandBuilder.cs
- VersionedStreamOwner.cs
- SafeReversePInvokeHandle.cs
- DataColumnSelectionConverter.cs
- StreamFormatter.cs
- GetPageNumberCompletedEventArgs.cs
- AdornerDecorator.cs
- MimeTypePropertyAttribute.cs
- InstanceDataCollection.cs
- VectorAnimationUsingKeyFrames.cs
- XmlUtilWriter.cs
- ContentAlignmentEditor.cs
- SignedXml.cs
- ConditionCollection.cs
- DataGridItemCollection.cs
- MetadataFile.cs
- MembershipValidatePasswordEventArgs.cs
- PartialArray.cs
- ToolboxDataAttribute.cs
- CodeMemberProperty.cs
- DbDataReader.cs
- UnicodeEncoding.cs
- PersonalizationDictionary.cs
- Symbol.cs
- InputLanguageManager.cs
- ReadWriteSpinLock.cs
- CqlErrorHelper.cs
- AuthenticationServiceManager.cs
- WindowsTreeView.cs
- SqlRowUpdatingEvent.cs
- ListControlStringCollectionEditor.cs
- ScriptManagerProxy.cs
- ControlFilterExpression.cs
- RemotingException.cs
- Line.cs
- Icon.cs
- JsonWriter.cs
- DefaultObjectMappingItemCollection.cs
- SequentialUshortCollection.cs
- BrowserCapabilitiesFactoryBase.cs
- InstanceCompleteException.cs
- CategoryNameCollection.cs
- DocumentEventArgs.cs
- List.cs
- RepeatInfo.cs
- SafeFileMappingHandle.cs
- ColumnHeaderConverter.cs
- InputScopeAttribute.cs
- Literal.cs
- DocComment.cs
- RegexNode.cs
- IPipelineRuntime.cs
- InputScope.cs
- XNodeNavigator.cs
- InputMethodStateTypeInfo.cs
- HierarchicalDataSourceDesigner.cs
- XamlPathDataSerializer.cs
- KeyGesture.cs
- BooleanConverter.cs
- EndpointAddressAugust2004.cs
- GZipDecoder.cs
- SimpleTextLine.cs
- TimeSpanValidatorAttribute.cs
- DbProviderFactoriesConfigurationHandler.cs
- GenerateScriptTypeAttribute.cs
- MapPathBasedVirtualPathProvider.cs
- ReferenceTypeElement.cs
- ResourceDictionary.cs
- ConversionContext.cs
- WindowsProgressbar.cs
- LoggedException.cs
- VectorAnimationUsingKeyFrames.cs
- DataGridViewElement.cs
- SamlSecurityTokenAuthenticator.cs
- TypeValidationEventArgs.cs
- ImageButton.cs
- FirstQueryOperator.cs
- XpsStructure.cs
- XmlTypeMapping.cs
- SessionPageStateSection.cs
- ThreadStartException.cs
- ProtectedConfiguration.cs
- QueryCacheEntry.cs
- EastAsianLunisolarCalendar.cs
- DataGridLinkButton.cs
- InheritanceContextChangedEventManager.cs
- FormsAuthenticationModule.cs
- METAHEADER.cs
- Material.cs
- AddressUtility.cs
- FindCriteria11.cs