performance issue with multiple data

Hi there,

A small question about performance issues today. I have a DisplayImplJ3D
with three different DataReferences linked to it. The first one is data from a
BaseMapAdapter that represents a world map. The others represent the orbit of
a satellite. The orbit is devided into small lines called GeoLocations. These
GeoLocations are selectable via a RubberBandBoxRendererJ3D. I want to color
the selected GeoLocations in red, the others in blue therefore I use two
DataReferences and add them with two ConstantMap arrays.

The problem is that everytime I have a change of the selection I have to
draw every GeoLocation and even the world map which lasts about a few seconds.
Is there an easier way to handle this issue. Or is there a way to only update
the two DataReferences which represent the orbit and not the one which
represents the world map? Here's an excerpt of my code which generates the two
orbit-references:

public void redrawGeoLocations() throws VisADException, RemoteException {

    FunctionType lonlatFunction = new FunctionType(RealType.Longitude,
RealType.Latitude);
    RealType indexType = RealType.getRealType("index");
    FunctionType geoLocationsFunction = new FunctionType(indexType,
lonlatFunction);

    // process unselected data
    if (unselectedGeoLocations.size() > 0) {
      FlatField[] unselectedData = new
FlatField[unselectedGeoLocations.size()];
      Iterator iterator = unselectedGeoLocations.iterator();
      int i = 0;
      while (iterator.hasNext()) {
        GeoLocation geoLocation = (GeoLocation)iterator.next();
        double first = (double)geoLocation.getFirstMeasurePoint().getPosX();
        double last = (double)geoLocation.getLastMeasurePoint().getPosX();
        Linear1DSet set = new Linear1DSet(RealType.Longitude, first, last,
2);
        float[][] values = new float[][] { {
          geoLocation.getFirstMeasurePoint().getPosY(),
          geoLocation.getLastMeasurePoint().getPosY()
        } };
        unselectedData[i] = new FlatField(lonlatFunction, set);
        unselectedData[i++].setSamples(values);
      }
      Integer1DSet unselectedSet = new
Integer1DSet(unselectedGeoLocations.size());
      FieldImpl unselectedField = new FieldImpl(geoLocationsFunction,
unselectedSet);
      unselectedField.setSamples(unselectedData, false);
      unselectedReference.setData(unselectedField);
    } else {
      unselectedReference.setData(null);
    }

    // process selected data
    if (selectedGeoLocations.size() > 0) {
      FlatField[] selectedData = new FlatField[selectedGeoLocations.size()];
      Iterator iterator = selectedGeoLocations.iterator();
      int i = 0;
      while (iterator.hasNext()) {
        GeoLocation geoLocation = (GeoLocation)iterator.next();
        double first = (double)geoLocation.getFirstMeasurePoint().getPosX();
        double last = (double)geoLocation.getLastMeasurePoint().getPosX();
        Linear1DSet set = new Linear1DSet(RealType.Longitude, first, last,
2);
        float[][] values = new float[][] { {
          geoLocation.getFirstMeasurePoint().getPosY(),
          geoLocation.getLastMeasurePoint().getPosY()
        } };
        selectedData[i] = new FlatField(lonlatFunction, set);
        selectedData[i++].setSamples(values);
      }
      Integer1DSet selectedSet = new
Integer1DSet(selectedGeoLocations.size());
      FieldImpl selectedField = new FieldImpl(geoLocationsFunction,
selectedSet);
      selectedField.setSamples(selectedData, false);
      selectedReference.setData(selectedField);
    } else {
      selectedReference.setData(null);
    }
  }

Thanks in advance, Mathias

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


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