コード例 #1
0
ファイル: VectorSymbol.cs プロジェクト: leamas/RleEditor
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(ObjectHeader);
            //SYMB   10SY00095NIL
            sb.AppendLine(string.Format("SYMB{0}", RleParser.AddLength(string.Format("{0}{1:00000;-0000}{2}", ObjectType, ObjectId, RleParser.Nil))));
            //SYMD   39NMKREG12R000150001500031000310000000000
            //         39ARPONE01V|05033|02167|00394|00000|04828|02167
            sb.AppendLine(string.Format("SYMD{0}", RleParser.AddLength(string.Format("{0}{1}{2:00000;-0000}{3:00000;-0000}{4:00000;-0000}{5:00000;-0000}{6:00000;-0000}{7:00000;-0000}", Code, SymbolType, OffsetX, OffsetY, Width, Height, HotspotX, HotspotY))));
            //SXPO   32notice mark, special attention
            sb.AppendLine(string.Format("SXPO{0}", RleParser.AddTermAndLength(string.Format("{0}", Description))));
            //SCRF   18ACHBLKBCHREDCCHWHT
            StringBuilder sb1 = new StringBuilder();

            foreach (var color in Colors)
            {
                sb1.Append(String.Format("{0}{1}", color.Key, color.Value.Code));
            }
            sb.AppendLine(String.Format("SCRF{0}", RleParser.AddLength(sb1.ToString())));
            //SVCT   32AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            foreach (var s in BitmapData.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                sb.AppendLine(String.Format("SVCT{0}", RleParser.AddLength(s)));
            }
            sb.Append(ObjectFooter);
            return(sb.ToString());
        }
コード例 #2
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(ObjectHeader);
            //PATT   10SY00095NIL
            sb.AppendLine(string.Format("PATT{0}", RleParser.AddLength(string.Format("{0}{1:00000;-0000}{2}", ObjectType, ObjectId, RleParser.Nil))));
            //PATD   55NODATA04RSTGCON0000300326000200000000048000240000000000
            sb.AppendLine(string.Format("PATD{0}", RleParser.AddLength(string.Format("{0}{1}{2}{3:00000;-0000}{4:00000;-0000}{5:00000;-0000}{6:00000;-0000}{7:00000;-0000}{8:00000;-0000}{9:00000;-0000}{10:00000;-0000}", Code, 'R', Value2, Value3, Value4, OffsetX, OffsetY, Width, Height, HotspotX, HotspotY))));
            //PXPO   22area of no chart data
            sb.AppendLine(string.Format("PXPO{0}", RleParser.AddTermAndLength(string.Format("{0}", Description))));
            //PCRF    6ACHGRD
            StringBuilder sb1 = new StringBuilder();

            foreach (var color in Colors)
            {
                sb1.Append(String.Format("{0}{1}", color.Key, color.Value.Code));
            }
            sb.AppendLine(String.Format("PCRF{0}", RleParser.AddLength(sb1.ToString())));
            //PBTM   49@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            foreach (var s in BitmapData.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                sb.AppendLine(String.Format("PBTM{0}", RleParser.AddTermAndLength(s)));
            }
            sb.Append(ObjectFooter);
            return(sb.ToString());
        }
