<commit_before>﻿/* Copyright 2013 Esri
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using System.Windows;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.AdvancedSymbology;
using System;
using ESRI.ArcGIS.Client.Geometry;
using System.Collections.ObjectModel;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Linq;
using ESRI.ArcGIS.Client.Symbols;

namespace SidcSymbolViewer
{

    public partial class MainWindow : Window
    {
        Dictionary<string, SymbolProperties> sidc2SymbolProps = new Dictionary<string, SymbolProperties>();        

        public MainWindow()
        {
            // License setting and ArcGIS Runtime initialization is done in Application.xaml.cs.

            InitializeComponent();
            _symbolDictionary = new SymbolDictionary(SymbolDictionaryType.Mil2525C);

            IEnumerable<SymbolProperties> symbolProperties = _symbolDictionary.FindSymbols(null, null);
            var allSymbols = symbolProperties.ToList();
            foreach (var s in allSymbols)
            {
                string name = s.Name;
                if (string.IsNullOrEmpty(name) || !(s.Values.ContainsKey("SymbolID")))
                    continue;

                string symbolId = s.Values["SymbolID"].Replace('*','-');
                string geoType = s.Values["GeometryType"];

                // Need this table to be able to get the geometry type & other properties later
                sidc2SymbolProps[symbolId] = s;

                // To see symbols list:
                // System.Diagnostics.Trace.WriteLine(name + ":" + symbolId + ":" + geoType);
            }

            ListBox_Swatches.ItemsSource = swatches;
        }

        double x = 0;
        const double INITIAL_Y = 15000000;
        double y = INITIAL_Y;
        ObservableCollection<Image> swatches = new ObservableCollection<Image>();

  
        public static SymbolDictionary _symbolDictionary;

        private void Button_Click_Add_Points(object sender, RoutedEventArgs e)
        {
            AddSic("GHSPPT--------X");
            AddSic("GFMPNDA-------X");
            AddSic("GFSPPAT-------X");
            AddSic("GFMPNEB-------X");
            AddSic("GHGPGPUUB-----X");
            AddSic("GNMPNEC-------X");
            AddSic("GFGPGPPC------X");
            AddSic("GNMPNDB-------X");
            AddSic("GHGPAPD-------X");
            AddSic("GHMPNF--------X");
            AddSic("GHGPGPWG------X");
            AddSic("GFGPGPUUL-----X");
            AddSic("GNGPGPWM------X");
        }

        private void Button_Click_Add_Lines(object sender, RoutedEventArgs e)
        {
            AddSic("GFMPSL--------X");
            AddSic("GFMPOFA-------X");
            AddSic("GFGPPM--------X");
            AddSic("GFGPGLP-------X");
        }

        private void Button_Click_AddOne(object sender, RoutedEventArgs e)
        {
            var sic = TextBox_Sic.Text;

            try
            {
                AddSic(sic);
            }
            catch (Exception ee)
            {
                MessageBox.Show("Error occured: " + ee.ToString());
            }

        }

        private void AddSic(string sic)
        {
            const double INCREMENT = 2000000;
            const double HALF_INCREMENT = INCREMENT / 2.0;

            Message msg = new Message();
            msg.Id = Guid.NewGuid().ToString();
            msg.Add("_type", "position_report");
            msg.Add("_action", "update");
            msg.Add("_wkid", "3857");
            msg.Add("sic", sic);
            msg.Add("UniqueDesignation", "1");

            SymbolProperties code = null;

            if (sidc2SymbolProps.ContainsKey(sic))
                code = this.sidc2SymbolProps[sic];

            string geoType = "Point";
            if (code != null)
                geoType = code.Values["GeometryType"];

            if (geoType == "Point")
                msg.Add("_control_points", x.ToString() + "," + y.ToString());
            else if (geoType == "Line")
            {
               double x2 = x + HALF_INCREMENT;

               msg.Add("_control_points", 
                   x.ToString() + "," + y.ToString() + ";" +
                   x2.ToString() + "," + y.ToString());                    
            }
            else if (geoType == "Polygon") 
            {
               double yMinusHalf = y - HALF_INCREMENT;
               double xPlusHalf = x + HALF_INCREMENT;<commit_msg>Minor - add sic to message processor label<commit_after>﻿/* Copyright 2013 Esri
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using System.Windows;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.AdvancedSymbology;
using System;
using ESRI.ArcGIS.Client.Geometry;
using System.Collections.ObjectModel;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Linq;
using ESRI.ArcGIS.Client.Symbols;

namespace SidcSymbolViewer
{

    public partial class MainWindow : Window
    {
        Dictionary<string, SymbolProperties> sidc2SymbolProps = new Dictionary<string, SymbolProperties>();        

        public MainWindow()
        {
            // License setting and ArcGIS Runtime initialization is done in Application.xaml.cs.

            InitializeComponent();
            _symbolDictionary = new SymbolDictionary(SymbolDictionaryType.Mil2525C);

            IEnumerable<SymbolProperties> symbolProperties = _symbolDictionary.FindSymbols(null, null);
            var allSymbols = symbolProperties.ToList();
            foreach (var s in allSymbols)
            {
                string name = s.Name;
                if (string.IsNullOrEmpty(name) || !(s.Values.ContainsKey("SymbolID")))
                    continue;

                string symbolId = s.Values["SymbolID"].Replace('*','-');
                string geoType = s.Values["GeometryType"];

                // Need this table to be able to get the geometry type & other properties later
                sidc2SymbolProps[symbolId] = s;

                // To see symbols list:
                // System.Diagnostics.Trace.WriteLine(name + ":" + symbolId + ":" + geoType);
            }

            ListBox_Swatches.ItemsSource = swatches;
        }

        double x = 0;
        const double INITIAL_Y = 15000000;
        double y = INITIAL_Y;
        ObservableCollection<Image> swatches = new ObservableCollection<Image>();

  
        public static SymbolDictionary _symbolDictionary;

        private void Button_Click_Add_Points(object sender, RoutedEventArgs e)
        {
            AddSic("GHSPPT--------X");
            AddSic("GFMPNDA-------X");
            AddSic("GFSPPAT-------X");
            AddSic("GFMPNEB-------X");
            AddSic("GHGPGPUUB-----X");
            AddSic("GNMPNEC-------X");
            AddSic("GFGPGPPC------X");
            AddSic("GNMPNDB-------X");
            AddSic("GHGPAPD-------X");
            AddSic("GHMPNF--------X");
            AddSic("GHGPGPWG------X");
            AddSic("GFGPGPUUL-----X");
            AddSic("GNGPGPWM------X");
        }

        private void Button_Click_Add_Lines(object sender, RoutedEventArgs e)
        {
            AddSic("GFMPSL--------X");
            AddSic("GFMPOFA-------X");
            AddSic("GFGPPM--------X");
            AddSic("GFGPGLP-------X");
        }

        private void Button_Click_AddOne(object sender, RoutedEventArgs e)
        {
            var sic = TextBox_Sic.Text;

            try
            {
                AddSic(sic);
            }
            catch (Exception ee)
            {
                MessageBox.Show("Error occured: " + ee.ToString());
            }

        }

        private void AddSic(string sic)
        {
            const double INCREMENT = 2000000;
            const double HALF_INCREMENT = INCREMENT / 2.0;

            Message msg = new Message();
            msg.Id = Guid.NewGuid().ToString();
            msg.Add("_type", "position_report");
            msg.Add("_action", "update");
            msg.Add("_wkid", "3857");
            msg.Add("sic", sic);
            msg.Add("uniquedesignation", sic);

            SymbolProperties code = null;

            if (sidc2SymbolProps.ContainsKey(sic))
                code = this.sidc2SymbolProps[sic];

            string geoType = "Point";
            if (code != null)
                geoType = code.Values["GeometryType"];

            if (geoType == "Point")
                msg.Add("_control_points", x.ToString() + "," + y.ToString());
            else if (geoType == "Line")
            {
               double x2 = x + HALF_INCREMENT;

               msg.Add("_control_points", 
                   x.ToString() + "," + y.ToString() + ";" +
                   x2.ToString() + "," + y.ToString());                    
            }
            else if (geoType == "Polygon") 
            {
               double yMinusHalf = y - HALF_INCREMENT;
               double xPlusHalf = x + HALF_INCREMENT;
{'fraction_non_alphanumeric': 0.12468652823753636, 'fraction_numerical': 0.008125188083057478, 'mean_word_length': 1.761008031016339, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6608699', 'n_tokens_mistral': 2830, 'n_tokens_neox': 2650, 'n_words': 645}