예제 #1
0
        internal GraphicPolygon(IPolygon polygon)
            : this()
        {
            Symbol = _symbol.Clone() as ISymbol;
            if (polygon == null)
            {
                return;
            }

            Template = polygon;

            IEnvelope env = polygon.Envelope;
            Scale(env.Width, env.Height);
            Translation(env.minx, env.miny);
        }
예제 #2
0
        public object Clone(IDisplay display)
        {
            QuantityRenderer renderer = new QuantityRenderer();

            renderer._valueField = _valueField;
            if (_defaultSymbol != null)
            {
                renderer._defaultSymbol = (ISymbol)_defaultSymbol.Clone(_useRefscale ? display : null);
            }

            foreach (QuantityClass qClass in _quantityClasses)
            {
                if (qClass == null)
                {
                    continue;
                }
                if (qClass.Symbol == null)
                {
                    renderer._quantityClasses.Add(new QuantityClass(qClass.Min, qClass.Max, null));
                }
                else
                {
                    renderer._quantityClasses.Add(new QuantityClass(qClass.Min, qClass.Max,
                                                                    (ISymbol)qClass.Symbol.Clone(_useRefscale ? display : null)));
                }
            }
            renderer._geometryType   = _geometryType;
            renderer._symbolRotation = (SymbolRotation)_symbolRotation.Clone();
            return(renderer);
        }
예제 #3
0
        public void ConstructMouseUp(IMapDocument doc, System.Windows.Forms.MouseEventArgs e)
        {
            _mousePressed = false;

            if (ActiveDisplay(doc) == null || _addContainer == null || _addContainer.Elements.Count == 0)
            {
                return;
            }

            Freehand element = _addContainer.Elements[0] as Freehand;
            if (element == null)
            {
                return;
            }

            element.Symbol = _symbol.Clone() as ISymbol;
            element.Template = element._pLine;

            IEnvelope env = element._pLine.Envelope;
            element.Scale(env.Width, env.Height);
            element.Translation(env.minx, env.miny);
            element._pLine = null;

            GraphicShape.AddElementToContainer(doc, element);

            _addContainer = null;
        }
예제 #4
0
        public object Clone(CloneOptions options)
        {
            var display = options?.Display;

            if (display == null)
            {
                return(Clone());
            }

            float fac = 1;

            if (options.ApplyRefScale)
            {
                fac = (float)(display.refScale / display.mapScale);
                fac = options.RefScaleFactor(fac);
            }

            if (display.dpi != 96.0)
            {
                fac *= (float)(display.dpi / 96.0);
            }

            GradientFillSymbol fSym = new GradientFillSymbol(_gradient);

            if (_outlineSymbol != null)
            {
                fSym._outlineSymbol = (ISymbol)_outlineSymbol.Clone(options);
            }

            fSym._rectType   = _rectType;
            fSym.LegendLabel = _legendLabel;
            return(fSym);
        }
예제 #5
0
        public void ConstructMouseDoubleClick(IMapDocument doc, System.Windows.Forms.MouseEventArgs e)
        {
            if (ActiveDisplay(doc) == null || _addContainer == null || _addContainer.Elements.Count == 0)
            {
                return;
            }

            GraphicPolyline element = _addContainer.Elements[0] as GraphicPolyline;
            if (element == null)
            {
                return;
            }

            // Remove the last 1 Points...
            element._pLine[0].RemovePoint(element._pLine[0].PointCount - 1);
            //element._pLine[0].ReomvePoint(element._pLine[0].PointCount - 1);

            element.Symbol = _symbol.Clone() as ISymbol;
            element.Template = element._pLine;

            IEnvelope env = element._pLine.Envelope;
            element.Scale(env.Width, env.Height);
            element.Translation(env.minx, env.miny);
            element._pLine = null;

            GraphicShape.AddElementToContainer(doc, element);

            _addContainer = null;
            _moveable = null;
        }
