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


C# IDiagramPresenter.ResetTransformation方法代码示例

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


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

示例1: Draw

 public override void Draw(IDiagramPresenter diagramPresenter)
 {
     Shape shape = null;
     if (diagramPresenter.Diagram != null && diagramPresenter.Diagram.Shapes.Count > 0)
         shape = diagramPresenter.Diagram.Shapes.TopMost;
     if (shape != null) {
         diagramPresenter.ResetTransformation();
         try {
             foreach (ControlPointId id in shape.GetControlPointIds(ControlPointCapabilities.All)) {
                 if (id == ControlPointId.Reference) continue;
                 IndicatorDrawMode drawMode = (SelectedPointId == id) ? IndicatorDrawMode.Highlighted : IndicatorDrawMode.Normal;
                 if (shape.HasControlPointCapability(id, ControlPointCapabilities.Resize))
                     diagramPresenter.DrawResizeGrip(drawMode, shape, id);
                 if (shape.HasControlPointCapability(id, ControlPointCapabilities.Connect | ControlPointCapabilities.Glue))
                     diagramPresenter.DrawConnectionPoint(drawMode, shape, id);
                 if (shape.HasControlPointCapability(id, ControlPointCapabilities.Rotate))
                     diagramPresenter.DrawRotateGrip(drawMode, shape, id);
             }
         } finally {
             diagramPresenter.RestoreTransformation();
         }
     }
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:23,代码来源:ShapeInfoDialog.cs

示例2: Draw

		public override void Draw(IDiagramPresenter diagramPresenter)
		{
			if (diagramPresenter == null) throw new ArgumentNullException("diagramPresenter");

			// always draw all the connection points on all shapes
			diagramPresenter.ResetTransformation();
			try {
				foreach (Shape shape in diagramPresenter.Diagram.Shapes) {
					if (shape is FilterSetupShapeBase) {
						FilterSetupShapeBase filterShape = shape as FilterSetupShapeBase;

						for (int i = 0; i < filterShape.InputCount; i++) {
							diagramPresenter.DrawConnectionPoint(IndicatorDrawMode.Normal, shape, filterShape.GetControlPointIdForInput(i));
						}
						for (int i = 0; i < filterShape.OutputCount; i++) {
							diagramPresenter.DrawConnectionPoint(IndicatorDrawMode.Normal, shape, filterShape.GetControlPointIdForOutput(i));
						}
					}
				}
			}
			finally {
				diagramPresenter.RestoreTransformation();
			}

			// conditionally take extra action, based on what we're currently doing
			switch (CurrentAction) {
				case Action.Select:
					// nothing to do
					break;

				case Action.None:
					break;

				case Action.SelectWithFrame:
					diagramPresenter.ResetTransformation();
					try {
						diagramPresenter.DrawSelectionFrame(frameRect);
					}
					finally {
						diagramPresenter.RestoreTransformation();
					}
					break;

				case Action.MoveShape:
				case Action.MoveHandle:
					// Draw shape previews first
					diagramPresenter.DrawShapes(Previews.Values);

					// Then draw snap-lines and -points
					if (selectedShapeAtCursorInfo != null && (snapPtId > 0 || snapDeltaX != 0 || snapDeltaY != 0)) {
						Shape previewAtCursor = FindPreviewOfShape(selectedShapeAtCursorInfo.Shape);
						diagramPresenter.DrawSnapIndicators(previewAtCursor);
					}
					// Finally, draw highlighted connection points and/or highlighted shape outlines
					if (diagramPresenter.SelectedShapes.Count == 1 && selectedShapeAtCursorInfo.ControlPointId != ControlPointId.None) {
						Shape preview = FindPreviewOfShape(diagramPresenter.SelectedShapes.TopMost);
						if (preview.HasControlPointCapability(selectedShapeAtCursorInfo.ControlPointId, ControlPointCapabilities.Glue)) {
							// Find and highlight valid connection targets in range
							Point p = preview.GetControlPointPosition(selectedShapeAtCursorInfo.ControlPointId);
							DrawConnectionTargets(ActionDiagramPresenter, selectedShapeAtCursorInfo.Shape,
							                      selectedShapeAtCursorInfo.ControlPointId, p, ActionDiagramPresenter.SelectedShapes);
						}
					}
					break;

				case Action.ConnectShapes:
					ShapeConnectionInfo connectionInfo = currentConnectionLine.GetConnectionInfo(ControlPointId.LastVertex, null);
					if (!connectionInfo.IsEmpty) {
						FilterSetupShapeBase shape = connectionInfo.OtherShape as FilterSetupShapeBase;
						if (shape != null) {
							FilterSetupShapeBase.FilterShapeControlPointType type = shape.GetTypeForControlPoint(connectionInfo.OtherPointId);
							if (type == FilterSetupShapeBase.FilterShapeControlPointType.Input ||
							    type == FilterSetupShapeBase.FilterShapeControlPointType.Output) {
								diagramPresenter.ResetTransformation();
								diagramPresenter.DrawConnectionPoint(IndicatorDrawMode.Highlighted, shape, connectionInfo.OtherPointId);
								diagramPresenter.RestoreTransformation();
							}
						}
					}
					break;

				default:
					throw new NShapeUnsupportedValueException(CurrentAction);
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:85,代码来源:ConfigFiltersAndPatching-Tools.cs

示例3: DrawConnectionTargets

		/// <summary>
		/// Draws all connection targets in range.
		/// </summary>
		protected void DrawConnectionTargets(IDiagramPresenter diagramPresenter, Shape shape, ControlPointId gluePtId, Point newGluePtPos, IEnumerable<Shape> excludedShapes) {
			if (diagramPresenter == null) throw new ArgumentNullException("diagramPresenter");
			if (!Geometry.IsValid(newGluePtPos)) throw new ArgumentException("newGluePtPos");
			if (shape == null) throw new ArgumentNullException("shape");
			//if (gluePtId == ControlPointId.None || gluePtId == ControlPointId.Any)
			//   throw new ArgumentException(string.Format("{0} is not a valid {1} for this operation.", gluePtId, typeof(ControlPointId).Name));
			//if (!shape.HasControlPointCapability(gluePtId, ControlPointCapabilities.Glue))
			//   throw new ArgumentException(string.Format("{0} is not a valid glue point.", gluePtId));
			if (!diagramPresenter.Project.SecurityManager.IsGranted(Permission.Connect, shape))
				return;

			// Find connection target shape at the given position
			ShapeAtCursorInfo shapeAtCursor = ShapeAtCursorInfo.Empty;
			if (shape != null && gluePtId != ControlPointId.None)
				shapeAtCursor = FindConnectionTarget(diagramPresenter, shape, gluePtId, newGluePtPos, false, false);
			else shapeAtCursor = FindConnectionTargetFromPosition(diagramPresenter, newGluePtPos.X, newGluePtPos.Y, false, false);

			// Add shapes in range to the shapebuffer and then remove all excluded shapes
			shapeBuffer.Clear();
			shapeBuffer.AddRange(shapesInRange);
			foreach (Shape excludedShape in excludedShapes) {
				shapeBuffer.Remove(excludedShape);
				if (excludedShape == shapeAtCursor.Shape)
					shapeAtCursor.Clear();
			}

			// If there is no ControlPoint under the Cursor and the cursor is over a shape, draw the shape's outline
			if (!shapeAtCursor.IsEmpty && shapeAtCursor.ControlPointId == ControlPointId.Reference
				&& shapeAtCursor.Shape.ContainsPoint(newGluePtPos.X, newGluePtPos.Y)) {
				diagramPresenter.DrawShapeOutline(IndicatorDrawMode.Highlighted, shapeAtCursor.Shape);
			}

			// Draw all connectionPoints of all shapes in range (except the excluded ones, see above)
			diagramPresenter.ResetTransformation();
			try {
				for (int i = shapeBuffer.Count - 1; i >= 0; --i) {
					foreach (int ptId in shapeBuffer[i].GetControlPointIds(ControlPointCapabilities.Connect)) {
						IndicatorDrawMode drawMode = IndicatorDrawMode.Normal;
						if (shapeBuffer[i] == shapeAtCursor.Shape && ptId == shapeAtCursor.ControlPointId)
							drawMode = IndicatorDrawMode.Highlighted;
						diagramPresenter.DrawConnectionPoint(drawMode, shapeBuffer[i], ptId);
					}
				}
			} finally { diagramPresenter.RestoreTransformation(); }
		}
开发者ID:jestonitiro,项目名称:nshape,代码行数:48,代码来源:Tool.cs

示例4: Draw

		/// <override></override>
		public override void Draw(IDiagramPresenter diagramPresenter) {
			if (diagramPresenter == null) throw new ArgumentNullException("diagramPresenter");
			// Draw preview shape
			if (PreviewShape != null) {
				// Draw preview shape and its ControlPoints
				diagramPresenter.DrawShape(PreviewShape);
				diagramPresenter.ResetTransformation();
				try {
					foreach (ControlPointId pointId in PreviewShape.GetControlPointIds(ControlPointCapabilities.Glue | ControlPointCapabilities.Resize))
						diagramPresenter.DrawResizeGrip(IndicatorDrawMode.Normal, PreviewShape, pointId);
				} finally { diagramPresenter.RestoreTransformation(); }
			}

			// Highlight ConnectionPoints in range
			if (!CurrentMouseState.IsEmpty) {
				if (Template.Shape.HasControlPointCapability(ControlPointId.LastVertex, ControlPointCapabilities.Glue)) {
					if (PreviewShape == null) DrawConnectionTargets(diagramPresenter, Template.Shape, CurrentMouseState.X, CurrentMouseState.Y);
					else {
						Point gluePtPos = PreviewShape.GetControlPointPosition(ControlPointId.LastVertex);
						DrawConnectionTargets(diagramPresenter, PreviewShape, ControlPointId.LastVertex, gluePtPos);
					}
				}
			}
		}
开发者ID:jestonitiro,项目名称:nshape,代码行数:25,代码来源:Tool.cs

示例5: Draw

 /// <override></override>
 public override void Draw(IDiagramPresenter diagramPresenter)
 {
     if (diagramPresenter == null) throw new ArgumentNullException("diagramPresenter");
     diagramPresenter.ResetTransformation();
     try {
         // draw stroke(s)
         foreach (Stroke stroke in strokeSet) {
             for (int i = 0; i < stroke.Count - 1; ++i)
                 diagramPresenter.DrawLine(stroke[i], stroke[i + 1]);
         }
         // draw stroke(s)
         for (int i = 0; i < currentStroke.Count - 1; ++i)
             diagramPresenter.DrawLine(currentStroke[i], currentStroke[i + 1]);
     } finally { diagramPresenter.RestoreTransformation(); }
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:16,代码来源:FreeHandTool.cs


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