Axiom.Overlays.OverlayElement.NotifyViewport C# (CSharp) Метод

NotifyViewport() публичный Метод

Notifies the viewport.
public NotifyViewport ( ) : void
Результат void
		public virtual void NotifyViewport()
		{
			switch ( metricsMode )
			{
				case MetricsMode.Pixels:
					{
						OverlayManager oMgr = OverlayManager.Instance;
						float vpWidth = oMgr.ViewportWidth;
						float vpHeight = oMgr.ViewportHeight;

						// cope with temporarily zero dimensions, avoid divide by zero
						vpWidth = vpWidth == 0.0f ? 1.0f : vpWidth;
						vpHeight = vpHeight == 0.0f ? 1.0f : vpHeight;

						pixelScaleX = 1.0f / vpWidth;
						pixelScaleY = 1.0f / vpHeight;
					}
					break;

				case MetricsMode.Relative_Aspect_Adjusted:
					{
						OverlayManager oMgr = OverlayManager.Instance;
						float vpWidth = oMgr.ViewportWidth;
						float vpHeight = oMgr.ViewportHeight;

						// cope with temporarily zero dimensions, avoid divide by zero
						vpWidth = vpWidth == 0.0f ? 1.0f : vpWidth;
						vpHeight = vpHeight == 0.0f ? 1.0f : vpHeight;

						pixelScaleX = 1.0f / ( 10000.0f * ( vpWidth / vpHeight ) );
						pixelScaleY = 1.0f / 10000.0f;
					}
					break;

				case MetricsMode.Relative:
					pixelScaleX = 1.0f;
					pixelScaleY = 1.0f;
					pixelLeft = left;
					pixelTop = top;
					pixelWidth = width;
					pixelHeight = height;
					break;
			}

			left = pixelLeft * pixelScaleX;
			top = pixelTop * pixelScaleY;
			width = pixelWidth * pixelScaleX;
			height = pixelHeight * pixelScaleY;

			isGeomPositionsOutOfDate = true;
		}

Usage Example

Пример #1
0
        /// <summary>
        ///    Adds another OverlayElement to this container.
        /// </summary>
        /// <param name="element"></param>
        public virtual void AddChildElement(OverlayElement element)
        {
            Debug.Assert(!this.children.ContainsKey(element.Name),
                         string.Format("Child with name '{0}' already defined.", element.Name));

            // add to lookup table and list
            this.children.Add(element.Name, element);

            // inform this child about his/her parent and zorder
            element.NotifyParent(this, overlay);
            element.NotifyZOrder(zOrder + 1);
            element.NotifyWorldTransforms(xform);
            element.NotifyViewport();
        }
All Usage Examples Of Axiom.Overlays.OverlayElement::NotifyViewport