[Mapserver-dev] Antialiasing State of Affairs

Tomas Krecmer tokr at tmapy.cz
Fri Sep 10 02:21:06 EDT 2004


This is a multi-part message in MIME format.
--------------070703080404090405020109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Cartolines were developed about 2 years ago(?). Here is a documentation 
part for a symbology with cartoline additions. I posted it twice in the 
last year to documentation team, but there is no answer ;-|. If you have 
problems or questions about that please ask me and add it to bugzilla of 
course.

The first purpose was to have options for drawing line caps and joins. 
Antialias was added consequently after GD2 came. As far as I know there 
is a few cartoline users around the world. They've got a documentation 
from me directly.
 

Tomas


Titus von der Malsburg wrote:

>Hi,
>
>yesterday I spend a hard time to figure out how antialiased rendering
>with gd works in Mapserver (including: a lot of reading in mapdraw.c,
>mapgd.c and friends).  Finally I got it working.  Now I have some
>questions:
>
>1.a) Since I get a lot of segfaults, I wonder how developed the
>code may be.  Are there only a few minor bugs or is this cartoline stuff
>more like a feasibility study?
>
>1.b) Drawing antialiased lines works only for lines with a thickness of
>one pixel.  Thicker lines look odd.  Is gd responsible for
>that or is it due to deficiencies of the cartoline code?
>
>2.a) Are there good reasons why one would want to have three
>spereate techical concepts for lines (normal, dashed lines with symbols,
>cartoline)?
>
>2.b) Would it be a good idea to unify these?
>
>3.) How much work would it be to
> * to make cartoline rendering stable,
> * to realize the unification of the line concepts?
>
>4.) Is there anyone working on this currently?  Is there any interest in
>these things at all?
>
>
>Thanks,
>	Titus
>_______________________________________________
>Mapserver-dev mailing list
>Mapserver-dev at lists.gis.umn.edu
>http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev
>
>  
>

-- 
Tomas Krecmer, tomas.krecmer at tmapy.cz
T-MAPY spol. s r.o., Nezvalova 850, 500 03 Hradec Kralove,
Czech Republic, phone: + 420 49 5513335 , fax + 420 49 5513371


--------------070703080404090405020109
Content-Type: text/html;
 name="symbol-cartoline.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="symbol-cartoline.html"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type"
 content="text/html; charset=ISO-8859-1">
  <title>MapFile Reference - MapServer 4.0</title>
  <meta name="generator" content="DocBook XSL Stylesheets V1.50.0">
  <script xmlns="http://www.w3.org/TR/xhtml1/transitional"
 language="javascript" src="../javascript/include.js"></script>
</head>
<body bgcolor="white" text="black" link="#0000ff" vlink="#840084"
 alink="#0000ff" marginheight="0" marginwidth="0" style="">
<script xmlns="http://www.w3.org/TR/xhtml1/transitional"
 language="javascript">
  header("doc");
  comment();
  </script>
<div class="article">
<div>
<h3 class="title">Style Object</h3>
<p>This
object holds parameters for symbolization. Multiple styles may be
applied within a class. This object is new in 4.0 and is intended to
seperate logic from looks. The final intent is to have named styles
(Not yet supported) that will be re-usable through the mapfile. This is
the new, preferred way of defining the appearance of an object, notably
a class.</p>
<div class="variablelist">
<dl>
  <dt><span class="term">ANTIALIAS [true|false]</span></dt>
  <dd>
    <p>Should TrueType fonts <span style="color: rgb(255, 0, 0);">and
Cartoline symbols </span>be antialiased. <br>
    </p>
  </dd>
  <dt><span class="term">BACKGROUNDCOLOR [r] [g] [b]</span></dt>
  <dd>
    <p>Color to use for non-transparent symbols.</p>
  </dd>
........................................................<br>
  <br>
  <br>
</dl>
</div>
<h2 class="title"><a name="symbology"></a>Symbology Reference</h2>
</div>
<div class="sect1">
<p>This section explains how to work with and define symbology in
MapServer.</p>
<div class="sect2">
<div class="titlepage">
<div>
<h3 class="title"><a name="d45e1642"></a>Notes</h3>
</div>
</div>
<div class="itemizedlist">
<ul type="disc">
  <li>
    <p>Symbol definitions can be included within the main MapFile or,
more commonly, in a separate file. Symbol definitions in a separate
file are designated using the <a href="#symbolset">SYMBOLSET</a>
keyword, as part of the <a href="#map" title="Map Object">Map Object</a>.
This recommended setup is ideal for re-using symbol definitions across
multiple MapServer applications.</p>
  </li>
  <li>
    <p>There are 3 main types of symbols in MapServer: Markers,
Shadesets, and Lines.</p>
  </li>
  <li>
    <p>Symbol 0 is always the degenerate case for a particular class of
