Re: Polygon manipulation in its nodes

Hi Andrea,

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
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 
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:

To unsubscribe visad, visit:

  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: