Shapefile  MultilLinehandler  false casting in getLength() and write
--------------------------------------------------------------------

                 Key: GEOT-1654
                 URL: http://jira.codehaus.org/browse/GEOT-1654
             Project: GeoTools
          Issue Type: Bug
    Affects Versions: 2.3.5
         Environment: Suse Linux 9.3, IA32, Java 5.0, Netbeans 5.5 
            Reporter: Alexander Weidauer


The casting in class:

org.geotools.data.shapefile.shp.MultiLineHandler
  
  public int getLength(Object geometry) and 
  public void write(ByteBuffer buffer, Object geometry)

  (MultiLineString) multi = (MultiLineString) geometry;  

Should be modified to:
  
                if (geometry instanceof MultiLineString) {
                  multi = (MultiLineString) geometry;
                } else {
                  multi = geometryFactory.createMultiLineString(
                          new LineString[] { (LineString) geometry });
                }

Because the in class org.geotools.data.shapefile.shp.ShapeType the member 
function

                public ShapeHandler getShapeHandler()

Creates for  MultiLineStrings  and Linestrings  a MultiLineHandler

Question is it possible to work direct on GeometryCollections or a Geometry 
instead of the Object  

     public int getLength(Object geometry)  -> public int getLength(Geometry 
geometry) 
     public void write(ByteBuffer buffer, Object geometry) -> public void 
write(ByteBuffer buffer, Geometry geometry) 
               


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to