Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I draw some polylines on map. How create new layer with this features? Map and Polylines must be in different layers.

public void DrawPolylineUsingInputGeometry(IActiveView activeView,
                                               IPolyline geometry,
                                               IRgbColor rgbColor)
    {
        IElement element = new LineElement();

        if (activeView == null)
        {
            return;
        }

        IScreenDisplay screenDisplay = activeView.ScreenDisplay;

        // Constant
        screenDisplay.StartDrawing(screenDisplay.hDC,
                                   Convert.ToInt16(esriScreenCache.esriNoScreenCache));

        IColor color = rgbColor; // Implicit Cast
        ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
        simpleLineSymbol.Color = color;
        simpleLineSymbol.Width = 2.2;
        element.Geometry = geometry as PolylineClass;
        var symbol = (ISymbol) simpleLineSymbol; // Explicit Cast
        screenDisplay.SetSymbol(symbol);
        //screenDisplay.DrawPolyline(geometry);
        IGraphicsContainer graphicsContainer = MainForm.axMapControl1.ActiveView.GraphicsContainer;
        graphicsContainer.AddElement(element, 0);
        screenDisplay.FinishDrawing();
        MainForm.axMapControl1.Refresh();
    }

as activeView, i use axMapControll.ActiveView;

share|improve this question
    
What have you tried so far? Have you looked at the help? –  blah238 Apr 21 '13 at 22:57
    
@blah238 i saw this article, but there no add a new layer to TOCControll etc. My problem is very simple to solve i think, but i can't understand how solve it( –  Roman Chyzh Apr 21 '13 at 23:09
    
Again, have you looked at the help? –  blah238 Apr 21 '13 at 23:30
    
@blah238 yes. if in help is help for me, i can't find it –  Roman Chyzh Apr 21 '13 at 23:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.