Esempio n. 1
0
        private static void readPointSymbol(BaseSymbol bs, FileStream fs)
        {
            short dataSize = FileIOHelpers.ReadInt16FromStream(fs);
            short res = FileIOHelpers.ReadInt16FromStream(fs);

            List<SymbolElement> symElements = new List<SymbolElement>();
            for (int c = 0; c < dataSize; c++)
            {
                int sType = FileIOHelpers.ReadInt16FromStream(fs);
                int stFlags = FileIOHelpers.ReadInt16FromStream(fs);
                int color = FileIOHelpers.ReadInt16FromStream(fs);
                double lineWidthMM = FileIOHelpers.ReadInt16FromStream(fs) * 0.01;
                double stDiameter = FileIOHelpers.ReadInt16FromStream(fs) * 0.01;
                int numCoords = FileIOHelpers.ReadInt16FromStream(fs);
                int res1 = FileIOHelpers.ReadInt16FromStream(fs);
                int res2 = FileIOHelpers.ReadInt16FromStream(fs);

                c += 2;

                SymbolElement sEl = null;
                switch (sType)
                {
                    case 1:
                        sEl = new LineSymbolElement();
                        break;
                    case 2:
                        sEl = new AreaSymbolElement();
                        break;
                    case 3:
                        sEl = new CircleSymbolElement();
                        break;
                    case 4:
                        sEl = new DotSymbolElement();
                        break;
                }

                sEl.Coordinates = new Coordinate[numCoords];
                for (int coord = 0; coord < numCoords; coord++)
                {
                    var tcoord = readCoord(fs);
                    sEl.Coordinates[coord] = tcoord;
                    c++;

                }

                symElements.Add(sEl);
            }

            (bs as PointSymbol).SymbolElements = symElements.ToArray();
        }
Esempio n. 2
0
        private static void readLineSymbol(BaseSymbol bs, FileStream fs, ColorInfo[] colors)
        {
            int col = FileIOHelpers.ReadInt16FromStream(fs);
            (bs as LineSymbol).LineWidth = FileIOHelpers.ReadInt16FromStream(fs);

            if (colors.Where(x => x.ColorNum == col).Count() == 0)
                throw new ApplicationException("cant find color " + col + " for symbol: " + bs.Description + " [" + bs.SymbolNumber + "]");

            (bs as LineSymbol).LineColor = colors.Where(x => x.ColorNum == col).Select(x=>x.Color).First();
        }