コード例 #1
0
 private bool GenerateLabels()
 {
     return(_featureSet.GenerateLabels(
                -1, _featureSet.Labels.Positioning,
                !chkLabelEveryPart.Checked,
                _featureSet.Labels.OffsetXField, _featureSet.Labels.OffsetYField
                ) > 0);
 }
コード例 #2
0
        private void AddPointCore(MapControl map, IFeatureSet fs, bool source, MouseEventArgs e)
        {
            double x, y;

            map.PixelToProj(e.X, e.Y, out x, out y);

            if (Model.NeedsNewPoint)
            {
                var pnt = new PointPair(_context.Map.MapUnits, Model.Points.Count + 1);
                Model.Points.Add(pnt);

                // we don't detach handler, object will be GCed eventually when form is closed
                pnt.PointSelected += (s, args) => OnPointChecked();

                UpdateView();
            }

            var shp = new Geometry(GeometryType.Point);

            shp.Points.Add(new Coordinate(x, y));
            int index = fs.Features.EditAdd(shp);

            fs.Features[index].SetValue(1, Model.Points.Count);

            fs.GenerateLabels(1, LabelPosition.Center);
            fs.Labels.Style.FrameVisible = false;
            map.Redraw();

            int count = Model.Points.Count - 1;

            if (source)
            {
                int imageX, imageY;
                Model.Image.ProjectionToImage(x, y, out imageX, out imageY);
                Model.Points[count].SetSourcePoint(imageX, imageY);
            }
            else
            {
                Model.Points[count].SetTargetPoint(x, y);
            }
        }