Ejemplo n.º 1
0
        private IRepresentationRule method_1(IFeatureClass ifeatureClass_1)
        {
            IBasicSymbol        symbol = this.method_0(ifeatureClass_1);
            IRepresentationRule rule   = new RepresentationRuleClass();

            rule.InsertLayer(0, symbol);
            return(rule);
        }
Ejemplo n.º 2
0
        public static IRepresentationRule CreateRepresentationRule(IFeatureClass ifeatureClass_0)
        {
            IBasicSymbol        symbol = CreateBasicSymbol(ifeatureClass_0);
            IRepresentationRule rule   = new RepresentationRuleClass();

            rule.InsertLayer(0, symbol);
            return(rule);
        }
Ejemplo n.º 3
0
        private void btnMoveUp_Click(object sender, EventArgs e)
        {
            TabPage      tabPage = this.tabControl1.TabPages[this.tabControl1.SelectedIndex];
            IBasicSymbol symbol  = this.m_pRepresentationRule.get_Layer(this.tabControl1.SelectedIndex - 1);

            this.m_pRepresentationRule.RemoveLayer(this.tabControl1.SelectedIndex - 1);
            this.m_pRepresentationRule.InsertLayer(this.tabControl1.SelectedIndex - 2, symbol);
            int index = this.tabControl1.SelectedIndex - 1;

            this.tabControl1.TabPages.RemoveAt(this.tabControl1.SelectedIndex);
            this.tabControl1.TabPages.Insert(index, tabPage);
        }
Ejemplo n.º 4
0
        internal static IBasicSymbol CreateBasicSymbol(IFeatureClass ifeatureClass_0)
        {
            IBasicSymbol symbol = null;

            if ((ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryMultipoint) ||
                (ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryPoint))
            {
                return(new BasicMarkerSymbolClass());
            }
            if (ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryPolyline)
            {
                return(new BasicLineSymbolClass());
            }
            if (ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryPolygon)
            {
                symbol = new BasicFillSymbolClass();
            }
            return(symbol);
        }
Ejemplo n.º 5
0
        private IBasicSymbol method_0(IFeatureClass ifeatureClass_1)
        {
            IBasicSymbol symbol = null;

            if ((ifeatureClass_1.ShapeType == esriGeometryType.esriGeometryMultipoint) ||
                (ifeatureClass_1.ShapeType == esriGeometryType.esriGeometryPoint))
            {
                return(new BasicMarkerSymbolClass());
            }
            if (ifeatureClass_1.ShapeType == esriGeometryType.esriGeometryPolyline)
            {
                return(new BasicLineSymbolClass());
            }
            if (ifeatureClass_1.ShapeType == esriGeometryType.esriGeometryPolygon)
            {
                symbol = new BasicFillSymbolClass();
            }
            return(symbol);
        }
