Line patterns with markers do not work properly

Hello,

since Version 5.2.4 creating linepattern with markers does not work predictable, sometimes the markers appear, sometime they do not.
I verified it with the mapwingis examples app (see attachment) . The error occurs even with the newest version 5.3.0. Using 5.1.1.1 everything is fine.
Please have a look at the code.

Thanks
Frank

I also encountered this problem. Looking forward to answer.

Hello,

after taking a look at the sourcecode is seems obvious, that in the constructor of CLineSegment (LineSegment.h) the “new” Properties are not or wrong initialized. After adding the missing initialization and recompiling the .ocx everything seems to work.

If someone could verify…?

CLineSegment()
{
_pUnkMarshaler = NULL;
_lineType = lltSimple;
_lineColor = RGB(0,0,0);
_markerOutlineColor = RGB(120, 120, 120);
_lineWidth = 1.0f;
_lineStyle = dsSolid;
_marker = dpsDiamond;
_markerSize = 12;
_markerInterval = 16;
_markerOffset = 0.0f;
_markerOrientation = lorParallel;
_markerFlipFirst = VARIANT_FALSE; // WRONG
_markerIntervalIsRelative = VARIANT_FALSE; //MISSING
_markerOffsetIsRelative = VARIANT_FALSE; //MISSING
_markerAllowOverflow = VARIANT_FALSE; //MISSING
gReferenceCounter.AddRef(idLineSegment);
}

Best Regards,
Frank

Thanks Frank for also providing a potential fix.

@jerryfaust: Could you have a look. It seems OK to me.
I’ve created MWGIS-255 for this.

Yes, I’ll review it this weekend.

Thank you, Frank.

Jerry.

Ironically, it looks like those new internal variables (listed as MISSING) were first introduced in the 5.1.1.1 release, and none of them were ever pre-initialized, which of course would produce unpredictable results. It’s possible that a subsequent change further altered the behavior. Either way, it is appropriate to initialize them in the constructor as recommended.

Jerry.

Hi @jerryfaust and @pmeems,

I’m also getting a strange result if I use the arrow symbol in my user definined line.
The arrow is drawing correctly but I can’t change the orientation. I want draw a red arrow from left to right, but it’s is drawing in other way from right to left.
Here is my code:

with FWRF do begin
    mUtils := CoUtils.Create;
    mPattern := CoLinePattern.Create;
    mPattern.AddLine(mUtils.ColorByName (Black), 12.0, dsSolid);
    mPattern.AddLine(mUtils.ColorByName (Green), 8.0, dsSolid);
    mSegm := mPattern.AddMarker(dpsArrowLeft);
    mSegm.MarkerOrientation := lorParallel;
    mSegm.Marker := dpsArrowRight ;
    mSegm.MarkerFlipFirst := false;
    mSegm.Color := mUtils.ColorByName (Red);
    mSegm.MarkerSize := 15;
    mSegm.MarkerInterval := 30;
    mSegm.MarkerIntervalIsRelative := false;
    DefaultDrawingOptions.LinePattern := mPattern;
    DefaultDrawingOptions.UseLinePattern := true;
  end;

Do you know what I’m doing wrong?
The line below start from left to right, but the array is drawing from right to left:

Can’t you just use
mSegm := mPattern.AddMarker(dpsArrowRight);