RE: Problem with ListSelectionModel index on some shape file sets imported with EsriPlugIn

From: Lonnie D. Goad <LGoad@optimetrics.org>
Date: Tue Jul 09 2002 - 16:08:11 EDT

Further research has indicated that the shape file sets that are
exported through OpenMap are 0 based where shape sets from other sources
seem to be 1 based. I found this in the Integer object of the
getAppObject call. I subclassed EsriPlugin and added the following
code, which seems to set things straight:

public RpmEsriPlugIn(String name, URL dbf, URL shp, URL shx)
{
        super(name, dbf, shp, shx);
        indexAdjust(); //new
}

public void selectEntry(OMGraphic graphic)
{
        Object obj = graphic.getAppObject();

        if (lsm == null)
        {
            getTable();
        }

        if (obj != null)
        {
                if (obj instanceof Integer)
                   {
                        int index = ((Integer)obj).intValue();
                        lsm.setSelectionInterval(index-indexAdjustment,
index-indexAdjustment);//changed
        
getTable().scrollRectToVisible(getTable().getCellRect(index
-indexAdjustment, 0, true)); //new
                }
        }
        else
        {
            lsm.clearSelection();
        }
}

private void indexAdjust()//new
{
        OMGraphicList graphic =
(OMGraphicList)getEsriGraphicList().getOMGraphicAt(0);
        Object obj = graphic.getAppObject();
        if (obj != null)
        {
                if (obj instanceof Integer)
                {
                        int indexHolder = ((Integer)obj).intValue();
                        if (indexHolder > 0) indexAdjustment = 1;
                }
        }
}

private int indexAdjustment = 0;//new

Also notice one change I made to selectEntry to allow the table make
visible the row corresponding to the selected OMGraphic

Thank You,

-----Original Message-----
From: owner-openmap-users@bbn.com [mailto:owner-openmap-users@bbn.com]
On Behalf Of Lonnie D. Goad
Sent: Tuesday, July 09, 2002 1:58 PM
To: openmap-users@bbn.com
Subject: Problem with ListSelectionModel index on some shape file sets
imported with EsriPlugIn

I am importing shape file sets to PlugIn layers via the EsriPlugIn. The
problem I am having is that if these shape file sets were exported from
OpenMap using EsriShapeExport the index in the ListSelectionModel is off
by 1. Meaning if I click on the graphic with index 0, nothing is
highlighted in the table, and when I click on the graphic with index 1
the table row of index 0 is highlighted and so on. I found that in the
selectEntry(OMGraphic) method of EsriPlugIn the statement
lsm.setSelectionInterval(index-1, index-1) if changed to
lsm.setSelectionInterval(index, index) will correct this problem.
However, as stated above this only seems to be a problem with shape file
sets exported from OpenMap. Shape file sets obtained from other sources
work fine with the original code and are obviously off by 1 in the
opposite direction of the list when I make the above change. Any
thoughts on this?

Thank You,

************************
Lonnie Goad - Programmer
OptiMetrics Inc.
2107 Laurel Bush Rd. Suite 209
Bel Air, Md. 21015
LGoad@OptiMetrics.org
http://www.OptiMetrics.org
(410)569-6081 ext: 105
fax: (410)569-6083

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe
openmap-users"]
--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Jul 9 16:08:43 2002

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT