Exemple #1
0
        public override void Paint(Graphics graphics, IDrawingSurface tileSet, ITile iTile, int offsetX, int offsetY)
        {
            if (!m_enabled)
            {
                return;
            }

            Rectangle r = m_imageBoundingRect;

            if (m_image == null)
            {
                Font font = Project.getLabelFont(m_fontSize);

                int    xx    = m_labelBoundingRect.X - 3;
                int    yy    = m_labelBoundingRect.Y - 1;
                string label = MapName + " - missing Tiff file or GeoTiff information";
                graphics.DrawString(label, font, Project.customMapFontBrush, xx + 1, yy - 1);

                graphics.DrawEllipse(Project.customMapPen, r.X + 2, r.Y + 2, r.Width - 4, r.Height - 4);
            }
            else
            {
                double angle  = Math.Atan(((double)(m_pixelLocationTopRight.Y - m_pixelLocation.Y)) / ((double)(m_pixelLocationTopRight.X - m_pixelLocation.X)));
                float  scaleX = ((float)(m_pixelLocationTopRight.X - m_pixelLocation.X)) / ((float)(m_pixelLocationBottomRight.X - m_pixelLocation.X));
                float  scaleY = ((float)(m_pixelLocationBottomLeft.Y - m_pixelLocation.Y)) / ((float)(m_pixelLocationBottomRight.Y - m_pixelLocation.Y));
                Matrix X      = new Matrix();
                X.Translate(m_pixelLocation.X, m_pixelLocation.Y);
                X.Scale(scaleX, scaleY);
                X.Rotate((float)(angle * 180.0d / Math.PI));
                //X.Shear(-0.01f, -0.01f);
                X.Translate(-m_pixelLocation.X, -m_pixelLocation.Y);
                graphics.Transform = X;

                ImageAttributes imageAttr = new ImageAttributes();

                ColorMatrix cm = new ColorMatrix();

                cm.Matrix00 = 1.0f;
                cm.Matrix11 = 1.0f;
                cm.Matrix22 = 1.0f;
                float opacity = (float)(Project.terraLayerOpacity3);
                cm.Matrix33 = opacity;

                imageAttr.SetColorMatrix(cm);

                int www = m_image.Width;
                int hhh = m_image.Height;
                graphics.DrawImage(m_image, r, 0, 0, www, hhh, System.Drawing.GraphicsUnit.Pixel, imageAttr);
                //graphics.DrawImage(m_image, r);

                graphics.Transform = new Matrix();

                // add confidence to allow double-check positioning - draw corner points:

                Project.drawCross(graphics, Project.redPen, m_pixelLocation, 20);
                Project.drawCross(graphics, Project.redPen, m_pixelLocationBottomLeft, 20);
                Project.drawCross(graphics, Project.redPen, m_pixelLocationTopRight, 20);
                Project.drawCross(graphics, Project.redPen, m_pixelLocationBottomRight, 20);
            }
        }
Exemple #2
0
 public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
 {
     // TODO: Add adornment painting logic
     context.DrawRectangle(null, Colors.Red, geometry.StartRect);
     context.DrawRectangle(null, Colors.Green, geometry.EndRect);
     context.DrawRectangle(null, Colors.Blue, geometry.Bounds);
 }
Exemple #3
0
 public DragScreenHelper(IDrawingSurface drawingSurface, Coordinates worldPoint)
 {
     this.drawingSurface    = drawingSurface;
     this.originalTransform = drawingSurface.Transform.Clone();
     this.originalCenter    = originalTransform.CenterPoint;
     this.moveOrigin        = worldPoint + originalCenter;
 }
 public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
 {
     BackgroundColor = DevExpress.DXCore.Platform.Drawing.Color.ConvertFrom(CodeRush.VSSettings.BackgroundColor);
     context.DrawRectangle(BackgroundColor, Opacity,
                           BackgroundColor, Opacity, 1,
                           geometry.Bounds.Extend(5, 0));
 }
 public DragScreenHelper(IDrawingSurface drawingSurface, Coordinates worldPoint)
 {
     this.drawingSurface = drawingSurface;
     this.originalTransform = drawingSurface.Transform.Clone();
     this.originalCenter = originalTransform.CenterPoint;
     this.moveOrigin = worldPoint + originalCenter;
 }
        public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
        {
            ColorProperty prefixColor = new ColorProperty(
                Color.FromArgb(_settings.PrefixAlpha, _settings.PrefixRed, _settings.PrefixGreen, _settings.PrefixBlue));

            context.DrawString(_settings.PrefixText, CodeRush.VSSettings.FontName,CodeRush.VSSettings.FontSize,prefixColor,geometry.Location);
        }
        public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
        {
            ColorProperty prefixColor = new ColorProperty(
                Color.FromArgb(_settings.PrefixAlpha, _settings.PrefixRed, _settings.PrefixGreen, _settings.PrefixBlue));

            context.DrawString(_settings.PrefixText, CodeRush.VSSettings.FontName, CodeRush.VSSettings.FontSize, prefixColor, geometry.Location);
        }
        void drawLine(IDrawingSurface drawingSurface, DrawLinesBetweenMethodsSettings settings, Point startPoint)
        {
            int lineWidth = 3000; //TODO: perhaps more scientific way of doing this?

            Point endPoint = startPoint.MoveRight(lineWidth);
            //Debug.WriteLine("  drawLine " + startPoint + " -> " + endPoint);
            drawingSurface.DrawLine(Color.ConvertFrom(settings.LineColor), startPoint, endPoint, null, settings.LineWidth);
        }
Exemple #9
0
        public virtual void PutOnMap(IDrawingSurface map, ITile iTile, IObjectsLayoutManager iOlm)
        {
            m_map   = map;
            m_itile = iTile;
            m_olm   = iOlm;             // can be null

            m_pixelLocation = map.toPixelLocation(m_location, iTile);
        }
        public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
        {
            ColorProperty metaColor = new ColorProperty(
                Color.FromArgb(_settings.BlockMetaDataAlpha, _settings.BlockMetaDataRed, _settings.BlockMetaDataGreen, _settings.BlockMetaDataBlue));

            float fontSize = CodeRush.VSSettings.FontSize;

            context.DrawString(_customMetaString, CodeRush.VSSettings.FontName, fontSize, metaColor, geometry.Location.MoveDown(2));
        }
Exemple #11
0
        void drawLine(IDrawingSurface drawingSurface, DrawLinesBetweenMethodsSettings settings, Point startPoint)
        {
            int lineWidth = 3000; //TODO: perhaps more scientific way of doing this?

            Point endPoint = startPoint.MoveRight(lineWidth);

            //Debug.WriteLine("  drawLine " + startPoint + " -> " + endPoint);
            drawingSurface.DrawLine(Color.ConvertFrom(settings.LineColor), startPoint, endPoint, null, settings.LineWidth);
        }
        public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
        {
            ColorProperty metaColor = new ColorProperty(
                Color.FromArgb(_settings.BlockMetaDataAlpha, _settings.BlockMetaDataRed, _settings.BlockMetaDataGreen, _settings.BlockMetaDataBlue));

            float fontSize = CodeRush.VSSettings.FontSize;

            context.DrawString (_customMetaString, CodeRush.VSSettings.FontName, fontSize , metaColor, geometry.Location.MoveDown(2));
        }