예제 #6
0
        public object Clone(CloneOptions options)
        {
            var display = options?.Display;

            if (display == null)
            {
                return(Clone());
            }

            float fac = 1;

            if (options.ApplyRefScale)
            {
                fac = (float)(display.refScale / display.mapScale);
                fac = options.RefScaleFactor(fac);
            }
            fac *= options.DpiFactor;

            HatchSymbol hSym = new HatchSymbol(_forecolor, _backcolor, _hatchStyle);

            if (_outlineSymbol != null)
            {
                hSym._outlineSymbol = (ISymbol)_outlineSymbol.Clone(options);
            }

            hSym.LegendLabel = _legendLabel;

            return(hSym);
        }
예제 #7
0
        public object Clone(IDisplay display)
        {
            ChartLabelRenderer clone = new ChartLabelRenderer();

            foreach (string key in _symbolTable.Keys)
            {
                ISymbol symbol = (ISymbol)_symbolTable[key];
                if (symbol != null)
                {
                    symbol = (ISymbol)symbol.Clone(display);
                }
                clone._symbolTable.Add(key, symbol);
            }
            clone._labelPriority = _labelPriority;
            clone._type          = _type;
            clone._outlineSymbol = (_outlineSymbol != null) ? (ILineSymbol)_outlineSymbol.Clone(display) : null;

            double fac = 1.0;

            if (display != null && display.refScale > 1)
            {
                fac = display.refScale / Math.Max(display.mapScale, 1D);
            }

            clone._size = Math.Max(_size * fac, 1D);
            clone._valueEquatesToSize = _valueEquatesToSize;
            clone._sizeType           = _sizeType;
            clone._clipEnvelope       = new Envelope(_clipEnvelope);
            return(clone);
        }
예제 #8
0
        virtual public void Draw(IDisplay display)
        {
            if (_template == null || _symbol == null || display == null)
            {
                return;
            }

            IGeometry geometry = TransformGeometry();

            if (geometry == null)
            {
                return;
            }

            if (display.refScale > 1 && !(this is Ghost))
            {
                ISymbol sym = _symbol.Clone(display) as ISymbol;
                if (sym != null)
                {
                    display.Draw(sym, geometry);
                    sym.Release();
                }
            }
            else
            {
                display.Draw(_symbol, geometry);
            }
        }
