Hmm. I did something similar recently, but chickened out on all the
complicated stuff, you might say.

I made a map service which reads and parses (Thanks to geotools!) map
shapefiles and then build images of the maps, and returns the coords for the
current map, so that I get a nice click-through effect.

I only use a regular hml image map, but with an @Any tag, and get the
current coords and the target url from the current map object. Hope that
helps,

Cheers,
PS

On 7/6/06, Alex Tian <[EMAIL PROTECTED]> wrote:


Jessek, I don't quite understand what you said. did you mean I should
modify
DirectArea.java?

I know it's gonna be a lenthy statement below, but I desperately need
help...

my task actually is to build a "family tree" web application, for
simplicity, e.g. User enters his/her name and his relatives'names (e.g.
his
parents' names and children's names ) and sumbit the form (triggers a
listener in that page's .java file). What I do is generate a tree-like
image
to show the relations among them (use only rectangles with lines to
connect
them, on each rectangle write proper family member's name which the user
entered) and display it on the page and use image map to make those
rectangles on the image clickable (e.g. user can link to a person's detail
page), because the I don't know what relations will be among those family
members and how many names the user will enter, so I cannot pre-define the
coords attribute and the number of <area> tags for "image map".

As I said in the first post, I managed to generate the buffered image and
display it on the page, I used 2 classes and 1 interface exactly as Chart
example in Workbench example (IChartProvider.java, ChartService.java,
ChartAsset.java). and I used DirectArea custom component in Virtual
Library
example implemented image map on this newly created image, the DirectArea
custom component in Virtual Library example to implement the image map so
that when user clicks a region of the image, it is just a link to another
page.

The problem now is I don't know how many <area jwcid="@DirectArea" .../>
tags will be in .html for image map and I have to specify the "coords"
attribute in each <area> tag myself. Because in my web app, I don't know
how
many family memebers'names the user will provide( the number of <area> tag
is unknown) and what relations will be among them ( the rectangle's
coordinates on the image will be different everytime, so the "coords"
value
in each <area> is unknown), say this time there should be 1 <area> tag(1
clickable area on that image) and the coords value is "10,10 10,10", but
next time user wants 2 <area> tags(2 clickable area on that image) and the
coords value are "20,20 20,20 ",   "30,30 30,30" that's what
DirectArea.java
does not do, because the coords attribute's value is already specified in
.html and the number of <area> tag doesn't change. I know there is a way
to
specify coords value in DirectArea.java in the method below:

protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
        {
                if (cycle.isRewinding())
                        return;

                Object[] parameters =
DirectLink.constructServiceParameters(getParameters

());

                IEngineService service = cycle.getEngine().getService

(Tapestry.DIRECT_SERVICE);
                ILink link = service.getLink(cycle, this, parameters);

                writer.beginEmpty("area");
                writer.attribute("href", link.getURL());

                renderInformalParameters(writer, cycle);
        }

I can write "writer.attribute("coords", "10, 10 10,10");" after
"writer.attribute("href", link.getURL());"
but since DirectArea is a component, everytime I use DirectArea component,
the coords value would be same, that even makes it worse than specifying
the
coords's value in .html, because for each <area jwcid="@DirectArea" ... />
one can specify the coords'value differently.

Do I have to create a new custome component of my own, if so, can I extend
the DirectArea component's feature, modify the DirectArea.java and How ?

thanks very much...

--
View this message in context:
http://www.nabble.com/help-please%2C-problem-with-image-map-using-Tapestry-4-%21%21%21-tf1897938.html#a5196425
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to