Exemple #13
0
 public MapEditorController(IDrawingSurface surface, string applicationPath)
 {
     AppPath     = applicationPath;
     Render      = new ImageMatrixRender(surface);
     PressedKeys = new ButtonController(new List <ButtonKey>()
     {
         new ButtonKey(System.Windows.Forms.Keys.Escape)
     });
 }
Exemple #14
0
 public CellRender(IDrawingSurface surface, int[][] data, Pen[] penses, Brush[] brushes, Pen cellRectanglePen, Color backgroundBrushColor)
 {
     Surface             = surface;
     Data                = data;
     paintPen            = penses;
     paintBrush          = brushes;
     cellRectPen         = cellRectanglePen;
     backgroundCellColor = backgroundBrushColor;
     DrawingFrame        = new Rectangle(0, 0, surface.Width, surface.Height);
 }
Exemple #15
0
 public override void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager iOlm)
 {
     if (m_bigCity > 0 || m_doName && m_intersections > 0)
     {
         //LibSys.StatusBar.Trace("AdjustPlacement():  City: - " + Location + " - " + Name + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
         placeLabel(m_bigCity, m_fontSize, true); // may turn m_doName to false
         boundingRect();                          // make sure we have current values there
         //LibSys.StatusBar.Trace("                int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
     }
 }
Exemple #16
0
        public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(tileSet, iTile, olm);

            m_pixelLocationBottomLeft  = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.BottomLeftLng, m_geoTiff.BottomLeftLat), iTile);
            m_pixelLocationTopRight    = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.TopRightLng, m_geoTiff.TopRightLat), iTile);
            m_pixelLocationBottomRight = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.BottomRightLng, m_geoTiff.BottomRightLat), iTile);

            boundingRect();                     // make sure we have current values there
        }
Exemple #17
0
        public override void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager olm)
        {
            if (m_intersections > 0)
            {
#if DEBUG
                LibSys.StatusBar.Trace("AdjustPlacement():  Vehicle: - " + Location + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
#endif
                placeLabel(0, m_fontSize, true);        // may turn m_doName to false
                boundingRect();                         // make sure we have current values there
                //LibSys.StatusBar.Trace("                int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
            }
        }
Exemple #18
0
        public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(tileSet, iTile, olm);

            m_enabled = true;

            placeLabel(5, m_fontSize, false);   // may turn m_doName to false

            boundingRect();                     // make sure we have current values there

            //LibSys.StatusBar.Trace("Vehicle:PutOnMap():  veh - " + Location + m_pixelLocation + " - " + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
        }
Exemple #19
0
        public void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager iOlm)
        {
            assignNames(layer);

            rebuildTrackBoundaries();

            /*
             * can't do this, as other trackpoints are not placed and will not react on mouse hover
             * foreach(Waypoint wpt in m_trackpointsNamed)
             * {
             *      wpt.PutOnMap(layer, iTile, iOlm);
             * }
             */

            // keep the stepping logic in sync with WaypointsCache:RefreshWaypointsDisplayed(), because
            // LayerWaypoints:WaypointByPoint() operates on the WaypointsCache.WaypointsDisplayedNotSorted array
            int step = getStep(this, layer.getCameraElevation());

            for (int i = 0; i < m_trackpoints.Count; i += step)
            {
                try
                {
                    Waypoint wpt = (Waypoint)m_trackpoints.GetByIndex(i);
                    if (wpt.ThumbImage != null)
                    {
                        i -= (step - 1);                                        // move to the next trackpoint
                        continue;
                    }

                    wpt.PutOnMap(layer, iTile, iOlm);
                    int pointsLeft = m_trackpoints.Count - i;
                    if (pointsLeft > 1 && pointsLeft < step)
                    {
                        step = pointsLeft - 2;
                        if (step < 1)
                        {
                            step = 1;
                        }
                    }
                }
                catch {}
            }
            if (Project.thumbDoDisplay)
            {
                SortedList ppts = Project.mainCommand.getWaypointsWithThumbs(m_id);
                for (int i = 0; i < ppts.Count; i++)
                {
                    Waypoint wpt = (Waypoint)ppts.GetByIndex(i);
                    wpt.PutOnMap(layer, iTile, iOlm);
                }
            }
        }
Exemple #20
0
        public override void Paint(Graphics graphics, IDrawingSurface tileSet, ITile iTile)
        {
            if (!m_enabled)
            {
                return;
            }

            Point pLoc = tileSet.toPixelLocation(Location, iTile);
            //LibSys.StatusBar.Trace("VehicleGps::Paint()  - " + Location + " - " + m_doName + m_labelBoundingRect);

            Font font = Project.getLabelFont(m_fontSize);

            int xx = m_labelBoundingRect.X - 3;
            int yy = m_labelBoundingRect.Y - 1;
            //string label = "" + m_labelPosition + " " + Name;
            string label = Name;

            if (Project.vehicleUseShadow)
            {
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx, yy);
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx + 2, yy);
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx, yy - 2);
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx + 2, yy - 2);
            }
            graphics.DrawString(label, font, Project.vehicleFontBrush, xx + 1, yy - 1);

            if (Image == null)
            {
                graphics.DrawEllipse(Project.vehiclePen, m_pixelLocation.X - MIN_VEH_PIXEL_RADIUS + 2, m_pixelLocation.Y - MIN_VEH_PIXEL_RADIUS + 2, MIN_VEH_PIXEL_RADIUS * 2 - 4, MIN_VEH_PIXEL_RADIUS * 2 - 4);
                graphics.FillEllipse(Project.vehicleBrush, m_pixelLocation.X - 2, m_pixelLocation.Y - 2, 4, 4);
            }
            else
            {
                // assume the center of the image is hotpoint:
                graphics.DrawImage(Image, m_pixelLocation.X - Image.Width / 2, m_pixelLocation.Y - Image.Height / 2);
                graphics.DrawEllipse(Project.vehiclePen, m_pixelLocation.X - 2, m_pixelLocation.Y - 2, 4, 4);
            }

            if (arrowPoints != null)
            {
                graphics.FillPolygon(brushVelocity, arrowPoints);
                graphics.DrawLine(penVelocity, new Point(m_pixelLocation.X, m_pixelLocation.Y), arrowPoints[0]);
            }

            // debug only:
            //	graphics.DrawRectangle(Project.debugPen, m_boundingRect);
            //	graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);
            //	graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);
        }
