コード例 #1
0
ファイル: GraphicElement.cs プロジェクト: FSofTlpz/GarminCore
 public GraphicElement(GraphicElement ge)
     : this()
 {
     Type    = ge.Type;
     Subtype = ge.Subtype;
     Text    = new MultiText(ge.Text);
     for (int i = 0; i < colDayColor.Length; i++)
     {
         colDayColor[i] = ge.colDayColor[i];
     }
     for (int i = 0; i < colNightColor.Length; i++)
     {
         colNightColor[i] = ge.colNightColor[i];
     }
     for (int i = 0; i < colFontColour.Length; i++)
     {
         colFontColour[i] = ge.colFontColour[i];
     }
     Options      = ge.Options;
     ExtOptions   = ge.ExtOptions;
     FontType     = ge.FontType;
     FontColType  = ge.FontColType;
     XBitmapDay   = new PixMap(XBitmapDay);
     XBitmapNight = new PixMap(XBitmapNight);
 }
コード例 #2
0
ファイル: MultiText.cs プロジェクト: FSofTlpz/GarminCore
 public MultiText(MultiText mt)
     : this()
 {
     foreach (Text.LanguageCode lcode in mt.txt.Keys)
     {
         txt.Add(lcode, mt.txt[lcode]);
     }
 }
コード例 #3
0
ファイル: POI.cs プロジェクト: FSofTlpz/GarminCore
        public void Read(BinaryReaderWriter br)
        {
            try {
                Options = br.ReadByte();
                uint iWidth  = br.ReadByte();
                uint iHeight = br.ReadByte();
                colsday         = br.ReadByte();
                ColormodeDay    = (BitmapColorMode)br.ReadByte();
                this.XBitmapDay = new PixMap(iWidth, iHeight, colsday, ColormodeDay, br);
                if (WithNightXpm)
                {
                    colsnight      = br.ReadByte();
                    ColormodeNight = (BitmapColorMode)br.ReadByte();
                    if (!NightXpmHasData)
                    {
                        Color[] col = BinaryColor.ReadColorTable(br, colsnight);
                        XBitmapNight = new PixMap(XBitmapDay);
                        XBitmapNight.SetNewColors(col);
                    }
                    else
                    {
                        XBitmapNight = new PixMap(Width, Height, colsnight, ColormodeNight, br);
                    }
                }
                if (WithString)
                {
                    Text = new MultiText(br);
                }
                if (WithExtendedOptions)
                {
                    ExtOptions = br.ReadByte();
                    switch (FontColType)
                    {
                    case FontColours.Day:
                        colFontColour[0] = BinaryColor.ReadColor(br);
                        break;

                    case FontColours.Night:
                        colFontColour[1] = BinaryColor.ReadColor(br);
                        break;

                    case FontColours.DayAndNight:
                        colFontColour = BinaryColor.ReadColorTable(br, 2);
                        break;
                    }
                }
            } catch (Exception ex) {
                throw new Exception(string.Format("Fehler beim Lesen des Punktes 0x{0:x} 0x{1:x}: {2}", Type, Subtype, ex.Message));
            }
        }
コード例 #4
0
ファイル: GraphicElement.cs プロジェクト: FSofTlpz/GarminCore
 public GraphicElement()
 {
     Type             = Subtype = 0;
     colDayColor      = new Color[2];
     colDayColor[0]   = colDayColor[1] = PixMap.TransparentColor;
     colNightColor    = new Color[2];
     colNightColor[0] = colNightColor[1] = PixMap.TransparentColor;
     colFontColour    = new Color[2];
     colFontColour[0] = colFontColour[1] = PixMap.TransparentColor;
     Options          = ExtOptions = 0;
     Text             = new MultiText();
     XBitmapDay       = null;
     XBitmapNight     = null;
 }
コード例 #5
0
ファイル: GraphicElement.cs プロジェクト: FSofTlpz/GarminCore
        /// <summary>
        /// setzt den Multitext neu
        /// </summary>
        /// <param name="txt"></param>
        public void SetText(MultiText txt)
        {
            bool bWithtxt = false;

            if (txt != null)
            {
                for (int i = 0; i < txt.Count; i++)
                {
                    if (txt.Get(i).Txt.Length > 0)
                    {
                        bWithtxt = true;
                        break;
                    }
                }
            }
            Text       = new MultiText(txt);
            WithString = bWithtxt;
        }
