Hello Jackie,

Very grateful for your elaborate answer.

I did look at the XML structure and I am quite familiar with reading it and 
understanding how it is structured.
I just did not connect the dots thus far.

I am quite used to having a ‘command-reference’ guide.
Maybe that made me spoiled. 😊

I will give it another go and see what I can accomplish.

Thank you very much so far and thank you for the corrected code sample.
It will be very helpful I am sure.

Met vriendelijke groet,

GISkit BV
Bart Oostdam

Van: mapguide-users <[email protected]> Namens Jackie Ng 
via mapguide-users
Verzonden: donderdag 25 juli 2024 13:46
Aan: MapGuide Users Mail List <[email protected]>
CC: Jackie Ng <[email protected]>
Onderwerp: Re: [mapguide-users] IronPython - automate Maestro

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.

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.

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.

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.

Either way, I'll give you a cliff-notes version of the Layer Definition 
structure:

A Layer Definition has:
 - A sub element that indicates if this is a vector, raster or DWF-based 
drawing layer
    - Because we're dealing with a vector layer, it has 1:n vector scale ranges
       - Each vector scale range has *zero or one* of:
          - A point style
             - With 1:n point rules
          - A line style
             - With 1:n line rules
          - An area (polygon) style
             - With 1:n area rules
          - A composite style (if using advanced stylization)
             - With 1:n composite rules

So to then revisit your original problem: Why is there no GetPointStyleAt() 
function?

Because there is indeed no such function. There's only one point style: The 
.PointStyle property.

Same thing for line/area/composite styles.

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.

Therefore your code should've been this:

  if vectorScaleRange.PointStyle is None:
    pointStyle = ldf.CreateDefaultPointStyle()
    #Add the new pointStyle to the vectorScaleRange
    vectorScaleRange.PointStyle = pointStyle
  else:
    print "There already is a pointStyle"

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.

- Jackie

You wrote:

Sorry to bother you again.

Trying:
  if vectorScaleRange.GetPointStyleAt(0) is None:
    pointStyle = ldf.CreateDefaultPointStyle()
    #Add the new pointStyle to the vectorScaleRange
    vectorScaleRange.PointStyle.AddPointStyle(pointStyle)
  else:
    print "There already is a pointStyle"

Apparently there is no GetPointStyle() or GetPointStyle

Here is where I cannot seem to grasp the logic of things.
Is there documentation about all getters and setters ?
I searched the API documentation for PointStyle and there is a decscription, 
however:
I franly do not understand how to use the API documentation and apply it in the 
context of IronPython.

(There is not much to go on for a beginner on it seems)



Met vriendelijke groet,

GISkit BV
Bart Oostdam
_______________________________________________
mapguide-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to