Ejemplo n.º 6
0
        protected void DrawSymbol(int int_0, Rectangle rectangle_0, object object_1)
        {
            IDisplayTransformation displayTransformation = new DisplayTransformation() as IDisplayTransformation;
            IEnvelope envelope = new Envelope() as ESRI.ArcGIS.Geometry.IEnvelope;

            envelope.PutCoords((double)rectangle_0.Left, (double)rectangle_0.Top, (double)rectangle_0.Right,
                               (double)rectangle_0.Bottom);
            tagRECT tagRECT;

            tagRECT.left   = rectangle_0.Left;
            tagRECT.right  = rectangle_0.Right;
            tagRECT.bottom = rectangle_0.Bottom;
            tagRECT.top    = rectangle_0.Top;
            displayTransformation.set_DeviceFrame(ref tagRECT);
            displayTransformation.Bounds = envelope;
            if (this.double_0 < 1.0 && object_1 is ILineSymbol)
            {
                displayTransformation.Resolution = 48.0 / this.double_0;
            }
            else
            {
                displayTransformation.Resolution = 96.0;
            }
            displayTransformation.ReferenceScale = 1.0;
            displayTransformation.ScaleRatio     = this.double_0;
            if (object_1 is IMarkerSymbol)
            {
                IStyleGalleryClass styleGalleryClass = new MarkerSymbolStyleGalleryClass();
                tagRECT            tagRECT2          = default(tagRECT);
                tagRECT2.left   = rectangle_0.Left;
                tagRECT2.right  = rectangle_0.Right;
                tagRECT2.top    = rectangle_0.Top;
                tagRECT2.bottom = rectangle_0.Bottom;
                styleGalleryClass.Preview(object_1, int_0, ref tagRECT2);
            }
            else if (object_1 is ILineSymbol)
            {
                IStyleGalleryClass styleGalleryClass = new LineSymbolStyleGalleryClass();
                tagRECT            tagRECT2          = default(tagRECT);
                tagRECT2.left   = rectangle_0.Left;
                tagRECT2.right  = rectangle_0.Right;
                tagRECT2.top    = rectangle_0.Top;
                tagRECT2.bottom = rectangle_0.Bottom;
                styleGalleryClass.Preview(object_1, int_0, ref tagRECT2);
            }
            else if (object_1 is IFillSymbol)
            {
                IStyleGalleryClass styleGalleryClass = new FillSymbolStyleGalleryClass();
                tagRECT            tagRECT2          = default(tagRECT);
                tagRECT2.left   = rectangle_0.Left;
                tagRECT2.right  = rectangle_0.Right;
                tagRECT2.top    = rectangle_0.Top;
                tagRECT2.bottom = rectangle_0.Bottom;
                styleGalleryClass.Preview(object_1, int_0, ref tagRECT2);
            }
            else
            {
                ISymbol symbol;
                if (object_1 is IColorRamp)
                {
                    IGradientFillSymbol gradientFillSymbol = new GradientFillSymbol();
                    ILineSymbol         outline            = gradientFillSymbol.Outline;
                    outline.Width = 0.0;
                    gradientFillSymbol.Outline            = outline;
                    gradientFillSymbol.ColorRamp          = (IColorRamp)object_1;
                    gradientFillSymbol.GradientAngle      = 180.0;
                    gradientFillSymbol.GradientPercentage = 1.0;
                    gradientFillSymbol.IntervalCount      = 100;
                    gradientFillSymbol.Style = esriGradientFillStyle.esriGFSLinear;
                    symbol = (ISymbol)gradientFillSymbol;
                }
                else if (object_1 is IColor)
                {
                    symbol = (ISymbol) new ColorSymbol
                    {
                        Color = (IColor)object_1
                    };
                }
                else if (object_1 is IAreaPatch)
                {
                    symbol = new SimpleFillSymbol() as ISymbol;
                    IRgbColor rgbColor = new RgbColor();
                    rgbColor.Red   = 227;
                    rgbColor.Green = 236;
                    rgbColor.Blue  = 19;
                    ((IFillSymbol)symbol).Color = rgbColor;
                }
                else if (object_1 is ILinePatch)
                {
                    symbol = new SimpleLineSymbol() as ISymbol;
                }
                else
                {
                    if (object_1 is INorthArrow)
                    {
                        IStyleGalleryClass styleGalleryClass = new NorthArrowStyleGalleryClass();
                        tagRECT            tagRECT2          = default(tagRECT);
                        tagRECT2.left   = rectangle_0.Left;
                        tagRECT2.right  = rectangle_0.Right;
                        tagRECT2.top    = rectangle_0.Top;
                        tagRECT2.bottom = rectangle_0.Bottom;
                        styleGalleryClass.Preview(object_1, int_0, ref tagRECT2);
                        return;
                    }
                    if (object_1 is ILegendItem)
                    {
                        IStyleGalleryClass styleGalleryClass = new LegendItemStyleGalleryClass();
                        tagRECT            tagRECT2          = default(tagRECT);
                        tagRECT2.left   = rectangle_0.Left;
                        tagRECT2.right  = rectangle_0.Right;
                        tagRECT2.top    = rectangle_0.Top;
                        tagRECT2.bottom = rectangle_0.Bottom;
                        styleGalleryClass.Preview(object_1, int_0, ref tagRECT2);
                        return;
                    }
                    if (object_1 is ILabelStyle)
                    {
                        IStyleGalleryClass styleGalleryClass = new LabelStyleGalleryClass();
                        tagRECT            tagRECT2          = default(tagRECT);
                        tagRECT2.left   = rectangle_0.Left;
                        tagRECT2.right  = rectangle_0.Right;
                        tagRECT2.top    = rectangle_0.Top;
                        tagRECT2.bottom = rectangle_0.Bottom;
                        styleGalleryClass.Preview(object_1, int_0, ref tagRECT2);
                        return;
                    }
                    if (object_1 is IMapSurround)
                    {
                        MapSurroundDraw mapSurroundDraw = new MapSurroundDraw(object_1 as IMapSurround);
                        mapSurroundDraw.Draw(int_0, rectangle_0, 96.0, this.double_0);
                        return;
                    }
                    if (object_1 is IBackground)
                    {
                        IDisplay display = new ScreenDisplay();
                        display.StartDrawing(int_0, 0);
                        display.DisplayTransformation = displayTransformation;
                        IGeometry geometry = ((IBackground)object_1).GetGeometry(display, envelope);
                        ((IBackground)object_1).Draw(display, geometry);
                        display.FinishDrawing();
                        return;
                    }
                    if (object_1 is IShadow)
                    {
                        ShadowDraw shadowDraw = new ShadowDraw(object_1 as IShadow);
                        shadowDraw.Draw(int_0, rectangle_0, 96.0, this.double_0);
                        return;
                    }
                    if (object_1 is IRepresentationMarker)
                    {
                        RepresentationMarkerDraw representationMarkerDraw =
                            new RepresentationMarkerDraw(object_1 as IRepresentationMarker);
                        representationMarkerDraw.Draw(int_0, rectangle_0, 96.0, this.double_0);
                        return;
                    }
                    if (object_1 is IRepresentationRuleItem)
                    {
                        try
                        {
                            RepresentationRuleDraw representationRuleDraw = new RepresentationRuleDraw(object_1);
                            IRepresentationRule    representationRule     =
                                (object_1 as IRepresentationRuleItem).RepresentationRule;
                            IBasicSymbol arg_61E_0 = representationRule.get_Layer(0);
                            representationRuleDraw.Draw(int_0, rectangle_0, 96.0, this.double_0);
                            return;
                        }
                        catch
                        {
                            return;
                        }
                    }
                    if (object_1 is IBorder)
                    {
                        IDisplay display = new ScreenDisplay();
                        display.StartDrawing(int_0, 0);
                        display.DisplayTransformation = displayTransformation;
                        IPointCollection pointCollection = new Polyline();
                        object           value           = System.Reflection.Missing.Value;
                        IPoint           point           = new ESRI.ArcGIS.Geometry.Point();
                        point.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Top);
                        pointCollection.AddPoint(point, ref value, ref value);
                        point.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Bottom);
                        pointCollection.AddPoint(point, ref value, ref value);
                        point.PutCoords((double)(rectangle_0.Right - 4), (double)rectangle_0.Bottom);
                        pointCollection.AddPoint(point, ref value, ref value);
                        IGeometry geometry = ((IBorder)object_1).GetGeometry(display, (IGeometry)pointCollection);
                        ((IBorder)object_1).Draw(display, geometry);
                        display.FinishDrawing();
                        return;
                    }
                    if (object_1 is IMapGrid)
                    {
                        IDisplay display = new ScreenDisplay();
                        display.StartDrawing(int_0, 0);
                        display.DisplayTransformation = displayTransformation;
                        IPointCollection pointCollection = new Polyline();
                        object           value           = System.Reflection.Missing.Value;
                        IPoint           point           = new ESRI.ArcGIS.Geometry.Point();
                        point.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Top);
                        pointCollection.AddPoint(point, ref value, ref value);
                        point.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Bottom);
                        pointCollection.AddPoint(point, ref value, ref value);
                        point.PutCoords((double)(rectangle_0.Right - 4), (double)rectangle_0.Bottom);
                        pointCollection.AddPoint(point, ref value, ref value);
                        IMapFrame mapFrame = new MapFrame() as IMapFrame;
                        IMap      map      = new Map();
                        mapFrame.Map = map;
                        (map as IActiveView).Extent = (pointCollection as IGeometry).Envelope;
                        (object_1 as IMapGrid).Draw(display, mapFrame);
                        display.FinishDrawing();
                        return;
                    }
                    return;
                }
                if (symbol is IPictureFillSymbol || symbol is IPictureLineSymbol)
                {
                    symbol.SetupDC(int_0, displayTransformation);
                }
                else
                {
                    symbol.SetupDC(int_0, displayTransformation);
                }
                if (symbol is IMarkerSymbol)
                {
                    this.method_0((IMarkerSymbol)symbol, rectangle_0);
                }
                else if (symbol is ILineSymbol)
                {
                    this.method_1((ILineSymbol)symbol, rectangle_0);
                }
                else if (symbol is IFillSymbol)
                {
                    this.method_2((IFillSymbol)symbol, rectangle_0);
                }
                else if (symbol is ITextSymbol)
                {
                    this.method_3((ITextSymbol)symbol, rectangle_0);
                }
                symbol.ResetDC();
            }
        }
