示例#1
0
        public void ShowTriangles(GlyphTriangleInfo tri)
        {
            if (!_clearInfoView)
            {
                return;
            }
            //-----------------------------
            TreeNode triangleNode = new TreeNode()
            {
                Text = "tri:" + tri.ToString(), Tag = new NodeInfo(tri)
            };

            _trianglesNode.Nodes.Add(triangleNode);
        }
示例#2
0
 public NodeInfo(GlyphTriangleInfo tri)
 {
     this.tri      = tri;
     this.pos      = new System.Numerics.Vector2((float)tri.CentroidX, (float)tri.CentroidY);
     this.NodeKind = NodeInfoKind.Tri;
 }
示例#3
0
        void DrawMarkedNode(TreeNode node)
        {
            NodeInfo nodeinfo = node.Tag as NodeInfo;

            if (nodeinfo == null)
            {
                return;
            }
            //---------------
            //what kind of nodeinfo
            //---------------

            switch (nodeinfo.NodeKind)
            {
            default: throw new NotSupportedException();

            case NodeInfoKind.Bone:
            {
                if (RequestGlyphRender != null)
                {
                    _clearInfoView = false;
                    RequestGlyphRender(this, EventArgs.Empty);

                    GlyphBone bone     = nodeinfo.Bone;
                    var       midPoint = bone.GetMidPoint() * PxScale;
                    Owner.DrawMarker(midPoint.X, midPoint.Y, PixelFarm.Drawing.Color.Yellow);
                    if (_flushOutput != null)
                    {
                        //TODO: review here
                        _flushOutput();
                    }
                    _clearInfoView = true;
                }
            }
            break;

            case NodeInfoKind.Tri:
            {
                //draw glyph triangle
                if (RequestGlyphRender != null)
                {
                    _clearInfoView = false;
                    RequestGlyphRender(this, EventArgs.Empty);

                    GlyphTriangleInfo tri = nodeinfo.GlyphTri;
                    var cen_x             = (float)(tri.CentroidX * PxScale);
                    var cen_y             = (float)(tri.CentroidY * PxScale);

                    Owner.DrawMarker(cen_x, cen_y, PixelFarm.Drawing.Color.Yellow);
                    if (_flushOutput != null)
                    {
                        //TODO: review here
                        _flushOutput();
                    }
                    _clearInfoView = true;
                }
            }
            break;

            case NodeInfoKind.RibEndPoint:
            case NodeInfoKind.Joint:
            case NodeInfoKind.GlyphEdge:
            {
                if (RequestGlyphRender != null)
                {
                    _clearInfoView = false;
                    RequestGlyphRender(this, EventArgs.Empty);

                    var pos = nodeinfo.Pos * PxScale;
                    Owner.DrawMarker(pos.X, pos.Y, PixelFarm.Drawing.Color.Red);
                    if (_flushOutput != null)
                    {
                        //TODO: review here
                        _flushOutput();
                    }
                    _clearInfoView = true;
                }
            }
            break;

            case NodeInfoKind.TessEdge:
            {
                _addDebugMarkOnEdgeNo = nodeinfo.TessEdgeNo;
                if (RequestGlyphRender != null)
                {
                    _clearInfoView = false;
                    RequestGlyphRender(this, EventArgs.Empty);
                    if (_flushOutput != null)
                    {
                        //TODO: review here
                        _flushOutput();
                    }
                    _clearInfoView = true;
                }
            }
            break;

            case NodeInfoKind.FlattenVertexCommand:
            {
                _addDebugVertexCmd = nodeinfo.VertexCommandNo;
                if (RequestGlyphRender != null)
                {
                    _clearInfoView = false;
                    RequestGlyphRender(this, EventArgs.Empty);
                    //

                    if (_flushOutput != null)
                    {
                        //TODO: review here
                        _flushOutput();
                    }
                    _clearInfoView = true;
                }
            }
            break;

            case NodeInfoKind.OrgVertexCommand:
            {
                if (RequestGlyphRender != null)
                {
                    _clearInfoView = false;
                    RequestGlyphRender(this, EventArgs.Empty);
                    //
                    double x, y;
                    _orgVxs.GetVertex(nodeinfo.VertexCommandNo, out x, out y);
                    Owner.DrawMarker((float)x, (float)y, PixelFarm.Drawing.Color.Red);
                    if (_flushOutput != null)
                    {
                        //TODO: review here
                        _flushOutput();
                    }
                    _clearInfoView = true;
                }
            }
            break;
            }
        }
 public NodeInfo(GlyphTriangleInfo tri)
 {
     _tri          = tri;
     _pos          = new Vector2f((float)tri.CentroidX, (float)tri.CentroidY);
     this.NodeKind = NodeInfoKind.Tri;
 }