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;
 }
 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;
     }
 }
Exemplo n.º 3
0
 public override void recreateLinksAfterLoading()
 {
     // try to find the brick with the id we read
     LayerBrick.Brick brick = Map.sHashtableForRulerAttachementRebuilding[mAttachedBrickHashCodeUsedDuringLoading] as LayerBrick.Brick;
     if (brick != null)
     {
         // compute the attach offset in local coordinate
         PointF attachOffset = RulerAttachementSet.Anchor.sComputeLocalOffsetFromLayerItem(brick, this.Center);
         // create a new Anchor
         RulerAttachementSet.Anchor anchor = new RulerAttachementSet.Anchor(this, 0, attachOffset);
         brick.attachRuler(anchor);
     }
 }