[mapguide-users] Regarding - Set Feature Label at Run Time

ravinder.singh at BIRLASOFT.COM ravinder.singh at BIRLASOFT.COM
Thu Mar 5 06:25:41 EST 2009


Hi,

 

I have tried it and written the following code. It works if I
check(select) the Display feature Labels in Label Style Dialog Box(in
maestro) and even don't set any property, but It does not work if I
don't check the Display feature Labels. 

 

Means if there is text "None"  set in Label Style  in Area Style then it
does not work , otherwise it works by simply checking the Display
feature Labels in Label Style Dialog Box.

 

That's why in your example code, this code "if (ar.Label != null)" is
written.

 

But my problem is that I do have Only Area style defined in maestro ,
but I have not defined any property as feature label. So I don't want to
check the  Display feature Labels checkbox, To Generate the dynamic
label I tried to write my commented line of code (c#), but does not
work.

 

Please If can be done ?

 

  foreach (VectorScaleRangeType vsr in
vectorLayerDefinition1.VectorScaleRange)

            {

                foreach (object o in vsr.Items)

                {

                    if (o is AreaTypeStyleType)

                    {

                        AreaTypeStyleType ast = o as AreaTypeStyleType;

                        if (ast.AreaRule != null)

                        {

                            foreach (AreaRuleType ar in ast.AreaRule)

                            {

                                      //Code to Create the label at run
time

   //====================================

                                //TextSymbolType txtSymb = new
TextSymbolType();

                                //txtSymb.Text = "MY_PROPERTY_NAME";

                                //ar.Label = txtSymb;        

  //====================================                       

                                if (ar.Label != null)

                                {

                                    ar.Label.Text = "MY_PROPERTY_NAME ";

                                }

                            }

                        }

                    }

                }

            }                        

 

Thanks & Regards,

Ravinder

________________________________

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kenneth
Skovhede, GEOGRAF A/S
Sent: Thursday, March 05, 2009 1:12 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] Regarding - Set Feature Label at Run Time

 

That is a bit difficult for two reasons.
1) The MapGuide style model is fairly large, so there are many subitems
to examine
2) The styles for Point, Line and Area don't share the same properties,
so they must be handled individually.

I have put up an example on how to do this here:
http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/IterateLa
yerRules




Regards, Kenneth Skovhede, GEOGRAF A/S



ravinder.singh at BIRLASOFT.COM skrev: 

Hi All,

 

I have to set a property as Feature Label for a layer at run time. I got
some hints and tried with VectorLayerDefinitionType and
TextSymbolType.But not able to do so as I don't know the exact
procedure.

 

I am using maestro api for creating run time map.

 

Please assist...

 

I am using c#, asp.net.

 

 

Thanks & Regards,

Ravinder

 

************************************************************************
************************************************************************
*********************%CRLF%"This message and any attachments are solely
for the intended recipient and may contain Birlasoft confidential or
privileged information. If you are not the intended recipient,any
disclosure,copying, use, or distribution of the information included in
this message and any attachments is %CRLF%prohibited. If you have
received this communication in error, please notify us by reply e-mail
at (administrator at birlasoft.com) and permanently delete this message and
any attachments. Thank
you."%CRLF%*************************************************************
************************************************************************
********************************%CRLF%
 



________________________________



 
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
  

*********************************************************************************************************************************************************************%CRLF%"This message and any attachments are solely for the intended recipient and may contain Birlasoft confidential or privileged information. If you are not the intended recipient,any disclosure,copying, use, or distribution of the information included in this message and any attachments is %CRLF%prohibited. If you have received this communication in error, please notify us by reply e-mail at (administrator at birlasoft.com) and permanently delete this message and any attachments. Thank you."%CRLF%*********************************************************************************************************************************************************************%CRLF%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090305/b93c0aa8/attachment.html


More information about the mapguide-users mailing list