/// <summary> /// Clone this instance /// </summary> public override DrawObject Clone() { DrawLine drawLine = new DrawLine(); drawLine.startPoint = startPoint; drawLine.endPoint = endPoint; FillDrawObjectFields(drawLine); return(drawLine); }
/// <summary> /// Left mouse is released. /// New object is created and resized. /// </summary> /// <param name="drawArea"></param> /// <param name="e"></param> public override void OnMouseUp(ImageDrawBox drawArea, MouseEventArgs e) { drawArea.GraphicsList[0].Normalize(); drawArea.AddCommandToHistory(new CommandAdd(drawArea.GraphicsList[0])); drawArea.ActiveTool = ImageDrawBox.DrawToolType.Pointer; //TODO : 这部分代码需要整理 //zhoujin: 如果是正在定标则删除图形,并弹出定标窗口 if (drawArea.DrawMode == ImageDrawBox.DrawingMode.SetUnit) { DrawObject drawObj = drawArea.GraphicsList[0]; //定标只支持用画直线的方式 if (drawObj is DrawLine) { DrawLine drawLine = drawObj as DrawLine; double pxLen = CalcLenght(drawLine.StartPoint, drawLine.EndPoint); SetUnitForm setUnitForm = new SetUnitForm(drawArea, pxLen); setUnitForm.ShowDialog(); drawArea.GraphicsList.DeleteLastAddedObject(); drawArea.DrawMode = ImageDrawBox.DrawingMode.Measure; } } if (drawArea.DrawMode == ImageDrawBox.DrawingMode.SetROI) { DrawObject drawObj = drawArea.GraphicsList[0]; //设置ROI只支持用矩形绘制 if (drawObj is DrawRectangle) { DrawRectangle drawRect = drawObj as DrawRectangle; drawArea.SetROI(drawRect.GetBoundingBox()); drawArea.GraphicsList.DeleteLastAddedObject(); drawArea.DrawMode = ImageDrawBox.DrawingMode.Measure; } } drawArea.Capture = false; drawArea.Refresh(); drawArea.GraphicsList.Dirty = true; }
/// <summary> /// Clone this instance /// </summary> public override DrawObject Clone() { DrawLine drawLine = new DrawLine(); drawLine.startPoint = this.startPoint; drawLine.endPoint = this.endPoint; FillDrawObjectFields(drawLine); return drawLine; }