[mapguide-internals] Area stylization

Walt Welton-Lair walt.welton-lair at autodesk.com
Mon Dec 14 21:25:41 EST 2009


I should have included the ClippingControl element in the symbol for clarity.  The default value is 'Clip'.  Looking at the code, support for 'Inside' and 'Overlap' are actually missing.   I completely forgot that we didn't have enough time to add this last year.  So for now stick with just 'Clip'.


Regarding your questions from the other email.

* For colors, using 0x00000000 or 00000000 or 000000 should make little difference performance-wise.  The C++ code first tries to evaluate the string using swscanf with a format-control string of "%X%n", and it handles all three cases.  I like prefixing with 0x so it's clear it's a hexadecimal value.

* For string properties, it's important to wrap constant values in single quotes.  The code explicitly checks for this.  If quotes are not found then it's treated as an expression which will be much slower.

Walt

-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
Sent: Monday, December 14, 2009 8:19 PM
To: MapGuide Internals Mail List
Subject: Re: [mapguide-internals] Area stylization

Sweet, this is all working the way I want now.

I did run into something that was probably just a limitation of my
understanding.  I thought in my testing setting ClippingControl to Inside
made it not draw the individual bushes where they intersected with a polygon
boundary. Later tests showed that this caused the symbols to be clipped to a
rough bounding box of the polygon instead.  I hate it when I see things that
don't exist and don't even have an excuse :)

I'm fine with this as it stands (with parts of the individual bushes getting
cut off at polygon edges), but if there's a way to prevent these from
drawing if they intersect with the polygon outline that would be useful to
know.

Jason

2009/12/14 Walt Welton-Lair

> Your guesses were pretty much right on.
>
> - Symbols are always defined in millimeters, for both device and mapping
> size context.  For mapping size context you typically have to set the scales
> in the symbol instance to something larger than 1 to make the symbol a
> reasonable size for the map.  E.g. if you're at a mapscale of 1000 then at a
> symbol instance scale of 1 a 1 mm wide symbol will be 0.001 mm on your
> screen :-).
>
> - Yes, the ampersand is for accessibility.  It's not a fixed rule though.
>  It's how we at Autodesk have done it.
>
> - For the polygon border you'll need an additional line symbol - one that
> defines a LineUsage.  You can then either combine both the line and area
> symbol into one CompoundSymbolDefinition, or they can remain separate
> symbols but then you need two symbol instances in your layer definition.
>  Having them be separate symbols is more flexible - you can use the same
> line symbols for polylines and polygon borders.  It's also a good idea to
> include UsageContext and GeometryContext elements in your SymbolInstances to
> ensure there's no ambiguity when using and applying the symbols.  See the
> section in RFC 29 (https://trac.osgeo.org/mapguide/wiki/MapGuideRfc29) for
> a good description of what these do.
>
> Walt
>
> -----Original Message-----
> From: mapguide-internals-bounces at lists.osgeo.org [mailto:
> mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
> Sent: Monday, December 14, 2009 6:09 PM
> To: MapGuide Internals Mail List
> Subject: Re: [mapguide-internals] Area stylization
>
> Cool, thanks!
>
> Setting the ClippingControl to Inside gave me exactly what I wanted for the
> interior fill.
>
> Few questions:
>
> - I just get black blobs when I try to set SizeContext to MappingUnits set
> in the LayerDefinition.  Is this unsupported, or do I just have to scale
> the
> symbol smaller or something?
>
> - Is the ampersand at the beginning of the DisplayName for accessibility
> (keyboard shortcut) in GUI clients or something?
>
> - I'm at a bit of a loss how to symbolize the polygon border.  Do I create
> this as a composite symbol with a separate symbol and LineUsage?
>
> I hate that I feel so clueless when working with this, thanks again for the
> help.
>
> Jason
>
> 2009/12/14 Walt Welton-Lair <walt.welton-lair at autodesk.com>
>
> > Area style support was initially available in MGOS 2.0.0, while a preview
> > of line style support was available in 1.2.0.  But it wasn't until 2.0.1
> > until both were reasonably stable.  I've updated RFC 14 to indicate this.
> >
> > Here's a simple swamp symbol I hacked together:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <SimpleSymbolDefinition xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance"
> > xsi:noNamespaceSchemaLocation="SymbolDefinition-1.1.0.xsd"
> version="1.1.0">
> >  <Name>SWAMP</Name>
> >  <Graphics>
> >  <Path>
> >   <Geometry>M -1.0,0.0 h 2.0 M -1.3,0.3 h 2.6 M 0.0,0.3 v 1.5 M -0.2,0.3
> l
> > -1.0,1.0 M 0.2,0.3 l 1.0,1.0</Geometry>
> >   <LineColor>%HATCHCOLOR%</LineColor>
> >  </Path>
> >  <Path>
> >   <Geometry>M 3.0,2.5 h 2.0 M 2.7,2.8 h 2.6 M 4.0,2.8 v 1.5 M 3.8,2.8 l
> > -1.0,1.0 M 4.2,2.8 l 1.0,1.0</Geometry>
> >   <LineColor>%HATCHCOLOR%</LineColor>
> >  </Path>
> >  </Graphics>
> >  <AreaUsage>
> >  <Angle>0.0</Angle>
> >  <RepeatX>8.0</RepeatX>
> >  <RepeatY>5.0</RepeatY>
> >  </AreaUsage>
> >  <ParameterDefinition>
> >  <Parameter>
> >   <Identifier>HATCHCOLOR</Identifier>
> >   <DefaultValue>0xff000000</DefaultValue>
> >   <DisplayName>&amp;Hatch Color</DisplayName>
> >   <Description>Color for the hatch style</Description>
> >   <DataType>FillColor</DataType>
> >  </Parameter>
> >  </ParameterDefinition>
> > </SimpleSymbolDefinition>
> >
> > Walt
> >
> > -----Original Message-----
> > From: mapguide-internals-bounces at lists.osgeo.org [mailto:
> > mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
> > Sent: Monday, December 14, 2009 3:06 PM
> > To: MapGuide Internals Mail List
> > Subject: [mapguide-internals] Area stylization
> >
> > I'm not clear on whether there is any area stylization support in the new
> > advanced stuff or not.  The schema has an AreaUsage section, but the RFCs
> > show that support would be deferred.
> >
> > I'm trying to create a classic "Wetlands" area fill which has a stylized
> > bush ( *\|/* )  at an even/odd offset (or random) grid pattern fixed to
> > mapping units.  If anyone has any pointers on this, or even a "can't do
> > that, just use the stock Swamp symbol" I'd appreciate it. :)
> >
> > Thanks,
> > Jason
> > _______________________________________________
> > mapguide-internals mailing list
> > mapguide-internals at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> > _______________________________________________
> > mapguide-internals mailing list
> > mapguide-internals at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> >
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
>
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals


More information about the mapguide-internals mailing list