Пример #1
0
        void InitializeAndStartBarcodeScanning()
        {
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            foreach (int symbology in symbologiesToEnable)
            {
                settings.SetSymbologyEnabled(symbology, true);
            }

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            barcodePicker = new BarcodePicker(this, settings);
            barcodePicker.SetOnScanListener(this);
            SetContentView(barcodePicker);
        }
        /// <summary>
        /// Saves the settings for the next session
        /// </summary>
        private void SaveSettings()
        {
            // saving the settings for the subsequent generations
            SymbologySettings settings = Globals.get_LayerSettings(m_layerHandle);

            settings.LabelsVariableSize    = chkUseVariableSize.Checked;
            settings.LabelsSizeRange       = (int)(udMaxSize.Value - udMinSize.Value);
            settings.LabelsGraduatedColors = chkGraduatedFrame.Checked;
            settings.LabelsRandomColors    = chkRandomColors.Checked;
            settings.LabelsFieldName       = cboField.Text;
            settings.LabelsSchemeIndex     = icbFrame.SelectedIndex;
            settings.LabelsClassification  = (tkClassificationType)cboClassificationType.SelectedIndex;
            settings.LabelsSize            = (int)udMinSize.Value;

            int val;

            if (Int32.TryParse(cboCategoriesCount.Text, out val))
            {
                settings.LabelsCategoriesCount = val;
            }
            if (icbFrame.SelectedItem != null)
            {
                settings.LabelsScheme = (ColorBlend)icbFrame.ColorSchemes.List[icbFrame.SelectedIndex];
            }

            Globals.SaveLayerSettings(m_layerHandle, settings);
        }
Пример #3
0
        public ProsperityForm(LegendControl.Legend legend, int layerHandle)
        {
            InitializeComponent();

            var gs = new GlobalSettings();

            gs.ForceHideLabels = true;
            //初始化form
            _legend      = legend;
            _layerHandle = layerHandle;
            _layer       = _legend.GetLayer(_layerHandle);
            _shapefile   = _layer.GetObject() as Shapefile;
            _settings    = Globals.get_LayerSettings(_layerHandle);
            this.Text    = "图层属性: " + _layer.Name;

            //锁定图层
            LockLegendAndMap(true);
            _initState = SaveState();

            // 颜色框中的第一种颜色应该是shapefile的填充/线条颜色
            Globals.LayerColors.SetDefaultColorScheme(_shapefile);

            //选项卡初始化,禁止触发事件
            _noEvents = true;

            initGategoiresTab();

            //事件触发正常
            _noEvents = false;
        }
