本文整理汇总了C#中Layer.UpdateMaxSpace方法的典型用法代码示例。如果您正苦于以下问题:C# Layer.UpdateMaxSpace方法的具体用法?C# Layer.UpdateMaxSpace怎么用?C# Layer.UpdateMaxSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer.UpdateMaxSpace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateLayer
public override void GenerateLayer(Layer layer, double actualLength, double actualWidth)
{
layer.Clear();
double boxLength = layer.BoxLength;
double boxWidth = layer.BoxWidth;
double palletLength = GetPalletLength(layer);
double palletWidth = GetPalletWidth(layer);
int sizeX = (int)Math.Floor(palletLength / boxLength);
int sizeY = (int)Math.Floor(palletWidth / boxWidth);
double offsetX = 0.5 * (palletLength - actualLength);
double offsetY = 0.5 * (palletWidth - actualWidth);
double spaceX = sizeX > 1 ? (actualLength - sizeX * boxLength) / (sizeX - 1) : 0.0;
double spaceY = sizeY > 1 ? (actualWidth - sizeY * boxWidth) / (sizeY - 1) : 0.0;
for (int i = 0; i < sizeX; ++i)
for (int j = 0; j < sizeY; ++j)
AddPosition(layer
, new Vector2D(
offsetX + i * (boxLength + spaceX)
, offsetY + j * (boxWidth + spaceY)
)
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
// set spacing to ZERO i.e. no spacing with column layout
layer.UpdateMaxSpace(spaceX);
layer.UpdateMaxSpace(spaceY);
}
示例2: GenerateLayer
public override void GenerateLayer(Layer layer, double actualLength, double actualWidth)
{
layer.Clear();
double boxLength = layer.BoxLength;
double boxWidth = layer.BoxWidth;
double palletLength = GetPalletLength(layer);
double palletWidth = GetPalletWidth(layer);
int maxSizeXLength = 0, maxSizeXWidth = 0, maxSizeYLength = 0, maxSizeYWidth = 0;
GetSizeXY(boxLength, boxWidth, palletLength, palletWidth
, out maxSizeXLength, out maxSizeXWidth, out maxSizeYLength, out maxSizeYWidth);
double offsetX = 0.5 * (palletLength - actualLength);
double offsetY = 0.5 * (palletWidth - actualWidth);
double spaceX = maxSizeXLength + maxSizeXWidth > 1 ? (actualLength - (maxSizeXLength * boxLength + maxSizeXWidth * boxWidth)) / (maxSizeXLength + maxSizeXWidth - 1) : 0.0;
double spaceYLength = maxSizeYLength > 1 ? (actualWidth - maxSizeYLength * boxWidth) / (maxSizeYLength - 1) : 0.0;
double spaceYWidth = maxSizeYWidth > 1 ? (actualWidth - maxSizeYWidth * boxLength) / (maxSizeYWidth - 1) : 0.0;
for (int i = 0; i < maxSizeXLength/2; ++i)
for (int j = 0; j < maxSizeYLength; ++j)
{
AddPosition(
layer
, new Vector2D(
offsetX + i * (boxLength + spaceX)
, offsetY + j * (boxWidth + spaceYLength))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
AddPosition(
layer
, new Vector2D(
palletLength - offsetX - i * (boxLength + spaceX)
, palletWidth - offsetY - j * (boxWidth + spaceYLength))
, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N);
}
for (int i = 0; i < maxSizeXWidth; ++i)
for (int j = 0; j < maxSizeYWidth; ++j)
AddPosition(
layer
, new Vector2D(
offsetX + maxSizeXLength/2 * (boxLength + spaceX) + i * (boxWidth + spaceX) + boxWidth
, offsetY + j * (boxLength + spaceYWidth))
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N);
layer.UpdateMaxSpace(spaceX);
layer.UpdateMaxSpace(spaceYLength);
layer.UpdateMaxSpace(spaceYWidth);
}
示例3: GenerateLayer
public override void GenerateLayer(Layer layer, double actualLength, double actualWidth)
{
// initialization
layer.Clear();
double boxLength = layer.BoxLength;
double boxWidth = layer.BoxWidth;
double palletLength = GetPalletLength(layer);
double palletWidth = GetPalletWidth(layer);
// compute optimal layout by evaluating all spirale configurations
int sizeX_area1 = 0, sizeY_area1 = 0, sizeX_area2 = 0, sizeY_area2 = 0;
GetOptimalSizesXY(boxLength, boxWidth, palletLength, palletWidth
, out sizeX_area1, out sizeY_area1, out sizeX_area2, out sizeY_area2);
// compute offsets
double offsetX = 0.5 * (palletLength - actualLength);
double offsetY = 0.5 * (palletWidth - actualWidth);
// area1
for (int i=0; i<sizeX_area1; ++i)
for (int j = 0; j<sizeY_area1; ++j)
{
AddPosition(layer
, new Vector2D(offsetX + i * boxLength, offsetY + j * boxWidth)
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
AddPosition(layer
, new Vector2D(palletLength - offsetX - i * boxLength, palletWidth - offsetY - j * boxWidth)
, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N);
}
double spaceX_Area1 = actualLength - 2.0 * sizeX_area1 * boxLength;
double spaceY_Area1 = actualWidth - 2.0 * sizeY_area1 * boxWidth;
// area2
for (int i=0; i<sizeX_area2; ++i)
for (int j = 0; j<sizeY_area2; ++j)
{
AddPosition(layer
, new Vector2D(palletLength - offsetX - i * boxWidth, offsetY + j * boxLength)
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N);
AddPosition(layer
, new Vector2D(offsetX + i * boxWidth, palletWidth - offsetY - j * boxLength)
, HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_X_P);
}
double spaceX_Area2 = actualLength - 2.0 * sizeX_area2 * boxWidth;
double spaceY_Area2 = actualWidth - 2.0 * sizeY_area2 * boxLength;
double spaceX = spaceX_Area1 > 0 ? spaceX_Area1 : spaceX_Area2;
double spaceY = spaceY_Area1 > 0 ? spaceY_Area1 : spaceY_Area2;
layer.UpdateMaxSpace( Math.Min(spaceX, spaceY) );
}
示例4: GenerateLayer
public override void GenerateLayer(Layer layer, double actualLength, double actualWidth)
{
layer.Clear();
double boxLength = layer.BoxLength;
double boxWidth = layer.BoxWidth;
double palletLength = GetPalletLength(layer);
double palletWidth = GetPalletWidth(layer);
int sizeX_area1 = 0, sizeY_area1 = 0, sizeX_area2 = 0, sizeY_area2 = 0, sizeX_area3 = 0, sizeY_area3 = 0;
GetOptimalSizeArea1(boxLength, boxWidth, palletLength, palletWidth, out sizeX_area1, out sizeY_area1);
GetSizeXY(boxLength, boxWidth, palletLength, palletWidth, sizeX_area1, sizeY_area1
, out sizeX_area2, out sizeY_area2, out sizeX_area3, out sizeY_area3);
// compute offsets
double offsetX = 0.5 * (palletLength - actualLength);
double offsetY = 0.5 * (palletWidth - actualWidth);
// compute spaces
double spaceX_area1 = (actualLength - (boxWidth * sizeX_area1 + boxLength * sizeX_area3)) / (sizeX_area1 + sizeX_area3 > 1 ? (sizeX_area1 + sizeX_area3 - 1) : 1.0);
double spaceX_area2 = (actualLength - sizeX_area2 * boxLength) / (sizeX_area2 > 1 ?(sizeX_area2 - 1) : 1.0);
double spaceX_area3 = spaceX_area1;
double spaceY_area1 = 0.0, spaceY_area2 = 0.0, spaceY_area3 = 0.0;
if (sizeY_area1 * boxLength > sizeY_area3 * boxWidth)
{
spaceY_area1 = (actualWidth - sizeY_area1 * boxLength - sizeY_area2 * boxWidth) / (sizeY_area1 + sizeY_area2 > 1 ?(sizeY_area1 + sizeY_area2 - 1) : 1.0);
spaceY_area2 = spaceY_area1;
spaceY_area3 = (sizeY_area1 * (boxLength + spaceY_area1) - sizeY_area3 * boxWidth) / (0 != sizeY_area3 ? sizeY_area3 : 1.0);
}
else
{
spaceY_area3 = (actualWidth - (sizeY_area2 + sizeY_area3) * boxWidth) / (sizeY_area2 + sizeY_area3 > 1 ? (sizeY_area2 + sizeY_area3 - 1) : 1.0);
spaceY_area2 = spaceY_area3;
spaceY_area1 = (sizeY_area3 * (boxWidth + spaceY_area3) - sizeY_area1 * boxLength) /(sizeY_area1 > 0 ? sizeY_area1 : 1.0);
}
// area1
for (int i = 0; i < sizeX_area1; ++i)
for (int j = 0; j < sizeY_area1; ++j)
AddPosition(layer
, new Vector2D(
offsetX + boxWidth + i * (boxWidth + spaceX_area1)
, offsetY + j * (boxLength + spaceY_area1))
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N);
// area2
for (int i = 0; i < sizeX_area2; ++i)
for (int j = 0; j < sizeY_area2; ++j)
AddPosition(layer
, new Vector2D(
offsetX + i * (boxLength + spaceX_area2)
, actualWidth + offsetY - (j + 1) * boxWidth - j * spaceY_area2)
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
// area3
for (int i = 0; i < sizeX_area3; ++i)
for (int j = 0; j < sizeY_area3; ++j)
AddPosition(layer
, new Vector2D(
offsetX + sizeX_area1 * (boxWidth + spaceX_area1) + i * (boxLength + spaceX_area3)
, offsetY + j * (boxWidth + spaceY_area3))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
layer.UpdateMaxSpace(spaceX_area1);
layer.UpdateMaxSpace(spaceY_area1);
layer.UpdateMaxSpace(spaceX_area2);
layer.UpdateMaxSpace(spaceY_area2);
layer.UpdateMaxSpace(spaceX_area3);
layer.UpdateMaxSpace(spaceY_area3);
}
示例5: GenerateLayer
public override void GenerateLayer(Layer layer, double actualLength, double actualWidth)
{
// initialization
layer.Clear();
double boxLength = layer.BoxLength;
double boxWidth = layer.BoxWidth;
double palletLength = GetPalletLength(layer);
double palletWidth = GetPalletWidth(layer);
// compute optimal layout
int sizeX_area1 = 0, sizeY_area1 = 0
, sizeX_area2 = 0, sizeY_area2 = 0
, sizeX_area3 = 0, sizeY_area3 = 0
, dir_area3 = 0;
GetOptimalSizesXY(
boxLength, boxWidth, palletLength, palletWidth
, out sizeX_area1, out sizeY_area1
, out sizeX_area2, out sizeY_area2
, out sizeX_area3, out sizeY_area3
, out dir_area3);
// compute offsets
double offsetX = 0.5 * (palletLength - actualLength);
double offsetY = 0.5 * (palletWidth - actualWidth);
// area1
for (int i = 0; i < sizeX_area1; ++i)
for (int j = 0; j < sizeY_area1; ++j)
{
AddPosition(layer
, new Vector2D(offsetX + i * boxLength, offsetY + j * boxWidth)
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
AddPosition(layer
, new Vector2D(palletLength - offsetX - i * boxLength, palletWidth - offsetY - j * boxWidth)
, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N);
}
double spaceX_area1 = actualLength - 2 * sizeX_area1 * boxLength;
double spaceY_area1 = actualWidth - 2 * sizeY_area1 * boxWidth;
// area2
for (int i = 0; i < sizeX_area2; ++i)
for (int j = 0; j < sizeY_area2; ++j)
{
AddPosition(layer
, new Vector2D(palletLength - offsetX - i * boxWidth, offsetY + j * boxLength)
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N);
AddPosition(layer
, new Vector2D(offsetX + i * boxWidth, palletWidth - offsetY - j * boxLength)
, HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_X_P);
}
double spaceX_area2 = actualLength - 2 * sizeX_area2 * boxWidth;
double spaceY_area2 = actualWidth - 2 * sizeY_area2 * boxLength;
// area3
for (int i = 0; i < sizeX_area3; ++i)
for (int j = 0; j < sizeY_area3; ++j)
{
if (dir_area3 == 0)
AddPosition(layer
, new Vector2D(
offsetX + 0.5 * (actualLength - sizeX_area3 * boxLength) + i * boxLength
, offsetY + 0.5 * (actualWidth - sizeY_area3 * boxWidth) + j * boxWidth
)
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
else
AddPosition(layer
, new Vector2D(
offsetX + 0.5 * (actualLength - sizeX_area3 * boxWidth) + (i+1) * boxWidth
, offsetY + 0.5 * (actualWidth - sizeY_area3 * boxLength) + j * boxLength
)
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N);
}
double spaceX_area3 = 0.0, spaceY_area3 = 0.0;
if (dir_area3 == 0)
{
spaceX_area3 = 0.5 * (actualLength - sizeX_area3 * boxLength - 2.0 * (spaceX_area1 > 0 ? sizeX_area1 * boxLength : sizeX_area2 * boxWidth));
spaceY_area3 = 0.5 * (actualWidth - sizeY_area3 * boxWidth - 2.0 * (spaceY_area1 > 0 ? sizeY_area1 * boxWidth : sizeY_area2 * boxLength));
}
else
{
spaceX_area3 = 0.5 * (actualLength - sizeX_area3 * boxWidth - 2.0 * (spaceX_area1 > 0 ? sizeX_area1 * boxLength : sizeX_area2 * boxWidth));
spaceY_area3 = 0.5 * (actualWidth - sizeY_area3 * boxLength - 2.0 * (spaceY_area1 > 0 ? sizeY_area1 * boxWidth : sizeY_area2 * boxLength));
}
// set spacing
layer.UpdateMaxSpace(spaceX_area3);
layer.UpdateMaxSpace(spaceY_area3);
}
示例6: GenerateLayer
public override void GenerateLayer(Layer layer, double actualLength, double actualWidth)
{
layer.Clear();
double boxLength = layer.BoxLength;
double boxWidth = layer.BoxWidth;
double palletLength = GetPalletLength(layer);
double palletWidth = GetPalletWidth(layer);
int maxSizeXLength = 0, maxSizeXWidth = 0, maxSizeYLength = 0, maxSizeYWidth = 0, iStep = 0;
GetSizeXY(boxLength, boxWidth, palletLength, palletWidth
, out iStep, out maxSizeXLength, out maxSizeXWidth, out maxSizeYLength, out maxSizeYWidth);
double offsetX = 0.5 * (palletLength - actualLength);
double offsetY = 0.5 * (palletWidth - actualWidth);
for (int i = 0; i < iStep; ++i)
{
double spaceX = maxSizeXLength + maxSizeXWidth > 1
? (actualLength - maxSizeXLength * boxLength - maxSizeXWidth * boxWidth) / (maxSizeXLength + maxSizeXWidth - 1)
: 0.0;
double spaceY = maxSizeYLength + maxSizeYWidth > 1
? (actualWidth - maxSizeYWidth * boxWidth - maxSizeYLength * boxLength) / (maxSizeYLength + maxSizeYWidth - 1)
: 0.0;
double xBase = offsetX + i * (boxLength + spaceX);
double yBase = offsetY + i * (boxWidth + spaceY);
// first box
AddPosition(
layer
, new Vector2D(xBase + boxWidth, yBase)
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N);
// along X
for (int ix = 0; ix < iStep - 1 - i; ++ix)
AddPosition(
layer
, new Vector2D(
xBase + boxWidth + spaceX + ix * (boxLength + spaceX)
, yBase)
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
int maxY = (int)Math.Floor(actualWidth / boxWidth);
double ySpaceNew = maxY > 1 ? (actualWidth - boxWidth * maxY) / (maxY - 1) : 0;
for (int ix = iStep - 1 - i; ix < maxSizeXLength - i && i < iStep - 1; ++ix)
AddPosition(
layer
, new Vector2D(
xBase + boxWidth + spaceX + ix * (boxLength + spaceX)
, offsetY + i * (boxWidth + ySpaceNew))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
// along Y
for (int iy = 0; iy < iStep - 1 - i; ++iy)
AddPosition(
layer
, new Vector2D(
xBase
, yBase + boxLength + spaceY + iy * (boxWidth + spaceY))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
int maxX = (int)Math.Floor(actualLength / boxLength);
double xSpaceNew = maxX > 1 ? (actualLength - boxLength * maxX) / (maxX - 1) : 0;
for (int iy = iStep - 1 - i; iy < maxSizeYWidth - i && i < iStep - 1; ++iy)
{
AddPosition(
layer
, new Vector2D(
offsetX + i * (boxLength + xSpaceNew)
, yBase + boxLength + spaceY + iy * (boxWidth + spaceY))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
}
// set spacing
layer.UpdateMaxSpace(spaceX);
layer.UpdateMaxSpace(spaceY);
layer.UpdateMaxSpace(Math.Abs(boxLength - boxWidth));
}
}
示例7: GenerateLayer
public override void GenerateLayer(Layer layer, double actualLength, double actualWidth)
{
layer.Clear();
double boxLength = layer.BoxLength;
double boxWidth = layer.BoxWidth;
double palletLength = GetPalletLength(layer);
double palletWidth = GetPalletWidth(layer);
int maxSizeXLength = 0, maxSizeXWidth = 0, maxSizeYLength = 0, maxSizeYWidth = 0;
int fillSizeXLength = 0, fillSizeYLength = 0, fillSizeXWidth = 0, fillSizeYWidth = 0;
GetSizeXY(boxLength, boxWidth, palletLength, palletWidth
, out maxSizeXLength, out maxSizeYLength, out maxSizeXWidth, out maxSizeYWidth
, out fillSizeXLength, out fillSizeYLength, out fillSizeXWidth, out fillSizeYWidth);
double offsetX = 0.5 * (palletLength - actualLength);
double offsetY = 0.5 * (palletWidth - actualWidth);
double spaceX = maxSizeXLength + maxSizeXWidth > 1 ? (actualLength - (maxSizeXLength * boxLength + maxSizeXWidth * boxWidth)) / (maxSizeXLength + maxSizeXWidth - 1) : 0.0;
double spaceYLength = maxSizeYLength > 1 ? (actualWidth - maxSizeYLength * boxWidth - fillSizeYLength * boxLength) / (maxSizeYLength + fillSizeYLength - 1) : 0.0;
double spaceYWidth = maxSizeYWidth > 1 ? (actualWidth - maxSizeYWidth * boxLength - fillSizeYWidth * boxWidth) / (maxSizeYWidth + fillSizeYWidth - 1) : 0.0;
if (1 == maxSizeYLength % 2)
{
// LENGTH
for (int i = 0; i < maxSizeXLength; ++i)
for (int j = 0; j < maxSizeYLength; ++j)
{
AddPosition(
layer
, new Vector2D(
offsetX + i * (boxLength + spaceX)
, offsetY + j * (boxWidth + spaceYLength))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
}
}
else
{
// LENGTH
for (int i = 0; i < maxSizeXLength; ++i)
for (int j = 0; j < maxSizeYLength / 2; ++j)
{
AddPosition(
layer
, new Vector2D(
offsetX + i * (boxLength + spaceX)
, offsetY + j * (boxWidth + spaceYLength))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
}
for (int i = 0; i < maxSizeXLength; ++i)
for (int j = maxSizeYLength / 2; j < maxSizeYLength; ++j)
{
AddPosition(
layer
, new Vector2D(
offsetX + i * (boxLength + spaceX)
, offsetY + j * (boxWidth + spaceYLength) + (fillSizeYLength > 0 ? (spaceYLength + boxLength) : 0.0))
, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
}
double spaceXFill = fillSizeXLength > 1
? (maxSizeXLength * (boxLength + spaceX) - fillSizeXLength * boxWidth) / (fillSizeXLength-1)
: 0;
layer.UpdateMaxSpace(spaceXFill);
for (int i = 0; i < fillSizeXLength; ++i)
for (int j = 0; j < fillSizeYLength; ++j)
{
AddPosition(
layer
, new Vector2D(
offsetX + boxWidth + i * (boxWidth + spaceXFill)
, offsetY + (maxSizeYLength / 2) * (boxWidth + spaceYLength) + j * boxLength)
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N
);
}
}
// WIDTH
if (1 == maxSizeYWidth % 2)
{
for (int i = 0; i < maxSizeXWidth; ++i)
for (int j = 0; j < maxSizeYWidth; ++j)
{
AddPosition(
layer
, new Vector2D(
offsetX + maxSizeXLength * (boxLength + spaceX) + i * (boxWidth + spaceX) + boxWidth
, offsetY + j * (boxLength + spaceYWidth))
, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N);
}
}
else
{
for (int i = 0; i < maxSizeXWidth; ++i)
for (int j = 0; j < maxSizeYWidth / 2; ++j)
{
AddPosition(
layer
, new Vector2D(
offsetX + maxSizeXLength * (boxLength + spaceX) + i * (boxWidth + spaceX) + boxWidth
, offsetY + j * (boxLength + spaceYWidth))
//.........这里部分代码省略.........