예제 #9
0
        public void Draw(GraphicsEngine.Abstraction.ICanvas canvas, GraphicsEngine.CanvasRectangle rectangle, ISymbol symbol, bool cls)
        {
            if (symbol == null || canvas == null)
            {
                return;
            }

            Display display = new gView.Framework.Carto.Display(_map);

            display.dpi = GraphicsEngine.Current.Engine.ScreenDpi; //96f; // canvas.DpiX;

            IEnvelope env = display.Limit = new Envelope(0, rectangle.Top + rectangle.Height, rectangle.Left + rectangle.Width, 0);

            display.iWidth  = (int)env.maxx;
            display.iHeight = (int)env.maxy;
            display.ZoomTo(env.minx, env.miny, env.maxx, env.maxy);

            IGeometry geometry = GeometryFromSymbol(symbol, new Envelope(rectangle.Left,
                                                                         rectangle.Height + rectangle.Top,
                                                                         rectangle.Width + rectangle.Left,
                                                                         rectangle.Top));

            if (geometry == null)
            {
                return;
            }

            if (PlugInManager.PlugInID(symbol).Equals(KnownObjects.Symbology_PolygonMask))
            {
                return;
            }

            display.Canvas = canvas;

            if (cls)
            {
                using (var brush = GraphicsEngine.Current.Engine.CreateSolidBrush(GraphicsEngine.ArgbColor.White))
                {
                    canvas.FillRectangle(brush, rectangle);
                }
            }

            ISymbol sym = symbol.Clone(new CloneOptions(display, false)) as ISymbol;

            if (sym != null)
            {
                if (sym is ITextSymbol)
                {
                    ((ITextSymbol)sym).Text = "Text";
                }

                sym.Draw(display, geometry);
                sym.Release();
            }
            else
            {
                symbol.Draw(display, geometry);
            }
        }
        internal ISymbol AlternateSymbol(ISymbol from, ISymbol to, double fac)
        {
            if (fac >= 1.0)
            {
                return(to.Clone() as ISymbol);
            }


            ISymbol symbol = from.Clone() as ISymbol;

            if (symbol == null)
            {
                return(null);
            }

            if (fac == 0.0)
            {
                return(symbol);
            }

            if (symbol is IPenColor &&
                from is IPenColor && to is IPenColor)
            {
                ((IPenColor)symbol).PenColor = Helper.AlterColor(
                    ((IPenColor)from).PenColor, ((IPenColor)to).PenColor, fac);
            }
            if (symbol is IBrushColor &&
                from is IBrushColor && to is IBrushColor)
            {
                ((IBrushColor)symbol).FillColor = Helper.AlterColor(
                    ((IBrushColor)from).FillColor, ((IBrushColor)to).FillColor, fac);
            }
            if (symbol is IFontColor &&
                from is IFontColor && to is IFontColor)
            {
                ((IFontColor)symbol).FontColor = Helper.AlterColor(
                    ((IFontColor)from).FontColor, ((IFontColor)to).FontColor, fac);
            }
            if (symbol is IPenWidth &&
                from is IPenWidth && to is IPenWidth)
            {
                ((IPenWidth)symbol).PenWidth =
                    (float)((double)((IPenWidth)from).PenWidth + (((IPenWidth)to).PenWidth - ((IPenWidth)from).PenWidth) * fac);
            }
            if (symbol is ISymbolSize &&
                from is ISymbolSize && to is ISymbolSize)
            {
                ((ISymbolSize)symbol).SymbolSize =
                    (float)((double)((ISymbolSize)from).SymbolSize + (((ISymbolSize)to).SymbolSize - ((ISymbolSize)from).SymbolSize) * fac);
            }
            if (symbol is ISymbolWidth &&
                from is ISymbolWidth && to is ISymbolWidth)
            {
                ((ISymbolWidth)symbol).SymbolWidth =
                    (float)((double)((ISymbolWidth)from).SymbolWidth + (((ISymbolWidth)to).SymbolWidth - ((ISymbolWidth)from).SymbolWidth) * fac);
            }
            return(symbol);
        }
예제 #11
0
        public object Clone(CloneOptions options)
        {
            UniversalGeometrySymbol symbol = new UniversalGeometrySymbol();

            symbol._pointSymbol   = (ISymbol)_pointSymbol.Clone(options);
            symbol._lineSymbol    = (ISymbol)_lineSymbol.Clone(options);
            symbol._polygonSymbol = (ISymbol)_polygonSymbol.Clone(options);

            return(symbol);
        }
        public object Clone(IDisplay display)
        {
            UniversalGeometrySymbol symbol = new UniversalGeometrySymbol();

            symbol._pointSymbol   = (ISymbol)_pointSymbol.Clone(display);
            symbol._lineSymbol    = (ISymbol)_lineSymbol.Clone(display);
            symbol._polygonSymbol = (ISymbol)_polygonSymbol.Clone(display);

            return(symbol);
        }
