0

I'm working with the OL3 example DrawShapes. There is a "star" as example for a custom draw interaction with a user defined geometry function looking like

   draw = new ol.interaction.Draw({
        source: source,
        type:  'Circle',
        geometryFunction: 
          function(coordinates, geometry) {
            if (!geometry) {
              geometry = new ol.geom.Polygon(null);
            }

            //Calculate coordinates and set geometry

          }
   });

What I am actually trying to achieve is replacing this geometry with a custom SVG. The user should be able to draw these SVGs (basically arrows) with the circle-like two point interaction, just like in the example.

I already parsed the svg to a OL-MultilineString geometry. But when I am trying to replace the Polygon with my custom MultiLineString, the "basic geometry stroke" from center to last in the example also appears. Is this intended behavior or not and how can I get rid of this additional line?

Does it make a difference to recreate the geometry every time during the draw interaction or to use deltas and change the geometry continuously?

star with dispensable line in yellow

For testing you can just use the above link and replacing the ol.geom.Polygon(null) with a ol.geom.MultiLineString(null)

I appreciate every solution including different approaches.

Raphael H.
  • 55
  • 2
  • 7
  • 1
    Having trouble & asking for help is not a question, read [ask] and edit the question. – Omri Luzon Jun 09 '17 at 16:22
  • I clearly specified the question part, having trouble is usually the way leading to a question, isn't it? I reformatted a bit, now it should be more comprehensible. – Raphael H. Jun 10 '17 at 20:13

0 Answers0