Re: Polygon manipulation in its nodes

Hi Andrea,

I'm not sure about this, but here it goes:

Use a PickManipulationRenderer with the Gridded2DSet that
contains the nodes.  This will allow you to get the node index
from a mouse click in the display.  Create one DirectManipulationRenderer
linked to a single tuple, make this tuple really small and some
color which makes it hard to see (I learned this trick from BillH, and
use it in HYDRA).  Once you have the node index, move the tuple
to that node, and use the Data changed events to update the Set.  If
the set is large, you could segment it somewhat for performance. Wrap this all up in a nice api that just needs a reference to the primary
set of nodes.

Just a thought, I'm really busy right now with the AGU.


Andrea Antonello wrote:

I tried to do it with separate DirectManipulationRenderers for each
The result is really very nice and can be seen together with the code at:

The problem isn't even performance, the loading is not very fast, but
once loaded it works very well. The real problem is once again memory. After about 3000 nodes the adding references to the display sucks more than
1.5 gigs from the pc and brings everything to freeze.

Any idea?


Yeah, that is the way it is done by the TrackManipulation example.
I'm not sure that this could be done in a performant way with let's say
a polygon of 15000 points. That is why I went over to the
ManipulationRenderers. I will investigate and try it out.


One possibility:  use separate DirectManipulationRenderers
for each node and redraw the connecting lines as the nodes
are changed.


Andrea Antonello wrote:

I gave a closer look into the CurveManipulationRenderer class and the
regarding classes.
As I understand it, the rendering is passed to the ShadowCurveSetTypeJ3D
and then to the ShadowFunctionOrSetType.

Using that approach I am able to modify the shapefile on the display,
the problem is that it is modified not only in its nodes, but also in
every point between two nodes, which it should not. I saw the same
behaviour in the IDV. Even if the nodes are visualized with boxes, it is
possible to modify also points between the node boxes.

How I would like to have it behave is kinda similar as in the example of the bom.TrackManipulation.
Now I need some help to get the right starting point.
I would like to do the following:
- have the nodes (coordinates) of the shapefile surrounded by a small
shape of any kind
- have the manipulation renderer to modify only the nodes through the
dragging action, adapting the two lines that converge into the node so
that they stay straight lines and follow their node.

What exactly should I do? Extend the ShadowFunctionOrSetType and
override the doTranform method inserting the drawing of the shapes?

I really need some good advice.


* [A.D. 27/11/06 17:25], Andrea Antonello <andrea.antonello@xxxxxxxxx> probably wrote:

Hi Tom,
you are right, it is a problem of Type.

I went a bit into the code and noticed that the method
setIsDirectManipulation(boolean) of the DataRenderer is set to false
(and throws the error I reported in the original post), if
the type of the data is not of one of the following types:
FunctionType, RealTupleType, RealType
which the Gridded2DSet is not.

I will have a closer look to the CurveManipulationRenderer class. I
already gave it a very quick look for it is a nice example of drawing.
Hopefully you are right, I could have a chance to modify it for my needs.

Thanks man,

* [A.D. 27/11/06 10:10], Tom Rink <rink@xxxxxxxxxxxxx> probably wrote:
Hi Andrea,

The default DirectManipulationRenderer makes certain
assumptions about the structure of the linked data in
order to generate new data values as a result of user
gestures.   A polygon is too ambiguous for the default
logic and probably a "notSimpleField" or "notRealFunction"
exception is being thrown.  You could try using the
CurveManipulationRenderer class in the
package.  I believe the folks at Unidata have done some
work with this in the IDV.


Andrea Antonello wrote:

I am trying to create a toolbox that is able to modify shapefiles.
My first approach is the existing DirectManipulationRendererJ3D, but as
I try it with the code below, it gives me:

null: DirectManipulationRendererJ3D.doTransform in the lower left corner
of the display.

       Coordinate[] tmpCoord = coords.elementAt(i);
       int np = tmpCoord.length;
       float[][] samples = new float[2][np];
       for (int j = 0; j < np; j++) {
           samples[0][j] = (float) tmpCoord[j].x;
           samples[1][j] = (float) tmpCoord[j].y;

       // the lines
       Gridded2DSet tmpLines = new Gridded2DSet(earth, samples,
       // create a DataReference for river system
       DataReference rivers_ref = new DataReferenceImpl("rivers");

ConstantMap[] colorMapLines = { new ConstantMap(1, Display.Red),
               new ConstantMap(0, Display.Green),
               new ConstantMap(0, Display.Blue),
               new ConstantMap(3f, Display.LineWidth) };
       display1.addReferences(new DirectManipulationRendererJ3D(),
               rivers_ref, colorMapLines);

What am I doing wrong?

To unsubscribe visad, visit:

HydroloGIS - Environmental Safety Modelling
Siemens Str. 19 via Siemens
I-39100 Bozen - Bolzano

Andrea Antonello
Environmental Engineer
tel. +39 0471 068065 mobile: +39 328 8497722
fax:  +39 36 328 8497722
email:   andrea.antonello@xxxxxxxxxxxxxx

"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik

To unsubscribe visad, visit: