[mapguide-internals] Why not encapsulate the style things into class ?

Champin champingfor at 163.com
Wed May 23 23:13:38 EDT 2007


I am a newbie of MGOS, after read part of the code about the layer definition
,I found that many things are just string ,in my point of view ,if they are
encapsulated into class ,it will be much better .
For example :




    /// <summary>
    /// Creates the line rule.
    /// </summary>
    /// The legend label string.
    /// The filter string.
    /// The color code for the line
    /// <returns></returns>
    public string CreateLineRule(string legendLabel, string filter, string
color)
    {
        string lineRule = LoadTemplateFile("/viewerfiles/linerule.templ");
        string[] strColletion = { legendLabel, filter, color };
        lineRule = Substitute(lineRule, strColletion);
        return lineRule;
    }


    /// <summary>
    /// Creates the line type style.
    /// </summary>
    /// The line rules.Call CreateLineRule to create line rules
    /// <returns></returns>
    public string CreateLineTypeStyle(string lineRules)
    {
        string lineStyle =
LoadTemplateFile("/viewerfiles/linetypestyle.templ");
        string[] strCollection = { lineRules };
        lineStyle = Substitute(lineStyle, strCollection);
        return lineStyle;
    }


	I want to create a line type string style , the function
CreateLineTypeStyle needs a parameter lineRules, which is string type .

	why not define a class named MgLineRule , and define a class
MgLineTypeStyle, so the signature of the function maybe goes like that :

	public  MgLineTypeStyle CreateLineTypeStyle(MgLineRule lineRule)

	does that looks better ?


	Has anybody done that already? Or Is that a good idea ?
-- 
View this message in context: http://www.nabble.com/Why-not-encapsulate-the-style-things-into-class---tf3807748s16610.html#a10776733
Sent from the MapGuide Internals mailing list archive at Nabble.com.



More information about the mapguide-internals mailing list