예제 #1
0
        public LegendItem ToLegendItem()
        {
            this.coreItem.TextStyle.Font = NotifiedGeoFont.ToGeoFont();

            LegendItem newLegendItem = new LegendItem((int)Width, (int)Height, ImageWidth, ImageHeight, ImageStyle,
                                                      new TextStyle(Text, NotifiedGeoFont.ToGeoFont(), TextSolidBrush));

            newLegendItem.BackgroundMask         = BackgroundMask;
            newLegendItem.BottomPadding          = BottomPadding;
            newLegendItem.ImageBottomPadding     = ImageBottomPadding;
            newLegendItem.ImageJustificationMode = ImageJustificationMode;
            newLegendItem.ImageLeftPadding       = ImageLeftPadding;
            newLegendItem.ImageStyle             = ImageStyle;
            newLegendItem.ImageMask         = ImageMask;
            newLegendItem.ImageRightPadding = ImageRightPadding;
            newLegendItem.ImageTopPadding   = ImageTopPadding;
            newLegendItem.LeftPadding       = LeftPadding;
            newLegendItem.RightPadding      = RightPadding;
            newLegendItem.TextBottomPadding = TextBottomPadding;
            newLegendItem.TextLeftPadding   = TextLeftPadding;
            newLegendItem.TextMask          = TextMask;
            newLegendItem.TextRightPadding  = TextRightPadding;
            newLegendItem.TextTopPadding    = TextTopPadding;
            newLegendItem.TopPadding        = TopPadding;

            if (this.ImageStyle == null)
            {
                newLegendItem.ImageStyle = new PointStyle();
            }

            return(newLegendItem);
        }
예제 #2
0
        public SizeF Measure(GeoCanvas geoCanvas)
        {
            DrawingRectangleF rect;

            try
            {
                rect = geoCanvas.MeasureText(Text, NotifiedGeoFont.ToGeoFont());
            }
            catch (Exception ex)
            {
                GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex));
                if (string.IsNullOrEmpty(Text.Trim()))
                {
                    rect = geoCanvas.MeasureText("a", new GeoFont("ARIAL", 10, NotifiedGeoFont.FontStyles));
                }
                else
                {
                    rect = geoCanvas.MeasureText(Text, new GeoFont("ARIAL", NotifiedGeoFont.FontSize, NotifiedGeoFont.FontStyles));
                }
            }

            float width = rect.Width;

            width += ImageLeftPadding;
            width += ImageWidth;
            width += ImageRightPadding;
            width += TextLeftPadding;
            width += TextRightPadding;

            float imageHeight = ImageTopPadding + ImageHeight + ImageBottomPadding;
            float textHeight  = TextTopPadding + rect.Height + TextBottomPadding;
            float height      = imageHeight > textHeight ? imageHeight : textHeight;

            return(new SizeF(width, height));
        }
예제 #3
0
        public LegendItemViewModel Clone()
        {
            LegendItemViewModel newItem = new LegendItemViewModel
            {
                NotifiedGeoFont        = NotifiedGeoFont.Clone(),
                BackgroundMask         = BackgroundMask == null ? null : (AreaStyle)BackgroundMask.CloneDeep(),
                BottomPadding          = BottomPadding,
                Height                 = Height,
                ImageBottomPadding     = ImageBottomPadding,
                ImageHeight            = ImageHeight,
                ImageJustificationMode = ImageJustificationMode,
                ImageLeftPadding       = ImageLeftPadding,
                ImageMask              = ImageMask == null ? null : (AreaStyle)ImageMask.CloneDeep(),
                ImageRightPadding      = ImageRightPadding,
                //ImageStyle = ImageStyle.CloneDeep(),
                ImageTopPadding   = ImageTopPadding,
                ImageWidth        = ImageWidth,
                LeftPadding       = LeftPadding,
                LegendItemType    = LegendItemType,
                TextBottomPadding = TextBottomPadding,
                TextLeftPadding   = TextLeftPadding,
                TextMask          = TextMask == null ? null : (AreaStyle)TextMask.CloneDeep(),
                TextRightPadding  = TextRightPadding,
                TextSolidBrush    = TextSolidBrush,
                TextTopPadding    = TextTopPadding,
                Text       = this.Text,
                TopPadding = TopPadding,
                Width      = Width,
                Parent     = Parent
            };

            if (ImageStyle != null)
            {
                newItem.ImageStyle = ImageStyle.CloneDeep();
            }

            return(newItem);
        }