Exemple #21
0
        public override void Paint(Graphics graphics, IDrawingSurface tileSet, ITile iTile, int offsetX, int offsetY)
        {
            if (!m_enabled)
            {
                return;
            }

            //LibSys.StatusBar.Trace("Paint():  Place: - " + Location + " - " + Name);
            Point pLoc     = tileSet.toPixelLocation(Location, iTile);
            int   toffsetX = iTile.getOffset().X;

            Rectangle r = m_imageBoundingRect;

            r.Offset(toffsetX, 0);

            Font font = Project.getLabelFont(m_fontSize);

            if (m_doName)
            {
                int xx = m_labelBoundingRect.X - 3 + toffsetX + offsetX;
                int yy = m_labelBoundingRect.Y - 1 + offsetY;
                //string label = "" + m_labelPosition + Name;
                string label = Name;
                if (m_doDrawShadow)
                {
                    graphics.DrawString(label, font, m_labelShadowBrush, xx, yy);
                    graphics.DrawString(label, font, m_labelShadowBrush, xx + 2, yy);
                    graphics.DrawString(label, font, m_labelShadowBrush, xx, yy - 2);
                    graphics.DrawString(label, font, m_labelShadowBrush, xx + 2, yy - 2);
                }
                graphics.DrawString(label, font, m_labelBrush, xx + 1, yy - 1);
            }

            if (m_doDrawPoint)
            {
                if (m_doDrawShadow)
                {
                    graphics.DrawEllipse(m_shadowPen, r.X + 3 + offsetX, r.Y + 3 + offsetY, r.Width - 5, r.Height - 5);
                    graphics.DrawEllipse(m_shadowPen, r.X + 1 + offsetX, r.Y + 1 + offsetY, r.Width - 2, r.Height - 2);
                }
                graphics.DrawEllipse(m_pen, r.X + 2 + offsetX, r.Y + 2 + offsetY, r.Width - 4, r.Height - 4);
            }

            // debug only:
//				graphics.DrawRectangle(Project.debugPen, m_boundingRect);
//				graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);
//				graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);
        }
Exemple #22
0
        public void PutOnMap(IDrawingSurface map, ITile iTile, IObjectsLayoutManager tile)
        {
#if DEBUG
            LibSys.StatusBar.Trace("IP: Features:PutOnMap()  " + m_list.Count + "  " + tile);
#endif

            // here is a slow and ineffective method to restore all live objects to original state.
            // it does not work on substitutes though:
            // m_list.Clear();
            // this.Fill();

            // if lo.init() works well, the loop below will do the job of Clear/Fill:
            foreach (LiveObject lo in m_list)
            {
                try
                {
                    lo.init(true);
                }
                catch (Exception e)
                {
                    LibSys.StatusBar.Error("Features:PutOnMap(): lo=" + lo + " " + e.Message);
                }
            }
            foreach (LiveObject lo in m_list)
            {
                try
                {
                    lo.PutOnMap(map, iTile, tile);
                }
                catch (Exception e)
                {
                    LibSys.StatusBar.Error("Features:PutOnMap(): lo=" + lo + " " + e.Message);
                }
            }
            foreach (LiveObject lo in m_list)
            {
                try
                {
                    lo.AdjustPlacement(map, iTile, tile);
                }
                catch (Exception e)
                {
                    LibSys.StatusBar.Error("Features:PutOnMap() - AdjustPlacement: lo=" + lo + " " + e.Message);
                }
            }
            m_hasPutOnMap = true;
        }
Exemple #23
0
        public override void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(layer, iTile, olm);

            //m_doName = true;
            m_enabled = true;

            Name = getLabel(true);

            m_fontSize = fontSizeByType(LiveObjectType);

            placeLabel(0, m_fontSize, false);   // may turn m_doName to false

            boundingRect();                     // make sure we have current values there

            //LibSys.StatusBar.Trace("LabeledPoint:PutOnMap():  " + Location + m_pixelLocation + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
        }
Exemple #24
0
        public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager tile)
        {
            base.PutOnMap(tileSet, iTile, tile);

            //LibSys.StatusBar.Trace("PutOnMap(): - " + this);

            m_pixelRadius = MIN_PLACE_PIXEL_RADIUS;

            m_enabled = true;

            int    importance = Importance;
            string dsg        = Dsg;

            m_placeCode = m_code;
            setColors();                                // and doSize

            if (m_doName)
            {
                int bigPlace = (6 - importance);                    // 5-high, 0-low

                // font size will be calculated depending on population
                m_fontSize = Project.PLACE_FONT_SIZE;
                if (bigPlace > 0)
                {
                    switch (bigPlace)
                    {
                    case 5:
                        m_fontSize += 3;
                        break;

                    default:
                        m_fontSize += bigPlace / 2;
                        break;
                    }
                }

                placeLabel(bigPlace, m_fontSize, false);
            }
            else
            {
                m_imageBoundingRect = Rectangle.Empty;
            }

            boundingRect();                     // make sure we have current values there
        }
Exemple #25
0
        public override void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(layer, iTile, olm);

            m_elevKm = layer.getCameraElevation() / 1000.0d;
            m_doFill = m_magn > 1.0d &&
                       (!Project.earthquakeStyleFillRecent ||
                        Project.localToZulu(DateTime.Now).AddMinutes(-recentTimes[Project.earthquakeStyleFillHowRecentIndex]) < this.DateTime);
            if (m_elevKm > 5000.0d)
            {
                m_doName = m_magn > 5.0d;
            }
            else if (m_elevKm > 2000.0d)
            {
                m_doName = m_magn > 4.0d;
            }
            else if (m_elevKm > 900.0d)
            {
                m_doName = m_magn > 3.0d;
            }
            else if (m_elevKm > 370.0d)
            {
                m_doName = m_magn > 1.0d;
            }
            else if (m_elevKm > 100.0d)
            {
                m_doName = m_magn > 0.0d;
            }
            else
            {
                m_doName = true;
            }

            m_enabled = true;

            Name = getLabel(true);

            placeLabel(0, m_fontSize, false);   // may turn m_doName to false

            boundingRect();                     // make sure we have current values there

            //LibSys.StatusBar.Trace("Earthquake:PutOnMap():  eq - " + Location + m_pixelLocation + " - " + Magn + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
        }
Exemple #26
0
        public override void Paint(Graphics graphics, IDrawingSurface tileSet, ITile iTile, int offsetX, int offsetY)
        {
            if (!m_enabled)
            {
                return;
            }

            Point pLoc = tileSet.toPixelLocation(Location, iTile);
            //LibSys.StatusBar.Trace("Vehicle::Paint()  - " + Location + " - " + m_doName + m_labelBoundingRect);

            Rectangle r = m_imageBoundingRect;

            Font font = Project.getLabelFont(m_fontSize);

            int xx = m_labelBoundingRect.X - 3;
            int yy = m_labelBoundingRect.Y - 1;
            //string label = "" + m_labelPosition + Name;
            string label = Name;

            if (Project.vehicleUseShadow)
            {
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx, yy);
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx + 2, yy);
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx, yy - 2);
                graphics.DrawString(label, font, Project.vehicleBackgroundBrush, xx + 2, yy - 2);
            }
            graphics.DrawString(label, font, Project.vehicleFontBrush, xx + 1, yy - 1);

            if (m_image == null)
            {
                graphics.DrawEllipse(Project.vehiclePen, r.X + 2, r.Y + 2, r.Width - 4, r.Height - 4);
            }
            else
            {
                graphics.DrawImage(m_image, r.X, r.Y);
            }

            // debug only:
            //	graphics.DrawRectangle(Project.debugPen, m_boundingRect);
            //	graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);
            //	graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);
        }
