/// <summary>
        /// Changes the default style of labels to generate based on
        /// </summary>
        private void btnChangeStyle_Click(object sender, EventArgs e)
        {
            LabelStyleForm styleFormForm = new LabelStyleForm(m_shapefile, m_shapefile.Labels.Options);

            if (styleFormForm.ShowDialog(this) == DialogResult.OK)
            {
                // refreshing preview
                DrawPreview();
                RefreshControlsState(null, null);
            }
            styleFormForm.Dispose();
        }
        public override void Run(LegendCommand command)
        {
            Shapefile sf    = null;
            var       layer = _legend.Layers.ItemByHandle(LayerHandle);

            if (layer != null)
            {
                sf = layer.GetObject() as Shapefile;
            }

            switch (command)
            {
            case LegendCommand.CalculateArea:
                sf.CalculateArea();
                break;

            case LegendCommand.RemoveLayer:
                LayerHelper.RemoveLayer();
                break;

            case LegendCommand.LoadLayerStyle:
                LayerHelper.LoadLayerStyle();
                break;

            case LegendCommand.SaveLayerStyle:
                LayerHelper.SaveCurrentStyle();
                break;

            case LegendCommand.ImportOgrLayer:
                LayerHelper.ImportOgrLayer();
                break;

            case LegendCommand.ZoomToLayer:
                _legend.Map.ZoomToLayer(LayerHandle);
                break;

            case LegendCommand.Labels:
            {
                using (Form form = new LabelStyleForm(_legend, sf, LayerHandle))
                {
                    form.ShowDialog(MainForm.Instance);
                    _legend.Refresh();
                }
            }
            break;

            case LegendCommand.Properties:
                LayerHelper.ShowLayerProperties(LayerHandle);
                break;
            }
        }
Example #3
0
        internal static void ShowLabels(IAppContext context)
        {
            var layer = context.Legend.SelectedLayer;

            if (layer == null)
            {
                return;
            }

            using (var form = new LabelStyleForm(context, layer))
            {
                context.View.ShowChildView(form);
            }
        }
Example #4
0
        private void LayerLabelsClicked(IMuteLegend legend, LayerEventArgs e)
        {
            var fs = legend.Map.GetFeatureSet(e.LayerHandle);

            if (fs != null)
            {
                var layer = legend.Map.Layers.ItemByHandle(e.LayerHandle);
                using (var form = new LabelStyleForm(_context, layer))
                {
                    _context.View.ShowChildView(form);
                }
                e.Handled = true;
            }
        }
        /// <summary>
        /// Generating of labels
        /// </summary>
        private void btnGenerateLabels_Click(object sender, EventArgs e)
        {
            //frmGenerateLabels form = new frmGenerateLabels(m_mapWin, _shapefile, layer, LabelAction.ChangeAll);

            LabelStyleForm form = new LabelStyleForm(_legend, _shapefile, _layerHandle);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                _shapefile.Labels.Visible = true;
                DrawLabelsPreview();
                RefreshControlsState(null, null);
                RedrawMap();
            }
            form.Dispose();
        }
        /// <summary>
        /// Handles the clicking on the labels for a layer
        /// </summary>
        /// <param name="Handle"></param>
        void m_legend_LayerLabelsClicked(int Handle)
        {
            if (m_legend == null || m_legend.m_Map == null)
            {
                return;
            }

            MapWinGIS.Shapefile sf = m_legend.m_Map.get_Shapefile(Handle);
            if (sf != null)
            {
                using (Form form = new LabelStyleForm(m_legend, sf, Handle))
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        m_legend.Refresh();
                    }
                }
            }
        }
        /// <summary>
        /// Changing the default style of labels
        /// </summary>
        private void btnLabelsAppearance_Click(object sender, EventArgs e)
        {
            LabelStyleForm styleFormForm = new LabelStyleForm(_legend, _shapefile, _layerHandle);

            styleFormForm.ShowDialog();

            // updating controls (even if cancel was hit, a user could have applied the options)
            MapWinGIS.LabelCategory options = _shapefile.Labels.Options;
            udLabelFontSize.Value = options.FontSize;
            clpLabelFrame.Color   = Colors.UintToColor(options.FrameBackColor);
            chkLabelFrame.Checked = options.FrameVisible;
            chkShowLabels.Checked = options.Visible;

            RefreshControlsState(null, null);

            RedrawMap();

            // refreshing preview
            DrawLabelsPreview();

            styleFormForm.Dispose();
        }
Example #8
0
        public override void RunCommand(VectorStyleCommand command)
        {
            switch (command)
            {
            case VectorStyleCommand.ClearVisibilityExpression:
                FeatureSet.VisibilityExpression = "";
                View.UpdateView();
                break;

            case VectorStyleCommand.ChangeVisibilityExpression:
                string s = FeatureSet.VisibilityExpression;
                if (FormHelper.ShowQueryBuilder(_context, Model, ViewAsParent, ref s, false))
                {
                    FeatureSet.VisibilityExpression = s;
                    View.UpdateView();
                }
                break;

            case VectorStyleCommand.ClearLabels:
                if (MessageService.Current.Ask("Do you want to remove labels?"))
                {
                    FeatureSet.Labels.Items.Clear();
                    FeatureSet.Labels.Expression = "";
                }
                View.RefreshLabels();
                break;

            case VectorStyleCommand.LabelAppearance:
                using (var form = new LabelStyleForm(_context, Model))
                {
                    _context.View.ShowChildView(form, ViewAsParent);
                }
                View.RefreshLabels();
                break;

            case VectorStyleCommand.ClearCharts:
                if (MessageService.Current.Ask("Do you want to remove charts?"))
                {
                    FeatureSet.Diagrams.Fields.Clear();
                    FeatureSet.Diagrams.Clear();
                }
                View.RefreshCharts();
                break;

            case VectorStyleCommand.OpenLocation:
                string filename = Model.Filename;
                if (!string.IsNullOrWhiteSpace(filename))
                {
                    PathHelper.OpenFolderWithExplorer(filename);
                }
                else
                {
                    MessageService.Current.Info("Can't find the datasource.");
                }
                break;

            case VectorStyleCommand.SaveStyle:
                LayerSerializationHelper.SaveSettings(Model);
                break;

            case VectorStyleCommand.RemoveStyle:
                LayerSerializationHelper.RemoveSettings(Model, false);
                break;

            case VectorStyleCommand.ProjectionDetails:
                _context.ShowProjectionProperties(Model.Projection, View as IWin32Window);
                break;

            case VectorStyleCommand.ChartsEditColorScheme:
                FormHelper.EditColorSchemes(_context, SchemeTarget.Charts, ViewAsParent);
                break;

            case VectorStyleCommand.ChartAppearance:
                using (var form = new ChartStyleForm(_context, Model))
                {
                    _context.View.ShowChildView(form, ViewAsParent);
                }
                View.RefreshCharts();
                break;

            default:
                throw new ArgumentOutOfRangeException("command");
            }
        }