java mapscript map annotations

Steve Lime Steve.Lime at DNR.STATE.MN.US
Thu Aug 31 13:14:33 EDT 2006


Symbols and annotation are scalable. See the SYMBOLSCALE layer
property.
Basically you set a reference scale at which no scaling is applied and
from
there stuff gets bigger or smaller accordingly. With MINSIZE/MAXSIZE
you
can set bounds so a symbol or text does not become too large or small.

Another option is setting SIZEUNITS. This applies to symbols only but
computes the SIZE of marker based on the cellsize of the map so a
feature
could always be, say, 5 miles wide.

Steve

>>> mikiet <mike.talbutt at DOTTEDEYES.COM> 8/31/2006 10:15:34 AM >>>
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