Examples of AggregateFactoryImpl


Examples of org.geotools.geometry.iso.aggregate.AggregateFactoryImpl

      List<OrientableCurve> aCurves, List<Point> aPoints) {

    int nS = aSurfaces.size();
    int nC = aCurves.size();
    int nP = aPoints.size();
    AggregateFactoryImpl aggregateFactory = new AggregateFactoryImpl(crs);
   
    if (nS + nC + nP == 0)
      // Return null if the sets are empty
      return null;
      //throw new IllegalArgumentException("All Sets are empty");

   
    if (nS == 0) {
     
      if (nC == 0) {
       
        // Surfaces empty, Curves empty, Points not empty
        if (nP == 1) {
         
          // POINT
          return (GeometryImpl) aPoints.get(0);
         
        } else {
         
          // MULTIPOINT
          return (GeometryImpl) aggregateFactory.createMultiPoint(new HashSet(aPoints));
         
        }
      } else if (nP == 0) {
       
        // Surfaces empty, Curves not empty, Points empty
        if (nC == 1) {
         
          // CURVE
         
          return (GeometryImpl) aCurves.get(0);
        } else {
         
          // MULTICURVE
          return (GeometryImpl) aggregateFactory.createMultiCurve(new HashSet(aCurves));
        }
      }

    } else {
     
      if (nC == 0 && nP == 0) {
       
        if (nS == 1) {
         
          // SURFACE
          return (GeometryImpl) aSurfaces.get(0);
         
        } else {
         
          // MULTISURFACE
          return (GeometryImpl) aggregateFactory.createMultiSurface(new HashSet(aSurfaces));
         
        }
       
      }

    }
   
    // All other cases: MULTIPRIMITIVE
    Set<Primitive> tPrimitives = new HashSet<Primitive>();
    tPrimitives.addAll(aSurfaces);
    tPrimitives.addAll(aCurves);
    tPrimitives.addAll(aPoints);
   
    return (GeometryImpl) aggregateFactory.createMultiPrimitive(tPrimitives);

 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.