Yes, that is how it's supposed to be.
If you want to assign the label style, you must set many of the required properties for a
label style object:

ar.Label = new TextSymbolType();
ar.Label.BackgroundColor = System.Drawing.Color.FromArgb(0, System.Drawing.Color.White); //Transparent
ar.Label.ForegroundColor = System.Drawing.Color.Black;
ar.Label.Unit = LengthUnitType.Points;
ar.Label.SizeX = "12";
ar.Label.SizeY = "12";
ar.Label.FontName = "Arial";

I think those are the required ones, but I have not tested it.

Regards, Kenneth Skovhede, GEOGRAF A/S



[email protected] skrev:

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:* [email protected] [mailto:[email protected]] *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/IterateLayerRules


Regards, Kenneth Skovhede, GEOGRAF A/S



[email protected] <mailto:[email protected]> 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 ([email protected] 
<mailto:[email protected]>) and permanently delete this message and any 
attachments. Thank 
you."%CRLF%*********************************************************************************************************************************************************************%CRLF%


------------------------------------------------------------------------


_______________________________________________
mapguide-users mailing list
[email protected] <mailto:[email protected]>
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 ([email protected]) and permanently delete this message and any attachments. Thank you."%CRLF%*********************************************************************************************************************************************************************%CRLF%

------------------------------------------------------------------------

_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to