Ejemplo n.º 7
0
 private void RepresationRuleCtrl_Load(object sender, EventArgs e)
 {
     this.contextMenuStrip1.Items.Clear();
     if (this.m_pRepresentationRuleItem != null)
     {
         this.symbolItem1.Symbol = this.m_pRepresentationRuleItem;
     }
     if (this.m_pRepresentationRule != null)
     {
         for (int i = 0; i < this.m_pRepresentationRule.LayerCount; i++)
         {
             TabPage      page;
             IBasicSymbol symbol = this.m_pRepresentationRule.get_Layer(i);
             if (symbol is IBasicMarkerSymbol)
             {
                 this.contextMenuStrip1.Items.Add(this.basicMarkerLayerToolStripMenuItem);
                 page = new TabPage("点");
                 BasicMarkerSymbolLayer layer = new BasicMarkerSymbolLayer
                 {
                     BasicSymbol  = symbol,
                     GeometryType = this.m_pRepresentationRuleItem.GeometryType
                 };
                 page.Controls.Add(layer);
                 layer.Dock = DockStyle.Fill;
                 this.tabControl1.TabPages.Add(page);
             }
             else if (symbol is IBasicLineSymbol)
             {
                 this.contextMenuStrip1.Items.Add(this.basicMarkerLayerToolStripMenuItem);
                 this.contextMenuStrip1.Items.Add(this.basicLineLayerToolStripMenuItem);
                 page = new TabPage("线");
                 BasicLineSymbolLayer layer2 = new BasicLineSymbolLayer
                 {
                     BasicSymbol  = symbol,
                     GeometryType = this.m_pRepresentationRuleItem.GeometryType
                 };
                 page.Controls.Add(layer2);
                 layer2.Dock = DockStyle.Fill;
                 this.tabControl1.TabPages.Add(page);
             }
             else if (symbol is IBasicFillSymbol)
             {
                 this.contextMenuStrip1.Items.Add(this.basicMarkerLayerToolStripMenuItem);
                 this.contextMenuStrip1.Items.Add(this.basicLineLayerToolStripMenuItem);
                 this.contextMenuStrip1.Items.Add(this.basicFillLayerToolStripMenuItem);
                 page = new TabPage("面");
                 BasicFillSymbolLayer layer3 = new BasicFillSymbolLayer
                 {
                     BasicSymbol  = symbol,
                     GeometryType = this.m_pRepresentationRuleItem.GeometryType
                 };
                 page.Controls.Add(layer3);
                 layer3.Dock = DockStyle.Fill;
                 this.tabControl1.TabPages.Add(page);
             }
         }
     }
     this.btnAddLayer.Enabled    = this.m_CanEdit;
     this.btnDeleteLayer.Enabled = this.m_CanEdit;
     this.btnMoveUp.Enabled      = this.m_CanEdit;
     this.tnMoveDown.Enabled     = this.m_CanEdit;
 }
