<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
span.E-mailStijl18
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:11.0pt;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="en-NL" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Hello Jackie,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Very grateful for your elaborate answer.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I did look at the XML structure and I am quite familiar with reading it and understanding how it is structured.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I just did not connect the dots thus far.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I am quite used to having a ‘command-reference’ guide.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Maybe that made me spoiled.
</span><span style="font-size:11.0pt;font-family:"Segoe UI Emoji",sans-serif;mso-fareast-language:EN-US">😊</span><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I will give it another go and see what I can accomplish.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Thank you very much so far and thank you for the corrected code sample.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">It will be very helpful I am sure.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:11.0pt;mso-fareast-language:NL">Met vriendelijke groet,
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:11.0pt;mso-fareast-language:NL"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="nl" style="color:black">GISkit BV<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="nl" style="color:black">Bart Oostdam</span><span lang="nl" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="NL" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Van:</span></b><span lang="NL" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> mapguide-users <mapguide-users-bounces@lists.osgeo.org>
<b>Namens </b>Jackie Ng via mapguide-users<br>
<b>Verzonden:</b> donderdag 25 juli 2024 13:46<br>
<b>Aan:</b> MapGuide Users Mail List <mapguide-users@lists.osgeo.org><br>
<b>CC:</b> Jackie Ng <jumpinjackie@gmail.com><br>
<b>Onderwerp:</b> Re: [mapguide-users] IronPython - automate Maestro<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">You really have to be familiar with the XML structure of the resources you are working with. The objects you are interacting with on the console are objects that have near 1:1 structure with their respective XML schema definition.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The bulk of the Maestro API is C# classes auto-generated from the .xsd documents that ship with MapGuide. These .xsd files describe the shape of all the resources (and all the versions of these resources) you can work with in MapGuide.
Because these .xsd documents exist in multiple versions, we use C# interfaces to provide commonality across these different auto-generated classes and when working with resources in Maestro API, you're working against these interfaces and never have to deal
with the underlying auto-generated classes.<br>
<br>
I'm sorry if the API documentation is not that helpful or barebones around these classes/interfaces because practically speaking at the moment it is simpler to just look at the underlying .xsd documents to understand the XML structure of a specific resource
type rather than painstakingly repeat all of this documentation in our common wrapping interfaces.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">In the case of Layer Definitions, you should refer to the respective LayerDefinition.xsd to understand the structure of a Layer Definition document. These schema files are in the Server/Schema folder of your MapGuide install and are also
included in the Schemas directory of your Maestro installation. If you're unable to read/understand these .xsd schema files then I can't really help you there.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Either way, I'll give you a cliff-notes version of the Layer Definition structure:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">A Layer Definition has:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - A sub element that indicates if this is a vector, raster or DWF-based drawing layer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - Because we're dealing with a vector layer, it has 1:n vector scale ranges<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - Each vector scale range has *zero or one* of:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - A point style<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - With 1:n point rules<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - A line style<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - With 1:n line rules<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - An area (polygon) style<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - With 1:n area rules<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - A composite style (if using advanced stylization)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - With 1:n composite rules<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">So to then revisit your original problem: Why is there no GetPointStyleAt() function?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Because there is indeed no such function. There's only one point style: The .PointStyle property.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Same thing for line/area/composite styles.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">We only provide GetXXXAt() and AddXXX() functions for elements that can exist 1 or more times. Point styles do not qualify. Therefore they only exist as properties to set directly.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Therefore your code should've been this:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""> if vectorScaleRange.PointStyle is None:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""> pointStyle = ldf.CreateDefaultPointStyle()</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""> #Add the new pointStyle to the vectorScaleRange</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""> vectorScaleRange.PointStyle = pointStyle</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""> else:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""> print "There already is a pointStyle"</span><o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I would think and hope that as you were typing your original code out in the IronPython console, that the autocomplete did not provide any suggestions for GetPointStyleAt after you hit dot after vectorScaleRange. That is because the autocomplete
was telling the truth: There is no such function on the vectorScaleRange object. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">- Jackie<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">You wrote:<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Sorry to bother you again.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Trying:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> if vectorScaleRange.GetPointStyleAt(0) is None:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> pointStyle = ldf.CreateDefaultPointStyle()</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> #Add the new pointStyle to the vectorScaleRange</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> vectorScaleRange.PointStyle.AddPointStyle(pointStyle)</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> else:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> print "There already is a pointStyle"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Apparently there is no GetPointStyle() or GetPointStyle</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Here is where I cannot seem to grasp the logic of things.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Is there documentation about all getters and setters ?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">I searched the API documentation for PointStyle and there is a decscription, however:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">I franly do not understand how to use the API documentation and apply it in the context of IronPython.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">(There is not much to go on for a beginner on it seems)</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="NL" style="font-size:11.0pt">Met vriendelijke groet,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="NL" style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="NL" style="color:black">GISkit BV</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="NL" style="color:black">Bart Oostdam</span><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>