Пример #4
0
        public async Task SetMaxSymbolCountAsync(Symbology symbology, short maxSymbolCount)
        {
            SymbologySettings symbologySettings = this.GetSymbologySettings(symbology);
            short             minSymbologyCount = symbologySettings.ActiveSymbolCounts.Min();

            await this.SetSymbolCountAsync(symbologySettings, minSymbologyCount, maxSymbolCount);
        }
        /// <summary>
        /// Loads options set by previous run
        /// </summary>
        private void LoadOptions()
        {
            SymbologySettings settings = null;//m_plugin.get_LayerSettings(_layerHandle);

            cboClassificationType.SelectedIndex = (int)settings.LabelsClassification;
            cboCategoriesCount.Text             = settings.LabelsCategoriesCount.ToString();
            udMinSize.SetValue((double)settings.LabelsSize);
            udMaxSize.SetValue((double)udMinSize.Value + settings.LabelsSizeRange);
            chkUseVariableSize.Checked = settings.LabelsVariableSize;
            icbFrame.ComboStyle        = settings.LabelsRandomColors ? ImageComboStyle.ColorSchemeRandom : ImageComboStyle.ColorSchemeGraduated;
            chkGraduatedFrame.Checked  = settings.LabelsGraduatedColors;
            chkRandomColors.Checked    = settings.LabelsRandomColors;

            cboField.Items.Clear();
            cboField.Items.Add(settings.LabelsFieldName);
            cboField.SelectedIndex = 0;

            if (icbFrame.Items.Count > settings.LabelsSchemeIndex && settings.LabelsSchemeIndex >= 0)
            {
                icbFrame.SelectedIndex = settings.LabelsSchemeIndex;
            }
            else
            {
                if (icbFrame.Items.Count > 0)
                {
                    icbFrame.SelectedIndex = 0;
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Updating selection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            this.Tag = richTextBox1.Text;
            SymbologySettings settings = Globals.get_LayerSettings(_layerHandle);

            settings.ShowQueryValues = chkShowValues.Checked;
            settings.ShowQueryOnMap  = chkShowDynamically.Checked;
            Globals.SaveLayerSettings(_layerHandle, settings);
        }
Пример #7
0
 /// <summary>
 /// Saves symbology settings for the layer
 /// </summary>
 internal static void SaveLayerSettings(int layerHandle, SymbologySettings settings)
 {
     // TODO: restore
     //MWLite.Symbology.Layer layer = Legend.GetLayer(layerHandle);
     //if (layer != null)
     //{
     //    layer.SetCustomObject(settings, "SymbologyPluginSettings");
     //}
 }
Пример #8
0
        /// <summary>
        /// Creates a new instance of frmQueryBuilder class
        /// </summary>
        public frmQueryBuilder(MapWinGIS.Shapefile sf, int layerHandle, string expression, bool SelectionMode)
        {
            InitializeComponent();

            if (sf == null)
            {
                return;
            }

            _shapefile     = sf;
            _selectionMode = SelectionMode;
            _layerHandle   = layerHandle;

            btnTest.Text = SelectionMode ? "Select" : "Test";

            dgvField.Rows.Clear();
            dgvField.Rows.Add(_shapefile.NumFields);

            for (int i = 0; i < _shapefile.NumFields; i++)
            {
                dgvField[CMN_NAME, i].Value = _shapefile.get_Field(i).Name;
                if (_shapefile.get_Field(i).Type == MapWinGIS.FieldType.STRING_FIELD)
                {
                    dgvField[CMN_ICON, i].Value           = "Aa";
                    dgvField[CMN_ICON, i].Style.ForeColor = Color.Maroon;
                }
                else
                {
                    dgvField[CMN_ICON, i].Value = "09";
                    //dgvField[CMN_ICON, i].Style.ForeColor = Color.Blue;
                }
            }

            if (dgvField.Rows.Count > 0)
            {
                // TODO: show unique values
            }
            richTextBox1.Text          = expression;
            richTextBox1.HideSelection = false;
            richTextBox1.SelectAll();
            richTextBox1.Focus();

            if (chkShowValues.Checked)
            {
                ShowValues(0);
            }

            _noEvents = true;

            // restoring values
            SymbologySettings settings = Globals.get_LayerSettings(_layerHandle);

            chkShowValues.Checked      = settings.ShowQueryValues;
            chkShowDynamically.Checked = settings.ShowQueryOnMap;

            _noEvents = false;
        }
Пример #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            // Set the app key before instantiating the picker.
            ScanditLicense.AppKey = appKey;

            // The scanning behavior of the barcode picker is configured through scan
            // settings. We start with empty scan settings and enable a very generous
            // set of symbologies. In your own apps, only enable the symbologies you
            // actually need.
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            for (int sym = 0; sym < symbologiesToEnable.Length; sym++)
            {
                settings.SetSymbologyEnabled(symbologiesToEnable[sym], true);
            }

            // Some 1d barcode symbologies allow you to encode variable-length data. By default, the
            // Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your
            // application requires scanning of one of these symbologies, and the length is falling
            // outside the default range, you may need to adjust the "active symbol counts" for this
            // symbology. This is shown in the following few lines of code.

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            // For details on defaults and how to calculate the symbol counts for each symbology, take
            // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

            picker = new BarcodePicker(this, settings);

            // Set listener for the scan event.
            picker.SetOnScanListener(this);

            // Show the scan user interface
            SetContentView(picker);
        }
        /// <summary>
        /// Saves the state of controls for the further launches
        /// </summary>
        private void SaveSettings()
        {
            return;

            SymbologySettings settings = Globals.get_LayerSettings(_layerHandle);

            int count;

            if (Int32.TryParse(cboCategoriesCount.Text, out count))
            {
                settings.CategoriesCount = count;
            }
            else
            {
                settings.CategoriesCount = 8;
            }

            // saving the options for the next time
            if (cboField.SelectedItem != null)
            {
                settings.CategoriesFieldName = ((ComboItem)cboField.SelectedItem).Text;
            }
            else
            {
                settings.CategoriesFieldName = string.Empty;
            }

            settings.CategoriesClassification = (tkClassificationType)cboClassificationType.SelectedIndex;;

            if (icbColorScheme.SelectedItem != null)
            {
                settings.CategoriesColorScheme = (ColorBlend)icbColorScheme.ColorSchemes.List[icbColorScheme.SelectedIndex];
            }
            else
            {
                settings.CategoriesColorScheme = null;
            }

            settings.CategoriesRandomColors = chkRandomColors.Checked;
            settings.CategoriesUseGradient  = chkSetGradient.Checked;
            settings.CategoriesVariableSize = chkUseVariableSize.Checked;
            //settings.CategoriesSortingField = cboSortingField.Text;

            if (chkUseVariableSize.Checked)
            {
                settings.CategoriesSizeRange = (int)(udMaxSize.Value - udMinSize.Value);
            }

            //_plugin.SaveLayerSettings(_layerHandle, settings);
        }
Пример #11
0
        void InitializeAndStartBarcodeScanning()
        {
            // The scanning behavior of the barcode picker is configured through scan
            // settings. We start with empty scan settings and enable a very generous
            // set of symbologies. In your own apps, only enable the symbologies you
            // actually need.
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            foreach (int symbology in symbologiesToEnable)
            {
                settings.SetSymbologyEnabled(symbology, true);
            }

            // Some 1d barcode symbologies allow you to encode variable-length data. By default, the
            // Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your
            // application requires scanning of one of these symbologies, and the length is falling
            // outside the default range, you may need to adjust the "active symbol counts" for this
            // symbology. This is shown in the following few lines of code.

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            // For details on defaults and how to calculate the symbol counts for each symbology, take
            // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

            barcodePicker = new BarcodePicker(this, settings);

            // Set listener for the scan event.
            barcodePicker.SetOnScanListener(this);

            // Show the scan user interface
            SetContentView(barcodePicker);
        }
Пример #12
0
        /// <summary>
        /// Generate label categories for the given set of shapefile categories
        /// </summary>
        /// <param name="mapWin">The reference to MapWindow</param>
        /// <param name="layerHandle">The handle of the layer</param>
        internal static void GenerateCategories(LegendControl.Legend legend, int layerHandle)
        {
            Layer     lyr = legend.GetLayer(layerHandle);
            Shapefile sf  = lyr.GetObject() as MapWinGIS.Shapefile;
            Labels    lb  = sf.Labels;

            sf.Labels.ClearCategories();
            for (int i = 0; i < sf.Categories.Count; i++)
            {
                ShapefileCategory cat      = sf.Categories.get_Item(i);
                LabelCategory     labelCat = lb.AddCategory(cat.Name);
                labelCat.Expression = cat.Expression;
            }

            SymbologySettings settings = Globals.get_LayerSettings(layerHandle);
            ColorBlend        blend    = (ColorBlend)settings.LabelsScheme;

            if (blend != null)
            {
                ColorScheme scheme = ColorSchemes.ColorBlend2ColorScheme(blend);
                if (settings.LabelsRandomColors)
                {
                    lb.ApplyColorScheme(tkColorSchemeType.ctSchemeRandom, scheme);
                }
                else
                {
                    lb.ApplyColorScheme(tkColorSchemeType.ctSchemeGraduated, scheme);
                }
            }

            if (settings.LabelsVariableSize)
            {
                for (int i = 0; i < lb.NumCategories; i++)
                {
                    lb.get_Category(i).FontSize = (int)((double)sf.Labels.FontSize +
                                                        (double)settings.LabelsSizeRange / ((double)lb.NumCategories - 1) * (double)i);
                }
            }

            // Expressions aren't supported by labels yet, therefore we need to copy indices from the symbology
            for (int i = 0; i < lb.Count; i++)
            {
                MapWinGIS.Label label = lb.get_Label(i, 0);
                label.Category = sf.get_ShapeCategory(i);
            }
        }
Пример #13
0
        private async Task SetSymbolCountAsync(SymbologySettings symbologySettings, short minSymbolCount, short maxSymbolCount)
        {
            HashSet <short> symbolCount = new HashSet <short>();

            if (minSymbolCount >= maxSymbolCount)
            {
                symbolCount.Add(maxSymbolCount);
            }
            else
            {
                for (short i = minSymbolCount; i <= maxSymbolCount; i++)
                {
                    symbolCount.Add(i);
                }
            }

            symbologySettings.ActiveSymbolCounts = symbolCount;
            await this.ApplyBarcodeCaptureSettingsAsync();
        }
Пример #14
0
 internal static SymbologySettings get_LayerSettings(int layerHandle)
 {
     // TODO: restore
     //SymbologySettings settings = null;
     //MWLite.Symbology.Layer layer = Legend.GetLayer(layerHandle);
     //if (layer != null)
     //{
     //    settings = (SymbologySettings)layer.GetCustomObject("SymbologyPluginSettings");
     //}
     if (_settings.ContainsKey(layerHandle))
     {
         return(_settings[layerHandle]);
     }
     else
     {
         var settings = new SymbologySettings();
         _settings[layerHandle] = settings;
         return(settings);
     }
 }
Пример #15
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            _tabIndex = tabControl1.SelectedIndex;

            SymbologySettings settings = null; //Globals.get_LayerSettings(_layer.Handle, _mapWin);

            if (settings != null)
            {
                settings.IconCollection = cboIconCollection.Text;
                settings.ScaleIcons     = chkScaleIcons.Checked;
                settings.IconIndex      = iconControl1.SelectedIndex;
                //Globals.SaveLayerSettings(_layer.Handle, settings, _mapWin);
            }

            if (_options.Serialize() != _initState)
            {
                m_legend.FireLayerPropertiesChanged(m_layer.Handle);
                m_legend.RedrawLegendAndMap();
            }
        }
