Example #1
0
        private TextBox createTextBox(MPZPModel mpzp, string parent, string child, string name)
        {
            System.Windows.Controls.TextBox MPZPTextBox = new System.Windows.Controls.TextBox();
            MPZPTextBox.IsReadOnly = true;
            MPZPTextBox.Width      = 150;
            MPZPTextBox.Name       = name;
            object result      = null;
            string MPZPIdField = config.getConfig(parent, child);

            mpzp.mpzp.TryGetValue(MPZPIdField, out result);
            MPZPTextBox.Text = result.ToString();
            return(MPZPTextBox);
        }
Example #2
0
        public void createRow(MPZPModel mpzp, int row)
        {
            WrapPanel panel = new WrapPanel();

            TextBox MPZPName = createTextBox(mpzp, "MPZP", "MPZPId", "MPZPName");

            panel.Children.Add(MPZPName);

            TextBox resolutionName = createTextBox(mpzp, "MPZP", "MPZPResolution", "MPZPResolution");

            panel.Children.Add(resolutionName);

            System.Windows.Controls.Button button = new System.Windows.Controls.Button();
            button.Content = "Wybierz";
            button.Click  += chooseMPZP;
            panel.Children.Add(button);
            primaryNavigator.Items.Add(panel);
        }
        public string editDocument(string file)
        {
            file = editHeader(file);
            file = getParcelsData(file);
            file = getResolutionData(file);
            file = createAssume(file);

            string HEADER_BG         = "\\red212\\green234\\blue255";
            string BG_LIGHT_GRAY     = "\\red232\\green232\\blue232";
            string BG_LIGHTER_GRAY   = "\\red240\\green240\\blue240";
            string paperSizeProps    = "\\paperw11909\\paperh16834";
            string colorTableString  = "{\\colortbl;" + HEADER_BG + ";" + BG_LIGHT_GRAY + ";" + BG_LIGHTER_GRAY + "}";
            string marginsProps      = "\\margl1400\\margr1400\\margt1400\\margb1400";
            string podsumowanieTable = "{";

            podsumowanieTable += "\\trowd\\trrh400 " +
                                 "\\clvertalc\\clcbpat1\\trbrdrb\\cellx4000 " +
                                 "\\clvertalc\\clcbpat1\\trbrdrb\\cellx5000 " +
                                 "\\clvertalc\\clcbpat1\\trbrdrb\\cellx7000 " +
                                 "\\b " + StringUtil.ToRtfString("Nazwa obrębu") + " \\b0\\intbl\\cell " +
                                 "\\b " + StringUtil.ToRtfString("Nr obrębu") + " \\b0\\intbl\\cell " +
                                 "\\b " + StringUtil.ToRtfString("Nr działki") + " \\b0\\intbl\\cell " +
                                 "\\row";
            var i = 0;

            foreach (ParcelModel parcel in acceptedProperties.parcels)
            {
                string rowBg          = (i % 2 == 0) ? "\\clcbpat2" : "\\clcbpat3";
                string parcelsIdField = config.getConfig("Działki", "parcelsId");
                string areaNameField  = config.getConfig("Obręby", "areaName");
                object areaName       = null;
                var    area           = parcel.precints.Where((precint) =>
                {
                    object resultShape = null;
                    precint.precint.TryGetValue("Shape", out resultShape);
                    ArcGIS.Core.Geometry.Polygon polygon = (ArcGIS.Core.Geometry.Polygon)resultShape;
                    parcel.parcel.TryGetValue("Shape", out resultShape);
                    ArcGIS.Core.Geometry.Polygon parcelPolygon = (ArcGIS.Core.Geometry.Polygon)resultShape;
                    return(!GeometryEngine.Instance.Intersection(polygon, parcelPolygon).IsEmpty);
                }).First();
                area.precint.TryGetValue(areaNameField, out areaName);
                object result = null;
                parcel.parcel.TryGetValue(parcelsIdField, out result);
                var array = result.ToString().Split('.');
                podsumowanieTable += "\\trowd\\trrh360 " +
                                     rowBg + "\\clvertalc\\cellx4000 " +
                                     rowBg + "\\clvertalc\\cellx5000 " +
                                     rowBg + "\\clvertalc\\cellx7000 " +
                                     StringUtil.ToRtfString(areaName.ToString()) + " \\intbl\\cell " +
                                     array[1].TrimStart(new Char[] { '0' }) + " \\intbl\\cell " +
                                     array[2] + " \\intbl\\cell " +
                                     "\\row ";
                i++;
            }
            podsumowanieTable += "}";

            file = file.Replace("[[podsumowanie_tabela]]", podsumowanieTable);

            string    legendFieldName = config.getConfig("MPZP", "MPZPLegend");
            MPZPModel mpzp            = acceptedProperties.mpzpModels.First();
            Object    legend          = null;

            mpzp.mpzp.TryGetValue("legend", out legend);
            if (legend != null)
            {
                Object legendSize = null;
                mpzp.mpzp.TryGetValue("legendSize", out legendSize);

                string str = BitConverter.ToString((byte[])legend, 0).Replace("-", string.Empty);

                string rtfImageStr = @"{\pict\pngblip\picw" +
                                     ((System.Drawing.Size)legendSize).Width + @"\pich" + (((System.Drawing.Size)legendSize).Height * 10) +
                                     @"\picwgoal" + (((System.Drawing.Size)legendSize).Width * 10) + @"\pichgoal" + (((System.Drawing.Size)legendSize).Height * 10) +
                                     str + "}";

                while (file.IndexOf("[[legenda_rastrowa]]") != file.LastIndexOf("[[legenda_rastrowa]]"))
                {
                    file = file.Remove(file.LastIndexOf("[[legenda_rastrowa]]"), 20);
                }

                file = file.Replace("[[legenda_rastrowa]]", rtfImageStr);
            }
            file = convertMapToString(file);
            file = removeStrings(file);
            return(file);
        }