Exemple #1
0
        public void Tile_Paint2(object sender, PaintEventArgs e)
        {
            //LibSys.StatusBar.Trace("Tile_Paint2(): " + m_baseName + " painting to " + e.ClipRectangle);

            try
            {
                //LibSys.StatusBar.Trace("Tile_Paint2(): tileFeatures=" + m_tileFeatures);
                if (m_tileFeatures != null && !m_tileFeatures.IsEmpty && m_tileFeatures.Count > 0)
                {
                    if (!m_tileFeatures.HasPutOnMap)
                    {
                        //LibSys.StatusBar.Trace("Tile_Paint2(): " + m_baseName + " calling features.PutOnMap()");
                        m_tileFeatures.PutOnMap(m_tileSet, this, this);
                    }

                    // we need to paint backwards, so that important cities are painted last:
                    int  i        = m_tileFeatures.Count - 1;
                    Type cityType = City.city.GetType();
                    for ( ; i >= 0; i--)
                    {
                        LiveObject lo = (LiveObject)m_tileFeatures.List[i];
                        try
                        {
                            if (Project.drawCities || !lo.GetType().Equals(cityType))
                            {
                                Point     pixelPos             = m_tileSet.toPixelLocation(lo.Location, this);
                                Rectangle adjustedBoundingRect = lo.BoundingRect;
                                adjustedBoundingRect.Offset(m_offset);
                                if (e.ClipRectangle.IntersectsWith(adjustedBoundingRect))
                                {
                                    lo.Paint(e.Graphics, m_tileSet, this);
                                }
                            }
                        }
                        catch (Exception ee)
                        {
                            LibSys.StatusBar.Error("Tile:Tile_Paint2(): lo=" + lo + " " + ee);
                        }
                    }
                }
            }
            catch (Exception eee)
            {
                LibSys.StatusBar.Error("Tile:Tile_Paint(): " + m_baseName + " " + eee);
            }
        }
Exemple #2
0
        public void Tile_Paint2Print(Graphics graphics)
        {
            //LibSys.StatusBar.Trace("Tile_Paint2Print(): " + m_baseName + " painting to " + ppe.ClipRectangle);

            int offsetSave = m_offset.X;

            m_offset.X = 0;             // we use direct method of calculating print surface location, world offset does not apply.

            try
            {
                //LibSys.StatusBar.Trace("Tile_Paint2Print(): tileFeatures=" + m_tileFeatures);
                if (m_tileFeatures != null && !m_tileFeatures.IsEmpty && m_tileFeatures.Count > 0)
                {
                    // we need to paint backwards, so that important cities are painted last:
                    int  i        = m_tileFeatures.Count - 1;
                    Type cityType = City.city.GetType();
                    for ( ; i >= 0; i--)
                    {
                        LiveObject lo = (LiveObject)m_tileFeatures.List[i];
                        try
                        {
                            if (Project.drawCities || !lo.GetType().Equals(cityType))
                            {
                                Point pixelPosPrint = m_tileSet.toPixelLocationPrint(lo.Location, this);
                                Point pixelPosDispl = lo.PixelLocation;
                                int   offsetX       = pixelPosPrint.X - pixelPosDispl.X;
                                int   offsetY       = pixelPosPrint.Y - pixelPosDispl.Y;
                                lo.Paint(graphics, m_tileSet, this, offsetX, offsetY);
                            }
                        }
                        catch (Exception ee)
                        {
                            LibSys.StatusBar.Error("Tile:Tile_Paint2Print(): lo=" + lo + " " + ee);
                        }
                    }
                }
            }
            catch (Exception eee)
            {
                LibSys.StatusBar.Error("Tile:Tile_Paint2Print(): " + m_baseName + " " + eee);
            }
            m_offset.X = offsetSave;
        }