Milton Jonathan ha scritto: > Hello people > > We were taking a look at the ShapeMarkFactory, that I guess Andrea > introduced some months ago in GeoTools 2.5. > > Well, we're actually thinking about using it, but we're moving to > GeoTools 2.6 and there is no ShapeMarkFactory yet over there, as far as > I know. Is there a reason for not bringing it over? (it seems quite > trivial to do so).
It's there: http://svn.osgeo.org/geotools/trunk/modules/library/render/src/main/java/org/geotools/renderer/style/ShapeMarkFactory.java Are you sure you're working against the OSGEO repository? > Also, we may be interested in extending that factory to allow for custom > hatches that specify line width, an angle (i.e., a slash with x degrees > instead of always 45) and a spacing between each hatch line. > Does anybody have a suggestion about how to do that? Our current idea is > to have the extended factory understand something like: > shape://customslash?width=1&angle=30&spacing=2 Sure, the factories can take as many parameters as you like, you'll just have to roll a parser to break apart the tokens in that URL form. The factory will receive "customslash?width=1&angle=30&spacing=2" as the name, you have to parse it. > What do you think? Another idea would be to generate the shape somewhere > else and use something like factory.addShape() as suggested by Andrea > once, but I think in this case that idea may not be the most practical one. You're trying to control spacing and angle. To control spacing you don't need to add a new parameter, just change the size of your marker and you'll get more space between the lines. The angle I tried to handle, but I gave up because I did not find a cheap solution for the problem and I was working in my spare time under the Christmas holidays. All markers you generate get turned into a square tile that is passed to TexturePaint for the filling. Now, how do you generate a square image that, when tiled, generates a 30° (or any other random angle) line pattern? I could not figure it out, it seems to me to solve this problem the dynamic symbolizers should be modified so that they can generate a custom Paint object. A Paint object is asked for a raster to fill a certain rectangular image (see the TexturePaint source), and there it should be possible to handle the generation of a filler that works with whatever angle you want. To sum up I believe we'd have to add this method: MarkFactory.getPaint(graphics2d, name, feature) to the mark factories and then roll out a custom Paint object that knows how to deal with this kind of not regular-enough fills (and would open the door for completely non regular ones, such as random point distributions with a certain density). Another way is to break the assumption a shape is to be contained in a 1x1 square, and allow for rectangular ones. I believe I looked into that path as well but it had some other ugly repercussions that I could not deal with in a short amount of time. Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
