Add Multiple Graphics with 1 Graphic ID

4654
7
01-28-2015 11:56 AM
GSauers
Occasional Contributor

I am trying to create a line with a dot at each end of the line. I have successfully completed this by drawing a line, a dot, and another dot. My issue is that this creates 3 different graphic IDs.

When a user clicks on a line, they have an option to delete the line. No problem, but I also have to delete the points associated with the line. I have a work around solution, but I would love to create and add one object to the map that draws the line and 2 dots.

I am also trying to add a line with text above it, but again want to add both graphics as one graphic with only 1 graphic ID.

Thank you for any help or advice.

0 Kudos
7 Replies
WillCrick
Occasional Contributor

Hi,

Try using a composite symbol for the graphic:

CompositeSymbol | ArcGIS Android 10.2.5 API

Will

0 Kudos
GSauers
Occasional Contributor

Will, thank you for your response. That gets me closer to my goal. I have created a composite symbol full of my symbols, but I need to create graphics from those symbols. Each symbol is then paired with a geometry and then a graphic is created from the symbol and geometry.

Do you have ideas on how to do this?

Thank you for the help.

0 Kudos
WillCrick
Occasional Contributor

If you set this composite symbol as the symbol for your graphic, its should work.

W.

0 Kudos
GSauers
Occasional Contributor

Thanks again Will, when creating a graphic the object needs 2 parameters, a geometry and a symbol. I understand putting the composite symbol as the symbol, but how is the geometry specified if I am trying to create a polyline with 2 points at the ends of the lines?

Thanks again Will.

0 Kudos
WillCrick
Occasional Contributor

You can use a normal polygon for this, the composite symbol should make the vertexes of the polygon draw with the point symbol, the lines draw with any line symbol and the fill with the fill symbol. let me know though, screen shots would be great!

w.

0 Kudos
GSauers
Occasional Contributor

Thanks again for the help Will. I tried this and since I am drawing many line segments to create a fluid line, points are draw at the start and end of every line segment.

Thanks.

0 Kudos
GSauers
Occasional Contributor

Will, however, this does work for another feature on my maps. I allow the user to create 'Push Pins' that used an image in conjunction with a point to show exactly where the point is located on the map. I used the CompositeSymbol to draw the point and the push pin together and it works great. Thanks.

0 Kudos