CSharp-Mapscript: setSymbolSet doesn't work?!

Tamas Szekeres szekerest at GMAIL.COM
Tue Jul 18 18:57:19 EDT 2006


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
>



More information about the mapserver-users mailing list