[mapguide-users] IronPython - automate Maestro
Bart Oostdam
bart at giskit.nl
Wed Jul 24 07:38:43 PDT 2024
Hello Jacky,
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
Van: mapguide-users <mapguide-users-bounces at lists.osgeo.org> Namens Jackie Ng via mapguide-users
Verzonden: woensdag 24 juli 2024 16:13
Aan: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
CC: Jackie Ng <jumpinjackie at gmail.com>
Onderwerp: Re: [mapguide-users] IronPython - automate Maestro
If you focus at this part of the error: NoneType has no attribute 'AddRule'
Then IronPython is really complaining about the expression:
vectorScaleRange.PointStyle
Which is just another way of saying that the vectorScaleRange has no actual point style because it is null (on in Python terminology: None)
ie. You are adding to a layer without a point style set on the given scale range
How can you rectify this? If this is the correct layer definition you intend to add a point rule to, then you should assign a point style if vectorScaleRange.PointStyle is None.
Where can you create a new point style? From the same place where you're creating point rules: The layer definition object itself.
- Jackie
You wrote:
Hello Jackie,
I ran into a problem trying your code.
This Line does not seem to work:
vectorScaleRange.PointStyle.AddRule(pointRule)
Error when running the code:
[cid:image001.png at 01DADDBD.2CF4D050<https://lists.osgeo.org/mailman/listinfo/mapguide-users>]
I ran a dir() on the vectorScaleRange variable and it shows no AddRule.
I will take a better look at the API documentation
[cid:image002.png at 01DADDBD.2CF4D050<https://lists.osgeo.org/mailman/listinfo/mapguide-users>]
Met vriendelijke groet,
GISkit BV
Bart Oostdam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20240724/4120814a/attachment.htm>
More information about the mapguide-users
mailing list