Пример #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
            ScanditLicense.AppKey = appKey;
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            for (int sym = 0; sym < symbologiesToEnable.Length; sym++)
            {
                settings.SetSymbologyEnabled(symbologiesToEnable[sym], true);
            }

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            // For details on defaults and how to calculate the symbol counts for each symbology, take
            // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

            picker = new BarcodePicker(this, settings);
            picker.SetOnScanListener(this);
            SetContentView(picker);
        }
Пример #17
0
        protected void InitializeAndStartBarcodeScanning()
        {
            // Create data capture context using your license key.
            this.dataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);

            // Use the default camera and set it as the frame source of the context.
            // The camera is off by default and must be turned on to start streaming frames to the data
            // capture context for recognition.
            // See resumeFrameSource and pauseFrameSource below.
            this.camera = Camera.GetDefaultCamera();
            if (this.camera != null)
            {
                // Use the settings recommended by barcode capture.
                this.camera.ApplySettingsAsync(BarcodeCapture.RecommendedCameraSettings);
                this.dataCaptureContext.SetFrameSourceAsync(this.camera);
            }

            BarcodeCaptureSettings barcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // The settings instance initially has all types of barcodes (symbologies) disabled.
            // For the purpose of this sample we enable a very generous set of symbologies.
            // In your own app ensure that you only enable the symbologies that your app requires as
            // every additional enabled symbology has an impact on processing times.
            HashSet <Symbology> symbologies = new HashSet <Symbology>()
            {
                Symbology.Ean13Upca,
                Symbology.Ean8,
                Symbology.Upce,
                Symbology.Qr,
                Symbology.DataMatrix,
                Symbology.Code39,
                Symbology.Code128,
                Symbology.InterleavedTwoOfFive
            };

            barcodeCaptureSettings.EnableSymbologies(symbologies);

            // Some linear/1d barcode symbologies allow you to encode variable-length data.
            // By default, the Scandit Data Capture SDK only scans barcodes in a certain length range.
            // If your application requires scanning of one of these symbologies, and the length is
            // falling outside the default range, you may need to adjust the "active symbol counts"
            // for this symbology. This is shown in the following few lines of code for one of the
            // variable-length symbologies.
            SymbologySettings symbologySettings =
                barcodeCaptureSettings.GetSymbologySettings(Symbology.Code39);

            HashSet <short> activeSymbolCounts = new HashSet <short>(
                new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 });

            symbologySettings.ActiveSymbolCounts = activeSymbolCounts;

            // Create new barcode capture mode with the settings from above.
            this.barcodeCapture = BarcodeCapture.Create(this.dataCaptureContext, barcodeCaptureSettings);

            // Register self as a listener to get informed whenever a new barcode got recognized.
            this.barcodeCapture.AddListener(this);

            // To visualize the on-going barcode capturing process on screen, setup a data capture view
            // that renders the camera preview. The view must be connected to the data capture context.
            this.dataCaptureView = DataCaptureView.Create(this.dataCaptureContext, this.View.Bounds);
            this.dataCaptureView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight |
                                                    UIViewAutoresizing.FlexibleWidth;
            this.View.AddSubview(this.dataCaptureView);

            this.overlay            = BarcodeCaptureOverlay.Create(this.barcodeCapture, this.dataCaptureView);
            this.overlay.Viewfinder = RectangularViewfinder.Create(RectangularViewfinderStyle.Square, RectangularViewfinderLineStyle.Light);

            // Adjust the overlay's barcode highlighting to match the new viewfinder styles and improve the visibility of feedback.
            // With 6.10 we will introduce this visual treatment as a new style for the overlay.
            overlay.Brush = new Brush(fillColor: UIColor.Clear,
                                      strokeColor: UIColor.White,
                                      strokeWidth: 3);

            this.dataCaptureView.AddOverlay(this.overlay);
        }
        private void InitializeAndStartBarcodeScanning()
        {
            // Create data capture context using your license key.
            this.dataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);

            // Use the default camera and set it as the frame source of the context.
            // The camera is off by default and must be turned on to start streaming frames to the data
            // capture context for recognition.
            // See resumeFrameSource and pauseFrameSource below.
            this.camera = Camera.GetDefaultCamera();
            if (this.camera != null)
            {
                // Use the settings recommended by barcode capture.
                this.camera.ApplySettingsAsync(BarcodeCapture.RecommendedCameraSettings);
                this.dataCaptureContext.SetFrameSourceAsync(this.camera);
            }

            // The barcode capturing process is configured through barcode capture settings
            // which are then applied to the barcode capture instance that manages barcode recognition.
            BarcodeCaptureSettings barcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // The settings instance initially has all types of barcodes (symbologies) disabled.
            // For the purpose of this sample we enable a very generous set of symbologies.
            // In your own app ensure that you only enable the symbologies that your app requires as
            // every additional enabled symbology has an impact on processing times.
            HashSet <Symbology> symbologies = new HashSet <Symbology>();

            symbologies.Add(Symbology.Ean13Upca);
            symbologies.Add(Symbology.Ean8);
            symbologies.Add(Symbology.Upce);
            symbologies.Add(Symbology.Qr);
            symbologies.Add(Symbology.DataMatrix);
            symbologies.Add(Symbology.Code39);
            symbologies.Add(Symbology.Code128);
            symbologies.Add(Symbology.InterleavedTwoOfFive);

            barcodeCaptureSettings.EnableSymbologies(symbologies);

            // Some linear/1d barcode symbologies allow you to encode variable-length data.
            // By default, the Scandit Data Capture SDK only scans barcodes in a certain length range.
            // If your application requires scanning of one of these symbologies, and the length is
            // falling outside the default range, you may need to adjust the "active symbol counts"
            // for this symbology. This is shown in the following few lines of code for one of the
            // variable-length symbologies.
            SymbologySettings symbologySettings =
                barcodeCaptureSettings.GetSymbologySettings(Symbology.Code39);

            ICollection <short> activeSymbolCounts = new HashSet <short>(
                new short[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 });

            symbologySettings.ActiveSymbolCounts = activeSymbolCounts;

            // Create new barcode capture mode with the settings from above.
            this.barcodeCapture = BarcodeCapture.Create(this.dataCaptureContext, barcodeCaptureSettings);
            // Register self as a listener to get informed whenever a new barcode got recognized.
            barcodeCapture.AddListener(this);

            // To visualize the on-going barcode capturing process on screen, setup a data capture view
            // that renders the camera preview. The view must be connected to the data capture context.
            this.dataCaptureView = DataCaptureView.Create(this, this.dataCaptureContext);

            // Add a barcode capture overlay to the data capture view to render the location of captured
            // barcodes on top of the video preview.
            // This is optional, but recommended for better visual feedback.
            BarcodeCaptureOverlay overlay = BarcodeCaptureOverlay.Create(this.barcodeCapture, this.dataCaptureView);

            overlay.Viewfinder = RectangularViewfinder.Create();

            SetContentView(this.dataCaptureView);
        }
        /// <summary>
        /// Creates new instance of the SymbologyMainForm class
        /// </summary>
        public frmSymbologyMain(LegendControl.Legend legend, int layerHandle)
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            var gs = new GlobalSettings();

            gs.ForceHideLabels = true;

            // setting member variables (some of them for faster access)
            _legend      = legend;
            _layerHandle = layerHandle;
            _layer       = _legend.GetLayer(_layerHandle);
            _shapefile   = _layer.GetObject() as Shapefile;

            _settings = Globals.get_LayerSettings(_layerHandle);
            this.Text = "Layer properties: " + _layer.Name;

            // update map at once button is off by default which is equal to locked state of the map
            LockLegendAndMap(true);

            _initState = SaveState();

            // the first color in color scheme should be the fill/line color of the shapefile
            Globals.LayerColors.SetDefaultColorScheme(_shapefile);

            _noEvents = true;

            InitGeneralTab();

            InitModeTab();

            InitAppearanceTab();

            InitCategoriesTab();

            InitLabelsTab();

            InitChartsTab();

            InitExpressionTab();

            InitVisibilityTab();

            UpdateColorSchemes();

            // the state should be set after the loading as otherwise we can trigger unnecessary redraws
            chkRedrawMap.Checked = false; //_settings.UpdateMapAtOnce;

            _noEvents = false;

            // sets the enabled state of the controls
            RefreshControlsState(null, null);

            //DrawAllPreviews();

            AddTooltips();

            // displaying the last tab
            tabControl1.SelectedIndex = _tabIndex;

            tabControl1.TabPages.Remove(tabCharts);
            tabControl1.TabPages.Remove(tabLabels);
            tabControl1.TabPages.Remove(tabDefault);

            this.Shown += frmSymbologyMain_Shown;
        }
        protected override void OnElementChanged(ElementChangedEventArgs <CustomStackLayout> e)
        {
            base.OnElementChanged(e);

            //var test = this as ViewGroup;

            if (e.NewElement != null)
            {
                // Set the app key before instantiating the picker.
                ScanditLicense.AppKey = appKey;

                // The scanning behavior of the barcode picker is configured through scan
                // settings. We start with empty scan settings and enable a very generous
                // set of symbologies. In your own apps, only enable the symbologies you
                // actually need.
                ScanSettings settings            = ScanSettings.Create();
                int[]        symbologiesToEnable = new int[]
                {
                    Barcode.SymbologyEan13,
                    Barcode.SymbologyEan8,
                    Barcode.SymbologyUpca,
                    Barcode.SymbologyDataMatrix,
                    Barcode.SymbologyQr,
                    Barcode.SymbologyCode39,
                    Barcode.SymbologyCode128,
                    Barcode.SymbologyInterleaved2Of5,
                    Barcode.SymbologyUpce
                };

                for (int sym = 0; sym < symbologiesToEnable.Length; sym++)
                {
                    settings.SetSymbologyEnabled(symbologiesToEnable[sym], true);
                }

                //// Some 1d barcode symbologies allow you to encode variable-length data. By default, the
                //// Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your
                //// application requires scanning of one of these symbologies, and the length is falling
                //// outside the default range, you may need to adjust the "active symbol counts" for this
                //// symbology. This is shown in the following few lines of code.

                SymbologySettings symSettings        = settings.GetSymbologySettings(Barcode.SymbologyCode128);
                short[]           activeSymbolCounts = new short[]
                {
                    7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
                };
                symSettings.SetActiveSymbolCounts(activeSymbolCounts);
                // For details on defaults and how to calculate the symbol counts for each symbology, take
                // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

                picker = new BarcodePicker(this.Context, settings);

                picker.OverlayView.SetViewfinderDimension(0.5f, 0.9f, 0.5f, 0.9f);
                picker.OverlayView.SetTorchEnabled(false);


                // Set listener for the scan event.
                picker.SetOnScanListener(this);

                picker.StartScanning();

                //picker.Scan += (sender, args) =>
                //{

                //};

                AddView(picker);

                //SetNativeControl(picker);
            }
        }