symbol. For points, symbol 0 is a single pixel, for shading (i.e.
filled polygons) symbol 0 is a solid fill, and for lines, symbol 0 is a
single pixel wide line.</p>
  </li>
  <li>
    <p>Symbol definitions contain <span class="emphasis"><em>no</em></span>
color information, colors are set within <a href="#class"
 title="Class Object">CLASS</a> objects.</p>
  </li>
  <li>
    <p>There is a maximum of 64 symbols per file. This can be changed
by editing mapsymbol.h and changing the value of MS_MAXSYMBOLS at the
top of the file.</p>
  </li>
</ul>
</div>
</div>
<div class="sect2">
<div class="titlepage">
<div>
<h3 class="title"><a name="d45e1673"></a>Syntax</h3>
</div>
</div>
<div class="variablelist">
<dl>
  <dt><span class="term">ANTIALIAS [true|false]</span></dt>
  <dd>
    <p>Should TrueType fonts be antialiased.</p>
  </dd>
  <dt><span class="term">CHARACTER [char]</span></dt>
  <dd>
    <p>Character used to reference a particular TrueType font
character. You'll need to figure out the mapping from the keyboard
character to font character.</p>
  </dd>
  <dt><span class="term">FILLED [true|false]</span></dt>
  <dd>
    <p>Sets the symbol to be filled with a user defined color (See the <a
 href="#class" title="Class Object">CLASS</a> object). For marker
symbols, if <a href="#outlinecolor">OUTLINECOLOR</a> was specified
then the symbol is outlined with it.</p>
  </dd>
  <dt><span class="term">FONT [string]</span></dt>
  <dd>
    <p>Name of TrueType font to use as defined in the <a
 href="#fontset">FONTSET</a>.</p>
  </dd>
  <dt><span class="term">GAP [int]</span></dt>
  <dd>
    <p>Given in pixels. This defines a distance between symbols for
TrueType lines.</p>
  </dd>
  <dt><span class="term">IMAGE [string]</span></dt>
  <dd>
    <p>Image (GIF or PNG) to use as a marker or brush for type PIXMAP
symbols.</p>
  </dd>
  <dt><span class="term">NAME [string]</span></dt>
  <dd>
    <p>Alias for this font to be used in CLASS objects</p>
  </dd>
  <dt style="color: rgb(255, 0, 0);"><span class="term">LINECAP
[butt|round|square|triangle]</span></dt>
  <dd style="color: rgb(255, 0, 0);">
    <p>Sets the line cap type for the cartoline symbol. Default is
butt. Works with the CARTOLINE symbol only!<br>
    </p>
  </dd>
  <dt style="color: rgb(255, 0, 0);"><span class="term">LINEJOIN
[round|miter|bevel]</span></dt>
  <dd style="color: rgb(255, 0, 0);">
    <p>Sets the line join type for the cartoline symbol. Default is
"none" - lines will not be joined . Works with the CARTOLINE symbol
only!</p>
  </dd>
  <dt style="color: rgb(255, 0, 0);"><span class="term">LINEJOINMAXSIZE
[num]</span></dt>
  <dd style="color: rgb(255, 0, 0);">
    <p>Sets the max length of the miter line join type. The value
represents a coefficient which multitplies a current symbol size. Default
is 3. Works with the CARTOLINE symbol only!</p>
  </dd>
  <dt><span class="term">POINTS [x y] [x y] ... END<br>
    </span></dt>
  <dd>
    <p>Signifies the start of the definition of points that make up a
vector symbol or that define the x and y radius of an ellipse symbol.
The end of this section is signified with the keyword END. Coordinates
are given in pixels and define the default size of the symbol before
any scaling. You can create non-contiguous paths by inserting negative
coordinates at the appropriate place. For ellipse symbols you provide a
single point that defines the x and y radius of an ellipse. Circles are
created when x and y are equal.</p>
  </dd>
  <dt><span class="term">STYLE [num on] [num off] [num on] ... END</span></dt>
  <dd>
    <p>Defines a dash style or pattern.</p>
  </dd>
  <dt><span class="term">TRANSPARENT [color index]</span></dt>
  <dd>
    <p>Sets a transparent color for the input GIF image for pixmap
symbols, or determines whether all shade symbols should have a
transparent background. For shade symbols it may be desirable to have
background features "show through" a transparent hatching pattern,
creating a more complex map. By default a symbol's background is the
same as the parent image (i.e. color 0). This is user configurable.</p>
  </dd>
  <dt><span class="term">TYPE [vector|ellipse|pixmap|truetype|simple<span
 style="color: rgb(255, 0, 0);">|cartoline</span>]</span></dt>
  <dd>
    <p> </p>
    <div class="itemizedlist">
    <ul type="disc">
      <li>
        <p>vector: a simple drawing is used to define the shape of the