Exemple #27
0
        // for the LiveMap:isRelevant() method
        // we need to know how important/big the waypoint representation is on the map without
        // instantiating the visial object. So, we use static method here.
        public static Rectangle boundingRectEstimate(IDrawingSurface map, LabeledPoint wp)
        {
            Point pPoint;

            try
            {
                pPoint = map.toPixelLocation(wp.Location, null);
            }
            catch (Exception e)
            {
                return(Rectangle.Empty);
            }

            int w = wp.imageSizeByType(wp.LiveObjectType);
            int h = w;

            Rectangle re = new Rectangle(pPoint.X - w, pPoint.Y - h, w * 2, h * 2);

            return(re);
        }
        public GraphicsBasedDisplay(IDrawingSurface drawingSurface, Configuration config)
        {
            ValidateConfiguration(config);

            this.config         = config;
            this.drawingSurface = drawingSurface;

            BackdropColor = Color.Blue;

            for (int i = 0; i < 256; i++)
            {
                characterColors[(byte)i]  = new Tuple <Color, Color>(Color.Black, Color.Black);
                characterBrushes[(byte)i] = new Tuple <Brush, Brush>(new SolidBrush(Color.Black), new SolidBrush(Color.Black));
            }

            defaultGraphics = drawingSurface.GetGraphics();
            defaultGraphics.InterpolationMode = InterpolationMode.NearestNeighbor;
            Transform(defaultGraphics);

            drawingSurface.RequiresPaint += DrawingSurfaceOnRequiresPaint;
        }
        public override void Render(IDrawingSurface drawingSurface, ElementFrameGeometry geometry)
        {
            //Debug.WriteLine("  HorizontalLineViewAdornment.Render");

            var settings = DrawLinesBetweenMethodsSettings.Current;

            Color lineColor = Color.ConvertFrom(settings.LineColor);

            bool isAttributeOrComment = (_languageElement is Comment || _languageElement is XmlDocComment || _languageElement is AttributeSection);

            if (isAttributeOrComment || _languageElement.Range.LineCount.NumLines > 1)
            {
                // Top line
                if (settings.DrawLineAtStartOfMethod)
                {
                    Point startPoint = geometry.StartPoint
                        .MoveUp(settings.LineSpacer);
                    drawLine(drawingSurface, settings, startPoint);
                }

                // Bottom line
                if (settings.DrawLineAtEndOfMethod)
                {
                    Point startPoint = geometry.EndRect.BottomLeft
                        .MoveDown(settings.LineSpacer);
                    drawLine(drawingSurface, settings, startPoint);
                }
            }


            // TODO: DrawRectangle method only draws horizontal gradients
            //const int shadowHeight = 10;
            //const int shadowAlpha = 50;
            //var shadowRect = new Rect(startPoint, new Size(lineWidth, shadowHeight));
            //Color shadowStartColor = Color.FromArgb(shadowAlpha, lineColor);
            //Color shadowEndColor = Colors.Transparent;
            //drawingSurface.DrawRectangle(shadowStartColor, shadowEndColor, Colors.Transparent, shadowRect);

        }
Exemple #30
0
        public override void Render(IDrawingSurface drawingSurface, ElementFrameGeometry geometry)
        {
            //Debug.WriteLine("  HorizontalLineViewAdornment.Render");

            var settings = DrawLinesBetweenMethodsSettings.Current;

            Color lineColor = Color.ConvertFrom(settings.LineColor);

            bool isAttributeOrComment = (_languageElement is Comment || _languageElement is XmlDocComment || _languageElement is AttributeSection);

            if (isAttributeOrComment || _languageElement.Range.LineCount.NumLines > 1)
            {
                // Top line
                if (settings.DrawLineAtStartOfMethod)
                {
                    Point startPoint = geometry.StartPoint
                                       .MoveUp(settings.LineSpacer);
                    drawLine(drawingSurface, settings, startPoint);
                }

                // Bottom line
                if (settings.DrawLineAtEndOfMethod)
                {
                    Point startPoint = geometry.EndRect.BottomLeft
                                       .MoveDown(settings.LineSpacer);
                    drawLine(drawingSurface, settings, startPoint);
                }
            }


            // TODO: DrawRectangle method only draws horizontal gradients
            //const int shadowHeight = 10;
            //const int shadowAlpha = 50;
            //var shadowRect = new Rect(startPoint, new Size(lineWidth, shadowHeight));
            //Color shadowStartColor = Color.FromArgb(shadowAlpha, lineColor);
            //Color shadowEndColor = Colors.Transparent;
            //drawingSurface.DrawRectangle(shadowStartColor, shadowEndColor, Colors.Transparent, shadowRect);
        }
Exemple #31
0
        public override void Paint(Graphics graphics, IDrawingSurface layer, ITile iTile, int offsetX, int offsetY)
        {
            if (!m_enabled)
            {
                return;
            }

            //LibSys.StatusBar.Trace("LabeledPoint::Paint()  - " + Location + " : " + m_doName + m_labelBoundingRect);

            int x, y, w, h;

            x = m_imageBoundingRect.X + 1 + offsetX;
            y = m_imageBoundingRect.Y + 1 + offsetY;
            w = m_imageBoundingRect.Width - 2;
            h = m_imageBoundingRect.Height - 2;

            graphics.DrawEllipse(penMain, x, y, w, h);

            // debug only - show bounding rectangles:
            //graphics.DrawRectangle(Project.debugPen, m_boundingRect);			// red
            //graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);		// green
            //graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);		// yellow
        }
Exemple #32
0
        public override void PaintLabel(Graphics graphics, IDrawingSurface layer, ITile iTile, bool isPrint, int offsetX, int offsetY)
        {
            if(!m_enabled || !m_doName)
            {
                return;
            }

            //LibSys.StatusBar.Trace("Earthquake::Paint()  - " + Location + " - " + Magn + " : " + m_doName + m_labelBoundingRect);

            string label = getLabel(false);
            if(!label.Equals(Name))
            {
                Name = label;
                recalcLabelMetrics(label, graphics);
            }

            if(label != null && label.Length > 0)
            {
                int x, y, w, h;

                x = m_imageBoundingRect.X + 1 + offsetX;
                y = m_imageBoundingRect.Y + 1 + offsetY;
                w = m_imageBoundingRect.Width-2;
                h = m_imageBoundingRect.Height-2;

                int xxx = m_labelBoundingRect.X + offsetX;
                int yyy = m_labelBoundingRect.Y + offsetY + (isPrint ? 1 : 0);
                Font font = isPrint ? mm_fontPrint : mm_font;
                if(Project.earthquakeUseShadow)
                {
                    graphics.DrawString(label, font, Project.earthquakeBackgroundBrush, xxx,   yyy);
                    graphics.DrawString(label, font, Project.earthquakeBackgroundBrush, xxx+2, yyy);
                    graphics.DrawString(label, font, Project.earthquakeBackgroundBrush, xxx,   yyy-2);
                    graphics.DrawString(label, font, Project.earthquakeBackgroundBrush, xxx+2, yyy-2);
                }
                //label += (" " + m_labelPosition);
                graphics.DrawString(label, font, Project.earthquakeFontBrush, xxx+1, yyy-1);

                int xe = m_pixelLocation.X + offsetX;
                int ye = m_pixelLocation.Y + offsetY;
                int xx = xe;
                int yy = ye;
                switch(m_labelPosition)
                {
                    default:
                    case LPOS_UP_RIGHT_MIN:
                        xx += m_shift;
                        yy -= m_shift/3;
                        break;
                    case LPOS_UP_RIGHT:
                        xx += m_shift;
                        yy -= m_shift;
                        break;
                    case LPOS_UP_RIGHT_MAX:
                        xx += m_shift*2/3;
                        yy -= m_shift*3/2;
                        break;
                    case LPOS_DOWN_RIGHT:
                        xx += m_shift;
                        yy += m_shift;
                        break;
                    case LPOS_DOWN_RIGHT_MIN:
                        xx += m_shift;
                        yy += m_shift/3;
                        break;
                    case LPOS_DOWN_RIGHT_MAX:
                        xx += m_shift*2/3;
                        yy += m_shift*3/2;
                        break;
                    case LPOS_DOWN_LEFT_MIN:
                        xx -= m_labelWidth + m_shift;
                        yy += m_shift/3;
                        break;
                    case LPOS_DOWN_LEFT:
                        xx -= m_labelWidth + m_shift;
                        yy += m_shift;
                        break;
                    case LPOS_UP_LEFT_MIN:
                        xx -= m_labelWidth + m_shift;
                        yy -= m_shift/3;
                        break;
                    case LPOS_DOWN_LEFT_MAX:
                        xx -= m_labelWidth + m_shift*2/3;
                        yy += m_shift*3/2;
                        break;
                    case LPOS_UP_LEFT_MAX:
                        xx -= m_labelWidth + m_shift*2/3;
                        yy -= m_shift*3/2;
                        break;
                    case LPOS_UP_LEFT:
                        xx -= m_labelWidth + m_shift;
                        yy -= m_shift;
                        break;
                }

                //graphics.DrawString("***"+label, mm_font, Project.earthquakeFontBrush, xx, yy-m_labelHeight);
                graphics.DrawLine(Project.earthquakePen, xx+1, yy+1, xx+m_labelWidth, yy+1);

                switch(m_labelPosition)
                {
                    default:
                    case LPOS_UP_LEFT_MAX:
                    case LPOS_UP_LEFT:
                    case LPOS_UP_LEFT_MIN:
                        xx += m_labelWidth;
                        graphics.DrawLine(Project.earthquakePen, xe-1, ye-1, xx, yy+1);
                        break;
                    case LPOS_DOWN_LEFT_MIN:
                    case LPOS_DOWN_LEFT:
                    case LPOS_DOWN_LEFT_MAX:
                        xx += m_labelWidth;
                        graphics.DrawLine(Project.earthquakePen, xe-1, ye+1, xx, yy+1);
                        break;
                    case LPOS_UP_RIGHT_MIN:
                    case LPOS_UP_RIGHT:
                    case LPOS_UP_RIGHT_MAX:
                        graphics.DrawLine(Project.earthquakePen, xe+1, ye-1, xx, yy+1);
                        break;
                    case LPOS_DOWN_RIGHT_MIN:
                    case LPOS_DOWN_RIGHT:
                    case LPOS_DOWN_RIGHT_MAX:
                        graphics.DrawLine(Project.earthquakePen, xe+1, ye+1, xx, yy);
                        break;
                }
                //if(Options.earthquakeUseShadow) {
                //	g.setColor(PrjColor.palette[Options.earthquakeColorShadowIndex]);
                //	g.fillOval(xe-3, ye-3, 5, 5);
                //}

                //g.setColor(color(3));
                graphics.DrawEllipse(Project.earthquakePen, xe-1, ye-1, 3, 3);

                // debug only - show bounding rectangles:
                //graphics.DrawRectangle(Project.debugPen, m_boundingRect);			// red
                //graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);		// green
                //graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);		// yellow
                //graphics.DrawRectangle(Project.debug3Pen, intersectionSensitiveRect2());		// yellow
            }
        }
Exemple #33
0
        public override void Paint(Graphics graphics, IDrawingSurface layer, ITile iTile, int offsetX, int offsetY)
        {
            if(!m_enabled)
            {
                return;
            }

            //LibSys.StatusBar.Trace("Earthquake::Paint()  - " + Location + " - " + Magn + " : " + m_doName + m_labelBoundingRect);

            int x, y, w, h;

            x = m_imageBoundingRect.X + 1 + offsetX;
            y = m_imageBoundingRect.Y + 1 + offsetY;
            w = m_imageBoundingRect.Width-2;
            h = m_imageBoundingRect.Height-2;

            switch (Project.earthquakeStyle)
            {
                case STYLE_DOT:		// small dot
                    //g.setColor(color(3));
                    graphics.DrawEllipse(Project.earthquakePen, x, y, w, h);
                    break;
                case STYLE_TRIANGLE:
                {
                    // triangle pointing down to epicenter; the deeper the quake,
                    // the more narrow the triangle is:
                    // m_triWidth is actually half of the upper side of the triangle.
                    //g.setColor(color(3));
                    graphics.DrawLine(Project.earthquakePen, x+w/2-m_triWidth, y, x+w/2+m_triWidth, y);
                    graphics.DrawLine(Project.earthquakePen, x+w/2-m_triWidth, y, x+w/2, y+h);
                    graphics.DrawLine(Project.earthquakePen, x+w/2+m_triWidth, y, x+w/2, y+h);

                    if(h > 15 && Project.displayEqDepth && m_doName)
                    {
                        double depthMeters = Math.Max(0.0, -Location.Z);
                        Distance dist = new Distance(depthMeters);
                        string sDist = dist.ToString();
                        if(m_triWidth > 50)
                        {
                            sDist += " deep";
                        }

                        // other threads can throw "invalid argument" exception in graphics.MeasureString:
                        SizeF size = graphics.MeasureString(sDist, mm_font);
                        int depthLabelWidth = (int)(size.Width * 0.95d);
                        int depthLabelHeight = (int)(size.Height * 0.85d);
                        //if(depthLabelWidth > m_triWidth*5/6)
                        //{
                        //	depthLabelWidth = m_triWidth*5/6;
                        //}
                        int xx = x+w/2-depthLabelWidth/2;
                        int yy = y + 2; //-depthLabelHeight-2;
                        if(Project.earthquakeUseShadow)
                        {
                            //g.setColor(PrjColor.palette[Project.earthquakeColorShadowIndex]);
                            graphics.DrawString(sDist, mm_font, Project.earthquakeBackgroundBrush, xx,   yy);
                            graphics.DrawString(sDist, mm_font, Project.earthquakeBackgroundBrush, xx+2, yy);
                            graphics.DrawString(sDist, mm_font, Project.earthquakeBackgroundBrush, xx,   yy-2);
                            graphics.DrawString(sDist, mm_font, Project.earthquakeBackgroundBrush, xx+2, yy-2);
                        }
                        //g.setColor(color(3));
                        graphics.DrawString(sDist, mm_font, Project.earthquakeFontBrush, xx+1, yy-1);
                    }
                }
                    break;
                case STYLE_SQUARES:
                    // Cyan looks like a good contrast color on the map, very suitable for border around filled circles and squares.
                    // g.setColor(PrjColor.palette[PrjColor.COLOR_CYAN]);
                    //g.setColor(color(3));
                    graphics.DrawRectangle(Project.earthquakePen, x, y, w, h);
                    break;
                case STYLE_FILLSQUARES:
                    if(m_doFill)
                    {
                        graphics.FillRectangle(brushByDepth(), x, y, w, h);
                    }
                    if(w > 6)
                    {
                        //g.setColor(color(3));   // PrjColor.palette[PrjColor.COLOR_CYAN]);
                        graphics.DrawRectangle(Project.earthquakePen, x, y, w, h);
                    }
                    break;
                case STYLE_CIRCLES:
                    //g.setColor(color(3));
                    graphics.DrawEllipse(Project.earthquakePen, x, y, w, h);
                    break;
                case STYLE_FILLCIRCLES:
                    if(m_doFill)
                    {
                        graphics.FillEllipse(brushByDepth(), x, y, w, h);
                    }
                    if(w > 6)
                    {
                        //g.setColor(color(3));   // PrjColor.palette[PrjColor.COLOR_CYAN]);
                        graphics.DrawEllipse(Project.earthquakePen, x, y, w, h);
                    }
                    break;
                case STYLE_CONCENTRICCIRCLES:
                default:
                    // Oval drawn without "+1" would go beyond the bounding rectangle
                    //g.setColor(color(3));
                    graphics.DrawEllipse(Project.earthquakePen, x, y, w, h);
                    if(w > 12 && h > 12)
                    {
                        //g.setColor(color(2));
                        graphics.DrawEllipse(Project.earthquakePen, x+w/6, y+h/6, w*2/3, h*2/3);
                        if(w > 24 && h > 24)
                        {
                            //g.setColor(color(1));
                            graphics.DrawEllipse(Project.earthquakePen, x+w/3, y+h/3, w/3, h/3);
                        }
                    }
                    break;
            }
            // debug only - show bounding rectangles:
            //graphics.DrawRectangle(Project.debugPen, m_boundingRect);			// red
            //graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);		// green
            //graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);		// yellow
        }
Exemple #34
0
        // for the LiveMap:isRelevant() method
        // we need to know how big the earthquake is on the map without
        // instantiating the visial object. So, we use static method here.
        public static Rectangle boundingRectEstimate(IDrawingSurface map, Earthquake eq, double magnFactor)
        {
            Point pPoint;

            try
            {
                pPoint =	map.toPixelLocation(eq.Location, null);
            }
            catch (Exception e)
            {
                return Rectangle.Empty;
            }

            int w, h;
            int minSize = 15;
            int maxSize = 300;
            int xFactor = 2;
            int yFactor = 2;
            int yExtra = 0;

            double xMetersPerPixel = map.xMetersPerPixel();

            w = (int)(eq.Magn * magnFactor / map.xMetersPerPixel());
            if(w < minSize)	// we don't want the quake to show up too small or too big
            {
                w = minSize;
            }
            if(w > maxSize)
            {
                w = maxSize;
            }

            h = (int)(eq.Magn * magnFactor / map.yMetersPerPixel());
            if(h < minSize)
            {
                h = minSize;
            }
            if(h > maxSize)
            {
                h = maxSize;
            }

            double cameraElevationKm = map.getCameraElevation() / 1000.0d;

            switch (Project.earthquakeStyle)
            {
                default:
                case STYLE_CONCENTRICCIRCLES:	// concentric circles
                case STYLE_SQUARES:
                case STYLE_FILLSQUARES:
                case STYLE_CIRCLES:
                case STYLE_FILLCIRCLES:		// filled circles Alan Jones "Seismic Eruptions" style
                {
                    double magMin;
                    double magOff;
                    double magFact;

                    if(cameraElevationKm > 4000.0d)  // world map
                    {
                        magMin = 5.0d;
                        magOff = 4.5d;
                        magFact = 7.0d;
                    }
                    else if(cameraElevationKm > 900.0d)
                    {	 // small scale
                        magMin = 4.0d;
                        magOff = 2.5d;
                        magFact = 6.0d;
                    }
                    else if(cameraElevationKm > 370.0d)
                    {	 // medium scale
                        magMin = 2.0d;
                        magOff = 0.5d;
                        magFact = 5.0d;
                    }
                    else
                    {	 // very large scale
                        magMin = 1.0d;
                        magOff = 0.5d;
                        magFact = 4.0d;
                    }

                    if(eq.Magn <= magMin)
                    {
                        w = 3;
                        h = 3;
                    }
                    else
                    {
                        w = h = (int)((eq.Magn - magOff) * magFact);
                    }
                }
                    break;
                case STYLE_TRIANGLE:
                    // triangle pointing down to epicenter; the deeper the quake,
                    // the more narrow the triangle is:
                    h = (int)(((double)h) * (1.0d + cameraElevationKm / 10000.0d));	// make them more visible on small scale maps:
                    w = eq.calcTriWidth(h) * 2;	// triWidth is actually half of the upper side of the triangle.
                    if(w < 50 && Project.displayEqDepth)
                    {
                        w = 50;
                    }
                    yFactor = 1;
                    xFactor = 1;
                    yExtra = 3;			// 3 pixels for the epicenter oval
                    break;
                case STYLE_DOT:			// dot
                    w = 3;
                    h = 3;
                    break;
            }

            Rectangle re = new Rectangle(pPoint.X-(w*xFactor/2), pPoint.Y-h, w*xFactor, h*yFactor + yExtra);

            return re;
        }
Exemple #35
0
 public abstract void Paint(Graphics graphics, IDrawingSurface tileSet, ITile iTile, int offsetX, int offsetY);
Exemple #36
0
 public virtual void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager tile)
 {
 }
Exemple #37
0
        // for the LiveMap:isRelevant() method
        // we need to know how important/big the waypoint representation is on the map without
        // instantiating the visial object. So, we use static method here.
        public static Rectangle boundingRectEstimate(IDrawingSurface map, LabeledPoint wp)
        {
            Point pPoint;

            try
            {
                pPoint = map.toPixelLocation(wp.Location, null);
            }
            catch (Exception e)
            {
                return Rectangle.Empty;
            }

            int w = wp.imageSizeByType(wp.LiveObjectType);
            int h = w;

            Rectangle re = new Rectangle(pPoint.X-w, pPoint.Y-h, w*2, h*2);

            return re;
        }
Exemple #38
0
 public override void Paint(Graphics graphics, IDrawingSurface layer, ITile iTile)
 {
     Paint(graphics, layer, iTile, 0, 0);
 }
Exemple #39
0
        public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(tileSet, iTile, olm);

            m_enabled = true;

            placeLabel(5, m_fontSize, false);	// may turn m_doName to false

            boundingRect();		// make sure we have current values there

            //LibSys.StatusBar.Trace("Vehicle:PutOnMap():  veh - " + Location + m_pixelLocation + " - " + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
        }
Exemple #40
0
 public void OnDeactivate(IDrawingSurface drawingService)
 {
     this.drawingSurface = null;
 }
 public void OnActivate(IDrawingSurface drawingService)
 {
     drawingService.GetControl().Cursor = Cursors.Arrow;
     this.drawingSurface = drawingService;
     this.dragHelper = null;
 }
 public void OnDeactivate(IDrawingSurface drawingService)
 {
 }