コード例 #6
0
ファイル: Polyline.cs プロジェクト: FSofTlpz/GarminCore
        public void Read(BinaryReaderWriter br)
        {
            long startpos = br.BaseStream.Position;

            try {
                Options  = br.ReadByte();
                Options2 = br.ReadByte();

                // Farben einlesen (1 bis max. 4)
                switch (Polylinetype)
                {
                case PolylineType.Day2:
                    colDayColor = BinaryColor.ReadColorTable(br, 2);
                    break;

                case PolylineType.Day2_Night2:
                    colDayColor   = BinaryColor.ReadColorTable(br, 2);
                    colNightColor = BinaryColor.ReadColorTable(br, 2);
                    break;

                case PolylineType.Day1_Night2:
                    colDayColor[0] = BinaryColor.ReadColor(br);
                    colNightColor  = BinaryColor.ReadColorTable(br, 2);
                    break;

                case PolylineType.NoBorder_Day2_Night1:
                    colDayColor      = BinaryColor.ReadColorTable(br, 2);
                    colNightColor[0] = BinaryColor.ReadColor(br);
                    break;

                case PolylineType.NoBorder_Day1:
                    colDayColor[0] = BinaryColor.ReadColor(br);
                    break;

                case PolylineType.NoBorder_Day1_Night1:
                    colDayColor[0]   = BinaryColor.ReadColor(br);
                    colNightColor[0] = BinaryColor.ReadColor(br);
                    break;
                }

                if (BitmapHeight == 0) // Linien- und Randbreite ermitteln
                {
                    switch (Polylinetype)
                    {
                    case PolylineType.Day2:
                    case PolylineType.Day2_Night2:
                    case PolylineType.Day1_Night2:
                        InnerWidth = br.ReadByte();
                        if (InnerWidth > 0)              // sonst Bitmap, also KEINE BorderWidth
                        {
                            BorderWidth = (br.ReadByte() - InnerWidth) / 2;
                        }
                        break;

                    case PolylineType.NoBorder_Day2_Night1:
                    case PolylineType.NoBorder_Day1:
                    case PolylineType.NoBorder_Day1_Night1:
                        InnerWidth = br.ReadByte();      // es folgt KEINE BorderWidth
                        break;
                    }
                }
                else   // Bitmap einlesen (Höhe ist Thickness Pixel, Breite 32 Pixel, Dummyfarbe!)
                {
                    XBitmapDay = new PixMap(32, BitmapHeight, new Color[1] {
                        Color.White
                    }, BitmapColorMode.POLY1TR, br);
                }

                if (WithString)
                {
                    Text = new MultiText(br);
                }

                if (WithExtendedOptions)
                {
                    ExtOptions = br.ReadByte();
                    switch (FontColType)
                    {
                    case FontColours.Day:
                        colFontColour[0] = BinaryColor.ReadColor(br);
                        break;

                    case FontColours.Night:
                        colFontColour[1] = BinaryColor.ReadColor(br);
                        break;

                    case FontColours.DayAndNight:
                        colFontColour = BinaryColor.ReadColorTable(br, 2);
                        break;
                    }
                }
            } catch (Exception ex) {
                throw new Exception(string.Format("Fehler beim Lesen der Linie 0x{0:x} 0x{1:x}: {2}", Type, Subtype, ex.Message));
            }
        }