Ejemplo n.º 8
0
        public void Init()
        {
            int num;

            this.contextMenuStrip1.Items.Clear();
            for (num = this.tabControl1.TabCount - 1; num > 0; num--)
            {
                this.tabControl1.TabPages.RemoveAt(num);
            }
            this.symbolItem1.Symbol = this.m_pRepresentationRuleItem;
            if (this.m_pRepresentationRule != null)
            {
                for (num = 0; num < this.m_pRepresentationRule.LayerCount; num++)
                {
                    TabPage      page;
                    IBasicSymbol symbol = this.m_pRepresentationRule.get_Layer(num);
                    if (symbol is IBasicMarkerSymbol)
                    {
                        this.contextMenuStrip1.Items.Add(this.basicMarkerLayerToolStripMenuItem);
                        page = new TabPage("点");
                        BasicMarkerSymbolLayer layer = new BasicMarkerSymbolLayer
                        {
                            BasicSymbol  = symbol,
                            GeometryType = this.m_pRepresentationRuleItem.GeometryType
                        };
                        page.Controls.Add(layer);
                        layer.Dock = DockStyle.Fill;
                        this.tabControl1.TabPages.Add(page);
                    }
                    else if (symbol is IBasicLineSymbol)
                    {
                        this.contextMenuStrip1.Items.Add(this.basicMarkerLayerToolStripMenuItem);
                        this.contextMenuStrip1.Items.Add(this.basicLineLayerToolStripMenuItem);
                        page = new TabPage("线");
                        BasicLineSymbolLayer layer2 = new BasicLineSymbolLayer
                        {
                            BasicSymbol  = symbol,
                            GeometryType = this.m_pRepresentationRuleItem.GeometryType
                        };
                        page.Controls.Add(layer2);
                        layer2.Dock = DockStyle.Fill;
                        this.tabControl1.TabPages.Add(page);
                    }
                    else if (symbol is IBasicFillSymbol)
                    {
                        this.contextMenuStrip1.Items.Add(this.basicMarkerLayerToolStripMenuItem);
                        this.contextMenuStrip1.Items.Add(this.basicLineLayerToolStripMenuItem);
                        this.contextMenuStrip1.Items.Add(this.basicFillLayerToolStripMenuItem);
                        page = new TabPage("面");
                        BasicFillSymbolLayer layer3 = new BasicFillSymbolLayer
                        {
                            BasicSymbol  = symbol,
                            GeometryType = this.m_pRepresentationRuleItem.GeometryType
                        };
                        page.Controls.Add(layer3);
                        layer3.Dock = DockStyle.Fill;
                        this.tabControl1.TabPages.Add(page);
                    }
                }
            }
            this.btnAddLayer.Enabled    = this.m_CanEdit;
            this.btnDeleteLayer.Enabled = this.m_CanEdit;
            this.btnMoveUp.Enabled      = this.m_CanEdit;
            this.tnMoveDown.Enabled     = this.m_CanEdit;
        }