[Mapserver-users] Label/Classes Items

Fernando S. simon at inf.univali.br
Tue May 4 07:59:00 PDT 2004


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

Hi,  
    I am with some problems with label items. I have one layer with two 
classes and I don't have data because I NEED to use FEATURE.
    Well, I'm using mapscript to set and add the feature, this items are 
draw correctly, they appear in the map. They are drawed using first 
class definitions.
    Now I need to set correctly the class using mapscript. I tried to 
set the classindex in "ms_newShapeObj", the same that I use in 
"addFeature". I set this value before I execute "addFeature". But the 
data always drawed by first class. When I execute an echo before set the 
classindex was show 0 and after I changed, was show the value that I 
set, but always the feature it's drawed by first class. I changed the 
values to many options (1, 2, 3....) but without effect.
    I can't to define one EXPRESSION in class because I don't have 
anything to define. The feature (shapeObj) only support to change two 
attributes "text" and "classindex". Text to label and index to class, 
correct?

    I used this layer:

layer
    name 'test'
    type point
    status off
    labelcache on
    class
        symbol 'coleta'
        color 255 0 0
        outlinecolor 255 255 255
        size 10
        label
            antialias on            
            color 255 255 255
            outlinecolor 0 0 0
            buffer 2
            font verdana
            type truetype
            force false
            size 8
            position ll
        end            
    end
    class      
        color 0 0 0
        outlinecolor 255 255 255
        symbol 'sede'
        size 10
        label
            antialias on
            color 125 255 155
            outlinecolor 125 0 123
            buffer 2
            font verdana
            type truetype
            force true
            size 8
            position cc
        end            
    end
end  

    I changed many values in this layer, labelcache, force, 
position...... but always the same efect. First class.

    And I use this mapscript code:

        if ($layer_name == 'test')
        {           
            ociConectar();  //Connect to database
            ociExecutar( $pesq_faz_suinos);  //Execute the query
            $p = ms_newpointObj();
            while (list($cd_fornecedor, $x, $y ) = ociTupla())
            {     
                    $p->setXY($x, $y);                   
                    if ($circle->contains($p))
                    {
                          isset($ShapePonto);
                          isset($Ponto);
                       
                          $Ponto = ms_newLineObj();
                          $Ponto->addXY( $x, $y );
                          $ShapePonto = ms_newShapeObj( MS_SHAPE_POINT );
                          $ShapePonto->add( $Ponto );
                                                   
                          echo $ShapePonto->classindex; //Show 0
                          echo $layer->numclasses; //Show 2
                          $ShapePonto->set('classindex',1);
                          echo $ShapePonto->classindex; //Show 1
                         
                          $ShapePonto->set('text',$cd_fornecedor);
                          $layer->addFeature( $ShapePonto );
                          echo $ShapePonto->classindex; //Show 1
                       
                           $Ponto->free();
                           $ShapePonto->free();                       
                           unset($Ponto);
                           unset($ShapePonto);
                    }                  
            }
        }

    Now, how I can do to set the indexclass correctly?How I can change 
betwen the class using Mapscript?
    I'm using version 4.02.

    Sorry my poor english.
    Thank's for help.

==================================================================
Fernando Simon
DataBase Manager, Mapserver, OracleSpatial and PostGis Developer
G10 - Laboratório de Computação Aplicada
MapOracleSpatial developer
http://g10.cttmar.univali.br
==================================================================

--------------050707070105030603090803
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,   <br>
    I am with some problems with label items. I have one layer with two
classes and I don't have data because I NEED to use FEATURE. <br>
    Well, I'm using mapscript to set and add the feature, this items
are draw correctly, they appear in the map. They are drawed using first
class definitions. <br>
    Now I need to set correctly the class using mapscript. I tried to
set the classindex in "ms_newShapeObj", the same that I use in
"addFeature". I set this value before I execute "addFeature". But the
data always drawed by first class. When I execute an echo before set
the classindex was show 0 and after I changed, was show the value that
I set, but always the feature it's drawed by first class. I changed the
values to many options (1, 2, 3....) but without effect.<br>
    I can't to define one EXPRESSION in class because I don't have
anything to define. The feature (shapeObj) only support to change two
attributes "text" and "classindex". Text to label and index to class,
correct?<br>
<br>
    I used this layer:<br>
<br>
layer<br>
    name 'test'<br>
    type point<br>
    status off<br>
    labelcache on<br>
    class<br>
        symbol 'coleta'<br>
        color 255 0 0<br>
        outlinecolor 255 255 255<br>
        size 10<br>
        label<br>
            antialias on            <br>
            color 255 255 255<br>
            outlinecolor 0 0 0<br>
            buffer 2<br>
            font verdana<br>
            type truetype<br>
            force false<br>
            size 8<br>
            position ll<br>
        end            <br>
    end<br>
    class       <br>
        color 0 0 0<br>
        outlinecolor 255 255 255<br>
        symbol 'sede'<br>
        size 10<br>
        label<br>
            antialias on<br>
            color 125 255 155<br>
            outlinecolor 125 0 123<br>
            buffer 2<br>
            font verdana<br>
            type truetype<br>
            force true<br>
            size 8<br>
            position cc<br>
        end            <br>
    end<br>
end   <br>
<br>
    I changed many values in this layer, labelcache, force,
position...... but always the same efect. First class.<br>
<br>
    And I use this mapscript code:<br>
<br>
        if ($layer_name == 'test')<br>
        {            <br>
            ociConectar();  //Connect to database<br>
            ociExecutar( $pesq_faz_suinos);  //Execute the query<br>
            $p = ms_newpointObj();<br>
            while (list($cd_fornecedor, $x, $y ) = ociTupla()) <br>
            {      <br>
                    $p->setXY($x, $y);                    <br>
                    if ($circle->contains($p))<br>
                    {<br>
                          isset($ShapePonto);<br>
                          isset($Ponto);<br>
                        <br>
                          $Ponto = ms_newLineObj();<br>
                          $Ponto->addXY( $x, $y );<br>
                          $ShapePonto = ms_newShapeObj( MS_SHAPE_POINT
);<br>
                          $ShapePonto->add( $Ponto );<br>
                                                    <br>
                          echo $ShapePonto->classindex; //Show 0<br>
                          echo $layer->numclasses; //Show 2<br>
                          $ShapePonto->set('classindex',1); <br>
                          echo $ShapePonto->classindex; //Show 1<br>
                          <br>
                          $ShapePonto->set('text',$cd_fornecedor);<br>
                          $layer->addFeature( $ShapePonto );<br>
                          echo $ShapePonto->classindex; //Show 1<br>
                        <br>
                           $Ponto->free();<br>
                           $ShapePonto->free();                   
    <br>
                           unset($Ponto);<br>
                           unset($ShapePonto);<br>
                    }                   <br>
            }<br>
        }<br>
<br>
    Now, how I can do to set the indexclass correctly?How I can change
betwen the class using Mapscript?<br>
    I'm using version 4.02.<br>
<br>
    Sorry my poor english.<br>
    Thank's for help.<br>
<br>
<font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">==================================================================
<br>
Fernando Simon<br>
DataBase Manager, Mapserver, OracleSpatial and PostGis Developer <br>
G10 - Laboratório de Computação Aplicada<br>
MapOracleSpatial developer <br>
<a href="http://g10.cttmar.univali.br">http://g10.cttmar.univali.br</a>
<br>
==================================================================</span></font><br>
</body>
</html>

--------------050707070105030603090803--



More information about the MapServer-users mailing list