예제 #13
0
        public static void Draw(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, ISymbol symbol, bool cls)
        {
            if (symbol == null)
            {
                return;
            }

            Display display = new gView.Framework.Carto.Display();

            display.dpi = graphics.DpiX;

            IEnvelope env = display.Limit = new Envelope(0, rectangle.Top + rectangle.Height, rectangle.Left + rectangle.Width, 0);

            display.iWidth  = (int)env.maxx;
            display.iHeight = (int)env.maxy;
            display.ZoomTo(env.minx, env.miny, env.maxx, env.maxy);

            IGeometry geometry = GeometryFromSymbol(symbol, new Envelope(rectangle.Left, rectangle.Bottom, rectangle.Right, rectangle.Top));

            if (geometry == null)
            {
                return;
            }

            if (PlugInManager.PlugInID(symbol).Equals(KnownObjects.Symbology_PolygonMask))
            {
                return;
            }

            display.GraphicsContext = graphics;

            if (cls)
            {
                using (System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.White))
                {
                    graphics.FillRectangle(brush, rectangle);
                }
            }

            ISymbol sym = symbol.Clone(display) as ISymbol;

            if (sym != null)
            {
                if (sym is ITextSymbol)
                {
                    ((ITextSymbol)sym).Text = "Text";
                }
                sym.Draw(display, geometry);
                sym.Release();
            }
            else
            {
                symbol.Draw(display, geometry);
            }
        }
예제 #14
0
        public object Clone(CloneOptions options)
        {
            SimpleAggregateRenderer renderer = new SimpleAggregateRenderer();

            if (_symbol != null)
            {
                renderer._symbol = (ISymbol)_symbol.Clone(_useRefScale ? options : null);
            }

            return(renderer);
        }
예제 #15
0
        public SymbolControl(ISymbol symbol)
        {
            if (symbol != null)
            {
                _symbol = (ISymbol)symbol.Clone();
                if (_symbol is ILabel)
                {
                    _txtSymbolAlignment = ((ILabel)_symbol).TextSymbolAlignment;
                    ((ILabel)_symbol).TextSymbolAlignment = TextSymbolAlignment.Center;
                }
            }

            InitializeComponent();
        }
예제 #16
0
        public SymbolControl(ISymbol symbol)
            : this()
        {
            if (symbol != null)
            {
                _symbol = (ISymbol)symbol.Clone();
                if (_symbol is ILabel)
                {
                    _txtSymbolAlignment = ((ILabel)_symbol).TextSymbolAlignment;
                    ((ILabel)_symbol).TextSymbolAlignment = TextSymbolAlignment.Center;
                }

                symbolSelectorControl1.SymbolProtoType = _symbol;
            }
        }
예제 #17
0
            public object Clone(CloneOptions options)
            {
                Rule clone = new Rule();

                if (_symbol != null)
                {
                    clone.Symbol = _symbol.Clone(options) as ISymbol;
                }
                clone.Filter     = _filter;
                clone.filterType = _filterType;
                clone.MinScale   = _minScale;
                clone.MaxScale   = _maxScale;

                return(clone);
            }
예제 #18
0
            public object Clone(IDisplay display)
            {
                Rule clone = new Rule();

                if (_symbol != null)
                {
                    clone.Symbol = _symbol.Clone(display) as ISymbol;
                }
                clone.Filter     = _filter;
                clone.filterType = _filterType;
                clone.MinScale   = _minScale;
                clone.MaxScale   = _maxScale;

                return(clone);
            }
예제 #19
0
        public object Clone(CloneOptions options)
        {
            SimpleRenderer renderer = new SimpleRenderer();

            if (_symbol != null)
            {
                renderer._symbol = (ISymbol)_symbol.Clone(_useRefScale ? options : null);
            }

            renderer._symbolRotation    = (SymbolRotation)_symbolRotation.Clone();
            renderer._rotate            = _rotate;
            renderer._cartoMethod       = _cartoMethod;
            renderer._actualCartoMethod = _actualCartoMethod;

            return(renderer);
        }
예제 #20
0
        public object Clone(CloneOptions options)
        {
            var display = options?.Display;

            if (display == null)
            {
                return(Clone());
            }

            SimpleFillSymbol fSym = new SimpleFillSymbol(_brush.Color);

            if (_outlineSymbol != null)
            {
                fSym._outlineSymbol = (ISymbol)_outlineSymbol.Clone(options);
            }

            fSym.LegendLabel = _legendLabel;
            //fSym.Smoothingmode = this.Smoothingmode;
            return(fSym);
        }
