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 was wondering if there is a way to draw a polyline but with an arrow head at the end point?

Thanks all

IPolyline line = new PolylineClass();
((IPointCollection)line).AddPoint((IPoint)sourceFeature.Shape);
((IPointCollection)line).AddPoint((IPoint)sinkFeature.Shape);
share|improve this question
    
I think this is more of a symbology question than a polyline-creation question. Have you tried what's in this thread ? –  Kirk Kuykendall Apr 7 '11 at 20:07
    
but if i use a symbol, that means i cannot control the direction of the arrow head. –  Kev84 Apr 7 '11 at 20:43
    
Using a cartographiclinesymbol, the arrow can be either at the beginning or the end of the polyline. Do you want the polyline to contain extra points at the end representing the shape of the arrow head? –  Kirk Kuykendall Apr 7 '11 at 20:47
    
I currently have a line created with source and sink, i read your sample thread, but that's drawing a line, i already have a line, can you provide me some sample with using the cartographiclinesymbol? Thanks –  Kev84 Apr 7 '11 at 22:38
add comment

3 Answers 3

up vote 2 down vote accepted

Assuming you have already an IFeatureLayer object called featLayer:

SimpleLineDecorationElementClass de = new SimpleLineDecorationElementClass();
de.AddPosition(1);
de.MarkerSymbol = new ArrowMarkerSymbolClass();

LineDecorationClass ld = new LineDecorationClass();
ld.AddElement(de);

CartographicLineSymbolClass cl = new CartographicLineSymbolClass();
cl.Width = 1;
cl.LineDecoration = ld;

SimpleRendererClass sr = new SimpleRendererClass();
sr.Symbol = cl;
((IGeoFeatureLayer)featLayer).Renderer = sr;
share|improve this answer
    
Great AndOne, now is there a way to get rid of the arrow? I"m doing a show/hide context menu in TOC. I tried setting the renderer to null but didn't work –  Kev84 Jun 23 '11 at 14:31
add comment

Just go in to the symbology menu and scroll down until you see an option for this type of line symbology (arrow at start, end, etc). If you're using ArcGIS 10, you even have the option to search for symbology by a certain parameter (ex - typing "helicopter" will bring you to a number of symbology options related to that keyword). If you're using ArcGIS 9, you can also add different symbol sets to your array of options. I only have ArcView 9.3, but the print screen I attached shows you what you need.
Hope this helps, Dano enter image description here

share|improve this answer
    
thanks, but i want to achieve this by using ArcEngine 10 backend code. using c# and .net 4 + WPF –  Kev84 Apr 12 '11 at 14:31
    
Way out of my league .... sorry I couldn't help. –  Dano Apr 12 '11 at 16:19
add comment

Thanks to Dano for "pointing" me in this direction.

The following is my workaround for arrows in ArcView 9.3

-Create a polyline shapefile

-Add the shapefile to the map

-Use Editor to draw the line

-Navigate to the Symbol Selector and scroll down in the list and select either Arrow Right Middle or Arrow Left Middle

-The color of the line can be changed easily but the color of the arrow must be changed by navigating to Properties > Line Properties > Line Decorations: > Properties

-Number of positions = number of arrowheads; the cartographic symbol has only one arrowhead on the line

-Navigate to Symbol to change the color and size of the arrowheads

-Select multiple Oks to accept selections

share|improve this answer
    
Welcome to GIS SE! Something to be aware of is that your answers should directly address the question, and in this case there is a requirement for an ArcGIS Engine (ArcObjects) solution and what you have provided uses the ArcGIS Desktop GUI. –  PolyGeo Jul 16 at 21:22
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.