Exemple #43
0
 public abstract void PaintLabel(Graphics graphics, IDrawingSurface tileSet, ITile iTile, bool isPrint, int offsetX, int offsetY);
Exemple #44
0
 public override void PaintLabel(Graphics graphics, IDrawingSurface layer, ITile iTile, bool isPrint)
 {
     PaintLabel(graphics, layer, iTile, isPrint, 0, 0);
 }
Exemple #45
0
 public virtual void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager tile)
 {
 }
Exemple #46
0
        public override void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(layer, iTile, olm);

            //m_doName = true;
            m_enabled = true;

            Name = getLabel(true);

            m_fontSize = fontSizeByType(LiveObjectType);

            placeLabel(0, m_fontSize, false);	// may turn m_doName to false

            boundingRect();		// make sure we have current values there

            //LibSys.StatusBar.Trace("LabeledPoint:PutOnMap():  " + Location + m_pixelLocation + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
        }
Exemple #47
0
 public override void AdjustPlacement(IDrawingSurface map, ITile iTile, IObjectsLayoutManager olm)
 {
     //LibSys.StatusBar.Trace("LabeledPoint:AdjustPlacement():   - " + Location + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
     if(m_intersections > 0)
     {
         //LibSys.StatusBar.Trace("LabeledPoint:AdjustPlacement():   - " + Location + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
         placeLabel(0, m_fontSize, true);	// may turn m_doName to false
         boundingRect();		// make sure we have current values there
         //LibSys.StatusBar.Trace("                int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
     }
 }
Exemple #48
0
        public virtual void PutOnMap(IDrawingSurface map, ITile iTile, IObjectsLayoutManager iOlm)
        {
            m_map = map;
            m_itile = iTile;
            m_olm = iOlm;	// can be null

            m_pixelLocation = map.toPixelLocation(m_location, iTile);
        }
Exemple #49
0
        public override void Paint(Graphics graphics, IDrawingSurface layer, ITile iTile, int offsetX, int offsetY)
        {
            if(!m_enabled)
            {
                return;
            }

            //LibSys.StatusBar.Trace("LabeledPoint::Paint()  - " + Location + " : " + m_doName + m_labelBoundingRect);

            int x, y, w, h;

            x = m_imageBoundingRect.X + 1 + offsetX;
            y = m_imageBoundingRect.Y + 1 + offsetY;
            w = m_imageBoundingRect.Width-2;
            h = m_imageBoundingRect.Height-2;

            graphics.DrawEllipse(penMain, x, y, w, h);

            // debug only - show bounding rectangles:
            //graphics.DrawRectangle(Project.debugPen, m_boundingRect);			// red
            //graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);		// green
            //graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);		// yellow
        }
 public void OnDeactivate(IDrawingSurface drawingService)
 {
     this.drawingSurface = null;
     this.dragHelper = null;
     this.inZoom = false;
 }
Exemple #51
0
        public override void PaintLabel(Graphics graphics, IDrawingSurface layer, ITile iTile, bool isPrint, int offsetX, int offsetY)
        {
            if(!m_enabled || !m_doName)
            {
                return;
            }

            //LibSys.StatusBar.Trace("LabeledPoint::PaintLabel()  - " + Location + " : " + m_doName + m_labelBoundingRect);

            string label = getLabel(false);
            if(!label.Equals(Name))
            {
                Name = label;
                recalcLabelMetrics(label, graphics);
            }

            if(label != null && label.Length > 0)
            {
                int x, y, w, h;

                x = m_imageBoundingRect.X + 1 + offsetX;
                y = m_imageBoundingRect.Y + 1 + offsetY;
                w = m_imageBoundingRect.Width-2;
                h = m_imageBoundingRect.Height-2;

                int xxx = m_labelBoundingRect.X + offsetX;
                int yyy = m_labelBoundingRect.Y + offsetY + (isPrint ? 2 : 0);
                Font font = isPrint ? m_fontPrint : m_font;
                if(Project.waypointUseShadow)
                {
                    graphics.DrawString(label, font, brushBackground, xxx,   yyy);
                    graphics.DrawString(label, font, brushBackground, xxx+2, yyy);
                    graphics.DrawString(label, font, brushBackground, xxx,   yyy-2);
                    graphics.DrawString(label, font, brushBackground, xxx+2, yyy-2);

                    graphics.DrawString(label, font, brushBackground, xxx+2, yyy-1);
                    graphics.DrawString(label, font, brushBackground, xxx+1, yyy);
                    graphics.DrawString(label, font, brushBackground, xxx,   yyy-1);
                    graphics.DrawString(label, font, brushBackground, xxx+1, yyy-2);
                }
                //label += (" " + m_labelPosition);

                graphics.DrawString(label, font, brushFont, xxx+1, yyy-1);

                // white lines on topo maps are invisible, use Black pen instead:
                Pen pen = "topo".Equals(Project.drawTerraserverMode) || (!Project.drawTerraserver && !Project.drawRelief) ? Project.blackPen : penUnderline;

                int xe = m_pixelLocation.X + offsetX;
                int ye = m_pixelLocation.Y + offsetY;
                int xx = xe;
                int yy = ye;
                switch(m_labelPosition)
                {
                    default:
                    case LPOS_UP_RIGHT_MIN:
                        xx += m_shift;
                        yy -= m_shift/3;
                        break;
                    case LPOS_UP_RIGHT:
                        xx += m_shift;
                        yy -= m_shift;
                        break;
                    case LPOS_UP_RIGHT_MAX:
                        xx += m_shift*2/3;
                        yy -= m_shift*3/2;
                        break;
                    case LPOS_DOWN_RIGHT:
                        xx += m_shift;
                        yy += m_shift;
                        break;
                    case LPOS_DOWN_RIGHT_MIN:
                        xx += m_shift;
                        yy += m_shift/3;
                        break;
                    case LPOS_DOWN_RIGHT_MAX:
                        xx += m_shift*2/3;
                        yy += m_shift*3/2;
                        break;
                    case LPOS_DOWN_LEFT_MIN:
                        xx -= m_labelWidth + m_shift;
                        yy += m_shift/3;
                        break;
                    case LPOS_DOWN_LEFT:
                        xx -= m_labelWidth + m_shift;
                        yy += m_shift;
                        break;
                    case LPOS_UP_LEFT_MIN:
                        xx -= m_labelWidth + m_shift;
                        yy -= m_shift/3;
                        break;
                    case LPOS_DOWN_LEFT_MAX:
                        xx -= m_labelWidth + m_shift*2/3;
                        yy += m_shift*3/2;
                        break;
                    case LPOS_UP_LEFT_MAX:
                        xx -= m_labelWidth + m_shift*2/3;
                        yy -= m_shift*3/2;
                        break;
                    case LPOS_UP_LEFT:
                        xx -= m_labelWidth + m_shift;
                        yy -= m_shift;
                        break;
                }

                graphics.DrawLine(pen, xx+1, yy+1, xx+m_labelWidth, yy+1);

                switch(m_labelPosition)
                {
                    default:
                    case LPOS_UP_LEFT_MAX:
                    case LPOS_UP_LEFT:
                    case LPOS_UP_LEFT_MIN:
                        xx += m_labelWidth;
                        graphics.DrawLine(pen, xe-1, ye-1, xx, yy+1);
                        break;
                    case LPOS_DOWN_LEFT_MIN:
                    case LPOS_DOWN_LEFT:
                    case LPOS_DOWN_LEFT_MAX:
                        xx += m_labelWidth;
                        graphics.DrawLine(pen, xe-1, ye+1, xx, yy+1);
                        break;
                    case LPOS_UP_RIGHT_MIN:
                    case LPOS_UP_RIGHT:
                    case LPOS_UP_RIGHT_MAX:
                        graphics.DrawLine(pen, xe+1, ye-1, xx, yy+1);
                        break;
                    case LPOS_DOWN_RIGHT_MIN:
                    case LPOS_DOWN_RIGHT:
                    case LPOS_DOWN_RIGHT_MAX:
                        graphics.DrawLine(pen, xe+1, ye+1, xx, yy);
                        break;
                }

                graphics.DrawEllipse(pen, xe-1, ye-1, 3, 3);

                // debug only - show bounding rectangles:
                //graphics.DrawRectangle(Project.debugPen, m_boundingRect);					// red
                //graphics.DrawRectangle(Project.debug2Pen, m_imageBoundingRect);			// green
                //graphics.DrawRectangle(Project.debug3Pen, m_labelBoundingRect);			// yellow
                //graphics.DrawRectangle(Project.debug3Pen, intersectionSensitiveRect2());	// yellow
            }
        }
