本文整理汇总了Java中com.vividsolutions.jts.operation.linemerge.LineMerger.getMergedLineStrings方法的典型用法代码示例。如果您正苦于以下问题:Java LineMerger.getMergedLineStrings方法的具体用法?Java LineMerger.getMergedLineStrings怎么用?Java LineMerger.getMergedLineStrings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.operation.linemerge.LineMerger
的用法示例。
在下文中一共展示了LineMerger.getMergedLineStrings方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.vividsolutions.jts.operation.linemerge.LineMerger; //导入方法依赖的package包/类
void run() throws Exception {
Collection lineStrings = getData();
LineMerger lineMerger = new LineMerger();
lineMerger.add(lineStrings);
Collection mergedLineStrings = lineMerger.getMergedLineStrings();
System.out.println("Lines formed (" + mergedLineStrings.size() + "):");
System.out.println(mergedLineStrings);
}
示例2: dissolveLines
import com.vividsolutions.jts.operation.linemerge.LineMerger; //导入方法依赖的package包/类
private Geometry dissolveLines(Geometry lines) {
Geometry dissolved = lines.union();
LineMerger merger = new LineMerger();
merger.add(dissolved);
Collection mergedColl = merger.getMergedLineStrings();
Geometry merged = lines.getFactory().buildGeometry(mergedColl);
return merged;
}
示例3: mergeLinestrings
import com.vividsolutions.jts.operation.linemerge.LineMerger; //导入方法依赖的package包/类
/**
* Tries to merge multilines when they are snapped properly.
*
* @param multiLines the lines to merge.
* @return the list of lines, ideally containing a single line,merged.
*/
@SuppressWarnings("unchecked")
public static List<LineString> mergeLinestrings( List<LineString> multiLines ) {
LineMerger lineMerger = new LineMerger();
for( int i = 0; i < multiLines.size(); i++ ) {
Geometry line = multiLines.get(i);
lineMerger.add(line);
}
Collection<Geometry> merged = lineMerger.getMergedLineStrings();
List<LineString> mergedList = new ArrayList<>();
for( Geometry geom : merged ) {
mergedList.add((LineString) geom);
}
return mergedList;
}
示例4: lineMerge
import com.vividsolutions.jts.operation.linemerge.LineMerger; //导入方法依赖的package包/类
public static Geometry lineMerge(Geometry g)
{
LineMerger merger = new LineMerger();
merger.add(g);
Collection lines = merger.getMergedLineStrings();
return g.getFactory().buildGeometry(lines);
}
示例5: merge
import com.vividsolutions.jts.operation.linemerge.LineMerger; //导入方法依赖的package包/类
private Collection merge(Collection linestrings) {
LineMerger merger = new LineMerger();
merger.add(linestrings);
return merger.getMergedLineStrings();
}