public EditRulerForm(LayerRuler.RulerItem rulerItem) { InitializeComponent(); // clone the specified ruler in a new instance that will receive the edited properties mEditedRulerClone = rulerItem.Clone() as LayerRuler.RulerItem; // set the different control with the current state of the ruler // line appearance this.lineThicknessNumericUpDown.Value = (decimal)(rulerItem.LineThickness); this.lineColorPictureBox.BackColor = rulerItem.Color; if (rulerItem is LayerRuler.LinearRuler) { this.allowOffsetCheckBox.Checked = (rulerItem as LayerRuler.LinearRuler).AllowOffset; } else { this.allowOffsetCheckBox.Enabled = false; } // guideline appearance this.dashPatternLineNumericUpDown.Value = (decimal)(rulerItem.GuidelineDashPattern[0]); this.dashPatternSpaceNumericUpDown.Value = (decimal)(rulerItem.GuidelineDashPattern[1]); this.guidelineThicknessNumericUpDown.Value = (decimal)(rulerItem.GuidelineThickness); this.guidelineColorPictureBox.BackColor = rulerItem.GuidelineColor; // measure and unit this.displayUnitCheckBox.Checked = rulerItem.DisplayUnit; this.displayMeasureTextCheckBox.Checked = rulerItem.DisplayDistance; this.unitComboBox.SelectedIndex = (int)(rulerItem.CurrentUnit); this.fontColorPictureBox.BackColor = rulerItem.MeasureColor; updateChosenFont(rulerItem.MeasureFont); }
public Anchor(LayerRuler.RulerItem ruler, int index, PointF localAttachOffset) { mAttachedRuler = ruler; mAttachedPointIndex = index; mLocalAttachOffsetFromCenter = localAttachOffset; mWorldAttachOffsetFromCenter = localAttachOffset; // initialize with a zero angle }
public ScaleRuler(LayerRuler layer, LayerRuler.RulerItem rulerItem, PointF originalPosition, PointF newPosition) { mRulerLayer = layer; mRulerItem = rulerItem; mOriginalPosition = originalPosition; mNewPosition = newPosition; }
public EditRuler(LayerRuler layer, LayerRuler.RulerItem rulerItem, LayerRuler.RulerItem rulerItemTemplateForNewProperties) { mRulerLayer = layer; // memorise the item mRulerItem = rulerItem; // and clone the two templates, for doing undo/redo and keeping the properties when the ruler change mOldRulerItemTemplate = rulerItem.Clone() as LayerRuler.RulerItem; mNewRulerItemTemplate = rulerItemTemplateForNewProperties.Clone() as LayerRuler.RulerItem; }
public AttachRulerToBrick(LayerRuler.RulerItem rulerItem, LayerBrick.Brick brick) { // compute the attach offset in local coordinate PointF attachOffset = RulerAttachementSet.Anchor.sComputeLocalOffsetFromLayerItem(brick, rulerItem.CurrentControlPoint); // create a new Anchor mAnchor = new RulerAttachementSet.Anchor(rulerItem, rulerItem.CurrentControlPointIndex, attachOffset); mBrick = brick; }
/// <summary> /// get the anchor for the specified ruler for its current control point /// </summary> /// <param name="rulerItem">the anchor or null if the specified control point is not attached</param> /// <returns>the anchor that match both the ruler item and the connection point index</returns> public RulerAttachementSet.Anchor getRulerAttachmentAnchor(LayerRuler.RulerItem rulerItem) { foreach (Anchor anchor in mAnchors) { if ((anchor.AttachedRuler == rulerItem) && (anchor.AttachedPointIndex == rulerItem.CurrentControlPointIndex)) { return(anchor); } } return(null); }
public MoveRulerControlPoint(LayerRuler layer, LayerRuler.RulerItem rulerItem, PointF originalPosition, PointF newPosition) { mRulerLayer = layer; mRulerItem = rulerItem; mControlPointIndex = rulerItem.CurrentControlPointIndex; mOriginalPosition = originalPosition; mNewPosition = newPosition; // compute the new attach offset if the control point is attached if (rulerItem.IsCurrentControlPointAttached) { LayerBrick.Brick attachedBrick = rulerItem.BrickAttachedToCurrentControlPoint; mAnchor = attachedBrick.getRulerAttachmentAnchor(rulerItem); mOriginalLocalAttachOffset = mAnchor.LocalAttachOffsetFromCenter; mNewLocalAttachOffset = RulerAttachementSet.Anchor.sComputeLocalOffsetFromLayerItem(attachedBrick, newPosition); mAttachedBrickOrientation = attachedBrick.Orientation; } }
private void copyRulerProperties(LayerRuler.RulerItem rulerTemplate) { // line appearance mRulerItem.LineThickness = rulerTemplate.LineThickness; mRulerItem.Color = rulerTemplate.Color; if (mRulerItem is LayerRuler.LinearRuler) { (mRulerItem as LayerRuler.LinearRuler).AllowOffset = (rulerTemplate as LayerRuler.LinearRuler).AllowOffset; } // guideline appearance mRulerItem.GuidelineDashPattern = rulerTemplate.GuidelineDashPattern; mRulerItem.GuidelineThickness = rulerTemplate.GuidelineThickness; mRulerItem.GuidelineColor = rulerTemplate.GuidelineColor; // measure and unit mRulerItem.DisplayUnit = rulerTemplate.DisplayUnit; mRulerItem.DisplayDistance = rulerTemplate.DisplayDistance; mRulerItem.CurrentUnit = rulerTemplate.CurrentUnit; mRulerItem.MeasureColor = rulerTemplate.MeasureColor; mRulerItem.MeasureFont = rulerTemplate.MeasureFont; // update the display data mRulerItem.updateDisplayDataAndMesurementImage(); mRulerLayer.updateBoundingSelectionRectangle(); }
public DetachRuler(LayerRuler.RulerItem rulerItem, LayerBrick.Brick brick) { mAnchor = brick.getRulerAttachmentAnchor(rulerItem); mBrick = brick; }
private int mRulerItemIndex = -1; // this index is for the redo, to add the ruler at the same place, start with -1 to add it at the end of the list (so on top of the other rulers) public AddRuler(LayerRuler layer, LayerRuler.RulerItem rulerItem) { mRulerLayer = layer; mRulerItem = rulerItem; }