当前位置: 首页>>代码示例>>C#>>正文


C# UITouch.GetAzimuthAngle方法代码示例

本文整理汇总了C#中UITouch.GetAzimuthAngle方法的典型用法代码示例。如果您正苦于以下问题:C# UITouch.GetAzimuthAngle方法的具体用法?C# UITouch.GetAzimuthAngle怎么用?C# UITouch.GetAzimuthAngle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UITouch的用法示例。


在下文中一共展示了UITouch.GetAzimuthAngle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LinePoint

		public LinePoint (UITouch touch, int sequenceNumber, PointType pointType)
		{
			SequenceNumber = sequenceNumber;
			Type = touch.Type;
			PointType = pointType;

			Timestamp = touch.Timestamp;
			var view = touch.View;
			Location = touch.LocationInView (view);
			PreciseLocation = touch.GetPreciseLocation (view);
			AzimuthAngle = touch.GetAzimuthAngle (view);
			EstimatedProperties = touch.EstimatedProperties;
			EstimatedPropertiesExpectingUpdates = touch.EstimatedPropertiesExpectingUpdates;
			AltitudeAngle = touch.AltitudeAngle;
			Force = (Type == UITouchType.Stylus || touch.Force > 0) ? touch.Force : 1f;

			if (EstimatedPropertiesExpectingUpdates != 0)
				PointType = this.PointType.Add (PointType.NeedsUpdate);

			EstimationUpdateIndex = touch.EstimationUpdateIndex;
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:21,代码来源:LinePoint.cs

示例2: UpdateReticleView

		void UpdateReticleView (UITouch touch, bool predicated = false)
		{
			if (touch == null)
				return;

			ReticleView.PredictedDotLayer.Hidden = !predicated;
			ReticleView.PredictedLineLayer.Hidden = !predicated;

			ReticleView.Center = touch.LocationInView (touch.View);

			var azimuthAngle = touch.GetAzimuthAngle (touch.View);
			var azimuthUnitVector = touch.GetAzimuthUnitVector (touch.View);
			var altitudeAngle = touch.AltitudeAngle;

			if (predicated) {
				ReticleView.PredictedAzimuthAngle = azimuthAngle;
				ReticleView.PredictedAzimuthUnitVector = azimuthUnitVector;
				ReticleView.PredictedAzimuthAngle = altitudeAngle;
			} else {
				ReticleView.ActualAzimuthAngle = azimuthAngle;
				ReticleView.ActualAzimuthUnitVector = azimuthUnitVector;
				ReticleView.ActualAzimuthAngle = altitudeAngle;
			}
		}
开发者ID:russellharvey,项目名称:monotouch-samples,代码行数:24,代码来源:MainViewController.cs

示例3: Collect

		void Collect (Stroke stroke, UITouch touch, UIView view, bool coalesced, bool predicted)
		{
			if (view == null)
				throw new ArgumentNullException ();

			// Only collect samples that actually moved in 2D space.
			var location = touch.GetPreciseLocation (view);
			var previousSample = stroke.Samples.LastOrDefault ();
			if (Distance (previousSample?.Location, location) < 0.003)
				return;

			var sample = new StrokeSample {
				Timestamp = touch.Timestamp,
				Location = location,
				Coalesced = coalesced,
				Predicted = predicted
			};
			bool collectForce = touch.Type == UITouchType.Stylus || view.TraitCollection.ForceTouchCapability == UIForceTouchCapability.Available;
			if (collectForce)
				sample.Force = touch.Force;

			if (touch.Type == UITouchType.Stylus) {
				var estimatedProperties = touch.EstimatedProperties;
				sample.EstimatedProperties = estimatedProperties;
				sample.EstimatedPropertiesExpectingUpdates = touch.EstimatedPropertiesExpectingUpdates;
				sample.Altitude = touch.AltitudeAngle;
				sample.Azimuth = touch.GetAzimuthAngle (view);

				if (stroke.Samples.Count == 0 && estimatedProperties.HasFlag (UITouchProperties.Azimuth)) {
					stroke.ExpectsAltitudeAzimuthBackfill = true;
				} else if (stroke.ExpectsAltitudeAzimuthBackfill &&
						   !estimatedProperties.HasFlag (UITouchProperties.Azimuth)) {
					for (int index = 0; index < stroke.Samples.Count; index++) {
						var priorSample = stroke.Samples [index];
						var updatedSample = priorSample;

						if (updatedSample.EstimatedProperties.HasFlag (UITouchProperties.Altitude)) {
							updatedSample.EstimatedProperties &= ~UITouchProperties.Altitude;
							updatedSample.Altitude = sample.Altitude;
						}
						if (updatedSample.EstimatedProperties.HasFlag (UITouchProperties.Azimuth)) {
							updatedSample.EstimatedProperties &= ~UITouchProperties.Azimuth;
							updatedSample.Azimuth = sample.Azimuth;
						}
						stroke.Update (updatedSample, index);
					}
					stroke.ExpectsAltitudeAzimuthBackfill = false;
				}
			}

			if (predicted) {
				stroke.AddPredicted (sample);
			} else {
				var index = stroke.Add (sample);
				if (touch.EstimatedPropertiesExpectingUpdates != 0) {
					outstandingUpdateIndexes [touch.EstimationUpdateIndex] = new StrokeIndex {
						Stroke = stroke,
						Index = index
					};
				}
			}
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:62,代码来源:StrokeGestureRecognizer.cs

示例4: UpdateReticleView

		void UpdateReticleView (UITouch touch, bool predicated = false)
		{
			if (touch == null || touch.Type != UITouchType.Stylus)
				return;

			ReticleView.PredictedDotLayer.Hidden = !predicated;
			ReticleView.PredictedLineLayer.Hidden = !predicated;

			var azimuthAngle = touch.GetAzimuthAngle (View);
			var azimuthUnitVector = touch.GetAzimuthUnitVector (View);
			var altitudeAngle = touch.AltitudeAngle;

			if (predicated) {
				ReticleView.PredictedAzimuthAngle = azimuthAngle;
				ReticleView.PredictedAzimuthUnitVector = azimuthUnitVector;
				ReticleView.PredictedAltitudeAngle = altitudeAngle;
			} else {
				var location = touch.PreviousLocationInView (View);
				ReticleView.Center = location;
				ReticleView.ActualAzimuthAngle = azimuthAngle;
				ReticleView.ActualAzimuthUnitVector = azimuthUnitVector;
				ReticleView.ActualAltitudeAngle = altitudeAngle;
			}
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:24,代码来源:MainViewController.cs

示例5: UpdateWithTouch

		public bool UpdateWithTouch (UITouch touch)
		{
			if (!touch.EstimationUpdateIndex.IsEqualTo(EstimationUpdateIndex))
				return false;

			// An array of the touch properties that may be of interest.
			UITouchProperties[] touchProperties = {
				UITouchProperties.Location,
				UITouchProperties.Force,
				UITouchProperties.Altitude,
				UITouchProperties.Azimuth
			};

			// Iterate through possible properties.
			foreach (var expectedProperty in touchProperties) {
				// If an update to this property is not expected, continue to the next property.
				if (EstimatedPropertiesExpectingUpdates.HasFlag (expectedProperty))
					continue;

				switch (expectedProperty) {
				case UITouchProperties.Force:
					Force = touch.Force;
					break;
				case UITouchProperties.Azimuth:
					AzimuthAngle = touch.GetAzimuthAngle (touch.View);
					break;
				case UITouchProperties.Altitude:
					AltitudeAngle = touch.AltitudeAngle;
					break;
				case UITouchProperties.Location:
					Location = touch.LocationInView (touch.View);
					PreciseLocation = touch.PreviousLocationInView (touch.View);
					break;
				}

				// Flag that this point now has a 'final' value for this property.
				if (!touch.EstimatedProperties.HasFlag (expectedProperty))
					EstimatedProperties &= ~expectedProperty;

				// Flag that this point is no longer expecting updates for this property.
				if (!touch.EstimatedPropertiesExpectingUpdates.HasFlag (expectedProperty)) {
					EstimatedPropertiesExpectingUpdates &= ~expectedProperty;

					if (EstimatedPropertiesExpectingUpdates == 0) {
						PointType &= ~PointType.NeedsUpdate;
						PointType |= PointType.Updated;
					}
				}
			}

			return true;
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:52,代码来源:LinePoint.cs


注:本文中的UITouch.GetAzimuthAngle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。