CSharp-Mapscript: setSymbolSet doesn't work?!
Christian Wilmes
C.Wilmes at GMX.DE
Thu Jul 20 07:34:13 PDT 2006
Hi,
I could not find a soluötion for solving my problem. So I created a simple Exampels with VS2005. The examples uses a Point-Shape which is together with everything else in the zip-File. I tried it out with new Layer(myMap) and with the myMap.insert method. Both of them doesn't work.
Best Regards
Christian
-------- Original-Nachricht --------
Datum: Wed, 19 Jul 2006 17:36:02 +0200
Von: "Tamas Szekeres" <szekerest at gmail.com>
An: "Christian Wilmes" <C.Wilmes at gmx.de>
Betreff: Re: Re: Re: [UMN_MAPSERVER-USERS] CSharp-Mapscript: setSymbolSet doesn\'t work?!
> Hi,
>
> You may also have to set the default symbol size to greater than 0,
> like for example:
>
> symbol.sizex = 0;
> symbol.sizey = 0;
>
> I would also suggest to use layerObj(mapObj map) instead of inserlayer
> to avoid an unnecessary layer copy.
>
> If the problem still persists it would be helpful if you could post a
> sample application to be able to reproduce the error and find a fix
> for it.
>
> Best Regards,
>
> Tamas
>
>
> 2006/7/19, Christian Wilmes <C.Wilmes at gmx.de>:
> > Hi,
> >
> > thanks for your quick response Tamas, but the symbols don't work up to
> now.
> >
> > Normaly it should work with the gif-File in the parameterlist too, the
> gif-File exists on my System. But I tested it with your code for the
> symbolObj a lot of times, because that seems to be more simple. Directly before
> and after calling mapObj.draw() I saved the mapfile build by my Application.
> I tested both mapfiles in my Browser and both of them are working correct.
> I will insert the two mapfiles in this email.
> >
> > Here is my original code I use with some expressions:
> >
> > public class Controller
> > {
> > //myMapHandler is a type of the class MapHandler which handels
> Objects of the class Map. Map is a Subclass of mapObj
> > private MapHandler myMapHandler = new MapHandler();
> >
> >
> > public void InitializeLayers()
> > {
> >
> > //PipelineLayer is a Subclass from layerObj
> > //The first parameter in the Constructor is the mapObj,
> the second one the status of the Layer, the third one is the
> Connectionstring to my WFS-Server
> > //I've got good reasons for giving null in the
> parameterlist for the mapObj and using the InsertLayer-Method later.
> > //I tested it with giving directly the mapObj in the
> constructor, it also doesn't work
> > PipelineLayer trajektorie = new PipelineLayer(null,
> true, "http://localhost/cgi-bin/mapserv.exe?");
> >
> > //Building the Symbol:
> > symbolObj symbol = new symbolObj("mySymbol", null);
> > symbol.type = (int)MS_SYMBOL_TYPE.MS_SYMBOL_VECTOR;
> > symbol.filled = mapscript.MS_TRUE;
> > lineObj line = new lineObj();
> > line.add(new pointObj(1, 5, 0, 0));
> > line.add(new pointObj(1, 3, 0, 0));
> > line.add(new pointObj(3, 2, 0, 0));
> > line.add(new pointObj(1, 1, 0, 0));
> > line.add(new pointObj(1, 3, 0, 0));
> > symbol.setPoints(line);
> >
> >
> >
> > ´ myMapHandler.Map.SymbolSet.appendSymbol(symbol);
> >
> >
> >
> > classObj classtest = new classObj(trajektorie);
> > classtest.name = "test";
> >
> > styleObj myStyle = new styleObj(classtest);
> > myStyle.symbolname = "mySymbol";
> >
> > myStyle.size = 150;
> > myStyle.color = new colorObj(255, 0, 0, -1);
> >
> >
> myMapHandler.Map.SymbolSet.save(Environment.CurrentDirectory + @"\test.sym");
> >
> > myMapHandler.Map.InsertLayer(trajektorie, -1);
> > // the Method Refresh Map is displayed above
> > myMapHandler.Map.RefreshMap();
> > }
> > }
> >
> > public class Map : mapObj
> > {
> > :
> > :
> > public void RefreshMap()
> > {
> > Cursor.Current = Cursors.WaitCursor;
> > try
> > {
> > lock (this)
> > {
> > this.Save(Environment.CurrentDirectory +
> @"\testBefore.map");
> > using (imageObj image = this.draw())
> > {
> > this.Save(Environment.CurrentDirectory +
> @"\testAfter.map");
> > byte[] img = image.getBytes();
> > using (MemoryStream ms = new MemoryStream(img))
> > {
> > myImageHandler.ImageMap =
> Image.FromStream(ms);
> > }
> > }
> > }
> > }
> > catch (Exception ex)
> > {
> > MessageBox.Show(ex.Message + "\n" + (ex.InnerException
> != null ? ex.InnerException.Message : "")
> > , "Error", MessageBoxButtons.OK,
> MessageBoxIcon.Error);
> > }
> > finally
> > {
> > Cursor.Current = Cursors.Default;
> > }
> > }
> > :
> > :
> > }
> >
> >
> >
> > I've got no idea where else I have to search the mistake, or is it even
> possible that there is a another Bug in the mapscript who is responsible
> for that?
> >
> >
> > Best Regards
> > Christian
> > -------- Original-Nachricht --------
> > Datum: Wed, 19 Jul 2006 00:57:19 +0200
> > Von: Tamas Szekeres <szekerest at gmail.com>
> > An: Christian Wilmes <C.Wilmes at gmx.de>
> > Betreff: Re: Re: [UMN_MAPSERVER-USERS] CSharp-Mapscript: setSymbolSet
> doesn\'t work?!
> >
> > > Hi,
> > >
> > > Constructing symbolObj you are using:
> > >
> > > "symbolObj(string symbolname, string imagefile)"
> > >
> > > The second parameter - if exists - point to an image for rendering
> that
> > > symbol.
> > > In your case the followings should work:
> > >
> > > symbolObj mySymbol = new symbolObj("mySymbol", null);
> > > mySymbol.type = (int)MS_SYMBOL_TYPE.MS_SYMBOL_VECTOR;
> > > mySymbol.filled = mapscript.MS_TRUE;
> > > lineObj line = new lineObj();
> > > line.add(new pointObj(1, 5, 0, 0));
> > > line.add(new pointObj(1, 3, 0, 0));
> > > line.add(new pointObj(3, 2, 0, 0));
> > > line.add(new pointObj(1, 1, 0, 0));
> > > line.add(new pointObj(1, 3, 0, 0));
> > > mySymbol.setPoints(line);
> > > myMap.symbolset.appendSymbol(mySymbol);
> > >
> > > I haven't tested it so additional properties might be set, apologies.
> > >
> > > Tamas
> > >
> > >
> > > 2006/7/18, Christian Wilmes <C.Wilmes at gmx.de>:
> > > > Hi,
> > > >
> > > > sorry, myMapHandler.Map was my mistake. But he was only in the mail,
> I
> > > just tried to create a very simple sample. Now I've changed my code
> for
> > > using myMap.symbolset.appendSymbol but it still doesn't work:
> > > >
> > > > mapObj myMap = new mapObj("");
> > > > symbolObj symbol = new symbolObj("mySymbol", directory);
> > > > myMap.symbolSet.appendSymbol(symbol);
> > > > :
> > > > layerObj myLayer = new layerObj(null);
> > > > myLayer.name = "RosoftWFS";
> > > > myLayer.Type = MS_LAYER_TYPE.MS_LAYER_POINT;
> > > > myLayer.Connectiontype = MS_CONNECTION_TYPE.MS_WFS;
> > > > myLayer.Connection = "http://localhost/cgi-bin/mapserv.exe?";
> > > > myLayer.metadata.set("wfs_typename", "myWFS");
> > > > myLayer.metadata.set("wfs_version","1.0.0");
> > > > myLayer.metadata.set("wfs_request_method", "GET");
> > > > myLayer.metadata.set("wfs_service", "WFS");
> > > > myLayer.setProjection("EPSG:31467");
> > > >
> > > > classObj c = new classObj(myLayer);
> > > > c.name = "test";
> > > >
> > > > styleObj style = new styleObj(c);
> > > > style.symbolname = "mySymbol";
> > > > style.size = 150;
> > > > style.color = new colorObj(255, 0, 255, 0);
> > > > :
> > > > myMap.insertLayer(myLayer, -1);
> > > >
> > > >
> > > > Best Regards
> > > > Christian
> > > > -------- Original-Nachricht --------
> > > > Datum: Mon, 17 Jul 2006 23:40:09 +0200
> > > > Von: Tamas Szekeres <szekerest at GMAIL.COM>
> > > > An: MAPSERVER-USERS at LISTS.UMN.EDU
> > > > Betreff: Re: [UMN_MAPSERVER-USERS] CSharp-Mapscript: setSymbolSet
> > > doesn\'t work?!
> > > >
> > > > > Christian,
> > > > >
> > > > > I'm a bit uncertain if you have added that symbolset to your map
> > > > > (myMapHandler.Map may be another map reference :? ).
> > > > > I would prefer using myMap.symbolset.appendSymbol instead of using
> > > > > setsymbolset.
> > > > >
> > > > > If you are using constructors like "new classObj(myLayer)" and
> "new
> > > > > styleObj(c)" you might want to use mapserver 4.8.4 to avoid nasty
> heap
> > > > > corruptions and memory reference errors ;-) In that case using new
> > > > > layerObj(mymap) seems better than insertLayer since the extra
> layer
> > > > > copy is avoided.
> > > > >
> > > > > Best Regards,
> > > > >
> > > > > Tamas
> > > > >
> > > > >
> > > > >
> > > > > 2006/7/17, Christian Wilmes <C.Wilmes at gmx.de>:
> > > > > > Hi All,
> > > > > >
> > > > > > I try to display a WFS-Layer with my application but I got only
> > > small
> > > > > points instead of the symbol in my Symbolset.
> > > > > >
> > > > > > My Symbolset looks like that:
> > > > > > SYMBOLSET
> > > > > > SYMBOL
> > > > > > NAME "Fahne"
> > > > > > TYPE VECTOR
> > > > > > FILLED TRUE
> > > > > > POINTS
> > > > > > 1 5
> > > > > > 1 3
> > > > > > 3 2
> > > > > > 1 1
> > > > > > 1 3
> > > > > > END
> > > > > > END
> > > > > > END
> > > > > >
> > > > > > Some Code from the application:
> > > > > > mapObj myMap = new mapObj("");
> > > > > > myMapHandler.Map.setSymbolSet(Environment.CurrentDirectory +
> > > > > @"\test.sym");
> > > > > > :
> > > > > > layerObj myLayer = new layerObj(null);
> > > > > > myLayer.name = "RosoftWFS";
> > > > > > myLayer.Type = MS_LAYER_TYPE.MS_LAYER_POINT;
> > > > > > myLayer.Connectiontype = MS_CONNECTION_TYPE.MS_WFS;
> > > > > > myLayer.Connection = "http://localhost/cgi-bin/mapserv.exe?";
> > > > > > myLayer.metadata.set("wfs_typename", "myWFS");
> > > > > > myLayer.metadata.set("wfs_version","1.0.0");
> > > > > > myLayer.metadata.set("wfs_request_method", "GET");
> > > > > > myLayer.metadata.set("wfs_service", "WFS");
> > > > > >
> > > > > > myLayer.setProjection("EPSG:31467");
> > > > > > classObj c = new classObj(myLayer);
> > > > > > c.name = "test";
> > > > > > styleObj style = new styleObj(c);
> > > > > > style.symbolname = "Fahne";
> > > > > > style.size = 150;
> > > > > > style.color = new colorObj(255, 0, 255, 0);
> > > > > > :
> > > > > > myMap.insertLayer(myLayer, -1);
> > > > > >
> > > > > >
> > > > > > Does anybody have an idea where to find the mistake?
> > > > > >
> > > > > >
> > > > > > Best Regards
> > > > > > Christian
> > > > > > --
> > > > > >
> > > > > >
> > > > > > "Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
> > > > > > Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
> > > > > >
> > > >
> > > > --
> > > >
> > > >
> > > > "Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
> > > > Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
> > > >
> >
> > --
> >
> >
> > Echte DSL-Flatrate dauerhaft für 0,- Euro*!
> > "Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl
> >
> >
> >
--
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