<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I don't know where or what the LayerDefinitionFactory is, but to add
thematic rules<br>
you simply add a "PointRuleType", "LineRuleType" or "AreaRuleType" to
the <br>
"PointTypeStyleType", "LineTypeStyleType" or "AreaTypeStyleType"
collection of the <br>
desired scalerange.<br>
<br>
eg:<br>
<tt>PointRuleType prt = new PointRuleType();<br>
prt.Filter = "\"ID\" > 100";<br>
//TODO: Set style and other properties<br>
<br>
</tt><tt>LayerDefinition ldef; //<-- Assign this</tt><br>
<tt>VectorLayerDefintionType vldef = ldef.Item as
VectorLayerDefinitionType;<br>
//If you have more than just points, you must itterate the "Items" to
find the right one<br>
PointTypeStyleType pst = vldef.VectorScaleRange[0].Items[0] as
PointTypeStyleType;<br>
pst.PointRule.Add(prt);<br>
</tt>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
padmini godavarthi skrev:
<blockquote cite="mid:1230635780273-2092027.post@n2.nabble.com"
type="cite">
<pre wrap="">Hi,
i want to do thematic mapping in .net .for that i suppose to use
LayerDefinitionFctory .
how to use it in .net?
can u send me the code in .net
Thanks and Regards,
Padmini
m.karam wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
Many thanks for you Jackie
it works good
Regards
Karam
Jackie Ng wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi there,
There is no .NET equivalent to LayerDefintionFactory. You'll have to port
it over to .net.
layerdefinitionfactory.php simply takes a bunch of xml templates in the
"viewerfiles" directory of your web extensions install folder and fills
in the blanks with the parameters you provide.
example of CreateAreaRule() in .net:
class LayerDefinitionFactory
{
...
public static string CreateAreaRule(string legendLabel, string
filterText, string foreGroudColor)
{
StreamReader reader = new StreamReader("path/to/arearule.templ");
string areaRuleXml = reader.ReadToEnd();
string [] values = new string[] { legendLabel, filterText,
foreGroundColor };
areaRuleXml = Substitute(areaRuleXml, values);
return areaRuleXml;
}
...
static String Substitute(String templ, String[] vals)
{
StringBuilder res = new StringBuilder();
int index = 0, val = 0;
bool found;
do
{
found = false;
int i = templ.IndexOf('%', index);
if(i != -1)
{
found = true;
res.Append(templ.Substring(index, i - index));
if(i < templ.Length - 1)
{
if(templ[i+1] == '%')
res.Append('%');
else if(templ[i+1] == 's')
res.Append(vals[val ++]);
else
res.Append('@'); //add a character illegal in
jscript so we know the template was incorrect
index = i + 2;
}
}
} while(found);
res.Append(templ.Substring(index));
return res.ToString();
}
}
Other CreateXXX functions are variations on the above example.
Regards,
- Jackie
m.karam wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi everybody
How can I use the (layerdefinitionfactory.php) API functions witn .NET ?
thanks
Karam
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>