• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VoronoiDiagramBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder的典型用法代码示例。如果您正苦于以下问题:Java VoronoiDiagramBuilder类的具体用法?Java VoronoiDiagramBuilder怎么用?Java VoronoiDiagramBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VoronoiDiagramBuilder类属于com.vividsolutions.jts.triangulate包,在下文中一共展示了VoronoiDiagramBuilder类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: VoronoiPartitioning

import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder; //导入依赖的package包/类
/**
 * Instantiates a new voronoi partitioning.
 *
 * @param samples the sample list
 * @param partitions the partitions
 * @throws Exception the exception
 */
public VoronoiPartitioning(List<Envelope> samples, int partitions) throws Exception
{
	GeometryFactory fact = new GeometryFactory();
	ArrayList<Point> subSampleList=new ArrayList<Point>();
	MultiPoint mp;
	
	//Take a subsample accoring to the partitions
	for(int i=0;i<samples.size();i=i+samples.size()/partitions)
	{
		Envelope envelope = samples.get(i);
		Coordinate coordinate = new Coordinate((envelope.getMinX()+envelope.getMaxX())/2.0,(envelope.getMinY()+envelope.getMaxY())/2.0);
		subSampleList.add(fact.createPoint(coordinate));
	}

	mp=fact.createMultiPoint(subSampleList.toArray(new Point[subSampleList.size()]));
	VoronoiDiagramBuilder voronoiBuilder = new VoronoiDiagramBuilder();
	voronoiBuilder.setSites(mp);
	Geometry voronoiDiagram=voronoiBuilder.getDiagram(fact);
	for(int i=0;i<voronoiDiagram.getNumGeometries();i++)
	{
		Polygon poly=(Polygon)voronoiDiagram.getGeometryN(i);
		grids.add(poly.getEnvelopeInternal());
	}
	//grids.add(new EnvelopeWithGrid(boundary,grids.size()));
}
 
开发者ID:DataSystemsLab,项目名称:GeoSpark,代码行数:33,代码来源:VoronoiPartitioning.java


示例2: Voronoi

import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder; //导入依赖的package包/类
public Voronoi(Bitmap map){
    this.inputMap = map;
    this.MAP_HEIGHT = map.getHeight();
    this.MAP_WIDTH = map.getWidth();
    this.sites = new ArrayList<>();
    this.polygons = new ArrayList<>();
    this.builder = new VoronoiDiagramBuilder();
    this.envelope = new Envelope(new Coordinate(MAP_MIN,MAP_MIN), new Coordinate(MAP_WIDTH,MAP_HEIGHT));
    this.voronoiMap = Bitmap.createBitmap(MAP_WIDTH, MAP_HEIGHT, Bitmap.Config.ARGB_4444);
    this.siteMap = Bitmap.createBitmap(MAP_WIDTH, MAP_HEIGHT, Bitmap.Config.ARGB_4444);
    this.linFun = new LinearFunction(MAP_WIDTH, MAP_HEIGHT);
    this.voronoiGraph = new Graph(linFun);
    this.nodeCounter = 0;

}
 
开发者ID:DIT524-V17,项目名称:group-5,代码行数:16,代码来源:Voronoi.java


示例3: voronoi

import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder; //导入依赖的package包/类
public static IList<IShape> voronoi(final IScope scope, final IList<GamaPoint> points) {
	final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
	final VoronoiDiagramBuilder dtb = new VoronoiDiagramBuilder();
	dtb.setClipEnvelope(scope.getSimulation().getEnvelope());
	dtb.setSites(points);
	final GeometryCollection g = (GeometryCollection) dtb.getDiagram(GEOMETRY_FACTORY);
	final int nb = g.getNumGeometries();
	for (int i = 0; i < nb; i++) {
		final Geometry gg = g.getGeometryN(i);
		geoms.add(new GamaShape(gg));
	}
	return geoms;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:14,代码来源:GeometryUtils.java


示例4: execute

import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder; //导入依赖的package包/类
public void execute(Scope scope)
throws Exception
{
  int geomIndex = SchemaUtil.getColumnWithType(input.getRows().getSchema(), Geometry.class);
  //TODO: handle no geometry case (return empty table)
  List pts = extractCoordinates(input.getRows().iterator(), geomIndex);
  VoronoiDiagramBuilder voronoiBuilder = new VoronoiDiagramBuilder();
  voronoiBuilder.setSites(pts);
  Geometry voronoi = voronoiBuilder.getDiagram(GeomFunction.geomFactory);
  
  List polys = toListOfGeometry(voronoi);
  
  result = createGeometryTable(polys);
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:15,代码来源:VoronoiCommand.java


示例5: process

import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder; //导入依赖的package包/类
@Execute
public void process() throws Exception {
    checkNull(inMap);

    if (!EGeometryType.isPoint(inMap.getSchema().getGeometryDescriptor())) {
        throw new ModelsIllegalargumentException("The input geometry needs to be points.", this, pm);
    }

    if (fElev != null) {
        fElev = FeatureUtilities.findAttributeName(inMap.getSchema(), fElev);
        if (fElev == null) {
            throw new ModelsIllegalargumentException("Couldn't find field: " + fElev, this);
        }
    }

    CoordinateReferenceSystem crs = inMap.getBounds().getCoordinateReferenceSystem();
    List<SimpleFeature> fList = FeatureUtilities.featureCollectionToList(inMap);

    pm.beginTask("Processing...", fList.size());
    VoronoiDiagramBuilder b = new VoronoiDiagramBuilder();
    List<Coordinate> cList = new ArrayList<Coordinate>();
    for( SimpleFeature f : fList ) {
        Geometry geometry = (Geometry) f.getDefaultGeometry();
        double elev = 0.0;
        if (fElev != null)
            elev = (Double) f.getAttribute(fElev);

        Coordinate c = geometry.getCoordinate();
        c.z = elev;
        cList.add(c);
        pm.worked(1);
    }
    pm.done();

    b.setSites(cList);

    List<Geometry> geosList = new ArrayList<Geometry>();
    Geometry diagram = b.getDiagram(gf);
    for( int i = 0; i < diagram.getNumGeometries(); i++ ) {
        Geometry geometryN = diagram.getGeometryN(i);
        Coordinate[] coordinates = geometryN.getCoordinates();
        double min = Double.POSITIVE_INFINITY;
        double max = Double.NEGATIVE_INFINITY;
        for( Coordinate coordinate : coordinates ) {
            min = Math.min(min, coordinate.z);
            max = Math.max(max, coordinate.z);
        }
        geometryN.setUserData(new String[]{"" + min, "" + max});
        geosList.add(geometryN);
    }

    outMap = FeatureUtilities.featureCollectionFromGeometry(crs, geosList.toArray(new Geometry[0]));
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:54,代码来源:OmsVoronoiDiagram.java



注:本文中的com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ActionManagerImpl类代码示例发布时间:2022-05-22
下一篇:
Java SearchCriteria类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap