scalebar-problem with csharp-mapscript
Christian Wilmes
C.Wilmes at GMX.DE
Mon Jun 19 09:41:26 PDT 2006
Hi Tamas,
thanks for your quick response. I tried it out, but there are still the same exeptions.
My new code:
scalebarObj scalebar = myMap.scalebar;
labelObj labelScalebar = scalebar.label;
labelScalebar.size = 12;
labelScalebar.type = MS_FONT_TYPE.MS_BITMAP;
labelScalebar.color = new colorObj(255, 0, 255, 0);
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;
Best Regards
Christian
-------- Original-Nachricht --------
Datum: Mon, 19 Jun 2006 18:08:09 +0200
Von: Tamas Szekeres <szekerest at GMAIL.COM>
An: MAPSERVER-USERS at LISTS.UMN.EDU
Betreff: Re: [UMN_MAPSERVER-USERS] scalebar-problem with csharp-mapscript
> Christian,
>
> scalebarObj is added to the map by default and also the labelObj is
> added to the scalebar so you should use these objects in the following
> way:
>
> scalebarObj scalebar = myMap.scalebar;
> 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;
> labelObj labelScalebar = scalebar.label;
> labelScalebar.size = 12;
> labelScalebar.type = MS_FONT_TYPE.MS_BITMAP;
> labelScalebar.color = new colorObj(255, 0, 255, 0);
>
> This problem is related to the following bug:
> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1803
>
> You should also avoid to use the object members mentioned there as
> writeable properties.
>
> Best Regards,
>
> Tamas
>
>
>
> 2006/6/19, Christian Wilmes <C.Wilmes at gmx.de>:
> > 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
> >
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
More information about the MapServer-users
mailing list