Exemple #52
0
        public override void PutOnMap(IDrawingSurface layer, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(layer, iTile, olm);

            m_elevKm = layer.getCameraElevation() / 1000.0d;
            m_doFill = m_magn > 1.0d
                && (!Project.earthquakeStyleFillRecent
                        || Project.localToZulu(DateTime.Now).AddMinutes(-recentTimes[Project.earthquakeStyleFillHowRecentIndex]) < this.DateTime);
            if(m_elevKm > 5000.0d)
            {
                m_doName = m_magn > 5.0d;
            }
            else if(m_elevKm > 2000.0d)
            {
                m_doName = m_magn > 4.0d;
            }
            else if(m_elevKm > 900.0d)
            {
                m_doName = m_magn > 3.0d;
            }
            else if(m_elevKm > 370.0d)
            {
                m_doName = m_magn > 1.0d;
            }
            else if(m_elevKm > 100.0d)
            {
                m_doName = m_magn > 0.0d;
            }
            else
            {
                m_doName = true;
            }

            m_enabled = true;

            Name = getLabel(true);

            placeLabel(0, m_fontSize, false);	// may turn m_doName to false

            boundingRect();		// make sure we have current values there

            //LibSys.StatusBar.Trace("Earthquake:PutOnMap():  eq - " + Location + m_pixelLocation + " - " + Magn + " BR=" + m_boundingRect + " LBR=" + m_labelBoundingRect + " int=" + m_intersections + " pos=" + m_labelPosition + " doName=" + m_doName);
        }
Exemple #53
0
 public void OnActivate(IDrawingSurface drawingService)
 {
     this.drawingSurface = drawingService;
 }
Exemple #54
0
 public abstract void Paint(Graphics graphics, IDrawingSurface tileSet, ITile iTile);
Exemple #55
0
 private IExternallyControlledV9938 CreateVdp(IDrawingSurface drawingSurface)
 {
     return(new V9938(new DisplayRenderer(new GraphicsBasedDisplay(drawingSurface, globalConfig), globalConfig), globalConfig, globalConfig.VramSizeInKb));
 }
        public override void Paint(Graphics graphics, IDrawingSurface tileSet, ITile iTile, int offsetX, int offsetY)
        {
            if(!m_enabled)
            {
                return;
            }

            Rectangle r = m_imageBoundingRect;

            if(m_image == null)
            {
                Font font = Project.getLabelFont(m_fontSize);

                int xx = m_labelBoundingRect.X - 3;
                int yy = m_labelBoundingRect.Y - 1;
                string label = MapName + " - missing Tiff file or GeoTiff information";
                graphics.DrawString(label, font, Project.customMapFontBrush, xx+1, yy-1);

                graphics.DrawEllipse(Project.customMapPen, r.X+2, r.Y+2, r.Width-4, r.Height-4);
            }
            else
            {
                double angle = Math.Atan(((double)(m_pixelLocationTopRight.Y - m_pixelLocation.Y)) / ((double)(m_pixelLocationTopRight.X - m_pixelLocation.X)));
                float scaleX = ((float)(m_pixelLocationTopRight.X - m_pixelLocation.X)) / ((float)(m_pixelLocationBottomRight.X - m_pixelLocation.X));
                float scaleY = ((float)(m_pixelLocationBottomLeft.Y - m_pixelLocation.Y)) / ((float)(m_pixelLocationBottomRight.Y - m_pixelLocation.Y));
                Matrix X = new Matrix();
                X.Translate(m_pixelLocation.X, m_pixelLocation.Y);
                X.Scale(scaleX, scaleY);
                X.Rotate((float)(angle * 180.0d / Math.PI));
                //X.Shear(-0.01f, -0.01f);
                X.Translate(-m_pixelLocation.X, -m_pixelLocation.Y);
                graphics.Transform = X;

                ImageAttributes imageAttr = new ImageAttributes();

                ColorMatrix cm = new ColorMatrix();

                cm.Matrix00 = 1.0f;
                cm.Matrix11 = 1.0f;
                cm.Matrix22 = 1.0f;
                float opacity = (float)(Project.terraLayerOpacity3);
                cm.Matrix33 = opacity;

                imageAttr.SetColorMatrix(cm);

                int www = m_image.Width;
                int hhh = m_image.Height;
                graphics.DrawImage(m_image, r, 0, 0, www, hhh, System.Drawing.GraphicsUnit.Pixel, imageAttr);
                //graphics.DrawImage(m_image, r);

                graphics.Transform = new Matrix();

                // add confidence to allow double-check positioning - draw corner points:

                Project.drawCross(graphics, Project.redPen, m_pixelLocation, 20);
                Project.drawCross(graphics, Project.redPen, m_pixelLocationBottomLeft, 20);
                Project.drawCross(graphics, Project.redPen, m_pixelLocationTopRight, 20);
                Project.drawCross(graphics, Project.redPen, m_pixelLocationBottomRight, 20);
            }
        }
 public void OnActivate(IDrawingSurface drawingService)
 {
     this.drawingSurface = drawingService;
 }
        public override void PutOnMap(IDrawingSurface tileSet, ITile iTile, IObjectsLayoutManager olm)
        {
            base.PutOnMap(tileSet, iTile, olm);

            m_pixelLocationBottomLeft = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.BottomLeftLng, m_geoTiff.BottomLeftLat), iTile);
            m_pixelLocationTopRight = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.TopRightLng, m_geoTiff.TopRightLat), iTile);
            m_pixelLocationBottomRight = tileSet.toPixelLocation(new GeoCoord(m_geoTiff.BottomRightLng, m_geoTiff.BottomRightLat), iTile);

            boundingRect();		// make sure we have current values there
        }
 public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
 {
     context.DrawRectangle(shade, shade, geometry.Bounds);
 }
 public void OnDeactivate(IDrawingSurface drawingService)
 {
     this.drawingSurface = null;
 }