예제 #21
0
        public object Clone(IDisplay display)
        {
            ValueMapRenderer renderer = new ValueMapRenderer();

            renderer._valueField = _valueField;
            //if (_defaultSymbol != null)
            //    renderer._defaultSymbol = (ISymbol)_defaultSymbol.Clone(_useRefscale ? display : null);
            foreach (string key in _symbolTable.Keys)
            {
                ISymbol symbol = (ISymbol)_symbolTable[key];
                if (symbol != null)
                {
                    symbol = (ISymbol)symbol.Clone(_useRefscale ? display : null);
                }
                renderer._symbolTable.Add(key, symbol);
            }
            renderer._geometryType   = _geometryType;
            renderer._symbolRotation = (SymbolRotation)_symbolRotation.Clone();
            renderer._cartoMethod    = _cartoMethod;
            return(renderer);
        }
예제 #22
0
        private void list_MouseDown(object sender, MouseEventArgs e)
        {
            ListViewItem item = list.GetItemAt(4, e.Y);

            if (!(item is SymbolListViewItem))
            {
                return;
            }

            if (e.X < imageList1.ImageSize.Width)
            {
                ISymbol symbol = ((SymbolListViewItem)item).Symbol;
                if (OnSymbolClicked != null)
                {
                    OnSymbolClicked(symbol);

                    Image image = imageList1.Images[item.ImageIndex];
                    using (System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image))
                    {
                        SymbolPreview.Draw(gr, new Rectangle(0, 0, image.Width, image.Height), symbol, true);
                        imageList1.Images[item.ImageIndex] = image;
                    }
                    list.Refresh();
                }
                else
                {
                    ISymbol    s   = (symbol is INullSymbol) ? RendererFunctions.CreateStandardSymbol(((INullSymbol)symbol).GeomtryType) : (ISymbol)symbol.Clone();
                    FormSymbol dlg = new FormSymbol(s);

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        Image image = imageList1.Images[item.ImageIndex];
                        using (System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image))
                        {
                            SymbolPreview.Draw(gr, new Rectangle(0, 0, image.Width, image.Height), dlg.Symbol, true);
                            imageList1.Images[item.ImageIndex] = image;

                            if (OnSymbolChanged != null)
                            {
                                OnSymbolChanged(item.Text, dlg.Symbol);
                            }
                        }
                        ((SymbolListViewItem)item).Symbol = dlg.Symbol;
                    }
                }

                if (_box.Visible)
                {
                    HideBox();
                }
            }
            else
            {
                int  w       = 0;
                bool showBox = false;
                foreach (ColumnHeader col in list.Columns)
                {
                    w += col.Width;
                    if (e.X < w)
                    {
                        if (col.Index == 0 && OnKeyChanged == null)
                        {
                            break;
                        }
                        if (col.Index > 0 && OnLabelChanged == null)
                        {
                            break;
                        }

                        Rectangle rect = item.Bounds;
                        rect.X      = 3 + w - col.Width + ((col.Index == 0) ? imageList1.ImageSize.Width : 0);
                        rect.Y      = 3 + rect.Top + rect.Height / 2 - _box.Height / 2;
                        rect.Width  = col.Width - ((col.Index == 0) ? imageList1.ImageSize.Width : 0);
                        rect.Height = _box.Height;

                        if (_box.Visible == true)
                        {
                            HideBox();
                        }

                        _box.Bounds  = rect;
                        _box.Text    = item.SubItems[col.Index].Text;
                        _box.Visible = true;
                        _box.Focus();
                        _labelEditItem  = (SymbolListViewItem)item;
                        _labelEditIndex = col.Index;
                        showBox         = true;
                        break;
                    }
                }
                if (showBox == false && _box.Visible == true)
                {
                    HideBox();
                    _labelEditIndex = 0;
                }
            }
        }