Exemple #1
0
        private void SetLabelSmoothing(SymbolSmoothing smooting)
        {
            if (_map == null || _map.MapElements == null)
            {
                return;
            }

            foreach (IDatasetElement dsElement in _map.MapElements)
            {
                IFeatureLayer fLayer = dsElement as IFeatureLayer;
                if (fLayer == null || fLayer.LabelRenderer == null)
                {
                    continue;
                }

                ILabelRenderer lRenderer = fLayer.LabelRenderer;
                foreach (ISymbol symbol in lRenderer.Symbols)
                {
                    if (symbol == null)
                    {
                        continue;
                    }
                    symbol.SymbolSmothingMode = smooting;
                }
            }
            if (_app != null)
            {
                _app.RefreshActiveMap(DrawPhase.All);
            }
        }
Exemple #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_map == null || _display == null)
            {
                return;
            }

            try
            {
                bool refresh = false;

                _map.Name         = txtName.Text;
                _display.refScale = Convert.ToDouble(numRefScale.Value);

                if (cmbMapUnits.Enabled)
                {
                    _display.MapUnits = ((GeoUnitsItem)cmbMapUnits.SelectedItem).Unit;
                }

                _display.DisplayUnits = ((GeoUnitsItem)cmbDisplayUnits.SelectedItem).Unit;

                _display.BackgroundColor = btnBackgroundColor.BackColor.ToArgbColor();

                ISpatialReference oldSRef = _display.SpatialReference;
                _display.SpatialReference = _sr.SpatialReference;

                if (oldSRef != null &&
                    !oldSRef.Equals(_display.SpatialReference))
                {
                    IEnvelope limit = _display.Limit;
                    IEnvelope env   = _display.Envelope;

                    _display.Limit = GeometricTransformerFactory.Transform2D(
                        limit,
                        oldSRef,
                        _display.SpatialReference).Envelope;

                    _display.ZoomTo(
                        GeometricTransformerFactory.Transform2D(
                            env,
                            oldSRef,
                            _display.SpatialReference).Envelope
                        );
                }

                _map.LayerDefaultSpatialReference = _sr2.SpatialReference;

                _map.Title = txtTitle.Text;
                _map.SetLayerDescription(Map.MapDescriptionId, txtDescription.Text);
                _map.SetLayerCopyrightText(Map.MapCopyrightTextId, txtCopyright.Text);

                if (SystemVariables.SystemFontsScaleFactor != (float)numFontScaleFactor.Value / 100f)
                {
                    SystemVariables.SystemFontsScaleFactor = (float)numFontScaleFactor.Value / 100f;
                    _display.Screen?.RefreshSettings();

                    refresh = true;
                }

                #region Graphics Engine

                if (cmbGraphicsEngine.SelectedItem.ToString() != GraphicsEngine.Current.Engine.EngineName)
                {
                    var engine = Engines.RegisteredGraphcisEngines().Where(ge => ge.EngineName == cmbGraphicsEngine.SelectedItem.ToString()).FirstOrDefault();
                    if (engine != null)
                    {
                        GraphicsEngine.Current.Engine = engine;
                        RefreshFeatureRendererSymbolsGraphcisEngine();

                        refresh = true;
                    }
                }

                #endregion Graphics Engine

                if (refresh)
                {
                    if (_app != null)
                    {
                        _app.RefreshTOC();
                        _app.RefreshActiveMap(DrawPhase.All);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }