ThinkGeo.com    |     Documentation    |     Premium Support

Loading CAD file in v12 is times slower than it was in v10

Hi ThinkGeo

we are working hard to upgrade our product from current ThinkGeo v10 to the v12. We noticed that initial display of the CAD drawing in v10 takes times less than it does in v12.

The v12 code is barebone sample (basically ThinkGeo domestic sample) taken from topic: https://community.thinkgeo.com/t/cad-layer-with-srid-3949-is-misplaced/9817 sample code from Frank https://community.thinkgeo.com/uploads/short-url/f9AOEmTYRrlogztHTQ9LtxLY1ro.zip

Particularly, at my work PC, sample application (ThinkGeo v12) loads CAD file in average 23.4 sec.
At same time, on same PC, the old application running ThinkGeo v10, loads same CAD drawing in fraction of a second.

Tiles caching enabled in both applications. In v12 sample application as follow:
CadFeatureLayer cadFeatureLayer = new CadFeatureLayer(@".\Asset\Cad_data.dwg");
LayerOverlay layerOverlay2 = new LayerOverlay();
layerOverlay2.TileCache = new FileRasterTileCache(@".\Cache");

wpfMap.Overlays.Add(layerOverlay2);
layerOverlay2.Layers.Add(cadFeatureLayer);

cadFeatureLayer.FeatureSource.Open();
var prjstr = System.IO.File.ReadAllText(@".\Asset\Cad_data.prj");
string proj4String = Projection.ConvertWktToProjString(prjstr);

This makes us think that tiles cache is not really used in v12 application (even tough tiles cache folders and files are created).

What is the difference in the tiles cache setup in v12, compared to the v10?

With best regards,
Alexey

OK, it looks that problem was in the incorrect TileCache setup. Problem is solved.

Thanks Alexey,
Good to know it solved. Go ahead let us know if you have any more questions.

Thanks

Frank

Hi Frank

here I come again. Actually, there is an isue with performance, and it DOES makes map to work times slower.

Here is the case:
for CAD drawing, if
LayerOverlay.TileType = TileType.SingleTile;
then drawing goes very slow (~15 sec instead of less then a 1 sec) and most important, CAD rendering goes in the Main Thread, thus making application unresponsive.

You can reproduce this behavior, if in your sample (referred above) specify LayerOverlay.TileType = TileType.SingleTile; you will reproduce this issue.

Wish you a good day!

With best regards
Alexey

Thanks Alexey,
I think you are talking about open the layer. It does need some time to load the drawing to the memory. We do support load the layer in background. Here is the code to do that.

private async void Window_Loaded(object sender, RoutedEventArgs e)
{
// Use BingMap Layer.
mapView.MapUnit = GeographyUnit.Meter;
mapView.CurrentExtent = MaxExtents.BingMaps;
BingMapsLayer bingMapsLayer = new BingMapsLayer(“Your Id”);
LayerOverlay layerOverlay = new LayerOverlay() { TileHeight = 256, TileWidth = 256 };
layerOverlay.TileCache = null;
// layerOverlay.tile
// layerOverlay.Layers.Add(bingMapsLayer);
layerOverlay.TileSizeMode = TileSizeMode.Small;
layerOverlay.TileType = TileType.SingleTile;
layerOverlay.MaxExtent = MaxExtents.OsmMaps;
mapView.Overlays.Add(“World”, layerOverlay);
CadFeatureLayer cadFeatureLayer = new CadFeatureLayer(@“D:\Tickets\Cad_data\Cad_data.dwg”);
string proj4String = Projection.ConvertWktToProjString(System.IO.File.ReadAllText(@“D:\Tickets\Cad_data\Cad_data.prj”));
ProjectionConverter projectionConverter = new ProjectionConverter(proj4String, 3857);
projectionConverter.Open();
cadFeatureLayer.FeatureSource.ProjectionConverter = projectionConverter;
// cadFeatureLayer.Open();
var extent = await Task.Run(() => OpenLayer(cadFeatureLayer));
layerOverlay.Layers.Add(cadFeatureLayer);
mapView.CurrentExtent = cadFeatureLayer.GetBoundingBox();
mapView.Refresh();
}

    public async Task<RectangleShape> OpenLayer(CadFeatureLayer _layer)
    {
        _layer.Open();
        return _layer.GetBoundingBox();
    }

Let me know if you have more questions.

Thanks

Frank

Hi Frank,

thank you for answer. I tried proposed solution and it does not improve performance. SingleTile still dramatically decreases performance during load and makes any panning of the already displayed map to freeze UI for 2-3 seconds.

Tough, since I got my solution already (MultiTiles), I will not pursue this case any longer. So it is just for your information. If you need any further information on this case, I can supply it to you.

With kind regards
Alexey

Thanks Alex,
SingleTile may take more time to draw since it contain more items than each small tile. And you will get response after one tile drawn. so we will feel MultiTiles faster. Anyway we will look into the SingleTile drawing performance. And let you know if we can do some enhancement.

Thanks

Frank