コード例 #7
0
        public void Read(BinaryReaderWriter br)
        {
            try {
                Options = br.ReadByte();

                // es folgen 1 bis max. 4 Farben und ev. 1 Bitmap
                switch (Colortype) // hier muss sicher noch überprüft werden, ob die Typen wirklich richtig interpretiert werden
                {
                case ColorType.Day1:
                    colDayColor[0] = BinaryColor.ReadColor(br);
                    break;

                case ColorType.Day1_Night1:
                    colDayColor[0]   = BinaryColor.ReadColor(br);
                    colNightColor[0] = BinaryColor.ReadColor(br);
                    break;

                case ColorType.BM_Day2:          // 2 Farben + 1x Pixeldaten
                    colDayColor = BinaryColor.ReadColorTable(br, 2);
                    XBitmapDay  = new PixMap(32, 32, colDayColor, BitmapColorMode.POLY2, br);
                    break;

                case ColorType.BM_Day2_Night2:   // 4 Farben + 1x Pixeldaten
                    colDayColor   = BinaryColor.ReadColorTable(br, 2);
                    colNightColor = BinaryColor.ReadColorTable(br, 2);
                    XBitmapDay    = new PixMap(32, 32, colDayColor, BitmapColorMode.POLY2, br);
                    XBitmapNight  = new PixMap(XBitmapDay);
                    XBitmapNight.SetNewColors(colNightColor);
                    break;

                case ColorType.BM_Day1_Night2:   // 3 Farben + 1x Pixeldaten
                    colDayColor[0] = BinaryColor.ReadColor(br);
                    colDayColor[1] = PixMap.TransparentColor;
                    colNightColor  = BinaryColor.ReadColorTable(br, 2);
                    XBitmapDay     = new PixMap(32, 32, colDayColor, BitmapColorMode.POLY2, br);
                    XBitmapNight   = new PixMap(XBitmapDay);
                    XBitmapNight.ChangeColorMode(BitmapColorMode.POLY2);
                    XBitmapNight.SetNewColors(colNightColor);
                    break;

                case ColorType.BM_Day2_Night1:   // 3 Farben + 1x Pixeldaten
                    colDayColor      = BinaryColor.ReadColorTable(br, 2);
                    colNightColor[0] = BinaryColor.ReadColor(br);
                    colNightColor[1] = PixMap.TransparentColor;
                    XBitmapDay       = new PixMap(32, 32, colDayColor, BitmapColorMode.POLY2, br);
                    XBitmapNight     = new PixMap(XBitmapDay);
                    XBitmapNight.ChangeColorMode(BitmapColorMode.POLY1TR);
                    XBitmapNight.SetNewColors(colNightColor);
                    break;

                case ColorType.BM_Day1:          // 1 Farbe + 1x Pixeldaten
                    colDayColor[0] = colNightColor[0] = BinaryColor.ReadColor(br);
                    colDayColor[1] = colNightColor[1] = PixMap.TransparentColor;
                    XBitmapDay     = new PixMap(32, 32, colDayColor, BitmapColorMode.POLY1TR, br);
                    break;

                case ColorType.BM_Day1_Night1:   // 2 Farben + 1x Pixeldaten
                    colDayColor[0]   = BinaryColor.ReadColor(br);
                    colDayColor[1]   = PixMap.TransparentColor;
                    colNightColor[0] = BinaryColor.ReadColor(br);
                    colNightColor[1] = PixMap.TransparentColor;
                    XBitmapDay       = new PixMap(32, 32, colDayColor, BitmapColorMode.POLY1TR, br);
                    XBitmapNight     = new PixMap(XBitmapDay);
                    XBitmapNight.SetNewColors(colNightColor);
                    break;
                }
                if (WithDayBitmap)
                {
                    // sicherheitshalber nochmal die Bitmapfarben übernehmen
                    DayColor1 = XBitmapDay.GetColor(0);
                    if (XBitmapDay.Colors > 1)
                    {
                        DayColor2 = XBitmapDay.GetColor(1);
                    }
                    if (XBitmapNight != null)
                    {
                        NightColor1 = XBitmapNight.GetColor(0);
                        if (XBitmapNight.Colors > 1)
                        {
                            NightColor2 = XBitmapNight.GetColor(1);
                        }
                    }
                }

                if (WithString)
                {
                    Text = new MultiText(br);
                }

                if (WithExtendedOptions)  // es folgen weitere (max. 2) Farben
                {
                    ExtOptions = br.ReadByte();
                    switch (FontColType)
                    {
                    case FontColours.Day:
                        colFontColour[0] = BinaryColor.ReadColor(br);
                        break;

                    case FontColours.Night:
                        colFontColour[1] = BinaryColor.ReadColor(br);
                        break;

                    case FontColours.DayAndNight:
                        colFontColour = BinaryColor.ReadColorTable(br, 2);
                        break;
                    }
                }
            } catch (Exception ex) {
                throw new Exception(string.Format("Fehler beim Lesen des Polygons 0x{0:x} 0x{1:x}: {2}", Type, Subtype, ex.Message));
            }
        }