ThinkGeo.com    |     Documentation    |     Premium Support

OutLine Color not available on DrawLine method using DrawCore

Hi,
I am trying to set OutLine Color using DrawLine method. It’s not available for setting it.
I want to set Outline color using DrawLine method.

Code :

Vertex vcenter = new Vertex(screenCenterPoint.X, screenCenterPoint.Y);
Vertex vdir = new Vertex((float)screenDirPoint.X, screenDirPoint.Y);
PointShape centerpoint = ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, (float)vcenter.X, (float)vcenter.Y, canvas.Width, canvas.Height);
PointShape dirpoint = ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, (float)vdir.X, (float)vdir.Y, canvas.Width, canvas.Height);
LineShape ldir = new LineShape();
ldir.Vertices.Add(new Vertex(centerpoint));
ldir.Vertices.Add(new Vertex(dirpoint));
canvas.DrawLine(new Feature(ldir), new GeoPen(GeoColor.FromArgb(255, 127, 127, 127), (float)0.5), DrawingLevel);

Result :

Expected Result :

Is it possible to set outline color.
Please suggest me any solution for it.

Thanks,
Riyaz

Hi Riyaz,

Please use LineStyle.Draw instead of your canvas.DrawLine, which should get the style works.

You can set outerline color as parameter in the API LineStyle.Draw.

Wish that’s helpful.

Regards,

Don

Hi Don,
Thanks for your reply.
I checked it in latest production dll(9.0.0.748). but LineStyle.Draw method not available.
Can you please suggest me code or other idea for setting Outline color of line.

Thanks,
Riyaz

Hi Riyaz,

I think you should missed something.

I tested with 9.0.0.748, the LineStyle support Draw, which is inherited from its base class Style.

As below is the API:
public void Draw(IEnumerable shapes, GeoCanvas canvas, Collection labelsInThisLayer, Collection labelsInAllLayers);

    public void Draw(IEnumerable<Feature> features, GeoCanvas canvas, Collection<SimpleCandidate> labelsInThisLayer, Collection<SimpleCandidate> labelsInAllLayers);

Please double check that and let us know if you still cannot use it.

Regards,

Don

Hi Don,
Thanks for your reply.

It’s work out. So much helpful.

Thanks,
Riyaz

Hi Riyaz,

I’m glad to hear that works.

Regards,

Don

Hi Don,
One more problem,
For only line or polygon features, it’s working fine of your logic. But If lines and polygons there, then it’s not work out correctly.

please check

But actually, I want like this

Code:
LineStyle ls = new LineStyle(new GeoPen(GeoColors.White, 3), new GeoPen(GeoColor.FromArgb(255, 127, 127, 127), 1));
ls.Draw(ftsLines, canvas, labelsInThisLayer, labelsInAllLayers);

        AreaStyle as1 = new AreaStyle(new GeoPen(GeoColors.White, 1), new GeoSolidBrush(GeoColors.Black), PenBrushDrawingOrder.BrushFirst);
        as1.Draw(ftsPolygons, canvas, labelsInThisLayer, labelsInAllLayers);

Please suggest me some ideas for solving this.

Thanks,
Riyaz

Hi Riyaz,

Do you means your layer contains lines and polygons there?

If your layer only render line and polygon is OK, my suggestion is, you can do something like this:

ShapeFileFeatureLayer layer1 = new ShapeFileFeatureLayer(“The Same Data Source”);
layer1.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = …

ShapeFileFeatureLayer layer2 = new ShapeFileFeatureLayer(“The Same Data Source”);
layer1.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = …

You don’t need render them at the same time.

Please let me know whether it’s helpful or I misunderstand it.

Regards,

Don

Hi Don,
we can’t use two layers for render styles. Actually I am using ‘WindBarbPointStyle’ custom class for achieving this.
In ‘DrawCore’ method, i am render features for specifying styles.

Please check attached file for reference of my code.

WindBarbPointStyleNew.cs (14.4 KB)

I want to set Outer Color to features(Lines/Polygons). Some times it’s combination of Line and Polygon features on that time, How should i apply style for ‘Outline Color’

Thanks
Riyaz

Hi Riyaz,

Does the “Outline Color” means something like halo? I hadn’t which part of your code draw that, but if you want draw that, you should calculate that and draw it first, that should be in the bottom level, then you can draw polygon and line above that. The drawn logic should be halo, polygon, line, point.

If I misunderstand it please let me know.

Regards,

Don