symbol.</p>
      </li>
      <li>
        <p>ellipse: radius values in the x and y directions define an
ellipse.</p>
      </li>
      <li>
        <p>pixmap: a user supplied GIF image will be used as the symbol.</p>
      </li>
      <li>
        <p>truetype: TrueType font to use as defined in the <a
 href="#fontset">FONTSET</a>.</p>
      </li>
    </ul>
    </div>
    <p></p>
  </dd>
</dl>
</div>
</div>
<div class="sect2">
<div class="titlepage">
<div>
<h3 class="title"><a name="examples"></a>Examples</h3>
</div>
</div>
<p>Here are some examples illustrating the various ways to create
symbols in MapServer:</p>
<div class="example">
<p class="title"><b>Example 3. Dashed Line</b></p>
<pre class="programlisting">SYMBOL<br>  NAME 'dashed1'<br>  TYPE ELLIPSE<br>  POINTS 1 1 END<br>  FILLED true<br>  STYLE 10 5 5 10 END<br>END<br></pre>
<p>This creates a dashed line with 10 pixels on, 5 off, 5 on, 10 off ...</p>
</div>
<div class="example">
<p class="title"><b>Example 4. TrueType font marker symbol</b></p>
<pre class="programlisting">SYMBOL<br>  NAME "natcap"<br>  TYPE TRUETYPE<br>  FONT geo<br>  FILLED true<br>  ANTIALIAS true<br>  CHARACTER "&amp;#114;"<br>END<br>					</pre>
<p>This symbol is a star, used to represent the national capital, hence
the name. The font name in defined in the <a href="#fontset">FONTSET</a>
file. The code number "114" varies, you can use MS Windows' character
map to figure it out, or guestimate.</p>
</div>
<div class="example">
<p class="title"><b>Example 5. Vector triangle marker symbol</b></p>
<pre class="programlisting">SYMBOL<br>  NAME "triangle"<br>  TYPE vector<br>  POINTS<br>    0 4<br>    2 0<br>    4 4<br>    0 4<br>  END<br>END<br>				</pre>
<p>This is fairly straight forward. Note that to have 3 sides you need
4 points, hence the first and last points are identical.</p>
</div>
<div class="example">
<p class="title"><b>Example 6. Non-contiguous vector marker symbol
(Cross)</b></p>
<pre class="programlisting">SYMBOL<br>  NAME "cross"<br>  TYPE vector<br>  POINTS<br>    2 0<br>    2 4<br>    -99 -99<br>    0 2<br>    4 2<br>  END <br>END<br>				</pre>
<p>This example draws a cross, that is 2 lines (vectors) that are not
connected end-to-end (Like the triangle in the previous example). The
negative values separate the two.</p>
</div>
<div class="example">
<p class="title"><b>Example 7. Circle vector symbol</b></p>
<pre class="programlisting">SYMBOL<br>  NAME "circle"<br>  TYPE ellipse<br>  FILLED true<br>  POINTS<br>    1 1<br>  END<br>END<br>				</pre>
<p>A simple filled circle. Using non-equal values for the point will
give you an actual ellipse.</p>
</div>
<div class="example">
<p class="title"><b>Example 8. Downward diagonal fill</b></p>
<pre class="programlisting">SYMBOL   <br>  NAME "downwarddiagonalfill"<br>  TYPE vector<br>  TRANSPARENT 0<br>  POINTS<br>    0 1<br>    1 0<br>  END   <br>END<br>			</pre>
<div class="example" style="color: rgb(255, 0, 0);">
<p class="title" style="font-weight: bold;">Example 9. Dashed Cartoline
symbol
</p>
<pre class="programlisting">SYMBOL   <br>  NAME "cartoline"<br>  TYPE cartoline<br>  LINECAP butt<br>  LINEJOIN miter<br>  LINEJOINMAXSIZE 1<br>  STYLE 10 5<br>END<br><br></pre>
This creates a dashed line with 10 pixels on, 5 off,... The line will
have butt caps and short miter joins. For layers with a scaled symbol
(SYMBOLSCALE, MINSIZE, MAXSIZE, ...) will be the STYLE&nbsp; resized to
maintain symbol ratios.<br>
<br>
</div>
</div>
</div>
</div>
</div>
<table xmlns="http://www.w3.org/TR/xhtml1/transitional" align="center"
 width="75%" border="1">
  <tbody>
    <tr>
      <td bgcolor="#ffff66"><a href="javascript:add_comment()"><font
 size="+1">Add a Comment</font></a></td>
    </tr>
<!--#include file=".txt"-->
  </tbody>
</table>
<script xmlns="http://www.w3.org/TR/xhtml1/transitional"
 language="javascript">doc_footer();</script>
</body>
</html>

--------------070703080404090405020109--



More information about the mapserver-dev mailing list