Esempio n. 1
0
 private void UpdateChildControls()
 {
     for (int i = 0; i < this.Mesh.Edges.Count; i++)
     {
         Edge        edge        = this.Mesh.Edges[i];
         EdgeDisplay edgeDisplay = edgeDisplays[i];
         edgeDisplay.EdgeState = edge.State;
         //edgeDisplay.EdgeColor = edge.Color;
         edgeDisplay.Marked = markedEdges.Contains(i);
         edgeDisplay.Render();
     }
 }
Esempio n. 2
0
        private void OnMeshChanged(Mesh newMesh)
        {
            if (this.displayHost.ClientHeight <= 0 || this.displayHost.ClientWidth <= 0)
            {
                return;
            }
            UpdateScaleFactor(newMesh);
            edgeDisplays.Clear();
            intersDisplays.Clear();
            if (newMesh == null)
            {
                return;
            }
            var drawContext = edgeCanvas.GetContext(CanvasTypes.CanvasContext2DType.CanvasRenderingContext2D);

            drawContext.ClearRect(0, 0, edgeCanvas.Width, edgeCanvas.Height);
            for (int i = 0; i < newMesh.Edges.Count; i++)
            {
                Edge  edge = newMesh.Edges[i];
                float x1, x2, y1, y2;
                newMesh.GetEdgeExtent(edge, out x1, out y1, out x2, out y2);
                EdgeDisplay edgeDisplay = new EdgeDisplay(drawContext, x1 * scaleFactor + xOffset, x2 * scaleFactor + xOffset, y1 * scaleFactor + yOffset, y2 * scaleFactor + yOffset);
                edgeDisplay.EdgeState = edge.State;
                //edgeDisplay.EdgeColor = edge.Color;
                edgeDisplay.Marked = markedEdges.Contains(i);
                edgeDisplay.Render();
                edgeDisplays.Add(edgeDisplay);
            }

            drawContext = intersectionCanvas.GetContext(CanvasTypes.CanvasContext2DType.CanvasRenderingContext2D);
            drawContext.ClearRect(0, 0, intersectionCanvas.Width, intersectionCanvas.Height);
            foreach (var intersection in mesh.Intersections)
            {
                IntersDisplay intersDisplay = new IntersDisplay(drawContext, intersection.X * scaleFactor + xOffset, intersection.Y * scaleFactor + yOffset);
                intersDisplay.IntersType = intersection.Type;
                intersDisplay.Render();
                intersDisplays.Add(intersDisplay);
            }
        }