Пример #21
0
 public void PresentSymbologySettings(SymbologySettings currentSettings, Action <SymbologySettings> actionHandler)
 {
     this.NavigationController.PushViewController(new SymbologySettingsTableViewController(currentSettings, actionHandler), true);;
 }
Пример #22
0
 public SymbologySettingsTableViewController(SymbologySettings symbologySettings, Action <SymbologySettings> onChange) : base(UITableViewStyle.Grouped)
 {
     this.SymbologySettings = symbologySettings;
     this.OnChange          = onChange;
     this.Title             = symbologySettings.Symbology.ReadableName();
 }
 public SymbologySettingsDataSource(IDataSourceListener dataSourceListener, SymbologySettings symbologySettings)
 {
     this.DataSourceListener   = dataSourceListener;
     this.symbologySettings    = symbologySettings;
     this.symbologyDescription = SymbologyDescription.Create(symbologySettings.Symbology);
 }
Пример #24
0
        /// <summary>
        /// Creates a new instance of PolygonsForm class
        /// </summary>
        public PolygonsForm(LegendControl.Legend legend, Layer layer, ShapeDrawingOptions options, bool applyDisabled)
        {
            InitializeComponent();

            if (options == null || layer == null)
            {
                throw new Exception("PolygonsForm: unexpected null parameter");
            }
            else
            {
                _options = options;
                m_layer  = layer;
            }

            m_legend         = legend;
            btnApply.Visible = !applyDisabled;

            _initState = options.Serialize();

            _noEvents           = true;
            groupPicture.Parent = tabPage2;
            groupPicture.Top    = groupGradient.Top;
            groupPicture.Left   = groupGradient.Left;

            groupHatch.Parent = tabPage2;
            groupHatch.Top    = groupGradient.Top;
            groupHatch.Left   = groupGradient.Left;

            cboFillType.Items.Clear();
            cboFillType.Items.Add("Solid");
            cboFillType.Items.Add("Hatch");
            cboFillType.Items.Add("Gradient");
            cboFillType.Items.Add("Texture");

            cboGradientType.Items.Clear();
            cboGradientType.Items.Add("Linear");
            cboGradientType.Items.Add("Rectangular");
            cboGradientType.Items.Add("Circle");

            cboGradientBounds.Items.Clear();
            cboGradientBounds.Items.Add("Whole layer");
            cboGradientBounds.Items.Add("Per-shape");

            cboVerticesType.Items.Clear();
            cboVerticesType.Items.Add("Square");
            cboVerticesType.Items.Add("Circle");

            icbHatchStyle.ComboStyle = ImageComboStyle.HatchStyle;
            icbLineType.ComboStyle   = ImageComboStyle.LineStyle;
            icbLineWidth.ComboStyle  = ImageComboStyle.LineWidth;

            // loading icons
            string path = Globals.GetTexturesPath();

            if (System.IO.Directory.Exists(path))
            {
                iconControl1.FilePath = path;
                iconControl1.Textures = true;

                SymbologySettings settings = Globals.get_LayerSettings(layer.Handle);
                iconControl1.SelectedIndex = settings.IconIndex;
            }
            else
            {
                udScaleX.Enabled = false;
                udScaleY.Enabled = false;
            }

            _noEvents = false;

            cboFillType.SelectedIndexChanged += new EventHandler(cboFillType_SelectedIndexChanged);

            Options2GUI();

            // -----------------------------------------------------
            // adding event handlers
            // -----------------------------------------------------
            // fill
            chkFillVisible.CheckedChanged += new EventHandler(GUI2Options);
            clpFill.SelectedColorChanged  += new EventHandler(GUI2Options);

            // hatch
            icbHatchStyle.SelectedIndexChanged  += new EventHandler(GUI2Options);
            chkFillBgTransparent.CheckedChanged += new EventHandler(GUI2Options);
            clpHatchBack.SelectedColorChanged   += new EventHandler(GUI2Options);

            // gradient
            clpGradient2.SelectedColorChanged      += new EventHandler(GUI2Options);
            udGradientRotation.ValueChanged        += new EventHandler(GUI2Options);
            cboGradientType.SelectedIndexChanged   += new EventHandler(GUI2Options);
            cboGradientBounds.SelectedIndexChanged += new EventHandler(GUI2Options);

            // outline
            chkOutlineVisible.CheckedChanged  += new EventHandler(GUI2Options);
            icbLineType.SelectedIndexChanged  += new EventHandler(GUI2Options);
            icbLineWidth.SelectedIndexChanged += new EventHandler(GUI2Options);
            clpOutline.SelectedColorChanged   += new EventHandler(GUI2Options);

            // vertices
            chkVerticesVisible.CheckedChanged     += new EventHandler(GUI2Options);
            cboVerticesType.SelectedIndexChanged  += new EventHandler(GUI2Options);
            clpVerticesColor.SelectedColorChanged += new EventHandler(GUI2Options);
            chkVerticesFillVisible.CheckedChanged += new EventHandler(GUI2Options);
            udVerticesSize.ValueChanged           += new EventHandler(GUI2Options);

            udScaleX.ValueChanged += new EventHandler(GUI2Options);
            udScaleY.ValueChanged += new EventHandler(GUI2Options);

            iconControl1.SelectionChanged += new ListControl.SelectionChangedDel(iconControl1_SelectionChanged);

            DrawPreview();

            tabControl1.SelectedIndex = _tabPage;
        }
        /// <summary>
        /// Generates a new instance of the GenerateCategoriesForm class
        /// </summary>
        public GenerateCategoriesForm(MapWinGIS.Shapefile sf, int layerHandle)
        {
            InitializeComponent();

            _shapefile   = sf;
            _layerHandle = layerHandle;
            if (sf == null)
            {
                return;
            }

            SymbologySettings settings = new SymbologySettings();// _plugin.get_LayerSettings(layerHandle);

            // 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
            Globals.LayerColors.SetDefaultColorScheme(_shapefile);

            // initializing for list of color schemes
            icbColorScheme.ColorSchemes = Globals.LayerColors;
            icbColorScheme.ComboStyle   = ImageComboStyle.ColorSchemeGraduated;

            // settings active color scheme
            for (int i = 0; i < icbColorScheme.Items.Count; i++)
            {
                if (icbColorScheme.ColorSchemes.List[i] == settings.CategoriesColorScheme)
                {
                    icbColorScheme.SelectedIndex = i;
                    break;
                }
            }
            if (icbColorScheme.SelectedItem == null)
            {
                icbColorScheme.SelectedIndex = 0;
            }

            if (_shapefile.ShapefileType == ShpfileType.SHP_POINT || _shapefile.ShapefileType == ShpfileType.SHP_MULTIPOINT)
            {
                chkUseVariableSize.Text = "Use variable symbol size";
                udMinSize.Minimum       = 1;
                udMinSize.Maximum       = 80;
                udMaxSize.Minimum       = 1;
                udMaxSize.Maximum       = 80;
                udMinSize.SetValue(_shapefile.DefaultDrawingOptions.PointSize);
                udMaxSize.SetValue((double)udMinSize.Value + settings.CategoriesSizeRange);
            }
            else if (_shapefile.ShapefileType == ShpfileType.SHP_POLYLINE)
            {
                chkUseVariableSize.Text = "Use variable line width";
                udMinSize.Minimum       = 1;
                udMinSize.Maximum       = 10;
                udMaxSize.Minimum       = 1;
                udMaxSize.Maximum       = 10;
                udMinSize.SetValue(_shapefile.DefaultDrawingOptions.LineWidth);
                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;
            }

            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 (((ComboItem)cboField.Items[i]).Text.ToLower() == name)
                {
                    cboField.SelectedIndex = i;
                    break;
                }
            }
        }