Changeset 13465
- Timestamp:
- 12/14/15 20:23:19 (9 years ago)
- Location:
- branches/HeuristicLab.BinPacking
- Files:
-
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan2DView.cs
r13462 r13465 86 86 Redraw(Content); 87 87 packingPlan2D.Refresh(); 88 packingPlan2D.Refresh();89 packingPlan2D.Refresh();90 packingPlan2D.Refresh();91 packingPlan2D.Refresh();92 88 } 93 89 … … 107 103 } 108 104 packingPlan2D.Refresh(); 109 packingPlan2D.Refresh();110 packingPlan2D.Refresh();111 packingPlan2D.Refresh();112 packingPlan2D.Refresh();113 105 } 114 106 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs
r13462 r13465 89 89 itemSelection.Items.Clear(); 90 90 int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0; 91 //for (int i = 0; i < Content.PackingItemPositions.Count; i++) {92 // if (Content.PackingItemPositions[i].AssignedBin == currentBin)93 // itemSelection.Items.Add(i);94 //}95 91 foreach (var entry in Content.BinPackings[currentBin].ItemMeasures) { 96 92 itemSelection.Items.Add(entry.Key); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Properties/AssemblyInfo.cs.frame
r13032 r13465 28 28 // associated with an assembly. 29 29 [assembly: AssemblyTitle("HeuristicLab.Problems.BinPacking.Views")] 30 [assembly: AssemblyDescription("HeuristicLab bin Packing-views classes")]30 [assembly: AssemblyDescription("HeuristicLab bin packing views")] 31 31 [assembly: AssemblyConfiguration("")] 32 32 [assembly: AssemblyCompany("")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 2 HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2015 HEAL and Joseph Helm")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] … … 54 54 // by using the '*' as shown below: 55 55 [assembly: AssemblyVersion("3.3.0.0")] 56 [assembly: AssemblyFileVersion("3.3. 7.$WCREV$")]56 [assembly: AssemblyFileVersion("3.3.14.$WCREV$")] -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/RectangularPackingShapeView.cs
r13464 r13465 32 32 } 33 33 34 35 34 public new RectangularPackingShape Content { 36 35 get { return (RectangularPackingShape)base.Content; } 37 36 set { base.Content = value; } 38 37 } 39 40 38 41 39 protected override void OnContentChanged() { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Properties/AssemblyInfo.cs.frame
r13032 r13465 32 32 [assembly: AssemblyCompany("")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 2 HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2015 HEAL and Joseph Helm")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] … … 54 54 // by using the '*' as shown below: 55 55 [assembly: AssemblyVersion("3.3.0.0")] 56 [assembly: AssemblyFileVersion("3.3. 7.$WCREV$")]56 [assembly: AssemblyFileVersion("3.3.14.$WCREV$")] -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/2D/PackingPlan2D.cs
r13161 r13465 33 33 namespace PackingPlanVisualizations { 34 34 public partial class PackingPlan2D : UserControl { 35 WindowRenderTarget wndRender 36 Factory2D1 factory 37 SharpDX.DirectWrite.Factory dwFactory 38 RenderTargetProperties rndTargProperties 35 WindowRenderTarget wndRender = null; 36 Factory2D1 factory = new Factory2D1(FactoryType2D1.SingleThreaded); 37 SharpDX.DirectWrite.Factory dwFactory = new SharpDX.DirectWrite.Factory(SharpDX.DirectWrite.FactoryType.Shared); 38 RenderTargetProperties rndTargProperties = new RenderTargetProperties(new PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied)); 39 39 HwndRenderTargetProperties hwndProperties = new HwndRenderTargetProperties(); 40 40 41 41 42 #region Packing members BEGIN 42 #region Packing members BEGIN 43 43 SolidColorBrush containerBrush; 44 44 SolidColorBrush containerFillingBrush; … … 71 71 containerFillingBrush = new SolidColorBrush(wndRender, Colors.DarkGray); 72 72 itemBrush = new SolidColorBrush(wndRender, Colors.Black); 73 itemFillingBrush = new SolidColorBrush(wndRender, new Color4 73 itemFillingBrush = new SolidColorBrush(wndRender, new Color4(Color3.White, 0.5f)); 74 74 labelBrush = new SolidColorBrush(wndRender, Colors.Black); 75 75 } … … 80 80 81 81 //Packing-Methods 82 public void InitializeContainer 83 container = new CenteredContainer2D(new Vector2 (this.Width, this.Height), new Vector2 (width, height));82 public void InitializeContainer(float width, float height) { 83 container = new CenteredContainer2D(new Vector2(this.Width, this.Height), new Vector2(width, height)); 84 84 } 85 85 86 86 public void AddItemToContainer(float width, float height, float x, float y, string label) { 87 container.AddItem(new Vector2(width, height), new Vector2 87 container.AddItem(new Vector2(width, height), new Vector2(x, y), label); 88 88 } 89 89 90 91 92 93 94 95 //Event-Listeners 90 //Event-Listeners 96 91 97 92 private void PackingPlan2D_Load(object sender, EventArgs e) { … … 101 96 private void PackingPlan2D_Paint(object sender, PaintEventArgs e) { 102 97 wndRender.BeginDraw(); 103 var controlColor = Colors.White; //System.Drawing.SystemColors.Control;104 wndRender.Clear(new Colors 98 var controlColor = Colors.White; 99 wndRender.Clear(new Colors(controlColor.R, controlColor.G, controlColor.B)); 105 100 106 101 if (container != null) { 107 102 container.UpdateContainer(new Vector2(this.Width, this.Height)); 108 103 wndRender.FillRectangle(container.GetContainerData(), containerFillingBrush); 109 110 //foreach (PackingPlanVisualizations.CenteredContainer2D.PackingItem item in container.GetPackingItems()) {111 // SharpDX.RectangleF rect = item.GetRectangle(container.ContainerTopLeft);112 // wndRender.DrawRectangle(rect, itemBrush, 2f);113 // wndRender.FillRectangle(rect, itemFillingBrush);114 // wndRender.DrawText(item.GetLabel(), textFormat, rect, labelBrush);115 //}116 104 117 105 foreach (PackingPlanVisualizations.CenteredContainer2D.LabeledRectangle item in container.GetItemRectangles()) { … … 131 119 if (wndRender != null) 132 120 wndRender.Resize(new Size2(this.Width, this.Height)); 133 //this.Refresh();134 121 } 135 122 -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/BasicCuboidShape.cs
r13032 r13465 25 25 26 26 namespace PackingPlanVisualizations { 27 27 28 28 public class BasicCuboidShape { 29 29 //Basic information 30 private Vector3 shapeSize;30 private readonly Vector3 shapeSize; 31 31 public Vector3 ShapeSize { get { return shapeSize; } } 32 private Vector3 shapePosition;32 private readonly Vector3 shapePosition; 33 33 public Vector3 ShapePosition { get { return shapePosition; } } 34 private int shapeID;34 private readonly int shapeID; 35 35 public int ShapeID { get { return shapeID; } } 36 36 public int Material { get; set; } 37 37 38 38 39 //Vertices 39 //Vertices 40 40 private VertexPositionColorNormal[] shapeTriangleVertices; 41 41 private VertexPositionColorNormal[] shapeLineVertices; 42 42 43 43 public BasicCuboidShape(Vector3 size, Vector3 position, int shapeNr, int material) { 44 shapeSize 45 shapePosition 46 shapeID 44 shapeSize = size; 45 shapePosition = position; 46 shapeID = shapeNr; 47 47 this.Material = material; 48 48 } … … 65 65 66 66 public void RenderShapeTriangles(GraphicsDevice device) { 67 RenderShapeTriangles(device, Material == 0 ? new Color(60, 60,60) :new Color (0,0,0));67 RenderShapeTriangles(device, Material == 0 ? new Color(60, 60, 60) : new Color(0, 0, 0)); 68 68 } 69 69 … … 85 85 } 86 86 87 public Vector3 CalculatePositionRelativeToBottomLeftBackCorner(Vector3 itemSize, Vector3 itemPosition) { 88 //Vector3 bottomLeftBack = shapePosition + new Vector3(-1.0f, -1.0f, 1.0f) * shapeSize; 89 Vector3 newPosition = itemPosition - (shapeSize/2 - itemSize/2); 87 public Vector3 CalculatePositionRelativeToBottomLeftBackCorner(Vector3 itemSize, Vector3 itemPosition) { 88 Vector3 newPosition = itemPosition - (shapeSize / 2 - itemSize / 2); 90 89 return newPosition; 91 90 } -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/CenteredContainer.cs
r13032 r13465 27 27 28 28 public class CenteredContainer { 29 private BasicCuboidShape container;30 private List<BasicCuboidShape> packingItems;31 private float normalizingFactor;29 private readonly BasicCuboidShape container; 30 private readonly List<BasicCuboidShape> packingItems; 31 private readonly float normalizingFactor; 32 32 33 33 public CenteredContainer(BasicCuboidShape container) { … … 58 58 Vector3 itemSize = size * normalizingFactor; 59 59 Vector3 itemPosition = position * normalizingFactor; 60 //Apply rotation = swap X and Y size61 //if (rotated) {62 // float aux = itemSize.X;63 // itemSize.X = itemSize.Y;64 // itemSize.Y = aux;65 //}66 60 Vector3 actualPosition = container.CalculatePositionRelativeToBottomLeftBackCorner(itemSize, itemPosition); 67 61 BasicCuboidShape itemShape = new BasicCuboidShape(itemSize, actualPosition, index, material); -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/CuboidShapePreperations.cs
r13032 r13465 53 53 Color rightColor = Color.Black; 54 54 55 //Define positions of the textures56 Vector2 textureTopLeft;57 Vector2 textureTopRight;58 Vector2 textureBottomLeft;59 Vector2 textureBottomRight;60 55 #endregion Private Members 61 56 … … 91 86 rightColor = color; 92 87 93 //Define positions of the textures94 textureTopLeft = new Vector2(0.5f * halfShapeSize.X, 0.0f * halfShapeSize.Y);95 textureTopRight = new Vector2(0.0f * halfShapeSize.X, 0.0f * halfShapeSize.Y);96 textureBottomLeft = new Vector2(0.5f * halfShapeSize.X, 0.5f * halfShapeSize.Y);97 textureBottomRight = new Vector2(0.0f * halfShapeSize.X, 0.5f * halfShapeSize.Y);98 88 } 99 89 … … 171 161 //Definition of the actual lines 172 162 VertexPositionColorNormal[] shapeVertices = new VertexPositionColorNormal[48]; 173 174 //shapeVertices[0] = new VertexPositionColorNormal(color, topRightFront, frontNormal);175 //shapeVertices[1] = new VertexPositionColorNormal(color, topLeftFront, frontNormal);176 //shapeVertices[2] = new VertexPositionColorNormal(color, topLeftFront, frontNormal);177 //shapeVertices[3] = new VertexPositionColorNormal(color, bottomLeftFront, frontNormal);178 //shapeVertices[4] = new VertexPositionColorNormal(color, bottomLeftFront, frontNormal);179 //shapeVertices[5] = new VertexPositionColorNormal(color, bottomRightFront, frontNormal);180 //shapeVertices[6] = new VertexPositionColorNormal(color, bottomRightFront, frontNormal);181 //shapeVertices[7] = new VertexPositionColorNormal(color, topRightFront, frontNormal);182 183 //shapeVertices[8] = new VertexPositionColorNormal(color, topRightBack, backNormal);184 //shapeVertices[9] = new VertexPositionColorNormal(color, topLeftBack, backNormal);185 //shapeVertices[10] = new VertexPositionColorNormal(color, topLeftBack, backNormal);186 //shapeVertices[11] = new VertexPositionColorNormal(color, bottomLeftBack, backNormal);187 //shapeVertices[12] = new VertexPositionColorNormal(color, bottomLeftBack, backNormal);188 //shapeVertices[13] = new VertexPositionColorNormal(color, bottomRightBack, backNormal);189 //shapeVertices[14] = new VertexPositionColorNormal(color, bottomRightBack, backNormal);190 //shapeVertices[15] = new VertexPositionColorNormal(color, topRightBack, backNormal);191 192 //shapeVertices[16] = new VertexPositionColorNormal(color, topLeftFront, topNormal);193 //shapeVertices[17] = new VertexPositionColorNormal(color, topLeftBack, topNormal);194 //shapeVertices[18] = new VertexPositionColorNormal(color, topRightFront, topNormal);195 //shapeVertices[19] = new VertexPositionColorNormal(color, topRightBack, topNormal);196 //shapeVertices[20] = new VertexPositionColorNormal(color, topLeftFront, topNormal);197 //shapeVertices[21] = new VertexPositionColorNormal(color, topRightFront, topNormal);198 //shapeVertices[22] = new VertexPositionColorNormal(color, topRightBack, topNormal);199 //shapeVertices[23] = new VertexPositionColorNormal(color, topLeftBack, topNormal);200 201 //shapeVertices[24] = new VertexPositionColorNormal(color, bottomLeftFront, bottomNormal);202 //shapeVertices[25] = new VertexPositionColorNormal(color, bottomRightFront, bottomNormal);203 //shapeVertices[26] = new VertexPositionColorNormal(color, bottomLeftBack, bottomNormal);204 //shapeVertices[27] = new VertexPositionColorNormal(color, bottomRightBack, bottomNormal);205 //shapeVertices[28] = new VertexPositionColorNormal(color, bottomRightFront, bottomNormal);206 //shapeVertices[29] = new VertexPositionColorNormal(color, bottomRightBack, bottomNormal);207 //shapeVertices[30] = new VertexPositionColorNormal(color, bottomLeftFront, bottomNormal);208 //shapeVertices[31] = new VertexPositionColorNormal(color, bottomLeftBack, bottomNormal);209 210 //shapeVertices[32] = new VertexPositionColorNormal(color, topLeftFront, leftNormal);211 //shapeVertices[33] = new VertexPositionColorNormal(color, topLeftBack, leftNormal);212 //shapeVertices[34] = new VertexPositionColorNormal(color, topLeftBack, leftNormal);213 //shapeVertices[35] = new VertexPositionColorNormal(color, bottomLeftBack, leftNormal);214 //shapeVertices[36] = new VertexPositionColorNormal(color, bottomLeftBack, leftNormal);215 //shapeVertices[37] = new VertexPositionColorNormal(color, bottomLeftFront, leftNormal);216 //shapeVertices[38] = new VertexPositionColorNormal(color, bottomLeftFront, leftNormal);217 //shapeVertices[39] = new VertexPositionColorNormal(color, topLeftFront, leftNormal);218 219 //shapeVertices[40] = new VertexPositionColorNormal(color, topRightFront, rightNormal);220 //shapeVertices[41] = new VertexPositionColorNormal(color, topRightBack, rightNormal);221 //shapeVertices[42] = new VertexPositionColorNormal(color, topRightBack, rightNormal);222 //shapeVertices[43] = new VertexPositionColorNormal(color, bottomRightBack, rightNormal);223 //shapeVertices[44] = new VertexPositionColorNormal(color, bottomRightBack, rightNormal);224 //shapeVertices[45] = new VertexPositionColorNormal(color, bottomRightFront, rightNormal);225 //shapeVertices[46] = new VertexPositionColorNormal(color, bottomRightFront, rightNormal);226 //shapeVertices[47] = new VertexPositionColorNormal(color, topRightFront, rightNormal);227 163 228 164 Vector3 topRightFrontNormal = (topNormal + rightNormal + frontNormal) / 3; -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/PackingGame.cs
r13161 r13465 106 106 Console.WriteLine("Initial bounds:" + Window.ClientBounds); 107 107 this.Window.IsMouseVisible = true; 108 //this.Window.ClientSizeChanged += (a, b) => {109 // Console.WriteLine("Resized..");110 // this.Tick();111 //};112 108 } 113 109 private void initializeWorld() { … … 177 173 178 174 #region Transparency 179 180 //basicEffect.GraphicsDevice.RenderState.AlphaBlendEnable = true;181 //basicEffect.GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha;182 //basicEffect.GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha;183 175 184 176 BlendStateDescription blendStateDescription = new SharpDX.Direct3D11.BlendStateDescription(); … … 264 256 private void computeLeftMouseBtnHandling(MouseState mouseState) { 265 257 //Left btn released 266 if (mouseState.LeftButton.Released && mouseState.LeftButton.Equals(previousMouseState.LeftButton)) {267 //Console.WriteLine("Released");268 }258 //if (mouseState.LeftButton.Released && mouseState.LeftButton.Equals(previousMouseState.LeftButton)) { 259 // //Console.WriteLine("Released"); 260 //} else 269 261 270 262 //Left btn pressed 271 else if (mouseState.LeftButton.Pressed && mouseState.LeftButton.Equals(previousMouseState.LeftButton)) { 263 264 if (mouseState.LeftButton.Pressed && mouseState.LeftButton.Equals(previousMouseState.LeftButton)) { 272 265 currentViewAngle = new Vector2( 273 266 viewAngleOnBtnRelease.X + mouseState.X - mousePositionOnBtnDown.X, 274 267 viewAngleOnBtnRelease.Y + mouseState.Y - mousePositionOnBtnDown.Y); 275 268 276 //angle += 0.5f;277 //Console.WriteLine("Pressed");278 //Console.WriteLine(currentViewAngle.ToString());279 269 } 280 270 281 271 //Left btn freshly pressed ==> ONLICK-EVENT 282 272 else if (mouseState.LeftButton.Pressed && !previousMouseState.LeftButton.Pressed) { 283 Console.WriteLine("OnClick");284 PackingPlan3D native = (PackingPlan3D)Window.NativeWindow;285 Console.WriteLine("Window: " + Window.ClientBounds.ToString());286 Console.WriteLine("native: " + native.ClientSize.ToString());287 Console.WriteLine("native.parent: " + native.Parent.ClientSize.ToString());288 289 Console.WriteLine(native.ParentForm.ToString());290 Console.WriteLine(Window.Name);291 Console.WriteLine(this.IsActive);273 //Console.WriteLine("OnClick"); 274 //PackingPlan3D native = (PackingPlan3D)Window.NativeWindow; 275 //Console.WriteLine("Window: " + Window.ClientBounds.ToString()); 276 //Console.WriteLine("native: " + native.ClientSize.ToString()); 277 //Console.WriteLine("native.parent: " + native.Parent.ClientSize.ToString()); 278 // 279 //Console.WriteLine(native.ParentForm.ToString()); 280 //Console.WriteLine(Window.Name); 281 //Console.WriteLine(this.IsActive); 292 282 mousePositionOnBtnDown = new Vector2(mouseState.X, mouseState.Y); 293 283 } … … 295 285 //Left btn freshly released ==> ONRELEASE-EVENT 296 286 else if (mouseState.LeftButton.Released && !previousMouseState.LeftButton.Released) { 297 Console.WriteLine("OnRelease");287 //Console.WriteLine("OnRelease"); 298 288 viewAngleOnBtnRelease = currentViewAngle; 299 289 } … … 304 294 if (curr < prev && zoom > 1) { 305 295 zoom++; 306 Console.WriteLine(zoom);296 //Console.WriteLine(zoom); 307 297 } else if (curr > prev && zoom < 300) { 308 298 zoom--; 309 Console.WriteLine(zoom);299 //Console.WriteLine(zoom); 310 300 } 311 301 } -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/PackingPlan3D.cs
r13032 r13465 25 25 26 26 27 namespace PackingPlanVisualizations { 27 namespace PackingPlanVisualizations { 28 28 public partial class PackingPlan3D : UserControl { 29 29 private PackingGame game; … … 67 67 68 68 69 70 #region Archive ..71 //private BasicCuboidShape containerShape;72 //private List<BasicCuboidShape> itemShapes;73 //private void RunGame() {74 // if (containerShape == null)75 // return;76 // game = new PackingGame(this);77 // game.InitializeContainer(containerShape);78 // foreach (BasicCuboidShape shape in itemShapes)79 // game.AddItemToContainer(shape);80 // game.Run(this);81 //}82 #endregion83 84 85 86 69 public void InitializeContainer(float width, float height, float depth) { 87 70 //if (game != null) { … … 95 78 96 79 public void AddItemToContainer(float width, float height, float depth, float x, float y, float z, int itemNr) { 97 AddItemToContainer(width, height, depth, x, y,z, itemNr, 0);80 AddItemToContainer(width, height, depth, x, y, z, itemNr, 0); 98 81 } 99 82 public void AddItemToContainer(float width, float height, float depth, float x, float y, float z, int itemNr, int material) { -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/VertexPositionColorNormal.cs
r13032 r13465 24 24 using SharpDX.Toolkit.Graphics; 25 25 26 namespace PackingPlanVisualizations { 26 namespace PackingPlanVisualizations { 27 27 28 28 [Serializable] … … 50 50 51 51 public override bool Equals(object obj) { 52 if (obj .GetType() == typeof (VertexPositionColorNormal))52 if (obj is VertexPositionColorNormal) 53 53 return this.Equals((VertexPositionColorNormal)obj); 54 54 else -
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/PackingPlanVisualizations.csproj
r13161 r13465 107 107 </ItemGroup> 108 108 <ItemGroup> 109 <EmbeddedResource Include="3D\PackingPlan3D.resx">110 <DependentUpon>PackingPlan3D.cs</DependentUpon>111 </EmbeddedResource>112 <EmbeddedResource Include="2D\PackingPlan2D.resx">113 <DependentUpon>PackingPlan2D.cs</DependentUpon>114 </EmbeddedResource>115 </ItemGroup>116 <ItemGroup>117 109 <None Include="HeuristicLab.snk" /> 118 110 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.