java mapscript map annotations

mikiet mike.talbutt at DOTTEDEYES.COM
Thu Aug 31 11:15:34 EDT 2006


There are 2 reasons why I did not want to accomplish this using a symbol.
Firstly when I annotate a map with a circle I want to be able to specify the
radius of that circle, so when I zoom in and out of the map the size of the
annotation will change correspondingly. If I use a symbols as I zoom in and
out of the map the size of the circle remains constant regardless of the
maps zoomwidth. 

Secondly if I wanted to produce an ellipse I could not work out how to
change the appearance of the symbol, presumably I read the symbol and alter
the points, however when I did this it did not change the way the symbol was
rendered on the screen. 

I have got round this problem by creating a polygon then represents my
circle/elipse with the code below, I just wondered if I was doing something
overly complicated for what should be a simple operation

shapeObj shape = new shapeObj(MS_SHAPE_TYPE.MS_SHAPE_POLYGON);
lineObj line = new lineObj();
for (double w = 0.0; w <= 2*Math.PI; w = w+0.1){
double x = (iRadius * Math.cos(w)) + dX;
	double y = (iRadius * Math.sin(w)) + dY;
	pointObj point = new pointObj(x, y, 0d);
	line.add(point);
}
double x = (iRadius * Math.cos(0)) + 295785d;
double y = (iRadius * Math.sin(0)) + 260734d;
pointObj point = new pointObj(x, y, 0d);
line.add(point);
shape.add(line);
mapobject.getLayerByName(layerName).addFeature(shape);


Umberto Nicoletti wrote:
> 
> On 8/31/06, mikiet <mike.talbutt at dottedeyes.com> wrote:
>> Hi there,
>>
>> I am new to mapserver and am using java mapscript to create a new
>> application. I have found documentation on java mapscript prettu hard to
>> come by, however have managerd to get most of my application up and
>> running
>> pretty quickly.
>>
>> Hoever I've fallen into problems annotation the map. My application needs
>> to
>> be able to annonate the map with rectangles, circles and ellipses.
>> rectangles were easy, I simply created a new lineObj and added the points
>> for my rectangle, create a shapeObj adding my lineObj  to it and then
>> added
>> my shape to the layer as an feature.
>>
>> Hoever how would I do this with a circle ?, in previose examples when I
>> have
>> rendered  points on a map as circles I have created a circle symbol in my
>> .sym file and applied that symbol to the features, however in my
>> application
>> when I draw the circle I need to be able to specify the radius. Also I
>> would
>> prefer the circle annonation to actually be a circle rather then a point
>> using a circle symbol to render it.
> 
> Doesn't setting the symbol size accomplish exactly this?
> 
> Umberto
> 
>>
>> Any help or pointers to documentation would be greatfully appreciated
>> --
>> View this message in context:
>> http://www.nabble.com/java-mapscript-map-annotations-tf2195520.html#a6075867
>> Sent from the Mapserver - Dev forum at Nabble.com.
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/java-mapscript-map-annotations-tf2195520.html#a6081496
Sent from the Mapserver - Dev forum at Nabble.com.



More information about the mapserver-dev mailing list