Пример #1
0
        public ProjectPolygon Clone()
        {
            ProjectPolygon ret = new ProjectPolygon();

            ret.Points = Points.ToList();
            return(ret);
        }
Пример #2
0
        private void ProjectMapEditor_FormClosing(object sender, FormClosingEventArgs e)
        {
            List <ProjectPolygon> pp = new List <ProjectPolygon>();

            foreach (var item in Polygons)
            {
                var poly = new ProjectPolygon();
                pp.Add(poly);
                poly.Points = item.Points.Select(z => z).ToList();
                for (int i = 0; i < poly.Points.Count; i++)
                {
                    var t1 = poly.Points[i];
                    poly.Points[i] = new Vector2d(t1.X / xxScale, t1.Y / 100);
                }
            }
            face.UpdateMesh(pp.ToArray());
        }
Пример #3
0
        public void UpdateNearest()
        {
            var    pos  = pictureBox1.PointToClient(Cursor.Position);
            var    posx = (pos.X / dc.zoom - dc.sx);
            double posy = (-pos.Y / dc.zoom - dc.sy);

            foreach (var item in polygons)
            {
                var fr = item.Points.OrderBy(z => (z - new Vector2d(posx, posy)).Length).First();
                if (!captured)
                {
                    if (((fr - new Vector2d(posx, posy)).Length) < 10 / dc.zoom)
                    {
                        sp     = item;
                        sindex = item.Points.IndexOf(fr);
                        break;
                    }
                    else
                    {
                        sindex = -1;
                    }
                }
            }

            if (sindex >= 0 && captured && sp != null)
            {
                if (posy < 0)
                {
                    posy = 0;
                }
                if (posy > yyScale)
                {
                    posy = yyScale;
                }
                sp.Points[sindex] = new Vector2d(posx, posy);
                pet.SetPoint(sp.Points[sindex]);
                lastEditedPointIndex = sindex;
            }
        }