Package chunmap.app.tools

Source Code of chunmap.app.tools.SelectIterator

/**
* Copyright (c) 2009-2011, chunquedong(YangJiandong)
*
* This file is part of ChunMap project
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
*
* History:
*     2010-05-05  Jed Young  Creation
*/
package chunmap.app.tools;

import java.util.ArrayList;
import java.util.List;

import chunmap.data.feature.Feature;
import chunmap.data.feature.Shape;
import chunmap.data.feature.VisitAction;
import chunmap.model.elem.Envelope;
import chunmap.model.geom.Geometry;

public class SelectIterator  implements VisitAction {
//  private static final Logger Log = new Logger(Logger.Debug,SelectIterator.class.getName());
  Envelope env;
  public List<Feature> features;

  public SelectIterator(Envelope env) {
    this.env = env;
    features = new ArrayList<Feature>();
    //geometrys.add(env.toPolygon());
  }

  @Override
  public void execute(Feature obj) {
    if (obj instanceof Shape) {
      Shape feature = (Shape) obj;
      Geometry g = feature.getGeometry();
//      if(Log.isDubug()){
//        Log.log(Logger.Debug, "geometry =" +g.getEnvelop()+"envelope="+env.toString());
//      }
      if (g == null)
        return;
      if (env.hasIntersect(g)) {
        features.add(obj);
//        if(Log.isDubug()){
//          Log.log(Logger.Debug, "add feature");
//        }
      }
    }
  }
}
TOP

Related Classes of chunmap.app.tools.SelectIterator

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.