I am using recent version of TMSFNCMaps with Delphi 13 and keep getting a range check error when trying to implement colouring and opacity for polygons loaded from a GeoJSON file. Current code is:
try
TMSFNCMaps1.BeginUpdate;
TMSFNCMaps1.Polygons.Clear;
TMSFNCMaps1.Clear;
TMSFNCMaps1.LoadGeoJSONFromFile(JSONfileName,true,false);
for iPoly := 1 to TMSFNCMaps1.Polygons.Count do
begin
PPoly := TMSFNCMaps1.Polygons[iPoly-1];
PPoly.StrokeColor := claBlueViolet;
PPoly.StrokeOpacity := 0.3;
PPoly.StrokeWidth := 2;
PPoly.FillColor := claWhite;
PPoly.FillOpacity := 0.0;
end;
finally
TMSFNCMaps1.EndUpdate;
end;
PPoly is defined to be of type TTMSFNCMapsPolygon.
If I omit the for loop, the polygon dataset loads and plots with opaque white fill and black outlines. The for loop will execute as long as I comment out all the PPoly.something statements.
Am I missing some command? The range check is not related to the iPoly value from anything I have tried.
We have not been able to reproduce the issue you reported.
This is likely related to the specific GeoJSON file you are using.
Can you please provide a GeoJSON file that is causing the issue for you so we can investigate this further?
Test program tries to load one of the GeoJSON file from button 5 and to colour/opacity them and tries to clear and load a second file from button6 with colouring, opacity, etc.
While looking at this, please could you also comment on the best way to clear all content in an exisitng FNCMaps item before loading new content.
Hello Bart
this is weird because the same program won't display any polygon for me. This includes when changing the colour code as you suggested. I have tried running as 32 bit and get an out of memory error when testing with madexcept and things just freeze when omitting madexcept. 64 bit freezes whatever te case.
Any suggestions for other things to look for since it must be something related to the entire environment, not just my code.
I don't understand this behaviour but document it in case others also have issues.
Thus far I have been using the 32 bit version of Delphi 13.0 with FMX. When I try to run as a 32 bit app, the app crashes. When I try to run the app as 64 bit from the 32 bit Delphi IDE, the app freezes. However, when I run the app from the 64 bit Delphi version, the app works as expected.
So, I will just have to use the 64 bit version of Delphi in future.
If anybody has any explanation for this unusual behaviour, I would be keen to understand what is happening.
Bart, thanks for your help and for proving it was something unusual for what should be a very simple app.