scalebar-problem with csharp-mapscript
Christian Wilmes
C.Wilmes at GMX.DE
Mon Jun 19 07:32:51 PDT 2006
Hi All,
if I try to add a scalebar to my map I get exceptions.The code for the scalebar:
labelObj labelScalebar = new labelObj();
labelScalebar.size = 12;
labelScalebar.type = MS_FONT_TYPE.MS_BITMAP;
labelScalebar.color = new colorObj(255, 0, 255, 0);
scalebarObj scalebar = new scalebarObj();
scalebar.height = pictureBoxScalebar.Height;
scalebar.width = pictureBoxScalebar.Width;
scalebar.intervals = 5;
scalebar.label = labelScalebar;
scalebar.position = (int)MS_LABEL_POSITIONS.MS_UL;
scalebar.style = 0; //0 or 1
scalebar.status = mapscript.MS_EMBED;
scalebar.units = (int)MS_UNITS.MS_KILOMETERS;
myMap.scalebar = scalebar;
Using myMap.drawScalebar() I get the following exception:
System.ApplicationException was unhandled
Message="msGetBitmapFont(): GD library error. Invalid bitmap font. Must be one of tiny, small, medium, large or giant."
Source="mapscript_csharp"
StackTrace:
at mapObj.drawScalebar()
at GeoDataPipelineViewer.GDPV.RefreshMap() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\GDPV.cs:line 415
at GeoDataPipelineViewer.GDPV.showMap() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\GDPV.cs:line 385
at GeoDataPipelineViewer.GDPV..ctor() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\GDPV.cs:line 45
at GeoDataPipelineViewer.Program.Main() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\Program.cs:line 19
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Using MyMap.draw() I get the following Exception:
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="mapscript_csharp"
StackTrace:
at mapscriptPINVOKE.mapObj_draw(HandleRef jarg1)
at mapObj.draw()
at GeoDataPipelineViewer.GDPV.RefreshMap() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\GDPV.cs:line 400
at GeoDataPipelineViewer.GDPV.showMap() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\GDPV.cs:line 385
at GeoDataPipelineViewer.GDPV..ctor() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\GDPV.cs:line 45
at GeoDataPipelineViewer.Program.Main() in C:\src\Visual Studio 2005\Projects\GeoDataPipelineViewer\GeoDataPipelineViewer\Program.cs:line 19
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I think the problem is the label, like it is described in the first exception but how could I set the bitmap-font, and where can I find a enum for that or some constants like MS_MEDIUM?
Or is there just another reason why that doesn't work?
Best Regards
Christian
--
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl
More information about the MapServer-users
mailing list