ThinkGeo.com    |     Documentation    |     Premium Support

Bug on DrawTileAsyncCore on EditInteractiveOverlay

I think there is a bug on DrawTileAsyncCore on EditInteractiveOverlay.
if i use 0, 90, 180, 270 angle it will rotate to proper angle other than that it will just rotate to 0 angle.

working

geoCanvas.DrawWorldImage(new GeoImage(@“Assets/DT_RIGHT_YELLOW.png”), featureCollection.BaseShape.GetCenterPoint().X, featureCollection.BaseShape.GetCenterPoint().Y, 24, 24, DrawingLevel.LevelOne, 0, 0, 90);

not working

geoCanvas.DrawWorldImage(new GeoImage(@“Assets/DT_RIGHT_YELLOW.png”), featureCollection.BaseShape.GetCenterPoint().X, featureCollection.BaseShape.GetCenterPoint().Y, 24, 24, DrawingLevel.LevelOne, 0, 0, 91);

hi Gisnoob,

I can’t reproduce this issue, could you please send us a sample? and which version are you using?

Thanks,
Leo

Unfortunately i cant send the whole code because im using postgresql database for my layers, but i can send the partial code.

    protected override Task DrawTileAsyncCore(GeoCanvas geoCanvas)
    {
        geoCanvas.DrawingQuality = DrawingQuality.HighSpeed;

        bool show_pointer = false;

        if (!mainWindow.IsNewFeatureActive)
        {
            return base.DrawTileAsyncCore(geoCanvas);
        }

        if (mainWindow.GetLayerActive().ShapeType is PointShape)
        {
            if (Point_feature != null)
            {
                if (mainWindow.GetLayerActive().Input.InputType == "SimplePoint")
                {
                    foreach (FeatureCollection featureCollection in mainWindow.TempFeatureCollection)
                    {
                        if (featureCollection.IsSelected)
                        {
                            geoCanvas.DrawEllipse(featureCollection.BaseShape.GetCenterPoint(), 3.0f, 3.0f, new GeoPen(new GeoColor(255, GeoColors.BrightYellow), 4.0f), DrawingLevel.LevelOne);
                        }
                        else
                        {
                            geoCanvas.DrawEllipse(featureCollection.BaseShape.GetCenterPoint(), 3.0f, 3.0f, new GeoPen(new GeoColor(255, GeoColors.Aqua), 3.0f), DrawingLevel.LevelOne);
                        }

                        geoCanvas.DrawTextWithScreenCoordinate($"{featureCollection.FeatureLabel}", new GeoFont("Segoe UI", 10.0f, DrawingFontStyles.Bold), GeoBrushes.DarkRed, new GeoPen(GeoColor.FromHtml("#FFFFFF"), 1.5f), (float)MapUtil.ToScreenCoordinate(featureCollection.BaseShape, mapView.CurrentExtent, (float)mapView.ActualWidth, (float)mapView.ActualHeight).GetCenterPoint().X, (float)MapUtil.ToScreenCoordinate(featureCollection.BaseShape, mapView.CurrentExtent, (float)mapView.ActualWidth, (float)mapView.ActualHeight).GetCenterPoint().Y - 10, DrawingLevel.LevelOne);
                    }
                    geoCanvas.DrawEllipse(Point_feature, 3.0f, 3.0f, new GeoPen(new GeoColor(255, GeoColors.BrightRed), 3.0f), DrawingLevel.LevelOne);
                }
                if (mainWindow.GetLayerActive().Input.InputType == "Image")
                {
                    foreach (FeatureCollection featureCollection in mainWindow.TempFeatureCollection)
                    {
                        geoCanvas.DrawTextWithScreenCoordinate($"{featureCollection.FeatureLabel}", new GeoFont("Segoe UI", 10.0f, DrawingFontStyles.Bold), GeoBrushes.DarkRed, new GeoPen(GeoColor.FromHtml("#FFFFFF"), 1.5f), (float)MapUtil.ToScreenCoordinate(featureCollection.BaseShape, mapView.CurrentExtent, (float)mapView.ActualWidth, (float)mapView.ActualHeight).GetCenterPoint().X, (float)MapUtil.ToScreenCoordinate(featureCollection.BaseShape, mapView.CurrentExtent, (float)mapView.ActualWidth, (float)mapView.ActualHeight).GetCenterPoint().Y - 10, DrawingLevel.LevelOne);
                    }
                    if (!is_edit)
                    {
                        geoCanvas.DrawWorldImage(new GeoImage(@"Assets/DT_RIGHT_CYAN.png"), Point_feature.GetShape().GetCenterPoint().X, Point_feature.GetShape().GetCenterPoint().Y, 24, 24, DrawingLevel.LevelFour, 0, 0, 0);
                    }
                    else
                    {
                        geoCanvas.DrawEllipse(Point_feature, 3.0f, 3.0f, new GeoPen(new GeoColor(255, GeoColors.BrightRed), 3.0f), DrawingLevel.LevelOne);
                    }
                }
            }

            return base.DrawTileAsyncCore(geoCanvas);
        }


        return base.DrawTileAsyncCore(geoCanvas);
    }

