Exemplo n.º 1
0
        /// <summary>
        /// It's called internally before the view is shown. The UI should be populated here from this.Model property.
        /// </summary>
        public void Initialize()
        {
            _imageSource = Model.ImageSource;

            _dynamicVisibilityControl1.Initialize(Model, _context.Map.CurrentZoom, _context.Map.CurrentScale);

            if (Raster != null)
            {
                _renderingPresenter.View.Metadata = SymbologyPlugin.GetMetadata(Model.Handle);
                _renderingPresenter.Initialize(Raster);

                rasterInfoTreeView1.Initialize(_imageSource as IRasterSource);

                histogramControl1.Initialize(_context.Container, Raster);

                _overviewControl1.Initialize(Raster);

                richTextBox1.Visible = false;
            }
            else
            {
                tabControlAdv1.TabPages.Remove(tabPageColors);
                tabControlAdv1.TabPages.Remove(tabPageHistogram);
                tabControlAdv1.TabPages.Remove(tabPagePyramids);

                richTextBox1.Visible = true;

                richTextBox1.Text = GdalUtils.Instance.GdalInfo(Model.Filename, "");

                btnShowDriverInfo.Visible = false;
            }

            ModelToUi();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of PolygonForm class
        /// </summary>
        public PolygonForm(IAppContext context, ILegendLayer layer, IGeometryStyle style, bool applyDisabled) : base(context)
        {
            if (layer == null)
            {
                throw new ArgumentNullException("layer");
            }
            if (style == null)
            {
                throw new ArgumentNullException("style");
            }

            InitializeComponent();

            _style    = style;
            _metadata = SymbologyPlugin.GetMetadata(layer.Handle);
            _legend   = context.Legend;
            _layer    = layer;

            _initState = style.Serialize();

            _noEvents = true;

            Initialize();

            btnApply.Visible          = !applyDisabled;
            tabControl1.SelectedIndex = _tabPage;
        }
Exemplo n.º 3
0
        private void InitSize()
        {
            var settings = SymbologyPlugin.GetMetadata(_layer.Handle);

            if (_shapefile.PointOrMultiPoint)
            {
                chkUseVariableSize.Text = "Use variable symbol size";
                udMinSize.Minimum       = 1;
                udMinSize.Maximum       = 80;
                udMaxSize.Minimum       = 1;
                udMaxSize.Maximum       = 80;
                udMinSize.SetValue(_shapefile.Style.Marker.Size);
                udMaxSize.SetValue((double)udMinSize.Value + settings.CategoriesSizeRange);
            }
            else if (_shapefile.GeometryType == GeometryType.Polyline)
            {
                chkUseVariableSize.Text = "Use variable line width";
                udMinSize.Minimum       = 1;
                udMinSize.Maximum       = 10;
                udMaxSize.Minimum       = 1;
                udMaxSize.Maximum       = 10;
                udMinSize.SetValue(_shapefile.Style.Line.Width);
                udMaxSize.SetValue((double)udMinSize.Value + settings.CategoriesSizeRange);
            }
            else
            {
                chkUseVariableSize.Enabled = false;
                udMinSize.Value            = udMinSize.Minimum;
                udMinSize.Enabled          = false;
                udMaxSize.Value            = udMaxSize.Minimum;
                udMaxSize.Enabled          = false;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the state of controls for the further launches
        /// </summary>
        private void SaveSettings()
        {
            var settings = SymbologyPlugin.GetMetadata(_layer.Handle);

            int count;

            settings.CategoriesCount = Int32.TryParse(cboCategoriesCount.Text, out count) ? count : 8;

            settings.CategoriesFieldName      = cboField.SelectedItem != null ? ((RealIndexComboItem)cboField.SelectedItem).Text : string.Empty;
            settings.CategoriesClassification = (Classification)cboClassificationType.SelectedIndex;;
            settings.CategoriesColorScheme    = icbColorScheme.GetSelectedItem();
            settings.CategoriesRandomColors   = chkRandomColors.Checked;
            settings.CategoriesUseGradient    = chkSetGradient.Checked;
            settings.CategoriesVariableSize   = chkUseVariableSize.Checked;

            if (chkUseVariableSize.Checked)
            {
                settings.CategoriesSizeRange = (int)(udMaxSize.Value - udMinSize.Value);
            }
        }
Exemplo n.º 5
0
        public void Initialize()
        {
            _metadata   = SymbologyPlugin.GetMetadata(Model.Handle);
            _featureSet = Model.FeatureSet;

            var model = new CategoriesSubViewModel(Model, _metadata);

            _categoriesPresenter.Initialize(model);

            MapConfig.ForceHideLabels = true;

            Text = "Layer properties: " + Model.Name;

            _initState = SaveState();

            InitializeCore();

            ColorSchemeProvider.SetFirstColorScheme(SchemeTarget.Vector, _featureSet);

            Shown += OnFormShown;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Generates a new instance of the GenerateCategoriesForm class
        /// </summary>
        public GenerateCategoriesForm(IAppContext context, ILayer layer) :
            base(context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (layer == null || layer.FeatureSet == null)
            {
                throw new ArgumentNullException("layer");
            }
            _layer = layer;

            InitializeComponent();

            _shapefile = layer.FeatureSet;

            var settings = SymbologyPlugin.GetMetadata(_layer.Handle);

            // classification
            cboClassificationType.Items.Clear();
            cboClassificationType.Items.Add("Natural breaks");
            cboClassificationType.Items.Add("Unique values");
            cboClassificationType.Items.Add("Equal intervals");
            cboClassificationType.Items.Add("Quantiles");
            cboClassificationType.SelectedIndex = (int)settings.CategoriesClassification;

            // number of categories
            cboCategoriesCount.Items.Clear();
            for (int i = 3; i <= 25; i++)
            {
                cboCategoriesCount.Items.Add(Convert.ToString(i));
            }
            cboCategoriesCount.Text = settings.CategoriesCount.ToString();

            // dummy color scheme
            ColorSchemeProvider.SetFirstColorScheme(SchemeTarget.Vector, _shapefile);

            // initializing for list of color schemes
            icbColorScheme.Target = SchemeTarget.Vector;

            // settings active color scheme
            icbColorScheme.SetSelectedItem(settings.CategoriesColorScheme);

            if (icbColorScheme.SelectedItem == null)
            {
                icbColorScheme.SelectedIndex = 0;
            }

            InitSize();

            chkRandomColors.Checked    = settings.CategoriesRandomColors;
            chkSetGradient.Checked     = settings.CategoriesUseGradient;
            chkUseVariableSize.Checked = settings.CategoriesVariableSize;

            RefreshControlsState(null, null);

            string name = settings.CategoriesFieldName.ToLower();

            for (int i = 0; i < cboField.Items.Count; i++)
            {
                if (((RealIndexComboItem)cboField.Items[i]).Text.ToLower() == name)
                {
                    cboField.SelectedIndex = i;
                    break;
                }
            }
        }