public override void ApplyConstraint(
PhysicalAxis pXAxis1, PhysicalAxis pYAxis1,
PhysicalAxis pXAxis2, PhysicalAxis pYAxis2)
{
int desiredLength = (int)(pXAxis1.Axis.WorldLength / (double)this.pWorldLength_);
int currentLength = pXAxis1.PhysicalLength;
int delta = currentLength - desiredLength;
int changeLeft = delta / 2;
int changeRight = delta / 2;
if (this.holdFixedY_ != null)
{
if ((PlotSurface2D.YAxisPosition)this.holdFixedY_ == PlotSurface2D.YAxisPosition.Left)
{
changeLeft = 0;
changeRight = delta;
}
else
{
changeLeft = delta;
changeRight = 0;
}
}
pXAxis1.PhysicalMin = new Point(pXAxis1.PhysicalMin.X + changeLeft, pXAxis1.PhysicalMin.Y);
pXAxis1.PhysicalMax = new Point(pXAxis1.PhysicalMax.X - changeRight, pXAxis1.PhysicalMax.Y);
pXAxis2.PhysicalMin = new Point(pXAxis2.PhysicalMin.X + changeLeft, pXAxis2.PhysicalMin.Y);
pXAxis2.PhysicalMax = new Point(pXAxis2.PhysicalMax.X - changeRight, pXAxis2.PhysicalMax.Y);
pYAxis1.PhysicalMin = new Point(pYAxis1.PhysicalMin.X + changeLeft, pYAxis1.PhysicalMin.Y);
pYAxis1.PhysicalMax = new Point(pYAxis1.PhysicalMax.X + changeLeft, pYAxis1.PhysicalMax.Y);
pYAxis2.PhysicalMin = new Point(pYAxis2.PhysicalMin.X - changeRight, pYAxis2.PhysicalMin.Y);
pYAxis2.PhysicalMax = new Point(pYAxis2.PhysicalMax.X - changeRight, pYAxis2.PhysicalMax.Y);
}
}