コード例 #3
0
ファイル: LookupTable.cs プロジェクト: leamas/RleEditor
        //"convyr","CATCON2|CONRAD1|","LS(SOLD,3,CHGRD);SY(RACNSP01);TE('clr %4.1lf','VERCLR',3,1,2,'15110',1,0,CHBLK,11)","8","O","DISPLAYBASE","12210"
        //0 - "convyr",
        //1 - "CATCON2|CONRAD1|",
        //2 - "LS(SOLD,3,CHGRD);SY(RACNSP01);TE('clr %4.1lf','VERCLR',3,1,2,'15110',1,0,CHBLK,11)",
        //3 - "8",
        //4 - "O",
        //5 - "DISPLAYBASE",
        //6 - "12210"
        //-----------------------
        //0001    500540
        //LUPT   29LU00540NILCOALNEL00007OLINES
        //ATTC    1
        //INST   13CS(QUAPOS01)
        //DISC   12DISPLAYBASE
        //LUCM    612410
        //****    0
        public static string LuptStringToRle(string ltline, int objectId, string symbolization)
        {
            try
            {
                //29LU00540NILCOALNEL00007OLINES
                string        LUPT       = "LU{0}NIL{1}{2}{3}{4}{5}";
                string[]      components = ltline.Replace("\",\"", "~").Replace("\"", string.Empty).Split('~');
                StringBuilder retstr     = new StringBuilder();
                retstr.AppendLine(ObjectHeader);
                //LUPT
                int x;
                Int32.TryParse(components[3], out x);

                string lupt = String.Format(LUPT, objectId.ToString("00000;-0000"), components[0], SymbolizationToSymbolizationLetter(symbolization),
                                            x.ToString("00000;-0000"), components[4],
                                            symbolization);
                retstr.Append("LUPT   ").Append(lupt.Length).AppendLine(lupt);
                //ATTC    1
                string attc;
                if (components[1].Length > 1 && !components[1].Contains("|")) //ENC tables from th PDF don't contain the attribute separators so we have to "invent them"
                {
                    string        attrstr = components[1];
                    StringBuilder sb      = new StringBuilder();
                    while (attrstr.Length > 0)
                    {
                        sb.Append(attrstr.Substring(0, 6));
                        attrstr = attrstr.Substring(6);
                        while (attrstr.Length > 0 && !Char.IsLetter(attrstr[0]))
                        {
                            sb.Append(attrstr[0]);
                            attrstr = attrstr.Substring(1);
                        }
                        sb.Append(RleParser.Term);
                    }
                    attc = sb.ToString();
                }
                else
                {
                    attc = components[1].Replace('|', RleParser.Term);
                }
                if (attc.Length == 0)
                {
                    attc = RleParser.Term.ToString();
                }
                retstr.AppendLine(String.Format("ATTC{0}", RleParser.AddLength(attc)));
                //INST
                retstr.AppendLine(String.Format("INST{0}", RleParser.AddTermAndLength(components[2])));
                //DISC
                retstr.AppendLine(String.Format("DISC{0}", RleParser.AddTermAndLength(components[5])));
                //LUCM
                retstr.AppendLine(String.Format("LUCM{0}", RleParser.AddTermAndLength(components[6])));
                retstr.Append(ObjectFooter);
                return(retstr.ToString());
            }
            catch
            {
                return(string.Empty);
            }
        }
コード例 #4
0
ファイル: VectorPattern.cs プロジェクト: leamas/RleEditor
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(ObjectHeader);
            sb.AppendLine(string.Format("PATT{0}", RleParser.AddLength(string.Format("{0}{1:00000;-0000}{2}", ObjectType, ObjectId, RleParser.Nil))));
            sb.AppendLine(string.Format("PATD{0}", RleParser.AddLength(string.Format("{0}{1}{2}{3:00000;-0000}{4:00000;-0000}{5:00000;-0000}{6:00000;-0000}{7:00000;-0000}{8:00000;-0000}{9:00000;-0000}{10:00000;-0000}", Code, SymbolType, Value2, Value3, Value4, OffsetX, OffsetY, Width, Height, HotspotX, HotspotY))));
            sb.AppendLine(string.Format("PXPO{0}", RleParser.AddTermAndLength(string.Format("{0}", Description))));
            StringBuilder sb1 = new StringBuilder();

            foreach (var color in Colors)
            {
                sb1.Append(String.Format("{0}{1}", color.Key, color.Value.Code));
            }
            sb.AppendLine(String.Format("PCRF{0}", RleParser.AddLength(sb1.ToString())));
            foreach (var s in BitmapData.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                sb.AppendLine(String.Format("PVCT{0}", RleParser.AddLength(s)));
            }
            sb.Append(ObjectFooter);
            return(sb.ToString());
        }