Im using the latest version btw.

Hi gisnoob,

Thanks for your code. I reproduced your issue. I think your code makes sense, we’ll fix it as soon as possible.

As of right now, you could use the following code to rotate the image to any angle:

    protected override Task DrawTileAsyncCore(GeoCanvas geoCanvas)
    {
        // call base.DrawTileAsyncCore first, then DrawWorldImage
        Task task = base.DrawTileAsyncCore(geoCanvas);

        PointShape p = geoCanvas.CurrentWorldExtent.GetCenterPoint();
        geoCanvas.DrawWorldImage(new GeoImage(@"Assets/DT_RIGHT_YELLOW.png"), featureCollection.BaseShape.GetCenterPoint().X, featureCollection.BaseShape.GetCenterPoint().Y, 24, 24, DrawingLevel.LevelOne, 0, 0, 91);

        return task;
    }

Thanks,
Leo

Thanks! hope to see the fix/patch soon cuz this will significantly shorten my codes.

i can rotate to any angle but the problem is if i have 2 or more features it will just display the last added feature.

Hi Gisnoob,

I’ve fixed it, you could upgrade your ThinkGeo.UI.Wpf to 13.0.0-beta370 or above to give it a try. And let me know if the problem still exists.

Thanks,
Leo

will wait for the beta370 its not yet available on nuget

still the problem still exists,

If the collection has only one feature, there is no problem i can rotate it to any angle, the bug will occur if collection has 2 or more features. can you check it?

Hi Gisnoob,

Thanks for your feedback. I reproduced the issue and have fixed it, you could upgrade your ThinkGeo.UI.Wpf to 13.0.0-beta372 or above to give it a try.

Thanks,
Leo

multiple feature fix but it has another problem, the when i click to add the feature it is not centered or it is not aligned with the center point that is set, it seems that the x coordinate it going to the negative side.

Hi,

Yes, it’s a bug. I’ve fixed it. Could you upgrade your ThinkGeo.UI.Wpf to 13.0.0-beta373 or above to give it a try?

Thanks,
Leo

one last problem if I call DrawCore and mapview.refresh() i get

Exception thrown: ‘System.InvalidCastException’ in System.Private.CoreLib.dll
An unhandled exception of type ‘System.InvalidCastException’ occurred in System.Private.CoreLib.dll
Unable to cast object of type ‘System.Windows.Controls.Canvas’ to type ‘ThinkGeo.Core.TileView’

hi,

I’m not sure if I understand correctly. Do you mean you call DrawCore method and then call MapView.refersh in your code? Could you post your code here, so we can have a better understanding?

Thanks,
Leo

yes i call also refresh because i have to reload an overlay aside from drawcore.