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
- DesignDataSource.cs
- StrokeIntersection.cs
- PageStatePersister.cs
- TreeView.cs
- WindowsBrush.cs
- KnownColorTable.cs
- TextBox.cs
- ExtensionDataReader.cs
- _AuthenticationState.cs
- DataSourceProvider.cs
- EncoderParameter.cs
- DetailsViewDesigner.cs
- DrawListViewColumnHeaderEventArgs.cs
- MergePropertyDescriptor.cs
- PersonalizationDictionary.cs
- AutoGeneratedField.cs
- ProtocolViolationException.cs
- FileUtil.cs
- TransformerInfo.cs
- LowerCaseStringConverter.cs
- DesignerHelpers.cs
- MediaTimeline.cs
- COSERVERINFO.cs
- ButtonRenderer.cs
- WebPartConnectionsDisconnectVerb.cs
- ScriptManager.cs
- OrCondition.cs
- HtmlTitle.cs
- DeviceContexts.cs
- HostedNamedPipeTransportManager.cs
- Rectangle.cs
- RegisteredArrayDeclaration.cs
- ObjectDataSourceDisposingEventArgs.cs
- ExpressionConverter.cs
- PriorityItem.cs
- SHA1Managed.cs
- errorpatternmatcher.cs
- HelloOperationCD1AsyncResult.cs
- KeyInstance.cs
- DiscoveryMessageProperty.cs
- FieldAccessException.cs
- ArrayWithOffset.cs
- HMACRIPEMD160.cs
- TraceListener.cs
- ArrayElementGridEntry.cs
- ValueType.cs
- FormViewPagerRow.cs
- LongValidatorAttribute.cs
- AudioFormatConverter.cs
- FilterableData.cs
- RTLAwareMessageBox.cs
- DBPropSet.cs
- ReferenceTypeElement.cs
- DataGrid.cs
- TransactionWaitAsyncResult.cs
- coordinatorscratchpad.cs
- StringAnimationUsingKeyFrames.cs
- SoapSchemaExporter.cs
- WebPartDescription.cs
- SqlProviderUtilities.cs
- DynamicDataRoute.cs
- FontResourceCache.cs
- RegexBoyerMoore.cs
- ContextMenuService.cs
- TdsParameterSetter.cs
- activationcontext.cs
- PromptEventArgs.cs
- XmlSchemaGroup.cs
- SessionStateModule.cs
- FontStyles.cs
- PropertyManager.cs
- FontSizeConverter.cs
- TableLayoutPanelCellPosition.cs
- CodeExpressionStatement.cs
- InheritanceAttribute.cs
- EventListener.cs
- AvTraceDetails.cs
- HandlerMappingMemo.cs
- LoadGrammarCompletedEventArgs.cs
- MetadataException.cs
- RepeaterItem.cs
- GroupBox.cs
- MethodBody.cs
- TextParentUndoUnit.cs
- DbgCompiler.cs
- CounterCreationDataCollection.cs
- CounterNameConverter.cs
- DropDownList.cs
- ConfigurationValues.cs
- StringWriter.cs
- BrushProxy.cs
- SQLDateTime.cs
- BindingEditor.xaml.cs
- SamlConditions.cs
- ReferenceConverter.cs
- ScriptModule.cs
- TextTreeTextBlock.cs
- MessageContractImporter.cs
- NativeMethodsCLR.cs
- Table.cs